/* CashPlan brand identity guidelines v1.0 (Task 50, 2026-10-21).
   Viewer and page system reused from the Pill brand deck (pill-playbook /brand, Task 82): 16 : 9 slides,
   ink nav rail (current section lit) | description column | content panels. Colours are tokens/cashplan-tokens.json. */

@font-face {
  font-family: "CashPlan Sans";
  src: url("assets/fonts/PretendardVariable.woff2") format("woff2-variations");
  font-weight: 45 920;
  font-display: swap;
}

:root {
  --ink: #0c1a14;
  --black: #060d0a;
  --neon: #09cc7c;
  --green: #09cc7c;
  --green-deep: #057a4b;
  --green-tint: #e8f8f0;
  --paper-w: #f1f6f3;
  --red: #e5484d;
  /* light */
  --page: #e6ebe8;
  --bg: #fff;
  --panel: #f3f6f4;
  --fg: #0c1a14;
  --fg2: #2c3631;
  --sub: #5e6a65;
  --faint: #687470;
  --line: #0c1a1424;
  --hair: #0c1a1414;
  --mark: var(--ink);
  --rail-dim: #ffffff73;
  --e-out: cubic-bezier(0.19, 1, 0.22, 1);
  --e-io: cubic-bezier(0.65, 0, 0.35, 1);
  --e-sprout: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --page: #050a08;
  --bg: #0f1814;
  --panel: #17231d;
  --fg: #eef4f1;
  --fg2: #c9d3ce;
  --sub: #a3b1aa;
  --faint: #7c8883;
  --line: #ffffff29;
  --hair: #ffffff14;
  --mark: var(--paper-w);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--page); }
body {
  margin: 0;
  font-family: "CashPlan Sans", "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  color: var(--fg);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 0;
  letter-spacing: -0.01em;
  word-break: keep-all;
}
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
svg.wm, svg.mk { display: block; fill: currentColor; }
.pel { fill: var(--pel, currentColor); }

/* ---------- Deck: slides stacked, 16 : 9 ---------- */
.deck { padding: 28px 0 96px; display: grid; gap: 28px; justify-items: center; }
.slide {
  --w: min(calc(100vw - 48px), calc((100svh - 104px) * 16 / 9), 1760px);
  width: var(--w);
  aspect-ratio: 16 / 9;
  container-type: inline-size;
  position: relative;
  overflow: hidden;
  background: var(--bg);
  border-radius: 6px;
  box-shadow: 0 1px 2px #0000000f, 0 8px 28px #00000014;
  scroll-margin: 28px;
}

/* ---------- Rule page grid (Bolt: rail 8.8 %, description 12.5 %, content 69 %) ---------- */
.rule { display: grid; grid-template-columns: 8.8cqw 22cqw 1fr; }
.rail {
  background: var(--ink);
  color: #fff;
  padding: 2.1cqw 1.25cqw;
  display: flex;
  flex-direction: column;
  gap: 2.4cqw;
}
.rail .wm { width: 4.6cqw; color: var(--paper-w); }
.rail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.42cqw; font-size: 0.74cqw; line-height: 1.3; }
.rail li { color: var(--rail-dim); }
.rail li.on { color: var(--green); font-weight: 600; }
.rail .cur { display: none; }
.rail .pg { margin-top: auto; font-size: 0.66cqw; color: var(--rail-dim); font-variant-numeric: tabular-nums; }

.desc { padding: 2.1cqw 2.2cqw 2.1cqw 2.6cqw; display: flex; flex-direction: column; min-width: 0; }
.desc h2 { margin: 0; font-size: 1.62cqw; line-height: 1.22; font-weight: 650; letter-spacing: -0.025em; }
.desc h2 .en, .t .en { display: block; font-size: 0.78cqw; font-weight: 450; color: var(--sub); letter-spacing: 0; margin-top: 0.42cqw; }
.desc p { margin: 1.2cqw 0 0; font-size: 0.86cqw; line-height: 1.62; color: var(--fg2); max-width: 19cqw; }
.desc p + p { margin-top: 0.7cqw; }
.desc ol.cap { margin: auto 0 0; padding: 0; list-style: none; display: grid; gap: 0.7cqw; font-size: 0.78cqw; line-height: 1.5; color: var(--sub); }
.desc ol.cap li { display: grid; grid-template-columns: auto 1fr; gap: 0.5cqw; }
.desc ol.cap b, .num { font-weight: 600; color: var(--fg); }
.desc .spec { margin-top: auto; border-top: 1px solid var(--line); padding-top: 0.9cqw; display: grid; grid-template-columns: 6cqw 1fr; gap: 0.45cqw 0.8cqw; font-size: 0.74cqw; line-height: 1.45; }
.desc .spec dt { color: var(--sub); }
.desc .spec dd { margin: 0; }
.desc ol.cap + .spec { margin-top: 1.2cqw; }

.content { padding: 1.6cqw 1.6cqw 1.6cqw 0; display: grid; gap: 1.1cqw; min-width: 0; min-height: 0; }
.pn {
  position: relative;
  background: var(--panel);
  border-radius: 0.55cqw;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 0;
  min-width: 0;
}
.pn.ink { background: var(--ink); color: var(--paper-w); }
.pn.blk { background: var(--black); color: var(--paper-w); }
.pn.neon { background: var(--neon); color: var(--ink); }
.pn.white { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px #11111114; }
.pn.char { background: #212121; color: #fff; }
.lab { position: absolute; left: 1cqw; top: 0.9cqw; font-size: 0.68cqw; line-height: 1.3; color: var(--sub); display: flex; gap: 0.5cqw; align-items: baseline; z-index: 2; }
.pn.ink .lab, .pn.blk .lab, .pn.char .lab { color: #ffffffa6; }
.pn.neon .lab { color: #0b0c0eb3; }
.lab i { font-style: normal; display: inline-grid; place-items: center; width: 1.15cqw; height: 1.15cqw; border-radius: 50%; border: 1px solid currentColor; font-size: 0.6cqw; }
.lab.bot { top: auto; bottom: 0.9cqw; }
.c2 { grid-template-columns: 1fr 1fr; }
.c3 { grid-template-columns: repeat(3, 1fr); }
.c4 { grid-template-columns: repeat(4, 1fr); }
.r2 { grid-template-rows: 1fr 1fr; }
.r21 { grid-template-rows: 1.5fr 1fr; }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.rspan2 { grid-row: span 2; }

/* ---------- Cover, statement, opener, field ---------- */
.cover { background: var(--green); color: var(--ink); display: grid; grid-template-columns: auto 1fr; align-items: center; padding: 0 7cqw; gap: 2.4cqw; }
.cover .wm { width: 22cqw; }
.cover .meta { font-size: 0.9cqw; line-height: 1.4; font-weight: 500; align-self: center; margin-top: 3.2cqw; }
.cover .foot { position: absolute; left: 7cqw; right: 7cqw; bottom: 3cqw; display: flex; justify-content: space-between; font-size: 0.78cqw; color: #0b0c0eb3; }

.statement { background: var(--ink); color: #fff; display: grid; grid-template-columns: 8.8cqw 1fr; }
.statement .body { padding: 0 10cqw 0 6cqw; display: flex; flex-direction: column; justify-content: center; gap: 2cqw; }
.statement .mk { width: 2.4cqw; color: var(--paper-w); --pel: var(--neon); }
.statement p { margin: 0; font-size: 2.85cqw; line-height: 1.32; font-weight: 550; letter-spacing: -0.03em; max-width: 58cqw; }
.statement p.small { font-size: 1.12cqw; line-height: 1.6; font-weight: 400; color: #ffffffb3; letter-spacing: -0.01em; }
.statement .kick { font-size: 1.05cqw; font-weight: 600; color: var(--neon); }

.opener { background: var(--panel); display: grid; }
.opener h2 { position: absolute; left: 6cqw; bottom: 9.5cqw; margin: 0; font-size: 10.2cqw; line-height: 1; font-weight: 700; letter-spacing: -0.05em; z-index: 1; }
.opener h2 .en { display: block; font-size: 1.5cqw; letter-spacing: 0; font-weight: 450; color: var(--sub); margin-top: 1.6cqw; }
.opener .shape { position: absolute; right: -9cqw; top: -14cqw; width: 64cqw; color: var(--mark); --pel: var(--mark); opacity: 1; }
:root[data-theme="dark"] .opener .shape { --pel: var(--neon); }
.opener .no { position: absolute; left: 6cqw; top: 3cqw; font-size: 0.9cqw; color: var(--sub); font-variant-numeric: tabular-nums; }
.opener .mini { position: absolute; left: 6cqw; bottom: 3cqw; width: 4.6cqw; color: var(--fg); }

/* ---------- Contents ---------- */
.toc { padding: 4.4cqw 6cqw; display: grid; grid-template-columns: 22cqw 1fr; }
.toc h2 { margin: 0; font-size: 1.62cqw; font-weight: 650; }
.toc h2 .en { display: block; font-size: 0.78cqw; color: var(--sub); font-weight: 450; margin-top: 0.4cqw; }
.toc .cols { display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(6, auto); grid-auto-flow: column; gap: 0 4cqw; align-content: start; }
.toc a { display: grid; grid-template-columns: 4cqw 1fr auto; align-items: baseline; text-decoration: none; padding: 1.15cqw 0; border-top: 1px solid var(--line); font-size: 2.2cqw; font-weight: 600; letter-spacing: -0.03em; }
.toc a small { font-size: 0.8cqw; font-weight: 450; color: var(--sub); letter-spacing: 0; }
.toc a .n { font-size: 0.9cqw; color: var(--sub); font-weight: 450; font-variant-numeric: tabular-nums; }
.toc a:hover { color: var(--sub); }
.toc .note { grid-column: 1; align-self: end; font-size: 0.86cqw; line-height: 1.6; color: var(--fg2); max-width: 17cqw; }

/* ---------- Pieces ---------- */
.big-wm { width: 88%; }
.hair-grid { position: absolute; inset: 0; pointer-events: none; }
.hair-grid line, .hair-grid rect { stroke: var(--red); stroke-width: 1; vector-effect: non-scaling-stroke; fill: none; }
.hair-grid text { fill: var(--red); font-size: 9px; font-family: inherit; }
.x-lab { font-size: 0.6cqw; fill: var(--red); }
.dont { position: relative; }
.dont::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top right, transparent calc(50% - 1px), var(--red) calc(50% - 1px), var(--red) calc(50% + 1px), transparent calc(50% + 1px)); pointer-events: none; }
.dont .lab { color: var(--red); }
.sw { place-items: stretch; padding: 1cqw; display: grid; grid-template-rows: auto 1fr auto; }
.sw .nm { font-size: 1.2cqw; font-weight: 650; letter-spacing: -0.02em; }
.sw .codes { font-size: 0.7cqw; line-height: 1.55; opacity: 0.8; font-variant-numeric: tabular-nums; }
.sw .use { font-size: 0.7cqw; line-height: 1.45; opacity: 0.8; }
table.tok { width: 100%; border-collapse: collapse; font-size: 0.74cqw; font-variant-numeric: tabular-nums; align-self: start; }
table.tok th, table.tok td { text-align: left; padding: 0.42cqw 0.6cqw; border-bottom: 1px solid var(--hair); white-space: nowrap; }
table.tok th { color: var(--sub); font-weight: 500; }
table.tok .chip { display: inline-block; width: 0.9cqw; height: 0.9cqw; border-radius: 50%; vertical-align: -0.12cqw; margin-right: 0.45cqw; box-shadow: inset 0 0 0 1px #8888884d; }
.tokwrap { padding: 2.4cqw 1.2cqw 1cqw; place-items: start stretch; overflow: hidden; }

.spec-a { font-size: 5.8cqw; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.alpha { font-size: 1.15cqw; line-height: 1.45; letter-spacing: 0; padding: 1.6cqw; place-items: end start; }
.hier { padding: 2.6cqw 2.6cqw; place-items: stretch; display: grid; gap: 1.1cqw; align-content: center; }
.hier div { display: grid; grid-template-columns: 9cqw 1fr; align-items: baseline; gap: 1cqw; border-top: 1px solid var(--line); padding-top: 0.8cqw; }
.hier small { font-size: 0.66cqw; color: var(--sub); line-height: 1.4; }

.pair { place-items: center start; padding: 0 1.6cqw; font-size: 1.5cqw; font-weight: 600; letter-spacing: -0.02em; }
.pair small { position: absolute; right: 1cqw; bottom: 0.8cqw; font-size: 0.64cqw; font-weight: 450; opacity: 0.75; letter-spacing: 0; }

.copy { place-items: stretch; padding: 2.6cqw 1.6cqw 1.4cqw; display: grid; align-content: start; gap: 0.9cqw; }
.copy h3 { margin: 0; font-size: 1.9cqw; line-height: 1.2; font-weight: 650; letter-spacing: -0.03em; }
.copy p { margin: 0; font-size: 0.82cqw; line-height: 1.6; color: inherit; opacity: 0.82; }
.copy .ex { font-size: 1.15cqw; font-weight: 550; line-height: 1.45; letter-spacing: -0.02em; }
.copy .ex s { text-decoration-color: var(--red); text-decoration-thickness: 2px; opacity: 0.7; }
.copy .tag { font-size: 0.66cqw; letter-spacing: 0; opacity: 0.7; }
.copy .tag.bad { color: var(--red); opacity: 1; }

.dl { padding: 2.4cqw 1.2cqw 1.2cqw; place-items: stretch; align-content: start; display: grid; gap: 0; }
.dl a { display: grid; grid-template-columns: 3cqw 1fr auto; align-items: center; gap: 1cqw; padding: 0.7cqw 0.4cqw; border-top: 1px solid var(--hair); text-decoration: none; font-size: 0.86cqw; }
.dl a:hover { background: var(--hair); }
.dl a .th { width: 3cqw; height: 2.2cqw; display: grid; place-items: center; background: var(--bg); border-radius: 0.3cqw; }
.dl a .th img { max-width: 2.25cqw; max-height: 1.65cqw; } /* % of a grid track overflows tall images */
.dl a small { color: var(--sub); font-size: 0.7cqw; font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .dl a .th img.inv { filter: invert(1); }

/* ---------- Bottom bar (keyAI deck viewer) ---------- */
.bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px);
  box-shadow: 0 0 0 1px var(--line), 0 6px 22px #0000002e; font-size: 13px;
}
.bar button, .bar a { appearance: none; border: 0; background: none; color: var(--fg); font: inherit; height: 32px; min-width: 32px; padding: 0 9px; border-radius: 7px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none; }
.bar button:hover, .bar a:hover { background: var(--hair); }
.bar button:disabled { opacity: 0.3; cursor: default; background: none; }
.bar button:focus-visible, .bar a:focus-visible, .toc a:focus-visible, .dl a:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.bar .count { font-variant-numeric: tabular-nums; min-width: 64px; justify-content: center; }
.bar .count span { color: var(--sub); }
.bar .home .wm { width: 30px; color: var(--fg); }
.bar .sep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }

/* ---------- Text animation (titles rise once per view; off under reduced motion) ---------- */
.anim .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.anim .w > span { display: inline-block; transform: translateY(105%); transition: transform 0.7s cubic-bezier(0.19, 1, 0.22, 1); transition-delay: calc(var(--i) * 40ms); }
.anim .in .w > span { transform: none; }

/* ---------- Phones: slides become natural-height cards, rail becomes a strip ---------- */
@media (max-width: 820px) {
  .deck { padding: 12px 0 88px; gap: 12px; }
  .slide { --w: calc(100vw - 24px); aspect-ratio: auto; min-height: 0; container-type: normal; font-size: 15px; }
  .rule { grid-template-columns: 1fr; }
  .rail { flex-direction: row; align-items: center; padding: 12px 16px; gap: 14px; }
  .rail .wm { width: 44px; }
  .rail ol { display: none; }
  .rail .pg { margin: 0 0 0 auto; font-size: 11px; }
  .rail .cur { display: block; color: var(--neon); font-size: 12px; font-weight: 600; }
  .desc { padding: 20px 18px 6px; }
  .desc h2 { font-size: 23px; }
  .desc h2 .en, .t .en { font-size: 12px; }
  .desc p { font-size: 14px; max-width: none; margin-top: 10px; }
  .desc ol.cap, .desc .spec { margin-top: 14px; font-size: 12.5px; gap: 6px; }
  .desc .spec { grid-template-columns: 88px 1fr; padding-top: 10px; }
  .content { padding: 12px 12px 14px; gap: 8px; grid-template-columns: 1fr 1fr !important; grid-template-rows: none !important; }
  .content > .pn { min-height: 150px; grid-column: auto; grid-row: auto; }
  .content > .pn.wide, .content > .pn.span2, .content > .pn.span3, .content.one > .pn { grid-column: 1 / -1; min-height: 210px; }
  .lab { font-size: 10.5px; left: 10px; top: 9px; }
  .lab i { width: 16px; height: 16px; font-size: 9px; }
  .cover { grid-template-columns: 1fr; padding: 64px 24px 80px; gap: 16px; }
  .cover .wm { width: 62vw; }
  .cover .meta { font-size: 13px; margin: 0; }
  .cover .foot { left: 24px; right: 24px; bottom: 20px; font-size: 11px; }
  .statement { grid-template-columns: 1fr; }
  .statement > .rail { display: none; }
  .statement .body { padding: 40px 22px; gap: 18px; }
  .statement .mk { width: 28px; }
  .statement p { font-size: 22px; }
  .statement p.small { font-size: 14px; }
  .statement .kick { font-size: 13px; }
  .opener { min-height: 300px; }
  .opener h2 { font-size: 64px; bottom: 54px; left: 22px; }
  .opener h2 .en { font-size: 14px; margin-top: 10px; }
  .opener .shape { width: 420px; right: -110px; top: -120px; }
  .opener .no { font-size: 12px; left: 22px; top: 18px; }
  .opener .mini { width: 40px; left: 22px; bottom: 18px; }
  .toc { grid-template-columns: 1fr; padding: 24px 20px; gap: 12px; }
  .toc h2 { font-size: 23px; }
  .toc .cols { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; }
  .toc a { font-size: 20px; padding: 10px 0; grid-template-columns: 34px 1fr auto; }
  .toc a small { font-size: 12px; }
  .toc a .n { font-size: 12px; }
  .toc .note { font-size: 13px; max-width: none; }
  .copy { padding: 30px 14px 14px; gap: 8px; }
  .copy h3 { font-size: 21px; }
  .copy p, .copy .tag { font-size: 12.5px; }
  .copy .ex { font-size: 15px; }
  .sw { padding: 10px; }
  .sw .nm { font-size: 15px; }
  .sw .codes, .sw .use { font-size: 11px; }
  table.tok { font-size: 11px; }
  table.tok th, table.tok td { padding: 5px 4px; white-space: normal; }
  table.tok .chip { width: 10px; height: 10px; }
  .tokwrap { padding: 30px 8px 8px; overflow-x: auto; }
  .spec-a { font-size: 64px; }
  .alpha { font-size: 13px; padding: 14px; }
  .hier { padding: 30px 14px 14px; }
  .hier div { grid-template-columns: 1fr; gap: 2px; }
  .hier small { font-size: 11px; }
  .pair { font-size: 17px; padding: 0 14px; }
  .pair small { font-size: 10px; }
  .slack { grid-template-columns: 34px 1fr; font-size: 13px; padding: 14px; gap: 10px; width: 94%; }
  .slack img { width: 34px; border-radius: 6px; }
  .slack .t, .slack .app { font-size: 10.5px; }
  .dl { padding: 30px 8px 8px; }
  .dl a { grid-template-columns: 40px 1fr auto; font-size: 13px; padding: 9px 4px; gap: 10px; }
  .dl a .th { width: 40px; height: 30px; }
  .dl a .th img { max-width: 30px; max-height: 22px; }
  .dl a small { font-size: 11px; }
  .x-lab { font-size: 9px; }
  .content > .pn.mobile-fixed { grid-column: 1 / -1; container-type: inline-size; aspect-ratio: 16 / 9; min-height: 0; }
  .mobile-fixed .mbar { font-size: 9px; }
  .bar { bottom: 10px; font-size: 12px; }
  .bar .opt { display: none; }
}

/* ---------- Print: one slide per page ---------- */
@media print {
  @page { size: 1600px 900px; margin: 0; }
  html, body { background: #fff; }
  .bar { display: none; }
  .deck { padding: 0; gap: 0; }
  .slide { --w: 1600px; border-radius: 0; box-shadow: none; break-after: page; }
  .anim .w > span { transform: none; transition: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
