/* BTB — Becoming the Best
   One design, two colour modes: dark (default) and light. Same fonts, layout and photos in both.
   The header toggle switches data-theme on <html>; the choice is remembered per visitor. */

/* ---------- Theme tokens ---------- */
:root,
:root[data-theme="dark"] {
  --bg: #0b0a08;
  --surface: #151310;
  --surface-2: #1d1a15;
  --ink: #f4eee3;
  --ink-2: #ddd5c7;
  --muted: #a69d8e;
  --line: #2c2821;
  --accent: #f2a40c;
  --fill: #f2a40c;
  --accent-ink: #0b0a08;
  --accent-soft: rgba(242, 164, 12, .12);
  --warn: #ef6a43;
  --ok: #8fc27a;
  --ok-bg: rgba(143, 194, 122, .13);
  --adv: #ef8a5a;
  --adv-bg: rgba(239, 106, 67, .14);
  --qs-bg: #151310;
  --qs-ink: #f4eee3;
  --qs-muted: #a69d8e;
  --qs-line: #2c2821;
  --hero-fade: 11, 10, 8;
  --shadow: 0 20px 50px rgba(0, 0, 0, .35);

  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --display-weight: 900;
  --display-case: uppercase;
  --display-track: .005em;
  --display-lh: .9;
  --ds: 1;            /* display size scale */
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f1e7;
  --surface: #fffcf5;
  --surface-2: #efe7d8;
  --ink: #14110d;
  --ink-2: #2f2a22;
  --muted: #645b4d;
  --line: #e0d5c1;
  --accent: #a86200;
  --fill: #f2a40c;
  --accent-ink: #0b0a08;
  --accent-soft: rgba(242, 164, 12, .16);
  --warn: #b23a17;
  --ok: #2f7a3b;
  --ok-bg: #e3f1e0;
  --adv: #9a3412;
  --adv-bg: #fde4d6;
  --qs-bg: #14110d;
  --qs-ink: #f4eee3;
  --qs-muted: #c9bfae;
  --qs-line: #2c2821;
  --hero-fade: 246, 241, 231;
  --shadow: 0 18px 44px rgba(60, 40, 10, .14);
  color-scheme: light;
}
:root {
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --max: 1200px;
  --read: 72ch;
  --gutter: clamp(16px, 4vw, 40px);
  --r: 16px;
  --r-sm: 10px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 1.05rem; line-height: 1.65; overflow-x: hidden;
  transition: background-color .25s, color .25s;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--fill); color: var(--accent-ink); }
.sr-skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--fill); color: var(--accent-ink); padding: 10px 14px; border-radius: 8px; }
.sr-skip:focus { left: 8px; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.ico { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 14px; height: 66px; }
.logo { font-family: var(--display); font-weight: var(--display-weight); font-size: 1.85rem; letter-spacing: var(--display-track); color: var(--ink); text-decoration: none; line-height: 1; display: flex; align-items: baseline; gap: 12px; margin-right: auto; }
.logo .mark b { color: var(--accent); }
.logo .sub { font-family: var(--mono); font-size: .6rem; font-weight: 500; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; }
.nav { display: flex; gap: 4px; align-items: center; }
.nav a { font-size: .9rem; font-weight: 500; color: var(--muted); text-decoration: none; padding: 8px 13px; border-radius: 999px; }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--accent-ink); background: var(--fill); }
.theme-toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  font: 600 .8rem var(--body); padding: 8px 12px 8px 9px; border-radius: 999px;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .ico { width: 18px; height: 18px; color: var(--accent); }
.theme-toggle .when-dark, .theme-toggle .when-light { display: none; align-items: center; gap: 7px; }
:root[data-theme="dark"] .theme-toggle .when-dark,
:root:not([data-theme]) .theme-toggle .when-dark,
:root[data-theme="light"] .theme-toggle .when-light { display: inline-flex; }
.nav-toggle { display: none; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font: 600 .8rem var(--body); padding: 8px 13px; border-radius: 999px; cursor: pointer; }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 66px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px var(--gutter) 16px; box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { padding: 14px 6px; font-size: 1rem; border-radius: 0; border-bottom: 1px solid var(--line); }
  .nav a[aria-current="page"] { background: none; color: var(--accent); }
  .logo .sub { display: none; }
  .theme-toggle .label { display: none; }
  .theme-toggle { padding: 8px; }
}

/* ---------- Type ---------- */
.eyebrow { font-family: var(--mono); font-size: .74rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; display: block; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: var(--display-weight); text-transform: var(--display-case); letter-spacing: var(--display-track); line-height: var(--display-lh); margin: 0; text-wrap: balance; }
h2 { font-size: calc(var(--ds) * clamp(2.4rem, 5.5vw, 3.8rem)); margin-bottom: 16px; }
h3 { font-size: calc(var(--ds) * clamp(1.7rem, 3vw, 2.2rem) + (1 - var(--ds)) * 1.6rem); margin: 36px 0 12px; }
h4 { font-family: var(--body); font-size: 1.08rem; font-weight: 700; text-transform: none; letter-spacing: 0; line-height: 1.3; margin: 26px 0 8px; }
p { margin: 0 0 1.05em; }
.lead { font-size: clamp(1.1rem, 2vw, 1.3rem); line-height: 1.55; color: var(--ink-2); max-width: 46ch; }
.muted { color: var(--muted); }
strong { font-weight: 650; }
ul, ol { padding-left: 1.25em; margin: 0 0 1.2em; }
li { margin-bottom: .45em; }
li::marker { color: var(--accent); }
code { font-family: var(--mono); font-size: .85em; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }

/* ---------- Buttons & chips ---------- */
.btn { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 600 .95rem/1 var(--body); padding: 15px 22px; border-radius: 999px; background: var(--fill); color: var(--accent-ink); border: 1.5px solid var(--accent); }
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: color-mix(in srgb, var(--ink) 30%, transparent); }
.btn.ghost:hover { border-color: var(--ink); }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font: 600 .68rem/1 var(--body); letter-spacing: .06em; text-transform: uppercase; padding: 6px 10px; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.chip.beg { background: var(--ok-bg); color: var(--ok); }
.chip.adv { background: var(--adv-bg); color: var(--adv); }
h2 .chip { font-family: var(--body); font-size: .68rem; margin-left: 12px; position: relative; top: -.35em; letter-spacing: .06em; }

/* ---------- Home hero (dark: full photo; light: split with mosaic) ---------- */
.home-hero { position: relative; overflow: hidden; }
.home-hero .bg { position: absolute; inset: 0; }
.home-hero .bg img { width: 100%; height: 100%; object-fit: cover; object-position: 62% 25%; }
.home-hero .bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(var(--hero-fade), .96) 0%, rgba(var(--hero-fade), .72) 45%, rgba(var(--hero-fade), .08) 100%), linear-gradient(0deg, var(--bg) 0%, transparent 32%); }
.home-hero .wrap { position: relative; z-index: 2; min-height: min(88vh, 800px); display: grid; grid-template-columns: 1fr; align-items: end; padding-top: 80px; padding-bottom: 90px; }
.home-hero h1 { font-size: calc(var(--ds) * clamp(3.4rem, 10vw, 8.6rem)); line-height: calc(var(--display-lh) * .96); margin: 6px 0 22px; max-width: 9ch; }
.home-hero h1 em { font-style: normal; color: var(--accent); }
.home-hero .lead { margin-bottom: 28px; }
.mosaic { display: none; }
.photo-credit { position: absolute; right: 12px; bottom: 10px; z-index: 3; font: 500 .62rem var(--mono); color: color-mix(in srgb, var(--ink) 55%, transparent); }
.mosaic figure { margin: 0; position: relative; border-radius: var(--r); overflow: hidden; }
.mosaic figure.tall { grid-row: span 2; }
.mosaic img { width: 100%; height: 100%; object-fit: cover; }
.mosaic figcaption { position: absolute; left: 10px; bottom: 10px; background: var(--surface); color: var(--ink); font: 600 .75rem var(--body); padding: 6px 10px; border-radius: 999px; }

/* ---------- Quick start ---------- */
.qs { background: var(--qs-bg); color: var(--qs-ink); border: 1px solid var(--qs-line); border-radius: calc(var(--r) + 6px); padding: clamp(22px, 3.5vw, 36px); display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: clamp(20px, 3.5vw, 44px); box-shadow: var(--shadow); }
.qs h2 { font-size: calc(var(--ds) * 2.4rem + (1 - var(--ds)) * 1.2rem); margin: 4px 0 10px; color: var(--qs-ink); }
.qs p { color: var(--qs-muted); margin: 0; font-size: .95rem; }
.qs .eyebrow { color: #8fc27a; }
.qs ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; counter-reset: q; }
.qs li { counter-increment: q; margin: 0; background: color-mix(in srgb, var(--qs-ink) 6%, transparent); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.qs li .ico { color: #f2a40c; }
.qs li b { font-weight: 650; font-size: .97rem; line-height: 1.3; }
.qs li b::before { content: counter(q) ". "; color: #f2a40c; }
.qs li span { font-size: .85rem; color: var(--qs-muted); line-height: 1.45; }
.qs li a { color: #f2a40c; }
@media (max-width: 1050px) { .qs { grid-template-columns: 1fr; } .qs ol { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .qs ol { grid-template-columns: 1fr; } }
.qs-wrap { margin-top: -36px; position: relative; z-index: 4; }

/* ---------- Sections (home) ---------- */
.section { padding: clamp(60px, 8vw, 104px) 0; }
.sec-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; margin-bottom: 30px; }
.sec-head h2 { margin: 0; }
.sec-head p { color: var(--muted); max-width: 46ch; margin: 0; }

/* pillar cards */
.pillars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.pillar { position: relative; border-radius: var(--r); overflow: hidden; min-height: 470px; display: flex; flex-direction: column; justify-content: flex-end; text-decoration: none; color: #f4eee3; isolation: isolate; border: 1px solid var(--line); }
.pillar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform .5s; }
.pillar::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, rgba(11, 10, 8, .97) 32%, rgba(11, 10, 8, .35) 70%, rgba(11, 10, 8, .08)); }
.pillar:hover { text-decoration: none; }
.pillar:hover img { transform: scale(1.05); }
.pillar .in { padding: 22px; }
.pillar .top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; color: #f2a40c; font: 500 .74rem var(--mono); letter-spacing: .12em; }
.pillar h3 { font-size: calc(var(--ds) * 2.7rem + (1 - var(--ds)) * 1.2rem); margin: 0 0 10px; color: #f4eee3; }
.pillar p { font-size: .93rem; color: #d9d1c3; margin: 0 0 14px; line-height: 1.5; }
.pillar .lv { display: flex; gap: 6px; flex-wrap: wrap; }
.pillar .chip.beg { background: rgba(143, 194, 122, .18); color: #a9d896; }
.pillar .chip.adv { background: rgba(239, 106, 67, .2); color: #f5a07a; }
.pillar .go { margin-top: 16px; font-weight: 600; font-size: .9rem; color: #f2a40c; }
@media (max-width: 1050px) { .pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .pillars { grid-template-columns: 1fr; } .pillar { min-height: 380px; } }

/* levels explainer */
.levels { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.level { border-radius: var(--r); padding: 28px; background: var(--surface); border: 1px solid var(--line); }
.level h3 { font-size: calc(var(--ds) * 2rem + (1 - var(--ds)) * 1.1rem); margin: 16px 0 10px; }
.level ul { margin: 0; color: var(--ink-2); }
@media (max-width: 760px) { .levels { grid-template-columns: 1fr; } }

/* manifesto */
.story { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.person { border-radius: var(--r); padding: 30px; background: var(--surface); border: 1px solid var(--line); position: relative; overflow: hidden; }
.person .big { position: absolute; right: -6px; top: -24px; font: 900 8.5rem/1 "Big Shoulders Display", Impact, sans-serif; color: transparent; -webkit-text-stroke: 1px var(--line); pointer-events: none; }
.person h3 { font-size: calc(var(--ds) * 2.6rem + (1 - var(--ds)) * 1.2rem); margin: 10px 0 4px; position: relative; }
.person .arc { font: 500 .78rem var(--mono); color: var(--accent); margin-bottom: 14px; position: relative; }
.person p { color: var(--ink-2); position: relative; }
.person p:last-child { margin-bottom: 0; }
@media (max-width: 760px) { .story { grid-template-columns: 1fr; } }
.open-note { display: flex; gap: 16px; align-items: flex-start; background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: var(--r-sm); padding: 20px 22px; margin-top: 18px; }
.open-note .ico { color: var(--accent); margin-top: 2px; }
.open-note p { margin: 0; }

.rules { counter-reset: rule; list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 12px; }
.rules li { counter-increment: rule; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.rules li::before { content: counter(rule, decimal-leading-zero); font: 900 1.8rem/1 "Big Shoulders Display", Impact, sans-serif; color: var(--accent); display: block; margin-bottom: 12px; }
.rules b { display: block; font-weight: 700; font-size: 1.05rem; margin-bottom: 6px; }
.rules span { color: var(--muted); font-size: .95rem; }

.quote { font-family: var(--display); font-weight: var(--display-weight); text-transform: var(--display-case); letter-spacing: var(--display-track); font-size: calc(var(--ds) * clamp(2.2rem, 5vw, 3.4rem)); line-height: var(--display-lh); margin: 0 0 28px; padding: 0; }
.quote cite { display: block; font: 500 .75rem var(--mono); font-style: normal; letter-spacing: .14em; color: var(--muted); margin-top: 14px; text-transform: uppercase; }

/* ---------- Pillar page hero ---------- */
.page-hero { border-bottom: 1px solid var(--line); }
.page-hero .wrap { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); align-items: center; padding-top: clamp(36px, 6vw, 72px); padding-bottom: clamp(36px, 6vw, 72px); }
.page-hero h1 { font-size: calc(var(--ds) * clamp(3.2rem, 8.5vw, 7.4rem)); margin: 4px 0 20px; }
.page-hero h1 em { font-style: normal; color: var(--accent); }
.page-hero .lead { margin-bottom: 0; }
.page-hero figure { margin: 0; position: relative; border-radius: calc(var(--r) + 4px); overflow: hidden; aspect-ratio: 4 / 5; max-height: 560px; box-shadow: var(--shadow); }
.page-hero figure img { width: 100%; height: 100%; object-fit: cover; }
.page-hero figure .badge { position: absolute; left: 14px; top: 14px; background: var(--fill); color: var(--accent-ink); font: 600 .74rem var(--mono); letter-spacing: .12em; padding: 7px 11px; border-radius: 999px; }
.page-hero figcaption { position: absolute; right: 10px; bottom: 8px; font: 500 .6rem var(--mono); color: rgba(255, 255, 255, .8); text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
@media (max-width: 860px) {
  .page-hero .wrap { grid-template-columns: 1fr; }
  .page-hero figure { aspect-ratio: 16 / 10; order: -1; }
}

/* page-top quick start + level filter */
.page-intro { padding-top: clamp(28px, 4vw, 44px); }
.level-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 22px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.level-bar p { margin: 0; color: var(--muted); font-size: .92rem; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; }
.seg button { border: 0; background: none; font: 600 .86rem var(--body); padding: 8px 15px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
body.only-beginner section[data-level="advanced"] { display: none; }
body.only-beginner .toc li.adv { display: none; }

/* ---------- Article layout with TOC ---------- */
.article { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); padding: 44px var(--gutter) 96px; }
.toc { position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 110px); overflow: auto; }
.toc > p { font-family: var(--mono); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line); }
.toc li { margin: 0; }
.toc a { display: flex; align-items: center; gap: 8px; padding: 7px 0 7px 16px; margin-left: -1px; border-left: 2px solid transparent; font-size: .86rem; color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc a::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; opacity: .8; }
.toc li.adv a::after { background: var(--adv); }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }
.prose { max-width: var(--read); min-width: 0; }
.prose > section { margin-bottom: 76px; }
.prose > section:last-of-type { margin-bottom: 40px; }
@media (max-width: 960px) {
  .article { grid-template-columns: 1fr; padding-top: 28px; gap: 24px; }
  .toc { position: static; max-height: none; }
  .toc ol { display: flex; flex-wrap: wrap; gap: 6px; border: 0; }
  .toc a { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; margin: 0; }
  .toc a.active { border-color: var(--accent); }
}

/* ---------- Content blocks ---------- */
.fig { margin: 28px 0; border-radius: var(--r); overflow: hidden; position: relative; }
.fig img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.fig figcaption { font-size: .82rem; color: var(--muted); padding: 10px 2px 0; }
.callout { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--surface); padding: 18px 20px; margin: 24px 0; border-radius: var(--r-sm); font-size: 1rem; }
.callout > :last-child { margin-bottom: 0; }
.callout .tag { font: 600 .7rem var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: 6px; }
.callout.warn { border-left-color: var(--warn); }
.callout.warn .tag { color: var(--warn); }
.callout.ok { border-left-color: var(--ok); }
.callout.ok .tag { color: var(--ok); }

.routine { border: 1px solid var(--line); border-radius: var(--r); margin: 24px 0; overflow: hidden; background: var(--surface); }
.routine-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; background: var(--surface-2); }
.routine-head h4 { margin: 0; }
.routine-head span { font: 500 .7rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.routine-row { display: grid; grid-template-columns: 130px 1fr; border-bottom: 1px solid var(--line); }
.routine-row:last-child { border-bottom: 0; }
.routine-row > div { padding: 12px 18px; font-size: .98rem; }
.routine-row > div:first-child { font: 600 .74rem var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-right: 1px solid var(--line); padding-top: 15px; }
@media (max-width: 560px) { .routine-row { grid-template-columns: 1fr; } .routine-row > div:first-child { border-right: 0; padding-bottom: 0; } }

.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; margin: 24px 0; }
.tool { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: var(--r); padding: 18px; background: var(--surface); text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
a.tool:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.tool .t-name { font-weight: 700; font-size: 1.1rem; line-height: 1.2; }
.tool .t-what { font-size: .92rem; color: var(--muted); line-height: 1.45; }
.tool .t-link { font: 500 .7rem var(--mono); color: var(--accent); margin-top: auto; padding-top: 6px; word-break: break-all; }

.table-wrap { overflow-x: auto; margin: 24px 0; border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; min-width: 540px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 600 .7rem var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 650; }
tbody tr { background: var(--surface); }

.calc { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); margin: 28px 0; overflow: hidden; box-shadow: var(--shadow); }
.calc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding: 18px; border-bottom: 1px solid var(--line); }
.calc-grid label { display: flex; flex-direction: column; gap: 6px; font: 600 .7rem var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.calc-grid label.wide { grid-column: 1 / -1; }
.calc-grid input, .calc-grid select { font: 500 1rem var(--body); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; width: 100%; min-width: 0; text-transform: none; letter-spacing: 0; }
.calc-grid input:focus, .calc-grid select:focus { border-color: var(--accent); outline: none; }
.calc-out { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.calc-out > div { padding: 16px 18px; border-right: 1px solid var(--line); }
.calc-out > div:last-child { border-right: 0; }
.calc-out b { display: block; font: 900 2rem/1 "Big Shoulders Display", Impact, sans-serif; font-variant-numeric: tabular-nums; }
.calc-out .hl b { color: var(--accent); }
.calc-out span { display: block; font-size: .8rem; color: var(--muted); margin-top: 6px; line-height: 1.3; }
@media (max-width: 700px) {
  .calc-grid { grid-template-columns: 1fr 1fr; }
  .calc-out { grid-template-columns: 1fr 1fr; }
  .calc-out > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .calc-out > div:nth-child(odd) { border-right: 1px solid var(--line); }
  .calc-out .hl { grid-column: 1 / -1; order: -1; border-right: 0 !important; }
}

.prompt-box { position: relative; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; font-family: var(--mono); font-size: .85rem; line-height: 1.6; margin: 18px 0; }
.copy-btn { position: absolute; top: 10px; right: 10px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); font: 600 .7rem var(--body); padding: 6px 10px; border-radius: 999px; cursor: pointer; }
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.prompt-box .copy-target { display: block; padding-right: 70px; }
.map { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 20px; display: inline-block; line-height: 1.5; font-size: 1rem; margin: 6px 0 18px; white-space: pre; }
.sources { font-size: .9rem; color: var(--muted); }
.sources li { margin-bottom: .6em; }
.sources a { word-break: break-word; }
.checklist { list-style: none; padding: 0; }
.checklist li { padding: 10px 0 10px 34px; border-bottom: 1px solid var(--line); position: relative; margin: 0; }
.checklist li::before { content: ""; position: absolute; left: 0; top: 13px; width: 18px; height: 18px; border: 2px solid var(--accent); border-radius: 5px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; margin: 24px 0; }
.stat { border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; background: var(--surface); }
.stat b { display: block; font: 900 2.4rem/1 "Big Shoulders Display", Impact, sans-serif; color: var(--accent); }
.stat span { font-size: .9rem; color: var(--muted); line-height: 1.4; display: block; margin-top: 8px; }

.next-pillar { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 28px; margin-top: 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); text-decoration: none; color: var(--ink); }
.next-pillar:hover { border-color: var(--accent); text-decoration: none; }
.next-pillar small { font: 500 .7rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 6px; }
.next-pillar strong { font-family: var(--display); font-weight: var(--display-weight); text-transform: var(--display-case); letter-spacing: var(--display-track); font-size: calc(var(--ds) * clamp(2.2rem, 5vw, 3.4rem)); line-height: 1; }
.next-pillar .arrow { font-size: 2rem; color: var(--accent); }

/* ---------- Money: swipeable tracks ---------- */
.tracks { margin: 26px 0 8px; scroll-margin-top: 84px; }
.track-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; background: var(--surface-2); padding: 6px; border-radius: calc(var(--r) + 4px); }
.track-tabs button { text-align: left; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 12px 14px; border-radius: var(--r); display: flex; flex-direction: column; gap: 3px; font-family: var(--body); transition: background .2s, color .2s; }
.track-tabs button b { font-size: .98rem; font-weight: 700; color: var(--ink); }
.track-tabs button span { font-size: .8rem; line-height: 1.3; }
.track-tabs button[aria-selected="true"] { background: var(--fill); color: var(--accent-ink); box-shadow: var(--shadow); }
.track-tabs button[aria-selected="true"] b { color: var(--accent-ink); }
.swipe-hint { display: none; font-size: .8rem; color: var(--muted); text-align: center; margin: 8px 0 0; }
.track-panel { margin-top: 20px; padding: clamp(18px, 3vw, 28px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); touch-action: pan-y; }
.track-panel.enter-left { animation: slideL .28s ease; }
.track-panel.enter-right { animation: slideR .28s ease; }
@keyframes slideL { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes slideR { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
.track-for { background: var(--accent-soft); border-radius: var(--r-sm); padding: 12px 14px; font-size: .97rem; }
@media (max-width: 700px) {
  .track-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; }
  .track-tabs button { padding: 10px 8px; text-align: center; }
  .track-tabs button span { display: none; }
  .track-tabs button b { font-size: .82rem; }
  .swipe-hint { display: block; }
}
.subtabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 18px 0 4px; padding: 5px; border: 1px solid var(--line); border-radius: calc(var(--r) + 2px); background: var(--bg); }
.subtabs button { text-align: left; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 10px 12px; border-radius: var(--r-sm); display: flex; flex-direction: column; gap: 2px; font-family: var(--body); transition: background .2s, color .2s; }
.subtabs button b { font-size: .95rem; font-weight: 700; color: var(--ink); }
.subtabs button span { font-size: .78rem; line-height: 1.3; }
.subtabs button[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.subpanel { animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 700px) { .subtabs button { padding: 9px 10px; } .subtabs button b { font-size: .88rem; } }
.steps { list-style: none; padding: 0; margin: 20px 0; counter-reset: st; }
.steps > li { counter-increment: st; position: relative; padding: 0 0 18px 52px; margin: 0; border-left: 2px solid var(--line); margin-left: 17px; padding-left: 34px; }
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps > li::before { content: counter(st); position: absolute; left: -18px; top: -2px; width: 34px; height: 34px; border-radius: 50%; background: var(--fill); color: var(--accent-ink); display: grid; place-items: center; font: 800 .95rem var(--body); }
.steps h3 { font-family: var(--body); text-transform: none; letter-spacing: 0; font-size: 1.12rem; font-weight: 700; line-height: 1.3; margin: 4px 0 6px; }
.steps p, .steps ul { margin-bottom: .6em; }

/* ---------- Nav dropdown (Mind > Brain, Behaviour) ---------- */
.nav-group { position: relative; }
.nav-group > a .chev { width: 14px; height: 14px; margin-left: 4px; vertical-align: -2px; stroke: currentColor; fill: none; stroke-width: 2.2; }
.nav-drop { display: none; position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); min-width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 8px; z-index: 60; }
.nav-drop::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.nav-group:hover .nav-drop, .nav-group:focus-within .nav-drop, .nav-group.open .nav-drop { display: block; }
.nav .nav-drop a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--ink); background: none; }
.nav .nav-drop a:hover { background: var(--surface-2); }
.nav .nav-drop a b { font-size: .95rem; }
.nav .nav-drop a span { font-size: .8rem; color: var(--muted); font-weight: 400; }
.nav .nav-drop a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); }
@media (max-width: 860px) {
  .nav-group > a .chev { display: none; }
  .nav-drop { display: block; position: static; transform: none; min-width: 0; background: none; border: 0; box-shadow: none; padding: 0 0 6px 14px; }
  .nav .nav-drop a { padding: 10px 6px; border-bottom: 1px solid var(--line); border-radius: 0; }
  .nav .nav-drop a span { display: none; }
}

/* Mind hub: chapter cards */
.chapters { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.chapter { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; text-decoration: none; color: var(--ink); transition: transform .2s, border-color .2s, box-shadow .2s; }
.chapter:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); text-decoration: none; }
.chapter img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.chapter .in { padding: 22px 24px 26px; display: flex; flex-direction: column; gap: 10px; }
.chapter h3 { margin: 0; font-size: calc(var(--ds) * 2.6rem + (1 - var(--ds)) * 1.2rem); }
.chapter p { margin: 0; color: var(--muted); }
.chapter ul { margin: 4px 0 0; color: var(--ink-2); font-size: .95rem; }
.chapter .go { font-weight: 600; color: var(--accent); margin-top: 6px; }
@media (max-width: 760px) { .chapters { grid-template-columns: 1fr; } }
.crumb { font-size: .88rem; color: var(--muted); margin: 0 0 10px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent); }

/* ---------- Blog ---------- */
.blog-head { padding: clamp(44px, 7vw, 88px) 0 clamp(24px, 4vw, 40px); }
.blog-head h1 { font-size: calc(var(--ds) * clamp(3.2rem, 9vw, 7rem)); margin: 4px 0 18px; }
.blog-head h1 em { font-style: normal; color: var(--accent); }
.blog-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; padding-bottom: 96px; }
.post-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; text-decoration: none; color: var(--ink); transition: transform .2s, border-color .2s, box-shadow .2s; }
.post-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); text-decoration: none; }
.post-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.pc-in { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pc-kicker { font: 600 .74rem var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0; display: flex; gap: 8px; align-items: center; }
.post-card h3 { font-size: calc(var(--ds) * 1.9rem + (1 - var(--ds)) * 1rem); margin: 2px 0 0; }
.post-card p { margin: 0; color: var(--muted); font-size: .95rem; }
.post-card.featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.2fr 1fr; }
.post-card.featured img { aspect-ratio: auto; height: 100%; min-height: 320px; }
.post-card.featured .pc-in { padding: clamp(22px, 4vw, 44px); justify-content: center; gap: 14px; }
.post-card.featured h2 { margin: 0; font-size: calc(var(--ds) * clamp(2.4rem, 4.5vw, 3.6rem)); }
.post-card.featured p { font-size: 1.05rem; }
.pc-go { font-weight: 600; color: var(--accent); }
@media (max-width: 960px) { .blog-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .blog-list { grid-template-columns: 1fr; } .post-card.featured { grid-template-columns: 1fr; } .post-card.featured img { min-height: 0; aspect-ratio: 16 / 10; } }

.post { padding-bottom: 80px; }
.post-head { max-width: 760px; margin: 0 auto; padding: clamp(36px, 6vw, 72px) var(--gutter) 28px; }
.post-head .back { font-size: .9rem; color: var(--muted); text-decoration: none; }
.post-head .back:hover { color: var(--accent); }
.post-kicker { display: flex; align-items: center; gap: 10px; font: 600 .78rem var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 22px 0 14px; }
.post-head h1 { font-size: calc(var(--ds) * clamp(2.8rem, 7vw, 5.2rem)); margin: 0 0 18px; }
.dek { font-size: clamp(1.1rem, 2.2vw, 1.3rem); color: var(--ink-2); line-height: 1.5; margin: 0 0 18px; }
.byline { font-size: .9rem; color: var(--muted); margin: 0; }
.post-cover { max-width: 1060px; margin: 8px auto 0; padding: 0 var(--gutter); }
.post-cover img { width: 100%; aspect-ratio: 16 / 8; object-fit: cover; border-radius: var(--r); }
.post-cover figcaption { font-size: .78rem; color: var(--muted); padding-top: 8px; }
.post-body { max-width: 760px; margin: 0 auto; padding: 36px var(--gutter) 0; font-size: 1.12rem; line-height: 1.75; }
.post-body h2 { font-size: calc(var(--ds) * clamp(2rem, 4vw, 2.6rem) + (1 - var(--ds)) * .9rem); margin: 44px 0 14px; }
.post-body > p:first-child { font-size: 1.22rem; }
.post-foot { max-width: 760px; margin: 0 auto; padding: 36px var(--gutter) 0; border-top: 0; }
.post-foot .muted { margin-bottom: 10px; font-size: .9rem; }
.post .table-wrap { font-size: .95rem; line-height: 1.55; }

/* home: latest posts strip */
.latest { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .latest { grid-template-columns: 1fr; } }

/* ---------- Protocol library ---------- */
.lib-tools { position: sticky; top: 66px; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 14px 0; border-bottom: 1px solid var(--line); }
.lib-tools .wrap { display: flex; flex-direction: column; gap: 12px; }
.lib-search { width: 100%; font: 500 1rem var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 13px 20px; }
.lib-search:focus { outline: none; border-color: var(--accent); }
.lib-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.lib-filters button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: 600 .84rem var(--body); padding: 8px 14px; border-radius: 999px; cursor: pointer; }
.lib-filters button[aria-pressed="true"] { background: var(--fill); color: var(--accent-ink); border-color: var(--fill); }
.lib-count { font-size: .88rem; color: var(--muted); margin: 0; }
.lib { padding-top: 24px; padding-bottom: 96px; }
.lib-group { margin-bottom: 36px; }
.lib-group h2 { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.lib-group h2 small { font: 500 .8rem var(--body); color: var(--muted); text-transform: none; letter-spacing: 0; }
.lib-sub { font: 700 .8rem var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 22px 0 8px; }
.lib-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.lib-list li { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px 12px 14px; display: grid; grid-template-columns: 62px 1fr; gap: 10px; font-size: .95rem; line-height: 1.5; }
.lib-list code { background: none; padding: 0; font-size: .72rem; color: var(--muted); padding-top: 3px; }
.lib-list li.flag { border-left: 3px solid var(--warn); }
.lib-list .note { display: block; font-size: .82rem; color: var(--warn); margin-top: 4px; }
@media (max-width: 760px) { .lib-list { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 48px 0 56px; font-size: .92rem; color: var(--muted); }
.site-footer .wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.site-footer h5 { font: 600 .72rem var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); margin: 0 0 12px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer .big { font-family: var(--display); font-weight: var(--display-weight); font-size: 2.3rem; color: var(--ink); line-height: 1; margin-bottom: 10px; }
@media (max-width: 760px) { .site-footer .wrap { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
