/* Fourth Sigma site styles.
   Every text color meets WCAG 2.2 AA (4.5:1) and every control edge meets 3:1 on
   --bg, --surface and --surface-raised. Change colors only through the tokens below.
   Paths are relative to this file (assets/css/), so pages work when opened from a folder. */

/* ---------- Fonts (self-hosted, SIL Open Font License; licenses in assets/fonts) ---------- */
@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk-latin-wght.woff2") format("woff2");
  font-weight: 300 700; font-style: normal; font-display: swap;
  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: "Source Serif 4";
  src: url("../fonts/source-serif-4-latin-opsz.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
  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: "Source Serif 4";
  src: url("../fonts/source-serif-4-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 900; font-style: italic; font-display: swap;
  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";
  src: url("../fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  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";
  src: url("../fonts/ibm-plex-mono-latin-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
  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;
}
/* Space Grotesk and IBM Plex Mono have no Greek letters, so σ and Σ come from Source Serif 4. */
@font-face {
  font-family: "Sigma";
  src: url("../fonts/source-serif-4-greek-wght.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
  unicode-range: U+03A3, U+03C3;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #0f1512;
  --surface: #141c18;
  --surface-raised: #182119;
  --rule: #263129;          /* decorative dividers only */
  --control: #5b7463;       /* borders that identify inputs and buttons */
  --ink: #e9ede8;
  --ink-2: #9fada2;
  --ink-3: #7f8e83;
  --accent: #d99a3c;
  --accent-hover: #e4a94f;
  --on-accent: #0f1512;
  --high: #c97558;
  --high-edge: #a8573a;

  --font-sans: "Space Grotesk", "Sigma", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Source Serif 4", "Sigma", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", "Sigma", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gutter-left: max(clamp(16px, 4vw, 48px), env(safe-area-inset-left, 0px));
  --gutter-right: max(clamp(16px, 4vw, 48px), env(safe-area-inset-right, 0px));
  --section-pad: clamp(64px, 8vw, 112px);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--accent); }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3 { text-wrap: balance; }
p { margin: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 20;
  padding: 10px 14px; background: var(--surface); color: var(--ink);
  border: 2px solid var(--accent); font-family: var(--font-mono); font-size: 14px;
}
.skip-link:focus { left: var(--gutter-left); }

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: var(--gutter-left);
  padding-right: var(--gutter-right);
}

/* ---------- Type helpers ---------- */
.label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.label-quiet { color: var(--ink-3); font-size: 11px; }
h2.label, h3.label { margin: 0; font-weight: 500; }
.mono { font-family: var(--font-mono); }
.fine { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.h2 {
  margin: 0;
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.lead { font-size: 18px; line-height: 1.65; color: var(--ink-2); max-width: 36em; }
.text-link { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; text-decoration: none; padding: 6px 0; }
.text-link::after { content: "→"; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 26px;
  border: 1px solid var(--control); border-radius: 0;
  background: transparent; color: var(--ink);
  font: 500 16px/1 var(--font-sans);
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-raised); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-small { min-height: 44px; padding: 0 18px; font-size: 15px; }
.btn[disabled] { opacity: 0.7; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Header and navigation ---------- */
.site-header { border-bottom: 1px solid var(--rule); }
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 32px;
  padding-top: max(16px, env(safe-area-inset-top, 0px)); padding-bottom: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; min-height: 44px; }
.brand:hover { color: var(--ink); }
.mark {
  width: 36px; height: 36px; flex-shrink: 0;
  border: 1.5px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 14px; color: var(--accent);
}
.mark-small { width: 30px; height: 30px; font-size: 12px; }
.wordmark { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }

.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; }
.nav-list { display: flex; flex-wrap: wrap; gap: 4px 28px; margin: 0; padding: 0; list-style: none; }
.nav-list a {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--ink-2); text-decoration: none; font-size: 15px;
  border-bottom: 2px solid transparent;
}
.nav-list a:hover { color: var(--ink); }
.nav-list a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

.menu-toggle {
  display: none;
  min-height: 44px; padding: 0 16px;
  background: transparent; border: 1px solid var(--control); border-radius: 0;
  color: var(--ink); font: 500 15px var(--font-sans); cursor: pointer;
  align-items: center; gap: 10px;
}
.menu-toggle .bars { display: inline-flex; flex-direction: column; gap: 4px; }
.menu-toggle .bars span { display: block; width: 16px; height: 1.5px; background: currentColor; }

/* Phone and tablet: the menu collapses behind a button once JavaScript has loaded. */
@media (max-width: 899px) {
  .js .menu-toggle { display: inline-flex; }
  .js .site-nav { display: none; }
  .js.nav-open .site-nav {
    display: flex; flex-direction: column; align-items: stretch; gap: 12px;
    width: 100%; padding: 8px 0 12px; border-top: 1px solid var(--rule);
  }
  .js.nav-open .nav-list { flex-direction: column; gap: 0; }
  .js.nav-open .nav-list a { width: 100%; font-size: 17px; border-bottom: 1px solid var(--rule); }
  .js.nav-open .nav-list a[aria-current="page"] { color: var(--accent); }
  .js.nav-open .site-nav .btn { align-self: flex-start; }
}

/* ---------- Sections ---------- */
.section { border-top: 1px solid var(--rule); }
.section > .wrap { padding-top: var(--section-pad); padding-bottom: var(--section-pad); }
.section-tint { background: var(--surface); }
.section-head { display: flex; flex-direction: column; gap: 16px; max-width: 800px; margin-bottom: 40px; }
.section-foot { margin-top: 32px; }
.split { display: flex; flex-wrap: wrap; gap: 32px 64px; }
.split > * { flex: 1 1 380px; min-width: 0; }
.split > .wide { flex: 2 1 560px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { gap: 18px; }

/* ---------- Page heading (inner pages) ---------- */
.page-hero .wrap { padding-top: clamp(56px, 8vw, 104px); padding-bottom: clamp(48px, 6vw, 80px); display: flex; flex-direction: column; gap: 20px; }
.page-hero h1 {
  margin: 0; max-width: 18em;
  font-family: var(--font-serif); font-weight: 500;
  font-size: clamp(40px, 5.4vw, 68px); line-height: 1.05; letter-spacing: -0.02em;
}
.page-hero .lead { font-size: 19px; max-width: 38em; }
.notice {
  align-self: flex-start;
  display: inline-flex; gap: 10px; align-items: baseline;
  padding: 10px 14px; border: 1px solid var(--rule); background: var(--surface);
  font-size: 14px; line-height: 1.5; color: var(--ink-2);
}
.notice .label { color: var(--accent); flex-shrink: 0; }

/* ---------- Home hero ---------- */
.hero .wrap {
  display: flex; flex-wrap: wrap; align-items: center; gap: 56px 64px;
  padding-top: clamp(56px, 8vw, 112px); padding-bottom: clamp(56px, 7vw, 96px);
}
.hero-copy { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.hero h1 {
  margin: 0;
  font-family: var(--font-serif); font-weight: 500;
  font-size: clamp(46px, 6.2vw, 84px); line-height: 1.02; letter-spacing: -0.02em;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.hero-lead { font-size: 19px; line-height: 1.6; color: var(--ink-2); max-width: 34em; }
.hero .actions { padding-top: 8px; }

.panel { flex: 1 1 460px; min-width: 0; margin: 0; background: var(--surface); border: 1px solid var(--rule); }
.panel-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px;
  padding: 12px 16px; border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2);
}
.panel-head .quiet { color: var(--ink-3); }
.chart { padding: 16px 12px 8px; }
.chart svg { display: block; width: 100%; height: auto; }
.alert { border-top: 1px solid var(--rule); padding: 18px 16px 20px; display: flex; flex-direction: column; gap: 16px; }
.alert-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.alert-title { margin-top: 4px; font-family: var(--font-serif); font-size: 20px; line-height: 1.3; }
.badge {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 4px 10px; border: 1px solid var(--high-edge); color: var(--high);
  font-family: var(--font-mono); font-size: 13px;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--high); }
.facts { margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.facts > div { display: flex; flex-wrap: wrap; gap: 2px 16px; }
.facts dt { flex: 0 0 120px; font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); padding-top: 1px; }
.facts dd { flex: 1 1 240px; margin: 0; }

/* ---------- Hairline card grids ---------- */
.grid-lines {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-wrap: wrap; gap: 1px;
  background: var(--rule); border: 1px solid var(--rule);
}
.grid-lines > * { flex: 1 1 260px; min-width: 0; background: var(--bg); padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.section-tint .grid-lines > * { background: var(--surface); }
.grid-lines.features > * { flex-basis: 240px; background: var(--surface); padding: 28px 24px 32px; gap: 12px; }
.grid-lines h3 { margin: 0; font-size: 18px; line-height: 1.3; font-weight: 600; }
.grid-lines.features h3 { font-size: 21px; line-height: 1.25; }
.grid-lines p { font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.grid-lines h3 a { color: var(--ink); text-decoration: none; }
.grid-lines h3 a::after { content: " →"; color: var(--ink-3); }
.grid-lines h3 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.grid-lines.wide-cards > * { flex-basis: 440px; padding: 32px 28px; gap: 12px; scroll-margin-top: 24px; }
.grid-lines.wide-cards h2 { margin: 0; font-size: 24px; line-height: 1.25; font-weight: 600; }

/* ---------- Lists ---------- */
.ticks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.ticks li { position: relative; padding-left: 22px; font-size: 15px; line-height: 1.6; color: var(--ink); }
.ticks li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 8px; height: 8px; border: 1.5px solid var(--accent); }
.ticks.large li { font-size: 17px; }
.chips { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 6px 12px; border: 1px solid var(--control); font-family: var(--font-mono); font-size: 13px; color: var(--ink); }

/* ---------- Steps ---------- */
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 40px 48px; }
.steps li { flex: 1 1 280px; min-width: 0; border-top: 1px solid var(--control); padding-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.steps .step-no { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.steps h3 { margin: 0; font-size: 24px; font-weight: 600; }
.steps p { font-size: 16px; line-height: 1.65; color: var(--ink-2); }

/* ---------- Definition lists ---------- */
.spec { margin: 0; border-top: 1px solid var(--rule); }
.spec > div { display: flex; flex-wrap: wrap; gap: 6px 32px; padding: 20px 0; border-bottom: 1px solid var(--rule); }
.spec dt {
  flex: 0 0 180px; padding-top: 3px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3);
}
.spec dd { flex: 1 1 320px; min-width: 0; margin: 0; font-size: 16px; line-height: 1.6; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--rule); }
.table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 15px; }
.table caption { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.table th, .table td { text-align: left; vertical-align: top; padding: 14px 16px; border-bottom: 1px solid var(--rule); line-height: 1.55; }
.table thead th {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3);
  background: var(--surface);
}
.table tbody th { font-weight: 600; white-space: nowrap; }
.table tbody tr:last-child th, .table tbody tr:last-child td { border-bottom: 0; }
.table td { color: var(--ink-2); }

/* ---------- Call to action band ---------- */
.cta-band { border-top: 1px solid var(--rule); background: var(--surface); }
.cta-band .wrap {
  padding-top: clamp(56px, 7vw, 96px); padding-bottom: clamp(56px, 7vw, 96px);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px 48px;
}
.cta-band h2 {
  margin: 0; max-width: 16em;
  font-family: var(--font-serif); font-weight: 500;
  font-size: clamp(32px, 3.8vw, 48px); line-height: 1.08; letter-spacing: -0.015em;
}
.cta-band p { margin-top: 12px; color: var(--ink-2); font-size: 17px; }

/* ---------- Signup form ---------- */
.signup { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.field .optional { text-transform: none; letter-spacing: 0; color: var(--ink-3); }
.field-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.captcha { min-height: 78px; max-width: 100%; }
.captcha.compact { min-height: 144px; }
.input {
  min-height: 52px; width: 100%; padding: 0 16px; margin: 0;
  background: var(--bg); border: 1px solid var(--control); border-radius: 0;
  color: var(--ink); font: 400 16px var(--font-sans);
  -webkit-appearance: none; appearance: none;
}
select.input {
  padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.input::placeholder { color: var(--ink-3); opacity: 1; }
.input[aria-invalid="true"] { border-color: var(--high); }
.field-error, .form-status[data-state="error"] { color: var(--high); font-size: 14px; }
.form-status:empty { display: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-card { background: var(--surface); border: 1px solid var(--rule); padding: clamp(20px, 3vw, 32px); }
.signup-done { display: flex; flex-direction: column; gap: 10px; }
.signup-done h2 { margin: 0; font-family: var(--font-serif); font-weight: 500; font-size: 28px; }
.signup-done p { color: var(--ink-2); }
.note { font-size: 13px; line-height: 1.6; color: var(--ink-3); }

/* ---------- Prose (privacy, thanks, 404) ---------- */
.prose { max-width: 65ch; display: flex; flex-direction: column; gap: 16px; font-size: 17px; line-height: 1.7; color: var(--ink-2); }
.prose h2 { margin: 24px 0 0; font-size: 22px; font-weight: 600; color: var(--ink); }
.prose ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.prose strong { color: var(--ink); font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); }
.footer-top { display: flex; flex-wrap: wrap; gap: 40px 64px; padding-top: 56px; padding-bottom: 40px; }
.footer-brand { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.footer-brand .row { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 600; }
.footer-col { flex: 0 1 180px; min-width: 140px; display: flex; flex-direction: column; gap: 4px; }
.footer-col h2 { margin: 0 0 8px; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.footer-col ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.footer-col a { display: inline-flex; align-items: center; min-height: 36px; color: var(--ink-2); text-decoration: none; font-size: 15px; }
.footer-col a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 48px;
  padding-top: 24px; padding-bottom: max(40px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--rule);
}
.footer-legal { flex: 1 1 420px; min-width: 0; max-width: 52em; font-size: 13px; line-height: 1.65; color: var(--ink-3); }
