/* Orthic Systems · the homepage (index.css). Everything shared (tokens, type, buttons, header, footer) is in site.css; this file
   is only the homepage's own sections: the headline and the framed film with its chapters, the product cards, the
   working, the evidence, the status and the pilot. */

/* ---------------- the first screen ---------------- */
.hero { padding: calc(var(--hdr) + clamp(32px, 4.5vw, 64px)) 0 clamp(40px, 5vw, 72px); }
.hero__head { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: 24px clamp(32px, 5vw, 80px); align-items: end; }
.hero__title { max-width: 17em; font-size: clamp(2.375rem, 1.3rem + 2.8vw, 4rem); }
.hero__side { display: grid; gap: 22px; padding-bottom: 6px; }
.hero__lede { font-size: var(--t-small); line-height: 1.55; color: var(--text-2); max-width: 30rem; }
.hero__side .actions { gap: 10px 22px; }

/* the film: a sheet of paper on the page, with its chapters ruled underneath */
.film { margin-top: clamp(28px, 3.5vw, 48px); }
.film__stage { position: relative; height: clamp(300px, 58svh, 620px); border-radius: var(--r-4); overflow: hidden; background: var(--film);
  box-shadow: 0 0 0 1px var(--line-2); }
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.film__still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.chapters { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 0 12px; align-items: start; margin-top: 4px; }
.chapters__ink { display: none; }
.ctl { grid-column: 1; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-top: 4px; border: 1px solid var(--line-2); border-radius: var(--r-3);
  background: var(--sheet); color: var(--ink); cursor: pointer; transition: border-color var(--dur-1) var(--ease-out); }
.ctl:hover { border-color: var(--ink); }
.chapters__list { grid-column: 2; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0 12px; }
.chap { position: relative; display: grid; gap: 8px; width: 100%; min-height: 52px; padding: 14px 0 6px; border: 0; background: none; text-align: left; cursor: pointer;
  font: 500 0.875rem/1.3 var(--sans); color: var(--muted); transition: color var(--dur-1) var(--ease-out); }
.chap::before, .chap::after { content: ""; position: absolute; left: 0; right: 0; top: 0; }
.chap::before { height: 1px; top: 1px; background: var(--line-2); }
.chap::after { height: 3px; border-radius: 2px; transform: scaleX(var(--p, 0)); transform-origin: left; }
/* the story's colours: what goes wrong is noticed in burnt orange; Orthic Flow resolves it in green */
.chap::after { background: var(--ember); }
.chap--of::after { background: var(--accent); }
.chap:hover, .chap[aria-current] { color: var(--ink); }
.chap[aria-current] { font-weight: 600; }
.chap__pic { display: none; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r-2); box-shadow: 0 0 0 1px var(--line); background: var(--film); }
/* reduced motion: the chapters become a storyboard of still frames; the chosen one is outlined */
.chapters.is-board { grid-template-columns: minmax(0, 1fr); }
.chapters.is-board .chap__pic { display: block; }
.chapters.is-board .chap[aria-current] .chap__pic { box-shadow: 0 0 0 2px var(--ink); }
.film__cap { margin: 10px 0 0 56px; min-height: 3.1em; max-width: 38rem; font-size: var(--t-small); line-height: 1.55; color: var(--text-2); }
.chapters.is-board + .film__cap { margin-left: 0; }

/* ---------------- two people, one file ---------------- */
.two__cols { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 5vw, 80px); }
.two__col { display: grid; align-content: start; gap: 14px; padding-top: 20px; border-top: 1px solid var(--ink); }
.two__who { font-size: var(--t-small); font-weight: 600; color: var(--muted); }
.two__q { font-weight: 600; font-stretch: var(--cond); font-size: clamp(1.5rem, 1.2rem + 0.9vw, 2rem); line-height: 1.15; letter-spacing: -0.015em; text-wrap: balance; }
.two__col > p:not(.two__who) { color: var(--text-2); max-width: 34rem; }

/* ---------------- the product, in its own interface ---------------- */
.card { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 32px clamp(32px, 5vw, 72px); align-items: center; }
.card + .card { margin-top: clamp(56px, 7vw, 96px); }
.card--flip { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); }
.card--flip .card__text { order: 2; }
.card__text { display: grid; align-content: start; justify-items: start; gap: 14px; }
.card__text p { color: var(--text-2); max-width: 32rem; }
.card__text .mono { font-size: 0.875em; color: var(--ink); background: var(--sheet-2); padding: 1px 6px; border-radius: var(--r-2); white-space: nowrap; }
.card__ui { position: relative; margin: 0; padding: clamp(14px, 2.4vw, 32px); border-radius: var(--r-4); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.card__ui .ui { clip-path: circle(150% at var(--fx, 50%) var(--fy, 50%)); }
.card__ui.is-sketch .ui { clip-path: circle(0 at var(--fx, 50%) var(--fy, 50%)); }
.card__ui.is-flood .ui { transition: clip-path 720ms var(--ease-out); }
.card__ui .sketch { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; transition: opacity 480ms var(--ease-out) 240ms; }
.card__ui.is-flood .sketch { opacity: 0; }
.vignette { display: block; width: min(240px, 100%); aspect-ratio: 260 / 200; margin-top: 8px; }
.product__note { margin-top: clamp(40px, 5vw, 64px); }

/* ---------------- the working (forest) ---------------- */
.sheet { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px clamp(40px, 6vw, 96px); align-items: start; padding-top: 28px; border-top: 1px solid var(--forest-line); }
.sheet__asset { font-size: var(--t-small); color: var(--on-forest-2); }
.sheet__figure { margin: 8px 0 0; font-weight: 500; font-stretch: var(--cond); font-size: clamp(3.25rem, 1rem + 6vw, 5.5rem); letter-spacing: -0.035em; line-height: 0.95; font-variant-numeric: tabular-nums; }
.sheet__caption { margin: 12px 0 28px; font-size: var(--t-caption); color: var(--on-forest-2); }
.ledger { border-top: 1px solid var(--forest-line); }
.ledger li { display: grid; grid-template-columns: 2em minmax(0, 1fr) auto; grid-template-areas: "op k v" "op s v"; gap: 0 12px; padding: 14px 0; border-bottom: 1px solid var(--forest-line); align-items: center; }
.ledger__op { grid-area: op; font-size: 1.25rem; color: var(--mint); text-align: center; }
.ledger__k { grid-area: k; font-weight: 500; justify-self: start; }
.ledger__src { grid-area: s; font-family: var(--mono); font-size: 0.75rem; color: var(--on-forest-2); }
.ledger b { grid-area: v; font-size: 1.1875rem; font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.ledger__sub b { color: var(--on-forest-2); }
.ledger__total { border-bottom: 0 !important; border-top: 2px solid var(--on-forest); margin-top: -1px; }
.ledger__total .ledger__k, .ledger__total b { font-weight: 640; }
.working__note { margin-top: 40px; }

/* ---------------- how a figure is reached ---------------- */
.proof__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 var(--gap); }
.proof__list li { display: grid; align-content: start; justify-items: start; gap: 8px; padding: 20px 0 28px; border-top: 1px solid var(--line-2); }
.proof__list li:nth-child(-n + 3) { border-top-color: var(--ink); }
.proof__k { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-weight: 600; font-size: 1.0625rem; }
.proof__list p:not(.proof__k) { color: var(--text-2); font-size: var(--t-small); max-width: 26rem; }

/* ---------------- where it stands ---------------- */
.standing { border-top: 1px solid var(--ink); }
.standing > div { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 8px 24px; padding: 18px 0; border-bottom: 1px solid var(--line-2); }
.standing dd { color: var(--text-2); max-width: 38rem; }
.standing__more { margin-top: 12px; }

/* ---------------- the pilot (night) ---------------- */
.pilot__grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 40px clamp(40px, 6vw, 96px); align-items: center; }
.steps { margin: 36px 0 32px; counter-reset: step; border-top: 1px solid var(--night-line); }
.steps li { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: 4px 12px; padding: 18px 0; border-bottom: 1px solid var(--night-line); counter-increment: step; }
.steps li::before { content: counter(step); grid-row: 1 / span 2; font-family: var(--mono); font-size: 0.875rem; color: var(--ember-glow); padding-top: 2px; }
.steps b { font-weight: 600; color: var(--on-night); }
.steps span { color: var(--on-night-2); max-width: 36rem; }
.pilot__note { margin-top: 24px; }
.pilot__aside { margin: 0; padding: 20px 20px 16px; border-radius: var(--r-4); background: var(--sheet); color: var(--ink); }
.pilot__aside .vignette { width: 100%; margin: 0; }
.pilot__aside figcaption { margin-top: 8px; font-size: var(--t-small); color: var(--muted); text-align: center; }

/* ---------------- the auditor's marks, and where each figure comes from (annotate.ts) ---------------- */
.marks { position: absolute; left: 0; top: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.mark path { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 0.6s var(--ease-out); }
.mark.is-dark path { stroke: var(--mint); }
.mark--circle path { stroke: var(--ember); stroke-width: 2; }
.mark.is-on path { stroke-dashoffset: 0; }
.mark__note { font: italic 600 14px/1 var(--sans); fill: var(--accent); opacity: 0; transition: opacity 0.4s var(--ease-out) 0.3s; }
.mark__note.is-dark { fill: var(--mint); }
.mark--circle .mark__note { fill: var(--ember-ink); }
.mark.is-on .mark__note { opacity: 1; }
.ink-write { display: inline-block; clip-path: inset(-12% 100% -12% 0); }
.is-written .ink-write { clip-path: inset(-12% -4% -12% 0); transition: clip-path 1.4s cubic-bezier(.45, .1, .4, 1) 0.1s; }
.ink-row { clip-path: inset(0 100% 0 0); }
.is-written .ink-row { clip-path: inset(0 0 0 0); transition: clip-path 0.6s cubic-bezier(.45, .1, .4, 1) calc(1s + var(--i) * 0.2s); }
.has-source { cursor: help; text-decoration: underline dotted 1px; text-underline-offset: 4px; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); border-radius: var(--r-1); }
/* a figure that can tell you where it came from: pointed at, its underline turns to the burnt-orange pencil */
.has-source { transition: text-decoration-color var(--dur-1) var(--ease-out); }
.has-source:hover, .has-source:focus-visible { text-decoration-color: var(--ember-glow); }
.source { position: absolute; left: 0; top: 0; z-index: 55; padding: 12px 14px 13px; border-radius: var(--r-4); background: var(--sheet); color: var(--ink);
  border: 1.5px solid var(--ink); box-shadow: var(--shadow-float); pointer-events: none; }
.source__k { margin: 0 0 4px; font-weight: 600; font-size: 0.75rem; color: var(--ember-ink); }
.source__v { margin: 0; font-size: 0.875rem; line-height: 1.45; color: var(--text-2); }

/* ---------------- tablet ---------------- */
@media (max-width: 1100px) {
  .hero__head { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .hero__title { max-width: 18em; }
  .proof__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proof__list li:nth-child(3) { border-top-color: var(--line-2); }
}
@media (max-width: 940px) {
  .card, .card--flip, .sheet, .pilot__grid { grid-template-columns: minmax(0, 1fr); }
  .card__ui { order: -1; }
  .card--flip .card__text { order: 2; }
  .two__cols { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .pilot__aside { max-width: 360px; }
}
/* ---------------- phone ---------------- */
@media (max-width: 640px) {
  .film__stage { height: auto; aspect-ratio: 4 / 5; max-height: 74svh; }
  .chapters { grid-template-columns: minmax(0, 1fr); }
  .ctl { position: absolute; right: 10px; top: 10px; margin: 0; background: rgb(252 251 248 / 0.92); }
  .film { position: relative; }
  .chapters__list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 10px; }
  .chap { min-height: 48px; padding-top: 12px; font-size: 0.8125rem; }
  .film__cap { margin-left: 0; }
  .proof__list { grid-template-columns: minmax(0, 1fr); }
  .proof__list li:nth-child(2) { border-top-color: var(--line-2); }
  .standing > div { grid-template-columns: minmax(0, 1fr); }
  .ledger li { grid-template-columns: 1.6em minmax(0, 1fr) auto; }
  .ledger b { font-size: 1.0625rem; }
  .card__ui { padding: 10px; margin: 0 calc(-1 * var(--pad) + 8px); }
}
@media (prefers-reduced-motion: reduce) { .mark path, .mark__note { transition: none; } }

/* ---------------- the reconciliation scene: layers of paper (see main.ts, depth.ts) ----------------
   Behind the interface, the two records the finding compared; above the books' paper, the clue circled in burnt
   orange. At rest the papers peek out from behind; opened, they rise, part a little, and the circle is drawn. The
   scene leans a few degrees towards a mouse pointer, which separates the layers as real sheets would. */
.stack { cursor: pointer; }
.stack__scene { position: relative; padding-top: 104px; transform-style: preserve-3d;
  transform: perspective(1600px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.stack__ui { position: relative; z-index: 2; transform: translate3d(0, 0, 0); transition: transform 560ms var(--ease-out); }
.stack__doc { position: absolute; top: 10px; z-index: 1; padding: 13px 16px 16px; border-radius: var(--r-2); background: var(--sheet); color: var(--ink);
  box-shadow: 0 0 0 1px var(--line-2), 0 12px 26px -18px rgb(21 20 19 / 0.4); font-size: 0.8125rem; line-height: 1.45; transform-style: preserve-3d;
  transition: transform 620ms var(--ease-out); }
.stack__doc--reg { left: 2%; width: 46%; transform: translate3d(0, 30px, -30px) rotate(-1.6deg); }
.stack__doc--books { right: 2%; width: 50%; top: 18px; transform: translate3d(0, 22px, -60px) rotate(1.2deg); }
.stack:hover:not(.is-open) .stack__doc--reg { transform: translate3d(0, 24px, -30px) rotate(-2deg); }
.stack:hover:not(.is-open) .stack__doc--books { transform: translate3d(0, 16px, -60px) rotate(1.6deg); }
.stack.is-open .stack__doc--reg { transform: translate3d(-1.5%, -4px, -30px) rotate(-2.6deg); }
.stack.is-open .stack__doc--books { transform: translate3d(1.5%, -14px, -60px) rotate(2deg); transition-delay: 60ms; }
.stack.is-open .stack__ui { transform: translate3d(0, 10px, 24px); }
.stack__k { font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.stack__amt { margin: 2px 0 4px; font-family: var(--mono); font-size: 1.125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stack__diff { text-decoration: underline 2px transparent; text-underline-offset: 4px; transition: text-decoration-color 300ms var(--ease-out) 300ms; }
.stack.is-open .stack__diff { text-decoration-color: var(--ember); }
.stack__row { color: var(--text-2); }
.stack__clue { position: relative; white-space: nowrap; transform-style: preserve-3d; }
.stack__ring { position: absolute; left: -9px; top: -7px; width: calc(100% + 18px); height: calc(100% + 14px); overflow: visible; transform: translateZ(10px); pointer-events: none; }
.stack__ring path { fill: none; stroke: var(--ember); stroke-width: 1.8; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1;
  transition: stroke-dashoffset 560ms var(--ease-out); }
.stack.is-open .stack__ring path { stroke-dashoffset: 0; transition-delay: 420ms; }
.stack__note { margin-left: 12px; font: italic 600 0.8125rem/1 var(--sans); color: var(--ember-ink); opacity: 0; transition: opacity 260ms var(--ease-out); white-space: nowrap; }
.stack.is-open .stack__note { opacity: 1; transition-delay: 880ms; }
.stack__btn[aria-pressed="true"] { border-color: var(--ink); }
.card__text .actions { gap: 8px 18px; }
@media (max-width: 640px) {
  /* the labels wrap here, so the papers start lower at rest and rise further: amounts showing at rest, the circled
     narration clear of the interface when open (measured at 390 px) */
  .stack__scene { padding-top: 152px; }
  .stack__doc--reg { transform: translate3d(0, 82px, -30px) rotate(-1.6deg); }
  .stack__doc--books { transform: translate3d(0, 56px, -60px) rotate(1.2deg); }
  .stack.is-open .stack__doc--reg { transform: translate3d(-1%, 6px, -30px) rotate(-2.2deg); }
  .stack.is-open .stack__doc--books { transform: translate3d(1%, -2px, -60px) rotate(1.8deg); }
  .stack__doc { padding: 11px 12px 12px; font-size: 0.75rem; }
  .stack__doc--reg { width: 48%; } .stack__doc--books { width: 52%; }
  .stack__amt { font-size: 1rem; }
  .stack__note { display: block; margin: 4px 0 0; }
}
