/* ==========================================================================
   Editorial Slate — shared design system for Learn With Darin guides
   Single stylesheet, hand-rolled, no Tailwind.
   ========================================================================== */

/* --- Tokens ---------------------------------------------------------------- */

:root {
  /* Surfaces */
  --paper:        #f6f4ef;
  --paper-tint:   #ecebe5;
  --paper-deep:   #e0ddd3;
  --rule:         #d8d4c8;

  /* Ink */
  --ink:          #11151c;
  --ink-soft:     #2c333d;
  --muted:        #5b6471;
  --muted-2:      #8b94a3;

  /* Accent (deep editorial blue) */
  --accent:       #1f4ed8;
  --accent-deep:  #1e3a8a;
  --accent-tint:  #dbe5ff;

  /* Code */
  --code-bg:      #0e141d;
  --code-ink:     #e7ecf3;
  --code-accent:  #7dd3fc;
  --code-pill:    #e6e3d8;
  --code-pill-ink:#1e3a8a;

  /* Callouts */
  --note-bar:     #1f4ed8;
  --note-bg:      #eef3ff;
  --warn-bar:     #b45309;
  --warn-bg:      #fdf3e0;
  --tip-bar:      #047857;
  --tip-bg:       #e6f4ec;

  /* Type */
  --serif: "Fraunces", "Times New Roman", Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Layout */
  --content-max: 740px;   /* Reading column inside guides (intentionally narrow) */
  --page-max:    1680px;  /* Outer page shell (nav, hub, cert, guide-shell).
                             Generous so MacBook Air / Pro 14-16 fill the screen;
                             still capped to avoid sprawl on 4K monitors.        */
  --nav-height:  56px;
}

/* --- Reset ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

/* Subtle paper grain — gives the cool ivory a tactile feel without
   announcing itself. Fixed-position so it doesn't repaint on scroll. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

img, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 120ms; }
a:hover { border-bottom-color: var(--accent); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 56px 0; }
::selection { background: var(--accent-tint); color: var(--accent-deep); }

/* --- Cross-guide sticky nav ----------------------------------------------- */

.twd-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-height);
  background: rgba(246, 244, 239, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.twd-nav__inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}
.twd-nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  border-bottom: 0;
  white-space: nowrap;
}
.twd-nav__brand:hover { border-bottom: 0; color: var(--accent-deep); }
.twd-nav__brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}
.twd-nav__list {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}
.twd-nav__list::-webkit-scrollbar { display: none; }
.twd-nav__item a {
  display: inline-block;
  padding: 8px 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 6px;
  border-bottom: 0;
  white-space: nowrap;
  transition: color 120ms, background 120ms;
}
.twd-nav__item a:hover { color: var(--ink); background: var(--paper-tint); border-bottom: 0; }
.twd-nav__item.is-active a {
  color: var(--accent-deep);
  background: var(--accent-tint);
}
.twd-nav__item--cert a {
  color: var(--accent);
  font-weight: 600;
  position: relative;
}
.twd-nav__item--cert a::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
  vertical-align: middle;
  transform: translateY(-1px);
}
.twd-nav__item--cert.is-active a { color: var(--accent-deep); background: var(--accent-tint); }
.twd-nav__hub {
  font-size: 13.5px;
  color: var(--muted);
  border-bottom: 0;
  margin-left: auto;
}
.twd-nav__hub:hover { color: var(--ink); border-bottom: 0; }

@media (max-width: 720px) {
  .twd-nav__brand-meta { display: none; }
  .twd-nav__inner { gap: 12px; padding: 0 16px; }
}

/* --- Page shell ----------------------------------------------------------- */

.guide-shell {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 64px 24px 120px;
}

.guide-content {
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

/* --- Hero ---------------------------------------------------------------- */

.guide-eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin: 0 0 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 14px;
}
.guide-eyebrow .guide-number {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.18em;
}
.guide-eyebrow .guide-eyebrow__rule {
  flex: 1;
  height: 1px;
  background: var(--rule);
  display: inline-block;
  max-width: 240px;
  align-self: center;
}

.guide-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(36px, 7.5vw, 88px);
  line-height: 1.02;
  letter-spacing: -0.018em;
  color: var(--ink);
  margin: 0 0 24px;
  font-variation-settings: "SOFT" 50, "opsz" 144;
  text-wrap: balance;
}

.guide-deck {
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 640px;
  margin: 0 0 16px;
}

.guide-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 16px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 32px 0 56px;
}

/* --- Headings ------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 { color: var(--ink); }

h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(28px, 3.4vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.005em;
  margin: 72px 0 16px;
  scroll-margin-top: calc(var(--nav-height) + 24px);
  position: relative;
}

h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.35;
  margin: 40px 0 12px;
  scroll-margin-top: calc(var(--nav-height) + 24px);
  position: relative;
}

h4 {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 12px;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 32px 0 8px;
}

h2 a.anchor, h3 a.anchor {
  position: absolute;
  left: -28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 18px;
  border-bottom: 0;
  opacity: 0;
  transition: opacity 120ms;
}
h2:hover a.anchor, h3:hover a.anchor { opacity: 1; }
h2 a.anchor:hover, h3 a.anchor:hover { color: var(--accent); border-bottom: 0; }

/* --- Body content -------------------------------------------------------- */

p, ul, ol, dl, blockquote { margin: 0 0 18px; }
p + p { margin-top: -2px; }

ul, ol { padding-left: 22px; }
li { margin: 4px 0; }
li > ul, li > ol { margin: 4px 0 4px; }

strong, b { color: var(--ink); font-weight: 600; }
em, i { font-style: italic; }

abbr[title] { text-decoration: none; border-bottom: 1px dotted var(--muted-2); cursor: help; }

/* --- Inline code & code blocks ------------------------------------------- */

code, kbd, samp {
  font-family: var(--mono);
  font-size: 0.88em;
}

p code, li code, td code, h2 code, h3 code, h4 code {
  background: var(--code-pill);
  color: var(--code-pill-ink);
  padding: 1px 6px;
  border-radius: 4px;
}

pre.code, pre {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 18px 20px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.55;
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid #1a2230;
}
pre code { background: none; padding: 0; color: inherit; font-size: inherit; }

kbd {
  background: var(--paper-tint);
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.82em;
  color: var(--ink);
}

/* --- Callouts ------------------------------------------------------------ */

.note, .warn, .tip {
  position: relative;
  margin: 28px 0;
  padding: 16px 20px 16px 22px;
  border-radius: 10px;
  border: 1px solid var(--rule);
  background: var(--note-bg);
  font-size: 16px;
  line-height: 1.6;
}
.note::before, .warn::before, .tip::before {
  content: "";
  position: absolute;
  left: 0; top: 12px; bottom: 12px;
  width: 3px;
  border-radius: 2px;
  background: var(--note-bar);
}
.note { background: var(--note-bg); border-color: #d3deff; }
.warn { background: var(--warn-bg); border-color: #f0d6a3; }
.warn::before { background: var(--warn-bar); }
.tip  { background: var(--tip-bg); border-color: #c8e3d4; }
.tip::before  { background: var(--tip-bar); }

.note > :first-child, .warn > :first-child, .tip > :first-child { margin-top: 0; }
.note > :last-child, .warn > :last-child, .tip > :last-child { margin-bottom: 0; }

.note .label, .warn .label, .tip .label {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-right: 8px;
  vertical-align: 1px;
}
.note .label { color: var(--note-bar); }
.warn .label { color: var(--warn-bar); }
.tip  .label { color: var(--tip-bar); }

/* --- Pull quote ---------------------------------------------------------- */

.pull {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 24px;
  line-height: 1.4;
  color: var(--ink-soft);
  margin: 40px 0;
  padding: 0 0 0 24px;
  border-left: 3px solid var(--accent);
}
.pull cite {
  display: block;
  margin-top: 12px;
  font-family: var(--mono);
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* --- Compare grid (e.g., Mac vs Windows, iOS vs Android) ----------------- */

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 32px 0;
}
.compare > article {
  background: var(--paper-tint);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 20px 22px;
}
.compare h4 {
  margin: 0 0 12px;
}
.compare h4 .badge {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  margin-right: 8px;
}
.compare > article ul {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 15px;
}
.compare > article li { margin: 6px 0; }

@media (max-width: 720px) {
  .compare { grid-template-columns: 1fr; }
}

/* --- Recipes (numbered horizontal rows) ---------------------------------- */

.recipes {
  margin: 32px 0;
  border-top: 1px solid var(--rule);
}
.recipe {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
}
.recipe__num {
  font-family: var(--serif);
  font-size: 32px;
  line-height: 1;
  color: var(--accent);
}
.recipe__title {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--ink);
}
.recipe__body {
  font-size: 16px;
  color: var(--ink-soft);
  margin: 0;
}

/* --- Tables -------------------------------------------------------------- */

.table-wrap { overflow-x: auto; margin: 24px 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
thead th {
  background: var(--paper-tint);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}
tbody tr:last-child td { border-bottom: 0; }

/* --- Top-of-document linked TOC (the brand pattern) ---------------------- */

.toc {
  margin: 56px 0 0;
  padding: 32px;
  background: var(--paper-tint);
  border-radius: 4px;
}
.toc-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 18px;
  font-weight: 500;
}
.toc ol {
  list-style: none;
  counter-reset: toc;
  padding: 0;
  margin: 0;
}
.toc li {
  counter-increment: toc;
  border-bottom: 1px dashed var(--rule);
  margin: 0;
}
.toc li:last-child { border-bottom: none; }
.toc a {
  display: grid;
  grid-template-columns: 28px 1fr auto 16px;
  align-items: baseline;
  gap: 16px;
  padding: 14px 14px;
  margin: 0 -14px;
  border-radius: 4px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 0;
  font-size: 17px;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}
.toc a:hover {
  background: var(--paper);
  color: var(--accent-deep);
  border-bottom: 0;
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}
.toc a::after {
  content: "→";
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted-2);
  transition: color 120ms ease, transform 120ms ease;
}
.toc a:hover::after {
  color: var(--accent);
  transform: translateX(2px);
}
.toc-note {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 14px;
  color: var(--muted);
}
@media (max-width: 640px) {
  .toc { padding: 24px 20px; }
  .toc a { grid-template-columns: 24px 1fr 16px; font-size: 16px; }
  .toc-note { display: none; }
}

/* --- Section markers ("Part 01", "Part 02") ----------------------------- */

.section-marker {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  font-weight: 500;
  margin: 0 0 16px;
}
.section-marker + h2 { margin-top: 12px; }

/* --- Editorial italic callout (lower-key than .note/.warn/.tip) --------- */

.callout {
  border-left: 3px solid var(--accent);
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  line-height: 1.4;
  color: var(--ink-soft);
  margin: 32px 0;
  padding: 4px 0 4px 24px;
}
@media (max-width: 640px) {
  .callout { font-size: 20px; padding-left: 18px; }
}

/* --- H1 italic-em accent emphasis (brand signature) --------------------- */

.guide-title em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}

/* --- Failure-mode blocks for troubleshooting ---------------------------- */

.fails {
  margin: 24px 0;
  border-top: 1px solid var(--rule);
}
.fail {
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.fail-name {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}
.fail-name::before {
  content: "✕";
  display: inline-block;
  width: 1.6em;
  margin-left: -1.6em;
  color: var(--muted-2);
  font-weight: 400;
}
.fail-fix {
  font-size: 16px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.55;
}
.fail-fix strong { color: var(--ink); }
.fail-fix ul, .fail-fix ol { margin: 8px 0 0; padding-left: 22px; }
.fail-fix li { margin: 4px 0; }

/* --- Hub homepage -------------------------------------------------------- */

.hub-shell {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 80px 24px 120px;
}
.hub-hero {
  max-width: 820px;
  margin: 0 0 64px;
}
.hub-eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin: 0 0 20px;
}
.hub-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 9vw, 124px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin: 0 0 28px;
  font-variation-settings: "SOFT" 50, "opsz" 144;
  text-wrap: balance;
}
.hub-title br + em,
.hub-title br {
  /* Add a touch of vertical breathing room between the two display lines
     without affecting single-line uses of .hub-title. */
}
.hub-title em {
  color: var(--accent);
  font-style: italic;
  font-weight: 400;
}
.hub-deck {
  font-size: 20px;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 640px;
  margin: 0;
}

.hub-section + .hub-section { margin-top: 56px; }

.hub-section-label {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
@media (max-width: 720px) {
  .hub-grid { grid-template-columns: 1fr; }
}

.hub-card {
  background: var(--paper-tint);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 28px 28px 32px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  color: inherit;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.hub-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  border-bottom-color: var(--accent);
  box-shadow: 0 16px 32px -24px rgba(31, 78, 216, 0.4);
}
.hub-card__kicker {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-deep);
  margin: 0 0 12px;
}
.hub-card__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 12px;
}
.hub-card__body {
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 24px;
  flex: 1;
}
.hub-card__cta {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  border-bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hub-card.is-stub .hub-card__cta { color: var(--muted); }
.hub-card.is-stub::after {
  content: "Coming soon";
  position: absolute;
}

.hub-footer {
  margin-top: 96px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
}
.hub-footer a {
  color: var(--muted);
  border-bottom: 0;
}
.hub-footer a:hover { color: var(--ink); border-bottom: 0; }

/* --- Footer for guides --------------------------------------------------- */

.guide-footer {
  margin-top: 96px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
}
.guide-footer a { color: var(--muted); border-bottom: 0; }
.guide-footer a:hover { color: var(--ink); }

/* --- Stub guide placeholder --------------------------------------------- */

.stub-block {
  margin-top: 56px;
  padding: 40px 32px;
  background: var(--paper-tint);
  border: 1px dashed var(--rule);
  border-radius: 12px;
  text-align: center;
}
.stub-block__label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin: 0 0 12px;
}
.stub-block__title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  margin: 0 0 12px;
  color: var(--ink);
}
.stub-block__body {
  max-width: 540px;
  margin: 0 auto;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* --- Editorial Quarterly upgrades --------------------------------------- */

/* Hub publication-mark line, sits between deck and provider sections */
.hub-meta {
  margin: 36px 0 0;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
}
.hub-meta strong { color: var(--ink); font-weight: 600; }

/* Hub-card refinement: number badge in the corner, sharper chrome,
   restrained hover. Extends the existing .hub-card rule. */
.hub-card {
  position: relative;
  border-radius: 8px;
  padding: 32px 32px 36px;
}
.hub-card .guide-number {
  position: absolute;
  top: 22px;
  right: 24px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--accent);
  background: var(--paper);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule);
}
.hub-card:hover .guide-number {
  border-color: var(--accent);
  color: var(--accent-deep);
}

/* Drop cap for the first paragraph of a guide. The class is applied by
   each guide's first <p> after the section header. */
.has-dropcap::first-letter {
  font-family: var(--serif);
  font-weight: 400;
  font-style: normal;
  color: var(--accent);
  float: left;
  font-size: 5.4em;
  line-height: 0.82;
  margin: 0.04em 0.12em 0 -0.04em;
  font-variation-settings: "SOFT" 100, "opsz" 144;
}

/* Section-end fleuron: appears between adjacent <section> blocks inside
   .guide-content. Pulled up so it sits in the negative-space between
   sections rather than adding new vertical run. */
.guide-content section + section::before {
  content: "✦";
  display: block;
  text-align: center;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--muted-2);
  margin: -28px 0 24px;
  letter-spacing: 0;
  user-select: none;
}

/* Page-load stagger: hero block elements fade up. CSS-only, runs once. */
@keyframes twd-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.guide-content > header > *,
.hub-shell > .hub-hero > *,
.hub-shell > .hub-section {
  animation: twd-rise 700ms cubic-bezier(.2,.8,.2,1) both;
}
.guide-content > header > *:nth-child(1) { animation-delay: 40ms; }
.guide-content > header > *:nth-child(2) { animation-delay: 120ms; }
.guide-content > header > *:nth-child(3) { animation-delay: 220ms; }
.guide-content > header > *:nth-child(4) { animation-delay: 320ms; }
.hub-shell > .hub-hero > *:nth-child(1) { animation-delay: 40ms; }
.hub-shell > .hub-hero > *:nth-child(2) { animation-delay: 120ms; }
.hub-shell > .hub-hero > *:nth-child(3) { animation-delay: 220ms; }
.hub-shell > .hub-hero > *:nth-child(4) { animation-delay: 300ms; }
.hub-shell > .hub-section:nth-of-type(1) { animation-delay: 380ms; }
.hub-shell > .hub-section:nth-of-type(2) { animation-delay: 460ms; }
.hub-shell > .hub-section:nth-of-type(3) { animation-delay: 540ms; }
@media (prefers-reduced-motion: reduce) {
  .guide-content > header > *,
  .hub-shell > .hub-hero > *,
  .hub-shell > .hub-section { animation: none; }
}

/* Refined hub-section-label rhythm with the date stamp on the right */
.hub-section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}
.hub-section-label::after {
  content: attr(data-mark);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* Subtle TOC entry stagger on initial render */
.toc li {
  animation: twd-rise 600ms ease both;
}
.toc li:nth-child(1) { animation-delay: 540ms; }
.toc li:nth-child(2) { animation-delay: 580ms; }
.toc li:nth-child(3) { animation-delay: 620ms; }
.toc li:nth-child(4) { animation-delay: 660ms; }
.toc li:nth-child(5) { animation-delay: 700ms; }
.toc li:nth-child(6) { animation-delay: 740ms; }
.toc li:nth-child(7) { animation-delay: 780ms; }
.toc li:nth-child(8) { animation-delay: 820ms; }
.toc li:nth-child(9) { animation-delay: 860ms; }
.toc li:nth-child(10) { animation-delay: 900ms; }
.toc li:nth-child(11) { animation-delay: 940ms; }
.toc li:nth-child(12) { animation-delay: 980ms; }
@media (prefers-reduced-motion: reduce) {
  .toc li { animation: none; }
}

/* --- Hub primer (Start here) ------------------------------------------- */

.hub-primer {
  display: block;
  margin: 56px 0 72px;
  padding: 40px 44px 44px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 8px;
  text-decoration: none;
  border-bottom: 0;
  position: relative;
  overflow: hidden;
  transition: transform 200ms cubic-bezier(.2,.8,.2,1), box-shadow 200ms;
}
.hub-primer::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 100% 0%, rgba(31,78,216,0.35), transparent 55%),
    radial-gradient(circle at 0% 100%, rgba(125,211,252,0.18), transparent 60%);
  opacity: 0.9;
  pointer-events: none;
}
.hub-primer::after {
  content: "✦";
  position: absolute;
  top: 28px;
  right: 32px;
  font-family: var(--serif);
  font-size: 18px;
  color: rgba(125,211,252,0.55);
}
.hub-primer:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 48px -28px rgba(11,21,40,0.55);
  border-bottom: 0;
}
.hub-primer > * { position: relative; }

.hub-primer__meta {
  display: flex;
  align-items: baseline;
  gap: 18px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(231,236,243,0.65);
  margin: 0 0 18px;
}
.hub-primer__label {
  color: var(--code-accent);
  font-weight: 600;
}
.hub-primer__num {
  border-left: 1px solid rgba(231,236,243,0.25);
  padding-left: 18px;
}

.hub-primer__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(36px, 5.4vw, 56px);
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  color: var(--paper);
  font-variation-settings: "SOFT" 50, "opsz" 144;
  max-width: 780px;
}
.hub-primer__title em {
  color: var(--code-accent);
  font-style: italic;
}

.hub-primer__body {
  font-size: 17px;
  line-height: 1.55;
  color: rgba(231,236,243,0.8);
  max-width: 640px;
  margin: 0 0 28px;
}

.hub-primer__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--code-accent);
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(125,211,252,0.4);
}
.hub-primer:hover .hub-primer__cta {
  border-bottom-color: var(--code-accent);
}

@media (max-width: 720px) {
  .hub-primer { padding: 32px 28px; }
}

/* --- Audio overview card ------------------------------------------------- */

.audio-card {
  margin: 32px 0;
  padding: 22px 26px;
  background: var(--paper-tint);
  border: 1px solid var(--rule);
  border-radius: 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px 22px;
  align-items: center;
}
.audio-card__icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.audio-card__meta { min-width: 0; }
.audio-card__kicker {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin: 0 0 4px;
}
.audio-card__title {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 2px;
  letter-spacing: 0;
  text-transform: none;
}
.audio-card__sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.audio-card audio {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 4px;
}
@media (max-width: 720px) {
  .audio-card { padding: 18px 20px; gap: 12px 16px; }
  .audio-card__icon { width: 40px; height: 40px; font-size: 18px; }
}

/* --- Gentle (beginner) primer variant ---------------------------------- */

/* When two primers stack, tighten the spacing between them. */
.hub-primer + .hub-primer { margin-top: -32px; }

.hub-primer--gentle {
  background: var(--paper-tint);
  color: var(--ink);
  border: 1px solid var(--rule);
}
.hub-primer--gentle::before {
  background:
    radial-gradient(circle at 0% 0%, rgba(31,78,216,0.10), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(180,83,9,0.08), transparent 60%);
  opacity: 1;
}
.hub-primer--gentle::after {
  color: var(--accent);
  opacity: 0.55;
}
.hub-primer--gentle .hub-primer__meta {
  color: var(--muted);
}
.hub-primer--gentle .hub-primer__label {
  color: var(--accent);
}
.hub-primer--gentle .hub-primer__num {
  border-left: 1px solid var(--rule);
}
.hub-primer--gentle .hub-primer__title {
  color: var(--ink);
}
.hub-primer--gentle .hub-primer__title em {
  color: var(--accent);
}
.hub-primer--gentle .hub-primer__body {
  color: var(--ink-soft);
}
.hub-primer--gentle .hub-primer__cta {
  color: var(--accent);
  border-bottom: 1px solid rgba(31,78,216,0.4);
}
.hub-primer--gentle:hover .hub-primer__cta {
  border-bottom-color: var(--accent);
}

/* --- Guides dropdown ----------------------------------------------------- */

.twd-nav__guides {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.twd-nav__guides-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: color 120ms, background 120ms;
}
.twd-nav__guides-trigger:hover { color: var(--ink); background: var(--paper-tint); }
.twd-nav__guides-trigger.is-active {
  color: var(--accent-deep);
  background: var(--accent-tint);
}
.twd-nav__caret {
  font-size: 10px;
  line-height: 1;
  transform: translateY(-1px);
  transition: transform 160ms ease;
}
.twd-nav__guides.is-open .twd-nav__caret {
  transform: translateY(-1px) rotate(180deg);
}

.twd-nav__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  min-width: 380px;
  max-width: 92vw;
  /* Cap height so the panel stays inside the viewport even when the guide
     list grows. Scroll inside the panel rather than off the page. */
  max-height: calc(100vh - var(--nav-height) - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 18px 40px -22px rgba(11,21,40,0.25);
  padding: 16px 8px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
  z-index: 60;
}
.twd-nav__guides.is-open .twd-nav__menu {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.twd-nav__menu-group { padding: 4px 8px; }
.twd-nav__menu-group + .twd-nav__menu-group {
  border-top: 1px solid var(--rule);
  margin-top: 6px;
  padding-top: 12px;
}
.twd-nav__menu-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 4px 8px;
  margin-bottom: 4px;
}
.twd-nav__menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.twd-nav__menu li { margin: 0; }
.twd-nav__menu li a {
  display: grid;
  gap: 2px;
  padding: 8px 8px;
  border-radius: 6px;
  color: var(--ink);
  border-bottom: 0;
  transition: background 120ms;
}
.twd-nav__menu li a:hover { background: var(--paper-tint); border-bottom: 0; }
.twd-nav__menu li.is-active a { background: var(--accent-tint); }
.twd-nav__menu-title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.twd-nav__menu li.is-active .twd-nav__menu-title { color: var(--accent-deep); }
.twd-nav__menu-tagline {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.4;
}

@media (max-width: 720px) {
  .twd-nav__menu {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    min-width: 0;
    max-width: 100vw;
    transform: translateY(-4px);
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: 0 12px 24px -12px rgba(11,21,40,0.2);
  }
  .twd-nav__guides.is-open .twd-nav__menu {
    transform: translateY(0);
  }
}

/* --- Language picker (i18n) ---------------------------------------------- */

.twd-i18n {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: auto; /* Pin to the right edge of the nav inner */
}
.twd-i18n__trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  transition: color 120ms, background 120ms, border-color 120ms;
}
.twd-i18n__trigger:hover {
  color: var(--ink);
  background: var(--paper-tint);
  border-color: var(--rule);
}
.twd-i18n__globe { font-size: 13px; line-height: 1; }
.twd-i18n__current {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.twd-i18n__caret {
  font-size: 9px;
  line-height: 1;
  transition: transform 160ms ease;
}
.twd-i18n.is-open .twd-i18n__caret { transform: rotate(180deg); }

.twd-i18n__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 18px 40px -22px rgba(11,21,40,0.25);
  padding: 6px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
  transform: translateY(-4px);
  z-index: 60;
}
.twd-i18n.is-open .twd-i18n__menu {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.twd-i18n__menu ul { list-style: none; margin: 0; padding: 0; }
.twd-i18n__menu li a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 7px 10px;
  border-radius: 6px;
  border-bottom: 0;
  color: var(--ink);
}
.twd-i18n__menu li a:hover { background: var(--paper-tint); border-bottom: 0; }
.twd-i18n__menu-native {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.twd-i18n__menu-name {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

@media (max-width: 720px) {
  .twd-i18n__menu {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    min-width: 0;
    max-width: 100vw;
    max-height: 70vh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
}

/* --- Language auto-detect banner ----------------------------------------- */

.twd-i18n-banner {
  position: sticky;
  top: var(--nav-height);
  z-index: 49;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-family: var(--sans);
  font-size: 14px;
  border-bottom: 1px solid rgba(246,244,239,0.08);
}
.twd-i18n-banner__msg {
  flex: 1 1 auto;
  min-width: 200px;
  color: rgba(246,244,239,0.92);
}
.twd-i18n-banner__yes,
.twd-i18n-banner__no {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 120ms, border-color 120ms;
}
.twd-i18n-banner__yes {
  background: var(--code-accent);
  color: var(--ink);
  border-color: var(--code-accent);
}
.twd-i18n-banner__yes:hover { background: #b6e6fd; border-color: #b6e6fd; }
.twd-i18n-banner__no {
  background: transparent;
  color: rgba(246,244,239,0.7);
  border-color: rgba(246,244,239,0.2);
}
.twd-i18n-banner__no:hover {
  color: var(--paper);
  border-color: rgba(246,244,239,0.5);
}

/* Language picker filter input */
.twd-i18n__search {
  width: 100%;
  margin: 0 0 6px;
  padding: 8px 10px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  outline: none;
  transition: border-color 120ms;
}
.twd-i18n__search::placeholder { color: var(--muted-2); }
.twd-i18n__search:focus { border-color: var(--accent); }

/* --- Hub: unified "every guide" section --------------------------------- */

.hub-section--all { margin-top: 16px; }

.hub-section-head { margin-bottom: 24px; }
.hub-section-sub {
  font-size: 16px;
  color: var(--muted);
  margin: 8px 0 0;
  max-width: 640px;
  line-height: 1.55;
}

.hub-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 32px;
}
.hub-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  transition: color 120ms, background 120ms, border-color 120ms;
}
.hub-filter:hover { color: var(--ink); border-color: var(--ink); }
.hub-filter.is-active {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}
.hub-filter__count {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(11,21,40,0.06);
  color: var(--muted-2);
  min-width: 18px;
  text-align: center;
}
.hub-filter.is-active .hub-filter__count {
  background: rgba(246,244,239,0.18);
  color: var(--paper);
}

.hub-grid--all {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 0;
}

/* Tighter card density inside the unified grid; adds a provider tag pill.
   Card uses a 2-column grid so the guide-number and provider tag share row 1
   without overlapping at any text length. */
.hub-grid--all .hub-card {
  position: relative;
  padding: 22px 24px 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-content: start;
}
.hub-grid--all .hub-card > * { grid-column: 1 / -1; }
.hub-grid--all .hub-card > .guide-number {
  grid-column: 1;
  grid-row: 1;
  font-size: 11px;
  letter-spacing: 0.18em;
  margin-top: 4px;
  align-self: center;
}
.hub-grid--all .hub-card > .hub-card__tag {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-self: end;
}
.hub-grid--all .hub-card .hub-card__title {
  font-size: 22px;
  margin: 4px 0 6px;
}
.hub-grid--all .hub-card .hub-card__body {
  font-size: 14.5px;
  line-height: 1.5;
  margin: 0;
  color: var(--ink-soft);
}
.hub-grid--all .hub-card .hub-card__cta {
  margin-top: 12px;
  font-size: 11px;
}

.hub-card__tag {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  padding: 3px 8px;
  border: 1px solid var(--accent-tint);
  background: var(--accent-tint);
  border-radius: 999px;
  white-space: nowrap;
}

.hub-empty {
  margin: 24px 0 0;
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
  border: 1px dashed var(--rule);
  border-radius: 8px;
}

/* --- Hub: single cert card (compact, distinctive) ----------------------- */

.hub-section--cert { margin: 56px 0 16px; }
.hub-cert { position: relative; }
.hub-cert::before {
  content: attr(data-mark);
  position: absolute;
  top: -20px;
  left: 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
}
.hub-cert__card {
  display: grid;
  gap: 8px;
  padding: 32px 36px;
  background: var(--paper-tint);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  text-decoration: none;
  border-bottom: 0;
  transition: transform 200ms cubic-bezier(.2,.8,.2,1), box-shadow 200ms, border-left-color 200ms;
}
.hub-cert__card:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 48px -28px rgba(11,21,40,0.25);
  border-bottom: 0;
}
.hub-cert__kicker {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.hub-cert__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(28px, 3.4vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 4px 0 6px;
  font-variation-settings: "SOFT" 50, "opsz" 144;
}
.hub-cert__title em { color: var(--accent); font-style: italic; }
.hub-cert__body {
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 8px;
  max-width: 720px;
}
.hub-cert__cta {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  padding-bottom: 3px;
  border-bottom: 1px solid var(--accent-tint);
  width: fit-content;
}
.hub-cert__card:hover .hub-cert__cta { border-bottom-color: var(--accent); }

@media (max-width: 720px) {
  .hub-cert__card { padding: 24px 22px; }
  .hub-grid--all { grid-template-columns: 1fr; }
}

/* --- Study video embed (cert page primer; reusable on any guide) -------- */

.study-video {
  margin: 32px 0;
  padding: 24px;
  background: var(--paper-tint);
  border: 1px solid var(--rule);
  border-radius: 10px;
  border-left: 3px solid var(--accent);
}
.study-video__label {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
}
.study-video__title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.2;
  margin: 8px 0 8px;
  color: var(--ink);
}
.study-video__body {
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 18px;
  color: var(--ink-soft);
  max-width: 64ch;
}
.study-video__player {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--ink);
  border-radius: 6px;
  overflow: hidden;
}
.study-video__player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 720px) {
  .study-video { padding: 20px; }
  .study-video__title { font-size: 22px; }
}

/* --- Footer prev/next nav (rendered by templater from manifest order) -- */

.guide-prevnext {
  margin: 56px 0 16px;
  padding: 24px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  border-top: 1px solid var(--rule);
}
.guide-prevnext__link {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper-tint);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 120ms ease, background 120ms ease;
}
.guide-prevnext__link:hover {
  border-color: var(--accent);
  background: var(--paper);
}
.guide-prevnext__prev { text-align: left; }
.guide-prevnext__next { text-align: right; }
.guide-prevnext__label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
}
.guide-prevnext__prev .guide-prevnext__label::before { content: "← "; }
.guide-prevnext__next .guide-prevnext__label::after  { content: " →"; }
.guide-prevnext__title {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--ink);
}
.guide-prevnext__spacer { display: block; }

@media (max-width: 720px) {
  .guide-prevnext { grid-template-columns: 1fr; }
  .guide-prevnext__next { text-align: left; }
  .guide-prevnext__next .guide-prevnext__label::after { content: ""; }
  .guide-prevnext__next .guide-prevnext__label::before { content: "→ "; }
}

/* --- TOC scroll-spy active state --------------------------------------- */

nav.toc a.is-active {
  color: var(--accent);
  background: var(--accent-tint);
  border-radius: 4px;
}
nav.toc a.is-active span:first-child {
  font-weight: 600;
}

/* --- Code-block copy button -------------------------------------------- */

.code-wrap {
  position: relative;
}
.code-wrap > pre.code { margin: 0; }
.code-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--code-ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}
.code-wrap:hover .code-copy,
.code-wrap:focus-within .code-copy { opacity: 1; }
.code-copy:hover { background: rgba(255, 255, 255, 0.14); }
.code-copy:focus-visible {
  opacity: 1;
  outline: 2px solid var(--code-accent);
  outline-offset: 2px;
}
.code-copy.is-copied {
  color: var(--code-accent);
  border-color: var(--code-accent);
  background: rgba(125, 211, 252, 0.12);
}

/* --- Hub: head-to-head section ----------------------------------------- */

.hub-section--compare { margin: 56px 0 16px; }
.hub-compare-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 0;
}
.hub-compare-card {
  display: grid;
  gap: 6px;
  padding: 22px 22px 24px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 120ms ease, transform 120ms ease;
}
.hub-compare-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.hub-compare-card__kicker {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.hub-compare-card__title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.2;
  margin: 4px 0 6px;
  color: var(--ink);
}
.hub-compare-card__body {
  font-size: 14.5px;
  line-height: 1.5;
  margin: 0;
  color: var(--ink-soft);
}
.hub-compare-card__cta {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

@media (max-width: 980px) {
  .hub-compare-grid { grid-template-columns: 1fr; }
}

/* --- Skip-to-content link (visible on focus) --------------------------- */

.skip-to-content {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 6px;
  transform: translateY(-150%);
  transition: transform 140ms ease;
}
.skip-to-content:focus,
.skip-to-content:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Section-anchor reveal --------------------------------------------- */

section[id] > h2 {
  scroll-margin-top: 80px;
}
.section-anchor {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.7em;
  color: var(--muted-2);
  text-decoration: none;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 120ms ease, transform 120ms ease, color 120ms ease;
}
section[id]:hover > h2 .section-anchor,
section[id] > h2:hover .section-anchor,
.section-anchor:focus-visible {
  opacity: 1;
  transform: translateX(0);
}
.section-anchor:hover { color: var(--accent); }

/* --- Cmd-K search modal ------------------------------------------------- */

.twd-search {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.twd-search.is-open { display: flex; }
.twd-search__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 21, 40, 0.45);
  backdrop-filter: blur(4px);
}
.twd-search__panel {
  position: relative;
  width: min(640px, 92vw);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: 0 24px 60px -22px rgba(11, 21, 40, 0.45);
  overflow: hidden;
}
.twd-search__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
}
.twd-search__input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  padding: 6px 0;
}
.twd-search__input::placeholder { color: var(--muted-2); }
.twd-search__esc {
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--paper-tint);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.twd-search__list {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.twd-search__hint {
  padding: 24px 12px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}
.twd-search__result a {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  row-gap: 2px;
  padding: 10px 12px;
  color: var(--ink);
  text-decoration: none;
  border-radius: 6px;
}
.twd-search__result.is-active a,
.twd-search__result a:hover {
  background: var(--accent-tint);
}
.twd-search__tag {
  align-self: start;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 3px 7px;
  border: 1px solid var(--accent-tint);
  background: var(--paper);
  border-radius: 999px;
  white-space: nowrap;
  grid-row: 1 / span 2;
}
.twd-search__title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  color: var(--ink);
}
.twd-search__tagline {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.twd-search__status {
  padding: 8px 14px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
body.twd-search-open { overflow: hidden; }

/* --- Responsive refinements ---------------------------------------------
 * Existing breakpoints in this file are mostly @720px. This block adds
 * tablet (480-720) and small-mobile (<=480) refinements, plus a few tap-
 * target rules so touch interactions land cleanly. Wide screens stay
 * centered via the existing 1120px max-width on hub/guide shells.
 */

/* Tablet and below: hub container breathes with less padding */
@media (max-width: 720px) {
  .hub-shell { padding: 48px 16px 80px; }
  .hub-hero { margin: 0 0 40px; }
  .hub-hero .hub-deck { font-size: 17px; }
  .hub-hero .hub-meta { font-size: 11px; gap: 8px 16px; flex-wrap: wrap; }
  .hub-section + .hub-section { margin-top: 40px; }
  .hub-section-label { font-size: 22px; margin-bottom: 16px; }
  .hub-primer { padding: 28px 24px; }
  .hub-primer__title { font-size: clamp(28px, 8vw, 44px) !important; }
  .hub-cert__card { padding: 24px 22px; }
  .hub-cert__title { font-size: clamp(24px, 7vw, 36px); }
  .hub-grid--all .hub-card { padding: 18px 20px 22px; }
  .hub-grid--all .hub-card .hub-card__title { font-size: 19px; }
  .hub-compare-card { padding: 18px 20px 22px; }
  .hub-compare-card__title { font-size: 19px; }
}

/* Small-mobile (phones): tighter still, larger tap targets */
@media (max-width: 480px) {
  .hub-shell { padding: 36px 14px 64px; }
  .hub-hero .hub-deck { font-size: 16px; }
  .hub-primer { padding: 22px 18px; border-radius: 12px; }
  .hub-primer__meta { gap: 8px; flex-wrap: wrap; }
  .hub-cert__card { padding: 22px 18px; border-radius: 10px; }
  .hub-grid--all { gap: 12px; }
  .hub-compare-grid { gap: 12px; }

  /* Filter chips: 40px tap-target floor, wider gap so they wrap cleanly */
  .hub-filters { gap: 8px; }
  .hub-filter {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 11.5px;
  }

  /* Cross-guide nav: tighten padding, hide brand subtext, reduce item size */
  .twd-nav__inner { gap: 8px; padding: 0 12px; }
  .twd-nav__brand { font-size: 16px; }
  .twd-nav__brand-mark { width: 26px; height: 26px; font-size: 14px; }
  .twd-nav__item a { padding: 8px 10px; font-size: 13px; }
}

/* Guide content body: tighten padding on tablet and below */
@media (max-width: 720px) {
  .guide-shell { padding: 40px 16px 80px; }
  .guide-deck { font-size: 17px; }
  .guide-meta { font-size: 11px; gap: 8px 16px; padding: 12px 0; margin: 24px 0 40px; }
  body { font-size: 16px; }
  h2 { margin: 56px 0 14px; }
  h3 { margin: 32px 0 10px; font-size: 18px; }
  pre.code, pre {
    padding: 14px 16px;
    font-size: 12.5px;
    border-radius: 8px;
    margin: 18px 0;
  }
  .table-wrap { margin: 18px 0; }
  .table-wrap table { font-size: 13px; }
  .recipe { grid-template-columns: 36px 1fr; gap: 12px; }
  .compare > article { padding: 16px 18px; }
  .note, .tip, .warn, .callout { padding: 14px 16px; }
}

/* Comparison/study video player: scale down nicely on small screens */
@media (max-width: 480px) {
  .study-video { padding: 16px; border-radius: 8px; }
  .study-video__title { font-size: 19px; }
  .study-video__body { font-size: 14px; }
}

/* Search modal: reduce padding-top on small screens so the panel sits
 * higher up where the keyboard doesn't immediately cover it. */
@media (max-width: 480px) {
  .twd-search { padding-top: 6vh; }
  .twd-search__panel { width: 96vw; max-height: 80vh; }
  .twd-search__bar { padding: 12px 14px; }
  .twd-search__input { font-size: 16px; } /* avoids iOS zoom-on-focus */
  .twd-search__title { font-size: 14px; }
  .twd-search__tagline { font-size: 12.5px; }
}

/* Footer prev/next: stack neatly on phones (already done at 720), add 480 */
@media (max-width: 480px) {
  .guide-prevnext { gap: 10px; padding-top: 18px; margin-top: 40px; }
  .guide-prevnext__link { padding: 14px 16px; }
  .guide-prevnext__title { font-size: 17px; }
}

/* Wide-screen polish: keep the editorial column from feeling marooned on
 * very wide monitors by slightly larger gutters; still capped at 1120. */
@media (min-width: 1440px) {
  .hub-shell { padding-left: 32px; padding-right: 32px; }
  .guide-shell { padding-left: 32px; padding-right: 32px; }
}
