/* Constellation Forge — site styles
   Layout: white editorial field, one centred 1120px column, big headlines,
   one navy statement band per page. Tokens follow the Constellation Forge design system. */
:root {
  --surface: #ffffff;
  --surface-sunken: #f4f2ec;
  --line: #dcd8cd;
  --ink: #13233f;
  --ink-muted: #4a5568;
  --on-ink: #f4f1ea;
  --on-ink-muted: #b8c2d6;
  --panel: #13233f;
  --star-dim: #7b879b;
  --chart-signal: #2f5f8f;
  --gold: #9a5f00;
  --gold-mark: #e9a23b;
  --gold-soft: #fcf1de;
  --on-gold: #ffffff;
  --veto: #a3271c;
  --caution: #8a5a00;
  --m-arc: #a8761f;
  --m-star: #b07f26;

  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-trove: "Josefin Sans", "Futura", system-ui, sans-serif;
  --font-orion: "Lexend", "Plus Jakarta Sans", system-ui, sans-serif;
  --font-meridian: "Sora", "Plus Jakarta Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --radius-md: 6px;
  --radius-lg: 12px;
  --max: 1120px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #0d1320; --surface-sunken: #141b2a; --line: #2a3346;
    --ink: #e9edf4; --ink-muted: #9aa6bb; --on-ink: #f4f1ea; --on-ink-muted: #b8c2d6;
    --panel: #18243d; --star-dim: #6e7b93; --chart-signal: #7fb2e3;
    --gold: #e9a23b; --gold-soft: #33240c; --on-gold: #0d1320;
    --veto: #f27b70; --caution: #e5ae45; --m-arc: #d9ae52; --m-star: #f2cf7e;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}
:root[data-theme="dark"] {
  --surface: #0d1320; --surface-sunken: #141b2a; --line: #2a3346;
  --ink: #e9edf4; --ink-muted: #9aa6bb; --on-ink: #f4f1ea; --on-ink-muted: #b8c2d6;
  --panel: #18243d; --star-dim: #6e7b93; --chart-signal: #7fb2e3;
  --gold: #e9a23b; --gold-soft: #33240c; --on-gold: #0d1320;
  --veto: #f27b70; --caution: #e5ae45; --m-arc: #d9ae52; --m-star: #f2cf7e;
  color-scheme: dark;
}
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
.logo-dark { display: none; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface);
}
img { max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 2px; }

.wrap {
  max-width: calc(var(--max) + 2 * 24px);
  margin: 0 auto;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}
@media (max-width: 560px) {
  .wrap {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-block: 14px;
}
.brand { display: block; line-height: 0; flex-shrink: 0; }
.brand img { height: 24px; width: auto; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav a {
  text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 8px 12px; border-radius: var(--radius-md); color: var(--ink-muted);
}
.nav a:hover { color: var(--ink); background: var(--surface-sunken); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--gold-mark); border-radius: 0; }
@media (max-width: 640px) {
  .site-header .wrap { flex-direction: column; align-items: flex-start; gap: 8px; }
  .brand img { height: 20px; }
  .nav { justify-content: flex-start; margin-left: -12px; }
  .nav a { padding: 6px 12px; font-size: 13px; }
}

/* ---------- Type ---------- */
.eyebrow {
  margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--gold);
}
h1, h2, h3 { margin: 0; text-wrap: balance; color: var(--ink); }
.display {
  font-size: clamp(42px, 7.2vw, 84px); line-height: 1.02;
  font-weight: 800; letter-spacing: -0.03em;
}
.title {
  font-size: clamp(30px, 4.4vw, 48px); line-height: 1.08;
  font-weight: 800; letter-spacing: -0.02em;
}
h3 { font-size: 20px; line-height: 1.3; font-weight: 700; }
.lede { font-size: clamp(18px, 2vw, 22px); line-height: 1.55; color: var(--ink-muted); max-width: 40ch; margin: 0; }
.body { color: var(--ink-muted); max-width: 62ch; margin: 0; }
.mono { font-family: var(--font-mono); font-size: 13px; }

/* ---------- Sections ---------- */
.section { padding-block: clamp(64px, 9vw, 120px); }
.section + .section { border-top: 1px solid var(--line); }
.section-head { display: grid; gap: 16px; margin-bottom: clamp(32px, 5vw, 56px); max-width: 760px; }

.hero { padding-block: clamp(56px, 9vw, 112px) clamp(48px, 7vw, 88px); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 48px; align-items: center;
}
.hero-copy { display: grid; gap: 24px; min-width: 0; }
.hero-art { min-width: 0; }
.hero-art svg { width: 100%; height: auto; display: block; }
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { max-width: 420px; }
}

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 15px/1 var(--font-sans); text-decoration: none;
  padding: 14px 20px; border-radius: var(--radius-md);
  border: 1px solid var(--ink); color: var(--ink); background: transparent;
  cursor: pointer;
}
.btn:hover { background: var(--surface-sunken); }
.btn-primary { background: var(--ink); color: var(--surface); }
.btn-primary:hover { background: var(--ink); opacity: 0.9; }

/* Grids */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 680px) { .grid-2 { grid-template-columns: 1fr; } }

.tile {
  background: var(--surface-sunken); border-radius: var(--radius-lg);
  padding: 28px; display: grid; gap: 10px; align-content: start; min-width: 0;
}
.tile p { margin: 0; color: var(--ink-muted); }
.tile .tile-big { font-size: 22px; line-height: 1.3; font-weight: 700; color: var(--ink); }
.outline {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px; display: grid; gap: 10px; align-content: start; min-width: 0;
}
.outline p { margin: 0; color: var(--ink-muted); }

.pull {
  font-size: clamp(24px, 3vw, 34px); line-height: 1.25; font-weight: 700;
  letter-spacing: -0.01em; max-width: 28ch; margin: 0; text-wrap: balance;
}

/* ---------- Navy statement band ---------- */
.band { background: var(--panel); color: var(--on-ink); }
.band h2, .band h3 { color: var(--on-ink); }
.band .eyebrow { color: var(--gold-mark); }
.band .body, .band p { color: var(--on-ink-muted); }
.band + .section { border-top: 0; }

.loop-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 56px; align-items: center; }
.loop-grid svg { width: 100%; height: auto; max-width: 460px; display: block; margin: 0 auto; }
@media (max-width: 860px) { .loop-grid { grid-template-columns: 1fr; gap: 32px; } }
.loop-list { display: grid; gap: 0; }
.loop-item {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px;
  padding-block: 22px; border-top: 1px solid rgba(233, 162, 59, 0.28);
  text-decoration: none; color: var(--on-ink);
}
.loop-item:last-child { border-bottom: 1px solid rgba(233, 162, 59, 0.28); }
.loop-item .step { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-mark); padding-top: 5px; }
.loop-item h3 { font-size: 22px; }
.loop-item p { margin: 4px 0 0; }
.loop-item .more { display: inline-block; margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--gold-mark); }
.loop-item:hover h3 { text-decoration: underline; text-decoration-color: var(--gold-mark); text-underline-offset: 4px; }

/* ---------- Product cards (home) ---------- */
.product-card {
  display: grid; gap: 14px; align-content: start;
  padding: 28px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  text-decoration: none; min-width: 0;
}
.product-card:hover { border-color: var(--ink); }
.product-card p { margin: 0; color: var(--ink-muted); }
.product-card .more { font-weight: 600; font-size: 14px; color: var(--gold); }

/* ---------- Product wordmarks ---------- */
.wm-trove {
  font-family: var(--font-trove); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--ink); white-space: nowrap;
}
.wm-trove .spark { color: var(--gold-mark); margin: 0 0.18em; font-size: 0.7em; vertical-align: 0.12em; letter-spacing: 0; }
/* Orion: Lexend SemiBold, +12% tracking, the belt as the I (Orion brand book) */
.wm-orion {
  font-family: var(--font-orion); font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink); white-space: nowrap;
  display: inline-flex; align-items: center; line-height: 1;
}
.wm-orion .o-belt { height: 0.92em; width: auto; margin: 0 0.12em 0 0; fill: var(--gold-mark); flex-shrink: 0; }
/* Meridian: Sora SemiBold, +14% tracking, the arc as the I (Meridian brand book) */
.wm-meridian {
  font-family: var(--font-meridian); font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink); white-space: nowrap;
  display: inline-flex; align-items: center; line-height: 1;
}
.wm-meridian .m-arc { height: 1.08em; width: auto; margin: 0 0.14em 0 0; flex-shrink: 0; }
/* Star Trove: the outlined wordmark file, letters follow the text colour */
.wm-trove-svg { display: block; height: 1em; width: auto; color: var(--ink); }
.wm-hero-trove { margin: 0; font-size: clamp(30px, 5vw, 56px); line-height: 1; }
.wm-hero { font-size: clamp(36px, 6.4vw, 72px); line-height: 1; margin: 0; }
.wm-card { font-size: 22px; line-height: 1.1; }

/* ---------- Drift comparison ---------- */
.drift { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 20px; align-items: center; }
.drift .neq { font-size: 64px; font-weight: 800; color: var(--gold); line-height: 1; text-align: center; }
@media (max-width: 720px) { .drift { grid-template-columns: 1fr; } .drift .neq { font-size: 44px; } }
.note-ill { font-size: 13px; color: var(--ink-muted); margin: 16px 0 0; }

/* ---------- Flow (captured → pending → starred) ---------- */
.flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; counter-reset: flow; }
.flow-step { padding: 24px 24px 24px 0; border-top: 2px solid var(--line); display: grid; gap: 8px; align-content: start; min-width: 0; }
.flow-step:last-child { border-top-color: var(--gold-mark); }
.flow-step .k { font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); }
.flow-step p { margin: 0; color: var(--ink-muted); }
@media (max-width: 720px) { .flow { grid-template-columns: 1fr; } .flow-step { padding-right: 0; } }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  background: var(--surface-sunken); color: var(--ink); border: 1px solid var(--line);
}

/* Question rows (Orion) */
.qrows { display: grid; gap: 10px; }
.qrow {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center;
  background: var(--surface-sunken); border-radius: var(--radius-lg); padding: 18px 22px;
}
.qrow .q { font-size: 18px; font-weight: 600; margin: 0; }
.qrow .layer { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); white-space: nowrap; }
@media (max-width: 560px) { .qrow { grid-template-columns: 1fr; gap: 6px; } }

/* Demo panel */
.demo {
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(24px, 4vw, 40px);
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px; align-items: center;
  background: var(--surface);
}
@media (max-width: 760px) { .demo { grid-template-columns: 1fr; } }
.demo-steps { margin: 0; padding-left: 20px; color: var(--ink-muted); display: grid; gap: 6px; }
.status {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); width: fit-content;
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold-mark); }

/* Next / prev */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.pager a {
  display: grid; gap: 4px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  text-decoration: none;
}
.pager a:hover { border-color: var(--ink); }
.pager .dir { font-size: 13px; color: var(--ink-muted); }
.pager .name { font-size: 20px; font-weight: 700; }
.pager a.next { text-align: right; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager a.next { text-align: left; } }

/* Contact */
.contact { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 40px; align-items: end; }
@media (max-width: 760px) { .contact { grid-template-columns: 1fr; } }
.contact-box { display: grid; gap: 8px; padding: 28px; border-radius: var(--radius-lg); background: var(--surface-sunken); }
.contact-box .addr { font-size: 20px; font-weight: 700; user-select: all; word-break: break-all; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 40px; font-size: 14px; color: var(--ink-muted); }
.site-footer .wrap { display: flex; gap: 24px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.site-footer img { height: 18px; width: auto; }
.site-footer .foot-links { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

/* Constellation drawing animation */
.thread { stroke-dasharray: 600; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: no-preference) {
  .draw .thread { animation: draw 1.6s ease-out both; }
  .draw .star { animation: pop 0.5s ease-out both; }
  .draw .star:nth-of-type(2) { animation-delay: 0.5s; }
  .draw .star:nth-of-type(3) { animation-delay: 1s; }
  .draw .star:nth-of-type(4) { animation-delay: 1.4s; }
  .twinkle { animation: twinkle 4s ease-in-out infinite; }
  .twinkle:nth-child(2n) { animation-delay: 1.3s; }
  .twinkle:nth-child(3n) { animation-delay: 2.4s; }
}
@keyframes draw { from { stroke-dashoffset: 600; } to { stroke-dashoffset: 0; } }
@keyframes pop { from { transform: scale(0.4); opacity: 0.4; } to { transform: scale(1); opacity: 1; } }
@keyframes twinkle { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.85; } }
.star { transform-box: fill-box; transform-origin: center; }

/* SVG theme helpers */
.svg-ink { fill: var(--ink); }
.svg-ink-stroke { stroke: var(--ink); }
.svg-muted { fill: var(--ink-muted); }
.svg-line { stroke: var(--line); }
.svg-gold { fill: var(--gold-mark); }
.svg-gold-stroke { stroke: var(--gold-mark); }
.svg-dim { fill: var(--star-dim); }
.svg-veto { stroke: var(--veto); }
.svg-caution { stroke: var(--caution); }
.svg-socket { stroke: var(--star-dim); fill: none; }
.svg-text { fill: var(--ink); font-family: var(--font-sans); }
.svg-text-muted { fill: var(--ink-muted); font-family: var(--font-sans); }
.svg-on-ink { fill: var(--on-ink); font-family: var(--font-sans); }
.svg-surface { fill: var(--surface); }
