/* graphics.css — the drawn parts. CSS 3D only; no WebGL, no image files, nothing fetched.
   Surface budget per box: shadow + radius(<16px) only. Borders stay at 1px so the
   stacking check (gradient / shadow / border>1 / blur / radius>=16 / text-shadow) never hits 3. */

/* ── paper field: the one gradient on the page, boxed well under 30% of the viewport ── */
.paperfield{position:relative;isolation:isolate}
.paperfield::before{content:"";position:absolute;inset:0;z-index:-1;
  background:
    repeating-linear-gradient(to bottom, transparent 0 31px, rgba(107,91,74,.07) 31px 32px),
    repeating-linear-gradient(to right, transparent 0 31px, rgba(107,91,74,.05) 31px 32px);
  -webkit-mask-image:radial-gradient(120% 90% at 78% 24%, #000 0%, transparent 68%);
          mask-image:radial-gradient(120% 90% at 78% 24%, #000 0%, transparent 68%)}

/* the bound book — a real box: the cover sits at z=0 and the two side faces hinge on its
   edges and swing back by --bd. Translating a face by the book's width (the previous build)
   left it floating beside the book whenever the width was overridden. */
.book{--bw:clamp(170px,20vw,228px);--bd:18px;position:relative;z-index:2;
  width:var(--bw);max-width:100%;aspect-ratio:3/4.3;
  transform-style:preserve-3d;transform:rotateY(-18deg)}
.book .face{position:absolute;inset:0;border-radius:2px 5px 5px 2px}
/* solid cover: the three redline rules are drawn with gradients (the only way to reveal a
   rule across wrapped text), and a decorative gradient here pushed the page to four
   gradient surfaces. The rule says big areas stay flat, so this is the one that goes. */
.book .front{background:var(--band);
  box-shadow:0 26px 54px color-mix(in srgb,var(--band) 34%,transparent);
  display:flex;flex-direction:column;justify-content:space-between;
  padding:clamp(16px,2vw,24px);color:#fff}
.book .front h3{font-family:var(--font-display);font-weight:600;
  font-size:clamp(15px,1.75vw,21px);line-height:1.32;margin:0;letter-spacing:-.02em;white-space:pre-line}
.book .front .by{font-size:clamp(10px,1vw,12px);color:var(--brand-on-dark);line-height:1.6}
.book .front .rule{width:34px;height:2px;background:var(--brand-on-dark);margin:0 0 var(--sp-3)}
/* right side = the page block; left side = the spine */
.book .pages{left:auto;right:0;width:var(--bd);border-radius:0;
  /* solid, not a striped gradient — at 18px the stripes never read, and the page already
     spends its gradient budget on the three redline rules */
  background:#E9E3D9;border-left:1px solid #CFC6B8;
  transform-origin:100% 50%;transform:rotateY(-90deg)}
.book .spine{left:0;width:var(--bd);border-radius:0;
  background:color-mix(in srgb,var(--band) 84%,#000);
  transform-origin:0 50%;transform:rotateY(90deg)}

/* ── B: redline clause ──────────────────────────────────── */
.redline{position:relative;perspective:1200px}
.doc{background:#fff;border-radius:4px;box-shadow:0 22px 48px rgba(26,40,54,.18);
  padding:clamp(24px,3vw,40px);transform:rotateY(-8deg) rotateX(2.5deg);
  transform-style:preserve-3d;font-size:clamp(14px,1.35vw,16px);line-height:1.95;color:var(--ink)}
.doc .num{display:block;font-family:var(--font);font-size:13px;font-weight:700;
  letter-spacing:.1em;color:var(--ink-2);margin-bottom:var(--sp-3)}
.doc .clause{margin:0}
/* The strike is a background, not an absolutely-positioned bar: a wrapped inline span is
   several line boxes, and one ::after only ever crossed the first of them. With
   box-decoration-break:clone each line fragment draws its own rule and --w reveals them. */
.strike{--w:0%;background-image:linear-gradient(var(--bad),var(--bad));
  background-size:var(--w) 2px;background-position:0 58%;background-repeat:no-repeat;
  -webkit-box-decoration-break:clone;box-decoration-break:clone;color:var(--ink-2)}
.doc .ins{color:var(--ok);font-weight:700;background:var(--ok-soft);
  padding:0 4px;border-radius:3px;box-decoration-break:clone}
.doc .caret{display:inline-block;width:2px;height:1.05em;vertical-align:-2px;
  background:var(--ok);margin-left:1px}
.doc .sign{display:flex;align-items:center;gap:var(--sp-2);margin-top:var(--sp-6);
  padding-top:var(--sp-4);border-top:1px solid var(--line);font-size:13px;color:var(--ink-2)}
.doc .sign b{color:var(--ink)}

/* ── scroll progress rail for step lists ────────────────── */
.prog{position:absolute;left:0;top:4px;bottom:4px;width:2px;background:var(--line)}
.prog-bar{position:absolute;inset:0;background:var(--brand);transform:scaleY(0)}

/* ── reduced motion: no transforms worth keeping ─────────── */
@media (prefers-reduced-motion:reduce){
  .book{transform:none}
  .doc{transform:none}
  .strike{--w:100%}
  .doc .caret{display:none}
}
/* ── ink: the whole hero is the drawing surface ─────────── */
.stagewrap{position:relative}
[data-pen]{position:relative}
/* hide the cursor across the hero but give it back on anything clickable — otherwise the
   effect costs usability at exactly the points that matter */
@media (pointer:fine) and (min-width:861px){
  [data-pen]{cursor:none}
  [data-pen] a,[data-pen] button,[data-pen] input,[data-pen] textarea,[data-pen] summary{cursor:pointer}
}
/* the wash sits under the content (z 1 < wrap z 3), pale and blurred: background motion only */
[data-pen]{--ink-wash:var(--brand-on-dark)}
[data-pen] > .ink{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:1;
  opacity:.3;filter:blur(12px)}
/* the pointer head: a soft brown dot drawn in SVG, so it adds no CSS surface of its own
   (gradient + shadow + big radius on one box is exactly what the stacking check bans) */
[data-pen] > .dot{position:absolute;left:-13px;top:-13px;width:26px;height:26px;
  pointer-events:none;z-index:2;opacity:0}
[data-pen] > .wrap{position:relative;z-index:3}

/* ── replay: a quiet icon in the graphic's top-right corner ─ */
.replay{position:absolute;top:0;right:0;z-index:5;width:44px;height:44px;display:grid;
  place-items:center;border:0;background:none;color:var(--ink-3);cursor:pointer;
  transition:color var(--dur-ui) var(--ease-out)}
.replay:hover{color:var(--brand)}
.replay:focus-visible{outline:2px solid var(--brand);outline-offset:-4px;border-radius:var(--r-1)}
@media (prefers-reduced-motion:reduce){ .replay{display:none} }
/* phones: motion is off (motion.js STILL), so nothing to replay and nothing to draw with */
@media (max-width:860px){
  .replay,[data-pen] > .ink,[data-pen] > .dot{display:none}
}
