/* === tokens (set by React inline-style via CSS vars on :root) === */
:root {
  --bg: #0e1116;
  --bg-soft: #141821;
  --surface: #181c25;
  --surface-2: #1f242f;
  --border: #262b37;
  --border-strong: #353c4b;
  --text: #ecedf0;
  --text-muted: #8a91a1;
  --text-dim: #5b6273;
  --accent: #e07a4c;
  --accent-soft: rgba(224, 122, 76, 0.14);
  --accent-quiet: rgba(224, 122, 76, 0.5);

  --font-sans: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --density-pad: 1;   /* multiplier */
  --density-text: 1;  /* multiplier on body */
  --gutter: 28px;
  --maxw: 1180px;
}

[data-theme="light"] {
  --bg: #f3f1ec;
  --bg-soft: #ebe9e3;
  --surface: #ffffff;
  --surface-2: #f7f5f0;
  --border: #d9d5cc;
  --border-strong: #b9b4a8;
  --text: #1a1d24;
  --text-muted: #5b6273;
  --text-dim: #8b919e;
  --accent: #c75a2f;
  --accent-soft: rgba(199, 90, 47, 0.12);
  --accent-quiet: rgba(199, 90, 47, 0.45);
}

[data-type="serif"] {
  --font-display: "Instrument Serif", "Fraunces", Georgia, serif;
}
[data-type="fraunces"] {
  --font-display: "Fraunces", Georgia, serif;
  --font-sans: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: calc(16px * var(--density-text));
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
a { color: inherit; }
a.no-link { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; }

::selection { background: var(--accent); color: #fff; }

/* tiny scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

/* ---------- layout primitives ---------- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(16px) saturate(140%);
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 18px;
  cursor: pointer;
  background: none; border: 0; color: inherit; padding: 0;
}
.brand__dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.brand, .nav > a {
  text-decoration: none;
}
.nav { display: flex; align-items: center; gap: calc(28px * var(--density-pad)); }
.nav-toggle {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface) 82%, transparent);
  color: var(--text);
  cursor: pointer;
}
.nav-toggle__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.nav-toggle__icon {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}
.nav-toggle__icon span {
  display: block;
  width: 12px;
  height: 1px;
  background: currentColor;
  transition: transform 160ms ease, opacity 160ms ease;
}
.nav__link {
  background: none; border: 0; padding: 0; color: var(--text-muted);
  font-size: 14px; letter-spacing: 0.01em; cursor: pointer;
  transition: color 120ms ease;
  position: relative;
}
.nav__link:hover { color: var(--text); }
.nav__link[aria-current="page"] { color: var(--text); }
.nav__link[aria-current="page"]::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -22px; height: 2px;
  background: var(--accent);
}

/* ---------- type ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
}
.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}
.mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.divider { border-top: 1px solid var(--border); margin: 0; }

/* ---------- buttons / chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent; color: var(--text);
  cursor: pointer; font-size: 13px;
  transition: all 140ms ease;
}
.btn:hover { border-color: var(--accent-quiet); color: var(--accent); }
.btn--solid { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--solid:hover { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn--ghost { border: 0; padding: 8px 10px; color: var(--text-muted); }
.btn--ghost:hover { color: var(--text); background: var(--surface); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 999px;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-muted);
  background: transparent;
}
.chip--active { color: var(--accent); border-color: var(--accent-quiet); }

/* ---------- placeholder images ---------- */
.ph {
  position: relative;
  background:
      repeating-linear-gradient(135deg,
      color-mix(in oklab, var(--text-muted) 8%, transparent) 0 2px,
      transparent 2px 12px),
      var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono); font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  overflow: hidden;
}
.ph__label {
  background: var(--bg);
  padding: 3px 8px; border: 1px solid var(--border);
  border-radius: 4px;
  letter-spacing: 0.04em;
}

/* ---------- footer ---------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 56px 0 28px;
  background: var(--bg-soft);
}
.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 22px;
  flex-wrap: wrap;
}
.footer-links {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.footer-sep {
  color: var(--text-dim);
  font-size: 12px;
}
@media (max-width: 760px) {
  .site-footer .container > div:first-child {
    grid-template-columns: 1fr !important;
    text-align: left !important;
  }
  .site-footer .container > div:first-child > div:last-child {
    text-align: left !important;
  }
}

/* ---------- newsletter ---------- */
.newsletter {
  display: flex; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px;
  border-radius: 999px;
  max-width: 420px;
}
.newsletter input {
  flex: 1; border: 0; background: transparent;
  padding: 10px 14px; color: var(--text);
  font: inherit; outline: none; font-size: 14px;
}
.newsletter input::placeholder { color: var(--text-dim); }
.newsletter button {
  border: 0; background: var(--accent); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 13px;
  cursor: pointer; font-weight: 500;
}
.newsletter button:hover { filter: brightness(1.08); }

/* ---------- socials ---------- */
.socials { display: flex; flex-wrap: wrap; gap: 10px; }
.social {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 140ms ease;
  background: transparent;
}
.social:hover { color: var(--accent); border-color: var(--accent-quiet); }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

/* shared section spacing */
.section { padding: calc(80px * var(--density-pad)) 0; }
.section--tight { padding: calc(48px * var(--density-pad)) 0; }
.section-head {
  display: flex; align-items: end; justify-content: space-between; gap: 24px;
  margin-bottom: calc(36px * var(--density-pad));
}
.section-head h2 { font-size: clamp(28px, 3.2vw, 40px); }

/* ---------- modal / drawer ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 60;
  background: color-mix(in oklab, #000 60%, transparent);
  backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 56px 24px;
  overflow-y: auto;
  animation: fadeIn 180ms ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal {
  width: 100%; max-width: 820px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  animation: slideUp 220ms cubic-bezier(.2,.7,.2,1) both;
}
.modal__close {
  position: absolute; top: 16px; right: 18px;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}

/* utility */
.row { display: flex; align-items: center; }
.row--gap { gap: 12px; }
.stack > * + * { margin-top: 12px; }
.hide-mobile { }
@media (max-width: 760px) { .hide-mobile { display: none !important; } }

@media (max-width: 760px) {
  .site-header {
    backdrop-filter: none;
    background: color-mix(in oklab, var(--bg) 96%, transparent);
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    display: grid;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: color-mix(in oklab, var(--surface) 94%, transparent);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 180ms ease, transform 180ms ease, visibility 0s linear 180ms;
  }

  .site-header.is-nav-open .nav {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity 180ms ease, transform 180ms ease;
  }

  .nav__link {
    display: block;
    padding: 12px 14px;
    border-radius: 12px;
    background: transparent;
  }

  .nav__link:hover,
  .nav__link[aria-current="page"] {
    background: var(--surface-2);
  }

  .nav__link[aria-current="page"]::after {
    display: none;
  }

  .site-header.is-nav-open .nav-toggle__icon span:first-child {
    transform: translateY(2.5px) rotate(45deg);
  }

  .site-header.is-nav-open .nav-toggle__icon span:last-child {
    transform: translateY(-2.5px) rotate(-45deg);
  }
}

.fade-in { animation: fadeIn 280ms ease both; }
.backlink {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 8;
  transition: color 140ms ease;
}
.backlink:hover { color: var(--accent); }
