:root {
  --bg: #0a1428;
  --card: #1a1a1a;
  --text: #ffffff;
  --text-muted: #b7bcc7;
  --gold: #d4af37;
  --gold-text: #d4af37;
  --on-gold: #0a1428;
  --gold-soft: rgba(212, 175, 55, 0.16);
  --border-rgb: 224, 224, 224;
  --border: rgba(var(--border-rgb), 0.18);
  --border-strong: rgba(var(--border-rgb), 0.4);
  --radius: 14px;
  --maxw: 1160px;
  --font-body: 'Inter', 'Segoe UI', Arial, sans-serif;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 48px;
  --space-6: 64px;
  --space-7: 96px;
  --touch: 48px;
  font-size: 16px;
}

:root[data-theme='light'] {
  --bg: #f0f4fa;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #575757;
  --gold: #b38f1d;
  --gold-text: #7a5c10;
  --on-gold: #1a1a1a;
  --gold-soft: rgba(179, 143, 29, 0.12);
  --border-rgb: 87, 87, 87;
  --border: rgba(var(--border-rgb), 0.18);
  --border-strong: rgba(var(--border-rgb), 0.38);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4 {
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5em 0;
}

p { margin: 0 0 1em 0; }

a { color: var(--text); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

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

/* TYPE SCALE — mobile-first (Inter, per brand spec) */
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3, h4 { font-size: 16px; }
body, p, li, input, select, textarea, button { font-size: 14px; }
small, .small-text { font-size: 12px; }

@media (min-width: 768px) {
  h1 { font-size: 40px; }
  h2 { font-size: 20px; }
  h3, h4 { font-size: 18px; }
  body, p, li, input, select, textarea, button { font-size: 15px; }
  small, .small-text { font-size: 12px; }
}
@media (min-width: 1024px) {
  h1 { font-size: 64px; }
  h2 { font-size: 28px; }
  h3, h4 { font-size: 20px; }
  body, p, li, input, select, textarea, button { font-size: 16px; }
  small, .small-text { font-size: 14px; }
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--gold);
  color: var(--on-gold);
  padding: 0.75em 1.25em;
  z-index: 1000;
  font-weight: 700;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* HEADER / NAV */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.logo-mark {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  object-fit: cover;
  background: #fff;
}
.nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
nav.primary-nav ul {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}
nav.primary-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.2px;
  position: relative;
  padding-bottom: 4px;
  transition: color 0.2s ease;
}
nav.primary-nav a:hover { color: var(--text); }
nav.primary-nav a.active { color: var(--text); }
nav.primary-nav a.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold);
}
@media (max-width: 820px) {
  nav.primary-nav a.active::after { left: -14px; right: auto; top: 0; bottom: 0; width: 2px; height: auto; }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--touch);
  min-height: var(--touch);
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 999px;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.icon-btn:hover { border-color: var(--gold); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 8px;
  min-width: var(--touch);
  min-height: var(--touch);
  padding: 8px 14px;
  cursor: pointer;
}
@media (max-width: 820px) {
  nav.primary-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--border); }
  nav.primary-nav.open { display: block; }
  nav.primary-nav ul { flex-direction: column; gap: 0; padding: 8px 24px 20px; }
  nav.primary-nav li { border-top: 1px solid var(--border); }
  nav.primary-nav li a { display: block; padding: 14px 0; min-height: var(--touch); display: flex; align-items: center; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
}

main section {
  padding: var(--space-7) 0;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 84px;
}
main section:last-of-type { border-bottom: none; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
  color: var(--gold-text);
  font-weight: 700;
  margin-bottom: 14px;
  display: block;
}

/* HERO */
.hero { padding-top: 100px; }
.hero h1 { max-width: 820px; color: var(--text); }
.hero p.lede { font-size: 18px; color: var(--text-muted); max-width: 640px; }
.hero-ctas { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 26px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid var(--border-strong);
  transition: transform 0.15s ease, background 0.15s ease;
  cursor: pointer;
  font-family: var(--font-body);
}
.btn-primary { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { color: var(--text); background: transparent; }
.btn-ghost:hover { transform: translateY(-2px); border-color: var(--gold); }

/* FOUNDATION — asymmetric split with pull-quote */
.foundation-split {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
  margin-top: var(--space-4);
}
.foundation-body p { color: var(--text-muted); }
.foundation-quote {
  font-weight: 700;
  font-size: clamp(20px, 2.1vw, 28px);
  line-height: 1.35;
  color: var(--text);
  border-left: 3px solid var(--gold);
  padding-left: 1.5rem;
  margin: 0;
}
@media (max-width: 820px) {
  .foundation-split { grid-template-columns: 1fr; }
}

/* TEAM */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-top: var(--space-4);
}
.team-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.team-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 14px;
}
.team-card h3 { margin-bottom: 2px; }
.team-card .role { color: var(--gold-text); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; display: block; }
.team-card p { color: var(--text-muted); margin: 0; }

/* PORTFOLIO */
.portfolio-subhead { margin-top: var(--space-5); margin-bottom: var(--space-2); }
.portfolio-subhead p { color: var(--text-muted); max-width: 640px; }
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}
.portfolio-grid.flagship-grid { grid-template-columns: 1fr; margin-top: var(--space-3); }
.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-top: 3px solid var(--gold);
}
.product-card.flagship { padding: 36px; }
.product-logo-strip {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 4px;
}
.product-logo-strip img { width: 100%; height: auto; display: block; }
.product-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.product-head h3, .product-head h4 { margin: 0; }
.stage-badge {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.stage-beta { background: rgba(212, 175, 55, 0.18); color: var(--gold-text); border: 1px solid rgba(212, 175, 55, 0.45); }
.stage-alpha { background: rgba(var(--border-rgb), 0.14); color: var(--text-muted); border: 1px solid rgba(var(--border-rgb), 0.35); }
.product-card p { color: var(--text-muted); margin: 0; }
.product-tagline { color: var(--text); font-weight: 600; }
.repo-note {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(var(--border-rgb), 0.08);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}
.product-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.chip-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border-strong);
  padding: 0 16px;
  border-radius: 999px;
}
.chip-link:hover { border-color: var(--gold); }

/* KNOWLEDGE BASE / DEV LOG */
.log-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: var(--space-4);
}
.log-entry {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.log-entry .tag {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700;
  color: var(--gold-text); margin-bottom: 8px; display: block;
}
.log-entry time { color: var(--text-muted); font-size: 12px; display: block; margin-top: 12px; }
.log-entry h4 { margin-bottom: 6px; }
.log-entry p { color: var(--text-muted); margin: 0; }
.log-entry .read-more { display: inline-block; margin-top: 10px; font-weight: 700; font-size: 13px; color: var(--text); text-decoration: none; }
.log-entry .read-more:hover { color: var(--gold-text); }

/* ARTICLE READ VIEW */
.article-main { padding: var(--space-6) 0 var(--space-7); }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: var(--space-4);
}
.back-link:hover { color: var(--gold-text); }
.article-header { max-width: 720px; margin: 0 auto var(--space-5); }
.article-header h1 { margin-bottom: var(--space-2); }
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: var(--space-3);
}
.article-meta .stage-badge { font-size: 11px; }
.article-lede { font-size: 18px; color: var(--text-muted); }
.article-body { max-width: 720px; margin: 0 auto; }
.article-body p { color: var(--text); font-size: 16px; line-height: 1.75; margin: 0 0 1.3em 0; }
.article-callout {
  border-left: 3px solid var(--gold);
  padding: 14px 20px;
  margin: var(--space-4) 0;
  font-style: italic;
  color: var(--text-muted);
  background: var(--card);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.article-actions {
  max-width: 720px;
  margin: var(--space-5) auto 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* CONTACT / WAITLIST */
.contact-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; }
@media (max-width: 820px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-list { list-style: none; padding: 0; margin: 20px 0 0; }
.contact-list li { padding: 12px 0; border-top: 1px solid var(--border); }
.contact-list a { color: var(--text); text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; min-height: var(--touch); }
.contact-list a:hover { color: var(--gold-text); }
.contact-list span { display: block; color: var(--text-muted); font-size: 12px; }
form.waitlist-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
}
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 6px; color: var(--text-muted); }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: var(--touch);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 8px;
  padding: 11px 13px;
  font-family: inherit;
}
.field textarea { min-height: 100px; resize: vertical; }
.form-note { font-size: 12px; color: var(--text-muted); margin-top: 10px; }

/* FOOTER */
footer.site-footer { padding: 40px 0; color: var(--text-muted); font-size: 13px; }
footer.site-footer .wrap { display: flex; flex-direction: column; gap: 10px; }
footer.site-footer .footer-brand { display: flex; align-items: center; gap: 8px; }
footer.site-footer .legal { max-width: 720px; }
footer.site-footer a { color: var(--text-muted); }
footer.site-footer a:hover { color: var(--text); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* REVEAL ON SCROLL */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }
.value-card, .product-card, .log-entry, .team-card { transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease; }
.value-card:hover, .product-card:hover, .log-entry:hover, .team-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: 0 14px 30px -20px rgba(0, 0, 0, 0.45);
}

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  width: var(--touch);
  height: var(--touch);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(6px);
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s, border-color 0.15s ease;
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { border-color: var(--gold); transform: translateY(-2px); }
