/* Self-hosted Google Fonts (variable, one file per subset covers every
   weight). Serving them from our own origin avoids a render-blocking
   third-party stylesheet and a second connection to fonts.gstatic.com.
   Latin covers French; latin-ext is only downloaded if a page uses one of
   its characters. The URLs must match the <link rel="preload"> in _Layout.
   /fonts/ is cached for a year (Program.cs): bump the version in the file
   name when replacing a font. */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/fonts/bricolage-grotesque-v9-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/fonts/bricolage-grotesque-v9-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Karla';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/karla-v33-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Karla';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/karla-v33-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #EEF5EC;
  --bg-raised: #FFFFFF;
  --ink: #1E2A1B;
  --ink-soft: #57684F;
  --line: rgba(30, 42, 27, .12);
  --orange: #E85E12;
  --orange-fill: #FF6B1A;
  --orange-soft: #FFE3CC;
  --green: #2F6B3C;
  --green-soft: #DCEEDD;
  --red: #C6392F;
  --red-soft: #FBDFDB;
  --gold: #C98A22;
  --gold-soft: #F6E4BE;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 3px rgba(30, 42, 27, .08);
  --ring-track: #C9D3C4;

  --trail-path-bed: rgba(255, 255, 255, .6);
  --trail-track: rgba(255, 255, 255, .92);
  --trail-checkpoint-bg: #FFFFFF;
  --trail-chip-bg: rgba(255, 255, 255, .82);
}

:root[data-theme="dark"] {
  --bg: #1B2417;
  --bg-raised: #26311F;
  --ink: #ECF1E6;
  --ink-soft: #9CAD93;
  --line: rgba(236, 241, 230, .14);
  --orange: #FF8A42;
  --orange-fill: #FF7D33;
  --orange-soft: #3D2716;
  --green: #6BBD79;
  --green-soft: #223A26;
  --red: #E76A62;
  --red-soft: #3D1C18;
  --gold: #F0B85A;
  --gold-soft: #3D2E12;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
  --ring-track: #3A4A34;

  --trail-path-bed: rgba(10, 16, 10, .45);
  --trail-track: rgba(255, 255, 255, .7);
  --trail-checkpoint-bg: #26311F;
  --trail-chip-bg: rgba(38, 49, 31, .82);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Karla', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img, svg { max-width: 100%; display: block; }

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

h1, h2, h3 {
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-weight: 800;
  line-height: 1.18;
  text-wrap: balance;
  margin: 0 0 .5em;
}

h1 { font-size: clamp(1.5rem, 4.5vw, 2.1rem); }
h3 { font-size: 1.05rem; font-weight: 700; }

p { margin: 0 0 1em; }
.muted { color: var(--ink-soft); }

a:focus-visible, button:focus-visible, input:focus-visible, .quiz-option:focus-within {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* ---------- header ---------- */
.site-header {
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header .container {
  padding-top: 14px;
  padding-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-start {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  color: var(--ink);
  flex: none;
}

.brand-text { display: flex; align-items: baseline; gap: 6px; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.site-nav::-webkit-scrollbar { display: none; }

.site-nav a {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: .85rem;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 8px 11px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  transition: background-color .12s ease, color .12s ease;
}

.site-nav a:hover { color: var(--ink); background: var(--line); }
.site-nav a.active { color: var(--green); background: var(--green-soft); }

.badge-new {
  display: inline-block;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: .6rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--orange-fill);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  margin-left: 4px;
  vertical-align: 2px;
  white-space: nowrap;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--bg-raised);
  color: var(--ink);
  cursor: pointer;
  flex: none;
}

.theme-toggle:hover { border-color: var(--ink-soft); }

.theme-toggle svg { width: 18px; height: 18px; display: block; }

.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------- hero + trajectory ---------- */
.hero { padding: 28px 0 6px; }

.kicker {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--green);
  margin: 0 0 10px;
}

.hero p.lead {
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.6;
}

.trajectory {
  position: relative;
  margin: 6px 0 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  background: var(--bg-raised) url('/img/hero-trail-day.webp') center / cover no-repeat;
  overflow: hidden;
  animation: trail-reveal .7s ease-out both;
}

:root[data-theme="dark"] .trajectory {
  background-image: url('/img/hero-trail-night.webp');
}

.traj-label {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  z-index: 2;
}

.traj-label span {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: .7rem;
  color: var(--ink-soft);
  background: var(--trail-chip-bg);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.trajectory svg { display: block; width: 100%; height: auto; }

/* On wide screens the full drawing would push the modules below the fold:
   keep its lower band, where the trail runs (preserveAspectRatio slice). */
@media (min-width: 700px) {
  .trajectory svg { aspect-ratio: 700 / 130; }
}

.hero-cta { margin: 18px 0 22px; }
.hero-cta .btn { font-size: .92rem; padding: 12px 20px; min-height: 44px; }

#traj-track, #traj-fill, .trail-checkpoints {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35));
}

#traj-fill {
  transition: stroke-dashoffset 1.3s cubic-bezier(.16, .84, .44, 1) .2s;
}

#traj-dot {
  transform-box: fill-box;
  transform-origin: center;
  transition: cx 1.3s cubic-bezier(.16, .84, .44, 1) .2s, cy 1.3s cubic-bezier(.16, .84, .44, 1) .2s;
  animation: trail-dot-pulse 2.4s ease-in-out infinite;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .28));
}

.traj-note {
  position: relative;
  z-index: 2;
  font-size: .8rem;
  color: #F4F7F2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .55);
  margin: 0;
  padding: 22px 18px 16px;
  background: linear-gradient(to top, rgba(10, 16, 10, .45), transparent);
}

@keyframes trail-reveal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes trail-dot-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* ---------- module cards ---------- */
.module-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0 8px;
  margin: 0;
  list-style: none;
}

.module-card {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 18px;
  background: var(--bg-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.module-card { align-items: flex-start; }
.module-card .badge-ring { flex: none; }
.module-card .body { flex: 1; min-width: 0; padding-top: 4px; }
.badge-ring.accent-gold { color: var(--gold); }
.badge-ring.accent-green { color: var(--green); }
.badge-ring.accent-orange { color: var(--orange); }

.module-kicker {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: .68rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin: 0 0 6px;
}
.module-kicker.accent-gold { color: var(--gold); }
.module-kicker.accent-green { color: var(--green); }
.module-kicker.accent-orange { color: var(--orange); }

.module-card h3 { margin: 0 0 6px; font-size: 1.02rem; }
.module-card p { font-size: .86rem; color: var(--ink-soft); margin: 0 0 14px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: .82rem;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  border: 1.5px solid var(--green);
  color: var(--green);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  background: transparent;
  cursor: pointer;
}

.btn.solid { background: var(--orange-fill); border-color: var(--orange-fill); color: #fff; }
.btn.done { background: var(--green-soft); border-color: var(--green-soft); color: var(--green); cursor: default; }
.btn:active { transform: translateY(1px); }
.btn.full { width: 100%; justify-content: center; font-size: .95rem; padding: 14px; }
/* .btn sets its own display: inline-flex, which otherwise beats the native
   [hidden] { display: none } UA rule at equal specificity and leaves the
   button visible; this restores hiding for buttons toggled via .hidden = true
   (exam pager prev/next/submit), and the flex exam trail hidden after grading. */
.btn[hidden],
.exam-progress[hidden] { display: none; }

.empty-state {
  padding: 20px;
  background: var(--bg-raised);
  border-radius: var(--radius-lg);
  color: var(--ink-soft);
  font-size: .9rem;
}

/* ---------- breadcrumb-style nav ---------- */
.crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--ink-soft);
  margin: 18px 0 4px;
  flex-wrap: wrap;
}

.crumb a { display: inline-block; padding: 5px 0; color: var(--ink-soft); text-decoration: none; font-weight: 600; }
.crumb a:hover { color: var(--green); }
.crumb .sep { opacity: .5; }
.crumb .current { color: var(--ink); font-weight: 700; }

/* On phones the H1 right below repeats the current page's (often long) name:
   show only the way back. The JSON-LD still lists the full trail. */
@media (max-width: 640px) {
  .crumb .current,
  .crumb .sep:nth-last-child(2) { display: none; }
}

/* ---------- module summary ---------- */
.callout {
  background: var(--orange-soft);
  color: #8A3E0C;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: .85rem;
  margin: 18px 0 30px;
}

:root[data-theme="dark"] .callout { color: #FFCFA8; }

/* Full container width, like the home page. */
.module-content { margin: 0 auto; }
.summary-section { margin: 0 0 34px; }
.summary-section p { font-size: 1.1rem; line-height: 1.75; }
.summary-section ul { margin: 0 0 1em; padding-left: 1.3em; }
.summary-section li { margin-bottom: .5em; font-size: 1.08rem; line-height: 1.6; }
.summary-section h2,
.summary-section h3 { font-size: 1.2rem; }

.faq-list, .glossary-list { margin: 0; }
.faq-item, .glossary-item {
  margin: 0 0 26px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.faq-item:last-child, .glossary-item:last-child { border-bottom: none; }
.faq-item dt, .glossary-item dt {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  margin: 0 0 .5em;
}
/* Clears the sticky header when opened from a link to /glossaire#term. */
.glossary-item { scroll-margin-top: 84px; }
.glossary-item:target dt { color: var(--green); }
.glossary-anchor { display: inline-block; padding: 2px 0; color: inherit; text-decoration: none; }
.glossary-anchor:hover { text-decoration: underline; }

/* A–Z index and search at the top of /glossaire */
.glossary-index {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 18px;
}
.glossary-index a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--bg-raised);
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  color: var(--green);
  text-decoration: none;
}
.glossary-index a:hover { border-color: var(--green); }

.glossary-search { margin: 0 0 26px; }
.glossary-search label {
  display: block;
  font-weight: 700;
  font-size: .9rem;
  margin: 0 0 6px;
}
.glossary-search input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg-raised);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
}
.glossary-search input:focus { outline: 2px solid var(--green); outline-offset: 1px; border-color: var(--green); }
.glossary-search-status { margin: 8px 0 0; font-size: .9rem; color: var(--ink-soft); }
.glossary-search-status:empty { display: none; }

.glossary-group { scroll-margin-top: 84px; }
.glossary-letter {
  font-size: 1.4rem;
  color: var(--green);
  margin: 8px 0 18px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--line);
}
.faq-item dd, .glossary-item dd {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.page-nav .spacer { flex: 1 1 auto; min-width: 8px; }

/* ---------- guides ---------- */
.guide-meta { font-size: .88rem; color: var(--ink-soft); margin: 0 0 6px; }
.guide-meta .sep { margin: 0 6px; opacity: .6; }
.guide-disclaimer { font-size: .8rem; color: var(--ink-soft); margin: 0 0 28px; }

.guide-body h2,
.guide h2 { font-size: 1.35rem; margin: 1.8em 0 .6em; }
.guide-body h3 { font-size: 1.12rem; margin: 1.4em 0 .5em; }
.guide-body p,
.guide-body li { font-size: 1.08rem; line-height: 1.75; }
.guide-body ul,
.guide-body ol { margin: 0 0 1em; padding-left: 1.3em; }
.guide-body li { margin-bottom: .45em; }
.guide-body a,
.guide-sources a,
.guide-related a { display: inline-block; padding: 3px 0; color: var(--green); font-weight: 600; text-underline-offset: 2px; }
.guide-body strong { color: var(--ink); }
/* Markdown tables have no wrapper: let them scroll sideways on phones. */
.guide-body table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 18px 0 24px;
  font-size: .95rem;
}
.guide-body th,
.guide-body td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  min-width: 140px;
}
.guide-body th { background: var(--bg-raised); font-weight: 700; }

.guide-cta {
  margin: 36px 0;
  padding: 20px 18px;
  background: var(--bg-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.guide-cta h2 { margin-top: 0; }
.guide-cta-label { font-weight: 700; margin-bottom: .4em; }
.guide-cta-modules { list-style: none; margin: 0 0 18px; padding: 0; }
.guide-cta-modules li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.guide-cta-modules a { color: var(--green); font-weight: 600; }
.guide-cta-modules .guide-cta-quiz { flex: none; color: var(--orange); }

.guide-related ul,
.guide-sources ul { margin: 0 0 1em; padding-left: 1.2em; }
.guide-related li,
.guide-sources li { margin-bottom: .7em; line-height: 1.5; }
.guide-related li .muted { display: block; font-size: .9rem; }
.guide-sources a { overflow-wrap: anywhere; }

.guide-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.guide-card {
  padding: 18px;
  background: var(--bg-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.home-careers { margin: 48px 0 0; }
.home-careers h2 { font-size: 1.35rem; margin: 0 0 8px; }
.home-careers > .muted { margin: 0 0 18px; }
.home-careers-all { margin: 14px 0 0; }
.home-careers-all a { color: var(--green); font-weight: 600; text-underline-offset: 2px; }

.guide-group { margin-bottom: 32px; }
.guide-group > h2 { font-size: 1.2rem; margin: 0 0 14px; scroll-margin-top: 84px; }
.guide-card h3 { font-size: 1.1rem; margin: 0 0 6px; }
.guide-card h3 a { display: inline-block; padding: 3px 0; color: var(--ink); text-decoration: none; }
.guide-card h3 a:hover { color: var(--green); text-decoration: underline; }
.guide-card p { margin: 0; color: var(--ink-soft); font-size: .95rem; }

/* Article layout: the breadcrumb lines up with the text column, and the
   table of contents becomes a sticky sidebar once there is room for it. */
.guide h1 { margin-bottom: 10px; }
.guide-body h2,
.guide section h2 { scroll-margin-top: 84px; }

/* The opening paragraph answers the question on its own. */
.guide-body > p:first-child {
  font-size: 1.16rem;
  line-height: 1.7;
  padding-left: 16px;
  border-left: 3px solid var(--green);
  color: var(--ink);
}

.guide-toc ol { margin: 0; padding-left: 1.3em; }
.guide-toc li { margin: 0 0 .2em; line-height: 1.4; }
.guide-toc a { display: inline-block; padding: 4px 0; color: var(--ink-soft); text-decoration: none; font-weight: 600; }
.guide-toc a:hover { color: var(--green); text-decoration: underline; }
.guide-toc-title,
.guide-toc summary {
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-weight: 700;
  font-size: .95rem;
  margin: 0 0 10px;
}
.guide-toc-inline {
  margin: 0 0 28px;
  padding: 12px 16px;
  background: var(--bg-raised);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.guide-toc-inline summary { margin: 0; padding: 4px 0; cursor: pointer; }
.guide-toc-inline[open] summary { margin-bottom: 10px; }
.guide-toc-inline li { font-size: .95rem; }
.guide-toc-side { display: none; }

@media (min-width: 1100px) {
  .guide-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    grid-template-areas: "crumb ." "article toc";
    column-gap: 56px;
  }
  .guide-layout .crumb { grid-area: crumb; margin-left: 0; margin-right: 0; }
  .guide-layout .guide { grid-area: article; }
  .guide-toc-side {
    display: block;
    grid-area: toc;
    align-self: start;
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding: 4px 0 4px 18px;
    border-left: 1px solid var(--line);
  }
  .guide-toc-side li { font-size: .9rem; }
  .guide-toc-inline { display: none; }
}

.guide-related .guide-related-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.guide-related .guide-related-list li {
  margin: 0;
  padding: 14px 16px;
  background: var(--bg-raised);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.guide-related-list a { display: block; margin-bottom: 4px; text-decoration: none; }
.guide-related-list a:hover { text-decoration: underline; }
.guide-related-list span { display: block; font-size: .9rem; color: var(--ink-soft); }
@media (min-width: 640px) {
  .guide-related-list { grid-template-columns: 1fr 1fr; }
}

/* ---------- glossary tooltips ---------- */
.gloss {
  text-decoration: underline dotted 2px var(--green);
  text-underline-offset: 3px;
  cursor: help;
  font-weight: 700;
}

.gloss:hover, .gloss:focus-visible { color: var(--green); }

.gloss-tip {
  position: absolute;
  z-index: 60;
  max-width: 280px;
  background: var(--ink);
  color: var(--bg);
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* ---------- diagrams ---------- */
.diagram-figure {
  margin: 18px 0;
  padding: 16px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.diagram-figure svg {
  display: block;
  width: 100%;
  /* Pages are full width now: keep diagrams at a readable size. */
  max-width: 760px;
  margin: 0 auto;
  height: auto;
  overflow: visible;
  font-family: 'Karla', sans-serif;
}
.diagram-figure figcaption {
  margin-top: 10px;
  font-size: .8rem;
  color: var(--ink-soft);
}

/* ---------- content tables ---------- */
.content-table-wrap {
  margin: 18px 0;
  padding: 16px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}
.content-table-caption {
  font-weight: 700;
  margin: 0 0 12px;
  font-size: 1rem;
}
.content-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: .92rem;
  table-layout: fixed;
}
.content-table th,
.content-table td {
  border: 1px solid var(--line);
  padding: 8px 14px;
  text-align: left;
  overflow-wrap: break-word;
}
.content-table th { font-weight: 700; }
.content-table-note {
  margin: 10px 0 0;
  font-size: .8rem;
  color: var(--ink-soft);
  white-space: normal;
}

/* ---------- quiz ---------- */
.quiz-meta { font-size: .9rem; color: var(--ink-soft); margin: 0 0 20px; }

.quiz-card {
  background: var(--bg-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 18px 22px;
  margin-bottom: 16px;
}

.quiz-eyebrow {
  display: inline-block;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--green);
  background: var(--green-soft);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 12px;
}

.quiz-card h3 { font-size: 1rem; margin: 0 0 14px; line-height: 1.45; }

.quiz-options { display: flex; flex-direction: column; gap: 9px; margin: 0; padding: 0; list-style: none; }

.quiz-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-raised);
  transition: border-color .12s ease;
}

.quiz-option:hover { border-color: var(--green); }

.quiz-option input {
  margin-top: 3px;
  accent-color: var(--green);
  width: 18px;
  height: 18px;
  flex: none;
}

.quiz-option b {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: .78rem;
  color: var(--ink-soft);
  flex: none;
}

.quiz-option.correct { border-color: var(--green); background: var(--green-soft); }
.quiz-option.wrong { border-color: var(--red); background: var(--red-soft); }

.quiz-feedback {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--orange-soft);
  border-radius: 12px;
  font-size: .85rem;
  font-weight: 600;
  color: #8A3E0C;
}

:root[data-theme="dark"] .quiz-feedback { color: #FFCFA8; }

.quiz-feedback.warn { background: var(--red-soft); color: #7A251C; }
:root[data-theme="dark"] .quiz-feedback.warn { color: #FFD4CE; }

.quiz-feedback .fb-badge {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: .68rem;
  color: #fff;
  background: var(--gold);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  flex: none;
  white-space: nowrap;
}

.quiz-feedback.warn .fb-badge { background: var(--red); }

.quiz-score {
  margin-top: 22px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--green-soft);
  color: var(--green);
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  text-align: center;
  font-size: 1rem;
}

/* ---------- exam pagination: a level-path trail (gamified stepper) ---------- */
.exam-progress {
  display: flex;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 0;
  margin: 0 0 22px;
  padding: 4px 2px 8px;
  outline: none;
  overflow-x: auto;
  scrollbar-width: none;
  /* .site-header is position: sticky, so a scrollIntoView(block: "start")
     would otherwise land the trail right under it, half-covered. */
  scroll-margin-top: 76px;
}

.exam-progress::-webkit-scrollbar { display: none; }

.exam-progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 2px 4px;
  border: none;
  background: none;
  color: var(--ink-soft);
  font-family: inherit;
  cursor: pointer;
}

.exam-step-node {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--bg-raised);
  color: var(--ink-soft);
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .15s ease;
}

.exam-progress-step:hover .exam-step-node { border-color: var(--green); }

.exam-step-index {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: .85rem;
}

.exam-step-check { display: none; width: 15px; height: 15px; }

.step-range {
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}

.step-connector {
  flex: 1 1 24px;
  min-width: 16px;
  height: 2px;
  margin-top: 17px;
  background: var(--line);
  transition: background .2s ease;
}

.step-connector.filled { background: var(--green); }

.exam-progress-step.done .exam-step-node {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.exam-progress-step.done .exam-step-index { display: none; }
.exam-progress-step.done .exam-step-check { display: block; }

.exam-progress-step.current .exam-step-node {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
  transform: scale(1.15);
  animation: step-pulse 1.8s ease-in-out infinite;
}

.exam-progress-step.current .step-range { color: var(--green); }

@keyframes step-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--green-soft); }
  50% { box-shadow: 0 0 0 5px transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .exam-progress-step.current .exam-step-node { animation: none; }
}

.exam-page-heading {
  margin: 0 0 16px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
}

@keyframes exam-page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.quiz-question.page-enter { animation: exam-page-in .25s ease both; }

@media (prefers-reduced-motion: reduce) {
  .quiz-question.page-enter { animation: none; }
}

.exam-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.exam-pager-status {
  flex: 1 1 auto;
  text-align: center;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

/* Fixed-position "page changed" badge: unlike the scroll-to-top cue, this
   stays inside the viewport no matter where the page is scrolled, so it
   reads as an unmistakable signal even on a tall mobile page where the
   scroll animation can take a while to bring the top back into view. */
.exam-page-toast {
  position: fixed;
  /* Clears the sticky .site-header (~67px tall) with a visible gap, so the
     toast reads as its own floating notification instead of blending into
     the nav row. */
  top: 84px;
  left: 50%;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  background: var(--green);
  color: #fff;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: .85rem;
  white-space: nowrap;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -14px);
  transition: opacity .2s ease, transform .2s ease;
}

.exam-page-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  .exam-page-toast { transition: opacity .2s ease; transform: translate(-50%, 0); }
}

@media (max-width: 560px) {
  /* Too narrow for prev/status/next on one line: keep Précédent and Suivant
     side by side and drop the status line above them instead of letting the
     flex row wrap the three items one under another. */
  .exam-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "status status" "prev next";
    gap: 8px 12px;
  }

  .exam-pager-status { grid-area: status; }
  #exam-prev { grid-area: prev; justify-self: start; }
  #exam-next { grid-area: next; justify-self: end; }
}

/* Results are revealed with scrollIntoView(block: "start"): clear the
   sticky header so the score itself stays visible. */
#exam-results { scroll-margin-top: 80px; }

.exam-score {
  margin-top: 22px;
  padding: clamp(18px, 2.4vw, 24px) clamp(20px, 3vw, 28px);
  border-radius: var(--radius-lg);
  background: var(--tier-soft);
}

.exam-score.tier-fail { --tier-color: var(--red); --tier-soft: var(--red-soft); }
.exam-score.tier-consolidate { --tier-color: var(--gold); --tier-soft: var(--gold-soft); }
.exam-score.tier-good { --tier-color: var(--green); --tier-soft: var(--green-soft); }
.exam-score.tier-perfect { --tier-color: var(--green); --tier-soft: var(--green-soft); }

.exam-score-top { display: flex; align-items: center; gap: 16px; }

.exam-score-percent {
  flex: none;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 1.6rem + 1.6vw, 2.6rem);
  line-height: 1;
  color: var(--tier-color);
}

.exam-score-percent span { font-size: .5em; font-weight: 700; }

.exam-score-copy { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.exam-score-flag {
  display: inline-block;
  width: fit-content;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: .68rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--tier-color);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.exam-score-title { margin: 0; font-size: clamp(1.05rem, .95rem + .4vw, 1.25rem); }

.exam-score-detail { margin: 16px 0 0; font-size: .85rem; font-weight: 600; color: var(--ink-soft); }

.exam-score-message { margin: 8px 0 0; font-size: .92rem; line-height: 1.55; }

/* ---------- challenge received from a shared score (?defi=) ---------- */
.exam-challenge,
.exam-challenge-result {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--orange-soft);
  font-size: .92rem;
}

.exam-challenge { margin: 0 0 16px; }
.exam-challenge-result { margin-top: 14px; background: var(--bg-raised); }

.exam-challenge-badge {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: .68rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--orange);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  flex: none;
}

.exam-challenge-result.won .exam-challenge-badge { background: var(--green); }
.exam-challenge-result.lost .exam-challenge-badge { background: var(--red); }

/* ---------- share the score (exam results + /partage landing) ---------- */
.exam-share {
  margin-top: 14px;
  padding: 16px clamp(20px, 3vw, 28px) 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  border: 1px solid var(--line);
}

.exam-share-title { margin: 0; font-size: 1rem; }
.exam-share-intro { margin: 4px 0 12px; font-size: .88rem; color: var(--ink-soft); }
.share-buttons { display: flex; flex-wrap: wrap; gap: 10px; }

.share-btn { gap: 8px; min-height: 44px; padding: 10px 18px; font-size: .88rem; }
.share-btn:hover { background: var(--green-soft); }
.share-btn.solid:hover { background: var(--orange); border-color: var(--orange); }

.share-btn svg {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.share-btn svg .fill { fill: currentColor; stroke: none; }

/* Facebook keeps its own blue so it reads at a glance. */
.share-facebook { background: #1877F2; border-color: #1877F2; color: #fff; }
.share-facebook:hover { background: #0F65D6; border-color: #0F65D6; }

.share-btn .icon-check { display: none; }
.share-btn.copied { background: var(--green); border-color: var(--green); color: #fff; }
.share-btn.copied .icon-link { display: none; }
.share-btn.copied .icon-check { display: block; }

@media (max-width: 560px) {
  .share-buttons { flex-direction: column; }
  .share-btn { width: 100%; justify-content: center; min-height: 48px; }
}

.exam-share-status { margin: 10px 0 0; font-size: .85rem; font-weight: 600; color: var(--green); }
.exam-share-status:empty { display: none; }
.exam-share-status.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.share-lede { max-width: 60ch; }

.share-card-img {
  display: block;
  width: 100%;
  max-width: 720px;
  height: auto;
  margin: 18px 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.share-cta { margin-top: 20px; }


/* ---------- modal ---------- */
.modal {
  border: none;
  padding: 0;
  background: transparent;
  width: min(94vw, 560px);
  border-radius: var(--radius-lg);
}

.modal::backdrop {
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(2px);
}

.modal-card {
  background: var(--bg-raised);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  padding: clamp(26px, 3vw, 36px) clamp(24px, 3vw, 34px);
}

.modal-card h2 { font-size: clamp(1.15rem, 1rem + .6vw, 1.5rem); margin: 0 0 16px; }

.modal-list {
  margin: 0 0 22px;
  padding-left: 1.2em;
  font-size: clamp(.9rem, .82rem + .3vw, 1.05rem);
  line-height: 1.6;
  color: var(--ink-soft);
}

.modal-list li { margin-bottom: 10px; }
.modal-list li:last-child { margin-bottom: 0; }
.modal-list b { color: var(--ink); }

.modal-note {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--green-soft);
  color: var(--ink);
  font-size: .92rem;
  line-height: 1.5;
}

.modal-secondary { margin-top: 10px; }

.modal-back {
  display: block;
  margin-top: 14px;
  padding: 8px;
  text-align: center;
  font-size: .9rem;
  color: var(--ink-soft);
}

.modal-back:hover { color: var(--green); }

/* ---------- exam picker (/questions-ccsmaf) ---------- */
.exam-hub-lede { max-width: 680px; margin: 0 0 18px; }

.exam-list { margin: 0 0 30px; }

/* Side by side on desktop: three short cards read better as a row
   than as full-width stripes (.module-list.exam-list beats the later
   .module-list desktop rule). */
@media (min-width: 960px) {
  .module-list.exam-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  .exam-list .exam-card .body { display: flex; flex-direction: column; height: 100%; }
  .exam-list .exam-card .btn-row { margin-top: auto; padding-top: 14px; }
}

/* Orange until taken (matches the "Commencer" button), then green or red. */
.exam-card { border-left: 4px solid var(--orange-fill); }
.exam-card.passed { border-left-color: var(--green); }
.exam-card.failed { border-left-color: var(--red); }

.exam-card.module-card p { margin-bottom: 6px; }
.exam-card .btn-row { margin-top: 14px; }
.module-card p.exam-card-status { font-weight: 700; color: var(--ink-soft); }
.exam-card.passed p.exam-card-status { color: var(--green); }
.exam-card.failed p.exam-card-status { color: var(--red); }

.exam-hub-rules { max-width: 680px; margin-top: 32px; }
.exam-hub-rules h2 { font-size: 1.2rem; }
.exam-hub-rules ul { margin: 0; padding-left: 1.3em; }
.exam-hub-rules li { margin-bottom: .5em; font-size: 1.02rem; line-height: 1.6; }

/* ---------- exam simulation ---------- */

#exam-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink);
}

.results-heading { margin: 28px 0 4px; font-size: 1.05rem; }

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

.result-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 14px;
    background: var(--bg-raised);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.result-ring { flex: none; }

.result-label { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }

.result-order {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: .7rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.result-title {
  font-size: .86rem;
  font-weight: 700;
  line-height: 1.3;
}

.ring-fill.tier-strong { stroke: var(--green); }
.ring-fill.tier-medium { stroke: var(--gold); }
.ring-fill.tier-weak { stroke: var(--red); }

/* ---------- error page ---------- */
.error-page { padding: 28px 0 6px; max-width: 560px; }
.error-page .btn-row { margin-top: 22px; }
.error-request-id { margin-top: 22px; font-size: .8rem; }
.error-request-id code { background: var(--line); padding: 2px 6px; border-radius: 6px; }
.error-page .summary-section { margin-top: 34px; }

/* ---------- TPTO / PROUVE trail ---------- */
.trail-page .diagram-figure svg { width: 100%; max-width: 760px; margin: 0 auto; }

/* On phones the drawings would be unreadable (or need a hidden sideways
   scroll), and the cards right below each one list the same steps in full. */
@media (max-width: 560px) {
  .trail-page .diagram-figure { display: none; }
}

.trail-intro { text-align: center; max-width: 560px; margin: 0 auto 8px; }
.trail-intro .eyebrow {
  display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--orange);
  background: var(--orange-soft); padding: 5px 12px; border-radius: var(--radius-pill); margin-bottom: 14px;
}

.trail-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 20px 16px;
  box-shadow: var(--shadow-sm);
  margin: 18px 0;
}
.trail-card .sec-label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--orange);
  margin-bottom: 12px;
}
.trail-card.prouve .sec-label { color: var(--green); }

.step-row { display: flex; align-items: flex-start; gap: 14px; padding: 12px 0; }
.step-row + .step-row { border-top: 1px dashed var(--line); }
.step-node {
  flex: none;
  width: 40px; height: 40px;
  border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  background: var(--orange-soft);
  color: var(--orange);
  border: 2px solid var(--orange);
}
.trail-card.prouve .step-node {
  background: var(--green-soft);
  color: var(--green);
  border-color: var(--green);
}
.step-node.wide { font-size: .82rem; }
.step-text b { display: block; font-size: .98rem; margin-bottom: 2px; }
.step-text p { margin: 0; font-size: .9rem; color: var(--ink-soft); line-height: 1.5; }

.trail-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0 2px;
  color: var(--ink-soft);
  font-size: .82rem;
  text-align: center;
}
.trail-link svg { width: 16px; height: 26px; color: var(--ink-soft); }

.exam-note {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-left: 4px solid var(--orange);
  border-radius: var(--radius-lg);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow-sm);
  margin: 18px 0;
}
.exam-note-title {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 1.05rem;
  color: var(--ink); margin: 0 0 8px;
}
.exam-note-title svg { width: 20px; height: 20px; color: var(--orange); flex: none; }
.exam-note-lead { margin: 0 0 16px; font-size: .92rem; color: var(--ink-soft); line-height: 1.55; }
.exam-note-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.exam-note-item { border-radius: var(--radius-md); padding: 12px 14px; }
.exam-note-item.theory { background: var(--orange-soft); }
.exam-note-item.practice { background: var(--green-soft); }
.exam-note-tag {
  display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; margin-bottom: 6px;
}
.exam-note-item.theory .exam-note-tag { color: var(--orange); }
.exam-note-item.practice .exam-note-tag { color: var(--green); }
.exam-note-item p { margin: 0; font-size: .88rem; color: var(--ink); line-height: 1.5; }

@media (max-width: 560px) {
  .exam-note-grid { grid-template-columns: 1fr; }
}

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0; }
.site-footer p { font-size: .78rem; color: var(--ink-soft); margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
/* min-height: comfortable touch targets (WCAG 2.2 asks for 24px at least). */
.footer-links a { display: inline-flex; align-items: center; min-height: 32px; font-size: .8rem; color: var(--ink-soft); font-weight: 600; text-decoration: none; }
.footer-links a.active { color: var(--green); }
.footer-links a:hover { color: var(--green); }


@media (min-width: 1040px) {
  .container { max-width: 1040px; }

  .crumb,
  .hero,
  .trajectory,
  h1,
  .quiz-meta,
  .callout,
  .summary-section,
  .quiz-card,
  #quiz-form,
  #exam-form,
  .exam-progress,
  .quiz-score,
  .exam-score,
  .page-nav,
  .empty-state {
    
    margin-left: auto;
    margin-right: auto;
  }

  .module-list {
    max-width: 1040px;
    margin: 0 auto;
    gap: 16px;
  }
}

@media (min-width: 1400px) {
  .container { max-width: 1240px; }

  .module-list {
    max-width: 1240px;
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 760px) {
  /* Two rows: brand + theme toggle on top, nav full width underneath.
     display: contents lets the brand and nav join the container's flex
     flow so the nav can wrap below the toggle.
     The negative sticky top (padding + 38px toggle) lets the brand
     row scroll away with the page while the nav row stays pinned. */
  .site-header { top: -48px; }
  .site-header .container { flex-wrap: wrap; row-gap: 8px; padding-top: 10px; padding-bottom: 8px; }
  .header-start { display: contents; }
  .site-nav { order: 3; flex: 1 0 100%; }
  .site-nav a { flex: 1 1 auto; text-align: center; padding: 8px 10px; font-size: .8rem; }
  .exam-page-toast { top: 124px; }
  /* Only the nav row (~52px) stays pinned once the brand row scrolls away. */
  #exam-results { scroll-margin-top: 64px; }
}

/* The four nav links must all fit without scrolling: the nav hides its
   scrollbar, so an overflowing "Guides" is simply invisible. */
@media (max-width: 480px) {
  .site-nav { gap: 0; }
  .site-nav a { padding: 8px 6px; }
  .badge-new { font-size: 0; padding: 0; width: 7px; height: 7px; border-radius: 50%; vertical-align: middle; }
}

@media (max-width: 400px) {
  .site-nav a { padding: 8px 4px; font-size: .72rem; }
}

@media (max-width: 340px) {
  .site-nav a { padding: 8px 2px; font-size: .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
