/* ============================================================
   The Wick Academy
   Ink and paper parts · ice-blue accent · drafting-grid charts
   ============================================================ */

:root {
  /* Palette (Midnight and Ice): three ink surfaces, three paper surfaces, one accent in two weights, and text on each. */
  --ink: #0A1222;
  --ink-2: #101A2E;
  --ink-3: #18253F;
  --ink-deep: #060B16;
  --paper: #E9EEF4;
  --paper-2: #F5F8FB;
  --paper-3: #DBE3EC;
  --accent: #7DBEF5;
  --accent-deep: #1B5C99;
  --on-ink: #EAF0F8;
  --on-ink-2: #B1BDD0;
  --on-ink-3: #8593AB;
  --on-paper: #0E1726;
  --on-paper-2: #3A4659;
  --on-paper-3: #505E75;
  --chart-up: color-mix(in srgb, var(--on-ink) 88%, var(--ink));
  --chart-dn-fill: color-mix(in srgb, var(--on-ink) 18%, var(--ink));
  --chart-dn: color-mix(in srgb, var(--on-ink) 62%, var(--ink));
  --stop: #D67A6A;
  --tp: #7FB896;

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --max: 1200px;
  --pad: clamp(20px, 4vw, 40px);
  --r: 4px;
  --head: 72px;
  --sec: clamp(88px, 11vw, 160px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Theme scopes: every component reads these, so one rule serves both. */
.on-dark {
  --bg: var(--ink);
  --panel: var(--ink-2);
  --panel-2: var(--ink-3);
  --fg: var(--on-ink);
  --fg-2: var(--on-ink-2);
  --fg-3: var(--on-ink-3);
  --rule: color-mix(in srgb, var(--on-ink) 14%, transparent);
  --rule-2: color-mix(in srgb, var(--on-ink) 26%, transparent);
  --acc: var(--accent);
  background: var(--bg);
  color: var(--fg);
}
.on-light {
  --bg: var(--paper);
  --panel: var(--paper-2);
  --panel-2: var(--paper-3);
  --fg: var(--on-paper);
  --fg-2: var(--on-paper-2);
  --fg-3: var(--on-paper-3);
  --rule: color-mix(in srgb, var(--on-paper) 16%, transparent);
  --rule-2: color-mix(in srgb, var(--on-paper) 34%, transparent);
  --acc: var(--accent-deep);
  background: var(--bg);
  color: var(--fg);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--head) + 8px);
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--on-ink);
  font-family: var(--font);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0 0 1.1em; max-width: 64ch; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--acc, var(--accent));
  outline-offset: 3px;
  border-radius: 2px;
}

.wrap { width: min(100% - 2 * var(--pad), var(--max)); margin-inline: auto; }
.mono { font-family: var(--mono); font-feature-settings: "zero" 1; }

.skip {
  position: fixed; top: 10px; left: 10px; z-index: 100;
  padding: 12px 18px; background: var(--accent); color: var(--ink);
  font-weight: 600; text-decoration: none; border-radius: var(--r);
  transform: translateY(-160%);
}
.skip:focus { transform: none; }

/* ---------- header and rail ---------- */
.site-head {
  position: sticky; top: 0; z-index: 60;
  background: var(--ink);
}
.head-in {
  height: var(--head);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 600; letter-spacing: -0.01em; }
.brand svg { flex: none; }
.mark .w { stroke: var(--on-ink); }
.mark .b { fill: var(--accent); }
.brand-name { font-weight: 500; font-stretch: 114%; letter-spacing: 0.005em; font-size: 1.0625rem; white-space: nowrap; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  font-size: 0.9375rem; color: var(--fg-2); text-decoration: none;
  border-radius: var(--r); transition: color 0.2s;
}
.nav a:hover { color: var(--fg); }
.nav a[aria-current="true"] { color: var(--acc); }
.nav .btn { min-height: 44px; margin-left: 10px; padding: 0 20px; font-size: 0.9375rem; color: var(--ink); }
.nav .btn:hover, .nav .btn[aria-current="true"] { color: var(--ink); }

.nav-toggle {
  display: none; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 0 16px; background: transparent;
  border: 1px solid var(--rule-2); border-radius: var(--r); cursor: pointer;
}
.nav-toggle .bars { width: 16px; height: 10px; position: relative; }
.nav-toggle .bars::before, .nav-toggle .bars::after {
  content: ""; position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor;
}
.nav-toggle .bars::before { top: 0; }
.nav-toggle .bars::after { bottom: 0; }

.rail { position: relative; height: 2px; background: var(--rule); }
.rail-fill { position: absolute; inset: 0; background: var(--accent); transform-origin: left center; transform: scaleX(var(--p, 0)); }
.rail-ticks { position: absolute; inset: 0; pointer-events: none; }
.rail-ticks span { position: absolute; top: -5px; width: 1px; height: 12px; background: var(--rule-2); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  min-height: 52px; padding: 0 30px;
  font-weight: 600; font-size: 1rem; line-height: 1; letter-spacing: 0.015em; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; border-radius: 2px;
  transition: transform 0.2s var(--ease), background-color 0.2s, border-color 0.2s, box-shadow 0.3s var(--ease);
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary { background: var(--accent); color: var(--ink); box-shadow: 0 16px 34px -20px color-mix(in srgb, var(--accent) 50%, transparent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, white); box-shadow: 0 20px 38px -18px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn-ghost { border-color: var(--rule-2); color: var(--fg); background: transparent; }
.btn-ghost:hover { border-color: var(--fg); }
.btn svg { width: 16px; height: 16px; transition: transform 0.25s var(--ease); }
.btn:hover svg { transform: translateX(3px); }

/* ---------- typography ---------- */
h1 {
  font-size: clamp(2.6rem, 5.8vw, 5.4rem);
  font-weight: 300; font-stretch: 120%; line-height: 1; letter-spacing: -0.03em;
}
h2 {
  font-size: clamp(2rem, 3.7vw, 3.4rem);
  font-weight: 330; font-stretch: 114%; line-height: 1.06; letter-spacing: -0.025em;
}
h3 { font-size: clamp(1.4rem, 2.1vw, 1.8rem); font-weight: 500; font-stretch: 108%; line-height: 1.15; }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
::selection { background: var(--accent); color: var(--ink); }
h4 { font-size: 1.0625rem; font-weight: 600; letter-spacing: 0; line-height: 1.3; }

.lede { font-size: clamp(1.125rem, 1.5vw, 1.3rem); color: var(--fg-2); line-height: 1.55; max-width: 56ch; }
.sec { padding-block: var(--sec); }
.muted { color: var(--fg-2); }
.small { font-size: 0.9375rem; color: var(--fg-3); }
.note a { color: var(--acc); text-underline-offset: 3px; }
.note { font-size: 0.9375rem; color: var(--fg-3); max-width: 70ch; }

/* ---------- hero ---------- */
.hero { padding-block: clamp(48px, 6vw, 96px) clamp(72px, 9vw, 136px); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.hero h1 { margin-bottom: 28px; }
.hero .lede { margin-bottom: 36px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; }


.part-head .chain { max-width: 560px; margin-top: 36px; }
.chain { box-shadow: inset 0 1px 0 color-mix(in srgb, var(--on-ink) 9%, transparent); background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r); padding: clamp(22px, 3vw, 36px); position: relative; }
.chapters { background: var(--panel); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--on-ink) 9%, transparent); border: 1px solid var(--rule); border-radius: var(--r); padding: clamp(22px, 3vw, 36px); }
.chapters h2 { font-size: 1.25rem; font-weight: 500; font-stretch: 108%; letter-spacing: -0.01em; margin-bottom: 6px; }
.ch-part { margin: 18px 0 4px; font-size: 0.875rem; color: var(--fg-3); max-width: none; }
.ch-list { border-top: 1px solid var(--rule); }
.ch-list a { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; min-height: 42px; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--fg); font-weight: 500; transition: color 0.2s, padding 0.3s var(--ease); }
.ch-list a:hover { color: var(--acc); padding-left: 6px; }
.ch-n { font-family: var(--mono); font-size: 0.875rem; font-weight: 400; color: var(--acc); }
.hero-band { position: relative; margin: clamp(56px, 7vw, 104px) 0 0; aspect-ratio: 2 / 1; overflow: hidden; border: 1px solid var(--rule); border-radius: var(--r); background: var(--panel); }
.hero-band img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; filter: saturate(0.78) contrast(1.06) brightness(0.96); }
.hero-band::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(to top, color-mix(in srgb, var(--ink) 72%, transparent) 0%, transparent 42%), color-mix(in srgb, var(--ink) 16%, transparent); }
.hero-band::after { content: ""; position: absolute; inset: 14px; z-index: 2; pointer-events: none; border: 1px solid color-mix(in srgb, var(--on-ink) 24%, transparent); border-radius: 1px; }
.chain h3 { font-size: 1.25rem; font-stretch: 104%; letter-spacing: -0.01em; margin-bottom: 22px; }
.chain ol { position: relative; counter-reset: link; }
.chain ol::before { content: ""; position: absolute; left: 13px; top: 14px; bottom: 14px; width: 1px; background: var(--rule-2); }
.chain li { position: relative; padding: 0 0 22px 46px; counter-increment: link; color: var(--fg-2); }
.chain li::before {
  content: counter(link); position: absolute; left: 0; top: -2px;
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 1px solid var(--acc); border-radius: 50%; background: var(--panel);
  font-family: var(--mono); font-size: 0.8125rem; color: var(--acc);
}
.chain li strong { display: block; color: var(--fg); font-weight: 600; margin-bottom: 2px; }
.chain .sum { margin: 6px 0 0; padding-top: 18px; border-top: 1px dashed var(--rule-2); font-family: var(--mono); font-size: 0.9375rem; color: var(--fg); max-width: none; }
.chain .sum b { color: var(--acc); font-weight: 500; }
.chain .small { margin: 8px 0 0; }

/* ---------- section heads ---------- */
.sec-head { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(24px, 5vw, 72px); margin-bottom: clamp(40px, 5vw, 72px); }
.sec-head p { margin-bottom: 0; }

/* ---------- parts and chapters ---------- */
.part-head { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(24px, 5vw, 72px); padding-bottom: clamp(40px, 5vw, 72px); }
.part-no { font-family: var(--mono); font-size: 0.9375rem; color: var(--acc); margin-bottom: 14px; display: block; }
.part-head p { margin-bottom: 0; }

.chapter { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(24px, 5vw, 72px); padding-block: clamp(48px, 6vw, 80px); border-top: 1px solid var(--rule); }
.chapter-head, .chapter-body { min-width: 0; }
.chapter-head { position: sticky; top: calc(var(--head) + 28px); align-self: start; }
.chapter-no { font-family: var(--mono); font-size: 0.9375rem; color: var(--acc); display: block; margin-bottom: 10px; }
.chapter-head p { margin-top: 14px; font-size: 1rem; color: var(--fg-2); }
.chapter:last-child { padding-bottom: 0; }
.chapter-body > *:last-child { margin-bottom: 0; }
.chapter-body h4 { margin: 40px 0 12px; }
.chapter-body h4:first-child { margin-top: 0; }

/* ---------- ledger tables ---------- */
.ledger { width: 100%; border-collapse: collapse; font-size: 0.9688rem; margin-bottom: 8px; }
.ledger th { text-align: left; font-weight: 600; font-size: 0.875rem; color: var(--fg-3); padding: 0 16px 12px 0; border-bottom: 1px solid var(--rule-2); }
.ledger td { vertical-align: top; padding: 16px 16px 16px 0; border-bottom: 1px solid var(--rule); color: var(--fg-2); }
.ledger td:first-child { color: var(--fg); font-weight: 600; width: 22%; }
.ledger td.num, .ledger .num { font-family: var(--mono); font-size: 0.9375rem; }
.ledger tr:last-child td { border-bottom-color: var(--rule-2); }

/* ---------- lists ---------- */
.checks li, .dots li { position: relative; padding: 11px 0 11px 34px; border-bottom: 1px solid var(--rule); color: var(--fg-2); }
.checks li strong, .dots li strong { color: var(--fg); font-weight: 600; }
.checks li::before {
  content: ""; position: absolute; left: 0; top: 15px; width: 18px; height: 18px;
  background: var(--acc);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none' stroke='%23000' stroke-width='1.8'%3E%3Crect x='1' y='1' width='16' height='16' rx='2'/%3E%3Cpath d='M5 9.5l3 3 5-6.5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none' stroke='%23000' stroke-width='1.8'%3E%3Crect x='1' y='1' width='16' height='16' rx='2'/%3E%3Cpath d='M5 9.5l3 3 5-6.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.dots li::before { content: ""; position: absolute; left: 6px; top: 22px; width: 7px; height: 7px; background: var(--acc); }
.flags li::before { background: var(--stop); }
.on-light .flags li::before { background: #A8402F; }

.steps { counter-reset: step; }
.steps > li { counter-increment: step; position: relative; padding: 18px 0 18px 56px; border-bottom: 1px solid var(--rule); color: var(--fg-2); }
.steps > li::before { content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: 19px; font-family: var(--mono); color: var(--acc); }
.steps > li strong { display: block; color: var(--fg); font-weight: 600; margin-bottom: 2px; }
.steps > li:first-child { border-top: 1px solid var(--rule-2); }

.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(24px, 4vw, 56px); }
.cols-2 h4 { margin-top: 0 !important; margin-bottom: 8px; }

.formula {
  font-family: var(--mono); font-size: 0.9688rem; color: var(--fg);
  padding: 16px 18px; background: var(--panel-2); border-radius: var(--r); margin: 0 0 16px; max-width: none; overflow-x: auto;
}
.formula b { color: var(--acc); font-weight: 500; }

/* ---------- scorecard ---------- */
.score { border-top: 1px solid var(--rule-2); }
.score label {
  display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 14px; align-items: start;
  padding: 14px 0; border-bottom: 1px solid var(--rule); cursor: pointer; color: var(--fg-2); min-height: 52px;
}
.score label:hover { color: var(--fg); }
.score input { appearance: none; -webkit-appearance: none; margin: 1px 0 0; width: 22px; height: 22px; border: 1.5px solid var(--rule-2); border-radius: 3px; background: transparent; cursor: pointer; display: grid; place-content: center; }
.score input::after { content: ""; width: 10px; height: 10px; background: var(--ink); transform: scale(0); transition: transform 0.15s var(--ease); clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 8%, 38% 72%); }
.score input:checked { background: var(--acc); border-color: var(--acc); }
.score input:checked::after { transform: scale(1); }
.score label:has(input:checked) { color: var(--fg); }
.on-light .score input:checked::after { background: #fff; }
.score-out { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 24px; align-items: baseline; margin-top: 22px; padding: 20px 22px; background: var(--ink); color: var(--on-ink); border-radius: var(--r); }
.score-n { font-family: var(--mono); font-size: 2rem; line-height: 1; }
.score-n span { color: var(--on-ink-3); font-size: 1.125rem; }
.score-v { margin: 0; color: var(--on-ink-2); max-width: none; }
.score-v strong { color: var(--on-ink); }

/* ---------- calculator ---------- */
.calc { background: var(--ink); color: var(--on-ink); box-shadow: 0 40px 70px -44px color-mix(in srgb, var(--ink) 80%, transparent); border-radius: var(--r); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); overflow: hidden; }
.calc-in, .calc-out { padding: clamp(22px, 3vw, 36px); }
.calc-in { border-right: 1px solid color-mix(in srgb, var(--on-ink) 14%, transparent); display: grid; gap: 20px; align-content: start; }
.field label, .field .lab { display: block; font-size: 0.9375rem; color: var(--on-ink-2); margin-bottom: 8px; }
.input {
  width: 100%; min-height: 52px; padding: 0 14px; background: var(--ink); color: var(--on-ink);
  border: 1px solid color-mix(in srgb, var(--on-ink) 26%, transparent); border-radius: var(--r); font-family: var(--mono); font-size: 1.0625rem;
  transition: border-color 0.2s;
}
.input:hover { border-color: color-mix(in srgb, var(--on-ink) 50%, transparent); }
.input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip {
  min-height: 44px; padding: 0 12px; background: transparent; color: var(--on-ink); cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--on-ink) 26%, transparent); border-radius: var(--r); font-family: var(--mono); font-size: 0.9375rem;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.chip:hover { border-color: var(--on-ink); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.calc-out dl { margin: 0; display: grid; gap: 0; }
.calc-out dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 16px 0; border-bottom: 1px solid color-mix(in srgb, var(--on-ink) 14%, transparent); }
.calc-out dl > div:first-child { padding-top: 0; }
.calc-out dt { color: var(--on-ink-2); font-size: 0.9688rem; }
.calc-out dd { margin: 0; font-family: var(--mono); font-size: clamp(1.4rem, 2.4vw, 2rem); color: var(--on-ink); text-align: right; }
.calc-out dd.big { color: var(--accent); }
.calc-sum { margin: 20px 0 0; color: var(--on-ink-2); font-size: 0.9688rem; max-width: none; }
.calc-sum strong { color: var(--on-ink); font-weight: 600; }
.calc-err { margin: 6px 0 0; color: #E8A090; font-size: 0.9375rem; min-height: 1.4em; max-width: none; }

/* ---------- funnel ---------- */
.funnel { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin-bottom: 36px; }
.funnel li { position: relative; padding: 34px 20px 0 0; }
.funnel li::before { content: ""; position: absolute; left: 0; top: 7px; right: 0; height: 1px; background: var(--rule-2); }
.funnel li::after { content: ""; position: absolute; left: 0; top: 0; width: 15px; height: 15px; border: 1.5px solid var(--acc); background: var(--bg); border-radius: 50%; }
.funnel h4 { margin-bottom: 8px; }
.funnel p { font-size: 0.9688rem; color: var(--fg-2); margin-bottom: 12px; }
.funnel .measure { font-family: var(--mono); font-size: 0.8438rem; color: var(--fg-3); margin: 0; }
.funnel .measure b { color: var(--acc); font-weight: 500; }
.link-demo { font-family: var(--mono); font-size: 0.9688rem; padding: 16px 18px; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r); overflow-x: auto; max-width: none; white-space: nowrap; }
.link-demo b { color: var(--acc); font-weight: 500; }

/* ---------- tabs ---------- */
.tablist { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--rule-2); border-radius: var(--r); margin-bottom: clamp(32px, 4vw, 56px); overflow: hidden; }
.tab {
  text-align: left; padding: 18px 22px; background: transparent; border: 0; cursor: pointer; min-height: 72px;
  border-right: 1px solid var(--rule-2); color: var(--fg-2); transition: background-color 0.2s, color 0.2s;
}
.tab:last-child { border-right: 0; }
.tab:hover { background: var(--panel-2); }
.tab .t { display: block; font-weight: 600; font-stretch: 104%; font-size: 1.1875rem; color: var(--fg); }
.tab .d { display: block; font-size: 0.9375rem; margin-top: 2px; }
.tab[aria-selected="true"] { background: var(--ink); color: var(--on-ink-2); }
.tab[aria-selected="true"] .t { color: var(--on-ink); }
.tab[aria-selected="true"] .d { color: var(--accent); }
.tab:focus-visible { outline-offset: -4px; }
.panel[hidden] { display: none; }
.risk-bar { padding: 14px 18px; border: 1px solid var(--rule-2); border-radius: var(--r); font-size: 0.9375rem; color: var(--fg-2); margin-bottom: 28px; max-width: none; }
.risk-bar strong { color: var(--fg); }

/* ---------- charts ---------- */
.fig { margin: 0 0 28px; }
.chart-box { background: var(--ink); border-radius: var(--r); overflow: hidden; border: 1px solid color-mix(in srgb, var(--on-ink) 10%, transparent); }
.chart { width: 100%; height: auto; }
.fig figcaption { margin-top: 12px; font-size: 0.9375rem; color: var(--fg-3); max-width: 72ch; }
.chart .c-bg { fill: var(--ink); }
.chart .grid-line { stroke: color-mix(in srgb, var(--on-ink) 6%, transparent); stroke-width: 1; }
.chart .c-up { fill: var(--chart-up); stroke: var(--chart-up); }
.chart .c-dn { fill: var(--chart-dn-fill); stroke: var(--chart-dn); }
.chart .wick-up { stroke: var(--chart-up); stroke-width: 1.4; }
.chart .wick-dn { stroke: var(--chart-dn); stroke-width: 1.4; }
.chart .z-demand { fill: rgba(127, 184, 150, 0.14); stroke: rgba(127, 184, 150, 0.6); stroke-dasharray: 4 3; }
.chart .z-supply { fill: rgba(214, 122, 106, 0.14); stroke: rgba(214, 122, 106, 0.6); stroke-dasharray: 4 3; }
.chart .z-range { fill: color-mix(in srgb, var(--on-ink) 4%, transparent); stroke: color-mix(in srgb, var(--on-ink) 40%, transparent); stroke-dasharray: 4 3; }
.chart .z-fvg { fill: color-mix(in srgb, var(--accent) 20%, transparent); stroke: color-mix(in srgb, var(--accent) 70%, transparent); stroke-dasharray: 3 3; }
.chart .lv { stroke: color-mix(in srgb, var(--on-ink) 50%, transparent); stroke-dasharray: 5 4; stroke-width: 1; }
.chart .lv-liq { stroke: var(--accent); stroke-dasharray: 2 4; stroke-width: 1.2; }
.chart .box-risk { fill: rgba(214, 122, 106, 0.2); }
.chart .box-rew { fill: rgba(127, 184, 150, 0.2); }
.chart .ln-entry { stroke: var(--accent); stroke-width: 1.6; }
.chart .ln-stop { stroke: #D67A6A; stroke-width: 1.6; }
.chart .ln-tp { stroke: #7FB896; stroke-width: 1.6; }
.chart .dim { stroke: color-mix(in srgb, var(--on-ink) 70%, transparent); stroke-width: 1; fill: none; }
.chart text { font-family: var(--font); font-size: 12px; fill: var(--on-ink-2); paint-order: stroke; stroke: var(--ink); stroke-width: 3px; stroke-linejoin: round; }
.chart.anat text { font-size: 15px; }
.chart text.t-body { fill: var(--ink); stroke: none; }
.chart.anat text.t-mono { font-size: 14px; }
.chart text.t-mono { font-family: var(--mono); font-size: 11px; }
.chart text.t-entry { fill: var(--accent); font-weight: 600; }
.chart text.t-stop { fill: #E8998A; font-weight: 600; }
.chart text.t-tp { fill: #8FC9A8; font-weight: 600; }
.chart text.t-zone { fill: var(--on-ink); }
.chart text.t-note { fill: var(--on-ink); }
.chart .note-dot { fill: var(--on-ink); }
.chart .note-ln { stroke: color-mix(in srgb, var(--on-ink) 55%, transparent); stroke-width: 1; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 12px 0 0; font-size: 0.875rem; color: var(--fg-3); }
.legend span::before { content: ""; display: inline-block; width: 14px; height: 3px; margin-right: 8px; vertical-align: middle; background: currentColor; }
.legend .l-entry { color: var(--accent-deep); }
.legend .l-stop { color: #D67A6A; }
.legend .l-tp { color: #7FB896; }
.on-light .legend .l-entry { color: var(--accent-deep); }
.on-light .legend .l-stop { color: #A8402F; }
.on-light .legend .l-tp { color: #276A43; }

/* ---------- form ---------- */
.join-copy .steps { margin-top: 0; }
.join-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.offer { background: var(--panel); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--on-ink) 9%, transparent); border: 1px solid var(--rule); border-radius: var(--r); padding: clamp(24px, 3.4vw, 48px); margin-bottom: clamp(40px, 5vw, 64px); }
.offer-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.offer h3 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); margin-bottom: 22px; }
.offer-price { font-weight: 300; font-stretch: 118%; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; font-size: clamp(3rem, 5.4vw, 4.6rem); line-height: 1; color: var(--acc); margin: 0 0 10px; }
.offer-term { color: var(--fg-2); margin: 0 0 32px; }
.offer h4 { margin: 0 0 6px; }
.offer .dots { border-top: 1px solid var(--rule); }

.course-list { border-top: 1px solid var(--rule-2); }
.course { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 6fr) minmax(0, 4fr); gap: 16px clamp(20px, 3vw, 40px); align-items: start; padding: 28px 0; border-bottom: 1px solid var(--rule); }
.course-price { font-weight: 300; font-stretch: 114%; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; font-size: clamp(1.8rem, 2.8vw, 2.6rem); line-height: 1.05; color: var(--acc); margin: 0; }
.course h3 { font-size: 1.375rem; margin-bottom: 8px; }
.course-body p { color: var(--fg-2); margin: 0; max-width: 58ch; }
.course-side { display: grid; gap: 14px; justify-items: start; }
.course-meta { color: var(--fg-3); font-size: 0.9375rem; margin: 0; }
.course .btn { min-height: 44px; padding: 0 20px; font-size: 0.9375rem; }
.form { display: grid; gap: 22px; }
.form .row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.form label.lab { display: block; font-weight: 600; font-size: 0.9688rem; margin-bottom: 8px; color: var(--fg); }
.form .opt { font-weight: 400; color: var(--fg-3); }
.form .help { font-size: 0.875rem; color: var(--fg-3); margin: 6px 0 0; max-width: none; }
.form .err { font-size: 0.9062rem; color: #A8402F; margin: 6px 0 0; min-height: 0; max-width: none; }
.on-dark .form .err { color: #E8A090; }
.field-in {
  width: 100%; min-height: 52px; padding: 12px 14px; background: var(--panel); color: var(--fg);
  border: 1px solid var(--rule-2); border-radius: var(--r); transition: border-color 0.2s;
}
textarea.field-in { min-height: 120px; resize: vertical; line-height: 1.5; }
select.field-in { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23505E75' stroke-width='1.6'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; }
.on-dark select.field-in { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23B1BDD0' stroke-width='1.6'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); }
.on-dark select.field-in option, .on-dark select.field-in optgroup { background: var(--ink-2); color: var(--on-ink); }
.field-in:hover { border-color: var(--fg-3); }
.field-in:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-color: var(--acc); }
.field-in[aria-invalid="true"] { border-color: #A8402F; }
.status { padding: 16px 18px; border-radius: var(--r); font-size: 0.9688rem; max-width: none; margin: 0; }
.status[hidden] { display: none; }
.status.ok { background: rgba(47, 122, 78, 0.12); border: 1px solid rgba(47, 122, 78, 0.5); color: var(--fg); }
.status.warn { background: color-mix(in srgb, var(--accent-deep) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent-deep) 50%, transparent); color: var(--fg); }

/* ---------- events ---------- */
.events { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(16px, 2vw, 24px); }
.ev { background: var(--panel); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--on-ink) 7%, transparent); border: 1px solid var(--rule); border-radius: var(--r); padding: clamp(22px, 3vw, 36px); display: flex; flex-direction: column; min-width: 0; }
.ev.lead { grid-column: span 7; grid-row: span 2; }
.ev.side { grid-column: span 5; }
.ev-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: auto; padding-bottom: 28px; }
.ev-ico { width: 44px; height: 44px; border: 1px solid var(--rule-2); border-radius: 50%; display: grid; place-items: center; color: var(--acc); }
.ev-ico svg { width: 22px; height: 22px; }
.ev-status { font-family: var(--mono); font-size: 0.8125rem; color: var(--fg-2); padding: 6px 10px; border: 1px dashed var(--rule-2); border-radius: var(--r); }
.ev h3 { margin-bottom: 8px; }
.ev .where { font-family: var(--mono); font-size: 0.875rem; color: var(--fg-3); margin-bottom: 14px; }
.ev p { color: var(--fg-2); }
.ev .btn { align-self: flex-start; margin-top: 10px; }
.ev.side p { margin-bottom: 8px; }
.ev-topics { margin: 6px 0 22px; border-top: 1px solid var(--rule); }
.ev-topics li { padding: 11px 0 11px 28px; position: relative; border-bottom: 1px solid var(--rule); color: var(--fg-2); font-size: 0.9688rem; }
.ev-topics li::before { content: ""; position: absolute; left: 4px; top: 19px; width: 7px; height: 7px; background: var(--acc); }
.ev.lead .ev-top { margin-bottom: 0; padding-bottom: 36px; }

/* ---------- footer ---------- */
.foot { padding-block: clamp(56px, 7vw, 96px) 40px; background: var(--ink-deep); border-top: 1px solid var(--rule); }
.foot-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 72px); }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 18px; }
.foot-links a { min-height: 44px; display: inline-flex; align-items: center; color: var(--fg-2); text-decoration: none; font-size: 0.9688rem; }
.foot-links a:hover { color: var(--fg); }
.legal p { font-size: 0.9062rem; color: var(--fg-3); max-width: 78ch; }
.legal strong { color: var(--fg-2); font-weight: 600; }
.legal details { margin: 0 0 1.1em; }
.legal summary { cursor: pointer; font-size: 0.9062rem; color: var(--fg-2); min-height: 44px; display: flex; align-items: center; list-style: none; }
.legal summary::-webkit-details-marker { display: none; }
.legal summary::after { content: ""; width: 7px; height: 7px; margin: -3px 0 0 10px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform 0.2s; }
.legal details[open] summary::after { transform: rotate(225deg); margin-top: 3px; }
.copy { max-width: none; margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--rule); font-size: 0.875rem; color: var(--fg-3); }

/* ---------- entrance ---------- */
html.js .reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); transition-delay: calc(var(--i, 0) * 65ms); }
html.js .reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 1040px) {
  .funnel { grid-template-columns: 1fr; }
  .funnel li { padding: 0 0 28px 40px; }
  .funnel li::before { left: 7px; top: 15px; bottom: 0; right: auto; width: 1px; height: auto; }
  .funnel li:last-child::before { display: none; }
  .calc { grid-template-columns: 1fr; }
  .calc-in { border-right: 0; border-bottom: 1px solid color-mix(in srgb, var(--on-ink) 14%, transparent); }
}

@media (max-width: 1040px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px var(--pad) 20px; background: var(--ink); border-bottom: 1px solid var(--rule);
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { min-height: 52px; border-bottom: 1px solid var(--rule); border-radius: 0; padding: 0 4px; }
  .nav .btn { margin: 16px 0 0; border-bottom: 0; justify-content: center; }
}

@media (max-width: 900px) {
  .hero-band { aspect-ratio: 4 / 3; }
  .hero-band img { object-position: 50% 40%; }
  .hero-grid, .sec-head, .part-head, .chapter, .join-grid, .foot-grid { grid-template-columns: minmax(0, 1fr); }
  .chapter-head { position: static; }
  .cols-2 { grid-template-columns: 1fr; }
  .offer-grid { grid-template-columns: minmax(0, 1fr); }
  .course { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 24px 0; }
  .events .ev.lead, .events .ev.side { grid-column: span 12; grid-row: auto; min-height: 0; }
  .tablist { grid-template-columns: 1fr; }
  .tab { border-right: 0; border-bottom: 1px solid var(--rule-2); }
  .tab:last-child { border-bottom: 0; }
}

@media (max-width: 720px) {
  .ledger thead { display: none; }
  .ledger, .ledger tbody, .ledger tr, .ledger td { display: block; width: 100%; }
  .ledger tr { padding: 14px 0; border-bottom: 1px solid var(--rule-2); }
  .ledger td { padding: 4px 0; border: 0; width: 100% !important; }
  .ledger td::before { content: attr(data-label); display: block; font-size: 0.8125rem; color: var(--fg-3); }
  .ledger td:first-child::before { display: none; }
  .ledger td:first-child { font-size: 1.0625rem; padding-bottom: 6px; }
  .form .row { grid-template-columns: 1fr; }
  .calc-out dd { font-size: 1.5rem; }
  .score-out { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .brand-name { font-size: 0.9688rem; }
  .btn { padding: 0 22px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  html.js .reveal { opacity: 1; transform: none; }
}
