/* Grounded — shared design system. Single source of truth. */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/inter-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/instrument-serif-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/instrument-serif-italic.woff2') format('woff2');
}

:root {
  --bg: #FAF7F1;
  --bg-alt: #F2ECDE;
  --card: #FFFFFF;
  --ink: #0F1416;
  --ink-dim: #3F4A55;
  --ink-soft: #5F6B77;
  --leaf: #2E7D5B;
  --leaf-soft: #DFF2E7;
  --leaf-deep: #1E5A3F;
  --line: rgba(15, 20, 22, 0.08);
  --line-strong: rgba(15, 20, 22, 0.16);
  --shadow-sm: 0 1px 2px rgba(15, 20, 22, 0.04), 0 1px 3px rgba(15, 20, 22, 0.05);
  --shadow-md: 0 4px 8px rgba(15, 20, 22, 0.05), 0 8px 24px rgba(15, 20, 22, 0.08);
  --shadow-lg: 0 24px 48px -12px rgba(15, 20, 22, 0.22);
  --shadow-device: 0 40px 80px -20px rgba(15, 20, 22, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --radius: 20px;
  --radius-sm: 12px;
  --radius-pill: 999px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1113;
    --bg-alt: #151A1D;
    --card: #181D20;
    --ink: #ECEEF0;
    --ink-dim: #A8B0B8;
    --ink-soft: #6F7883;
    --leaf: #6FC08F;
    --leaf-soft: #1A2B23;
    --leaf-deep: #84D1A2;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.15);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.55);
    --shadow-device: 0 40px 80px -20px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}

img { display: block; max-width: 100%; height: auto; }
a { color: var(--leaf); text-decoration: none; }
a:hover { opacity: .85; }
h1, h2, h3, .lede, .section-lede, blockquote { text-wrap: balance; }
p, li { text-wrap: pretty; }

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  top: -48px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* Buttons */
button, .btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 0;
  padding: 14px 22px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease, border-color .2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); opacity: 1; }
.btn-primary:focus-visible { outline: 2px solid var(--leaf); outline-offset: 3px; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--card); border-color: var(--ink); opacity: 1; }
.btn-ghost:focus-visible { outline: 2px solid var(--leaf); outline-offset: 3px; }

.container { max-width: 1120px; margin-inline: auto; padding-inline: 24px; }
.container-narrow { max-width: 760px; margin-inline: auto; padding-inline: 24px; }

/* Nav (shared across all pages) */
nav.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
@supports not (backdrop-filter: blur(1px)) {
  nav.site-nav { background: var(--bg); }
}
nav.site-nav .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}
.brand:hover { opacity: 1; color: var(--ink); }
.nav-links {
  display: none;
  gap: 20px;
}
.nav-links a {
  color: var(--ink-dim);
  font-size: 14.5px;
  font-weight: 500;
}
.nav-links a:hover { color: var(--ink); opacity: 1; }
@media (min-width: 720px) { .nav-links { display: flex; } }
@media (min-width: 900px) { .nav-links { gap: 28px; } }
.nav-back {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-dim);
  text-decoration: none;
}
.nav-back:hover { color: var(--ink); opacity: 1; }

/* Footer */
footer.site-footer {
  border-top: 1px solid var(--line);
  padding: 48px 0 64px;
  background: var(--bg-alt);
}
footer.site-footer .foot {
  display: grid;
  gap: 40px;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) { footer.site-footer .foot { grid-template-columns: 2fr 1fr 1fr 1fr; } }
footer.site-footer h4 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
  margin-bottom: 14px;
}
footer.site-footer ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
footer.site-footer a {
  color: var(--ink-dim);
  font-size: 14.5px;
  text-decoration: none;
}
footer.site-footer a:hover { color: var(--ink); opacity: 1; }
.foot-brand { max-width: 36ch; }
.foot-brand p {
  color: var(--ink-dim);
  font-size: 14px;
  line-height: 1.6;
  margin-top: 12px;
}
.foot-bottom {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  color: var(--ink-soft);
  font-size: 13px;
}

/* Legal / reading pages — shared header + typography */
header.page {
  padding: 64px 0 40px;
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--leaf);
  margin-bottom: 16px;
  display: inline-block;
}
header.page h1 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.02;
  margin-bottom: 16px;
}
header.page .meta {
  font-size: 14px;
  color: var(--ink-soft);
}
header.page .lede {
  font-size: 18px;
  color: var(--ink-dim);
  line-height: 1.55;
  margin-top: 16px;
  max-width: 58ch;
}

/* Reading content (privacy, terms) */
main.reading { padding: 56px 0 80px; }
main.reading h2 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: 32px;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 48px 0 16px;
  color: var(--ink);
}
main.reading h2:first-child { margin-top: 0; }
main.reading h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 32px 0 10px;
  color: var(--ink);
}
main.reading p, main.reading li {
  color: var(--ink-dim);
  font-size: 16px;
  line-height: 1.7;
}
main.reading p { margin-bottom: 16px; }
main.reading ul { padding-left: 20px; margin-bottom: 20px; }
main.reading li { margin-bottom: 8px; }
main.reading strong { color: var(--ink); font-weight: 600; }
main.reading code {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 14px;
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 4px;
}
main.reading a { color: var(--leaf); text-decoration: underline; text-underline-offset: 3px; }
main.reading a:hover { color: var(--leaf-deep); }

.tldr {
  background: var(--leaf-soft);
  border: 1px solid color-mix(in oklab, var(--leaf) 35%, transparent);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 48px;
}
.tldr h2 {
  margin: 0 0 12px !important;
  font-size: 22px !important;
  color: var(--leaf) !important;
}
.tldr p { margin: 0; color: var(--ink); font-size: 15.5px; }

/* Reduced-motion override */
@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;
  }
}
