/* =====================================================================
   SUNGLINT STUDIO — stylesheet
   Orbital mechanics as a design system. Warm near-black ground, bone
   type, one sodium accent, hairline grid, zero radius.

   Two greys carry the whole hierarchy, named for the two apsides:
   APOAPSIS = farthest, brightest (--bone).  PERIAPSIS = nearest, dim (--ash).
   ===================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* Ground: warm near-black. Never blue-shifted. */
  --void:     #0A0908;
  --deep:     #100E0C;
  --deeper:   #060505;

  /* Type: two fixed opaque greys + one metadata grey. No alpha ramp. */
  --bone:     #E8E4DA;   /* 15.7:1 */
  --ash:      #B0A99F;   /*  8.3:1 — body, secondary */
  --dim:      #8A847A;   /*  5.4:1 — metadata, passes AA at 11px */

  /* The single accent. Sodium-vapour amber: orbital light. */
  --signal:   #FF8A00;
  --signal:   oklch(0.775 0.183 57);          /* wide-gamut where supported */
  --signal-s: #FF8A00;                         /* sRGB, for JS + shadows */

  /* Hairlines. Tinted to the bone, never pure white. */
  --rule:     rgba(232, 228, 218, 0.10);
  --rule-2:   rgba(232, 228, 218, 0.22);

  /* Legacy aliases — main.js reads these at runtime. Do not remove. */
  --text: var(--bone);
  --text-soft: var(--ash);
  --text-dim: var(--dim);
  --brand: var(--signal);
  --brand-2: var(--signal);
  --brand-3: #C4462A;
  --bg: var(--void);
  --surface: transparent;
  --border: var(--rule);

  --grid: 1px;
  --gutter: clamp(18px, 4vw, 56px);
  --rail: 62px;
  --maxw: 1680px;

  /* Instrument motion: fast out, snap to rest. Never floaty. */
  --out: cubic-bezier(0.16, 0.84, 0.24, 1);
  --fast: 140ms var(--out);
  --med: 220ms var(--out);

  --sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Martian Mono", "SFMono-Regular", ui-monospace, Consolas, monospace;

  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; border-radius: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--void);
  color: var(--bone);
  font-family: var(--sans);
  font-size: 16.5px;
  font-variation-settings: "wdth" 100;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, iframe { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
ul { list-style: none; }
::selection { background: var(--signal-s); color: #0A0908; }

:focus-visible { outline: 2px solid var(--signal-s); outline-offset: 3px; }

/* ---------- Type roles ---------- */

/* Metadata: the mono layer. Real facts only, never decoration. */
.m {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-variation-settings: "wdth" 87.5;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.m-lit { color: var(--signal); }
.m-bone { color: var(--ash); }

/* Display: the violent jump. Expanded width axis instead of a third family. */
.d {
  font-weight: 800;
  font-variation-settings: "wdth" 118;
  letter-spacing: -0.035em;
  line-height: 0.86;
  text-transform: uppercase;
  text-wrap: balance;
}

.body-lg { font-size: clamp(1.02rem, 1.25vw, 1.22rem); line-height: 1.5; color: var(--ash); max-width: 46ch; }
.body-lg strong, .body-lg b { color: var(--bone); font-weight: 600; }

/* ---------- Page frame ---------- */
.shell { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

/* Full-bleed hairlines that run edge to edge, dividing the page grid. */
.rule-t { border-top: var(--grid) solid var(--rule); }
.rule-b { border-bottom: var(--grid) solid var(--rule); }

section { position: relative; }

/* The fixed left rail: a technical-drawing margin with real tick marks. */
.rail {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--rail);
  z-index: 60;
  border-right: var(--grid) solid var(--rule);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding-block: 22px;
  pointer-events: none;
  background: var(--void);
}
.rail-v {
  writing-mode: vertical-rl;
  letter-spacing: 0.3em;
}
.rail-ticks { flex: 1; width: 100%; position: relative; margin-block: 18px; }
.rail-ticks::before {
  content: "";
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    var(--rule) 0 1px,
    transparent 1px 44px
  );
}
/* The scroll position, drawn as a periapsis marker travelling the rail. */
.rail-mark {
  position: absolute; left: 0; width: 100%; height: 2px;
  background: var(--signal-s);
  top: 0;
  transition: top 90ms linear;
}
.rail-mark::after {
  content: ""; position: absolute; right: -1px; top: -3px;
  width: 7px; height: 8px; background: var(--signal-s);
}

@media (max-width: 1024px) { .rail { display: none; } :root { --rail: 0px; } }

.page { margin-left: var(--rail); }

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: var(--rail); right: 0; z-index: 70;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px;
  padding: 0 var(--gutter);
  height: 54px;
  border-bottom: var(--grid) solid transparent;
  background: transparent;
  transition: background var(--med), border-color var(--med);
}
.nav.scrolled { background: var(--void); border-bottom-color: var(--rule); }

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-name {
  font-weight: 800; font-size: 0.98rem; letter-spacing: 0.02em;
  font-variation-settings: "wdth" 112; text-transform: uppercase;
}
.brand .m { font-size: 10px; }

.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links a {
  display: inline-flex; align-items: baseline; gap: 7px;
  padding: 7px 12px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  font-variation-settings: "wdth" 87.5;
  color: var(--ash);
  transition: color var(--fast);
}
.nav-links a i { font-style: normal; color: var(--dim); font-size: 9px; }
.nav-links a:hover { color: var(--bone); }
.nav-links a:hover i { color: var(--signal); }

.nav-right { display: flex; align-items: center; gap: 16px; }

.nav-toggle { display: none; width: 40px; height: 34px; border: var(--grid) solid var(--rule-2); }
.nav-toggle span { display: block; width: 16px; height: 1px; background: var(--bone); margin: 4px auto; transition: var(--fast); }

@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  /* The brand tag and the CTA both crowd the toggle at 375px. Contact is in the menu. */
  .brand .m, .nav-right .lnk { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--void); border-bottom: var(--grid) solid var(--rule);
    padding: 8px 0;
  }
  .nav-links.open a { padding: 12px var(--gutter); }
}

/* Link with a signal underline that wipes in. Used for all real links. */
.lnk {
  position: relative; display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  font-variation-settings: "wdth" 87.5;
  color: var(--bone);
  padding-bottom: 5px;
  border-bottom: var(--grid) solid var(--rule-2);
  transition: color var(--fast);
}
.lnk::after {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 1px; width: 0;
  background: var(--signal-s); transition: width var(--med);
}
.lnk:hover::after { width: 100%; }
.lnk-fill {
  background: var(--signal-s); color: #0A0908; border: none;
  padding: 13px 22px; font-weight: 600;
}
.lnk-fill::after { display: none; }
.lnk-fill:hover { background: var(--bone); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 92svh;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding-top: 54px;
  overflow: hidden;
}
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(10,9,8,.62) 0%, rgba(10,9,8,0) 26%, rgba(10,9,8,.55) 74%, var(--void) 100%);
}
.hero-inner { position: relative; z-index: 2; width: 100%; padding-bottom: clamp(28px, 5vh, 64px); }

/* The definition. Not a badge, not a pill. */
.defn {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px;
  max-width: 74ch; margin-bottom: clamp(22px, 4vh, 46px);
}
.defn b { color: var(--bone); font-weight: 400; }
.defn .sep { color: var(--signal); }

.hero h1 {
  font-size: clamp(3.1rem, 12.2vw, 11.2rem);
  margin-bottom: clamp(20px, 3.4vh, 40px);
  color: var(--bone);
}
.hero h1 em { font-style: normal; color: var(--signal); }

.hero-foot {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px;
  align-items: end;
  border-top: var(--grid) solid var(--rule);
  padding-top: 20px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

.hero-readout { display: flex; flex-direction: column; gap: 5px; text-align: right; }
@media (max-width: 760px) {
  .hero-foot { grid-template-columns: 1fr; }
  .hero-readout { text-align: left; }
}

/* ---------- Section scaffold ---------- */
.sec { padding-block: clamp(64px, 9vw, 132px); }
.sec-head {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 72px); align-items: end;
  margin-bottom: clamp(34px, 5vw, 64px);
}
.sec-head h2 { font-size: clamp(2.1rem, 5.4vw, 4.6rem); color: var(--bone); }
.sec-label { display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px; }
.sec-label::before { content: ""; width: 26px; height: 1px; background: var(--signal-s); }
@media (max-width: 860px) { .sec-head { grid-template-columns: 1fr; align-items: start; } }

/* ---------- Work index ---------- */
.idx { border-top: var(--grid) solid var(--rule); }

.idx-row {
  position: relative;
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) minmax(0, 0.85fr) 86px;
  gap: 20px; align-items: center;
  padding-block: clamp(20px, 2.6vw, 34px);
  border-bottom: var(--grid) solid var(--rule);
  transition: background var(--fast);
}
.idx-row::before {
  content: ""; position: absolute; left: 0; top: -1px; height: 1px; width: 0;
  background: var(--signal-s); transition: width 260ms var(--out);
}
.idx-row:hover::before { width: 100%; }
.idx-row:hover { background: var(--deep); }

.idx-n { font-family: var(--mono); font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.idx-row:hover .idx-n { color: var(--signal); }

.idx-name {
  font-size: clamp(1.7rem, 4.6vw, 3.5rem);
  font-weight: 700; font-variation-settings: "wdth" 112;
  letter-spacing: -0.03em; line-height: 1; text-transform: uppercase;
  color: var(--bone);
  display: flex; align-items: baseline; gap: 14px;
}
.idx-swatch { width: 9px; height: 9px; flex: none; }

.idx-meta { display: flex; flex-direction: column; gap: 4px; }

.idx-live {
  justify-self: end;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--dim);
  display: inline-flex; align-items: center; gap: 6px;
  transition: color var(--fast);
}
.idx-row:hover .idx-live { color: var(--signal); }

/* The live preview: the actual demo site, running, mounted on hover. */
.idx-stage {
  position: absolute; right: 96px; top: 50%;
  width: 420px; height: 263px;
  transform: translateY(-50%) scale(0.97);
  border: var(--grid) solid var(--rule-2);
  background: var(--deeper);
  overflow: hidden;
  opacity: 0; pointer-events: none;
  transition: opacity var(--med), transform var(--med);
  z-index: 3;
}
.idx-row:hover .idx-stage { opacity: 1; transform: translateY(-50%) scale(1); }
.idx-stage iframe {
  width: 1400px; height: 875px; border: 0;
  max-width: none;              /* the global img,iframe rule would clamp this to 420px */
  transform: scale(0.3); transform-origin: 0 0;
  pointer-events: none;
}
.idx-stage .stage-tag {
  position: absolute; left: 0; bottom: 0; z-index: 2;
  background: var(--void); padding: 5px 9px;
}

@media (max-width: 1240px) { .idx-stage { display: none; } }
@media (max-width: 760px) {
  .idx-row { grid-template-columns: 42px minmax(0, 1fr); row-gap: 12px; }
  .idx-meta { grid-column: 2; }
  .idx-live { grid-column: 2; justify-self: start; }
}

/* ---------- Capability table ---------- */
.tbl { width: 100%; border-top: var(--grid) solid var(--rule); }
.tbl-row {
  display: grid; grid-template-columns: 66px minmax(0, 0.9fr) minmax(0, 1.5fr);
  gap: 20px; align-items: baseline;
  padding-block: 22px;
  border-bottom: var(--grid) solid var(--rule);
  transition: background var(--fast);
}
.tbl-row:hover { background: var(--deep); }
.tbl-row h3 {
  font-size: clamp(1.05rem, 1.7vw, 1.45rem); font-weight: 600;
  font-variation-settings: "wdth" 106; letter-spacing: -0.015em; color: var(--bone);
}
.tbl-row p { color: var(--ash); font-size: 0.96rem; max-width: 60ch; }
@media (max-width: 760px) {
  .tbl-row { grid-template-columns: 42px minmax(0, 1fr); row-gap: 8px; }
  .tbl-row p { grid-column: 2; }
}

/* ---------- Method ---------- */
.method { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--grid); background: var(--rule); border: var(--grid) solid var(--rule); }
.method-step { background: var(--void); padding: 26px 22px 30px; display: flex; flex-direction: column; gap: 12px; }
.method-step h3 { font-size: 1.12rem; font-weight: 700; font-variation-settings: "wdth" 108; text-transform: uppercase; letter-spacing: -0.01em; }
.method-step p { color: var(--ash); font-size: 0.93rem; }
@media (max-width: 900px) { .method { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .method { grid-template-columns: 1fr; } }

/* ---------- Ledger (facts, not a stat banner) ---------- */
.ledger {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: var(--grid) solid var(--rule); border-bottom: var(--grid) solid var(--rule);
}
.ledger div { padding: 26px 0; border-left: var(--grid) solid var(--rule); padding-left: 20px; }
.ledger div:first-child { border-left: none; padding-left: 0; }
.ledger .val {
  font-size: clamp(1.9rem, 4vw, 3.1rem); font-weight: 800;
  font-variation-settings: "wdth" 118; letter-spacing: -0.03em; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--bone); margin-bottom: 10px;
}
@media (max-width: 760px) {
  .ledger { grid-template-columns: repeat(2, 1fr); }
  .ledger div { padding-left: 20px; border-left: var(--grid) solid var(--rule); }
  .ledger div:nth-child(3) { border-top: var(--grid) solid var(--rule); }
  .ledger div:nth-child(4) { border-top: var(--grid) solid var(--rule); }
  .ledger div:nth-child(odd) { border-left: none; padding-left: 0; }
}

/* ---------- Colophon (solo + AI, stated as facts) ---------- */
.colo { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr); gap: clamp(28px, 5vw, 80px); }
.colo-facts { display: flex; flex-direction: column; border-top: var(--grid) solid var(--rule); }
.colo-facts div {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 13px 0; border-bottom: var(--grid) solid var(--rule);
}
.colo-facts dt { color: var(--dim); }
.colo-facts dd { color: var(--bone); text-align: right; }
@media (max-width: 860px) { .colo { grid-template-columns: 1fr; } }

.claims { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--grid); background: var(--rule); border: var(--grid) solid var(--rule); }
.claim { background: var(--void); padding: 24px 22px 28px; display: flex; flex-direction: column; gap: 11px; }
.claim h3 { font-size: 1.06rem; font-weight: 700; font-variation-settings: "wdth" 106; letter-spacing: -0.012em; }
.claim p { color: var(--ash); font-size: 0.93rem; }
@media (max-width: 620px) { .claims { grid-template-columns: 1fr; } }

/* Toolchain: facts in a row, not logos in a marquee. */
.tools { display: flex; flex-wrap: wrap; gap: 0; border-top: var(--grid) solid var(--rule); margin-top: 30px; }
.tools li {
  padding: 11px 18px 11px 0; margin-right: 18px;
  border-bottom: var(--grid) solid transparent;
}
.tools li.lit { color: var(--signal); border-bottom-color: var(--signal-s); }

/* ---------- Contact ---------- */
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(30px, 5vw, 80px); align-items: start; }
@media (max-width: 900px) { .contact { grid-template-columns: 1fr; } }

.chan { border-top: var(--grid) solid var(--rule); margin-top: 30px; }
.chan a, .chan span {
  display: flex; justify-content: space-between; gap: 16px; align-items: baseline;
  padding: 14px 0; border-bottom: var(--grid) solid var(--rule);
  transition: color var(--fast);
}
.chan a:hover { color: var(--signal); }
.chan b { font-weight: 400; font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; color: var(--bone); }
.chan a:hover b { color: var(--signal); }

.form { display: grid; gap: 16px; }
.form-note { border: var(--grid) solid var(--rule-2); border-left: 2px solid var(--signal-s); padding: 14px 16px; }
.form-note p { font-size: 0.88rem; color: var(--ash); line-height: 1.5; }
.form-note b { color: var(--bone); font-weight: 600; }
.field { display: grid; gap: 7px; }
.field label { color: var(--dim); font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; }
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 14px;
  background: var(--deep); border: var(--grid) solid var(--rule-2);
  color: var(--bone); font-family: var(--sans); font-size: 0.97rem;
  transition: border-color var(--fast);
}
.field textarea { min-height: 132px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--signal-s); }
.field input::placeholder, .field textarea::placeholder { color: var(--dim); }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .form .row { grid-template-columns: 1fr; } }
.form button { justify-self: start; }
.msg { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.06em; min-height: 18px; }

/* ---------- Footer ---------- */
.footer { border-top: var(--grid) solid var(--rule); padding-block: 44px 30px; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 0.6fr)); gap: 32px; }
.footer h4 { margin-bottom: 14px; }
.footer .col a { display: block; padding: 5px 0; color: var(--ash); font-size: 0.92rem; transition: color var(--fast); }
.footer .col a:hover { color: var(--signal); }
.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px;
  margin-top: 40px; padding-top: 18px; border-top: var(--grid) solid var(--rule);
}
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Reveal: discrete states, short and asymmetric ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 260ms var(--out), transform 260ms var(--out); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"] { transition-delay: 60ms; }
.reveal[data-d="2"] { transition-delay: 120ms; }
.reveal[data-d="3"] { transition-delay: 180ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
