/* MOAT Safety site styles. Plain CSS, no build step.
   Colors live in the :root tokens below; dark mode redefines them. */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-hyperlegible-next-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-hyperlegible-next-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-hyperlegible-next-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --paper: #eef2f3;      /* drafting film */
  --surface: #ffffff;
  --ink: #142630;        /* deep slate, body text */
  --muted: #475862;      /* secondary text, 6.3:1 on paper */
  --moat: #0b5f6b;       /* links and the system boundary line */
  --moat-strong: #08444d;
  --signal: #f2b705;     /* safety amber, only as a fill behind dark ink */
  --signal-ink: #142630;
  --line: #c3cdd2;
  --line-strong: #6f8089;
  --error: #a3261b;
  --ok: #1d6b3a;
  --focus: #142630;
  --font-display: "Archivo", "Arial Narrow", Arial, sans-serif;
  --font-body: "Atkinson Hyperlegible Next", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --gutter: 16px;
  --max: 1120px;
  --measure: 66ch;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1a20;
    --surface: #13242c;
    --ink: #e3ebee;
    --muted: #a6b6bd;
    --moat: #6fcbd4;
    --moat-strong: #a3e3e9;
    --signal: #f2b705;
    --signal-ink: #10191e;
    --line: #2a3d46;
    --line-strong: #6c8590;
    --error: #ff9a8f;
    --ok: #7fd59b;
    --focus: #f2b705;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1a20;
  --surface: #13242c;
  --ink: #e3ebee;
  --muted: #a6b6bd;
  --moat: #6fcbd4;
  --moat-strong: #a3e3e9;
  --signal: #f2b705;
  --signal-ink: #10191e;
  --line: #2a3d46;
  --line-strong: #6c8590;
  --error: #ff9a8f;
  --ok: #7fd59b;
  --focus: #f2b705;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}
img, svg { max-width: 100%; }
a { color: var(--moat); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--moat-strong); text-decoration-thickness: 2px; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}
h1, h2, h3 {
  font-family: var(--font-display);
  font-stretch: 112%;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 1.3rem + 4vw, 3.9rem); font-weight: 800; font-stretch: 118%; }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.4rem); font-weight: 760; }
h3 { font-size: 1.25rem; font-weight: 700; font-stretch: 108%; }
p { margin: 0 0 1em; max-width: var(--measure); }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link {
  position: absolute; left: var(--gutter); top: -100px; z-index: 10;
  background: var(--signal); color: var(--signal-ink); padding: 8px 14px; font-weight: 700;
}
.skip-link:focus { top: 8px; }
.nowrap { white-space: nowrap; } /* keeps number ranges like "28-33 fps" on one line */

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 24px; padding-top: 14px; padding-bottom: 14px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font-family: var(--font-display); font-weight: 800; font-stretch: 120%; font-size: 1.1rem;
}
.brand:hover { color: var(--ink); }
.brand svg { width: 30px; height: 30px; flex: none; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 20px; align-items: center; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 0.98rem; }
.site-nav a:hover { color: var(--moat); text-decoration: underline; }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; }

/* ---------- Buttons ---------- */
.button {
  display: inline-block; font: inherit; font-weight: 700; cursor: pointer;
  padding: 0.7em 1.2em; border-radius: 4px; text-decoration: none; line-height: 1.2;
  border: 2px solid var(--ink); background: var(--ink); color: var(--paper);
}
.button:hover { background: var(--moat-strong); border-color: var(--moat-strong); color: var(--paper); text-decoration: none; }
.button.secondary { background: transparent; color: var(--ink); }
.button.secondary:hover { background: var(--surface); color: var(--ink); }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.5em; }

/* ---------- Hero ---------- */
.hero { padding: 40px 0 56px; }
.hero .wrap { display: grid; gap: 32px; align-items: center; }
.lede { font-size: 1.2rem; color: var(--ink); }
.hero .fine { color: var(--muted); font-size: 0.95rem; margin-top: 1.25em; }
.context { margin: 0; }
.context svg { display: block; width: 100%; max-width: 460px; height: auto; margin: 0 auto; }
.context figcaption { color: var(--muted); font-size: 0.95rem; text-align: center; margin: 0.5em auto 0; max-width: 40ch; }
.ctx-moat { fill: none; stroke: var(--signal); stroke-width: 16; }
.ctx-edge { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 6 6; }
.ctx-core { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.ctx-link { stroke: var(--line-strong); stroke-width: 2; }
.ctx-node { fill: var(--moat); }
.ctx-label { fill: var(--ink); font-family: var(--font-body); font-size: 16px; font-weight: 700; }
.ctx-core-label { fill: var(--ink); font-family: var(--font-display); font-size: 19px; font-weight: 800; font-stretch: 112%; }
.ctx-ring-label { fill: var(--muted); font-family: var(--font-body); font-size: 12.5px; letter-spacing: 0.06em; }
/* Below 480px the diagram shrinks to about 0.75 scale, so its labels get larger viewBox sizes.
   18px keeps "Environment" clear of the ring and "Who operates" inside the 440-unit viewBox. */
@media (max-width: 479.98px) {
  .ctx-label { font-size: 18px; }
  .ctx-ring-label { font-size: 17px; letter-spacing: 0.04em; }
}

/* The diagram is complete at rest. The only motion is the dashed boundary line
   creeping a short way around the ring, starting from its visible resting state. */
@media (prefers-reduced-motion: no-preference) {
  .ctx-edge { animation: ctx-creep 2.4s 0.3s ease-in-out 1 both; }
  @keyframes ctx-creep { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -36; } }
}

/* ---------- Sections ---------- */
.section { padding: 56px 0; border-top: 1px solid var(--line); }
.section-intro { color: var(--muted); font-size: 1.1rem; }

/* Services: a ruled list, name on the left and detail on the right at wide sizes */
.services { list-style: none; margin: 32px 0 0; padding: 0; border-top: 2px solid var(--ink); }
.service { display: grid; gap: 6px 40px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.service h3 { margin: 0; }
.service p { margin: 0 0 0.6em; }
.service .proof { color: var(--muted); font-size: 0.97rem; margin: 0; }
.service .proof strong { color: var(--ink); font-weight: 700; }

/* Engagement sequence: a real order, so it is numbered */
.sequence { list-style: none; counter-reset: seq; margin: 32px 0 0; padding: 0; display: grid; gap: 0; }
.sequence li {
  counter-increment: seq; position: relative; padding: 0 0 26px 58px;
  border-left: 2px solid var(--line-strong); margin-left: 19px;
}
.sequence li:last-child { border-left-color: transparent; padding-bottom: 0; }
.sequence li::before {
  content: counter(seq); position: absolute; left: -20px; top: -4px;
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--paper); border: 2px solid var(--ink);
  font-family: var(--font-display); font-weight: 800;
}
.sequence h3 { margin: 0 0 4px; font-size: 1.15rem; }
.sequence p { margin: 0; }

/* DashStar block */
.dashstar { display: grid; gap: 28px; }
.status-note {
  border-left: 6px solid var(--signal); background: var(--surface);
  padding: 14px 18px; margin: 0 0 1.2em; max-width: var(--measure);
}
.status-note p { margin: 0; }
.commitments { margin: 0; padding-left: 1.4em; }
.commitments li { margin: 0 0 0.55em; padding-left: 0.2em; max-width: 62ch; }
.never { margin-top: 1.2em; }
.never ul { margin: 0.3em 0 0; padding-left: 1.4em; }

/* About */
.about { display: grid; gap: 24px; }
.facts { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.facts li { padding: 10px 0; border-bottom: 1px solid var(--line); }

/* ---------- Footer ---------- */
.site-footer { border-top: 2px solid var(--ink); padding: 32px 0 48px; color: var(--muted); font-size: 0.95rem; }
.site-footer .wrap { display: grid; gap: 18px; }
.site-footer p { margin: 0; }
.socials { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.socials a {
  display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 700;
  min-height: 44px; padding: 0 12px 0 8px; border: 1px solid var(--line-strong); border-radius: 4px;
}
.socials a:hover { border-color: var(--ink); }
.socials svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }

/* ---------- Plain pages (privacy, sent, not sent) ---------- */
.page { padding: 40px 0 64px; }
.page h2 { font-size: 1.45rem; margin-top: 1.6em; }
.page ul { padding-left: 1.4em; max-width: var(--measure); }
.page li { margin-bottom: 0.4em; }
.updated { color: var(--muted); }

/* ---------- Intake form ---------- */
.intake-intro { max-width: var(--measure); }
.noscript-note { border-left: 6px solid var(--signal); background: var(--surface); padding: 12px 16px; }
.intake-form { margin-top: 24px; }
.intake-form fieldset {
  border: 0; border-top: 2px solid var(--ink); margin: 0 0 40px; padding: 20px 0 0; min-width: 0;
}
.intake-form legend {
  float: left; width: 100%; padding: 0; margin: 0 0 6px;
  font-family: var(--font-display); font-weight: 760; font-stretch: 112%; font-size: 1.5rem; line-height: 1.2;
}
.intake-form legend + * { clear: both; }
.step-hint { color: var(--muted); margin-bottom: 1.2em; }
.field { margin: 0 0 20px; max-width: 640px; }
.field label, .field .label { display: block; font-weight: 700; margin-bottom: 4px; }
.field .hint { display: block; color: var(--muted); font-size: 0.95rem; margin: -2px 0 6px; }
.req { color: var(--muted); font-weight: 400; }
input[type="text"], input[type="email"], input[type="tel"], input[type="date"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line-strong); border-radius: 4px; padding: 0.55em 0.7em;
}
textarea { min-height: 7.5em; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--ink); }
[aria-invalid="true"] { border-color: var(--error) !important; }
.field-error { display: block; color: var(--error); font-weight: 700; font-size: 0.95rem; margin-top: 4px; }
.field-error:empty { display: none; }
.choices { border: 0; padding: 0; margin: 0 0 20px; max-width: 640px; }
.choices legend {
  float: none; font-family: var(--font-body); font-size: 1rem; font-weight: 700; font-stretch: 100%; margin-bottom: 6px;
}
.choice { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; font-weight: 400; }
.choice input { width: 20px; height: 20px; margin: 3px 0 0; flex: none; accent-color: var(--moat); }
.criterion { border: 1px solid var(--line-strong); border-radius: 4px; padding: 16px; margin: 0 0 20px; max-width: 640px; background: var(--surface); }
.criterion h2 { font-size: 1.05rem; font-weight: 700; font-stretch: 108%; margin: 0 0 10px; }
.criterion .field { margin-bottom: 14px; }
.inline-choices { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.turnstile-slot:empty { display: none; }
.send-note { color: var(--muted); }
.send-note.noscript-note { color: var(--ink); max-width: 640px; margin-bottom: 20px; }
.consent { max-width: 640px; }

/* Stepped mode (added by js/intake.js; without JS the form is one long page) */
.stepper { list-style: none; margin: 0 0 28px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: st; }
.stepper li { counter-increment: st; }
.stepper button {
  font: inherit; font-size: 0.9rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 12px 4px 4px;
}
.stepper button::before {
  content: counter(st); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line-strong); font-weight: 700; font-size: 0.85rem;
}
.stepper button[aria-current="step"] { color: var(--signal-ink); background: var(--signal); border-color: var(--signal); font-weight: 700; }
.stepper button[aria-current="step"]::before { border-color: var(--signal-ink); }
.stepper button:disabled { cursor: not-allowed; opacity: 0.55; }
.stepper button.done { color: var(--ink); border-color: var(--ink); }
.is-stepped fieldset[data-step] { display: none; }
.is-stepped fieldset[data-step].is-current { display: block; }
.step-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.step-count { color: var(--muted); font-size: 0.95rem; margin: 0 0 4px; }
.review { max-width: 720px; }
.review h2 { font-size: 1.1rem; font-weight: 700; font-stretch: 108%; margin: 20px 0 6px; }
.review dl { margin: 0; border-top: 1px solid var(--line); }
.review div { display: grid; gap: 2px 20px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.review dt { font-weight: 700; }
.review dd { margin: 0; white-space: pre-wrap; }
.review .empty { color: var(--muted); }
.panel { border: 2px solid var(--ink); border-radius: 4px; padding: 20px; background: var(--surface); max-width: 720px; }
.panel.is-warning { border-color: var(--signal); border-left-width: 8px; }
.panel h2 { font-size: 1.4rem; margin-top: 0; }
.panel textarea { min-height: 12em; font-size: 0.95rem; }
.fallback-label { display: block; font-weight: 700; margin-top: 1em; }

/* ---------- Start a project (booking) ---------- */
.booking { max-width: 720px; }
.how-it-works { font-size: 1.15rem; }
/* BOOKING_URL is still the placeholder: hide the dead button and show the fallback.
   The fallback is visible by default, so a browser without :has() still shows a way forward. */
a[data-booking-url][href*="REPLACE-ME"] { display: none; }
.booking:has(a[data-booking-url]:not([href*="REPLACE-ME"])) .booking-soon { display: none; }
.booking-soon { border-left: 6px solid var(--signal); background: var(--surface); padding: 14px 18px; margin: 1.5em 0 0; max-width: var(--measure); }
.booking-soon p { margin: 0 0 0.5em; }
.booking-soon p:last-child { margin: 0; }
.selectable { user-select: all; -webkit-user-select: all; font-weight: 700; color: var(--ink); background: var(--paper); border: 1px dashed var(--line-strong); border-radius: 3px; padding: 0 0.3em; }
.after-booking { margin-top: 2em; padding-top: 1.2em; border-top: 1px solid var(--line); }

/* ---------- Needs brief form ---------- */
.prefill-note { border-left: 6px solid var(--signal); background: var(--surface); padding: 12px 16px; max-width: var(--measure); }
.field-row { display: flex; gap: 8px; align-items: flex-start; }
.field-row > input, .field-row > textarea { flex: 1 1 auto; min-width: 0; }
.clear-btn {
  flex: none; font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer; min-height: 44px;
  padding: 0 12px; border-radius: 4px; border: 2px solid var(--line-strong); background: transparent; color: var(--ink);
}
.clear-btn:hover { border-color: var(--ink); }
.brief-out { margin-top: 8px; }
.brief-sheet { border: 2px solid var(--ink); border-radius: 4px; background: var(--surface); padding: 20px; max-width: 760px; }
.brief-sheet h2 { margin-top: 0; }
.brief-sheet h3 { font-size: 1.1rem; margin: 1.3em 0 0.4em; }
.brief-sheet dl { margin: 0; border-top: 1px solid var(--line); }
.brief-sheet dl div { display: grid; gap: 2px 20px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.brief-sheet dt { font-weight: 700; }
.brief-sheet dd { margin: 0; white-space: pre-wrap; }
.brief-sheet .open { color: var(--muted); margin: 0.5em 0 0; }
.brief-date { color: var(--muted); }
.brief-note { color: var(--muted); max-width: var(--measure); }

/* ---------- Wider screens ---------- */
@media (min-width: 720px) {
  :root { --gutter: 28px; }
  .service { grid-template-columns: minmax(200px, 0.8fr) 2fr; }
  .about { grid-template-columns: 1.4fr 1fr; align-items: start; }
  .review div { grid-template-columns: 220px 1fr; }
  .brief-sheet dl div { grid-template-columns: 220px 1fr; }
}
@media (min-width: 960px) {
  .hero { padding: 64px 0 80px; }
  .hero .wrap { grid-template-columns: 1.15fr 0.85fr; gap: 48px; }
  .dashstar { grid-template-columns: 1fr 1fr; gap: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-nav, .socials, .button-row, .step-actions, .stepper, .clear-btn, .no-print, .brief-page .site-header, .brief-page .site-footer { display: none !important; }
  .brief-sheet { border: 0; padding: 0; }
  body { background: #fff; color: #000; }
}
