/* Shared styles for every page. Page-specific rules live in each page's
   <style id="page-css"> block, which nav.js swaps on client-side navigation. */
:root {
  --bg: #E4E5E7;
  --surface: #EDEEF0;
  --ink: #131416;
  --muted: #4D5157;
  --line: #BCC0C6;
  --accent: #C2571A;
  --accent-text: #93400C;
  --error: #A3322B;
  --max: 1180px;
  --pad: clamp(18px, 4.5vw, 56px);
  --font-display: 'Big Shoulders Display', 'Arial Narrow', Impact, sans-serif;
  --font-body: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --space-open: clamp(56px, 8vw, 112px);
  --space-tight: clamp(40px, 5vw, 72px);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: 17px; line-height: 1.55;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 3px;
}
@media (prefers-reduced-motion: no-preference) {
  a, button { transition: color .15s, background-color .15s, border-color .15s; }
}

/* Display face: short labels, numerals and buttons shared across pages. Never sentences. */
.nav-brand, .section-label, .page-header-label, .resource-label, .sec-heading,
.btn, .kpi-num, .kpi-num-sm, #cpBtn, .footer-brand-name {
  font-family: var(--font-display);
  text-transform: uppercase;
}

/* Subpage header */
.page-header { padding: clamp(48px, 7vw, 96px) 0 clamp(40px, 5vw, 72px); border-bottom: 1px solid var(--line); }
.page-header-label, .resource-label { font-size: 22px; font-weight: 800; letter-spacing: .02em; line-height: 1.1; margin: 0 0 clamp(18px, 2.4vw, 28px); }
.page-header-label .slash, .resource-label .slash { color: var(--accent); }
.page-header h1 {
  font-size: clamp(36px, 5vw, 68px); font-weight: 650; font-stretch: 85%;
  line-height: 1.02; letter-spacing: -.025em; margin: 0 0 clamp(18px, 2.4vw, 28px);
  max-width: 22ch; text-wrap: balance;
}
.page-header h1 em { font-style: normal; }
.page-header .sub, .page-header .subhead {
  font-size: clamp(18px, 1.8vw, 21px); font-weight: 500; font-stretch: 92%; line-height: 1.45;
  color: var(--muted); max-width: 52ch; margin: 0 0 28px;
}
.page-header .sub strong, .page-header .subhead strong { color: var(--ink); font-weight: 700; }

/* Tag rows: plain text separated by space, not pills */
.meta-row { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 0 28px; }
.chip { font-size: 15px; font-weight: 600; line-height: 1.3; }

/* Buttons: primary is solid ink, secondary is an ink outline. Square. */
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 18px; font-weight: 800; letter-spacing: .05em; line-height: 1;
  padding: 13px 20px 12px; border: 1px solid var(--ink); background: transparent; color: var(--ink);
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--ink); color: var(--bg); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover { background: var(--accent-text); border-color: var(--accent-text); }

/* Section headings without a slash (the copy never had one) */
.sec-heading { font-size: 26px; font-weight: 800; letter-spacing: .02em; line-height: 1; margin: 0 0 clamp(24px, 3.5vw, 40px); }

/* Stat ledger: number | label, ruled rows */
.kpi-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: clamp(20px, 3.5vw, 48px); margin: 0 0 20px; }
.kpi-item { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: baseline; padding: 14px 0; border-top: 1px solid var(--line); }
.kpi-item:last-child { border-bottom: 1px solid var(--line); }
.kpi-num { font-size: clamp(56px, 7vw, 96px); font-weight: 900; line-height: .85; font-variant-numeric: tabular-nums; }
.kpi-item:first-child .kpi-num { color: var(--accent-text); }
.kpi-num-sm { font-size: clamp(32px, 3.6vw, 48px); font-weight: 900; line-height: .95; }
.kpi-label { font-size: 17px; font-weight: 550; font-stretch: 92%; line-height: 1.4; }
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi-item { grid-template-columns: minmax(0, 1fr); row-gap: 8px; }
}

/* Lists */
.bullets { margin: 0; padding-left: 1.1em; color: var(--muted); }
.bullets li { margin: 6px 0; padding-left: 2px; }
.bullets li::marker { color: var(--ink); }
.bullets a { color: var(--ink); border-bottom: 1px solid var(--ink); }
.bullets a:hover { color: var(--accent-text); border-bottom-color: var(--accent-text); }

/* Section labels: the slash survives, without mono or a colored square */
.section-label {
  font-size: 26px; font-weight: 800; letter-spacing: .02em; line-height: 1;
  margin: 0;
}
.section-label .slash { color: var(--accent); }


/* Nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--pad);
  display: flex; align-items: center; justify-content: space-between;
  height: 62px;
}
.nav-brand { font-size: 22px; font-weight: 800; letter-spacing: .02em; }
.nav-brand em { font-style: normal; }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { font-size: 15px; font-weight: 500; color: var(--muted); }
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-links .nav-cta { color: var(--accent-text); font-weight: 700; }
.nav-links .nav-cta:hover { color: var(--ink); }
.nav-menu-btn {
  display: none; background: none; border: 1px solid var(--ink);
  padding: 8px 12px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--ink);
  font-family: var(--font-body);
}
.nav-mobile { display: none; background: var(--bg); border-top: 1px solid var(--line); }
.nav-mobile.open { display: block; }
.nav-mobile a {
  display: block; padding: 15px var(--pad);
  font-size: 16px; font-weight: 500; color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.nav-mobile .nav-cta { color: var(--accent-text); font-weight: 700; }
@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-menu-btn { display: block; }
}


/* Footer */
footer { border-top: 1px solid var(--line); }
.footer-main { padding: var(--space-tight) 0 40px; }
.footer-main-inner { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); display: grid; grid-template-columns: 1.4fr .8fr .8fr; gap: 48px; }
@media (max-width: 640px) { .footer-main-inner { grid-template-columns: 1fr; gap: 32px; } }
.footer-brand-name { font-size: 24px; font-weight: 800; letter-spacing: .02em; margin: 0 0 8px; }
.footer-brand-name em { font-style: normal; }
.footer-tagline { font-size: 15px; color: var(--muted); margin: 0 0 22px; max-width: 280px; }
.footer-tagline strong { font-weight: 700; color: var(--ink); }
.footer-icons { display: flex; gap: 8px; }
.footer-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--ink); color: var(--ink); }
.footer-icon:hover { background: var(--ink); color: var(--bg); }
.footer-icon svg { width: 15px; height: 15px; }
.footer-col-title { font-size: 14px; font-weight: 700; margin: 0 0 14px; }
.footer-col-links { display: flex; flex-direction: column; gap: 10px; list-style: none; padding: 0; margin: 0; }
.footer-col-links a { font-size: 15px; color: var(--muted); }
.footer-col-links a:hover { color: var(--ink); }
.footer-bottom { border-top: 1px solid var(--line); }
.footer-bottom-inner { max-width: var(--max); margin: 0 auto; padding: 18px var(--pad); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.footer-copy { font-size: 14px; color: var(--muted); }
.footer-back-top { font: inherit; font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; background: none; border: none; padding: 0; }
.footer-back-top:hover { color: var(--ink); }
.footer-back-top svg { width: 11px; height: 11px; }


/* Ask Merlin: restrained, square, no glow */
#cpBtn {
  position: fixed; bottom: 24px; right: 24px; z-index: 1000;
  background: var(--ink); color: var(--bg); border: none; border-radius: 0;
  padding: 13px 20px 12px; cursor: pointer;
  font-size: 18px; font-weight: 800; letter-spacing: .05em; line-height: 1;
}
#cpBtn:hover { background: var(--accent-text); }
@media (max-width: 640px) { #cpBtn { bottom: 16px; right: 16px; font-size: 16px; padding: 11px 16px 10px; } #cpPane { right: 16px; bottom: 64px; } }
#cpPane {
  display: none; position: fixed; bottom: 76px; right: 24px;
  z-index: 999; width: min(380px, calc(100vw - 40px));
  border: 1px solid var(--ink); background: var(--surface); color: var(--ink);
  flex-direction: column; overflow: hidden;
}
.cp-header-l {
  padding: 16px 18px 14px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; justify-content: space-between;
}
.cp-title { font-family: var(--font-display); text-transform: uppercase; font-weight: 800; font-size: 20px; letter-spacing: .03em; line-height: 1; margin: 0 0 4px; }
.cp-sub { font-size: 13px; color: var(--muted); margin: 0; }
.cp-close-btn { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; padding: 2px 4px; }
.cp-close-btn:hover { color: var(--ink); }
#cpMessages { padding: 14px 16px; max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.55; }
#cpMessages::-webkit-scrollbar { width: 4px; }
#cpMessages::-webkit-scrollbar-thumb { background: var(--line); }
.cm { display: flex; gap: 8px; align-items: flex-start; max-width: 88%; }
.cm.user { align-self: flex-end; flex-direction: row-reverse; }
.cm.assistant { align-self: flex-start; }
.cm-av { width: 24px; height: 24px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; }
.cm.assistant .cm-av { background: var(--ink); color: var(--bg); }
.cm.user .cm-av { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.cm-bubble { padding: 9px 12px; font-size: 14px; line-height: 1.55; }
.cm.assistant .cm-bubble { background: var(--bg); color: var(--ink); }
.cm.user .cm-bubble { background: var(--ink); color: var(--bg); }
.cp-typing { display: flex; gap: 4px; padding: 11px 12px; background: var(--bg); width: fit-content; }
.cp-typing span { width: 5px; height: 5px; background: var(--muted); opacity: .6; }
@media (prefers-reduced-motion: no-preference) {
  .cp-typing span { animation: cpbounce 1.2s infinite; }
  .cp-typing span:nth-child(2) { animation-delay: .2s; }
  .cp-typing span:nth-child(3) { animation-delay: .4s; }
}
@keyframes cpbounce { 0%,60%,100% { opacity: .35; } 30% { opacity: 1; } }
#cpSuggested { padding: 0 12px 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.cp-sq { padding: 6px 10px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.cp-sq:hover { border-color: var(--ink); }
.cp-input-row { padding: 10px 14px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-end; }
.cp-input {
  flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: 0; background: var(--bg);
  color: var(--ink); font: inherit; font-size: 14px;
  resize: none; line-height: 1.5; min-height: 38px; max-height: 100px;
}
.cp-input:focus { border-color: var(--ink); }
.cp-input::placeholder { color: var(--muted); }
.cp-send { width: 38px; height: 38px; background: var(--ink); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cp-send:hover { background: var(--accent-text); }
.cp-send:disabled { opacity: .35; cursor: not-allowed; }
.cp-send svg { width: 14px; height: 14px; }
.cp-footer-l { padding: 0 14px 10px; font-size: 12px; color: var(--muted); text-align: center; }
.cp-footer-l a { color: var(--muted); }
