/* Grounded Build Co design tokens + components.
   Source of truth for groundedbuild.com (site/) and my.groundedbuild.com (portal/).
   Layout: one calm reading column (~68ch) with full-width bands for work samples;
   hairline rules between sections, generous vertical rhythm, one accent. */

:root {
  /* Ochre and ink (chosen 2026-11-18). Contrast checked: text, links, buttons >= 4.5:1. */
  --bg: #fbf4e2;
  --surface: #fffdf6;
  --band: #f5e6b8;
  --ink: #1b2236;
  --muted: #585c6a;
  --line: #e8dcb6;
  --accent: #1b2236;
  --accent-hover: #2c3654;
  --accent-ink: #fbf4e2;
  --accent-soft: #efe2b9;
  --danger: #9b2c2c;

  --font-display: "Schibsted Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Public Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: clamp(2rem, 1.4rem + 2.6vw, 3.25rem);

  --measure: 68ch;
  --wide: 1120px;
  --radius: 10px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12141c;
    --surface: #1a1d28;
    --band: #1f2230;
    --ink: #f3ecd8;
    --muted: #b0ab9b;
    --line: #2f3242;
    --accent: #f2c94c;
    --accent-hover: #f7d873;
    --accent-ink: #12141c;
    --accent-soft: #3a3320;
    --danger: #f19a9a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12141c;
  --surface: #1a1d28;
  --band: #1f2230;
  --ink: #f3ecd8;
  --muted: #b0ab9b;
  --line: #2f3242;
  --accent: #f2c94c;
  --accent-hover: #f7d873;
  --accent-ink: #12141c;
  --accent-soft: #3a3320;
  --danger: #f19a9a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
img { max-width: 100%; }
[hidden] { display: none !important; }

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0;
}
/* Lighter headline weights (chosen 2026-11-18: "less thick"). */
h1 { font-size: var(--step-3); font-weight: 500; }
h2 { font-size: var(--step-2); font-weight: 500; }
h3 { font-size: var(--step-1); font-weight: 500; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap {
  max-width: var(--wide);
  margin-inline: auto;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
}
.prose { max-width: var(--measure); }
.stack { display: grid; gap: 1rem; }
.stack-lg { display: grid; gap: 2rem; }

.label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.lede { font-size: var(--step-1); color: var(--muted); max-width: 46ch; line-height: 1.5; }

/* Header */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 1.5rem; min-height: 64px; flex-wrap: wrap; }
.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}
.wordmark span:not(.wordmark-name) { color: var(--muted); font-weight: 500; }
/* Logo: light emblem by default, the Dark A emblem (cream line-work) in dark mode. Approved 2026-11-19, brand/README.md */
.wordmark .logo { width: 40px; height: 40px; flex: none; display: block; }
.wordmark .logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wordmark .logo-light { display: none; }
  :root:not([data-theme="light"]) .wordmark .logo-dark { display: block; }
}
:root[data-theme="dark"] .wordmark .logo-light { display: none; }
:root[data-theme="dark"] .wordmark .logo-dark { display: block; }
.nav { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.nav a:hover { color: var(--ink); }
@media (max-width: 720px) { .nav .nav-section { display: none; } }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font: 600 1rem/1 var(--font-body);
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
/* .nav a sets muted text; keep header buttons identical to every other button. */
.nav .btn-primary, .nav .btn-primary:hover { color: var(--accent-ink); }
.nav .btn-quiet { color: var(--ink); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--ink); color: var(--ink); }
.btn-sm { padding: 0.6rem 0.9rem; font-size: 0.92rem; }
.btn[disabled] { opacity: 0.6; cursor: progress; }

/* Sections */
.section { padding-block: clamp(3.5rem, 7vw, 6rem); border-top: 1px solid var(--line); }
.section:first-of-type { border-top: 0; }
.section-head { display: grid; gap: 0.75rem; margin-bottom: 2.25rem; max-width: var(--measure); }
.band { background: var(--band); }

.hero { padding-block: clamp(3.5rem, 9vw, 7rem) clamp(3rem, 6vw, 5rem); }
.hero .stack-lg { max-width: 860px; }
.hero-actions { display: flex; gap: 1rem 1.5rem; align-items: center; flex-wrap: wrap; }
.stack-line { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }

/* Cards (used only where an item is a separate object) */
.grid-2 { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2rem);
  display: grid;
  gap: 0.9rem;
  align-content: start;
  min-width: 0;
}
.card p { color: var(--muted); }

/* Steps (a real sequence) */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: step; }
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 1rem;
  padding-block: 1.5rem;
  border-top: 1px solid var(--line);
}
.steps li:last-child { border-bottom: 1px solid var(--line); }
.steps li::before {
  content: counter(step);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent);
  padding-top: 0.2rem;
}
.steps h3 { margin-bottom: 0.35rem; }
.steps p { color: var(--muted); max-width: 60ch; }
.price-note { font-family: var(--font-mono); font-size: 0.85rem; color: var(--ink); }

/* Commitments */
.commitments { display: grid; gap: 2rem 3rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.commitment { display: grid; gap: 0.5rem; padding-top: 1rem; border-top: 2px solid var(--ink); min-width: 0; }
.commitment p { color: var(--muted); }

/* Deployment record: the one signature artifact */
.record {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}
.record table { border-collapse: collapse; width: 100%; min-width: 520px; font-variant-numeric: tabular-nums; }
.record th, .record td { text-align: left; padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.record th { color: var(--muted); font-weight: 500; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
.record tr:last-child td { border-bottom: 0; }
.record caption { caption-side: top; text-align: left; padding: 0.8rem 1rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
}
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.9rem; }
.checklist li { display: grid; grid-template-columns: 1.25rem 1fr; gap: 0.75rem; }
.checklist li::before { content: ""; width: 0.6rem; height: 0.6rem; margin-top: 0.55rem; border-radius: 2px; background: var(--accent); }
.checklist strong { font-weight: 600; }
.checklist span { color: var(--muted); }

/* Forms */
.form { display: grid; gap: 1.25rem; max-width: 640px; }
.field { display: grid; gap: 0.4rem; }
.field label, .field legend { font-weight: 600; font-size: 0.95rem; }
.field .hint { font-size: 0.85rem; color: var(--muted); font-weight: 400; }
.field input, .field select, .field textarea {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  width: 100%;
}
.field textarea { min-height: 7rem; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field-row { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.radio-list { display: grid; gap: 0.5rem; border: 0; padding: 0; margin: 0; }
.radio-list label { font-weight: 400; display: flex; gap: 0.6rem; align-items: flex-start; }
.radio-list input { width: auto; margin-top: 0.35rem; accent-color: var(--accent); }
.form-error { color: var(--danger); font-size: 0.95rem; }
.form-note { font-size: 0.85rem; color: var(--muted); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.progress { display: flex; gap: 1.5rem; flex-wrap: wrap; list-style: none; padding: 0; margin: 0 0 2rem; font-size: 0.9rem; }
.progress li { color: var(--muted); display: flex; gap: 0.5rem; align-items: center; }
.progress li[aria-current="step"] { color: var(--ink); font-weight: 600; }
.progress .dot { font-family: var(--font-mono); width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); font-size: 0.8rem; }
.progress li[aria-current="step"] .dot { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.booking-frame { width: 100%; min-height: 820px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.notice {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  color: var(--ink);
  max-width: 640px;
}

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 2.5rem; color: var(--muted); font-size: 0.9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; }
.site-footer a { color: var(--muted); }

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

/* Cookie consent banner (shared/consent.js) */
.consent {
  position: fixed; z-index: 40;
  left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  max-width: 640px; margin-inline: auto;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 28px rgb(0 0 0 / 0.12);
  padding: 1rem 1.15rem; display: grid; gap: 0.85rem; font-size: 0.95rem;
}
.consent p { margin: 0; color: var(--muted); }
.consent-actions { display: flex; gap: 0.6rem; justify-content: flex-end; flex-wrap: wrap; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Blog */
.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-width: var(--measure); }
.post-list li { border-top: 1px solid var(--line); padding-block: 1.4rem; display: grid; gap: 0.35rem; }
.post-list a { color: var(--ink); text-decoration: none; }
.post-list a:hover h2 { color: var(--accent); }
.post-list h2 { font-size: var(--step-1); }
.post-list p { margin: 0; color: var(--muted); }
.post-meta { font-family: var(--font-mono); font-size: var(--step--1); color: var(--muted); }
.post { max-width: var(--measure); }
.post-body { display: grid; gap: 1.1rem; }
.post-body h2 { font-size: var(--step-2); margin-top: 1rem; }
.post-body h3 { margin-top: 0.5rem; }
.post-body p, .post-body ul, .post-body ol, .post-body blockquote, .post-body pre { margin: 0; }
.post-body ul, .post-body ol { padding-left: 1.3rem; display: grid; gap: 0.35rem; }
.post-body blockquote { border-left: 3px solid var(--accent); padding-left: 1rem; color: var(--muted); }
.post-body pre { background: var(--band); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; overflow-x: auto; font-size: 0.9rem; }
.post-body code { font-family: var(--font-mono); font-size: 0.92em; }
.post-body img { border-radius: 8px; border: 1px solid var(--line); }
.post-cta { margin-top: 3rem; }

/* ===== Layout: cards + editorial grid (chosen 2026-11-18) =====
   Each section sits in its own panel on a tinted page; inside, the heading is pinned
   in a left column and the content sits on the right (desktop). */
body { background: var(--band); }
.site-header { background: color-mix(in srgb, var(--band) 88%, transparent); }
.section { border-top: 0; padding-block: clamp(0.6rem, 1.4vw, 1.1rem); }
.section > .wrap {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: clamp(1.5rem, 4vw, 3rem); max-width: calc(var(--wide) - 2rem);
}
.section.band { background: transparent; }
.section.band > .wrap { background: var(--accent-soft); }
.hero { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(1rem, 2vw, 1.5rem); }
main { padding-bottom: 1.5rem; }
.card { background: var(--bg); }
@media (min-width: 900px) {
  .section > .wrap:has(> .section-head) {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.3fr);
    column-gap: clamp(2rem, 5vw, 4.5rem); align-items: start;
  }
  .section > .wrap:has(> .section-head) > .section-head {
    grid-column: 1; grid-row: 1 / span 6; margin-bottom: 0;
    position: sticky; top: calc(88px + env(safe-area-inset-top, 0px));
    padding-top: 0.9rem; border-top: 2px solid var(--ink);
  }
  .section > .wrap:has(> .section-head) > :not(.section-head) { grid-column: 2; }
  .section-head h2 { font-size: var(--step-1); }
  .section-head .lede { font-size: 1rem; }
  .grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
  .commitments { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Light/dark toggle (shared/theme.js). Shows the moon in light mode, the sun in dark mode. */
.theme-toggle {
  display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; padding: 0;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle svg { width: 1.15rem; height: 1.15rem; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
