:root {
  /* Light mode (default) */
  --paper: #f5f1e8;
  --ink: #1f2420;
  --muted: #697068;
  --muted-light: #5f665e;
  --line: rgba(31, 36, 32, 0.16);
  --deep: #20261f;
  --soft: #e9e2d4;
  --accent: #d7ef6b;
  --accent-2: #9dbd54;
  --max: 1180px;
  --radius: 24px;
  /* Fixed surfaces that must not follow the theme */
  --on-dark: #f5f1e8;
  --deep-surface-a: #2a3029;
  --deep-surface-b: #1e241e;
}

/* Dark mode via explicit choice (set by theme-init.js) */
html[data-theme="dark"] {
  --paper: #0f1210;
  --ink: #f0ebe2;
  --muted: #9a9490;
  --muted-light: #a5a39e;
  --line: rgba(240, 235, 226, 0.12);
  --deep: #1a1f1c;
  --soft: #1e2420;
  --accent: #c9e860;
  --accent-2: #a8c546;
}

/* Dark mode without JS: system dark preference and no explicit choice */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --paper: #0f1210;
    --ink: #f0ebe2;
    --muted: #9a9490;
    --muted-light: #a5a39e;
    --line: rgba(240, 235, 226, 0.12);
    --deep: #1a1f1c;
    --soft: #1e2420;
    --accent: #c9e860;
    --accent-2: #a8c546;
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Manrope", system-ui, sans-serif;
  line-height: 1.55;
}

body::selection {
  background: var(--accent);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  z-index: 10;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

.site-header,
main > section,
.site-footer {
  width: min(calc(100% - 48px), var(--max));
  margin-inline: auto;
}

.site-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: -0.03em;
  flex: 0 0 auto;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  font-family: "DM Mono", monospace;
  font-size: 14px;
}

.nav {
  display: flex;
  gap: 28px;
  font-size: 14px;
  justify-content: center;
  flex: 0 1 auto;
  min-width: 0;
}

.nav a,
.nav-cta,
.text-link {
  transition: text-decoration-color 160ms ease, transform 160ms ease;
}

.nav a,
.nav-cta,
.text-link {
  text-decoration: underline;
  text-decoration-color: transparent;
}

.nav a:hover,
.nav-cta:hover,
.text-link:hover {
  text-decoration-color: currentColor;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink);
  transition: background 160ms ease-out, border-color 160ms ease-out;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--soft);
  border-color: var(--muted);
}

.theme-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  position: absolute;
}

.theme-sun {
  opacity: 1;
  transition: opacity 160ms ease-out;
}

.theme-moon {
  opacity: 0;
  transition: opacity 160ms ease-out;
}

html[data-theme="dark"] .theme-sun {
  opacity: 0;
}

html[data-theme="dark"] .theme-moon {
  opacity: 1;
}

.eyebrow {
  margin: 0 0 22px;
  font: 500 11px/1.2 "DM Mono", monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero {
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  gap: 70px;
  min-height: 650px;
  align-items: center;
  padding: 90px 0 110px;
}

.hero h1,
.section-heading h2,
.about-copy h2,
.closing h2 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.hero h1 {
  font-size: clamp(58px, 7vw, 95px);
  max-width: 860px;
  text-wrap: balance;
}

.hero h1 em,
.closing h2 em {
  font-family: Georgia, serif;
  font-weight: 400;
}

.hero-text {
  max-width: 620px;
  margin: 30px 0 34px;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
}

.button span {
  font-size: 17px;
  line-height: 1;
}

.button-dark {
  background: var(--ink);
  color: var(--paper);
  transition: transform 160ms ease-out;
}

.button-dark:hover {
  transform: translateY(-2px);
}

.button-outline {
  border-color: var(--ink);
  margin-top: 22px;
  transition: background 160ms ease-out, color 160ms ease-out;
}

.button-outline:hover {
  background: var(--ink);
  color: var(--paper);
}

.text-link {
  font-size: 14px;
  font-weight: 700;
}

.hero-card-wrap {
  display: flex;
  justify-content: flex-end;
}

.hero-card {
  width: min(100%, 390px);
  min-height: 435px;
  padding: 26px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 85% 18%, rgba(215,239,107,0.18), transparent 26%),
    linear-gradient(145deg, var(--deep-surface-a), var(--deep-surface-b));
  color: var(--on-dark);
  box-shadow: 0 25px 70px rgba(31, 36, 32, 0.16);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-top,
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: 500 10px "DM Mono", monospace;
  letter-spacing: 0.1em;
  color: rgba(245, 241, 232, 0.8);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(215,239,107,0.08);
}

.signal {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 50px;
}

.signal-line {
  width: 80%;
  height: 1px;
  background: rgba(245, 241, 232, 0.25);
}

.signal-line.short { width: 58%; }

.card-quote {
  margin: 50px 0;
  font-family: Georgia, serif;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.card-meta {
  justify-content: flex-start;
  gap: 15px;
}

.card-meta span {
  padding: 7px 9px;
  border: 1px solid rgba(245, 241, 232, 0.16);
  border-radius: 999px;
}

.ticker {
  width: 100%;
  margin: 0;
  padding: 18px 0;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  justify-content: center;
  gap: 38px;
  flex-wrap: wrap;
  font: 500 10px "DM Mono", monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.section {
  padding: 125px 0;
}

.section-heading {
  display: grid;
  grid-template-columns: 0.65fr 1.35fr;
  gap: 35px;
  align-items: start;
  margin-bottom: 54px;
}

.section-heading h2,
.about-copy h2 {
  font-size: clamp(46px, 6.1vw, 78px);
}

.section-heading h2 span,
.about-copy h2 span {
  font-family: Georgia, serif;
  font-weight: 400;
}

.project-grid {
  display: grid;
  grid-template-columns: 1.17fr 0.83fr;
  gap: 20px;
}

.project-card {
  position: relative;
  min-height: 540px;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 30px;
}

.project-primary {
  background: var(--ink);
  color: var(--paper);
}

.project-secondary {
  background: var(--soft);
}

.project-number {
  font: 500 11px "DM Mono", monospace;
  color: var(--muted-light);
}

.project-content {
  max-width: 600px;
  padding-top: 90px;
}

.project-secondary .project-content {
  max-width: 500px;
  padding-right: 120px;
}

.project-status {
  margin-bottom: 18px;
  font: 500 10px "DM Mono", monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-light);
}

.project-card h3 {
  margin: 0;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.project-card p {
  max-width: 590px;
  margin: 22px 0 0;
  font-size: 15px;
  color: var(--muted);
}

.project-primary p {
  color: color-mix(in srgb, var(--paper) 70%, transparent);
}

.project-secondary p {
  color: var(--muted-light);
}

.project-note {
  padding-top: 15px;
  border-top: 1px solid currentColor;
  font-size: 13px !important;
  color: var(--muted-light);
}

.project-primary .project-note {
  opacity: 0.85;
  color: inherit;
}

.project-orbit {
  position: absolute;
  width: 280px;
  height: 280px;
  right: -95px;
  bottom: -100px;
  border-radius: 50%;
}

.orbit {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(215,239,107,0.3);
  border-radius: 50%;
}

.orbit-2 {
  inset: 35px;
  border-color: rgba(215,239,107,0.18);
}

.orbit-dot {
  position: absolute;
  width: 13px;
  height: 13px;
  top: 20px;
  left: 84px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 8px rgba(215,239,107,0.08);
}

.mini-grid {
  position: absolute;
  right: 30px;
  bottom: 30px;
  display: grid;
  grid-template-columns: repeat(4, 18px);
  gap: 7px;
  opacity: 0.7;
}

.mini-grid span {
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
}

.mini-grid .filled {
  background: var(--ink);
}

.principles-section {
  border-top: 1px solid var(--line);
}

.principle-list {
  border-top: 1px solid var(--line);
}

.principle {
  display: grid;
  grid-template-columns: 0.65fr 1.35fr;
  gap: 35px;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}

.principle-index {
  font: 500 11px "DM Mono", monospace;
  color: var(--muted);
}

.principle h3 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.025em;
}

.principle p {
  max-width: 650px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.about-section {
  display: grid;
  grid-template-columns: 0.65fr 1.35fr;
  gap: 35px;
  border-top: 1px solid var(--line);
}

.about-stamp {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  margin-top: 60px;
  border-radius: 50%;
  background: var(--accent);
  font: 500 21px "DM Mono", monospace;
  transform: rotate(-8deg);
}

.about-copy > p {
  max-width: 620px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.closing {
  width: min(calc(100% - 48px), var(--max));
  margin: 0 auto 80px;
  padding: 48px 0 55px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 30px;
}

.closing h2 {
  font-size: clamp(44px, 6vw, 76px);
}

.circle-link {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 24px;
  transition: transform 160ms ease;
}

.circle-link:hover {
  transform: translateY(-4px);
}

.site-footer {
  padding: 22px 0 30px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  font: 500 11px "DM Mono", monospace;
  color: var(--muted);
}

.site-footer > div {
  display: flex;
  gap: 8px;
  align-items: center;
}

.site-footer a {
  color: var(--ink);
  display: inline-block;
  padding: 8px 0;
}

.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: nowrap;
  flex: 0 0 auto;
}

.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  justify-content: center;
  align-items: center;
  font-family: inherit;
}

.mobile-menu-toggle span {
  width: 24px;
  height: 2px;
  background: var(--ink);
  transition: transform 200ms ease-out, opacity 200ms ease-out;
  border-radius: 1px;
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.mobile-menu {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 9;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 200ms ease-out, opacity 200ms ease-out;
}

.mobile-menu.open {
  max-height: 500px;
  opacity: 1;
}

.mobile-menu a {
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
}

.mobile-menu a:hover {
  background: var(--soft);
}

.mobile-menu a:last-child {
  border-bottom: none;
}

/* Legal pages */
.legal-content {
  max-width: 800px;
}

.legal-content h1 {
  font-family: Manrope, sans-serif;
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0 0 22px;
}

.legal-content h2 {
  font-size: 28px;
  margin-top: 40px;
  margin-bottom: 16px;
  font-weight: 700;
}

.legal-content h3 {
  font-size: 18px;
  margin-top: 24px;
  margin-bottom: 12px;
  font-weight: 700;
}

.legal-content p {
  margin-bottom: 16px;
  line-height: 1.7;
}

.legal-content ul {
  margin-bottom: 16px;
  padding-left: 24px;
}

.legal-content li {
  margin-bottom: 8px;
  line-height: 1.7;
}

.last-updated {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 40px;
}

/* 404 page */
.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 180px);
  text-align: center;
  padding: 40px 20px;
}

.error-code {
  font-size: clamp(64px, 12vw, 120px);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 20px;
}

.error-title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.04em;
}

.error-description {
  font-size: 18px;
  color: var(--muted);
  max-width: 500px;
  margin-bottom: 40px;
  line-height: 1.6;
}

.error-link {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms ease-out;
}

.error-link:hover {
  transform: translateY(-2px);
}

@media (max-width: 900px) {
  .hero,
  .project-grid,
  .section-heading,
  .principle,
  .about-section {
    grid-template-columns: 1fr;
  }

  .hero {
    gap: 48px;
    min-height: unset;
    padding: 72px 0 90px;
  }

  .hero-card-wrap {
    justify-content: flex-start;
  }

  .hero-card {
    width: 100%;
    min-height: 340px;
  }

  .project-card {
    min-height: 460px;
  }

  .project-content {
    padding-top: 60px;
  }

  .about-stamp {
    margin-top: 15px;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .nav {
    display: none;
  }

  .nav-cta {
    display: none;
  }

  html:not(.js) .mobile-menu {
    position: static;
    max-height: none;
    opacity: 1;
    overflow: visible;
  }

  html:not(.js) .mobile-menu-toggle {
    display: none;
  }
}

@media (max-width: 900px) and (scripting: none) {
  .mobile-menu {
    position: static;
    max-height: none;
    opacity: 1;
    overflow: visible;
  }

  .mobile-menu-toggle {
    display: none;
  }
}

@media (max-width: 640px) {
  .site-header,
  main > section,
  .site-footer {
    width: min(calc(100% - 30px), var(--max));
  }

  .site-header {
    padding: 20px 0;
  }

  .hero {
    padding: 56px 0 72px;
  }

  .hero h1 {
    font-size: clamp(50px, 15vw, 70px);
  }

  .hero-text {
    font-size: 16px;
  }

  .ticker {
    gap: 15px 22px;
    justify-content: flex-start;
    padding-inline: 15px;
  }

  .section {
    padding: 85px 0;
  }

  .section-heading {
    margin-bottom: 36px;
  }

  .project-card {
    min-height: 500px;
    padding: 24px;
  }

  .closing {
    width: min(calc(100% - 30px), var(--max));
    margin-bottom: 45px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
