/* ==========================================================================
   Curiosity Garage — design tokens & base
   Direction: technical / workshop. Paper light theme, ink text, one signal
   accent, hairline rules, monospace for machine detail. No gradients.
   ========================================================================== */

/* ---------- self-hosted fonts ---------- */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/fonts/space-grotesk-v22-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/fonts/space-grotesk-v22-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/fonts/space-grotesk-v22-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/fonts/ibm-plex-mono-v20-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url(/assets/fonts/ibm-plex-sans-v23-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-stretch: 100%;
  font-display: swap;
  src: url(/assets/fonts/ibm-plex-sans-v23-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Colour — 4 values, all derived from a warm neutral + one signal hue */
  --paper:      oklch(0.982 0.004 85);
  --paper-2:    oklch(0.964 0.006 85);
  --ink:        oklch(0.205 0.012 265);
  --ink-2:      oklch(0.455 0.012 265);
  --line:       oklch(0.900 0.008 85);
  --line-2:     oklch(0.845 0.010 85);
  --signal:     oklch(0.575 0.152 42);
  --signal-ink: oklch(0.400 0.130 42);
  --signal-ink-hover: oklch(0.325 0.112 42);
  --signal-on-dark:   oklch(0.780 0.130 50);
  --dark:       oklch(0.185 0.012 265);
  --dark-2:     oklch(0.235 0.012 265);
  --dark-ink:   oklch(0.935 0.006 85);
  --dark-ink-2: oklch(0.755 0.008 85);
  --dark-line:  oklch(0.330 0.010 265);

  /* Type */
  --font-display: "Space Grotesk", "Helvetica Neue", sans-serif;
  --font-body:    "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;

  --fs-h1:    clamp(2.35rem, 5.6vw, 4.35rem);
  --fs-h2:    clamp(1.65rem, 3.1vw, 2.45rem);
  --fs-h3:    clamp(1.15rem, 1.6vw, 1.35rem);
  --fs-lead:  clamp(1.05rem, 1.5vw, 1.30rem);
  --fs-body:  1.0625rem;
  --fs-small: 0.875rem;
  --fs-micro: 0.75rem;

  /* Space — 8pt grid */
  --s1: 0.5rem; --s2: 1rem;  --s3: 1.5rem; --s4: 2rem;
  --s6: 3rem;   --s8: 4rem;  --s12: 6rem;
  --section-y: clamp(4rem, 8vw, 7.5rem);
  --wrap: min(1140px, 100% - 2.5rem);

  --radius: 6px;
  --shadow-1: 0 1px 2px oklch(0.2 0.01 265 / 0.05);
  --shadow-2: 0 6px 24px -12px oklch(0.2 0.01 265 / 0.22);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

/* Deliberately `auto`, not `smooth`. With the CSS smooth rule, a deep link such
   as /#contact depends on an animated scroll that some browsers and in-app
   webviews never run — the link then looks dead. Clicks are smoothed in main.js,
   where the fallback is a plain instant jump. */
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.08;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); letter-spacing: -0.032em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: 1.25; letter-spacing: -0.012em; }

p { margin: 0 0 var(--s3); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }

ul { margin: 0; padding: 0; list-style: none; }

img, svg { max-width: 100%; display: block; }

::selection { background: oklch(0.575 0.152 42 / 0.20); }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- layout ---------- */

.wrap { width: var(--wrap); margin-inline: auto; }

.section { padding-block: var(--section-y); }
.section + .section { border-top: 1px solid var(--line); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0 0 var(--s3);
}

.lead { font-size: var(--fs-lead); color: var(--ink-2); max-width: 46ch; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: var(--s1) var(--s2); z-index: 100; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* ---------- header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: oklch(0.982 0.004 85 / 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex; align-items: center; gap: var(--s4);
  min-height: 68px;
}

.wordmark {
  display: inline-flex; align-items: baseline; gap: 0.5ch;
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.0625rem; letter-spacing: -0.02em;
  text-decoration: none; white-space: nowrap;
}
.wordmark .mark {
  /* Inline CG logo mark — dark tile with orange roofline + white C/G */
  flex-shrink: 0; margin-bottom: 2px;
}
.wordmark .mark svg {
  display: block; width: 20px; height: auto;
}

.nav { margin-left: auto; display: flex; align-items: center; gap: var(--s4); }
.nav a {
  font-size: var(--fs-small); color: var(--ink-2); text-decoration: none;
  padding-block: 4px; border-bottom: 1px solid transparent;
  transition: color 160ms var(--ease), border-color 160ms var(--ease);
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

/* the nav CTA must not inherit the muted link colour */
.nav a.btn, .nav a.btn:hover { border-bottom: 0; text-decoration: none; }
.nav a.btn--primary { color: var(--paper); min-height: 40px; }
.nav a.btn--primary:hover { color: var(--paper); background: oklch(0.28 0.012 265); }

.nav-toggle {
  display: none; margin-left: auto;
  background: none; border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 7px 10px; font-family: var(--font-mono); font-size: var(--fs-micro);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); cursor: pointer;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 0.6ch;
  font-family: var(--font-body); font-size: var(--fs-small); font-weight: 500;
  padding: 0.72rem 1.15rem; border-radius: var(--radius);
  border: 1px solid transparent; text-decoration: none; cursor: pointer;
  transition: transform 160ms var(--ease), background 160ms var(--ease),
              border-color 160ms var(--ease), color 160ms var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: oklch(0.28 0.012 265); }

.btn--ghost { border-color: var(--line-2); color: var(--ink); background: transparent; }
.btn--ghost:hover { border-color: var(--ink); }

.btn--signal { background: var(--signal-ink); color: var(--paper); }
.btn--signal:hover { background: var(--signal-ink-hover); }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }

/* ---------- hero ---------- */

.hero { padding-block: clamp(3.5rem, 9vw, 8rem) clamp(2.5rem, 6vw, 5rem); }
.hero h1 { max-width: 20ch; }
.hero .lead { margin-top: var(--s4); }
.hero .btn-row { margin-top: var(--s6); }

.hero-note {
  margin-top: var(--s4); font-family: var(--font-mono);
  font-size: var(--fs-micro); color: var(--ink-2); letter-spacing: 0.02em;
}
.hero-note a { color: var(--signal-ink); text-decoration: none; border-bottom: 1px solid var(--line-2); }
.hero-note a:hover { border-bottom-color: var(--signal); }

/* ---------- hero architecture diagram (inline SVG, P1) ---------- */

.hero-figure { margin: var(--s8) 0 0; max-width: 820px; }
.hero-figure svg { width: 100%; height: auto; }
.hero-figure figcaption {
  margin-top: var(--s3); font-family: var(--font-mono);
  font-size: var(--fs-micro); color: var(--ink-2); letter-spacing: 0.02em;
}

/* ---------- service cards ---------- */

.cards { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
@media (min-width: 860px) { .cards { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--paper); padding: var(--s6) var(--s4) var(--s6);
  display: flex; flex-direction: column; gap: var(--s3);
  box-shadow: var(--shadow-1);
  transition: background 200ms var(--ease), box-shadow 200ms var(--ease), transform 160ms var(--ease);
}
.card:hover {
  background: var(--paper-2);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}

.card .num {
  font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: 0.14em;
  color: var(--signal-ink); margin: 0;
}
.card h3 { max-width: 22ch; }
.card p { color: var(--ink-2); font-size: 0.98rem; }
.card ul { display: grid; gap: 0.55rem; margin-top: auto; padding-top: var(--s2); }
.card li {
  font-size: var(--fs-small); color: var(--ink-2);
  padding-left: 1.15rem; position: relative;
}
.card li::before {
  content: ""; position: absolute; left: 0; top: 0.62em;
  width: 6px; height: 1px; background: var(--line-2);
}
.card .card-link {
  margin-top: var(--s3); font-size: var(--fs-small); font-weight: 500;
  color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-2);
  align-self: flex-start; padding-bottom: 2px;
}

/* ---------- lock glyph in rescue timeline ---------- */

.lock-glyph {
  display: block;
  width: 24px;
  height: 24px;
  margin-bottom: var(--s2);
  color: var(--signal);
}

/* ---------- card icons (inline SVGs) ---------- */

.card-icon {
  display: block;
  color: var(--signal);
  margin-bottom: var(--s3);
  line-height: 0;
}
.card-icon svg { width: 48px; height: 48px; }
.card .card-link:hover { border-bottom-color: var(--signal); color: var(--signal-ink); }

/* ---------- dark rescue band ---------- */

.band { background: var(--dark); color: var(--dark-ink); border-top: 1px solid var(--dark); }
.band .eyebrow { color: var(--dark-ink-2); }
.band .lead { color: var(--dark-ink-2); }
.band h2 { color: var(--dark-ink); }
.band a { color: var(--dark-ink); }

/* Horizontal chevron/timeline for the 5-step rescue flow */
.timeline {
  margin-top: var(--s8); position: relative; overflow-x: auto; padding-bottom: var(--s4);
  -webkit-overflow-scrolling: touch;
}
.timeline-track { display: flex; gap: 0; min-width: max-content; }
.timeline-node {
  flex: 0 0 190px; background: var(--dark-2); border: 1px solid var(--dark-line);
  padding: var(--s3) var(--s3) var(--s4); position: relative;
}
.timeline-node .num {
  font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: 0.12em;
  color: var(--signal-on-dark); margin: 0 0 var(--s2);
}
.timeline-node h3 {
  font-size: 1rem; color: var(--dark-ink); margin: 0 0 var(--s2); line-height: 1.25;
}
.timeline-node p {
  font-size: var(--fs-small); color: var(--dark-ink-2); margin: 0; line-height: 1.5;
}
.timeline-arrow {
  display: flex; align-items: center; justify-content: center; width: 44px; flex-shrink: 0;
}
.timeline-arrow svg { width: 40px; height: 16px; }
@media (max-width: 900px) {
  /* Fixed 280px nodes overflow the container at these widths (5x280 + arrows > 100%),
     so the nodes must be allowed to shrink. Was flex: 0 0 280px. */
  .timeline-node { flex: 1 1 0; min-width: 0; }
  .timeline-arrow { width: 28px; }
  .timeline-arrow svg { width: 30px; height: 12px; }
}
@media (max-width: 720px) {
  /* Stacked at these widths, so min-width:max-content (which the horizontal strip needs)
     makes the track as wide as the longest paragraph — 762px at a 390px viewport — and
     .timeline's overflow-x then clips the nodes off-screen. Drop the floor and the scroller. */
  .timeline { overflow-x: visible; }
  .timeline-track { flex-direction: column; gap: 0; min-width: 0; width: 100%; }
  .timeline-node { flex: 0 0 auto; width: 100%; min-width: 0; }
  .timeline-arrow { transform: rotate(90deg); width: 30px; height: 60px; }
}

.guarantees { margin-top: var(--s8); display: grid; gap: var(--s3) var(--s6); }
@media (min-width: 720px) { .guarantees { grid-template-columns: repeat(2, 1fr); } }
.guarantees li {
  font-size: var(--fs-small); color: var(--dark-ink-2);
  padding-left: 1.6rem; position: relative;
}
.guarantees li::before {
  content: ""; position: absolute; left: 0; top: 0.55em;
  width: 10px; height: 1px; background: var(--signal);
}

/* ---------- principles ---------- */

.principles { display: grid; gap: var(--s6); }
@media (min-width: 860px) { .principles { grid-template-columns: repeat(3, 1fr); } }
.principle .num { font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: 0.14em; color: var(--ink-2); margin: 0 0 var(--s2); }
.principle h3 { margin-bottom: var(--s2); }
.principle p { color: var(--ink-2); font-size: 0.98rem; }

/* ---------- contact ---------- */

.contact-grid { display: grid; gap: var(--s8); }
@media (min-width: 900px) { .contact-grid { grid-template-columns: 1.1fr 0.9fr; align-items: start; } }

.contact-panel {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper-2); padding: var(--s4);
}
.contact-panel dl { margin: 0; display: grid; gap: var(--s3); }
.contact-panel dt { font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 4px; }
.contact-panel dd { margin: 0; font-size: 0.98rem; }

/* ---------- sticky-header anchor offset ---------- */

section[id] { scroll-margin-top: 88px; }

/* ---------- legal pages (privacy, terms) ---------- */

.legal { max-width: 68ch; }
.legal h1 { font-size: var(--fs-h2); }
.legal h2 { font-size: var(--fs-h3); margin-top: var(--s6); }
.legal p { color: var(--ink-2); }
.legal a { color: var(--signal-ink); }
.legal-meta {
  font-family: var(--font-mono); font-size: var(--fs-micro);
  color: var(--ink-2); letter-spacing: 0.02em; margin-bottom: var(--s6);
}

/* ---------- footer ---------- */

.site-footer { border-top: 1px solid var(--line); padding-block: var(--s8) var(--s6); }
.footer-grid { display: grid; gap: var(--s6); }
@media (min-width: 860px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer-grid h4 { font-size: var(--fs-micro); font-family: var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); font-weight: 400; margin-bottom: var(--s2); }
.footer-grid li { margin-bottom: 0.5rem; }
.footer-grid a { font-size: var(--fs-small); color: var(--ink-2); text-decoration: none; }
.footer-grid a:hover { color: var(--ink); text-decoration: underline; }
.footer-note { margin-top: var(--s6); padding-top: var(--s3); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); justify-content: space-between; }
.footer-note p, .footer-note li { font-size: var(--fs-micro); color: var(--ink-2); margin: 0; font-family: var(--font-mono); }

.todo {
  font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--signal-ink);
  border: 1px dashed var(--line-2); border-radius: 4px; padding: 2px 6px;
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- responsive nav ---------- */

@media (max-width: 780px) {
  .nav-toggle { display: inline-block; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: var(--s2) 1.25rem var(--s3);
  }
  .nav[data-open="true"] { display: flex; }
  /* No-JS fallback: without script the toggle is inert, so show the nav as a plain
     wrapped list. Keyed off html.js, set by assets/js/head.js — a <noscript><style>
     block would be blocked by style-src 'self'. */
  html:not(.js) .nav-toggle { display: none; }
  html:not(.js) .nav { position: static; display: flex; flex-wrap: wrap; }
  .nav a { padding: 0.6rem 0; font-size: 0.95rem; width: 100%; border-bottom: 1px solid var(--line); }
  .nav .btn { margin-top: var(--s2); min-height: 44px; justify-content: center; }
  .site-header .wrap { position: relative; }
}

/* ---------- small margins for lead text & containers ---------- */

.mt-sm  { margin-top: var(--s2); }       /* 1rem */
.mt-md  { margin-top: var(--s3); }       /* 1.5rem */
.mt-lg  { margin-top: var(--s4); }       /* 2rem */
.mt-xl  { margin-top: 3.5rem; }

.footer-brand {
  font-size: 0.875rem;
  color: var(--ink-2);
  max-width: 34ch;
}


/* ---------- access-lifecycle diagram ----------
   Rules moved out of an inline <style> inside the SVG. The site CSP is
   `style-src 'self'`, which blocks inline <style> elements — including one
   inside an inline <svg> — so the diagram would lose all styling in production.
   Colours are the designer's originals, unchanged. */

.access-lifecycle .bg        { fill:#21232a; stroke:#53575e; stroke-width:1; }
.access-lifecycle .box-out   { fill:none; stroke:#cfccc5; stroke-width:1; }
.access-lifecycle .box-sig   { fill:none; stroke:#c05323; stroke-width:1.5; }
.access-lifecycle .arrow     { fill:none; stroke:#c05323; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
.access-lifecycle .lock-box  { fill:none; stroke:#7d2600; stroke-width:1.5; }
.access-lifecycle .lock-arc  { fill:none; stroke:#7d2600; stroke-width:1.25; stroke-linecap:round; }
.access-lifecycle .txt-main  { font-family:'Space Grotesk','Helvetica Neue',sans-serif; font-weight:600; }
.access-lifecycle .txt-head  { font-size:18px; fill:#ebe9e5; }
.access-lifecycle .txt-sig   { font-size:18px; fill:#c05323; }
.access-lifecycle .txt-sub   { font-size:13px; fill:#b2afaa; }
.access-lifecycle .txt-sm    { font-size:11px; fill:#b2afaa; opacity:.6; font-family:'IBM Plex Mono','Courier New',monospace; }
.access-lifecycle .txt-circle{ font-size:16px; fill:#c05323; font-family:'IBM Plex Mono','Courier New',monospace; }
.access-lifecycle .circle-sig{ fill:none; stroke:#c05323; stroke-width:1.5; }

.figure-note {
  margin-top: var(--s3);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--dark-ink-2);
  letter-spacing: 0.02em;
}

/* ---------- 404 page ---------- */

.error-page { max-width: 52ch; margin: 0 auto; text-align: center; padding: var(--s8) 0; }
.error-page .code-big {
  font-family: var(--font-mono);
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--signal);
  margin: 0 0 var(--s3);
}
.error-page h1 { font-size: var(--fs-h2); margin: 0 0 var(--s3); }
.error-page p  { color: var(--ink-2); margin: 0 0 var(--s3); }

/* ---------- logo mark (replacing CG monospace chip) ---------- */

.wordmark .cg-mark {
  display: inline-block;
  vertical-align: middle;
  line-height: 0;
}
