/* ============================================================================
 *  Project   : modelmap
 *  File      : site/public/style.css
 *  Purpose   : Editorial light theme v2 — responsive, mobile-first refinements
 *  Author    : Simon-Pierre Boucher
 *  Contact   : contact@spboucher.ai
 *  Website   : https://modelmap.io
 *  Created   : 2026-08-12
 *  Modified  : 2026-08-12
 *  Platform  : Web (deployed from macOS / Apple Silicon)
 *  License   : All rights reserved (research code)
 * ==========================================================================*/

:root {
  color-scheme: light;
  --page: #faf9f6;
  --surface: #ffffff;
  --surface-2: #f4f2ec;
  --ink: #17151f;
  --ink-2: #4e4a5a;
  --muted: #8b8798;
  --grid: #e6e3da;
  --baseline: #c9c5ba;
  --accent: #6d4fc4;
  --accent-dark: #53389e;
  --accent-deep: #3b2775;
  --accent-bg: #f1edfa;
  --accent-glow: rgba(109, 79, 196, 0.12);
  --good: #0e9f4e;
  --good-text: #0a6b36;
  --good-bg: #e9f7ef;
  --warn-text: #9a6a00;
  --warn-bg: #fdf3e2;
  --shadow-sm: 0 1px 2px rgba(23, 21, 31, 0.05), 0 2px 8px rgba(23, 21, 31, 0.04);
  --shadow-md: 0 2px 4px rgba(23, 21, 31, 0.05), 0 10px 28px rgba(23, 21, 31, 0.08);
  --radius: 14px;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--page);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16px;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, pre, .mono-small { font-family: var(--font-mono); }
::selection { background: var(--accent-bg); color: var(--accent-deep); }

h1, h2, h3, .page-title, .section-title { font-family: var(--font-display); font-weight: 550; }

/* ---------------------------------------------------------------- header */
.site-header {
  background: rgba(250, 249, 246, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--grid);
  position: sticky; top: 0; z-index: 50;
}
.header-row { display: flex; align-items: center; justify-content: space-between; height: 62px; position: relative; }
.brand {
  font-family: var(--font-display);
  font-weight: 600; font-size: 21px; color: var(--ink); letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 9px;
}
.brand:hover { text-decoration: none; }
.brand-dim { color: var(--muted); font-weight: 450; }
.logo { width: 26px; height: 26px; color: var(--accent); flex: 0 0 auto; }

.site-nav { display: flex; gap: 2px; flex-wrap: wrap; }
.site-nav a {
  padding: 7px 13px; border-radius: 999px; color: var(--ink-2);
  font-size: 14px; font-weight: 500; transition: background 0.15s, color 0.15s;
}
.site-nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.site-nav a.active { color: var(--accent-deep); background: var(--accent-bg); font-weight: 600; }

/* hamburger — hidden on desktop */
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 44px; height: 44px; padding: 10px;
  background: none; border: 1px solid var(--grid); border-radius: 10px; cursor: pointer;
}
.nav-toggle span {
  display: block; height: 2px; width: 100%; background: var(--ink);
  border-radius: 2px; transition: transform 0.25s, opacity 0.2s;
}
.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); }

/* ---------------------------------------------------------------- hero */
.hero {
  padding: 72px 0 16px;
  position: relative;
}
.hero::before {
  content: ""; position: absolute; inset: -62px -50vw 0;
  background:
    radial-gradient(600px 320px at 78% 0%, var(--accent-glow), transparent 70%),
    radial-gradient(420px 260px at 12% 18%, rgba(14, 159, 78, 0.06), transparent 70%);
  pointer-events: none; z-index: -1;
}
.kicker {
  text-transform: uppercase; letter-spacing: 0.14em; font-size: 12px; font-weight: 650;
  color: var(--accent-dark); margin: 0 0 14px; font-family: var(--font-body);
}
.hero h1 {
  font-size: clamp(34px, 5.6vw, 54px);
  line-height: 1.08; letter-spacing: -0.015em; margin: 0 0 18px; font-weight: 560;
}
.hero h1 em, .lede em { font-style: italic; color: var(--accent-deep); }
.lede { font-size: 18.5px; color: var(--ink-2); max-width: 780px; margin: 0 0 14px; }
.lede-small { color: var(--ink-2); max-width: 780px; }
.lede-eq { margin-top: 18px; }
.lede-eq code {
  font-size: 12.5px; background: var(--surface); border: 1px solid var(--grid);
  border-radius: 10px; padding: 9px 14px; color: var(--ink-2); display: inline-block;
  box-shadow: var(--shadow-sm); line-height: 1.7;
}

/* ---------------------------------------------------------------- tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 40px 0; }
.tile {
  background: var(--surface); border: 1px solid var(--grid); border-radius: var(--radius);
  padding: 22px 24px; display: flex; flex-direction: column; gap: 2px;
  box-shadow: var(--shadow-sm); transition: transform 0.18s, box-shadow 0.18s;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tile-value {
  font-family: var(--font-display); font-size: 40px; font-weight: 560;
  letter-spacing: -0.02em; color: var(--accent-deep); line-height: 1.1;
}
.tile-denom { font-size: 22px; color: var(--muted); font-weight: 450; }
.tile-label { color: var(--ink-2); font-size: 13.5px; margin-top: 4px; }

/* ---------------------------------------------------------------- layout */
.split { display: grid; grid-template-columns: 3fr 2fr; gap: 22px; margin: 8px 0 22px; }
.card {
  background: var(--surface); border: 1px solid var(--grid); border-radius: var(--radius);
  padding: 28px 30px; margin-bottom: 22px; box-shadow: var(--shadow-sm);
}
.card h2 { margin-top: 0; font-size: 22px; letter-spacing: -0.01em; }
.more { font-weight: 600; font-size: 14px; }
.more::after { content: ""; }

/* ---------------------------------------------------------------- phases */
.phases { list-style: none; margin: 0; padding: 0; }
.phase { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--grid); }
.phase:last-child { border-bottom: 0; }
.phase strong { display: block; font-size: 14px; font-family: var(--font-body); font-weight: 600; }
.phase-detail { font-size: 12.5px; color: var(--muted); }
.phase-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; flex: 0 0 auto; background: var(--baseline); }
.phase.done .phase-dot { background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.phase.in-progress .phase-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.phase .badge { margin-left: auto; }

.badge {
  font-size: 11px; font-weight: 650; padding: 3px 10px; border-radius: 999px;
  white-space: nowrap; align-self: center; border: 1px solid var(--grid);
  color: var(--ink-2); letter-spacing: 0.02em;
}
.badge-done { color: var(--good-text); background: var(--good-bg); border-color: #cfe8d8; }
.badge-in-progress, .badge-has-results { color: var(--accent-deep); background: var(--accent-bg); border-color: #dcd2f2; }
.badge-pending, .badge-scaffolded { color: var(--muted); background: var(--surface-2); }

/* ---------------------------------------------------------------- ladder */
.ladder { list-style: none; margin: 18px 0; padding: 0; }
.ladder-step { display: flex; align-items: flex-start; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.ladder-step:last-child { border-bottom: 0; }
.ladder-step strong { display: block; font-size: 14.5px; font-family: var(--font-body); font-weight: 600; }
.ladder-desc { font-size: 13px; color: var(--muted); display: block; }
.ladder-num {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; font-weight: 650; font-size: 13px;
  font-family: var(--font-mono); margin-top: 2px;
  background: var(--surface-2); border: 1px solid var(--grid); color: var(--muted);
}
.ladder-num.lv1 { background: var(--warn-bg); border-color: #f3ddb0; color: var(--warn-text); }
.ladder-num.lv2 { background: var(--accent-bg); border-color: #dcd2f2; color: var(--accent-deep); }
.ladder-num.lv3 { background: var(--good-bg); border-color: #cfe8d8; color: var(--good-text); }
.badge-level-0 { color: var(--muted); background: var(--surface-2); }
.badge-level-1 { color: var(--warn-text); background: var(--warn-bg); border-color: #f3ddb0; }
.badge-level-2 { color: var(--accent-deep); background: var(--accent-bg); border-color: #dcd2f2; }
.badge-level-3 { color: var(--good-text); background: var(--good-bg); border-color: #cfe8d8; }

/* ---------------------------------------------------------------- cards grid */
.page-title { font-size: clamp(28px, 4vw, 36px); letter-spacing: -0.015em; margin: 44px 0 10px; }
.section-title { font-size: 22px; margin: 36px 0 8px; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin: 18px 0; }
.doc-card {
  background: var(--surface); border: 1px solid var(--grid); border-radius: var(--radius);
  padding: 20px 22px; color: var(--ink); display: block;
  box-shadow: var(--shadow-sm); transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.doc-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.doc-card.disabled { opacity: 0.55; pointer-events: none; }
.doc-card h3 { margin: 0 0 6px; font-size: 16.5px; }
.doc-card p { margin: 0 0 10px; font-size: 13.5px; color: var(--ink-2); }
.runs { font-size: 12px; color: var(--muted); margin-left: 8px; }
.note-line { color: var(--ink-2); font-size: 14px; }

/* ---------------------------------------------------------------- markdown */
.doc { max-width: 880px; margin: 32px auto; }
.crumb { font-size: 13px; color: var(--muted); margin: 26px 0 4px; font-family: var(--font-mono); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 18px; }
.chip {
  font-size: 12px; background: var(--surface); border: 1px solid var(--grid);
  border-radius: 999px; padding: 3px 12px; color: var(--ink-2);
}
.chip-k { color: var(--muted); margin-right: 6px; text-transform: uppercase; font-size: 10px; letter-spacing: 0.06em; }
.md { overflow-wrap: break-word; }
.md h1 { font-size: 30px; letter-spacing: -0.015em; }
.md h2 { font-size: 22px; margin-top: 40px; border-bottom: 1px solid var(--grid); padding-bottom: 8px; }
.md h3 { font-size: 17.5px; margin-top: 30px; }
.md code { background: var(--surface-2); border-radius: 5px; padding: 1px 6px; font-size: 0.86em; }
.md pre code, .codeblock code { background: none; padding: 0; font-size: 13px; }
.codeblock, .md pre {
  background: var(--surface-2); border: 1px solid var(--grid); border-radius: 10px;
  padding: 15px 18px; overflow-x: auto; line-height: 1.55;
}
.md table { border-collapse: collapse; width: 100%; font-size: 14px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--grid); padding: 7px 11px; text-align: left; vertical-align: top; }
.md th { background: var(--surface-2); font-family: var(--font-body); }
.md blockquote {
  border-left: 3px solid var(--accent); margin-left: 0; padding: 4px 0 4px 18px;
  color: var(--ink-2); font-family: var(--font-display); font-style: italic; font-size: 1.03em;
}

/* ---------------------------------------------------------------- log */
.log-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; }
.log-entry h3 { font-size: 15.5px; margin: 0 0 8px; }
.log-entry .md { font-size: 13.5px; color: var(--ink-2); }

/* ---------------------------------------------------------------- tables */
.results-table, .kv-table {
  border-collapse: collapse; width: 100%; font-size: 14.5px; background: var(--surface);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.results-table th, .results-table td, .kv-table th, .kv-table td {
  border: 1px solid var(--grid); padding: 9px 13px; text-align: left;
}
.results-table th { background: var(--surface-2); font-family: var(--font-body); }
.kv-table th { background: var(--surface-2); width: 190px; }
.table-scroll { overflow-x: auto; }
.file-list { list-style: none; padding: 0; }
.file-list li { padding: 7px 0; border-bottom: 1px solid var(--grid); }
.tree { list-style: none; padding-left: 0; }
.tree ul { list-style: none; padding-left: 20px; }
.tree-root { margin-bottom: 14px; }
.tree li { padding: 2px 0; font-size: 14.5px; }
.mono-small { font-size: 12.5px; color: var(--muted); }
.file-card { padding: 0; overflow: hidden; }
.file-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--grid); background: var(--surface-2); }
.file-card .codeblock { border: 0; border-radius: 0; margin: 0; }

/* ---------------------------------------------------------------- comments */
.comment-form { display: grid; gap: 14px; max-width: 640px; }
.comment-form label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); display: block; margin-bottom: 5px; }
.comment-form input[type="text"], .comment-form textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--baseline); border-radius: 10px;
  padding: 11px 14px; transition: border-color 0.15s, box-shadow 0.15s;
}
.comment-form input:focus, .comment-form textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.comment-form textarea { min-height: 130px; resize: vertical; }
.hp-field { position: absolute; left: -9999px; top: -9999px; height: 1px; width: 1px; overflow: hidden; }
.btn {
  display: inline-block; font: inherit; font-weight: 650; font-size: 15px;
  background: var(--accent-dark); color: #fff; border: 0; border-radius: 999px;
  padding: 11px 26px; cursor: pointer; justify-self: start;
  box-shadow: var(--shadow-sm); transition: background 0.15s, transform 0.15s;
}
.btn:hover { background: var(--accent-deep); transform: translateY(-1px); }
.flash { border-radius: 10px; padding: 12px 16px; font-size: 14.5px; margin: 14px 0; }
.flash-ok { background: var(--good-bg); color: var(--good-text); border: 1px solid #cfe8d8; }
.flash-err { background: #fdecec; color: #a03030; border: 1px solid #f2ccc9; }
.comment-list { list-style: none; padding: 0; margin: 8px 0 0; }
.comment {
  background: var(--surface); border: 1px solid var(--grid); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.comment-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.comment-name { font-weight: 650; font-size: 14.5px; }
.comment-date { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }
.comment-body { font-size: 14.5px; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: break-word; }

/* ---------------------------------------------------------------- charts */
.chart-fig { margin: 22px 0 10px; position: relative; }
.chart-fig + .chart-fig { margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--grid); }
.chart-title {
  font-family: var(--font-body); font-size: 14.5px; font-weight: 650;
  color: var(--ink); margin-bottom: 6px;
}
.panel-title { fill: var(--ink-2); font-size: 12px; font-weight: 600; font-family: var(--font-body); }
.bar-val { fill: var(--ink-2); font-size: 10.5px; font-family: var(--font-mono); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 6px 0 2px; font-size: 12.5px; color: var(--ink-2); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg-swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; flex: 0 0 auto; }
.chart-fig svg { width: 100%; height: auto; }
.chart-fig .grid { stroke: var(--grid); stroke-width: 1; }
.chart-fig .axis { stroke: var(--baseline); stroke-width: 1; }
.chart-fig .tick { fill: var(--muted); font-size: 11px; font-family: var(--font-mono); }
.chart-fig .axis-title { fill: var(--ink-2); font-size: 12px; }
.chart-fig .series-label { font-size: 12px; font-weight: 600; }
.chart-fig .pt { cursor: pointer; }
.chart-fig figcaption { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--ink); color: #fff;
  font-size: 12.5px; padding: 5px 10px; border-radius: 8px; white-space: nowrap; z-index: 5;
}

/* ---------------------------------------------------------------- hljs */
.hljs { color: #24292e; }
.hljs-keyword, .hljs-meta .hljs-keyword { color: #d73a49; }
.hljs-string, .hljs-attr { color: #032f62; }
.hljs-comment, .hljs-quote { color: #6a737d; font-style: italic; }
.hljs-number, .hljs-literal { color: #005cc5; }
.hljs-title, .hljs-function .hljs-title { color: #6f42c1; }
.hljs-built_in, .hljs-type { color: #e36209; }
.hljs-section { color: #005cc5; font-weight: 600; }
.hljs-params { color: #24292e; }
.hljs-variable, .hljs-template-variable { color: #e36209; }

/* ---------------------------------------------------------------- footer */
.site-footer {
  border-top: 1px solid var(--grid); margin-top: 64px; padding: 44px 0 28px;
  background: var(--surface); font-size: 14px; color: var(--ink-2);
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.footer-col { display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }
.footer-col h4 {
  margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); font-family: var(--font-body); font-weight: 650;
}
.footer-col a { color: var(--ink-2); font-size: 13.5px; }
.footer-col a:hover { color: var(--accent-deep); }
.footer-brand p { margin: 6px 0 0; font-size: 13px; color: var(--muted); max-width: 300px; }
.brand-foot {
  font-family: var(--font-display); font-weight: 600; font-size: 18px; color: var(--ink);
  display: inline-flex; align-items: center; gap: 8px;
}
.brand-foot .logo { width: 22px; height: 22px; }
.footer-meta { color: var(--muted); font-size: 12px; font-family: var(--font-mono); }
.footer-bottom {
  margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--grid);
  font-size: 12.5px; color: var(--muted);
}

/* ============================================================ responsive */
@media (max-width: 980px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 880px) {
  .nav-toggle { display: flex; }
  .site-nav {
    display: none;
    position: absolute; top: 62px; left: 0; right: 0;
    flex-direction: column; gap: 2px;
    background: var(--surface);
    border-bottom: 1px solid var(--grid);
    box-shadow: var(--shadow-md);
    padding: 10px 16px 16px;
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 13px 14px; border-radius: 10px; font-size: 16px; }
  .site-nav a + a { border-top: 1px solid var(--surface-2); border-radius: 0 0 10px 10px; }
}

@media (max-width: 560px) {
  body { font-size: 15.5px; }
  .wrap { padding: 0 18px; }
  .hero { padding: 44px 0 8px; }
  .lede { font-size: 16.5px; }
  .lede-eq code { font-size: 11px; padding: 8px 10px; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 28px 0; }
  .tile { padding: 16px 18px; }
  .tile-value { font-size: 30px; }
  .card { padding: 20px 18px; border-radius: 12px; }
  .doc-grid { grid-template-columns: 1fr; }
  .page-title { margin: 30px 0 8px; }
  .phase strong { font-size: 13px; }
  .phase .badge { display: none; }         /* dot already carries the status */
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .results-table, .kv-table { display: block; overflow-x: auto; }
  .md h2 { font-size: 20px; }
  .codeblock, .md pre { padding: 12px 12px; font-size: 12px; }
  .comment { padding: 14px 16px; }
}
