/* ============================================================
   HER — FILE: HER-001 · "The Continuity File"
   Design rule: the page must read as a complete printed document
   with JS disabled — CSS never hides content; JS hides just-in-time.
   All rules/borders: 1px, --hair. All accent uses: var(--accent),
   which warms from #EC4899 toward #FB7185 as the visitor progresses.
   #7A2B53 (superseded/redacted) is deliberately fixed — the past
   does not warm.
   ============================================================ */

:root {
  --ground: #0E0A12;
  --bg: #150F1A;
  --paper: #1E1626;
  --ink: #F1EAF3;
  --app: #9A8BAB;
  --hair: rgba(154, 139, 171, 0.28);
  --accent: #EC4899;
  --dim: #7A2B53;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Newsreader', Georgia, serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --pad: 24px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

[hidden] { display: none !important; }   /* .stamp's display would beat the UA rule */

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#file { background: var(--bg); }

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--app);
}

a { color: var(--accent); text-decoration: none; }

::selection { background: var(--accent); color: var(--ground); }

/* typewriter machinery (spans are created by JS) */
.chs { display: inline; }
.ch { display: inline; }
.caret-block {
  display: inline-block;
  width: 0.55em;
  height: 0.95em;
  margin-left: 1px;
  background: var(--accent);
  vertical-align: text-bottom;
}

/* ============================ RUNNING HEADER ============================ */

.run-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--pad);
  pointer-events: none;
}

.run-status { display: inline-flex; align-items: center; gap: 8px; }

.beat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  will-change: transform;
}
.heart { width: 14px; height: 14px; color: var(--accent); }
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

/* ============================== STAMPS ================================= */

.stamp {
  position: relative;
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: 5px;
  transform: rotate(var(--rot, -6deg));
  white-space: nowrap;
}
.stamp::before {           /* inner ring of the double-ring face */
  content: '';
  position: absolute;
  inset: 2.5px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  pointer-events: none;
}
.stamp .ink {              /* ink-bleed bloom, animated on opacity/scale only */
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--accent), transparent 72%);
  opacity: 0.16;
  pointer-events: none;
}

.stamp--cover {
  font-size: 14px;
  padding: 10px 18px;
  opacity: 0.7;
  --rot: -6deg;
}

.stamp--row, .stamp--owner {
  font-size: 10px;
  padding: 3px 9px;
}

.stamp--tool {
  position: fixed;
  top: 0; left: 0;
  z-index: 9;
  font-size: 10px;
  padding: 8px 12px;
  opacity: 0;
  pointer-events: none;
  will-change: transform;
  --rot: -8deg;
}

.hold-ring {
  position: fixed;
  top: 0; left: 0;
  z-index: 9;
  width: 56px; height: 56px;
  margin: -28px 0 0 -28px;
  opacity: 0;
  pointer-events: none;
}
.hold-ring circle {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transform: rotate(-90deg);
  transform-origin: center;
}

/* =============================== COVER ================================= */

.cover {
  position: relative;
  min-height: 100svh;
  background: var(--bg);
  overflow: hidden;
}

.cover-fallback {
  position: absolute;
  inset: 0;
  background: radial-gradient(55% 45% at 60% 38%, rgba(236, 72, 153, 0.05), transparent 70%);
}

.dust {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.cover-frame {
  position: absolute;
  inset: var(--pad);
  width: calc(100% - 2 * var(--pad));
  height: calc(100% - 2 * var(--pad));
  overflow: visible;
  z-index: 1;
  pointer-events: none;
}
.cover-frame rect {
  fill: none;
  stroke: var(--hair);
  stroke-width: 1px;
}

.cover-content {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.cover-meta {
  position: absolute;
  top: calc(var(--pad) + 22px);
  left: calc(var(--pad) + 24px);
  display: flex;
  flex-direction: column;
  line-height: 1.9;
  text-align: left;
}
/* no flex here — typed char spans must not become gapped flex items */
.mline--status .beat { margin-left: 8px; vertical-align: middle; }
.cover-meta .heart { width: 13px; height: 13px; }
.cover-meta .dot { width: 6px; height: 6px; }

.cover-center { text-align: center; padding: 0 var(--pad); }

.wordmark {
  font-family: var(--font-display);
  font-weight: 480;
  font-variation-settings: 'opsz' 144;
  font-size: clamp(4.5rem, 19vw, 13rem);
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}
.word-mask { display: block; overflow: hidden; }
.wordline { display: inline-block; }
.wordline .l { display: inline-block; }

.deck {
  font-style: italic;
  font-size: 1.25rem;
  color: var(--ink);
  margin-top: 1.4rem;
  opacity: 0.92;
}

.tagline { margin-top: 1.1rem; font-size: 11px; }

.stamp--cover {
  position: absolute;
  right: calc(var(--pad) + 32px);
  bottom: calc(var(--pad) + 48px);
}

.scroll-cue {
  position: absolute;
  bottom: var(--pad);
  left: 50%;
  transform: translate(-50%, 50%);
  background: var(--bg);
  padding: 2px 14px;
  color: var(--app);
  font-size: 11px;
  white-space: nowrap;
}
.scroll-cue:hover { color: var(--accent); }
.scroll-cue:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* =============================== ENTRIES ================================ */

.entry { position: relative; padding: min(14vh, 130px) var(--pad); }

.entry-inner { max-width: 880px; margin: 0 auto; }
.entry-inner--center { text-align: center; }

.kicker { display: block; margin-bottom: 2rem; }

.headline {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin-bottom: 1.6rem;
}

.prose { max-width: 38rem; color: var(--ink); opacity: 0.88; }
.entry-inner--center .prose { margin: 0 auto; }

.caption { display: block; margin-top: 2.2rem; font-size: 11px; }

.paper {
  background: var(--paper);
  border: 1px solid var(--hair);
  border-radius: 8px;
}

/* ------------------------------ entry 01 ------------------------------- */

.entry-01 .entry-inner { width: 100%; }

.spread {
  margin-top: 3.2rem;
  padding: 2.6rem 2.4rem 2rem;
}

.exchange {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 70px minmax(0, 240px);
  align-items: center;
  gap: 0;
  margin-bottom: 1.5rem;
}

.bubble {
  max-width: 330px;
  padding: 0.7rem 1.1rem;
  border-radius: 18px;
  font-size: 15.5px;
  line-height: 1.5;
}
.bubble--her {
  justify-self: start;
  background: rgba(236, 72, 153, 0.13);
  border: 1px solid rgba(236, 72, 153, 0.25);
  border-bottom-left-radius: 5px;
}
.bubble--you {
  justify-self: end;
  background: rgba(154, 139, 171, 0.10);
  border: 1px solid var(--hair);
  border-bottom-right-radius: 5px;
}

.connector {
  height: 1px;
  background: var(--accent);
  opacity: 0.55;
  transform-origin: left center;
  justify-self: stretch;
  margin: 0 10px;
}

.note { font-size: 11px; text-transform: none; letter-spacing: 0.05em; }

.spread-foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--hair);
}
.foot-label { font-size: 11px; }

.closing-line {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 340;
  font-size: clamp(1.4rem, 3vw, 2rem);
  text-align: center;
  margin-top: 3.4rem;
}

/* ------------------------------ entry 02 ------------------------------- */

.ledger-wrap { margin-top: 3rem; }

.ledger { overflow: hidden; }

.lrow {
  position: relative;
  display: grid;
  grid-template-columns: 76px 92px minmax(0, 1fr) 170px;
  align-items: center;
  gap: 12px;
  padding: 0.78rem 1.4rem;
  border-bottom: 1px solid var(--hair);
}
.lrow:last-child { border-bottom: none; }
.lrow--head { padding: 0.6rem 1.4rem; }
.lrow--head .lcell { font-size: 10px; opacity: 0.7; }

.lcell { min-width: 0; }
.lcell--title { font-size: 15.5px; }
.lcell--status { justify-self: end; text-align: right; }

.lrow--pending { cursor: pointer; touch-action: pan-y; }
.lrow--pending:focus-within,
.lrow--pending:hover { background: rgba(236, 72, 153, 0.04); }

.row-fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: 0.12;
  transform: scaleY(0);
  transform-origin: bottom;
  pointer-events: none;
}

.pending-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 0;
  color: var(--app);
}
.pending-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
.pending-btn .ring {
  width: 22px; height: 22px;
  overflow: visible;
}
.pending-btn .ring circle {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 0.06 0.045;
  animation: ring-spin 12s linear infinite;
  transform-origin: center;
}
@keyframes ring-spin { to { transform: rotate(360deg); } }

.pending-label { font-size: 10px; letter-spacing: 0.14em; }

.owner-line {
  display: block;
  font-size: 10px;
  margin-top: 4px;
  text-transform: none;
  letter-spacing: 0.06em;
}

.margin-note {
  max-width: 320px;
  margin: 1.6rem 0 0 auto;
  padding-left: 14px;
  border-left: 1px solid var(--accent);
  text-align: left;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0.05em;
}

.ledger-foot { margin-top: 1.4rem; font-size: 10px; opacity: 0.7; }

.append-line {
  margin-top: 1.2rem;
  font-size: 11.5px;
  text-transform: none;
  letter-spacing: 0.04em;
  min-height: 1.4em;
}
.append-line .accent { color: var(--accent); }

/* ------------------------------ entry 03 ------------------------------- */

.journal {
  margin-top: 3rem;
  padding: 2.4rem 2.4rem;
  max-width: 620px;
}

.jline {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--hair);
}
.jline:last-child { border-bottom: none; }

.chip {
  flex: none;
  font-size: 10px;
  padding: 1px 7px;
  border: 1px solid var(--hair);
  border-radius: 99px;
}
.chip--accent { color: var(--accent); border-color: var(--accent); }

.jtext { position: relative; font-size: 16.5px; }

.jline--old { opacity: 0.45; }   /* JS animates from 1 → 0.45; static = final state */

.strike {
  position: absolute;
  left: -2px; right: -2px;
  top: 55%;
  height: 1.5px;
  background: var(--dim);
  transform-origin: left center;
}

/* ------------------------------ entry 04 ------------------------------- */

.entry-04 {
  padding: 0;
  height: 220svh;
  overflow: clip;  /* clip stream bleed without breaking position:sticky */
}

.soul-streams {
  position: absolute;
  inset: -10% 0;
  overflow: hidden;
  pointer-events: none;
}
.stream {
  position: absolute;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 4.5em;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0.05em;
  opacity: 0.5;
  white-space: nowrap;
}
.s1 { left: 6%; }
.s2 { left: 42%; top: 14%; }
.s3 { left: 74%; top: 7%; }

.soul-sticky {
  position: sticky;
  top: 0;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: min(10vh, 80px) var(--pad);
}

.soul-card {
  position: relative;
  max-width: 420px;
  margin: 2.6rem auto 0;
  padding: 1.6rem 2rem 1.8rem;
  text-align: left;
}
.card-glow {
  position: absolute;
  inset: -1px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  opacity: 0.35;
  pointer-events: none;
}
.soul-head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  padding-bottom: 0.9rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--hair);
}
.lock { width: 14px; height: 14px; color: var(--accent); flex: none; }
.soul-lines p { opacity: 0.4; font-size: 15.5px; line-height: 1.9; }

/* ------------------------------ entry 05 ------------------------------- */

.premises {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 4rem;
  align-items: center;
}

.schematic { width: 100%; height: auto; overflow: visible; }

.sch-shape, .sch-mesh {
  fill: none;
  stroke: var(--hair);
  stroke-width: 1.2;
}
.sch-detail { fill: var(--hair); stroke: var(--hair); stroke-width: 1; }
.sch-led { fill: var(--accent); }
.sch-packet { fill: var(--accent); }
.sch-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  fill: var(--app);
}
.sch-sub { font-size: 9.5px; opacity: 0.75; }
.sch-redact { fill: var(--dim); transform-box: fill-box; transform-origin: left center; }
.sch-cloud-group .sch-label { opacity: 0.6; }

/* ------------------------------ entry 06 ------------------------------- */

.credits {
  margin-top: 3rem;
  max-width: 640px;
  padding: 2.2rem 2.4rem;
}

.credit {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 0.7rem 0;
}

.role { flex: none; font-size: 11px; }
.leader {
  flex: 1;
  border-bottom: 1px dotted rgba(154, 139, 171, 0.45);
  transform-origin: left center;
  align-self: center;
  height: 1px;
  margin-bottom: 0.25em;
}
.value { flex: none; font-size: 15px; opacity: 0.9; max-width: 60%; text-align: right; }

/* =============================== COLOPHON =============================== */

.colophon {
  background: var(--ground);
  text-align: center;
  padding: min(20vh, 180px) var(--pad) min(14vh, 120px);
}

.final-line {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 340;
  font-size: clamp(1.8rem, 4.5vw, 3rem);
}

.colo-heart { margin-top: 2.2rem; display: flex; justify-content: center; }
.colo-heart .heart { width: 18px; height: 18px; }
.colo-heart .dot { width: 8px; height: 8px; }

.colo-status { margin-top: 0.9rem; font-size: 11px; text-transform: lowercase; }

.colo-block { margin-top: 4rem; }
.colo-block p { margin-top: 0.5rem; }
.colo-block .colo-item:not(.mono) { font-size: 15px; opacity: 0.75; }
.colo-fine { font-size: 10px; opacity: 0.8; margin-top: 1.4rem !important; }

.colo-sign {
  margin-top: 4.5rem;
  font-size: 11.5px;
  text-transform: lowercase;
}
.colo-entry {
  margin-top: 0.7rem;
  font-size: 11.5px;
  text-transform: uppercase;
}

.caret {
  display: inline-block;
  width: 0.55em;
  height: 0.95em;
  margin-left: 3px;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: caret-blink 1s steps(2, jump-none) infinite;
}
@keyframes caret-blink { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }

/* ============================ REDUCED MOTION ============================ */

@media (prefers-reduced-motion: reduce) {
  .pending-btn .ring circle { animation-play-state: paused; }
  .caret { animation: none; }
  .dust { display: none; }
}

/* ================================ MOBILE ================================ */

@media (max-width: 768px) {
  :root { --pad: 16px; }

  .run-header { height: 40px; }

  .cover-frame {
    inset: 14px;
    width: calc(100% - 28px);
    height: calc(100% - 28px);
  }
  .cover-meta {
    top: 38px;
    left: 34px;
  }
  /* compress metadata: keep FILE / STATUS / DISPOSITION */
  .cover-meta .mline:nth-child(3),
  .cover-meta .mline:nth-child(4) { display: none; }

  .stamp--cover {
    position: static;
    margin-top: 2.6rem;
    display: inline-block;
  }
  .cover-center { display: flex; flex-direction: column; align-items: center; }
  .scroll-cue { bottom: 14px; font-size: 10px; }

  .entry { padding: min(12vh, 96px) var(--pad); }

  .spread { padding: 1.6rem 1.2rem 1.4rem; }
  .exchange {
    grid-template-columns: 1fr;
    margin-bottom: 1.8rem;
  }
  .connector { display: none; }
  .bubble--you { justify-self: end; }
  .note {
    margin-top: 0.7rem;
    margin-left: 1rem;
    padding-left: 12px;
    border-left: 1px solid var(--accent);
  }
  .spread-foot { flex-direction: column; gap: 0.6rem; }
  .foot-label { font-size: 10px; }

  /* ledger rows become two-line stacked cards */
  .lrow {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      'id   day'
      'title status';
    row-gap: 6px;
    padding: 0.9rem 1rem;
    min-height: 44px;
  }
  /* visually hidden, not display:none — keeps columnheader role in AT */
  .lrow--head {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px;
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
  }
  .lrow .lcell:nth-child(1 of .lcell) { grid-area: id; }
  .lrow .lcell:nth-child(2 of .lcell) { grid-area: day; justify-self: end; font-size: 10px; opacity: 0.7; }
  .lrow .lcell--title { grid-area: title; font-size: 15px; }
  .lrow .lcell--status { grid-area: status; }
  .margin-note { margin: 1.4rem 0 0; }

  .journal { padding: 1.6rem 1.2rem; }

  .entry-04 { height: 200svh; }
  .s1 { left: 4%; }
  .s2 { left: 52%; top: 16%; display: flex; }
  .s3 { display: none; }   /* two streams on mobile */
  .stream { font-size: 10px; gap: 4em; }

  .premises { grid-template-columns: 1fr; gap: 3rem; }
  .schematic { max-width: 340px; margin: 0 auto; }

  .credits { padding: 1.6rem 1.2rem; }
  .credit { flex-wrap: wrap; row-gap: 2px; }
  .value { max-width: 100%; }

  .closing-line { margin-top: 2.6rem; }
}

@media (max-width: 479px) {
  .mono { font-size: 11px; }
  .lrow { grid-template-columns: auto 1fr; }
}

/* the ledger pin must fit one phone viewport — compact entry-02 on mobile */
@media (max-width: 768px) {
  .entry-02 { padding-block: min(8vh, 64px); }
  .entry-02 .kicker { margin-bottom: 1.2rem; }
  .entry-02 .headline { font-size: 1.7rem; margin-bottom: 1rem; }
  .entry-02 .prose { font-size: 15.5px; }
  .entry-02 .ledger-wrap { margin-top: 1.2rem; }
  .entry-02 .lrow { padding: 0.6rem 1rem; row-gap: 4px; }
  .entry-02 .lcell--title { font-size: 14px; }
  .entry-02 .stamp--row, .entry-02 .stamp--owner { font-size: 9px; padding: 2px 7px; }
}

/* ============= SHORT VIEWPORTS — pinned sections must fit ============== */

@media (max-height: 760px) {
  .entry { padding-block: 48px; }
  .kicker { margin-bottom: 1.1rem; }
  .headline { font-size: clamp(1.7rem, 4vw, 2.3rem); margin-bottom: 1rem; }
  .prose { font-size: 15.5px; }
  .caption { margin-top: 1.2rem; }

  .spread { margin-top: 1.2rem; padding: 1.1rem 1.4rem 1rem; }
  .exchange { margin-bottom: 0.8rem; }
  .bubble { padding: 0.5rem 0.95rem; font-size: 14.5px; }
  .spread-foot { margin-top: 0.9rem; padding-top: 0.7rem; }
  .closing-line { margin-top: 1.2rem; font-size: 1.25rem; }

  .ledger-wrap { margin-top: 1.4rem; }
  .lrow, .lrow--head { padding: 0.45rem 1.4rem; }
  .lcell--title { font-size: 14px; }
  .stamp--row, .stamp--owner { font-size: 9px; padding: 2px 7px; }
  .margin-note { margin-top: 0.9rem; font-size: 10px; }
  .ledger-foot { margin-top: 0.8rem; }
  .append-line { margin-top: 0.7rem; }

  .journal { margin-top: 1.6rem; padding: 1.4rem 1.6rem; }
  .jline { padding: 0.55rem 0; }
}

/* short + wide (1366x768-class laptops): the ledger sits beside its text,
   so the whole pinned entry fits one viewport without shrinking further */
@media (max-height: 760px) and (min-width: 1000px) {
  .entry-02 .entry-inner {
    max-width: 1160px;
    display: grid;
    grid-template-columns: minmax(280px, 340px) 1fr;
    column-gap: 3.5rem;
    align-content: center;
  }
  .entry-02 .kicker, .entry-02 .headline, .entry-02 .prose { grid-column: 1; }
  .entry-02 .ledger-wrap { grid-column: 2; grid-row: 1 / span 3; margin-top: 0; }
}
