/* MaturityModel.io — "The Report" design system.
   Shared by every page: tokens, type, header, footer, homepage index, hubs, prose pages and 404.
   Assessment-specific styles live in assess.css. */

@font-face {
    font-family: 'Source Serif 4';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url('/fonts/source-serif-4.woff2') format('woff2');
}

@font-face {
    font-family: 'Source Serif 4';
    font-style: italic;
    font-weight: 400 600;
    font-display: swap;
    src: url('/fonts/source-serif-4-italic.woff2') format('woff2');
}

/* ---------- Tokens ---------- */
:root {
    --paper: #F6F3EC;
    --paper-2: #EDE8DD;
    --card: #FFFFFF;
    --ink: #1B1E24;
    --muted: #5B5F68;
    --rule: #DCD6CA;
    --rule-strong: #1B1E24;
    --accent: #1F3A5F;
    --accent-ink: #FFFFFF;
    --accent-tint: #E7ECF2;
    --focus: #8A2E2A;
    --bar-track: #E3DDD1;

    --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

    --page: 1200px;
    --gutter: 2rem;
    --measure: 68ch;
    color-scheme: light;
}

html[data-theme="dark"] {
    --paper: #14161A;
    --paper-2: #1A1D22;
    --card: #1B1E24;
    --ink: #ECE8DF;
    --muted: #A9ABB0;
    --rule: #2F3540;
    --rule-strong: #ECE8DF;
    --accent: #9DB8D9;
    --accent-ink: #14161A;
    --accent-tint: #25303F;
    --focus: #E08C82;
    --bar-track: #2A2F38;
    color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

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

body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--focus); }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

img, svg { display: block; }

[hidden] { display: none !important; }

.container {
    max-width: calc(var(--page) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.serif { font-family: var(--serif); }

.eyebrow {
    font: 600 11px/1.3 var(--sans);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--focus);
}

.label {
    font: 600 11px/1.3 var(--sans);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.num { font-variant-numeric: lining-nums tabular-nums; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute;
    left: 1rem; top: -3rem;
    background: var(--accent); color: var(--accent-ink);
    padding: 0.5rem 0.9rem; border-radius: 4px; z-index: 200;
    text-decoration: none;
}
.skip-link:focus { top: 0.75rem; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 0.95rem;
    font: 500 14px/1.2 var(--sans);
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.is-done { border-color: var(--accent); color: var(--accent); background: var(--accent-tint); }

/* ---------- Header ---------- */
.site-header {
    border-bottom: 1px solid var(--rule);
    background: var(--paper);
    position: sticky; top: 0; z-index: 100;
}

.site-header .container {
    display: flex; align-items: center; gap: 1.5rem;
    min-height: 64px;
}

.logo {
    display: inline-flex; align-items: center; gap: 0.6rem;
    color: var(--ink); text-decoration: none;
    font: 600 19px/1 var(--serif);
    flex-shrink: 0;
}
.logo:hover { color: var(--ink); }
.logo-icon { color: var(--ink); }

.site-nav {
    margin-left: auto;
    display: flex; align-items: center; gap: 1.6rem;
}
.site-nav a {
    color: var(--ink); text-decoration: none;
    font-size: 14px;
}
.site-nav a:hover { color: var(--focus); }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--focus); }

.theme-toggle {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    font-size: 13px;
    background: transparent;
    border: 1px solid var(--rule);
    border-radius: 4px;
    cursor: pointer;
    color: var(--ink);
}
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle svg { width: 13px; height: 13px; }

/* Assessment header variant: breadcrumb and actions instead of nav */
.header-crumbs {
    font-size: 13px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 0;
}
.header-crumbs a { color: var(--muted); text-decoration: none; }
.header-crumbs a:hover { color: var(--focus); }
.header-crumbs .sep { margin: 0 0.35rem; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; }

/* ---------- Breadcrumb (hub/content pages) ---------- */
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 2rem; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--focus); }
.breadcrumb-sep { margin: 0 0.35rem; }

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--rule);
    padding: 3rem 0 2.5rem;
    font-size: 14px;
    color: var(--muted);
}
.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 2.5rem;
    margin-bottom: 2.5rem;
}
.footer-col { display: flex; flex-direction: column; gap: 0.35rem; }
.footer-col a { color: var(--ink); text-decoration: none; }
.footer-col a:hover { color: var(--focus); }
.footer-brand p { max-width: 34ch; margin-top: 0.5rem; }
.footer-logo { font: 600 18px/1.2 var(--serif); color: var(--ink) !important; }
.footer-heading { font: 600 11px/1.3 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.4rem; }
.footer-copy { border-top: 1px solid var(--rule); padding-top: 1.5rem; font-size: 13px; }

/* Back to top */
.back-to-top {
    position: fixed; right: 1.5rem; bottom: 1.5rem;
    width: 2.5rem; height: 2.5rem;
    display: flex; align-items: center; justify-content: center;
    background: var(--paper); color: var(--ink);
    border: 1px solid var(--rule); border-radius: 50%;
    cursor: pointer;
    opacity: 0; visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 50;
}
.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { border-color: var(--ink); }

/* ---------- Homepage ---------- */
.home-hero { padding: 4.5rem 0 4rem; border-bottom: 1px solid var(--rule); }
.home-hero .container { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 4rem; align-items: center; }
.home-hero h1 {
    font: 400 64px/1.04 var(--serif);
    letter-spacing: -0.015em;
    margin: 1.1rem 0 1.4rem;
    text-wrap: balance;
}
.home-hero .lede {
    font: 400 20px/1.55 var(--serif);
    color: var(--ink);
    max-width: 30ch;
    margin-bottom: 2rem;
}

.search {
    position: relative;
    max-width: 560px;
    border-bottom: 2px solid var(--ink);
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.55rem 0;
}
.search svg { flex-shrink: 0; color: var(--ink); }
.search input {
    flex: 1; min-width: 0;
    background: transparent; border: 0; outline: none;
    font-size: 17px; color: var(--ink);
    -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search:focus-within { border-bottom-color: var(--accent); }
.search kbd, .search-clear {
    font: 12px/1 var(--mono);
    color: var(--muted);
    border: 1px solid var(--rule);
    border-radius: 3px;
    padding: 3px 6px;
    background: transparent;
}
.search-clear { cursor: pointer; font-family: var(--sans); font-size: 13px; }

.sample-question {
    background: var(--card);
    border: 1px solid var(--rule);
    padding: 1.6rem 1.75rem 1.4rem;
}
.sample-question h2 { font: 600 21px/1.3 var(--serif); margin-bottom: 1rem; }
.sample-question figcaption { font-size: 13px; color: var(--muted); margin-top: 1rem; line-height: 1.5; }

/* Answer rows (shared by the homepage sample and the assessment) */
.answer-box { border: 1px solid var(--rule); background: var(--card); }
.answer-row {
    display: grid; grid-template-columns: 22px 1fr; gap: 0.85rem;
    padding: 0.9rem 1.1rem;
    border-top: 1px solid var(--rule);
    position: relative;
}
.answer-row:first-child { border-top: 0; }
.answer-row .marker {
    width: 18px; height: 18px; margin-top: 2px;
    border: 1.5px solid var(--muted);
    border-radius: 50%;
    background: var(--card);
}
.answer-row .level-name {
    display: block;
    font: 600 11px/1.3 var(--sans);
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.2rem;
}
.answer-row .answer-text { display: block; font-size: 15px; line-height: 1.5; color: var(--ink); }
.answer-row.is-selected { background: var(--accent-tint); box-shadow: inset 0 0 0 1.5px var(--accent); }
.answer-row.is-selected .marker { border-color: var(--accent); border-width: 5px; }
.answer-row.is-selected .level-name { color: var(--accent); }

/* The index */
.index-section { padding: 4rem 0 4.5rem; }
.index-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
    padding-bottom: 0.9rem;
    border-bottom: 2px solid var(--rule-strong);
    margin-bottom: 2.25rem;
}
.index-head h2 { font: 400 40px/1.1 var(--serif); }
.index-head p { font-size: 14px; color: var(--muted); }

.index-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.index-column { padding: 0 2rem; border-left: 1px solid var(--rule); }
.index-column:first-child { padding-left: 0; border-left: 0; }
.index-column:last-child { padding-right: 0; }

.index-domain { margin-bottom: 2.25rem; scroll-margin-top: 5rem; }
.index-domain:last-child { margin-bottom: 0; }
.index-domain h3 { display: flex; align-items: baseline; gap: 0.6rem; font: 600 21px/1.25 var(--serif); }
.index-domain h3 a { color: var(--ink); text-decoration: none; }
.index-domain h3 a:hover { color: var(--focus); }
.domain-num { font: 600 12px/1 var(--mono); color: var(--focus); }
.index-domain > p { font-size: 13.5px; color: var(--muted); margin: 0.25rem 0 0.75rem 1.85rem; }

.index-list { list-style: none; margin-left: 1.85rem; }
.index-entry a {
    display: flex; align-items: baseline; gap: 0.4rem;
    padding: 0.18rem 0;
    color: var(--ink); text-decoration: none;
    font-size: 15px;
}
.index-entry a:hover .entry-title { color: var(--focus); text-decoration: underline; text-decoration-thickness: 1px; }
.entry-title { flex: 0 1 auto; }
.leader { flex: 1 1 1rem; min-width: 1rem; border-bottom: 1px dotted var(--muted); opacity: 0.6; transform: translateY(-0.3em); }
.entry-count { flex-shrink: 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.entry-desc { display: block; font-size: 13.5px; color: var(--muted); margin: -0.05rem 0 0.55rem; }
.entry-domain { font-size: 12px; color: var(--muted); flex-shrink: 0; }

.no-results { font: 400 18px/1.5 var(--serif); color: var(--muted); padding: 1rem 0; }

/* How it works / trust / FAQ */
.band { border-top: 1px solid var(--rule); }
.how { padding: 4rem 0; }
.how .container { display: grid; grid-template-columns: 1fr 3fr; gap: 2rem; }
.how h2, .faq-section h2 { font: 400 32px/1.15 var(--serif); }
.steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem; }
.step-num { display: block; font: 400 40px/1 var(--serif); color: var(--focus); margin-bottom: 1rem; }
.steps h3 { font: 600 20px/1.3 var(--serif); margin-bottom: 0.5rem; }
.steps p { color: var(--muted); }

.trust { display: grid; grid-template-columns: repeat(4, 1fr); }
.trust > div { padding: 2rem 2rem 2.25rem; border-left: 1px solid var(--rule); }
.trust > div:first-child { border-left: 0; padding-left: 0; }
.trust h3 { font: 600 11px/1.3 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.6rem; }
.trust p { color: var(--muted); font-size: 14.5px; }
.trust a { color: inherit; }

.faq-section { padding: 4rem 0 4.5rem; }
.faq-section .container { display: grid; grid-template-columns: 1fr 3fr; gap: 2rem; }
.faq-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 2.5rem; align-items: start; }
.faq-col { border-top: 1px solid var(--rule); }

.faq-item { border-bottom: 1px solid var(--rule); }
.faq-item summary {
    display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
    padding: 1rem 0;
    cursor: pointer; list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 18px; color: var(--ink); flex-shrink: 0; }
.faq-item[open] summary::after { content: '\2212'; }
.faq-question { font: 600 17px/1.35 var(--serif); }
.faq-item > p { color: var(--muted); padding: 0 0 1.1rem; max-width: var(--measure); }

/* ---------- Hub pages ---------- */
.page-main { padding: 3rem 0 5rem; }
.hub-header { max-width: 820px; margin-bottom: 2.5rem; }
.hub-header h1, .page-header h1 { font: 400 52px/1.08 var(--serif); letter-spacing: -0.01em; margin: 0.9rem 0 1rem; text-wrap: balance; }
.page-lede { font: 400 20px/1.55 var(--serif); max-width: 40ch; }
.hub-meta { font-size: 14px; color: var(--muted); margin-top: 1rem; }

.hub-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4rem; border-top: 2px solid var(--rule-strong); padding-top: 2rem; }
.hub-models h2, .hub-other h2 { font: 600 11px/1.3 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 1rem; }
.hub-models .index-list { margin-left: 0; }
.hub-models .index-entry a { font: 600 17px/1.35 var(--serif); }

.hub-other { margin-top: 3.5rem; border-top: 1px solid var(--rule); padding-top: 2rem; }
.chapter-list { list-style: none; columns: 3; column-gap: 2.5rem; }
.chapter-list li { break-inside: avoid; padding: 0.25rem 0; }
.chapter-list a { color: var(--ink); text-decoration: none; display: flex; gap: 0.6rem; align-items: baseline; }
.chapter-list a:hover { color: var(--focus); }

/* ---------- Prose (content pages, hub intros, model guide) ---------- */
.prose { max-width: var(--measure); font: 400 18px/1.65 var(--serif); color: var(--ink); }
.prose h2 { font: 600 28px/1.25 var(--serif); margin: 2.75rem 0 0.8rem; }
.prose h3 { font: 600 21px/1.3 var(--serif); margin: 2rem 0 0.5rem; }
.prose h4 { font: 600 18px/1.35 var(--serif); margin: 1.5rem 0 0.4rem; }
.prose p, .prose ul, .prose ol, .prose blockquote { margin-bottom: 1.05rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: 0.45rem; }
.prose li::marker { color: var(--muted); }
.prose strong { font-weight: 600; }
.prose blockquote { border-left: 2px solid var(--focus); padding-left: 1rem; font-style: italic; }
.prose code { font: 0.85em var(--mono); background: var(--paper-2); padding: 0.05rem 0.3rem; border-radius: 3px; }
.prose > h2:first-child { margin-top: 0; }

.content-page .page-header { margin-bottom: 2.5rem; padding-bottom: 2rem; border-bottom: 2px solid var(--rule-strong); max-width: var(--measure); }

/* ---------- Blog ---------- */
.post .page-header, .blog-header { margin-bottom: 2rem; padding-bottom: 1.75rem; border-bottom: 2px solid var(--rule-strong); }
.blog-header { max-width: 820px; }
.post-header h1 { font-size: 46px; }
.post-header .page-lede { max-width: none; }
.post-meta { font: 400 14px/1.5 var(--sans); color: var(--muted); margin-top: 1.1rem; }
.post-hero, .post-figure { margin: 0 0 2rem; }
.post-figure { margin: 2.25rem 0; }
.post-hero img, .post-figure img, .post-thumb { display: block; width: 100%; height: auto; background: var(--paper-2); }
[data-theme="dark"] .post-hero img, [data-theme="dark"] .post-figure img, [data-theme="dark"] .post-thumb { filter: brightness(0.86) contrast(1.05); }
.post a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.post-cta { margin-top: 3rem; padding: 1.5rem 0 0.5rem; border-top: 2px solid var(--rule-strong); font-family: var(--sans); }
.prose .post-cta h2 { font: 600 11px/1.3 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.5rem; }
.post-cta p { font-size: 15px; color: var(--muted); margin-bottom: 0.75rem; }
.post-cta .index-list, .prose .post-cta .index-list { margin-left: 0; padding-left: 0; }
.post-cta .index-entry a { font: 600 17px/1.35 var(--serif); text-decoration: none; color: var(--ink); }

.post-year { margin-bottom: 2.5rem; }
.post-year-title { border-bottom: 1px solid var(--rule); padding-bottom: 0.5rem; margin-bottom: 1.25rem; }
.post-list { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.25rem 2rem; }
.post-entry-link { display: block; color: var(--ink); text-decoration: none; }
.post-thumb { aspect-ratio: 16 / 9; margin-bottom: 0.85rem; }
.post-entry-meta { display: block; font: 400 12.5px/1.4 var(--sans); color: var(--muted); margin-bottom: 0.35rem; }
.post-entry-title { font: 600 19px/1.3 var(--serif); margin-bottom: 0.35rem; text-wrap: balance; }
.post-entry-link:hover .post-entry-title { color: var(--focus); text-decoration: underline; text-decoration-thickness: 1px; }
.post-entry-desc { display: block; font-size: 14px; line-height: 1.5; color: var(--muted); }
.post-list-compact .post-entry-desc { display: none; }
.more-posts, .related-reading { margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.more-posts h2, .related-reading h2 { margin-bottom: 1.25rem; }
.related-reading-more { margin-top: 1.25rem; font-size: 15px; }
.related-reading-more a { color: var(--accent); }
.home-blog { padding: 4rem 0; }
.home-blog h2 { font: 400 32px/1.15 var(--serif); margin-bottom: 1.75rem; }

/* ---------- 404 ---------- */
.error-page { padding-top: 5rem; padding-bottom: 6rem; }
.error-page h1 { font: 400 52px/1.1 var(--serif); margin: 0.9rem 0 1rem; }
.error-text { font: 400 20px/1.55 var(--serif); margin-bottom: 2rem; max-width: 40ch; }
.error-page .chapter-list { margin-top: 3rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .home-hero .container { grid-template-columns: 1fr; gap: 3rem; }
    .index-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .index-column:nth-child(3) { grid-column: 1 / -1; border-left: 0; padding: 2.25rem 0 0; border-top: 1px solid var(--rule); margin-top: 2.25rem; }
    .index-column:nth-child(2) { padding-right: 0; }
    .hub-body { grid-template-columns: 1fr; gap: 2.5rem; }
    .post-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    :root { --gutter: 1.25rem; }
    body { font-size: 15px; }
    .site-header .container { min-height: 56px; gap: 1rem; }
    .site-nav { gap: 0.9rem; }
    .site-nav a.nav-secondary { display: none; }
    .site-nav .theme-toggle-label { display: none; }
    .home-hero { padding: 2.5rem 0 3rem; }
    .home-hero h1 { font-size: 40px; }
    .home-hero .lede { font-size: 18px; }
    .index-head h2 { font-size: 32px; }
    .index-columns { grid-template-columns: 1fr; }
    .index-column, .index-column:nth-child(2), .index-column:nth-child(3) { padding: 0; border-left: 0; border-top: 0; margin-top: 0; }
    .index-column + .index-column { margin-top: 2.25rem; }
    .how .container, .faq-section .container { grid-template-columns: 1fr; }
    .steps { grid-template-columns: 1fr; gap: 1.75rem; }
    .trust { grid-template-columns: 1fr 1fr; }
    .trust > div { padding: 1.5rem 1rem 1.5rem 0; border-left: 0; border-top: 1px solid var(--rule); }
    .faq-grid { grid-template-columns: 1fr; }
    .faq-col + .faq-col { border-top: 0; }
    .hub-header h1, .page-header h1, .error-page h1 { font-size: 36px; }
    .post-header h1 { font-size: 34px; }
    .post-list { grid-template-columns: 1fr; gap: 2rem; }
    .page-lede { font-size: 18px; }
    .prose { font-size: 17px; }
    .chapter-list { columns: 1; }
    .footer-grid { grid-template-columns: 1fr; gap: 1.75rem; }
}

@media print {
    .site-header, .site-footer, .back-to-top { display: none !important; }
    body { background: #fff; color: #000; }
}

@media (max-width: 420px) {
    .site-nav a.nav-wide { display: none; }
}

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