/* ---------------------------------------------------------------------------
   The Ike series — shared theme.
   Carries the ikeanalytics register: dark editorial, cream Didone display,
   ike red as intrusive emphasis, gold as reminder.

   The three story voices are the palette. Oxblood narrates, gold is a Keeper
   speaking, teal is Ike. Cream is never used for story text.
--------------------------------------------------------------------------- */

:root{
  --ink:#0A0A0A;
  --ink-2:#111111;
  --border:rgba(242,242,240,0.09);
  --cream:#F2F2F0;
  --dim:#8b8377;
  --faint:#4a463f;

  --gold:#d4a017;
  --red:#c41e3a;

  /* Story voices. Both are their true colours lifted until they survive on
     near-black; true oxblood (#4a0e0e) is unreadable as body text here. */
  --oxblood:#a8443c;
  --teal:#3D9C9E;

  --display:'Didot','Bodoni MT','Playfair Display',Georgia,serif;
  --body:Georgia,'Iowan Old Style','Times New Roman',serif;
  --meta:'JetBrains Mono',ui-monospace,'SF Mono',Menlo,monospace;

  --frame:min(1100px,92vw);
}

*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  background:var(--ink);
  color:var(--cream);
  font-family:var(--body);
  -webkit-font-smoothing:antialiased;
}
a{color:inherit}

/* ---------- the rule that runs under every header ---------- */
.signature-rule{
  height:3px;width:100%;max-width:var(--frame);
  background:linear-gradient(90deg,var(--gold),var(--teal),var(--red));
  opacity:.85;
}

/* ---------- site chrome ---------- */
.masthead{
  display:flex;align-items:baseline;gap:1.2rem;
  width:var(--frame);margin:0 auto;padding:2.2rem 0 1rem;
  font-family:var(--meta);font-size:.7rem;letter-spacing:.34em;text-transform:uppercase;
  color:var(--dim);
}
.masthead .brand{color:var(--cream);letter-spacing:.28em}
.masthead .spacer{flex:1}
.masthead a{text-decoration:none;color:var(--dim)}
.masthead a:hover{color:var(--gold)}

/* ---------- title page ---------- */
.title{
  min-height:100svh;
  display:flex;flex-direction:column;justify-content:center;align-items:center;
  text-align:center;padding:8vh 6vw;gap:.5rem;
}
.title .num{
  font-family:var(--meta);
  font-size:.7rem;letter-spacing:.42em;text-transform:uppercase;
  color:var(--dim);margin-bottom:1.6rem;
}
.title h1{
  font-family:var(--display);
  font-size:clamp(2.2rem,6.4vw,4.6rem);
  font-weight:400;line-height:1.04;letter-spacing:.01em;margin:0;
  color:var(--cream);
}
.title .sub{color:var(--dim);font-size:.95rem;font-style:italic;margin-top:1.4rem}

/* ---------- one beat per screen ---------- */
.panel{
  min-height:100svh;
  display:flex;flex-direction:column;justify-content:center;align-items:center;
  padding:8vh 0;gap:clamp(1.5rem,4vh,3rem);
}
.stage{
  position:relative;width:var(--frame);aspect-ratio:16/9;
  background:#000;overflow:hidden;
}
.stage img.plate,.stage video.plate{
  position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;
}
.stage .missing{
  position:absolute;inset:0;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5rem;
  background:repeating-linear-gradient(45deg,#141414 0 12px,#101010 12px 24px);
  color:var(--faint);font-family:var(--meta);
  font-size:.72rem;letter-spacing:.28em;text-transform:uppercase;
}
.stage .missing b{color:#6b655b;font-size:1.4rem;letter-spacing:.1em}

/* ---------- the words ---------- */
.words{
  width:var(--frame);max-width:62ch;
  font-size:clamp(1.05rem,1.55vw,1.32rem);line-height:1.72;
}
.words p{margin:0 0 1.1em;color:var(--oxblood)}   /* narration */
.words p:last-child{margin-bottom:0}
.words p.k{color:var(--gold);font-style:italic}   /* a Keeper speaking */
.words p.t{color:var(--teal)}                     /* Ike, thought or spoken */

/* ---------- a mark, legible on hover. a footnote, not a tooltip ---------- */
.mark{
  border-bottom:1px dotted color-mix(in srgb,var(--teal) 55%,transparent);
  cursor:help;position:relative;
}
.mark .gloss{
  position:absolute;left:0;top:calc(100% + .5rem);
  width:min(30ch,70vw);
  font-family:var(--meta);font-size:.68rem;line-height:1.6;letter-spacing:.02em;
  color:var(--dim);background:var(--ink-2);
  border:1px solid var(--border);border-left:2px solid var(--teal);
  padding:.6rem .7rem;
  opacity:0;visibility:hidden;transition:opacity .18s ease;
  z-index:5;text-transform:none;
}
.mark:hover .gloss,.mark:focus .gloss{opacity:1;visibility:visible}

/* ---------- end of chapter ---------- */
.end{
  min-height:70svh;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:1.1rem;text-align:center;color:var(--dim);padding:6vh 6vw;
}
.end .mark-glyph{color:var(--gold);letter-spacing:.4em;font-size:.8rem}
.end .limit{
  font-family:var(--meta);font-size:.66rem;letter-spacing:.24em;
  text-transform:uppercase;color:var(--faint);margin-top:1.6rem;
}
.end nav{display:flex;gap:2rem;margin-top:1.4rem;font-family:var(--meta);
  font-size:.7rem;letter-spacing:.24em;text-transform:uppercase}
.end nav a{text-decoration:none;color:var(--dim)}
.end nav a:hover{color:var(--gold)}

/* ---------- shelf ---------- */
.shelf{width:var(--frame);margin:0 auto;padding:4vh 0 12vh}
.shelf h1{
  font-family:var(--display);font-weight:400;
  font-size:clamp(2rem,5vw,3.4rem);line-height:1.06;margin:.4rem 0 .6rem;
}
.shelf .lede{color:var(--dim);max-width:60ch;line-height:1.7;margin:0 0 3rem}
.arc{margin-bottom:3.2rem}
.arc > h2{
  font-family:var(--meta);font-size:.7rem;letter-spacing:.3em;text-transform:uppercase;
  color:var(--dim);margin:0 0 .5rem;
}
.arc > .arc-note{color:var(--faint);font-size:.82rem;line-height:1.7;margin:0 0 1.4rem;max-width:62ch}
.rows{display:flex;flex-direction:column;gap:1px;background:var(--border)}
.row{
  display:flex;gap:1.2rem;align-items:baseline;
  background:var(--ink);padding:1.1rem .2rem;text-decoration:none;
  transition:background .15s ease;
}
.row:hover{background:var(--ink-2)}
.row .idx{font-family:var(--meta);font-size:.68rem;letter-spacing:.2em;color:var(--faint);width:5ch;flex:none}
.row .name{font-family:var(--display);font-size:1.3rem;color:var(--cream)}
.row .what{color:var(--dim);font-size:.86rem;flex:1}
.row .state{font-family:var(--meta);font-size:.62rem;letter-spacing:.2em;text-transform:uppercase;color:var(--faint)}
.row.unwritten{opacity:.42;pointer-events:none}
.row.unwritten .name{color:var(--dim)}

/* ---------- riverbed ---------- */
.bed{width:var(--frame);margin:0 auto;padding:4vh 0 12vh}
.bed h1{font-family:var(--display);font-weight:400;font-size:clamp(2rem,5vw,3.2rem);margin:.4rem 0 .6rem}
.bed .lede{color:var(--dim);max-width:62ch;line-height:1.7;margin:0 0 3rem}
.stones{display:flex;flex-wrap:wrap;gap:14px;margin-bottom:2.4rem}
.stone{
  width:230px;background:var(--ink-2);border:1px solid var(--border);
  border-left:2px solid var(--teal);padding:14px 16px;
}
.stone .ref{font-family:var(--meta);font-size:.62rem;letter-spacing:.2em;color:var(--faint)}
.stone .what{font-family:var(--display);font-size:1.15rem;color:var(--teal);margin:.35rem 0 .5rem}
.stone .rec{font-size:.84rem;line-height:1.65;color:var(--dim)}
.stone .paid{
  font-family:var(--meta);font-size:.6rem;letter-spacing:.18em;text-transform:uppercase;
  color:var(--faint);margin-top:.7rem;display:block;
}
.stone.unpaid .paid{color:#6b655b}
.bed .note{
  color:var(--faint);font-size:.82rem;line-height:1.75;max-width:68ch;
  border-left:2px solid var(--border);padding-left:1rem;
}

@media (max-width:640px){
  :root{--frame:94vw}
  .panel{gap:1.4rem;padding:6vh 0}
  .row{flex-wrap:wrap;gap:.5rem}
  .stone{width:100%}
}

/* ---------- a mark you have kept ----------
   Feedback without a popup. The dotted line closes up, because the mark is
   yours now and the record is no longer provisional. */
.mark.kept{
  border-bottom-style:solid;
  border-bottom-color:var(--teal);
  color:var(--teal);
}
.mark.kept .gloss::after{
  content:'kept';
  display:block;margin-top:.5rem;
  color:var(--teal);letter-spacing:.2em;text-transform:uppercase;font-size:.58rem;
}

/* ---------- your record, stated at the end of a chapter ---------- */
.end .yours{
  font-family:var(--meta);font-size:.66rem;letter-spacing:.2em;text-transform:uppercase;
  color:var(--faint);margin-top:.4rem;
}
.end .yours b{color:var(--teal);font-weight:400}

/* ---------- riverbed: empty state and controls ---------- */
.bed .empty{
  border:1px dashed var(--border);padding:2rem 1.6rem;max-width:62ch;
  color:var(--dim);line-height:1.75;font-size:.92rem;
}
.bed .empty a{color:var(--teal)}
.bed .controls{
  display:flex;gap:2rem;align-items:baseline;margin:2.4rem 0 1rem;
  font-family:var(--meta);font-size:.66rem;letter-spacing:.2em;text-transform:uppercase;
}
.bed .controls .count{color:var(--dim)}
.bed .controls .count b{color:var(--teal);font-weight:400}
.bed .controls button{
  background:none;border:0;padding:0;cursor:pointer;color:var(--faint);
  font:inherit;letter-spacing:inherit;text-transform:inherit;
}
.bed .controls button:hover{color:var(--red)}

/* [hidden] loses to display:flex. Make it win. */
.bed .controls[hidden]{display:none}
