/* ============================================================
   inhand explained — the animated story behind the CTC->in-hand calculator.
   Same identity as the inhand app: fog & gunmetal, one tangerine flare.
   Motif: the salary waterfall (steel steps down to a tangerine block).
   Scroll-driven reveals; degrades to static, legible states with
   prefers-reduced-motion. WCAG-AA in light + dark. System sans + mono.
   ============================================================ */

:root {
  color-scheme: light dark;

  /* ---- light (default) ---- */
  --bg:        #EEF1F4;
  --panel:     #FFFFFF;
  --panel2:    #F5F7F9;
  --ink:       #1F2933;   /* gunmetal, ~12:1 on --bg */
  --muted:     #4A5763;   /* steel, ~6.5:1 on --bg */
  --steel:     #55606C;   /* secondary steel, AA on --bg for small hints */
  --line:      #D3DAE1;
  --line2:     #C2CBD4;
  --tangerine: #B04810;   /* deep tangerine — AA for small text on panels in light */
  --tangerine-bright: #F5762B; /* large fills / dark blocks only */
  --on-tang:   #FFFFFF;
  --good:      #1F7A4D;
  --flag:      #B02A1E;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 14px;
  --radius-sm: 9px;
  --wrap: 1080px;
  --shadow: 0 14px 40px -26px rgba(31,41,51,0.5);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #171C21;
    --panel:     #1E252C;
    --panel2:    #232B33;
    --ink:       #E5EAEE;
    --muted:     #AFBCC6;
    --steel:     #8FA3B0;
    --line:      #313B44;
    --line2:     #3C4854;
    --tangerine: #FF8A3D;
    --tangerine-bright: #FF8A3D;
    --on-tang:   #171C21;
    --good:      #57C98C;
    --flag:      #FF8A7A;
    --shadow: 0 18px 44px -24px rgba(0,0,0,0.7);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.003em;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.025em; line-height: 1.12; }
p { margin: 0; }
code { font-family: var(--mono); }
em { font-style: normal; color: var(--steel); }

.skip-link {
  position: fixed; left: 12px; top: -60px;
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-weight: 700;
  z-index: 90; transition: top 0.18s var(--ease); text-decoration: none;
}
.skip-link:focus { top: 12px; }

a:focus-visible, button:focus-visible {
  outline: 3px solid var(--tangerine);
  outline-offset: 3px;
  border-radius: 6px;
}

.eyebrow {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--tangerine); font-weight: 700;
}

/* ---------------- scroll progress ---------------- */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  background: transparent; z-index: 80;
}
.progress__bar {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--steel), var(--tangerine-bright));
  transition: width 0.1s linear;
}

/* ---------------- site head ---------------- */
.site-head {
  position: sticky; top: 0; z-index: 70;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 12px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); }
.brand__mark { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; flex: 0 0 auto; }
.brand__name { font-weight: 800; letter-spacing: -0.03em; font-size: 1.12rem; }
.brand__tag {
  font-weight: 600; color: var(--muted); font-size: 0.82rem; margin-left: 6px;
  padding-left: 8px; border-left: 1px solid var(--line2); letter-spacing: 0;
}
.head-cta {
  text-decoration: none; font-weight: 700; font-size: 0.88rem;
  color: var(--on-tang); background: var(--tangerine);
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--tangerine);
  transition: transform 0.12s var(--ease), filter 0.15s var(--ease);
}
.head-cta:hover { filter: brightness(1.06); transform: translateY(-1px); }
@media (max-width: 560px) { .head-cta { display: none; } .brand__tag { display: none; } }

/* ---------------- scenes ---------------- */
.scene { padding: clamp(64px, 12vh, 128px) clamp(16px, 4vw, 40px); }
.scene__inner { max-width: var(--wrap); margin: 0 auto; }
.scene__h { font-size: clamp(1.5rem, 3.6vw, 2.3rem); margin-bottom: 14px; }
.scene__lede { max-width: 62ch; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.14rem); }
.scene__foot { margin-top: 28px; font-weight: 600; color: var(--ink); max-width: 60ch; }

/* alternating surfaces for rhythm */
.scene--problem, .scene--cited, .scene--tour { background: var(--panel2); border-block: 1px solid var(--line); }
.scene--privacy { background:
  radial-gradient(1100px 520px at 88% -10%, color-mix(in srgb, var(--tangerine-bright) 10%, transparent), transparent 60%),
  var(--bg); }

/* ---------------- reveal animation ---------------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.scene__inner > .reveal:nth-child(2) { transition-delay: 0.05s; }
.scene__inner > .reveal:nth-child(3) { transition-delay: 0.1s; }
.scene__inner > .reveal:nth-child(4) { transition-delay: 0.15s; }

/* ---------------- HOOK ---------------- */
.scene--hook { min-height: 88vh; display: flex; align-items: center;
  background: linear-gradient(180deg, var(--panel2), var(--bg)); }
.hook__title {
  margin-top: 12px;
  font-size: clamp(2rem, 6vw, 3.6rem); font-weight: 800; letter-spacing: -0.035em;
  max-width: 18ch; line-height: 1.05;
}
.hook__lede { margin-top: 20px; max-width: 56ch; color: var(--muted); font-size: clamp(1.02rem, 1.8vw, 1.25rem); }
.hook__lede strong { color: var(--ink); }

.hook__figures { margin-top: 40px; display: flex; align-items: center; gap: clamp(18px, 4vw, 48px); flex-wrap: wrap; }
.hook__arrow { font-size: 2rem; color: var(--steel); }
@media (min-width: 620px) { .hook__arrow { transform: rotate(-90deg); } }
.bignum { display: flex; flex-direction: column; gap: 2px; }
.bignum__label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 700; }
.bignum__val { font-family: var(--mono); font-weight: 800; font-size: clamp(1.8rem, 5vw, 2.9rem); letter-spacing: -0.03em; line-height: 1.05; }
.bignum__val--ctc { color: var(--ink); }
.bignum__val--inhand { color: var(--tangerine); }
.bignum__note { font-size: 0.82rem; color: var(--steel); }

.scroll-cue { margin-top: 48px; font-size: 0.86rem; color: var(--steel); font-weight: 600; letter-spacing: 0.02em; }
.scroll-cue__chev { display: inline-block; animation: bob 1.6s var(--ease) infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* ---------------- PROBLEM ---------------- */
.pain-list { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; max-width: 66ch; }
.pain { display: flex; gap: 14px; align-items: flex-start; padding: 15px 17px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); font-size: 1rem; }
.pain__mark { flex: 0 0 auto; width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 50%; background: color-mix(in srgb, var(--flag) 16%, var(--panel));
  color: var(--flag); font-weight: 800; font-size: 1.05rem; }
.pain em { color: var(--ink); font-weight: 600; }

/* ---------------- WATERFALL ---------------- */
.wf { margin-top: 30px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); padding: 18px; box-shadow: var(--shadow); }
.wf__svg { width: 100%; min-width: 620px; height: auto; display: block; }

/* svg bar/label classes driven by app.js; base look here */
.wf-bar { transition: transform 0.7s var(--ease), opacity 0.7s var(--ease); transform-origin: bottom; transform: scaleY(0); opacity: 0; }
.wf-bar.is-in { transform: scaleY(1); opacity: 1; }
.wf-bar--ctc { fill: var(--ink); }
.wf-bar--drop { fill: var(--steel); }
.wf-bar--inhand { fill: var(--tangerine); }
.wf-conn { stroke: var(--line2); stroke-width: 1.6; stroke-dasharray: 3 3; fill: none;
  opacity: 0; transition: opacity 0.5s var(--ease) 0.4s; }
.wf-conn.is-in { opacity: 1; }
.wf-cap { font-family: var(--sans); font-size: 12px; fill: var(--muted); font-weight: 600; opacity: 0;
  transition: opacity 0.5s var(--ease) 0.35s; }
.wf-cap.is-in { opacity: 1; }
.wf-val { font-family: var(--mono); font-size: 12.5px; font-weight: 700; fill: var(--ink); opacity: 0;
  transition: opacity 0.5s var(--ease) 0.5s; }
.wf-val.is-in { opacity: 1; }
.wf-val--inhand { fill: var(--tangerine); font-weight: 800; }

.wf-legend { list-style: none; counter-reset: step; padding: 0; margin: 26px 0 0; display: grid; gap: 9px; max-width: 74ch; }
.wf-legend__item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; font-size: 0.96rem; color: var(--muted); }
.wf-legend__item em { font-family: var(--mono); font-size: 0.8rem; color: var(--steel); }
.chip { display: inline-block; font-size: 0.82rem; font-weight: 700; padding: 3px 11px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--line2); color: var(--ink); }
.chip--ctc { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip--inhand { background: var(--tangerine); color: var(--on-tang); border-color: var(--tangerine); }

/* ---------------- CITED cards ---------------- */
.cited-cards { margin-top: 30px; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.ccard { padding: 18px 18px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  border-left: 3px solid var(--tangerine); }
.ccard__name { font-size: 1.05rem; }
.ccard__rule { margin-top: 8px; color: var(--muted); font-size: 0.92rem; }
.ccard__cite { margin-top: 12px; font-family: var(--mono); font-size: 0.76rem; color: var(--steel); }

/* ---------------- PRIVACY ---------------- */
.privacy-demo { margin-top: 30px; padding: 22px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); max-width: 640px; }
.privacy-demo__csp { display: inline-block; font-size: 0.98rem; font-weight: 700; padding: 8px 14px;
  background: var(--panel2); border: 1px solid var(--line2); border-radius: var(--radius-sm); }
.privacy-demo__csp .tk-str { color: var(--tangerine); }
.privacy-demo__stage { position: relative; margin: 26px 0 6px; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; }
.pd-node { font-size: 0.82rem; font-weight: 700; padding: 9px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line2); background: var(--panel2); white-space: nowrap; }
.pd-node--you { color: var(--ink); }
.pd-node--net { color: var(--muted); }
.pd-wire { position: relative; flex: 1 1 auto; height: 3px; margin: 0 4px; background: repeating-linear-gradient(90deg, var(--line2) 0 7px, transparent 7px 13px); }
.pd-packet { position: absolute; top: 50%; left: 0; width: 14px; height: 14px; margin-top: -7px; border-radius: 4px;
  background: var(--tangerine); box-shadow: 0 0 14px -2px var(--tangerine-bright); opacity: 0; }
.pd-packet.is-run { animation: packet 2.6s var(--ease) infinite; }
@keyframes packet {
  0%   { left: 0;   opacity: 0; }
  12%  { opacity: 1; }
  58%  { left: calc(100% - 20px); opacity: 1; }
  66%  { left: calc(100% - 20px); opacity: 1; transform: scale(1); }
  72%  { left: calc(100% - 20px); opacity: 0; transform: scale(0.3) rotate(30deg); }
  100% { left: calc(100% - 20px); opacity: 0; }
}
.pd-wall { flex: 0 0 auto; width: 30px; height: 46px; border-radius: 7px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--flag) 16%, var(--panel)); border: 2px solid var(--flag); color: var(--flag);
  font-weight: 800; font-size: 1.1rem; }
.pd-wall.is-hit { animation: wallpulse 2.6s var(--ease) infinite; }
@keyframes wallpulse { 0%,60% { box-shadow: none; } 70% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--flag) 22%, transparent); } 85%,100% { box-shadow: none; } }
.privacy-demo__caption { margin-top: 18px; font-size: 0.9rem; color: var(--ink); font-weight: 600; }

.privacy-facts { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; max-width: 62ch; }
.privacy-facts li { display: flex; gap: 12px; align-items: flex-start; font-size: 0.98rem; }
.privacy-facts code { font-size: 0.86em; padding: 1px 5px; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; }
.tick { flex: 0 0 auto; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%;
  background: color-mix(in srgb, var(--good) 18%, var(--panel)); color: var(--good); font-weight: 800; font-size: 0.8rem; }

/* ---------------- TOUR ---------------- */
.tour-grid { margin-top: 30px; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tour { padding: 20px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.tour__ic { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 11px;
  background: var(--panel2); border: 1px solid var(--line2); color: var(--tangerine); font-size: 1.2rem; }
.tour h3 { margin-top: 13px; font-size: 1.06rem; }
.tour p { margin-top: 7px; color: var(--muted); font-size: 0.92rem; }

/* ---------------- CTA ---------------- */
.scene--cta { background: linear-gradient(180deg, var(--bg), var(--panel2)); text-align: center; }
.cta-inner { max-width: 640px; }
.cta__mark { width: 62px; height: 62px; margin: 0 auto 18px; display: block; border: 1px solid var(--line); border-radius: 14px; }
.cta__title { font-size: clamp(1.7rem, 4.4vw, 2.6rem); }
.cta__lede { margin: 16px auto 0; color: var(--muted); max-width: 52ch; font-size: 1.06rem; }
.cta__btn {
  display: inline-block; margin-top: 30px; text-decoration: none; font-weight: 800; font-size: 1.08rem;
  color: var(--on-tang); background: var(--tangerine); padding: 15px 30px; border-radius: 999px;
  border: 1px solid var(--tangerine); box-shadow: 0 16px 40px -18px var(--tangerine-bright);
  transition: transform 0.14s var(--ease), filter 0.16s var(--ease);
}
.cta__btn:hover { filter: brightness(1.06); transform: translateY(-2px); }
.cta__sub { margin-top: 16px; font-size: 0.84rem; color: var(--steel); }

/* ---------------- footer ---------------- */
.foot { border-top: 1px solid var(--line); background: var(--panel2); }
.foot__inner { max-width: var(--wrap); margin: 0 auto; padding: 30px clamp(16px, 4vw, 40px) 44px; }
.foot__disclaimer { font-size: 0.86rem; color: var(--muted); max-width: 84ch; }
.foot__disclaimer strong { color: var(--ink); }
.foot__meta { margin-top: 16px; font-size: 0.8rem; color: var(--steel); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.foot__meta a { color: var(--tangerine); text-decoration: none; font-weight: 700; }
.foot__meta a:hover { text-decoration: underline; }
.foot__dot { color: var(--line2); }

/* ---------------- reduced motion: everything legible & still ---------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .wf-bar { transform: scaleY(1) !important; opacity: 1 !important; }
  .wf-conn, .wf-cap, .wf-val { opacity: 1 !important; }
  .pd-packet { opacity: 1 !important; left: calc(50% - 7px) !important; }
  .scroll-cue__chev { animation: none !important; }
}
