/* 02 · How it works: a short scroll story. The section pins to the screen while the reader scrolls through three
   scenes (story.js turns the scroll into progress): the admin panel filling with policies, the side panel searching and
   answering, the admin panel turning a gap into a clause. Elements switch on at their own point of the scroll
   (data-at) and move on the site's springs, so scrolling back plays it in reverse. Phones get the same story, stacked
   and simplified. Without JavaScript it is a plain list of the three steps. */

.story { position: relative; height: 330vh; }
.story-sticky { position: sticky; top: 0; height: 100vh; height: 100svh; display: flex; align-items: center; overflow: hidden; }
.story-grid { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: 56px; align-items: center; width: 100%; }

/* ---------- The three steps, with a rail that fills as the story plays ---------- */
.story-steps { position: relative; list-style: none; margin: 0; padding: 0 0 0 26px; display: grid; gap: 22px; }
.story-step { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 6px; opacity: .3; transition: opacity .5s var(--ease), transform .7s var(--spring); }
.story-step.on { opacity: 1; transform: translateX(6px); }
.story-step .step-n { font-family: var(--serif); font-size: 46px; line-height: .85; color: var(--marker); }
.story-step .h3 { margin: 4px 0 0; }
.story-step p { margin: 8px 0 0; max-width: 46ch; color: var(--text-2); max-height: 0; overflow: hidden; opacity: 0; transition: max-height .7s var(--spring), opacity .4s var(--ease); }
.story-step.on p { max-height: 220px; opacity: 1; }
.story-rail { position: absolute; left: 0; top: 4px; bottom: 4px; width: 2px; border-radius: 2px; background: var(--border); list-style: none; }
.story-rail i { position: absolute; inset: 0; border-radius: 2px; transform-origin: top; transform: scaleY(var(--p, 0)); background: var(--marker); box-shadow: 0 0 14px rgba(255,122,0,.55); }

/* ---------- The stage and its scenes ---------- */
.story-stage { position: relative; height: min(560px, 74vh); }
.scene { position: absolute; inset: 0; opacity: 0; transform: translateY(28px) scale(.965); transition: opacity .55s var(--ease), transform .9s var(--spring); pointer-events: none; }
.scene.on { opacity: 1; transform: none; }
.scene.past { transform: translateY(-28px) scale(.965); }
.sc-note { position: absolute; right: 6px; bottom: -34px; font-size: 21px; transform: rotate(-2deg); white-space: nowrap; }
.story [data-at] { opacity: 0; transform: translateY(8px) scale(.98); transition: opacity .35s var(--ease), transform .6s var(--spring-bouncy); }
.story [data-at].on { opacity: 1; transform: none; }

/* ---------- Admin panel mockup ---------- */
.sc-console { display: grid; grid-template-rows: auto minmax(0, 1fr); border-radius: 16px; border: 1px solid var(--border-strong); background: #0F0F11; overflow: hidden;
  box-shadow: 0 50px 90px -40px rgba(0,0,0,.9), 0 0 0 6px rgba(7,7,8,.5); }
.sc-console .sc-note { bottom: -36px; }
.win-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: #131315; }
.win-bar i { width: 9px; height: 9px; border-radius: 50%; background: #2A2A2F; }
.win-url { margin-left: 10px; padding: 3px 10px; border-radius: 6px; background: #1A1A1D; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.win-body { display: grid; grid-template-columns: 150px minmax(0, 1fr); min-height: 0; }
.mini-nav { display: grid; align-content: start; gap: 2px; padding: 14px 10px; border-right: 1px solid var(--border); background: #111113; font-size: 11.5px; color: var(--muted); }
.mini-nav span { padding: 6px 8px; border-radius: 7px; }
.mini-nav .on { color: var(--text); background: rgba(255,122,0,.12); box-shadow: inset 2px 0 0 var(--marker); }
.mini-nav .mini-logo { margin: 0 0 10px 2px; padding: 0; font-size: 17px; color: var(--text); }
.win-main { display: grid; align-content: start; gap: 12px; min-width: 0; padding: 22px 24px; overflow: hidden; }
.mini-eyebrow { margin: 0; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.mini-title { margin: -4px 0 2px; font-family: var(--serif); font-size: 34px; line-height: 1; color: var(--text); }
.mini-title em { font-style: italic; color: var(--marker); }
.mini-drop { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-file { padding: 4px 9px; border-radius: 7px; border: 1px dashed var(--border-strong); font-family: var(--mono); font-size: 10.5px; color: var(--text-2); }
.mini-list { border: 1px solid var(--border); border-radius: 12px; background: #141416; overflow: hidden; }
.mini-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--border); }
.mini-row:first-child { border-top: 0; }
.mini-ico { width: 26px; height: 26px; border-radius: 8px; background: rgba(255,122,0,.12); border: 1px solid rgba(255,122,0,.35); }
.mini-row.internal .mini-ico { background: rgba(240,192,112,.1); border-color: rgba(240,192,112,.38); }
.mini-main b { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); }
.mini-main small { font-size: 10.5px; color: var(--muted); }
.story .mini-state[data-at] { opacity: 1; transform: none; }
.mini-state s, .mini-state em, .mini-chip { padding: 2px 8px; border-radius: 999px; font-family: var(--mono); font-size: 9.5px; font-style: normal; text-decoration: none; white-space: nowrap; }
.mini-state s { color: var(--muted); border: 1px solid var(--border-strong); }
.mini-state em { display: none; color: #8BD3A5; border: 1px solid rgba(139,211,165,.35); background: rgba(139,211,165,.1); }
.mini-state.on s { display: none; }
.mini-state.on em { display: inline-block; animation: mini-pop .5s var(--spring-bouncy) both; }
@keyframes mini-pop { from { transform: scale(.7); opacity: 0; } }
.mini-chip { color: #F0C070; border: 1px solid rgba(240,192,112,.35); background: rgba(240,192,112,.08); }
.mini-ai { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; border: 1px solid rgba(255,122,0,.35); background: rgba(255,122,0,.08); font-size: 11.5px; color: var(--text); }
.mini-spark { display: inline-block; color: var(--marker); animation: mini-spin 1.6s linear infinite; }
.mini-ai.done .mini-spark { animation: none; }
@keyframes mini-spin { to { transform: rotate(360deg); } }
.mini-bar { position: relative; flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.mini-bar i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); border-radius: 3px; background: var(--marker); }
.mini-label { display: block; margin-bottom: 6px; font-family: var(--mono); font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }

/* ---------- Side panel mockup (the hero's panel, in the middle of the stage) ---------- */
.sc-panel { display: flex; align-items: center; justify-content: center; }
.story .story-panel { position: relative; inset: auto; margin: 0; width: min(390px, 100%); max-width: none; top: auto; left: auto; }
.story-panel .panel-tabs span { transition: color .3s var(--ease), border-color .3s var(--ease); }
.sc-panel.asking .t-search, .sc-panel:not(.asking) .t-ask { color: var(--muted); border-bottom-color: transparent; }
.sc-panel.asking .t-ask, .sc-panel:not(.asking) .t-search { color: var(--marker); border-bottom-color: var(--marker); }
.sp-search { display: grid; gap: 7px; padding: 12px 14px 16px; }
.sc-panel.asking .sp-search, .sc-panel:not(.asking) .sp-ask { display: none; }
.sp-typed::after { content: ""; display: inline-block; width: 1px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--marker); animation: kcaret 1s steps(1) infinite; }
.sp-hit { display: flex; gap: 10px; padding: 10px 11px; border-radius: 9px; background: var(--bg-2); border: 1px solid var(--border); font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.sp-hit b { display: block; margin-bottom: 2px; font-weight: 600; color: var(--text); }
.sp-ref { flex: none; align-self: flex-start; font-family: var(--serif); font-size: 14px; color: var(--marker); }
.sp-hit mark, .sp-clause mark { padding: 0 2px; border-radius: 3px; color: inherit; background: rgba(255,214,120,.24); box-shadow: inset 0 -1px 0 rgba(255,214,120,.6); }
.sp-ask { padding-bottom: 14px; }
.sp-think { display: flex; align-items: center; gap: 5px; margin: 10px 14px 0; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.sp-think span { width: 5px; height: 5px; border-radius: 50%; background: var(--marker); animation: sp-blink 1s infinite; }
.sp-think span:nth-child(2) { animation-delay: .15s; } .sp-think span:nth-child(3) { animation-delay: .3s; }
@keyframes sp-blink { 50% { opacity: .25; } }
.sp-think.gone { display: none; }
.sp-answer { margin: 10px 14px 0; padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2); }
.sp-clause { margin: 10px 0 12px; padding: 10px 12px; border-radius: 8px; background: #EFE9DE; color: #2A2620; font-family: var(--serif); font-size: 14.5px; line-height: 1.45; }
.sp-clause .sp-ref { display: block; margin-bottom: 4px; font-family: var(--mono); font-size: 10.5px; color: #8A4A00; }
.sp-clause p { margin: 0; }
.sp-clause mark { background: rgba(255,144,41,.38); box-shadow: inset 0 -1.5px 0 rgba(178,92,10,.55); }
.sp-reply { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--text); }

/* ---------- Gaps mockup ---------- */
.gap-card { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; padding: 11px 13px; border-radius: 11px; border: 1px solid rgba(255,122,89,.32); background: rgba(255,122,89,.06); }
.gap-q { font-family: var(--serif); font-size: 17px; color: var(--text); }
.gap-chip { font-family: var(--mono); font-size: 10px; color: #FF9A7A; }
.gap-note { padding: 10px 12px; border-radius: 11px; border: 1px solid var(--border-strong); background: #141416; }
.gap-typed { min-height: 1.5em; margin: 0; font-size: 13px; line-height: 1.5; color: var(--text); }
.gap-typed::after { content: ""; display: inline-block; width: 1px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--marker); animation: kcaret 1s steps(1) infinite; }
.gap-draft { display: grid; gap: 6px; padding: 12px 14px; border-radius: 10px; background: #EFE9DE; color: #2A2620; box-shadow: 0 14px 30px -18px #000; }
.gap-ref { font-family: var(--mono); font-size: 10.5px; color: #8A4A00; }
.gap-draft p { margin: 0; font-family: var(--serif); font-size: 15px; line-height: 1.45; }
.gap-draft b { font-weight: 600; color: #16130E; }
.gap-draft mark { padding: 0 2px; border-radius: 3px; color: inherit; background: rgba(255,144,41,.32); }
.story .gap-publish[data-at] { opacity: 1; transform: none; }
.gap-publish { display: flex; align-items: center; gap: 10px; margin-top: 4px; font-size: 12px; }
.gp-btn { padding: 5px 12px; border-radius: 8px; background: var(--marker); color: #1A0E03; font-weight: 600; }
.gp-done { display: none; color: #1E6B45; font-weight: 600; }
.gap-publish.on .gp-btn { display: none; }
.gap-publish.on .gp-done { display: inline; animation: mini-pop .5s var(--spring-bouncy) both; }

/* ---------- Phones: the same story, stacked and simplified ---------- */
@media (max-width: 899px) {
  .story { height: 300vh; }
  .story-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: center; }
  .story-stage { order: -1; height: min(56svh, 440px); }
  .story-steps { min-height: 168px; padding-left: 18px; gap: 0; }
  .story-step { position: absolute; top: 0; left: 18px; right: 0; opacity: 0; transform: translateY(10px); }
  .story-step.on { opacity: 1; transform: none; }
  .story-step p { max-height: none; opacity: 1; font-size: 15px; }
  .story-step .step-n { font-size: 38px; }
  .win-body { grid-template-columns: minmax(0, 1fr); }
  .mini-nav, .sc-note, .win-url { display: none; }
  .win-main { gap: 9px; padding: 14px 14px 16px; }
  .mini-title { font-size: 25px; }
  .mini-drop { display: none; }
  .mini-row { padding: 8px 10px; }
  .gap-q { font-size: 15px; }
  .gap-draft p { font-size: 13.5px; }
  .sp-hit:nth-of-type(n + 4) { display: none; }
}

/* ---------- No JavaScript: three plain steps. Reduced motion: the same states, without the movement. ---------- */
.no-js .story { height: auto; }
.no-js .story-sticky { position: static; height: auto; }
.no-js .story-stage, .no-js .story-rail { display: none; }
.no-js .story-step { position: static; opacity: 1; }
.no-js .story-step p { max-height: none; opacity: 1; }
.no-js .story-grid { grid-template-columns: minmax(0, 1fr); }
@media (prefers-reduced-motion: reduce) {
  .story-step, .story-step p, .scene, .story [data-at] { transition: none; }
  .mini-spark, .sp-think span, .sp-typed::after, .gap-typed::after { animation: none; }
}
/* Paper keeps its own ink: the site's paragraph colour is for the dark page. */
.story .gap-draft p, .story .sp-clause p { color: #2A2620; }

/* ---------- Easier to read: air between the steps, a rule between titles, the body text set larger ---------- */
.story-steps { gap: 0; }
.story-step { padding: 24px 0 26px; border-top: 1px solid var(--border); }
.story-step:first-child { padding-top: 4px; border-top: 0; }
.story-step:nth-last-child(2) { padding-bottom: 6px; }
.story-step .step-n { font-size: 48px; }
.story-step .h3 { font-size: clamp(1.2rem, 1.8vw, 1.4rem); letter-spacing: -.012em; }
.story-step p { margin-top: 14px; max-width: 42ch; font-size: 16.5px; line-height: 1.75; letter-spacing: .003em; color: #D2CBBF; }
.story-step.on p { max-height: 280px; }

/* Letter by letter: the current step's text writes itself as the scene plays. */
.story .w { white-space: nowrap; }
.story .ch { opacity: 0; filter: blur(3px); transition: opacity .28s var(--ease), filter .28s var(--ease); }
.story .ch.on { opacity: 1; filter: none; }

/* ---------- Hand-written notes with arrows: what to look at, right when it happens ---------- */
.pin { position: absolute; z-index: 3; display: flex; gap: 4px; pointer-events: none; }
.pin .hand { font-size: 22px; line-height: 1.1; white-space: nowrap; transform: rotate(-2deg); text-shadow: 0 2px 14px #070708, 0 0 2px #070708; }
.pin-arrow { flex: none; width: 58px; height: auto; color: var(--marker); }
.pin-arrow path { stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 160; stroke-dashoffset: 160; transition: stroke-dashoffset .9s var(--ease) .18s; }
.pin.on .pin-arrow path { stroke-dashoffset: 0; }
.pin-files, .pin-gap { top: -70px; left: 178px; flex-direction: column; align-items: flex-start; }
.pin-files .pin-arrow, .pin-gap .pin-arrow { margin-left: 46px; }
.pin-laid, .pin-draft { bottom: -76px; flex-direction: column; align-items: flex-end; }
.pin-laid { right: 6px; }
.pin-draft { right: 70px; }
.pin-laid .pin-arrow, .pin-draft .pin-arrow { margin-right: 54px; }
.pin-type { top: 70px; left: -6px; align-items: center; flex-direction: column; }
.pin-type .pin-arrow { align-self: flex-end; margin-right: -26px; }
.pin-cite { top: 250px; right: -10px; flex-direction: column; align-items: flex-end; }
.pin-cite .pin-arrow { align-self: flex-start; margin-left: -30px; }

@media (max-width: 899px) {
  .story-step { padding: 0; border-top: 0; }
  .story-step p { font-size: 15.5px; line-height: 1.7; }
  /* Phones: each scene shows only its latest note, as a small caption on the mockup. */
  .pin { top: auto; right: 10px; bottom: 10px; left: 10px; flex-direction: row; justify-content: center; padding: 6px 10px; border-radius: 10px; background: rgba(7,7,8,.82); border: 1px solid rgba(255,122,0,.3); backdrop-filter: blur(6px); }
  .pin .hand { font-size: 18px; white-space: normal; text-align: center; transform: none; }
  .pin-arrow { display: none; }
  .scene .pin.on:has(~ .pin.on) { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .story .ch { transition: none; } .pin-arrow path { transition: none; } }

/* Desktop: the stage is centred below the fixed header and leaves room above and below it for the notes. */
@media (min-width: 900px) {
  .story-sticky { box-sizing: border-box; padding-top: 72px; }
  .story-stage { height: min(560px, calc(100svh - 260px)); }
}
@media (min-width: 900px) {
  /* The panel mockup is narrow: its side notes wrap to two lines and sit in the gutters beside it. */
  .pin-type .hand, .pin-cite .hand { width: 150px; white-space: normal; }
  .pin-type { left: -44px; }
  .pin-cite { right: -70px; }
  .pin-cite .hand { text-align: right; }
}
@media (min-width: 900px) and (max-width: 1199px) { .pin-cite { right: -20px; } }
