/* Base layout and shared components. Section-specific styles live in proposal.css. */
:root {
  --muted: var(--ink-muted);
  --paper: var(--surface);
  --border: var(--line);
  --proexca: #0a4fa3;
  --ok: #2f7d4f;
  --ok-soft: rgba(47,125,79,0.12);
  --toc-w: 292px;
  --gutter: clamp(16px, 5vw, 72px);
  --content-max: 1080px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 4px; }
a:not([class]) { color: var(--primary); }
button, input { font: inherit; }
button, summary, a { touch-action: manipulation; }
button, summary { cursor: pointer; }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
img { max-width: 100%; height: auto; }
.skip { position: absolute; left: 15px; top: -80px; z-index: 50; background: var(--surface-raised); padding: 12px; }
.skip:focus { top: 10px; }

/* Type */
h1, h2, h3 { font-weight: 500; margin: 0; }
h1 { font-family: var(--font-serif); font-size: clamp(38px, 5.2vw, 68px); line-height: 1.06; letter-spacing: -0.02em; margin-bottom: 28px; }
h2 { font-family: var(--font-serif); font-size: clamp(30px, 3.4vw, 42px); line-height: 1.15; letter-spacing: -0.01em; margin-bottom: 20px; }
h3 { font-size: 19px; line-height: 1.4; margin-bottom: 10px; }
em { font-style: italic; font-weight: 500; color: var(--ink-muted); }
p { margin: 0 0 1em; }
.lead { font-size: 17px; line-height: 1.8; color: var(--muted); max-width: 680px; }
.tiny, .eyebrow { font: 400 12px/1.5 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.eyebrow { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; color: var(--accent-strong); }
.eyebrow::before { content: ""; width: 7px; height: 7px; background: var(--accent-strong); border-radius: 100%; }
.band .eyebrow { color: var(--accent); }
.band .eyebrow::before { background: var(--accent); }
.tiny { color: var(--muted); }

/* Buttons */
.button {
  display: inline-flex; align-items: center; gap: 14px;
  background: var(--accent); color: var(--on-accent);
  padding: 13px 20px; border-radius: var(--radius-sm); border: 0;
  text-decoration: none; font-size: 14px; font-weight: 700;
  transition: transform 160ms ease;
}
.button:hover { transform: translateY(-1px); }
.button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--border); }
.band .button.ghost { color: var(--on-band); border-color: var(--on-band-muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 28px 0 0; }

/* Layout: sidebar + main */
.layout { display: grid; grid-template-columns: var(--toc-w) minmax(0, 1fr); min-height: 100vh; }
.toc {
  position: sticky; top: 0; height: 100vh; overflow: auto;
  border-right: 1px solid var(--border); background: var(--surface-raised);
  display: flex; flex-direction: column; padding: 28px 24px 24px;
}
.toc-head { display: grid; gap: 18px; margin-bottom: 26px; }
.toc-brand-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand img { display: block; height: 40px; width: auto; }
.brand .brand-mark { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.toc-toggle {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none;
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--ink-muted); cursor: pointer;
  transition: color 160ms ease, background 160ms ease, transform 220ms ease;
}
.toc-toggle:hover { color: var(--ink); background: var(--surface-tint); }
.toc-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.toc-for { display: grid; gap: 6px; padding-top: 14px; border-top: 1px solid var(--border); }
.client-logo { width: 150px; height: auto; }
.toc-nav ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc-nav a {
  display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: baseline;
  padding: 8px 10px 8px 12px; text-decoration: none; font-size: 13.5px; line-height: 1.35;
  color: var(--ink-muted); border-left: 2px solid transparent; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}
.toc-nav a .n { font: 400 11px/1 var(--font-mono); color: var(--accent-strong); }
.toc-nav a:hover { color: var(--ink); background: var(--surface-tint); }
.toc-nav a[aria-current="true"] { color: var(--ink); font-weight: 700; border-left-color: var(--accent); background: var(--surface-tint); }
.toc-progress { height: 2px; background: var(--surface-muted); margin: 22px 0 18px; }
.toc-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 120ms linear; }
.toc-foot { margin-top: auto; display: grid; gap: 12px; }
.toc-foot .button { justify-content: center; }

.topbar { display: none; }

/* Collapsed sidebar: a narrow rail with the mark, section numbers and the progress bar. */
@media (min-width: 1024px) {
  .layout { transition: grid-template-columns 220ms ease; }
  html.toc-collapsed { --toc-w: 72px; }
  html.toc-collapsed .toc { padding: 24px 12px 20px; }
  html.toc-collapsed .toc-brand-row { flex-direction: column; gap: 14px; }
  html.toc-collapsed .brand-full, html.toc-collapsed .toc-for, html.toc-collapsed .toc-foot,
  html.toc-collapsed .toc-nav a span:not(.n) { display: none; }
  html.toc-collapsed .brand-mark { display: block; height: 36px; }
  html.toc-collapsed .toc-toggle svg { transform: scaleX(-1); }
  html.toc-collapsed .toc-nav a { grid-template-columns: 1fr; justify-items: center; padding: 10px 0; border-left-width: 0; border-radius: var(--radius-sm); }
  html.toc-collapsed .toc-nav a .n { font-size: 12px; }
  html.toc-collapsed .toc-nav a[aria-current="true"] { box-shadow: inset 0 -2px 0 var(--accent); }
  html.toc-collapsed .toc-progress { margin: 22px 0 0; }
}
@media (prefers-reduced-motion: reduce) { .layout, .toc-toggle { transition: none; } }

main { min-width: 0; }
.section { padding: clamp(64px, 9vw, 112px) var(--gutter); border-bottom: 1px solid var(--border); scroll-margin-top: 0; }
.section > .inner { max-width: var(--content-max); margin: 0 auto; }
.section.band { background: var(--band); color: var(--on-band); border-bottom: 0; }
.section.band .lead, .section.band .muted { color: var(--on-band-muted); }
.section.band em { color: var(--accent); }
.section.band h2, .section.band h3 { color: var(--on-band); }

/* Cards and grids */
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  border: 1px solid var(--border); border-top: 3px solid var(--accent);
  background: var(--surface-raised); padding: 24px 22px; border-radius: var(--radius-none);
  display: flex; flex-direction: column; gap: 8px;
}
.card h3 { font-family: var(--font-serif); font-size: 22px; font-weight: 500; }
.card p { font-size: 14.5px; color: var(--muted); margin: 0; }
.card ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.card li { margin: 4px 0; }
.card .n { font: 400 12px/1 var(--font-mono); color: var(--accent-strong); letter-spacing: 0.08em; }
.callout { background: var(--surface-tint); padding: 28px; border-left: 3px solid var(--primary); }
.callout h3 { font-family: var(--font-serif); font-size: 24px; }
.callout ul { margin: 8px 0 0; padding-left: 18px; font-size: 14.5px; }
.callout li { margin: 6px 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 48px; align-items: start; }
@media (max-width: 1279px) { .two-col { grid-template-columns: 1fr; gap: 28px; } }
.stats { display: flex; flex-wrap: wrap; gap: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 36px 0 0; }
.stat { flex: 1 1 160px; padding: 20px 24px 20px 0; display: grid; gap: 2px; }
.stat + .stat { padding-left: 24px; border-left: 1px solid var(--border); }
.stat b { font-family: var(--font-serif); font-size: 40px; font-weight: 500; line-height: 1; color: var(--primary); }
.stat small { font: 400 12.5px/1.5 var(--font-sans); letter-spacing: 0; color: var(--muted); }
.band .stat b { color: var(--accent); }
.band .stat, .band .stats { border-color: rgba(255,255,255,0.16); }
.band .stat small { color: var(--on-band-muted); }

/* Review mode */
.confirm { }
body.review .confirm { text-decoration: underline dashed var(--danger); text-underline-offset: 3px; cursor: help; }

/* Footer */
.site-foot { padding: 40px var(--gutter); font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.site-foot p { margin: 0; }

/* Responsive */
@media (max-width: 1023px) {
  .layout { grid-template-columns: 1fr; }
  .topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
    height: 64px; padding: 0 16px; background: var(--surface-raised); border-bottom: 1px solid var(--border);
  }
  .topbar .brand img { height: 32px; }
  .topbar-title { font-size: 13px; font-weight: 700; flex: 1; border-left: 1px solid var(--border); padding-left: 14px; line-height: 1.2; }
  .menu-button { display: inline-flex; align-items: center; gap: 10px; background: transparent; border: 1px solid var(--border); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; color: var(--ink); }
  .menu-icon { width: 16px; height: 2px; background: currentColor; position: relative; display: block; }
  .menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; width: 16px; height: 2px; background: currentColor; }
  .menu-icon::before { top: -5px; } .menu-icon::after { top: 5px; }
  .toc {
    position: fixed; inset: 64px 0 0 0; height: auto; z-index: 25; border-right: 0;
    transform: translateX(-100%); transition: transform 220ms ease; visibility: hidden;
  }
  body.toc-open .toc { transform: none; visibility: visible; }
  body.toc-open { overflow: hidden; }
  .toc-head .brand, .toc-toggle { display: none; }
  .toc-for { border-top: 0; padding-top: 0; }
  .section { scroll-margin-top: 64px; }
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .two-col, .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .stat + .stat { padding-left: 0; border-left: 0; border-top: 1px solid var(--border); }
  .topbar-title { display: none; }
}

/* Dark theme: the slate logo needs to go white. */
[data-theme="dark"] .brand img, [data-theme="dark"] .hero-client img[alt="Socratix AI"] { filter: brightness(0) invert(1); }
[data-theme="dark"] .client-logo, [data-theme="dark"] .hero-client img[alt="PROEXCA"] { background: #fff; padding: 6px 8px; }
[data-theme="dark"] { --ok: #5fc08a; --ok-soft: rgba(95,192,138,0.16); }
