:root {
  --paper: #faf5ed;
  --paper-deep: #f2ecdf;
  --paper-edge: #e8e0d0;
  --ink: #2d3428;
  --ink-soft: #5a6151;
  --ink-faint: #6e7165;
  --terracotta: #cc785c;
  --terracotta-soft: #e0a98c;
  --terracotta-text: #ae5436;
  --purple: #4a3d7a;
  --purple-soft: #eee9f8;
  --moss: #4a5c28;
  --moss-soft: #e8eddc;
  --danger: #8b3a2f;
  --danger-soft: #f6e4de;
  --rule: rgba(45, 52, 40, 0.13);
  --rule-strong: rgba(45, 52, 40, 0.25);
  --shadow: 0 18px 50px rgba(45, 52, 40, 0.08);
  --gutter: clamp(1.1rem, 4vw, 3.5rem);
  --serif: "DM Serif Display", Georgia, serif;
  --sans: "Outfit", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius-sm: 6px;
  --radius: 14px;
  --radius-lg: 24px;
  /* Compatibility aliases for the preserved LearningHub pages. */
  --bg: var(--paper);
  --muted: var(--ink-faint);
  --card: var(--paper-deep);
  --border: var(--rule);
  --accent: var(--terracotta-text);
  --text: var(--ink);
  --brand: var(--moss);
}

:root[data-theme="dark"] {
  --paper: #1c1815;
  --paper-deep: #252119;
  --paper-edge: #322d24;
  --ink: #ece4d2;
  --ink-soft: #b8af9d;
  --ink-faint: #938a78;
  --terracotta: #d88a6e;
  --terracotta-soft: #7d4d3e;
  --terracotta-text: #e29b82;
  --purple: #a897df;
  --purple-soft: #2d2740;
  --moss: #a9bd78;
  --moss-soft: #2c3420;
  --danger: #ef9e8e;
  --danger-soft: #3a2421;
  --rule: rgba(236, 228, 210, 0.12);
  --rule-strong: rgba(236, 228, 210, 0.24);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

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

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse 900px 650px at 9% 5%, rgba(204, 120, 92, 0.07), transparent 62%),
    radial-gradient(ellipse 800px 600px at 95% 55%, rgba(74, 61, 122, 0.045), transparent 65%),
    var(--paper);
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 300;
  line-height: 1.65;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--terracotta-text); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
img, canvas { display: block; max-width: 100%; }

h1, h2, h3, h4, p, ul, ol, dl, blockquote { margin-top: 0; }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }

h1, h2 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.012em;
}

h1 { font-size: clamp(2.5rem, 7vw, 5.4rem); line-height: 0.98; }
h2 { font-size: clamp(1.75rem, 4vw, 2.7rem); line-height: 1.08; }
h3 { font-size: 1.08rem; line-height: 1.3; }

.page-shell {
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1000;
  transform: translateY(-200%);
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  color: var(--paper);
  background: var(--ink);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 1px solid var(--rule);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  border: 1px solid var(--ink-soft);
  border-radius: 50%;
  background: var(--paper-deep);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.brand-mark::before {
  width: 13px;
  height: 13px;
  top: 7px;
  left: 5px;
  border: 1px solid var(--terracotta);
  box-shadow: inset 0 0 0 3px var(--paper-deep), inset 0 0 0 4px var(--terracotta);
}

.brand-mark::after {
  width: 3px;
  height: 3px;
  top: 9px;
  right: 7px;
  background: var(--purple);
  box-shadow: 4px -4px 0 -1px var(--purple), 5px 2px 0 -1px var(--purple), 1px 6px 0 -1px var(--purple);
}

.brand-mark span {
  width: 17px;
  height: 8px;
  left: 8px;
  bottom: 5px;
  border-bottom: 1px solid var(--moss);
}

.brand-wordmark { font-size: 1.05rem; letter-spacing: -0.02em; }
.brand-wordmark span { font-weight: 300; }
.brand-wordmark strong { font-weight: 700; }
.brand-division {
  margin-left: 0.1rem;
  padding-left: 0.8rem;
  border-left: 1px solid var(--rule-strong);
  color: var(--ink-faint);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-actions,
.main-nav { display: flex; align-items: center; }
.header-actions { gap: 1rem; }
.main-nav { gap: clamp(0.8rem, 2vw, 1.5rem); }
.main-nav a {
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 500;
  text-decoration: none;
}
.main-nav a:hover { color: var(--terracotta-text); }

.theme-toggle {
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--paper-deep); }
.theme-toggle .theme-light { display: block; }
.theme-toggle .theme-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-light { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-dark { display: block; }

main { min-height: 70vh; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  color: var(--terracotta-text);
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 2rem; border-top: 1px solid var(--terracotta); }

.lead {
  max-width: 70ch;
  color: var(--ink-soft);
  font-size: clamp(1.04rem, 2vw, 1.22rem);
  line-height: 1.6;
}

.muted { color: var(--ink-faint); }

.section-kicker {
  color: var(--ink-faint);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: end;
  margin-bottom: 1.5rem;
}
.section-heading p { max-width: 58ch; margin-bottom: 0.2rem; color: var(--ink-soft); }

.card {
  padding: clamp(1.1rem, 2.5vw, 1.65rem);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--paper-deep) 50%, transparent);
}

a.card {
  display: block;
  color: var(--ink);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
a.card:hover { transform: translateY(-3px); border-color: var(--terracotta); box-shadow: var(--shadow); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }

.chip,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0.18rem 0.58rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--paper);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.status-pill.active { color: var(--moss); border-color: color-mix(in srgb, var(--moss) 42%, transparent); background: var(--moss-soft); }
.status-pill.next { color: var(--purple); border-color: color-mix(in srgb, var(--purple) 35%, transparent); background: var(--purple-soft); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--paper);
  background: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { color: var(--paper); opacity: 0.9; text-decoration: none; }
.btn-secondary { color: var(--ink); background: transparent; border-color: var(--rule-strong); }
.btn-secondary:hover { color: var(--ink); background: var(--paper-deep); }
.btn-success { border-color: var(--moss); background: var(--moss); }
.btn-danger { border-color: var(--danger); background: var(--danger); }
.btn:disabled { cursor: not-allowed; opacity: 0.45; }

.prose { max-width: 76ch; }
.prose p { margin-bottom: 1.15rem; }
.prose strong { font-weight: 600; }
.prose blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--terracotta);
  background: color-mix(in srgb, var(--paper-deep) 65%, transparent);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-top: clamp(4rem, 10vw, 8rem);
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-faint);
  font-size: 0.78rem;
}
.site-footer p { margin: 0.25rem 0 0; }
.footer-mark { color: var(--ink); font-size: 0.98rem; }
.footer-mark span { font-weight: 300; }
.footer-mark strong { font-weight: 700; }
.footer-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; text-align: right; }

.fc-card { padding: 1rem; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--paper); }
.fc-question { font-size: 1.15rem; font-weight: 500; }
.fc-answer { color: var(--ink-soft); }
.fc-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.fc-meta { margin-left: auto; color: var(--ink-faint); }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--terracotta) 72%, transparent); outline-offset: 3px; }

@media (max-width: 900px) {
  .site-header { align-items: flex-start; padding: 1rem 0; }
  .header-actions { align-items: flex-end; }
  .main-nav { flex-wrap: wrap; justify-content: flex-end; }
  .brand-division { display: none; }
}

@media (max-width: 680px) {
  body { font-size: 16px; }
  .site-header { flex-direction: column; gap: 0.8rem; }
  .header-actions { width: 100%; justify-content: space-between; align-items: center; }
  .main-nav { justify-content: flex-start; gap: 0.9rem; overflow-x: auto; padding-bottom: 0.25rem; }
  .main-nav a { white-space: nowrap; }
  .section-heading, .site-footer { flex-direction: column; align-items: flex-start; }
  .footer-meta { align-items: flex-start; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media print {
  :root, :root[data-theme="dark"] {
    --paper: #fff;
    --paper-deep: #fff;
    --paper-edge: #ddd;
    --ink: #000;
    --ink-soft: #222;
    --ink-faint: #555;
    --rule: rgba(0, 0, 0, 0.2);
  }
  body { background: #fff; font-size: 11pt; }
  .site-header, .site-footer, .theme-toggle, .no-print { display: none !important; }
  .page-shell { width: 100%; padding: 0; }
  a { color: #000; text-decoration: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; }
}
