/* ═══════════════════════════════════════════════════════════════════════════
   Distributed Tracing — Main Stylesheet
   Color Scheme: Autumn Harvest (toasted reds, brown sugar, mellow golds)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. CSS Custom Properties ──────────────────────────────────────────── */
:root {
  /* Palette */
  --c-primary:      #8B3A2A;   /* toasted red */
  --c-primary-dark: #6B2A1A;
  --c-primary-light:#B04A36;
  --c-secondary:    #9B6B2E;   /* brown sugar */
  --c-accent:       #C8941A;   /* mellow gold */
  --c-accent-light: #E8B84B;
  --c-accent-dim:   #D4A830;

  /* Neutrals */
  --c-bg:           #FAF6F1;   /* warm off-white */
  --c-surface:      #F2EAE0;   /* warm sand */
  --c-surface-2:    #EDE0D0;
  --c-border:       #D4B896;
  --c-border-light: #E8D8C4;

  /* Text */
  --c-text:         #2C1810;   /* dark brown */
  --c-text-muted:   #6B4A3A;
  --c-text-light:   #96786A;

  /* Code */
  --c-code-bg:      #FDF3E8;
  --c-code-border:  #E8C8A0;
  --c-inline-code-bg: #F5E8D8;

  /* Semantic */
  --c-link:         #8B3A2A;
  --c-link-hover:   #6B2A1A;
  --c-focus:        #C8941A;

  /* Spacing */
  --space-xs:  .25rem;
  --space-sm:  .5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Layout */
  --max-width:      1440px;
  --content-width:  1200px;
  --header-height:  64px;
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(44,24,16,.08), 0 1px 2px rgba(44,24,16,.06);
  --shadow-md:  0 4px 12px rgba(44,24,16,.10), 0 2px 4px rgba(44,24,16,.06);
  --shadow-lg:  0 8px 24px rgba(44,24,16,.12), 0 4px 8px rgba(44,24,16,.08);

  /* Transitions */
  --transition: 200ms ease;
}

/* ── 2. Reset & Base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1rem);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--c-bg);
  color: var(--c-text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg { max-width: 100%; display: block; }
ul, ol { padding-left: 1.4em; }
li { margin-bottom: .25em; }
hr { border: none; border-top: 1px solid var(--c-border); margin: var(--space-xl) 0; }

/* ── 3. Typography ──────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  font-weight: 700;
  color: var(--c-text);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
}

h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); color: var(--c-primary); margin-top: 0; }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.75rem); color: var(--c-primary-dark); border-bottom: 2px solid var(--c-border-light); padding-bottom: .4em; }
h3 { font-size: clamp(1.1rem, 2vw, 1.3rem); color: var(--c-secondary); }
h4 { font-size: 1.05rem; color: var(--c-text); }

p { margin-bottom: var(--space-md); }

a {
  color: var(--c-link);
  text-decoration: underline;
  text-decoration-color: var(--c-accent);
  text-underline-offset: 3px;
  transition: color var(--transition), text-decoration-color var(--transition);
}
a:hover { color: var(--c-link-hover); text-decoration-color: var(--c-primary); }
a:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 3px; border-radius: var(--radius-sm); }

strong { font-weight: 700; color: var(--c-text); }
em { font-style: italic; }

/* Anchor links on headings — headerLink() mode wraps the full text in the <a> */
.header-anchor {
  color: inherit;          /* always show the heading colour */
  text-decoration: none;
}
/* Reveal a subtle # symbol after the heading text on hover */
.header-anchor > span::after,
.header-anchor::after {
  content: " #";
  font-size: .65em;
  font-weight: 400;
  opacity: 0;
  color: var(--c-accent);
  transition: opacity var(--transition);
  user-select: none;
}
h1:hover .header-anchor > span::after, h1:hover .header-anchor::after,
h2:hover .header-anchor > span::after, h2:hover .header-anchor::after,
h3:hover .header-anchor > span::after, h3:hover .header-anchor::after,
h4:hover .header-anchor > span::after, h4:hover .header-anchor::after { opacity: .55; }

/* ── 4. Layout ──────────────────────────────────────────────────────────── */
.site-wrap { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space-xl); width: 100%; }

main {
  flex: 1;
  padding: var(--space-xl) 0 var(--space-3xl);
}

.content-wrap {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

/* ── 5. Sticky Header ───────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: linear-gradient(135deg, #2C1810 0%, #3D2415 60%, #4A2E18 100%);
  box-shadow: 0 2px 12px rgba(44,24,16,.4);
  border-bottom: 2px solid var(--c-accent);
}

.site-header .site-wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo:hover { opacity: .9; }
.site-logo svg { height: 36px; width: auto; flex-shrink: 0; }
.site-logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.site-logo-text .logo-primary { font-size: .95rem; font-weight: 800; color: #FAF6F1; letter-spacing: -.01em; }
.site-logo-text .logo-secondary { font-size: .7rem; font-weight: 500; color: var(--c-accent-light); letter-spacing: .03em; text-transform: uppercase; }

/* Nav */
.site-nav { display: flex; align-items: center; gap: var(--space-xs); }

.nav-link {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .85rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: #D4C4B8;
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-link:hover { background: rgba(200,148,26,.15); color: var(--c-accent-light); }
.nav-link.active { background: rgba(200,148,26,.22); color: var(--c-accent-light); font-weight: 600; }

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: var(--space-sm);
  cursor: pointer;
  width: 40px;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: #FAF6F1; border-radius: 2px; transition: transform var(--transition), opacity var(--transition); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── 6. Breadcrumbs ─────────────────────────────────────────────────────── */
.breadcrumb {
  max-width: var(--content-width);
  margin: 0 auto var(--space-xl);
  padding: 0 var(--space-xl);
}

.breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem;
  font-size: .8rem;
  color: var(--c-text-muted);
}

.breadcrumb li { display: flex; align-items: center; gap: .25rem; margin: 0; }
.breadcrumb li::before { content: none; }
.breadcrumb li + li::before {
  content: "›";
  color: var(--c-accent);
  font-weight: 600;
  font-size: .9em;
}

.breadcrumb a {
  color: var(--c-text-muted);
  text-decoration: none;
  transition: color var(--transition);
  font-weight: 500;
}
.breadcrumb a:hover { color: var(--c-primary); }
.breadcrumb [aria-current="page"] { color: var(--c-primary); font-weight: 600; }

/* ── 7. Home Page ───────────────────────────────────────────────────────── */
.page-home main { padding-top: 0; }

.hero {
  background: linear-gradient(160deg, #2C1810 0%, #3D2415 50%, #5A3820 100%);
  color: #FAF6F1;
  padding: var(--space-3xl) 0;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 70% 50%, rgba(200,148,26,.12) 0%, transparent 70%);
  pointer-events: none;
}

.hero .site-wrap { position: relative; }

.hero-inner {
  max-width: 820px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--c-accent-light);
  margin-bottom: var(--space-lg);
  background: rgba(200,148,26,.15);
  padding: .3rem .8rem;
  border-radius: 99px;
  border: 1px solid rgba(200,148,26,.3);
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: #FAF6F1;
  margin-top: 0;
  margin-bottom: var(--space-lg);
  line-height: 1.15;
}

.hero h1 .accent { color: var(--c-accent-light); }

.hero p {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: rgba(250,246,241,.85);
  line-height: 1.7;
  max-width: 65ch;
  margin-bottom: var(--space-lg);
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .8rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
  cursor: pointer;
  border: 2px solid transparent;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--c-accent); color: #2C1810; border-color: var(--c-accent); }
.btn-primary:hover { background: var(--c-accent-light); color: #2C1810; border-color: var(--c-accent-light); }

.btn-outline { background: transparent; color: #FAF6F1; border-color: rgba(250,246,241,.4); }
.btn-outline:hover { background: rgba(250,246,241,.1); border-color: rgba(250,246,241,.7); color: #FAF6F1; }

.btn svg { width: 20px; height: 20px; flex-shrink: 0; }

/* Section cards */
.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-xl);
  margin: var(--space-2xl) 0;
}

.section-card {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  color: var(--c-text);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  box-shadow: var(--shadow-sm);
  position: relative;  /* for stretched-link */
}
.section-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--c-accent); }

.section-card-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.section-card-icon.red    { background: rgba(139,58,42,.12); }
.section-card-icon.brown  { background: rgba(155,107,46,.12); }
.section-card-icon.gold   { background: rgba(200,148,26,.12); }

.section-card h3 { margin: 0; font-size: 1.1rem; }
.section-card h3 a {
  color: var(--c-primary);
  text-decoration: none;
}
/* Stretched link — makes the whole card clickable via the h3 <a> */
.section-card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: var(--radius-lg);
}
.section-card p  { margin: 0; font-size: .9rem; color: var(--c-text-muted); line-height: 1.6; }

.section-card-links { margin-top: auto; padding-top: var(--space-md); border-top: 1px solid var(--c-border-light); position: relative; z-index: 1; }
.section-card-links ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.section-card-links li { margin: 0; }
/* #755123 on #FAF6F1 = 6.60:1 (WCAG AA pass); arrow uses primary (#8B3A2A = 7.13:1) */
.section-card-links a { font-size: .83rem; color: #755123; text-decoration: none; display: flex; align-items: center; gap: .3rem; transition: color var(--transition); position: relative; z-index: 1; }
.section-card-links a::before { content: "→"; color: var(--c-primary); font-weight: 700; flex-shrink: 0; }
.section-card-links a:hover { color: var(--c-primary); }

.home-intro {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-xl) 0;
}

.home-intro h2 { border-bottom: none; margin-top: 0; font-size: 1.5rem; }

/* ── 8. Content Pages ───────────────────────────────────────────────────── */
.content-body {
  width: 100%;
}

.content-body > * + * { margin-top: var(--space-md); }

/* ── Lists ────────────────────────────────────────────────────────────────── */
.content-body ul,
.content-body ol {
  margin-bottom: var(--space-md);
  padding-left: 1.75em;
}

.content-body ul { list-style: disc; }
.content-body ol { list-style: decimal; }

.content-body ul ul       { list-style: circle; }
.content-body ul ul ul    { list-style: square; }
.content-body ol ol       { list-style: lower-alpha; }

.content-body li {
  margin-bottom: .45em;
  padding-left: .2em;
  line-height: 1.65;
}

.content-body ul > li::marker { color: var(--c-accent); font-size: 1.1em; }
.content-body ol > li::marker { color: var(--c-secondary); font-weight: 700; }

/* Nested list indent */
.content-body li > ul,
.content-body li > ol { margin-top: .3em; margin-bottom: .3em; }
.content-body blockquote {
  border-left: 4px solid var(--c-accent);
  background: var(--c-surface);
  padding: .8rem 1.2rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: var(--space-lg) 0;
  color: var(--c-text-muted);
  font-style: italic;
}

/* ── 9. Inline Code ─────────────────────────────────────────────────────── */
/* Inline <code> blends with prose: no background box, no border, no padding */
code:not([class]) {
  font-family: var(--font-mono);
  font-size: .875em;
  color: var(--c-text);
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
  /* Allow long unbreakable tokens to wrap rather than overflow the viewport */
  overflow-wrap: anywhere;
}

/* ── 10. Code Blocks (Prism — Autumn Harvest Light Theme) ──────────────── */
pre[class*="language-"] {
  background: var(--c-code-bg) !important;
  border: 1px solid var(--c-code-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg) !important;
  padding-top: 2.75rem !important; /* extra room for the language label badge */
  overflow-x: auto;
  margin: var(--space-lg) 0;
  position: relative;
  box-shadow: var(--shadow-sm);
  font-size: .875rem;
  line-height: 1.6;
}

code[class*="language-"] {
  font-family: var(--font-mono) !important;
  background: none !important;
  color: #2C1810;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  font-size: inherit;
}

/* Prism token colours — Autumn Harvest */
/* #63564F on code-bg #FDF3E8 = 6.44:1 (WCAG AA pass, replaces #8A786E which was 3.84:1) */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #63564F; font-style: italic; }
.token.punctuation                   { color: #5A4840; }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol { color: #A05A20; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin { color: #287A3A; }
.token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string { color: #7A6028; }
.token.atrule, .token.attr-value, .token.keyword { color: #8B3A2A; font-weight: 600; }
.token.function, .token.class-name   { color: #1A4A8B; }
.token.regex, .token.important, .token.variable { color: #7A3A8A; }
.token.important, .token.bold        { font-weight: 700; }
.token.italic                        { font-style: italic; }

/* Language label */
pre[class*="language-"]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  left: var(--space-md);
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 700;
  color: var(--c-text-light);
  text-transform: uppercase;
  letter-spacing: .08em;
  background: var(--c-surface);
  padding: .15rem .5rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  border: 1px solid var(--c-code-border);
  border-top: none;
}

/* Copy button */
.code-block-wrap { position: relative; }

.copy-btn {
  position: absolute;
  top: .6rem;
  right: .6rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  color: var(--c-text-muted);
  font-size: .72rem;
  font-weight: 600;
  padding: .3rem .65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .3rem;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  font-family: var(--font-sans);
  z-index: 2;
  opacity: 0;
}
.code-block-wrap:hover .copy-btn,
pre:hover + .copy-btn,
.copy-btn:focus { opacity: 1; }
.copy-btn:hover { background: var(--c-surface-2); color: var(--c-text); border-color: var(--c-secondary); }
.copy-btn.copied { color: #287A3A; border-color: #287A3A; background: #EBF5EC; }
.copy-btn svg { width: 13px; height: 13px; }

/* ── 10b. Plain pre (no Prism class) — e.g. raw text / pseudo-code blocks */
pre:not([class]) {
  background: var(--c-code-bg);
  border: 1px solid var(--c-code-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  overflow-x: auto;
  margin: var(--space-lg) 0;
  font-family: var(--font-mono);
  font-size: .875rem;
  line-height: 1.6;
  box-shadow: var(--shadow-sm);
}

/* ── 11. Tables ─────────────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; margin: var(--space-lg) 0; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }

/* Wrap every content table so it can scroll horizontally on narrow viewports
   without being forced to display:block (which collapses cell-width distribution). */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-lg) 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  background: var(--c-bg);
  min-width: 480px;
}

thead { background: linear-gradient(135deg, var(--c-primary), var(--c-secondary)); }
thead th { color: #FAF6F1; font-weight: 600; padding: .75rem 1rem; text-align: left; font-size: .85rem; letter-spacing: .02em; }
tbody tr { border-bottom: 1px solid var(--c-border-light); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--c-surface); }
td { padding: .7rem 1rem; color: var(--c-text); vertical-align: top; }
td code:not([class]) { font-size: .82em; }

/* ── 12. FAQ Accordion ──────────────────────────────────────────────────── */
.faq-list { margin: var(--space-lg) 0; display: flex; flex-direction: column; gap: .5rem; }

.faq-item {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--c-bg);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.faq-item.is-open { box-shadow: var(--shadow-sm); border-color: var(--c-accent); }

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: .9rem var(--space-lg);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: .95rem;
  font-weight: 600;
  color: var(--c-text);
  transition: background var(--transition), color var(--transition);
  line-height: 1.4;
}
.faq-question:hover { background: var(--c-surface); color: var(--c-primary); }
.faq-item.is-open .faq-question { color: var(--c-primary); background: rgba(139,58,42,.05); }

.faq-chevron {
  width: 18px; height: 18px;
  flex-shrink: 0;
  transition: transform var(--transition);
  color: var(--c-accent);
}
.faq-item.is-open .faq-chevron { transform: rotate(180deg); }

.faq-answer {
  display: none;
  padding: .5rem var(--space-lg) var(--space-lg);
  border-top: 1px solid var(--c-border-light);
}
.faq-answer.is-open { display: block; }
.faq-answer p { font-size: .93rem; color: var(--c-text-muted); margin-bottom: .6rem; }
.faq-answer p:last-child { margin-bottom: 0; }
.faq-answer ul, .faq-answer ol { padding-left: 1.5em; margin-bottom: .5rem; }
.faq-answer li { font-size: .93rem; color: var(--c-text-muted); margin-bottom: .25em; }
.faq-answer li::marker { color: var(--c-accent); }

/* ── 13. Interactive Checkboxes ─────────────────────────────────────────── */
/*
 * markdown-it-checkbox renders:
 *   <li><input type="checkbox" id="cbx_N"><label for="cbx_N"></label><strong>…</strong> text <code>…</code></li>
 *
 * Strategy: absolutely-position the checkbox so the remaining text (strong, code, text nodes)
 * keeps its natural inline flow and doesn't become broken flex items.
 */

/* Remove bullet and indent on any <ul> that holds checkbox items */
.content-body ul:has(> li > input[type="checkbox"]) {
  list-style: none;
  padding-left: 0;
}

.content-body li:has(> input[type="checkbox"]) {
  list-style: none !important;
  position: relative;
  padding-left: 1.75rem;  /* room for the 18px checkbox + gap */
  margin-bottom: .55rem;
  line-height: 1.65;
}

/* Absolutely-position the checkbox in the left gutter */
.content-body li:has(> input[type="checkbox"]) > input[type="checkbox"] {
  position: absolute;
  left: 0;
  top: .22em;
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-bg);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition);
}
.content-body li:has(> input[type="checkbox"]) > input[type="checkbox"]:hover {
  border-color: var(--c-accent);
}
.content-body li:has(> input[type="checkbox"]) > input[type="checkbox"]:checked {
  background: var(--c-primary);
  border-color: var(--c-primary);
}
.content-body li:has(> input[type="checkbox"]) > input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 2px; left: 5px;
  width: 5px; height: 9px;
  border: 2px solid #FAF6F1;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* Hide the empty <label> generated by markdown-it-checkbox */
.content-body li:has(> input[type="checkbox"]) > label:empty {
  display: none;
}

/* Line-through on the whole <li> text when checked (JS adds .is-checked) */
.content-body li.is-checked {
  text-decoration: line-through;
  color: var(--c-text-light);
}
/* Ensure inline elements inside also get the muted colour */
.content-body li.is-checked strong,
.content-body li.is-checked code,
.content-body li.is-checked a {
  color: var(--c-text-light);
}

/* ── 14. Mermaid Diagrams ───────────────────────────────────────────────── */
.mermaid {
  background: var(--c-surface);
  border: 1px solid var(--c-code-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin: var(--space-lg) 0;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}
.mermaid svg { max-width: 100%; }

/* ── 15. Production Notes ───────────────────────────────────────────────── */
em:only-child,
p > em:first-child { /* Production Notes in italics */
  display: block;
  background: rgba(139,58,42,.06);
  border-left: 3px solid var(--c-accent);
  padding: .6rem .9rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: normal;
  font-size: .875rem;
  color: var(--c-text-muted);
  margin: -.5rem 0 var(--space-md);
}

/* ── 16. Footer ─────────────────────────────────────────────────────────── */
.site-footer {
  background: linear-gradient(135deg, #1E1008, #2C1810);
  color: rgba(250,246,241,.8);
  padding: var(--space-2xl) 0 var(--space-lg);
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr repeat(3, auto);
  gap: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid rgba(250,246,241,.1);
}

.footer-brand { max-width: 280px; }
.footer-brand p { font-size: .85rem; color: rgba(250,246,241,.55); line-height: 1.6; margin-top: var(--space-sm); }
.footer-logo { display: flex; align-items: center; gap: .5rem; text-decoration: none; }
.footer-logo svg { height: 30px; }
.footer-logo-text { font-size: .9rem; font-weight: 700; color: #FAF6F1; }

.footer-col h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--c-accent); margin: 0 0 .75rem; font-weight: 700; }
.footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.footer-col li { margin: 0; }
.footer-col a { font-size: .83rem; color: rgba(250,246,241,.65); text-decoration: none; transition: color var(--transition); }
.footer-col a:hover { color: var(--c-accent-light); }

.footer-bottom {
  padding-top: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  font-size: .78rem;
  color: rgba(250,246,241,.4);
}

/* ── 17. Section / Subsection Specific ─────────────────────────────────── */
.section-hero {
  background: linear-gradient(135deg, var(--c-surface) 0%, var(--c-bg) 100%);
  border-bottom: 2px solid var(--c-border-light);
  padding: var(--space-2xl) 0 var(--space-xl);
  margin-bottom: var(--space-xl);
}

.section-hero .content-wrap h1 { margin-top: 0; }

/* Article list in subsection/section */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
  margin: var(--space-xl) 0;
}

.article-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-decoration: none;
  color: var(--c-text);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.article-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--c-accent); color: var(--c-text); }
.article-card h3 { margin: 0 0 .5rem; font-size: 1rem; color: var(--c-primary); }
.article-card p  { margin: 0; font-size: .85rem; color: var(--c-text-muted); }

/* ── 18. Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --space-xl: 1.5rem; --space-2xl: 2rem; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --header-height: 56px; }

  .site-wrap { padding: 0 var(--space-md); }
  .content-wrap { padding: 0 var(--space-md); }
  .breadcrumb { padding: 0 var(--space-md); }

  .nav-toggle { display: flex; }

  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0; right: 0;
    background: #2C1810;
    border-top: 1px solid rgba(200,148,26,.2);
    padding: var(--space-md);
    flex-direction: column;
    align-items: stretch;
    gap: .25rem;
    box-shadow: var(--shadow-lg);
  }
  .site-nav.is-open { display: flex; }
  .nav-link { padding: .7rem 1rem; }

  .hero { padding: var(--space-2xl) 0; }
  .hero h1 { font-size: clamp(1.6rem, 8vw, 2.2rem); }
  .hero-ctas { flex-direction: column; align-items: flex-start; }

  .sections-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: var(--space-xl); }
  .footer-bottom { flex-direction: column; text-align: center; }
  .article-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .btn { padding: .7rem 1.1rem; font-size: .88rem; }
  pre[class*="language-"] { font-size: .8rem; }
}

/* ── 19. Utility ────────────────────────────────────────────────────────── */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.mt-0 { margin-top: 0 !important; }

/* Skip link */
.skip-link {
  position: absolute;
  top: -100vh;
  left: 1rem;
  background: var(--c-accent);
  color: #2C1810;
  padding: .6rem 1.2rem;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-weight: 700;
  text-decoration: none;
  z-index: 999;
  transition: top .1s;
}
.skip-link:focus { top: 0; }

