/* ------------------------------------------------------------------ *
 * Free Medical Billing Training - clinical academic design system
 *
 * Reads like a university course handbook: serif prose, ruled tables,
 * numbered chapters, restrained colour. Light and dark are both first
 * class; the palette is defined once and inverted under a media query
 * plus an explicit [data-theme] escape hatch for the header toggle.
 * ------------------------------------------------------------------ */

/* --- fonts ---------------------------------------------------------
 * Fallback faces carry ascent/descent/size-adjust overrides computed
 * from the real font metrics (tools/font_metrics.py), so the swap from
 * Georgia to Source Serif shifts no layout. See @font-face block that
 * build.py injects above this file.
 * ------------------------------------------------------------------ */

:root {
  --serif: "Source Serif 4", "Source Serif Fallback", Georgia, "Times New Roman", serif;
  --sans: Inter, "Inter Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --ink: #16202e;
  --ink-2: #46566a;
  --ink-3: #6b7c90;
  --navy: #123a5e;
  --navy-deep: #0b2440;
  --paper: #ffffff;
  --paper-2: #f6f8fa;
  --paper-3: #eaeff4;
  --rule: #d5dde5;
  --rule-2: #e6ecf1;
  --link: #10608a;
  --link-hover: #0b4667;
  --accent: #8a6011;         /* academic gold - credentials, chapter marks */
  --accent-soft: #f7f1e2;
  --accent-rule: #e0cfa4;
  --ok: #1a6b4a;
  --ok-soft: #e8f4ee;
  --warn: #8d4a12;
  --warn-soft: #fbf0e6;
  --stop: #99302a;
  --stop-soft: #fbecea;

  --shadow-1: 0 1px 2px rgba(16, 32, 48, .06), 0 2px 8px rgba(16, 32, 48, .05);
  --shadow-2: 0 2px 6px rgba(16, 32, 48, .08), 0 12px 28px rgba(16, 32, 48, .09);

  --measure: 68ch;
  --wrap: 1180px;
  --radius: 3px;
  --radius-lg: 6px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e6edf4;
    --ink-2: #a9b8c8;
    --ink-3: #7d8fa2;
    --navy: #9dc6e6;
    --navy-deep: #cfe2f2;
    --paper: #0e1620;
    --paper-2: #141f2c;
    --paper-3: #1b2836;
    --rule: #2a3947;
    --rule-2: #21303e;
    --link: #6fb6dd;
    --link-hover: #9ed0ee;
    --accent: #d8ae5c;
    --accent-soft: #2a2418;
    --accent-rule: #4a3d22;
    --ok: #66c39a;
    --ok-soft: #16281f;
    --warn: #d79a5e;
    --warn-soft: #2a2018;
    --stop: #e08b84;
    --stop-soft: #2c1a19;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .3);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, .45), 0 12px 28px rgba(0, 0, 0, .4);
  }
}

:root[data-theme="dark"] {
  --ink: #e6edf4;
  --ink-2: #a9b8c8;
  --ink-3: #7d8fa2;
  --navy: #9dc6e6;
  --navy-deep: #cfe2f2;
  --paper: #0e1620;
  --paper-2: #141f2c;
  --paper-3: #1b2836;
  --rule: #2a3947;
  --rule-2: #21303e;
  --link: #6fb6dd;
  --link-hover: #9ed0ee;
  --accent: #d8ae5c;
  --accent-soft: #2a2418;
  --accent-rule: #4a3d22;
  --ok: #66c39a;
  --ok-soft: #16281f;
  --warn: #d79a5e;
  --warn-soft: #2a2018;
  --stop: #e08b84;
  --stop-soft: #2c1a19;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .45), 0 12px 28px rgba(0, 0, 0, .4);
}

/* --- base ---------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--serif);
  color: var(--navy-deep);
  line-height: 1.22;
  font-weight: 600;
  letter-spacing: -.011em;
  margin: 0 0 .6em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 1.35rem + 2.6vw, 3rem); font-weight: 700; }
h2 { font-size: clamp(1.45rem, 1.15rem + 1.2vw, 1.95rem); margin-top: 2.4em; }
h3 { font-size: clamp(1.2rem, 1.06rem + .6vw, 1.4rem); margin-top: 2em; }
h4 { font-size: 1.09rem; margin-top: 1.8em; font-weight: 700; }

p { margin: 0 0 1.15em; }
p:last-child { margin-bottom: 0; }

a { color: var(--link); text-decoration-thickness: .06em; text-underline-offset: .16em; }
a:hover { color: var(--link-hover); }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 2px;
}

img, video, svg { max-width: 100%; height: auto; }
strong, b { font-weight: 700; color: var(--navy-deep); }
abbr[title] { text-decoration: underline dotted; cursor: help; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

code, kbd, samp { font-family: var(--mono); font-size: .88em; }
code {
  background: var(--paper-3);
  padding: .12em .38em;
  border-radius: var(--radius);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--navy-deep);
  color: #fff;
  padding: .7rem 1.1rem;
  z-index: 200;
  font-family: var(--sans);
}
.skip:focus { left: .5rem; top: .5rem; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
@media (max-width: 40rem) { .wrap { width: min(100% - 1.75rem, var(--wrap)); } }

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

/* --- masthead ------------------------------------------------------ */

.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.masthead__bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 4.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  color: var(--navy-deep);
  margin-right: auto;
  padding: .35rem 0;
}
.brand__mark { flex: none; color: var(--navy); }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-weight: 700; font-size: 1.02rem; letter-spacing: -.012em; }
.brand__sub {
  font-family: var(--sans);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-3);
  font-weight: 500;
}

.nav { display: flex; align-items: center; gap: .15rem; }
.nav a {
  font-family: var(--sans);
  font-size: .875rem;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  padding: .5rem .7rem;
  border-radius: var(--radius);
  white-space: nowrap;
}
.nav a:hover { color: var(--navy-deep); background: var(--paper-2); }
.nav a[aria-current] { color: var(--navy-deep); font-weight: 600; }

.nav__cta {
  font-family: var(--sans);
  font-size: .85rem;
  font-weight: 600;
  background: var(--navy-deep);
  color: #fff !important;
  padding: .55rem 1rem !important;
  border-radius: var(--radius);
}
.nav__cta:hover { background: var(--navy); color: #fff !important; }
:root[data-theme="dark"] .nav__cta,
:root:not([data-theme="light"]) .nav__cta { color: var(--paper) !important; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.3rem; height: 2.3rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  flex: none;
}
.icon-btn:hover { background: var(--paper-2); color: var(--navy-deep); }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .moon,
:root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
:root[data-theme="dark"] .theme-toggle .sun,
:root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
}
:root[data-theme="light"] .theme-toggle .sun { display: block; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }

.nav-toggle { display: none; }

@media (max-width: 62rem) {
  .nav-toggle { display: inline-grid; }
  .nav {
    position: fixed;
    inset: 4.25rem 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: .5rem 1.25rem 1.25rem;
    box-shadow: var(--shadow-2);
    max-height: calc(100dvh - 4.25rem);
    overflow-y: auto;
  }
  .nav:not([data-open]) { display: none; }
  .nav a { padding: .8rem .25rem; border-bottom: 1px solid var(--rule-2); font-size: .95rem; }
  .nav__cta { margin-top: .9rem; text-align: center; padding: .8rem 1rem !important; }
}

/* --- page furniture ------------------------------------------------ */

.crumbs {
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--ink-3);
  padding: 1.4rem 0 0;
}
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; margin: 0; padding: 0; }
.crumbs li::after { content: "/"; margin-left: .35rem; color: var(--rule); }
.crumbs li:last-child::after { content: none; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--link); text-decoration: underline; }

.page-head { padding: 1.6rem 0 0; }
.page-head__eyebrow {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 .7rem;
  display: flex;
  align-items: center;
  gap: .55rem;
}
.page-head__eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--accent-rule);
  max-width: 5rem;
}
.page-head h1 { margin-bottom: .35em; }
.page-head__standfirst {
  font-size: 1.16rem;
  color: var(--ink-2);
  max-width: var(--measure);
  margin: 0;
  line-height: 1.6;
}
.page-head__meta {
  font-family: var(--sans);
  font-size: .8rem;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule-2);
}
.page-head__meta span { display: inline-flex; align-items: center; gap: .38rem; }
.page-head__meta svg { color: var(--ink-3); flex: none; }

/* --- article layout ------------------------------------------------ */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3rem;
  padding: 2.5rem 0 4rem;
}
@media (min-width: 64rem) {
  .layout--sidebar { grid-template-columns: minmax(0, 1fr) 16.5rem; }
}

.prose { max-width: var(--measure); }
.prose > :first-child { margin-top: 0; }
.prose h2 {
  padding-bottom: .3em;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 6rem;
}
.prose h3 { scroll-margin-top: 6rem; }
.prose ul, .prose ol { margin: 0 0 1.3em; padding-left: 1.35em; }
.prose li { margin-bottom: .5em; }
.prose li::marker { color: var(--ink-3); }
.prose ol li::marker { font-family: var(--sans); font-size: .85em; font-weight: 600; color: var(--accent); }

.prose blockquote {
  margin: 1.8em 0;
  padding: .2em 0 .2em 1.4em;
  border-left: 3px solid var(--accent-rule);
  color: var(--ink-2);
  font-style: italic;
}

.figure { margin: 2rem 0; }
.figure img {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  display: block;
}
.figure figcaption {
  font-family: var(--sans);
  font-size: .8rem;
  line-height: 1.5;
  color: var(--ink-3);
  margin-top: .7rem;
  padding-left: .9rem;
  border-left: 2px solid var(--rule);
}

/* --- sidebar / contents -------------------------------------------- */

.sidebar { font-family: var(--sans); }
@media (min-width: 64rem) {
  .sidebar { position: sticky; top: 5.75rem; align-self: start; max-height: calc(100dvh - 7rem); overflow-y: auto; }
}
.sidebar__title {
  font-family: var(--sans);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 .8rem;
}
.toc { list-style: none; margin: 0 0 2rem; padding: 0; border-left: 1px solid var(--rule); }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: .38rem 0 .38rem .9rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: .84rem;
  line-height: 1.4;
  color: var(--ink-2);
  text-decoration: none;
}
.toc a:hover { color: var(--link); border-left-color: var(--rule); }
.toc a.is-active { color: var(--navy-deep); border-left-color: var(--accent); font-weight: 600; }
.toc--sub a { padding-left: 1.7rem; font-size: .8rem; color: var(--ink-3); }

/* --- lesson rail ---------------------------------------------------- */

.rail { list-style: none; margin: 0 0 2rem; padding: 0; }
.rail li { margin: 0; }
.rail a {
  display: grid;
  grid-template-columns: 1.65rem 1fr;
  gap: .6rem;
  align-items: baseline;
  padding: .42rem .5rem .42rem .3rem;
  border-radius: var(--radius);
  font-size: .84rem;
  line-height: 1.35;
  color: var(--ink-2);
  text-decoration: none;
}
.rail a:hover { background: var(--paper-2); color: var(--navy-deep); }
.rail__n {
  font-family: var(--sans);
  font-size: .7rem;
  font-weight: 700;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.rail a[aria-current] { background: var(--accent-soft); color: var(--navy-deep); font-weight: 600; }
.rail a[aria-current] .rail__n { color: var(--accent); }

/* --- callouts ------------------------------------------------------- */

.callout {
  margin: 2rem 0;
  padding: 1.15rem 1.35rem;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  font-size: .96rem;
}
.callout__title {
  font-family: var(--sans);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 .5rem;
}
.callout p:last-child { margin-bottom: 0; }
.callout--sources { border-left-color: var(--link); }
.callout--sources .callout__title { color: var(--link); }
.callout--sources ul { list-style: none; margin: 0; padding: 0; font-family: var(--sans); font-size: .85rem; }
.callout--sources li { margin-bottom: .4rem; }
.callout--sources li:last-child { margin-bottom: 0; }

/* --- tables --------------------------------------------------------- */

.table-scroll {
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper);
}
table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: .88rem; }
thead th {
  text-align: left;
  font-weight: 600;
  font-size: .74rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: var(--paper-2);
  padding: .8rem 1rem;
  border-bottom: 2px solid var(--rule);
  white-space: nowrap;
}
tbody td, tbody th {
  padding: .78rem 1rem;
  border-bottom: 1px solid var(--rule-2);
  vertical-align: top;
  line-height: 1.55;
  text-align: left;
}
tbody th { font-weight: 600; color: var(--navy-deep); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody tr:hover { background: var(--paper-2); }
caption {
  caption-side: bottom;
  text-align: left;
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--ink-3);
  padding: .8rem 1rem;
  border-top: 1px solid var(--rule-2);
}

/* --- glossary ------------------------------------------------------- */

.glossary-tools {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  margin: 1.5rem 0 1.25rem;
  padding: 1rem;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  position: sticky;
  top: 4.5rem;
  z-index: 20;
}
.glossary-search {
  flex: 1 1 15rem;
  font-family: var(--sans);
  font-size: .92rem;
  padding: .58rem .8rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
.glossary-search::placeholder { color: var(--ink-3); }
.glossary-count { font-family: var(--sans); font-size: .8rem; color: var(--ink-3); }

.alphabet { display: flex; flex-wrap: wrap; gap: .2rem; margin: 0 0 1.75rem; padding: 0; list-style: none; }
.alphabet a {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 600;
  min-width: 1.75rem;
  padding: .3rem .1rem;
  text-align: center;
  display: block;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--link);
  text-decoration: none;
}
.alphabet a:hover { background: var(--navy-deep); border-color: var(--navy-deep); color: var(--paper); }
.alphabet .is-empty { color: var(--ink-3); opacity: .4; pointer-events: none; }

.glossary { margin: 0 0 2.5rem; }
.glossary__letter {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--accent);
  margin: 2.2rem 0 .9rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--accent-rule);
  scroll-margin-top: 9rem;
}
.glossary dl { margin: 0; }
.glossary dt {
  font-family: var(--sans);
  font-weight: 600;
  font-size: .95rem;
  color: var(--navy-deep);
  margin-top: 1.1rem;
}
.glossary dt:first-child { margin-top: 0; }
.glossary dd { margin: .25rem 0 0; color: var(--ink-2); font-size: 1rem; }
.glossary dd ul, .glossary dd ol { margin: .5rem 0 0; }
.glossary__abbr {
  font-family: var(--mono);
  font-size: .82em;
  font-weight: 500;
  color: var(--accent);
  margin-left: .4rem;
}
.glossary[data-filtering] .glossary__letter { display: none; }
.glossary .is-hidden { display: none; }

.glossary--compact dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .55rem 1.2rem;
  align-items: baseline;
}
.glossary--compact dt { margin: 0; font-family: var(--mono); font-size: .88rem; }
.glossary--compact dd { margin: 0; }

/* --- reimbursement flow -------------------------------------------- */

.flow { list-style: none; margin: 2.25rem 0; padding: 0; counter-reset: step; }
.flow > li {
  position: relative;
  padding: 0 0 1.6rem 3.4rem;
  margin: 0;
}
.flow > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 2.2rem; height: 2.2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--stage, var(--rule));
  color: var(--stage, var(--ink-2));
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  z-index: 2;
}
.flow > li::after {
  content: "";
  position: absolute;
  left: 1.1rem; top: 2.2rem; bottom: 0;
  width: 2px;
  background: var(--rule);
  transform: translateX(-1px);
}
.flow > li:last-child::after { content: none; }
.flow > li[data-stage="front"]    { --stage: var(--link); }
.flow > li[data-stage="clinical"] { --stage: var(--ok); }
.flow > li[data-stage="billing"]  { --stage: var(--accent); }
.flow > li[data-stage="payer"]    { --stage: var(--warn); }
.flow > li[data-terminal]::before { background: var(--ok); border-color: var(--ok); color: var(--paper); }

.flow__stage {
  font-family: var(--sans);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--stage, var(--ink-3));
  display: block;
  margin-bottom: .2rem;
}
.flow__title {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--navy-deep);
  margin: 0 0 .3rem;
  line-height: 1.35;
}
.flow__body { margin: 0; color: var(--ink-2); font-size: .97rem; }

.flow__branches {
  list-style: none;
  display: grid;
  gap: .7rem;
  margin: .85rem 0 0;
  padding: 0;
}
@media (min-width: 40rem) { .flow__branches { grid-template-columns: 1fr 1fr; } }
.flow__branch {
  margin: 0;
  padding: .7rem .9rem;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  font-size: .92rem;
  color: var(--ink-2);
}
.flow__branch b {
  display: block;
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--stage, var(--ink-3));
  margin-bottom: .25rem;
}
.flow__loop {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-top: .85rem;
  padding: .45rem .8rem;
  background: var(--stop-soft);
  border: 1px dashed var(--stop);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: .8rem;
  font-weight: 500;
  color: var(--stop);
}
.flow__loop svg { flex: none; }

.flow-key {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.1rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
  font-family: var(--sans);
  font-size: .76rem;
  color: var(--ink-2);
}
.flow-key li { display: inline-flex; align-items: center; gap: .4rem; }
.flow-key i {
  width: .65rem; height: .65rem;
  border-radius: 50%;
  background: var(--k);
  flex: none;
}

/* --- video ---------------------------------------------------------- */

.video { margin: 2.25rem 0; }
.video figure { margin: 0; }
.video video {
  width: 100%;
  display: block;
  background: #000;
  border-radius: var(--radius-lg);
  border: 1px solid var(--rule);
  aspect-ratio: 16 / 9;
}
.video figcaption {
  font-family: var(--sans);
  font-size: .8rem;
  color: var(--ink-3);
  margin-top: .65rem;
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .9rem;
  align-items: center;
}
.video figcaption b { color: var(--ink-2); font-weight: 600; }

/* --- lesson cards --------------------------------------------------- */

.cards {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17.5rem), 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}
.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.4rem 1.4rem 1.5rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-1);
  transition: border-color .16s, box-shadow .16s, transform .16s;
}
.card:hover {
  border-color: var(--navy);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}
.card__top { display: flex; align-items: center; gap: .7rem; margin-bottom: .85rem; }
.card__n {
  font-family: var(--sans);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}
.card__icon {
  margin-left: auto;
  color: var(--ink-3);
  opacity: .75;
  flex: none;
}
.card:hover .card__icon { color: var(--navy); opacity: 1; }
.card h3 {
  font-size: 1.12rem;
  margin: 0 0 .5rem;
  color: var(--navy-deep);
  line-height: 1.3;
}
.card p { font-size: .93rem; color: var(--ink-2); margin: 0 0 1rem; line-height: 1.6; }
.card__go {
  margin-top: auto;
  font-family: var(--sans);
  font-size: .8rem;
  font-weight: 600;
  color: var(--link);
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.card:hover .card__go svg { transform: translateX(2px); }
.card__go svg { transition: transform .16s; }
.card__meta {
  font-family: var(--sans);
  font-size: .72rem;
  color: var(--ink-3);
  margin-left: auto;
}

/* --- hero ----------------------------------------------------------- */

.hero {
  border-bottom: 1px solid var(--rule);
  background:
    radial-gradient(60rem 22rem at 12% -10%, var(--paper-2), transparent 70%),
    linear-gradient(180deg, var(--paper-2), var(--paper));
}
.hero__inner { padding: 3.25rem 0 3rem; display: grid; gap: 2.75rem; align-items: center; }
@media (min-width: 60rem) {
  .hero__inner { grid-template-columns: 1.15fr .85fr; padding: 4.5rem 0 4rem; }
}
.hero h1 { margin-bottom: .4em; }
.hero__lede {
  font-size: 1.2rem;
  color: var(--ink-2);
  max-width: 40ch;
  line-height: 1.62;
  margin: 0 0 1.9rem;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--sans);
  font-size: .92rem;
  font-weight: 600;
  padding: .78rem 1.4rem;
  border-radius: var(--radius);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn--primary { background: var(--navy-deep); color: #fff; }
.btn--primary:hover { background: var(--navy); color: #fff; }
:root[data-theme="dark"] .btn--primary { color: var(--paper); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn--primary { color: var(--paper); }
}
.btn--ghost { border-color: var(--rule); color: var(--navy-deep); background: var(--paper); }
.btn--ghost:hover { border-color: var(--navy); background: var(--paper-2); }

.hero__figure { margin: 0; }
.hero__figure img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-2);
  display: block;
}

/* --- credential bar -------------------------------------------------- */

.creds {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cred { background: var(--paper); padding: 1.35rem 1.3rem; }
.cred__icon { color: var(--accent); margin-bottom: .7rem; display: block; }
.cred__title {
  font-family: var(--sans);
  font-size: .88rem;
  font-weight: 700;
  color: var(--navy-deep);
  margin: 0 0 .35rem;
}
.cred p { font-size: .85rem; color: var(--ink-2); margin: 0; line-height: 1.55; font-family: var(--sans); }

/* --- section headers ------------------------------------------------- */

.section { padding: 3.75rem 0; }
.section--tint { background: var(--paper-2); border-block: 1px solid var(--rule); }
.section__head { margin-bottom: 2.1rem; max-width: var(--measure); }
.section__eyebrow {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 .6rem;
}
.section__head h2 { margin: 0 0 .5rem; border: 0; padding: 0; }
.section__head p { color: var(--ink-2); margin: 0; font-size: 1.05rem; }

/* --- pricing -------------------------------------------------------- */

.pricing {
  display: grid;
  gap: 1.75rem;
  align-items: center;
  padding: 2rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-1);
  margin: 2.5rem 0;
}
@media (min-width: 48rem) { .pricing { grid-template-columns: 1fr auto; } }
.pricing h2, .pricing h3 { margin: 0 0 .5rem; border: 0; padding: 0; }
.pricing__price { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .3rem; }
/* --ink-3 would only reach 4.28:1 here; the old price still has to be legible. */
.pricing__was { font-size: 1.15rem; color: var(--ink-2); text-decoration: line-through; }
.pricing__now { font-size: 2.5rem; font-weight: 700; color: var(--navy-deep); line-height: 1; }
.pricing__unit { font-family: var(--sans); font-size: .82rem; color: var(--ink-3); }
.pricing__side { text-align: center; }
.pricing__guarantee {
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--ink-3);
  margin: .75rem 0 0;
  display: block;
}
.pricing ul { list-style: none; margin: 1rem 0 0; padding: 0; font-family: var(--sans); font-size: .92rem; }
.pricing li { display: flex; gap: .55rem; margin-bottom: .45rem; color: var(--ink-2); }
.pricing li svg { color: var(--ok); flex: none; margin-top: .18rem; }

/* --- prev / next ---------------------------------------------------- */

.pager {
  display: grid;
  gap: 1rem;
  margin: 3.5rem 0 0;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
@media (min-width: 44rem) { .pager { grid-template-columns: 1fr 1fr; } }
.pager a {
  display: block;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  background: var(--paper);
}
.pager a:hover { border-color: var(--navy); background: var(--paper-2); }
.pager__dir {
  font-family: var(--sans);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: block;
  margin-bottom: .3rem;
}
.pager__title { font-weight: 600; color: var(--navy-deep); font-size: 1rem; line-height: 1.35; }
.pager--next { text-align: right; }
.pager--next:only-child { grid-column: 2; }

/* --- FAQ ------------------------------------------------------------- */

.faq { margin: 2rem 0 0; }
.faq details {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  margin-bottom: .7rem;
  background: var(--paper);
  overflow: hidden;
}
.faq summary {
  cursor: pointer;
  padding: 1.05rem 1.25rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.03rem;
  color: var(--navy-deep);
  list-style: none;
  display: flex;
  align-items: flex-start;
  gap: .8rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  margin-left: auto;
  flex: none;
  width: .6rem; height: .6rem;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg);
  transition: transform .18s;
  margin-top: .35rem;
}
.faq details[open] summary::after { transform: rotate(-135deg); }
.faq summary:hover { background: var(--paper-2); }
.faq__body { padding: 0 1.25rem 1.15rem; color: var(--ink-2); font-size: .98rem; }
.faq__body p:last-child { margin-bottom: 0; }

/* --- author / about ------------------------------------------------- */

.author {
  display: grid;
  gap: 1.5rem;
  align-items: start;
  padding: 1.75rem;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  margin: 2.5rem 0;
}
@media (min-width: 40rem) { .author { grid-template-columns: 7.5rem 1fr; } }
.author img { width: 100%; border-radius: var(--radius-lg); display: block; border: 1px solid var(--rule); }
.author__name { font-weight: 700; color: var(--navy-deep); margin: 0 0 .1rem; font-size: 1.08rem; }
.author__role {
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.author p { font-size: .96rem; color: var(--ink-2); margin: 0 0 .7rem; }

/* --- forms ----------------------------------------------------------- */

.form { margin: 2rem 0; max-width: 34rem; }
.field { margin-bottom: 1.15rem; }
.field label {
  display: block;
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 600;
  color: var(--navy-deep);
  margin-bottom: .38rem;
}
.field input, .field textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: .95rem;
  padding: .68rem .85rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
.field textarea { min-height: 9rem; resize: vertical; }
.field__hint { font-family: var(--sans); font-size: .76rem; color: var(--ink-3); margin-top: .3rem; }

/* --- footer ---------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 3rem 0 2rem;
  font-family: var(--sans);
  font-size: .87rem;
}
.footer__grid { display: grid; gap: 2.25rem; }
@media (min-width: 48rem) { .footer__grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer h2 {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 .9rem;
  border: 0;
  padding: 0;
}
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: .5rem; }
.footer a { color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: var(--link); text-decoration: underline; }
.footer__about { color: var(--ink-2); line-height: 1.65; max-width: 38ch; }
.footer__bottom {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.5rem;
  align-items: center;
  color: var(--ink-3);
  font-size: .8rem;
}
.footer__bottom p { margin: 0; }
.footer__disclaimer {
  margin-top: 1rem !important;
  font-size: .78rem;
  color: var(--ink-3);
  max-width: 75ch;
  line-height: 1.6;
}

/* --- print ------------------------------------------------------------ */

@media print {
  .masthead, .sidebar, .pager, .nav, .footer__grid, .glossary-tools, .alphabet { display: none !important; }
  body { font-size: 11pt; }
  .layout { display: block; padding: 0; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; color: #555; }
  .flow > li { break-inside: avoid; }
}
