/* Contextbook — custom layer.
   Tailwind (CDN) handles layout and spacing utilities.
   This file owns the components Tailwind is clumsy at, plus the
   accessibility floor. Keep component classes here and utilities in the
   markup, so the two never fight over the same property.                    */

:root {
  --ink:       #131522;
  --ink2:      #2A2E44;
  --paper:     #ECEDF1;
  --card:      #FFFFFF;
  --rule:      #D3D6E0;
  --muted:     #5C6178;
  --sig:       #2A34E8;
  --sig-pale:  #C5CAFB;
  --mem:       #6E3BD1;
  --convo:     #8A90A8;
  --waste:     #D31F5C;
  --waste-pale:#F3A9C2;
  --empty:     #DFE2EA;

  /* Semantic colour, used the same way everywhere on the site:
     blue = base / neutral, green = correct, red = wrong.
     Nothing is coloured for decoration. */
  --base:      #2A34E8;
  --ok:        #1A6E47;
  --ok-pale:   #DFE9E2;
  --ok-light:  #2FA870;
  --ok-med:    #21805A;
  --ok-dark:   #0D3A25;
  --bad:       #BF1F4A;
  --bad-pale:  #F8D7E1;
}

html { scroll-behavior: smooth; }
body { text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }

/* ── accessibility floor ─────────────────────────────────────────── */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: var(--ink);
  color: var(--card);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}
.skip-link:focus { left: 0; }

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

/* ── header and navigation ───────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--rule);
  background: rgba(236, 237, 241, 0.92);
  backdrop-filter: blur(8px);
}

.nav-desktop {
  display: none;
  align-items: center;
  gap: 1.4rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.nav-desktop a { color: var(--muted); transition: color 160ms ease; }
.nav-desktop a:hover { color: var(--ink); }
.nav-desktop .nav-cta {
  padding: 0.45rem 0.85rem;
  border-radius: 2px;
  background: var(--ink);
  color: var(--card);
  transition: background-color 160ms ease;
}
.nav-desktop .nav-cta:hover { background: var(--sig); color: var(--card); }

.nav-toggle {
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--card);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink);
}

.nav-mobile {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--rule);
  background: var(--card);
}
.nav-mobile a {
  padding: 0.95rem 1.25rem;
  border-bottom: 1px solid var(--rule);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
}
.nav-mobile a:last-child { border-bottom: 0; }
.nav-mobile[hidden] { display: none; }

.nav-desktop a[aria-current="page"],
.nav-mobile a[aria-current="page"] {
  color: var(--ink);
  font-weight: 700;
}
.nav-desktop .nav-cta[aria-current="page"] {
  color: var(--card);
  background: var(--sig);
}

@media (min-width: 768px) {
  .nav-desktop { display: flex; }
  .nav-toggle,
  .nav-mobile { display: none; }
}

/* ── hero mark ───────────────────────────────────────────────────── */

/* The phrase sits inside a drawn window, boundaries and all — the one
   ornament on the page, and it is literally the subject.               */
.hl-window {
  position: relative;
  white-space: nowrap;
  padding: 0 0.12em;
  background: linear-gradient(var(--sig-pale), var(--sig-pale)) no-repeat;
  background-size: 100% 0.34em;
  background-position: 0 82%;
  box-shadow: inset 2px 0 0 var(--sig), inset -2px 0 0 var(--sig);
}

/* ── the two doors ───────────────────────────────────────────────── */

.door {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.4rem 1.5rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--card);
  transition: border-color 180ms ease, transform 180ms ease;
}
.door:hover { border-color: var(--ink); transform: translateY(-2px); }
.door-accent { border-color: var(--sig-pale); }
.door-accent:hover { border-color: var(--sig); }

.door-kicker {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.door-title {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.door-note {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--muted);
}
.door-go {
  margin-top: 0.5rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sig);
}

/* ── panels and buttons ──────────────────────────────────────────── */

.panel {
  padding: 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--card);
}
@media (min-width: 640px) { .panel { padding: 2rem; } }

.btn-solid,
.btn-outline {
  display: inline-block;
  padding: 0.8rem 1.25rem;
  border-radius: 2px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.btn-solid {
  background: var(--sig);
  color: var(--card);
  transition: transform 160ms ease;
}
.btn-solid:hover { transform: translateY(-1px); }
.btn-outline {
  border: 1px solid var(--ink);
  color: var(--ink);
  transition: background-color 160ms ease, color 160ms ease;
}
.btn-outline:hover { background: var(--ink); color: var(--card); }

/* ── the "explain it to me" disclosure ───────────────────────────── */

.helper {
  border: 1px solid var(--sig-pale);
  border-radius: 4px;
  background: #F6F7FE;
}
.helper > summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sig);
  list-style: none;
}
.helper > summary::-webkit-details-marker { display: none; }
.helper > summary::before { content: "+ "; }
.helper[open] > summary::before { content: "− "; }
.helper > p {
  padding: 0 1rem 1rem;
  max-width: 68ch;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink2);
}
.helper strong { font-weight: 600; color: var(--ink); }

/* ── the three steps ─────────────────────────────────────────────── */

.step { padding-top: 1.25rem; border-top: 2px solid var(--ink); }
.step-num {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--sig);
}
.step-title {
  margin-top: 0.5rem;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.step-text {
  margin-top: 0.6rem;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--ink2);
}

/* ── callout ─────────────────────────────────────────────────────── */

.callout {
  padding: 1.5rem;
  border-left: 3px solid var(--sig);
  background: var(--paper);
  border-radius: 0 4px 4px 0;
}
.callout-title {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.callout-list { margin-top: 0.9rem; display: grid; gap: 0.5rem; max-width: 74ch; }
.callout-list li {
  position: relative;
  padding-left: 1.4rem;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink2);
}
.callout-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--sig);
}
.callout-foot {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: var(--muted);
}

/* ── the context-window strip ────────────────────────────────────── */

.strip {
  display: flex;
  width: 100%;
  height: 4.5rem;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--empty);
}

.seg {
  position: relative;
  min-width: 0;
  transition: width 620ms cubic-bezier(0.22, 0.68, 0.24, 1);
}
.seg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--card);
  opacity: 0;
  transition: opacity 160ms ease;
}
.seg.is-lit::after { opacity: 0.28; }

/* Hatching marks the tokens that were paid for and never read. */
.seg[data-key="skills-cold"],
.seg[data-key="memory-cold"] {
  background-image: repeating-linear-gradient(
    -45deg,
    var(--waste) 0 5px,
    var(--waste-pale) 5px 10px
  );
}

.seg-system      { background: var(--ink); }
.seg-skills-warm { background: var(--sig); }
.seg-skill-index { background: var(--sig-pale); }
.seg-memory-warm { background: var(--mem); }
.seg-convo       { background: var(--convo); }

/* ── legend ──────────────────────────────────────────────────────── */

.legend-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--rule);
  cursor: default;
}
.legend-row:last-child { border-bottom: 0; }

.legend-swatch {
  flex: none;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  transform: translateY(1px);
}
.legend-label {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink2);
}
.legend-val {
  margin-left: auto;
  padding-left: 1rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.legend-row.is-waste .legend-label { color: var(--waste); }

/* ── mode toggle ─────────────────────────────────────────────────── */

.mode-btn {
  color: var(--muted);
  border-radius: 2px;
  transition: background-color 180ms ease, color 180ms ease;
}
.mode-btn:hover { color: var(--ink); }
.mode-btn.is-active { background: var(--ink); color: var(--card); }

/* ── curriculum ladder ───────────────────────────────────────────── */

.level {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 0 1rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 768px) {
  .level { grid-template-columns: 6rem 1fr; gap: 0 1.5rem; }
}

.level-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--rule);
  padding-top: 0.35rem;
}
.level.is-core .level-num { color: var(--sig); }

.level-title {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.level-desc {
  margin-top: 0.5rem;
  max-width: 58ch;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink2);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1rem;
}
.tags li {
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  background: var(--card);
}
.level.is-core .tags li { border-color: var(--sig-pale); color: var(--sig); }

/* ── repository tree ─────────────────────────────────────────────── */

.tree { margin: 0; }
.tree .d { color: var(--ink); font-weight: 500; }
.tree .c { color: var(--muted); }

/* ── footer ──────────────────────────────────────────────────────── */

.foot-nav { display: flex; flex-direction: column; gap: 0.4rem; }
.foot-head {
  margin-bottom: 0.35rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.foot-nav a {
  font-size: 1rem;
  color: var(--ink2);
  transition: color 160ms ease;
}
.foot-nav a:hover { color: var(--sig); }

/* ── resources page ──────────────────────────────────────────────── */

.res-tier {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.tier-official  { background: #E4F0E8; color: #2E6B45; }
.tier-community { background: #FDF0DC; color: #8A5A12; }

.res-card {
  display: block;
  padding: 1.15rem 1.35rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--card);
  transition: border-color 180ms ease, transform 180ms ease;
}
.res-card:hover { border-color: var(--sig); transform: translateY(-2px); }
.res-name {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.res-desc {
  margin-top: 0.35rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink2);
}
.res-url {
  margin-top: 0.6rem;
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

.concept {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
}
.concept-name {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.concept-plain {
  margin-top: 0.3rem;
  max-width: 74ch;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--ink2);
}
.concept-where {
  margin-top: 0.4rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--sig);
}

/* ── skill collection page ───────────────────────────────────────── */

.asset-page { background: #1E1D1C; color: #F4F1EA; }
.asset-page .site-header { border-bottom-color: var(--rule); background: rgba(236, 237, 241, 0.92); }
.asset-page .site-header a, .asset-page .nav-toggle { color: var(--ink); }
.asset-page .nav-desktop a { color: var(--muted); }
.asset-page .nav-desktop a:hover, .asset-page .nav-desktop a[aria-current="page"] { color: var(--ink); }
.asset-page .nav-toggle { border-color: var(--rule); background: var(--card); }
.asset-page .nav-mobile { background: var(--card); border-top-color: var(--rule); }
.asset-page .nav-mobile a { color: var(--ink); border-bottom-color: var(--rule); }
.asset-page .text-sig { color: var(--sig); }
.asset-hero { position: relative; min-height: 37rem; overflow: hidden; display: flex; align-items: center; padding: 5rem max(1.25rem, calc((100vw - 72rem) / 2)); background: #1E1D1C; }
.asset-hero::after { content: ""; position: absolute; right: 8%; bottom: -11rem; width: 34rem; height: 34rem; border-radius: 50%; background: #9BAF7F; opacity: 0.12; filter: blur(1px); }
.asset-hero-inner { position: relative; z-index: 1; max-width: 45rem; }
.asset-kicker { font: 500 0.68rem/1.3 "JetBrains Mono", monospace; letter-spacing: 0.16em; text-transform: uppercase; color: #B5B0A6; }
.asset-kicker-dot { display: inline-block; width: 0.45rem; height: 0.45rem; margin-right: 0.55rem; border-radius: 50%; background: #D6A0B7; }
.asset-hero h1 { margin-top: 1.5rem; font: 800 clamp(3.4rem, 8vw, 7rem)/0.9 "Bricolage Grotesque", sans-serif; letter-spacing: -0.055em; }
.asset-hero h1 em { color: #B8CFC8; font-style: normal; }
.asset-lede { max-width: 32rem; margin-top: 2rem; color: #C3BFB7; font: 1.15rem/1.6 "Source Serif 4", Georgia, serif; }
.asset-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2.2rem; }
.asset-button { display: inline-flex; align-items: center; gap: 0.75rem; padding: 0.8rem 1rem; font: 500 0.68rem/1 "JetBrains Mono", monospace; letter-spacing: 0.08em; text-transform: uppercase; }
.asset-button-primary { color: #232522; background: #D6A0B7; }
.asset-button-quiet { color: #F4F1EA; border: 1px solid rgba(244,241,234,0.28); }
.asset-button:hover { transform: translateY(-2px); }
.asset-hero-note { position: absolute; right: max(1.25rem, calc((100vw - 72rem) / 2)); bottom: 3rem; z-index: 1; color: #817D76; font: 0.68rem/1.5 "JetBrains Mono", monospace; text-align: right; text-transform: uppercase; letter-spacing: 0.12em; }
.asset-collection { padding: 7rem max(1.25rem, calc((100vw - 72rem) / 2)); background: #F1EEE8; color: #242320; }
.asset-section-heading { display: flex; justify-content: space-between; gap: 3rem; align-items: end; margin-bottom: 3rem; }
.asset-section-heading .asset-kicker { color: #77736B; }
.asset-section-heading h2, .asset-next h2 { margin-top: 1rem; font: 800 clamp(2.3rem, 5vw, 4.5rem)/0.93 "Bricolage Grotesque", sans-serif; letter-spacing: -0.05em; }
.asset-section-heading h2 span { color: #9B6C80; }
.asset-section-heading > p { max-width: 24rem; color: #77736B; font: 1.05rem/1.55 "Source Serif 4", Georgia, serif; }
.asset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; }
.skill-card { display: block; color: inherit; }
.skill-window { min-height: 25rem; padding: 2.5rem; border-radius: 1.6rem; transition: transform 220ms ease; }
.skill-card:hover .skill-window { transform: translateY(-0.4rem) rotate(-0.5deg); }
.skill-card-green { --card-bg: #849B68; }
.skill-card-mint { --card-bg: #B8CFC8; }
.skill-card-sand { --card-bg: #D8B88F; }
.skill-card-blue { --card-bg: #8EA8BB; }
.skill-window { background: var(--card-bg); }
.skill-window-chat { display: flex; flex-direction: column; justify-content: center; gap: 1.5rem; color: #2A2927; }
.chat-pill { padding: 0.8rem 1rem; border-radius: 0.75rem; background: #F4F1EA; font: 0.9rem "Bricolage Grotesque", sans-serif; box-shadow: 0 0.4rem 1.4rem rgba(38,38,32,0.08); }
.chat-mark { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; margin-right: 0.45rem; border-radius: 50%; color: #F4F1EA; background: #C86D8E; }
.chat-copy { max-width: 26rem; font: 1.08rem/1.3 "Source Serif 4", Georgia, serif; }
.chat-status { padding: 0.85rem; border: 1px solid rgba(42,41,39,0.15); border-radius: 0.55rem; color: #59564F; font: 0.73rem/2 "JetBrains Mono", monospace; }
.chat-status span { margin-right: 0.5rem; color: #435D44; }
.skill-file { display: flex; align-items: center; gap: 0.7rem; padding: 0.75rem; border: 1px solid rgba(42,41,39,0.13); border-radius: 0.55rem; background: rgba(244,241,234,0.7); font: 0.78rem "JetBrains Mono", monospace; }
.file-icon { font-size: 1.35rem; }.skill-file small { display: block; margin-top: 0.2rem; color: #77736B; font-size: 0.62rem; }.file-arrow { margin-left: auto; font-size: 1.2rem; }
.skill-window-code { padding: 0; overflow: hidden; color: #C9C3B8; background: #1B1C1A; }
.code-top { display: flex; gap: 0.55rem; padding: 0.9rem 1.1rem; background: #30322F; }.code-top span { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: #8D938B; }
.skill-window-code pre { padding: 2.2rem 1.6rem; white-space: pre-wrap; font: 0.84rem/1.7 "JetBrains Mono", monospace; }
.skill-window-writing { display: flex; flex-direction: column; justify-content: center; gap: 1.2rem; color: #5D4632; background: #D7B88E; }.writing-number { font: 0.75rem "JetBrains Mono", monospace; }.writing-line { display: block; width: 78%; height: 0.45rem; border-radius: 1rem; background: rgba(93,70,50,0.25); }.writing-line.wide { width: 92%; }.writing-line.short { width: 54%; }.writing-highlight { align-self: start; padding: 0.5rem 0.7rem; background: #F4E5C9; font: 800 1.7rem "Bricolage Grotesque", sans-serif; }
.skill-window-layout { display: grid; grid-template-columns: 1.35fr 1fr; grid-template-rows: 1.2fr 0.7fr 0.55fr; gap: 0.8rem; background: #A9C1D0; }.layout-block { border-radius: 0.8rem; background: #E5EDF0; }.layout-large { grid-row: span 2; background: #3D5662; }.layout-wide { grid-column: span 2; background: #D6A0B7; }
.skill-card-caption { display: grid; grid-template-columns: 2.5rem 1fr; padding: 1.2rem 0 0; color: #242320; }.skill-card-caption span { color: #99938A; font: 0.68rem "JetBrains Mono", monospace; }.skill-card-caption strong { font: 800 1.25rem/1.1 "Bricolage Grotesque", sans-serif; }.skill-card-caption small { grid-column: 2; margin-top: 0.35rem; color: #77736B; font: 0.7rem "JetBrains Mono", monospace; text-transform: uppercase; letter-spacing: 0.08em; }
.asset-next { display: flex; justify-content: space-between; gap: 3rem; padding: 7rem max(1.25rem, calc((100vw - 72rem) / 2)); background: #B8CFC8; color: #242320; }.asset-next .asset-kicker { color: #596E6A; }.asset-next-links { display: grid; min-width: min(100%, 24rem); }.asset-next-links a { display: flex; justify-content: space-between; gap: 1rem; padding: 1.2rem 0; border-bottom: 1px solid rgba(36,35,32,0.22); }.asset-next-links span { color: #596E6A; font: 0.65rem "JetBrains Mono", monospace; text-transform: uppercase; }.asset-next-links strong { font: 800 1.05rem "Bricolage Grotesque", sans-serif; }.asset-footer { display: flex; justify-content: space-between; gap: 2rem; padding: 3rem max(1.25rem, calc((100vw - 72rem) / 2)); color: #B9B5AC; background: #1E1D1C; }.asset-footer p { margin-top: 0.6rem; color: #817D76; font: 0.8rem "JetBrains Mono", monospace; }.asset-footer nav { display: flex; flex-wrap: wrap; align-content: start; gap: 1rem 1.5rem; font: 0.7rem "JetBrains Mono", monospace; text-transform: uppercase; }.asset-footer a:hover { color: #F4F1EA; }
@media (max-width: 700px) { .asset-hero { min-height: 34rem; padding-top: 4rem; }.asset-hero-note { display: none; }.asset-section-heading, .asset-next, .asset-footer { display: block; }.asset-section-heading > p { margin-top: 1.5rem; }.asset-grid { grid-template-columns: 1fr; }.skill-window { min-height: 21rem; }.asset-next-links { margin-top: 2rem; }.asset-footer nav { margin-top: 2rem; } }

/* ── motion preference ───────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .seg,
  .seg::after,
  .mode-btn,
  .door,
  .res-card,
  .btn-solid,
  .btn-outline,
  a { transition: none !important; }
  .door:hover,
  .res-card:hover,
  .btn-solid:hover { transform: none; }
}

/* ── article pages ───────────────────────────────────────────────── */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.breadcrumb a { color: var(--muted); transition: color 160ms ease; }
.breadcrumb a:hover { color: var(--sig); }
.breadcrumb [aria-current] { color: var(--ink); font-weight: 700; }

/* The rail is the "you are here" for the whole course. */
.phase-rail {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin-top: 1.5rem;
  list-style: none;
}
.phase-rail a,
.phase-rail span {
  display: block;
  padding: 0.6rem 0.7rem 0.7rem;
  border-top: 3px solid var(--rule);
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  transition: border-color 160ms ease, color 160ms ease;
}
.phase-rail a:hover { border-top-color: var(--ink); color: var(--ink); }
.phase-rail .is-here {
  border-top-color: var(--sig);
  color: var(--sig);
  font-weight: 700;
}
.phase-rail .rail-n { display: block; font-size: 13px; font-weight: 700; }
.phase-rail .rail-name { display: none; }
@media (min-width: 640px) { .phase-rail .rail-name { display: block; margin-top: 0.2rem; } }

.article-grid { display: grid; gap: 2.5rem; }
/* Grid items default to a min-content minimum, so the long <pre> blocks in
   .prose set the column floor and push the whole grid past the container.
   min-width:0 lets them shrink and scroll internally instead. */
.article-grid > * { min-width: 0; }
@media (min-width: 1024px) {
  .article-grid { grid-template-columns: 15rem minmax(0, 1fr); gap: 4rem; }
}

.toc { position: static; }
@media (min-width: 1024px) {
  .toc { position: sticky; top: 5.5rem; align-self: start; max-height: calc(100vh - 7rem); overflow-y: auto; }
}
.toc-head {
  margin-bottom: 0.75rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.toc ol { list-style: none; display: flex; flex-direction: column; }
.toc a {
  display: block;
  padding: 0.4rem 0 0.4rem 0.85rem;
  border-left: 2px solid var(--rule);
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--muted);
  transition: color 160ms ease, border-color 160ms ease;
}
.toc a:hover { color: var(--ink); border-left-color: var(--ink); }
.toc a.is-current {
  color: var(--sig);
  border-left-color: var(--sig);
  font-weight: 600;
}

/* ── prose ───────────────────────────────────────────────────────── */

.prose > section { padding-top: 2.5rem; scroll-margin-top: 5.5rem; }
.prose > section + section { margin-top: 1rem; border-top: 1px solid var(--rule); }

.prose h2 {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
}
.prose h3 {
  margin-top: 2rem;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.prose p {
  margin-top: 1.1rem;
  max-width: 68ch;
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--ink2);
}
.prose strong { font-weight: 600; color: var(--ink); }
.prose a { color: var(--sig); text-decoration: underline; text-underline-offset: 3px; }

.prose ul, .prose ol.numbered {
  margin-top: 1.1rem;
  max-width: 68ch;
  display: grid;
  gap: 0.6rem;
}
.prose ul li, .prose ol.numbered li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--ink2);
}
.prose ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--sig);
}
.prose ol.numbered { counter-reset: n; }
.prose ol.numbered li::before {
  counter-increment: n;
  content: counter(n) ".";
  position: absolute;
  left: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
  color: var(--sig);
}

.prose code {
  padding: 0.1em 0.35em;
  border-radius: 3px;
  background: #E3E5EC;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.88em;
  color: var(--ink);
}
.prose pre {
  margin-top: 1.25rem;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--card);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  line-height: 1.8;
}
.prose pre code { padding: 0; background: none; font-size: inherit; }

.keypoint {
  margin-top: 1.5rem;
  padding: 1.15rem 1.35rem;
  border-left: 3px solid var(--sig);
  border-radius: 0 4px 4px 0;
  background: var(--card);
}
.keypoint p { margin-top: 0; font-size: 1.05rem; }
.keypoint-label {
  display: block;
  margin-bottom: 0.4rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--sig);
}

/* ── prev / next ─────────────────────────────────────────────────── */

.pager { display: grid; gap: 1rem; margin-top: 4rem; }
@media (min-width: 640px) { .pager { grid-template-columns: 1fr 1fr; } }
.pager a {
  display: block;
  padding: 1.15rem 1.35rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--card);
  transition: border-color 160ms ease;
}
.pager a:hover { border-color: var(--sig); }
.pager .dir {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.pager .to {
  display: block;
  margin-top: 0.3rem;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.pager .next { text-align: right; }

/* Topic tags become real links once there is somewhere to go. */
.tags li a { display: block; color: inherit; }
.tags li:hover { border-color: var(--sig); }
.level.is-core .tags li:hover { border-color: var(--sig); }

@media (prefers-reduced-motion: reduce) {
  .toc a, .pager a, .phase-rail a, .breadcrumb a { transition: none !important; }
}

/* ── module bar (AI Mastery page) ────────────────────────────────── */

/* A horizontal companion to .toc, for pages whose layout has no room for a
   sidebar. Same job: always answer "which part am I in". */
.modulebar {
  position: sticky;
  top: 3.4rem;
  z-index: 40;
  margin: 0 -1rem 3rem;
  padding: 0.5rem 1rem;
  background: rgba(249, 247, 242, 0.94);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.modulebar ol {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: none;
}
.modulebar ol::-webkit-scrollbar { display: none; }
.modulebar li { flex: none; }
.modulebar a {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--muted);
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.modulebar a:hover { color: var(--ink); border-color: var(--rule); }
.modulebar .mod-n {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  opacity: 0.7;
}
.modulebar a.is-current {
  background: #4F46E5;
  border-color: #4F46E5;
  color: #FFFFFF;
  font-weight: 600;
}
.modulebar a.is-current .mod-n { opacity: 0.85; }

@media (prefers-reduced-motion: reduce) { .modulebar a { transition: none !important; } }

/* ── skill phase tabs (AI Mastery, Module 01) ────────────────────── */

.skill-tab.is-active {
  background: #4F46E5;
  border-color: #4F46E5;
  color: #FFFFFF;
}
.skill-tab.is-active:hover { border-color: #4F46E5; }

/* ── ethics section ──────────────────────────────────────────────── */

/* Deliberately a different world from the rest of the book: green rather
   than ultramarine, warmer paper, a narrower measure and more air. It reads
   as a charter, not a chapter. Scoped to body.eth so none of it leaks. */

.nav-eth {
  padding: 0.45rem 0.85rem;
  border-radius: 2px;
  background: #1A6E47;
  color: #FFFFFF !important;
  transition: background-color 160ms ease;
}
.nav-eth:hover { background: #0D4A32; color: #FFFFFF !important; }
.nav-mobile .nav-eth { border-radius: 0; }

body.eth {
  --eth-ink:   #0F2E1F;
  --eth-body:  #35495F;
  --eth-paper: #F2F7F4;
  --eth-card:  #FFFFFF;
  --eth-rule:  #D1DFD8;
  --eth-green: #1A6E47;
  --eth-pale:  #DFE9E2;
  background: #F2F7F4;
  color: var(--eth-ink);
}
body.eth .site-header { background: rgba(241,245,242,0.93); border-bottom-color: var(--eth-rule); }
body.eth .breadcrumb a:hover { color: var(--eth-green); }

.eth-band {
  background: linear-gradient(135deg, #0D4A32 0%, #1A6E47 45%, #2E9B6E 100%);
  color: #EAF3EE;
  border-bottom: 1px solid rgba(255,255,255,0.16);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.12);
}
.eth-band .eth-kicker { color: #bfe4cf; }
.eth-wrap { max-width: 46rem; margin: 0 auto; }

.eth-h1 {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  font-weight: 800; letter-spacing: -0.025em; line-height: 1.02;
  color: #FFFFFF;
}
.eth-lede { margin-top: 1.4rem; font-size: 1.2rem; line-height: 1.65; color: #CFE6DA; }
.eth-kicker {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em;
}

.eth-doors { display: grid; gap: 1rem; }
@media (min-width: 720px) { .eth-doors { grid-template-columns: 1fr 1fr; gap: 1.25rem; } }

.eth-door {
  display: flex; flex-direction: column; gap: 0.5rem;
  padding: 2rem 1.9rem;
  border: 1px solid var(--eth-rule); border-radius: 6px;
  background: var(--eth-card);
  transition: border-color 180ms ease, transform 180ms ease;
}
.eth-door:hover { border-color: var(--eth-green); transform: translateY(-3px); }
.eth-door-icon {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--eth-green);
}
.eth-door-title {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1;
  color: var(--eth-ink);
}
.eth-door-note { font-size: 1.05rem; line-height: 1.55; color: var(--eth-body); }
.eth-door-go {
  margin-top: 0.6rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--eth-green);
}

.eth-principle {
  padding-top: 1.6rem; margin-top: 2.6rem;
  border-top: 2px solid var(--eth-ink);
  scroll-margin-top: 5.5rem;
}
.eth-n {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em;
  color: var(--eth-green);
}
.eth-principle h2 {
  margin-top: 0.6rem;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: clamp(1.5rem, 3.6vw, 2rem);
  font-weight: 800; letter-spacing: -0.02em; line-height: 1.12;
  color: var(--eth-ink);
}
.eth-principle p { margin-top: 1rem; font-size: 1.125rem; line-height: 1.7; color: var(--eth-body); }
.eth-principle strong { color: var(--eth-ink); font-weight: 600; }
.eth-principle ul { margin-top: 1rem; display: grid; gap: 0.55rem; }
.eth-principle ul li {
  position: relative; padding-left: 1.5rem;
  font-size: 1.1rem; line-height: 1.6; color: var(--eth-body);
}
.eth-principle ul li::before { content: "→"; position: absolute; left: 0; color: var(--eth-green); }

.eth-rule-card {
  margin-top: 1.4rem; padding: 1.2rem 1.4rem;
  border-left: 3px solid var(--eth-green);
  border-radius: 0 5px 5px 0;
  background: var(--eth-pale);
}
.eth-rule-card p { margin-top: 0; font-size: 1.05rem; color: #1D3A2B; }
.eth-rule-label {
  display: block; margin-bottom: 0.35rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--eth-green);
}

.eth-back {
  display: inline-block; padding: 0.8rem 1.25rem;
  border: 1px solid var(--eth-green); border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--eth-green);
  transition: background-color 160ms ease, color 160ms ease;
}
.eth-back:hover { background: var(--eth-green); color: #FFFFFF; }

@media (prefers-reduced-motion: reduce) {
  .eth-door:hover { transform: none; }
  .eth-door, .eth-back, .nav-eth { transition: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════
   LANDING — cinematic treatment
   Big type, deep space, one moving thing at a time. Scoped to .lp-.
   ═══════════════════════════════════════════════════════════════════ */

.lp-hero {
  position: relative; min-height: 92vh;
  display: flex; align-items: center; overflow: hidden;
  background: linear-gradient(180deg, #05070C 0%, #0A0E16 100%);
  color: #FFFFFF;
}
.lp-aurora {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right,  rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: radial-gradient(72% 62% at 62% 50%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(72% 62% at 62% 50%, #000 0%, transparent 78%);
  animation: none;
}
@keyframes lp-drift {
  0%   { transform: translate3d(-2%,-1%,0) scale(1); }
  50%  { transform: translate3d(2%,2%,0) scale(1.06); }
  100% { transform: translate3d(-1%,1%,0) scale(1.02); }
}
#lp-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 1; }
.lp-hero-inner { position: relative; z-index: 2; }

.lp-eyebrow {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid rgba(255,255,255,0.18); border-radius: 999px;
  background: rgba(255,255,255,0.06); backdrop-filter: blur(10px);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em;
  color: #C5CAFB;
}
.lp-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #4ADE80;
  animation: lp-pulse 2.4s infinite;
}
@keyframes lp-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(74,222,128,0.6); }
  70%  { box-shadow: 0 0 0 9px rgba(74,222,128,0); }
  100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}

.lp-h1 {
  margin-top: 1.6rem;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: clamp(2.9rem, 9vw, 7.5rem);
  font-weight: 800; letter-spacing: -0.038em; line-height: 0.94;
}
.lp-shimmer {
  color: #8E9BFF;
  background: none;
  -webkit-text-fill-color: currentColor;
  animation: none;
}
@keyframes lp-sweep { 0%,100%{background-position:0% 50%} 50%{background-position:100% 50%} }

.lp-sub {
  margin-top: 1.9rem; max-width: 40ch;
  font-size: clamp(1.05rem, 2.1vw, 1.45rem); line-height: 1.55;
  color: rgba(255,255,255,0.72);
}
.lp-cta-row { margin-top: 2.4rem; display: flex; flex-wrap: wrap; gap: 0.85rem; }

.lp-btn {
  position: relative; display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 1rem 1.7rem; border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
  overflow: hidden;
  transition: transform 260ms cubic-bezier(.2,.7,.3,1), box-shadow 260ms ease;
}
.lp-btn-primary { background:#FFFFFF; color:#08080E; box-shadow:0 10px 34px -10px rgba(255,255,255,0.5); }
.lp-btn-primary:hover { transform: translateY(-3px) scale(1.02); box-shadow:0 18px 44px -12px rgba(255,255,255,0.62); }
.lp-btn-ghost { border:1px solid rgba(255,255,255,0.28); color:#FFFFFF; backdrop-filter: blur(10px); }
.lp-btn-ghost:hover { transform: translateY(-3px); background: rgba(255,255,255,0.08); }

.lp-scrollcue {
  position: absolute; left: 50%; bottom: 2.2rem; transform: translateX(-50%); z-index: 2;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  animation: lp-bob 2.6s ease-in-out infinite;
}
@keyframes lp-bob { 0%,100%{transform:translate(-50%,0)} 50%{transform:translate(-50%,7px)} }

/* Hidden only when JS is present to un-hide it. Without the html.js guard,
   a JS failure would leave the entire page blank. */
html.js .reveal {
  opacity: 0; transform: translateY(26px);
  transition: opacity 750ms cubic-bezier(.2,.7,.3,1), transform 750ms cubic-bezier(.2,.7,.3,1);
}
html.js .reveal.is-in { opacity: 1; transform: none; }
html.js .reveal[data-d="1"] { transition-delay: 90ms; }
html.js .reveal[data-d="2"] { transition-delay: 180ms; }
html.js .reveal[data-d="3"] { transition-delay: 270ms; }

.lp-stats { display: grid; gap: 2.5rem 1rem; grid-template-columns: repeat(2,1fr); }
@media (min-width: 860px) { .lp-stats { grid-template-columns: repeat(4,1fr); } }
.lp-stat-n {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: clamp(2.4rem,5.4vw,3.9rem); font-weight: 800;
  letter-spacing: -0.03em; line-height: 1;
  background: linear-gradient(180deg,#131522 45%,#3B45C9 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lp-stat-l { margin-top: 0.7rem; font-size: 0.98rem; line-height: 1.45; color: var(--muted); max-width: 22ch; }

.lp-cards { display: grid; gap: 1.1rem; }
@media (min-width: 760px)  { .lp-cards { grid-template-columns: repeat(2,1fr); } }
@media (min-width: 1180px) { .lp-cards { grid-template-columns: repeat(4,1fr); } }

.lp-card {
  position: relative; display: flex; flex-direction: column;
  min-height: 21rem; padding: 1.7rem;
  border: 1px solid rgba(148,166,214,0.18);
  border-radius: 4px;
  background: linear-gradient(165deg, #0E1420 0%, #0A0E16 100%);
  overflow: hidden; color: #FFFFFF; isolation: isolate;
  transition: border-color 300ms ease, transform 300ms cubic-bezier(.2,.7,.3,1);
}
.lp-card::before {
  content: ""; position: absolute; left: 0; top: 0; height: 2px; width: 100%;
  background: var(--card-grad);
  transition: opacity 300ms ease;
  opacity: 0.85;
}
.lp-card::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(to right,  rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: 0; transition: opacity 300ms ease;
}
.lp-card:hover { transform: translateY(-5px); border-color: rgba(142,155,255,0.55); box-shadow: 0 14px 40px -18px rgba(88,101,242,0.45); }
.lp-card:hover::before { opacity: 1; }
.lp-card:hover::after { opacity: 1; }

.lp-card-n { font-family:"JetBrains Mono",monospace; font-size:11px; letter-spacing:0.2em; color:rgba(255,255,255,0.62); }
.lp-card-t {
  margin-top: 0.8rem;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 1.65rem; font-weight: 800; letter-spacing: -0.022em; line-height: 1.06;
}
.lp-card-d { margin-top: 0.75rem; font-size: 1rem; line-height: 1.5; color: rgba(255,255,255,0.78); }
.lp-card-go {
  margin-top: auto; padding-top: 1.4rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: #FFFFFF;
}
.lp-card-go span { display:inline-block; transition: transform 300ms cubic-bezier(.2,.7,.3,1); }
.lp-card:hover .lp-card-go span { transform: translateX(7px); }

.lp-dark { background: linear-gradient(180deg,#0A0E16 0%,#05070C 55%,#0A0E16 100%); color:#FFFFFF; position:relative; overflow:hidden; }
.lp-dark-glow {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right,  rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: radial-gradient(70% 70% at 50% 50%, #000 0%, transparent 80%);
  -webkit-mask-image: radial-gradient(70% 70% at 50% 50%, #000 0%, transparent 80%);
}
.lp-quiet {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: clamp(1.9rem,5vw,3.4rem); font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.06;
}

/* ═══════════════════════════════════════════════════════════════════
   Scroll-Driven Animations — tied to viewport progress
   ═══════════════════════════════════════════════════════════════════ */

@keyframes scroll-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scroll-slide-up {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scroll-scale-in {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes scroll-border-expand {
  from { border-left-width: 0; }
  to { border-left-width: 3px; }
}

@keyframes scroll-accent-glow {
  from { border-color: rgba(63, 162, 119, 0.2); box-shadow: inset 0 0 0 1px rgba(63, 162, 119, 0.1); }
  to { border-color: rgba(63, 162, 119, 0.6); box-shadow: inset 0 0 12px rgba(63, 162, 119, 0.15); }
}

.scroll-fade { animation: scroll-fade-in linear; animation-timeline: view(); }
.scroll-slide { animation: scroll-slide-up linear; animation-timeline: view(); }
.scroll-scale { animation: scroll-scale-in linear; animation-timeline: view(); }
.scroll-border { animation: scroll-border-expand linear; animation-timeline: view(); }
.scroll-glow { animation: scroll-accent-glow linear; animation-timeline: view(); }

@media (prefers-reduced-motion: reduce) {
  .lp-aurora, .lp-shimmer, .lp-scrollcue, .lp-dot { animation: none !important; }
  body.dark::after { animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .lp-btn, .lp-card, .lp-card::before, .lp-card::after, .lp-card-go span { transition: none !important; }
  .lp-btn:hover, .lp-card:hover { transform: none !important; }
  .scroll-fade, .scroll-slide, .scroll-scale, .scroll-border, .scroll-glow { animation: none !important; }
}

/* semantic stat variants — red for the number that is a problem,
   green for the one that is the fix, blue for plain facts */
.lp-stat-n.is-bad { background: linear-gradient(180deg,#7A1433 40%,#C0224E 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.lp-stat-n.is-ok  { background: linear-gradient(180deg,#0F3D28 40%,#1B6E48 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ── do / do-not lists ───────────────────────────────────────────── */

/* Same semantics as everywhere else on the site: green is what you may do,
   red is what you must not. Marked per item, so a mixed list still works.
   The tick and cross matter as much as the colour — red/green alone is not
   readable for colour-blind users. */
.eth-principle ul li.do,
.eth-principle ul li.dont {
  padding: 0.6rem 0.9rem 0.6rem 2.3rem;
  border-left: 3px solid;
  border-radius: 0 4px 4px 0;
}
.eth-principle ul li.do   { background: var(--ok-pale);  border-left-color: var(--ok); }
.eth-principle ul li.dont { background: var(--bad-pale); border-left-color: var(--bad); }

.eth-principle ul li.do::before {
  content: "\2713"; /* tick */
  left: 0.9rem;
  color: var(--ok);
  font-weight: 700;
}
.eth-principle ul li.dont::before {
  content: "\2715"; /* cross */
  left: 0.9rem;
  color: var(--bad);
  font-weight: 700;
}
.eth-principle ul li.do strong    { color: #14472F; }
.eth-principle ul li.dont strong  { color: #7A1433; }

/* ── animated page band (article pages) ──────────────────────────── */

/* The homepage aurora, reused as a header band so the inner pages feel part
   of the same site. Pure CSS — no extra script, nothing to stall. */
.page-band {
  position: relative; overflow: hidden;
  background:
    radial-gradient(70% 90% at 88% 100%, rgba(63,162,119,0.10) 0%, transparent 60%),
    linear-gradient(160deg, #0C111C 0%, #070A10 100%);
  color: #FFFFFF;
  border: 1px solid rgba(148,166,214,0.18);
  border-radius: 4px;
  padding: 3rem 1.75rem 3.25rem;
}
.page-band::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: linear-gradient(90deg, #5865F2 0%, #3FA277 100%);
  opacity: 0.85;
}
@media (min-width: 768px) { .page-band { padding: 4rem 3rem 4.25rem; } }

.page-band::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right,  rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(80% 80% at 30% 40%, #000 0%, transparent 82%);
  -webkit-mask-image: radial-gradient(80% 80% at 30% 40%, #000 0%, transparent 82%);
}
.page-band > * { position: relative; z-index: 1; }

.page-band .page-kicker {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #A9B3F2;
}
.page-band h1 {
  margin-top: 1.1rem;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.02;
  color: #FFFFFF;
}
.page-band .page-lede {
  margin-top: 1.4rem;
  max-width: 62ch;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.6;
  color: rgba(255,255,255,0.74);
}

@media (prefers-reduced-motion: reduce) {
  .page-band::before { animation: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════
   DARK MODE — the hairline-on-black system, applied site-wide.
   Most components already read from the variables below, so flipping
   these carries most of the work; the rest overrides the Tailwind
   colour utilities the markup uses directly.
   ═══════════════════════════════════════════════════════════════════ */

body.dark {
  --ink:       #ECEEF5;
  --ink2:      #B7BCCE;
  --paper:     #0A0E16;
  --card:      #10151F;
  --rule:      rgba(148,166,214,0.16);
  --muted:     #878DA3;
  --sig:       #8E9BFF;
  --sig-pale:  #2B3270;
  --mem:       #9E7BEA;
  --convo:     #6C7290;
  --empty:     rgba(255,255,255,0.07);
  --ok:        #42B883;
  --ok-pale:   rgba(66,184,131,0.15);
  --ok-light:  #56D48F;
  --ok-med:    #35A373;
  --ok-dark:   #246B52;
  --bad:       #E2456F;
  --bad-pale:  rgba(226,69,111,0.14);

  background: #0A0E16;
  color: var(--ink);
}

/* faint hairline grid, same as the hero */
body.dark::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right,  rgba(148,166,214,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148,166,214,0.05) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: radial-gradient(90% 70% at 50% 0%, #000 0%, transparent 85%);
  -webkit-mask-image: radial-gradient(90% 70% at 50% 0%, #000 0%, transparent 85%);
}

/* ambient depth: two slow glows, blue and green, drifting behind everything.
   Low alpha so it reads as atmosphere, not decoration. */
body.dark::after {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42% 34% at 16% 10%, rgba(88,110,255,0.13) 0%, transparent 64%),
    radial-gradient(38% 30% at 86% 24%, rgba(63,162,119,0.09) 0%, transparent 66%),
    radial-gradient(52% 42% at 55% 96%, rgba(88,101,242,0.10) 0%, transparent 70%);
  animation: ambient-drift 32s ease-in-out infinite alternate;
}
@keyframes ambient-drift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  50%  { transform: translate3d(1.5%,1%,0) scale(1.045); }
  100% { transform: translate3d(-1.5%,-1%,0) scale(1.02); }
}
body.dark > * { position: relative; z-index: 1; }

/* ── tailwind colour utilities ──────────────────────────────────── */

body.dark .bg-paper  { background-color: var(--paper) !important; }
body.dark .bg-card   { background-color: var(--card)  !important; }
body.dark .text-ink  { color: var(--ink)   !important; }
body.dark .text-ink2 { color: var(--ink2)  !important; }
body.dark .text-muted{ color: var(--muted) !important; }
body.dark .text-sig  { color: var(--sig)   !important; }
body.dark .border-rule { border-color: var(--rule) !important; }

/* ── chrome ─────────────────────────────────────────────────────── */

body.dark .site-header {
  background: rgba(10,14,22,0.90);
  border-bottom-color: var(--rule);
}
body.dark .nav-toggle { background: var(--card); color: var(--ink); border-color: var(--rule); }
body.dark .nav-mobile { background: var(--card); }
body.dark .nav-desktop .nav-cta { background: var(--ink); color: #000; }
body.dark .nav-desktop .nav-cta:hover { background: var(--sig); color: #000; }

/* ── surfaces ───────────────────────────────────────────────────── */

body.dark .panel,
body.dark .res-card,
body.dark .pager a,
body.dark .tags li { background: var(--card); border-color: var(--rule); }

body.dark .helper { background: rgba(142,155,255,0.07); border-color: rgba(142,155,255,0.28); }
body.dark .helper strong { color: var(--ink); }

body.dark .callout { background: var(--card); border-left-color: var(--sig); }
body.dark .step { border-top-color: var(--ink); }

body.dark .keypoint { background: var(--card); border-left-color: var(--sig); }
body.dark .prose code { background: rgba(255,255,255,0.09); color: var(--ink); }
body.dark .prose pre  { background: var(--card); border-color: var(--rule); }
body.dark .prose a    { color: var(--sig); }

/* ── curriculum + demo ──────────────────────────────────────────── */

body.dark .level { border-bottom-color: var(--rule); }
body.dark .level-num { color: rgba(255,255,255,0.22); }
body.dark .strip { background: var(--empty); border-color: var(--rule); }
body.dark .legend-row { border-bottom-color: var(--rule); }
body.dark .mode-btn.is-active { background: var(--ink); color: #000; }
body.dark .lp-stat-n { background: linear-gradient(180deg,#FFFFFF 40%,#8E9BFF 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ── resources ──────────────────────────────────────────────────── */

body.dark .res-card:hover,
body.dark .pager a:hover { border-color: rgba(142,155,255,0.5); box-shadow: 0 10px 34px -16px rgba(88,101,242,0.4); }
body.dark .tier-official  { background: rgba(63,162,119,0.16);  color: #6FCFA1; }
body.dark .tier-community { background: rgba(214,158,46,0.16);  color: #E0B65C; }
body.dark .concept { border-bottom-color: var(--rule); }

/* ── article furniture ──────────────────────────────────────────── */

body.dark .toc a:not(.is-current) { border-left-color: var(--rule); color: var(--muted); }
body.dark .toc a:hover { color: var(--ink); border-left-color: var(--ink); }
body.dark .phase-rail a:not(.is-here),
body.dark .phase-rail span:not(.is-here) { border-top-color: var(--rule); }
body.dark .phase-rail a:hover { border-top-color: var(--ink); color: var(--ink); }
body.dark .modulebar { background: rgba(10,14,22,0.90); border-color: var(--rule); }
body.dark .btn-outline { border-color: var(--ink); color: var(--ink); }
body.dark .btn-outline:hover { background: var(--ink); color: #000; }
body.dark .btn-solid { background: var(--sig); color: #000; }
body.dark .tree .d { color: var(--ink); }

/* the page band already is black — drop the border so it merges */
body.dark .page-band { border-color: var(--rule); }

/* ── ethics: black, with green as the accent rather than the field ── */

body.eth.dark {
  --eth-ink:   #ECEEF5;
  --eth-body:  #B7BCCE;
  --eth-paper: #000000;
  --eth-card:  #0E1812;
  --eth-rule:  rgba(126,180,152,0.18);
  --eth-green: #3FA277;
  --eth-pale:  rgba(63,162,119,0.14);
  background:
    radial-gradient(60% 40% at 85% 0%, rgba(63,162,119,0.10) 0%, transparent 60%),
    #0A120E;
  color: var(--eth-ink);
}
body.eth.dark .site-header { background: rgba(10,18,14,0.90); border-bottom-color: var(--eth-rule); }
body.eth.dark .eth-band { background: linear-gradient(165deg, #0B1A12 0%, #04120C 100%); border-bottom: 1px solid rgba(63,162,119,0.35); }
body.eth.dark .eth-h1 { color: #FFFFFF; }
body.eth.dark .eth-lede { color: #9FBFAE; }
body.eth.dark .eth-door { background: linear-gradient(165deg, #101B14 0%, #0A140E 100%); border-color: var(--eth-rule); }
body.eth.dark .eth-door:hover { border-color: var(--eth-green); box-shadow: 0 14px 40px -18px rgba(63,162,119,0.4); }
body.eth.dark .eth-principle { border-top-color: rgba(255,255,255,0.28); }
body.eth.dark .eth-rule-card { background: var(--eth-pale); }
body.eth.dark .eth-rule-card p { color: #CFE6DA; }
body.eth.dark .nav-eth { background: var(--eth-green); color: #04120C !important; }
body.eth.dark li.do   { background: rgba(63,162,119,0.13); }
body.eth.dark li.dont { background: rgba(226,69,111,0.13); }
body.eth.dark li.do strong   { color: #7FD3AC; }
body.eth.dark li.dont strong { color: #F58BA6; }
body.eth.dark footer { background: #0C1610 !important; border-color: var(--eth-rule) !important; }

/* Active-state rescue. The generic dark overrides above are more specific
   than the .is-here / .is-current rules, so without these the "you are here"
   indicators silently flatten to the same grey as everything else — which
   removes the only signal telling the reader where they are. */
body.dark .phase-rail .is-here {
  border-top-color: var(--sig);
  color: var(--sig);
}
body.dark .toc a.is-current {
  border-left-color: var(--sig);
  color: var(--sig);
  font-weight: 600;
}
body.dark .modulebar a.is-current {
  background: var(--sig);
  border-color: var(--sig);
  color: #000;
}
body.dark .nav-desktop a[aria-current="page"],
body.dark .nav-mobile a[aria-current="page"] { color: var(--ink); }
body.dark .level.is-core .level-num,
body.dark .level-state.is-core { color: var(--sig); }
body.dark .skill-tab.is-active { background: var(--sig); border-color: var(--sig); color: #000; }

/* ── AI Mastery page: it uses Tailwind's default gray/indigo palette
      rather than the site variables, so those need mapping too.
      Without this its h1 is near-black on black — invisible.         ── */

body.dark .bg-white     { background-color: var(--card) !important; }
body.dark .bg-gray-50   { background-color: rgba(255,255,255,0.04) !important; }
body.dark .bg-gray-200  { background-color: rgba(255,255,255,0.12) !important; }
body.dark .bg-gray-900  { background-color: #0E1420 !important; }
body.dark .bg-indigo-50 { background-color: rgba(142,155,255,0.08) !important; }

body.dark .text-gray-900,
body.dark .text-gray-800 { color: var(--ink)  !important; }
body.dark .text-gray-700,
body.dark .text-gray-600 { color: var(--ink2) !important; }
body.dark .text-gray-500,
body.dark .text-gray-400,
body.dark .text-gray-300 { color: var(--muted) !important; }

body.dark .text-indigo-900,
body.dark .text-indigo-800,
body.dark .text-indigo-700,
body.dark .text-indigo-600,
body.dark .text-indigo-400,
body.dark .text-indigo-200 { color: var(--sig) !important; }

body.dark .border-gray-800   { border-color: var(--rule) !important; }
body.dark .border-indigo-100,
body.dark .border-indigo-200 { border-color: rgba(142,155,255,0.28) !important; }

/* Tailwind preflight gives every element a light default border colour;
   anything using a bare `border` utility on this page needs the dark one. */
body.dark .border { border-color: var(--rule) !important; }

body.dark .memory-file:hover { background-color: rgba(255,255,255,0.06) !important; }
body.dark .shadow-sm,
body.dark .shadow-xl { box-shadow: none !important; }

/* ═══════════════════════════════════════════════════════════════════
   TOP-DARK — the homepage arrival, brought to the inner pages.
   The header and title zone sit on a deep olive-green field (the
   swatch tone) that dissolves into the paper below. One gradient on
   the body does the merge; no extra wrappers needed.
   ═══════════════════════════════════════════════════════════════════ */

/* The dark field is anchored to .top-zone, not to the body — a fixed
   pixel fade cannot know how tall the title block is at a given width,
   and the tail ended up washing over the content below it. */
.top-zone { position: relative; }
.top-zone::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -10rem;
  bottom: -1.5rem;
  left: 50%;
  width: 100vw;
  margin-left: -50vw;
  background: linear-gradient(
    180deg,
    #0A0C07 0%,
    #0E1209 42%,
    #141A0F 72%,
    rgba(20,26,15,0) 100%
  );
}

body.top-dark .site-header {
  background: rgba(10,12,7,0.92);
  border-bottom-color: rgba(255,255,255,0.09);
}
body.top-dark .site-header .font-display { color: #F2F4EA; }
body.top-dark .nav-desktop a { color: #A6AC96; }
body.top-dark .nav-desktop a:hover { color: #FFFFFF; }
body.top-dark .nav-desktop a[aria-current="page"] { color: #F2F4EA; }
body.top-dark .nav-desktop .nav-cta { background: #F2F4EA; color: #0A0C07; }
body.top-dark .nav-desktop .nav-cta:hover { background: var(--sig); color: #FFFFFF; }
body.top-dark .nav-toggle { background: transparent; color: #F2F4EA; border-color: rgba(255,255,255,0.25); }

body.top-dark .breadcrumb,
body.top-dark .breadcrumb a { color: #8F957F; }
body.top-dark .breadcrumb a:hover { color: #F2F4EA; }
body.top-dark .breadcrumb [aria-current] { color: #F2F4EA; }

body.top-dark .phase-rail a,
body.top-dark .phase-rail span { color: #8F957F; border-top-color: rgba(255,255,255,0.16); }
body.top-dark .phase-rail a:hover { color: #F2F4EA; border-top-color: #F2F4EA; }
body.top-dark .phase-rail .is-here { color: var(--sig); border-top-color: var(--sig); }

/* the band melts into the field: same olive family, softer edge */
body.top-dark .page-band {
  background:
    radial-gradient(70% 90% at 88% 100%, rgba(63,162,119,0.13) 0%, transparent 60%),
    linear-gradient(160deg, #141910 0%, #0A0C07 100%);
  border-color: rgba(163,177,138,0.22);
}

/* AI Mastery: its hero heading is dark-on-light and sits in this zone */
body.top-dark main > header h1 { color: #F2F4EA !important; }
body.top-dark main > header p  { color: #A6AC96 !important; }
body.top-dark main > header a  { color: #9DB7FF !important; }

/* ── milestone rail ──────────────────────────────────────────────── */

/* A hairline running the length of the article, blue fading to green,
   with a numbered marker at every section — progress made visible. */
.prose {
  position: relative;
  counter-reset: mile;
  padding-left: 2.7rem;
}
.prose::before {
  content: "";
  position: absolute;
  left: 1.05rem;
  top: 1rem;
  bottom: 0.75rem;
  width: 1px;
  background: linear-gradient(180deg, var(--sig) 0%, #3FA277 100%);
  opacity: 0.45;
}
.prose > section { position: relative; counter-increment: mile; }
.prose > section::before {
  content: counter(mile, decimal-leading-zero);
  position: absolute;
  left: -1.65rem;
  top: 2.45rem;
  transform: translateX(-50%);
  width: 2.1rem;
  height: 2.1rem;
  line-height: calc(2.1rem - 2px);
  text-align: center;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--sig);
  color: var(--sig);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
}
/* the rail replaces the old ruled separators */
.prose > section + section { border-top: none; margin-top: 1.75rem; }

@media (max-width: 640px) {
  .prose { padding-left: 2.2rem; }
  .prose::before { left: 0.85rem; }
  .prose > section::before {
    left: -1.35rem;
    width: 1.7rem; height: 1.7rem;
    line-height: calc(1.7rem - 2px);
    font-size: 10px;
  }
}
