/* ─── RESET ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

/* ─── TOKENS ─────────────────────────────────────────────────────────── */
:root {
  --ink:    #0A0A0A;
  --paper:  #FAFAFA;
  --white:  #FFFFFF;
  --silver: #8A8A8A;

  /* dark mode defaults */
  --bg:         #0A0A0A;
  --fg:         #FFFFFF;
  --muted:      #8A8A8A;
  --hairline:   rgba(255,255,255,0.14);
  --btn-bg:     #FFFFFF;
  --btn-fg:     #0A0A0A;
  --img-filter: none;

  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg:         #FAFAFA;
  --fg:         #0A0A0A;
  --muted:      #8A8A8A;
  --hairline:   rgba(10,10,10,0.14);
  --btn-bg:     #0A0A0A;
  --btn-fg:     #FAFAFA;
  --img-filter: invert(1);
}

/* ─── BASE ───────────────────────────────────────────────────────────── */
body {
  font-family: var(--font-mono);
  background-color: var(--bg);
  color: var(--fg);
  transition: background-color 0.35s ease, color 0.35s ease;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ─── HERO WRAPPER ───────────────────────────────────────────────────── */
.hero-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* No overflow:hidden here: it's not needed (the bleeding planet is
     already clipped by .hero-planet's own overflow:hidden) and any
     ancestor with overflow != visible becomes the containing block for
     position:sticky descendants — breaking .about-sticky, since this
     section isn't the actual scrolling element (the page/body is). */
  flex-shrink: 0;
}

/* ─── HERO PLANET (photoreal, top-right) ───────────────────────────── */
/*
 * Anchored top-right: bleeds off the top and right edges.
 * Larger size — closer to native 1600×2000 proportions.
 * Three overlay layers inside the container:
 *   img          — the photo with left-edge mask fade
 *   .hero-planet-scrim  — light-mode left-edge paper scrim
 *   .hero-planet-bottom — bottom 10% dark-to-transparent fade
 */
.hero-planet {
  position: absolute;
  right: 0;
  top: 0;
  width: clamp(500px, 62vw, 1000px);
  /* Cap height at 100vh so the planet doesn't push the spec strip out of view.
     object-position: right top keeps the planet's right limb and lit side in frame. */
  height: 100vh;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.hero-planet img,
.hero-planet video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right top;
  display: block;
  /* left-edge fade: transparent → opaque over leftmost 38% of image */
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    rgba(0,0,0,0.12) 10%,
    rgba(0,0,0,0.5) 22%,
    black 38%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    rgba(0,0,0,0.12) 10%,
    rgba(0,0,0,0.5) 22%,
    black 38%
  );
}
/* Dark mode: single-play video (poster shows the dark photo while it loads).
   Light mode: static inverse photo. Only one is display:block at a time,
   so they never need absolute positioning to overlap. */
.hero-planet-img-light { display: none; }
[data-theme="light"] .hero-planet-video { display: none; }
[data-theme="light"] .hero-planet-img-light { display: block; }
/* Light-mode video: created by scripts/script.js only while the theme is
   light; it takes over from the static image once the browser confirms
   playback (class .live), so dark-mode users never download it. */
.hero-planet-video-light { display: none; }
[data-theme="light"] .hero-planet-video-light.live { display: block; }
[data-theme="light"] .hero-planet-video-light.live ~ .hero-planet-img-light { display: none; }
/* Static-image-only variant (no video) for pages other than the homepage. */
[data-theme="light"] .hero-planet-img-dark { display: none; }

/* Light mode: sibling scrim div fades left edge to paper colour */
.hero-planet-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    #FAFAFA 0%,
    rgba(250,250,250,0.9) 12%,
    rgba(250,250,250,0.5) 26%,
    transparent 44%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 1;
}
[data-theme="light"] .hero-planet-scrim {
  opacity: 1;
}
/* Bottom fade: dark bg → transparent over bottom 10% of planet container */
.hero-planet-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 10%;
  background: linear-gradient(to top, #0A0A0A 0%, transparent 100%);
  pointer-events: none;
  z-index: 2;
  transition: background 0.35s ease;
}
[data-theme="light"] .hero-planet-bottom {
  background: linear-gradient(to top, #FAFAFA 0%, transparent 100%);
}

/* ─── NAV ────────────────────────────────────────────────────────────── */
.nav {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 84px;
  padding: 0 48px;
  border-bottom: 1px solid var(--hairline);
  transition: border-color 0.35s ease;
  flex-shrink: 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  width: 28px;
}
.nav-brand-mark {
  width: 168px;
  height: 38px;
  flex-shrink: 0;
  filter: var(--img-filter);
  transition: filter 0.35s ease;
}
.nav-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.nav-wordmark {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 36px;
  list-style: none;
}
.nav-links a {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s ease;
}
.nav-links a:hover { color: var(--fg); }
.nav-links a.active {
  color: #FFFFFF;
  text-decoration: underline;
}
[data-theme="light"] .nav-links a.active {
  color: #000000;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}
.nav-location {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.toggle-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--fg);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}
.toggle-btn:hover {
  opacity: 0.7;
}
.toggle-icon-light { display: none; }
[data-theme="light"] .toggle-icon-dark { display: none; }
[data-theme="light"] .toggle-icon-light { display: block; }

/* ─── MOBILE MENU ────────────────────────────────────────────────────────
   Toggle row + vertical link list. Both hidden by default; the
   max-width: 768px block (where .nav-links itself is hidden) is what
   turns the toggle row on and lets the menu open.
   Both need position + z-index above .hero-planet (z-index: 2): as plain
   in-flow elements they'd otherwise paint underneath it regardless of DOM
   order, since z-indexed positioned elements always paint above non-
   positioned ones. A solid --bg keeps them opaque against the planet
   bleeding underneath. */
.mobile-nav-toggle-row {
  display: none;
  position: relative;
  z-index: 10;
  background-color: transparent;
  transition: background-color 0.35s ease;
}
/* Match the open mobile-menu's fill so the row and the menu read as one
   continuous panel; back to transparent once the menu is closed. */
.mobile-nav-toggle-row:has(.mobile-menu.is-open) {
  background-color: color-mix(in srgb, var(--bg) 93%, transparent);
}
.mobile-nav-toggle {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s ease;
}
.mobile-nav-toggle:hover {
  color: var(--fg);
}
.mobile-nav-icon-open { display: none; }
.mobile-nav-toggle.is-open .mobile-nav-icon-closed { display: none; }
.mobile-nav-toggle.is-open .mobile-nav-icon-open { display: block; }

.mobile-menu {
  display: none;
  flex-direction: column;
  list-style: none;
  /* Absolute + anchored to .mobile-nav-toggle-row (position: relative) so
     opening the menu overlays the hero content below rather than pushing
     it down the page. */
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  /* 50% opacity on the fill only (not text) — color-mix keeps link text fully legible */
  background-color: color-mix(in srgb, var(--bg) 93%, transparent);
  transition: background-color 0.35s ease;
}
.mobile-menu a {
  display: block;
  padding: 14px 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  /* Always the hover color — mobile has no hover state to reveal it. */
  color: var(--fg);
  border-bottom: 1px solid var(--hairline);
}
.mobile-menu li:last-child a {
  border-bottom: none;
}

/* ─── HERO BODY ──────────────────────────────────────────────────────── */
.hero-body {
  position: relative;
  z-index: 5;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 80px 48px 100px;
  max-width: 1440px;
  width: 100%;
}

/* ─── EYEBROW ────────────────────────────────────────────────────────── */
.eyebrow {
  display: inline-block;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--btn-fg);
  background-color: var(--btn-bg);
  padding: 4px;
  margin-bottom: 28px;
  transition: background-color 0.35s ease, color 0.35s ease;
}

/* ─── HEADLINE ───────────────────────────────────────────────────────── */
.hero-headline {
  font-size: clamp(52px, 9vw, 118px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--fg);
  margin-bottom: 36px;
  max-width: min(14ch, 70%);
}

.headline-line1 {
  display: block;
}
.headline-line2 {
  display: block;
  position: relative;
}

/* Hairline accent removed — tight line-height causes glyph overflow
   that makes any rule appear to cut through text at large sizes.
   The headline margin-bottom provides the visual breathing room. */

/* ─── SUBCOPY ────────────────────────────────────────────────────────── */
.hero-sub {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
  color: var(--muted);
  max-width: 52ch;
  margin-bottom: 48px;
  font-family: 'DM Sans';
}

/* ─── CTA ROW ────────────────────────────────────────────────────────── */
.cta-row {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}

.btn-primary {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background-color: var(--btn-bg);
  color: var(--btn-fg);
  border: none;
  padding: 14px 32px;
  cursor: pointer;
  transition: background-color 0.35s ease, color 0.35s ease, opacity 0.2s ease;
  display: inline-block;
  text-decoration: none;
}
.btn-primary:hover { opacity: 0.85; }

.btn-ghost {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease;
  display: inline-block;
  text-decoration: none;
}
.btn-ghost:hover { color: var(--fg); }

/* ─── ABOUT PAGE ─────────────────────────────────────────────────────── */
.about-columns {
  position: relative;
  z-index: 5;
  /* Fills leftover vertical space up to .hero-section's min-height:100vh
     floor, so the footer sticks to the bottom on short-content pages
     (e.g. apps.html) instead of trailing right after the content. Has
     no effect on pages already taller than one viewport (about.html). */
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 48px;
  padding: 64px 48px 80px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}
.about-sticky {
  flex: 1 1 45%;
  min-width: 0;
}
/* Desktop only: the eyebrow/heading/image column stays put while
   .about-panel scrolls past it. Scoped above the 768px stacking
   breakpoint, where the two columns collapse into one flow anyway. */
@media (min-width: 769px) {
  .about-sticky {
    position: sticky;
    top: 96px;
  }
}
.about-heading {
  font-family: var(--font-mono);
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--fg);
  max-width: 22ch;
  margin-bottom: 32px;
}
.about-heading-line1,
.about-heading-line2 {
  display: block;
}
.about-image img {
  display: block;
  width: 100%;
  height: auto;
  filter: grayscale(1);
}

.about-panel {
  flex: 1 1 55%;
  min-width: 0;
  background-color: color-mix(in srgb, var(--bg) 90%, transparent);
  padding: 16px;
  transition: background-color 0.35s ease;
}
.about-block + .about-block {
  margin-top: 40px;
}
.about-block h2 {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  color: var(--fg);
  margin-bottom: 16px;
}
.about-block p {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
}
.about-block p + p {
  margin-top: 16px;
}

/* ─── CONTACT EMAIL ROW ──────────────────────────────────────────────── */
.contact-email-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin: 24px 0;
}
.contact-email-link {
  font-family: var(--font-mono);
  font-size: clamp(18px, 3.5vw, 26px);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--fg);
  border-bottom: 1px solid var(--hairline);
  transition: border-color 0.2s ease;
}
.contact-email-link:hover { border-bottom-color: var(--fg); }
.contact-email-copy {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--hairline);
  padding: 6px 12px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.contact-email-copy:hover { color: var(--fg); border-color: var(--fg); }
.contact-email-noscript {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--muted);
}

/* ─── SPEC STRIP ─────────────────────────────────────────────────────── */
.spec-strip {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 12px 48px;
  border-top: 1px solid var(--hairline);
  flex-shrink: 0;
  transition: border-color 0.35s ease;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.spec-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* ─── SCROLL REVEAL ──────────────────────────────────────────────────────
   Elements tagged .reveal fade/slide in as they enter the viewport.
   scripts/script.js adds `.js` to <html> before first paint (so this only
   hides content when JS can bring it back) and toggles `.is-visible` via an
   IntersectionObserver, staggering items that appear together. Honoured on
   every page; skipped entirely under prefers-reduced-motion. */
@media (prefers-reduced-motion: no-preference) {
  html.js .reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
    transition-delay: var(--reveal-delay, 0s);
    will-change: opacity, transform;
  }
  html.js .reveal.is-visible {
    opacity: 1;
    transform: none;
  }

  /* Ease in-page anchor jumps (e.g. the legal-page contents list) into a
     smooth scroll. Under prefers-reduced-motion the browser keeps the
     instant jump. */
  html {
    scroll-behavior: smooth;
  }
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .nav { padding: 0 32px; }
  .hero-body { padding: 60px 32px 80px; }
  .spec-strip { padding: 0 32px; }
  .about-columns { padding: 56px 32px 64px; gap: 32px; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav { padding: 0 24px; }
  .hero-body { padding: 48px 24px 64px; }
  .mobile-nav-toggle-row {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--hairline);
    transition: border-color 0.35s ease;
  }
  .mobile-menu.is-open {
    display: flex;
    padding: 8px 24px 4px;
    border-bottom: 1px solid var(--hairline);
    transition: border-color 0.35s ease;
  }
  .spec-strip {
    padding: 0 24px;
    height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .about-columns {
    flex-direction: column;
    padding: 40px 24px 56px;
  }
  .about-block h2 { font-size: 26px; }
  /* On tablet: planet shrinks, stays top-right, flush to edge */
  .hero-planet {
    width: clamp(300px, 70vw, 560px);
    height: 100vh;
    right: 0;
    top: 0;
  }
  .hero-planet img {
    opacity: 0.75;
    -webkit-mask-image: linear-gradient(
      to right,
      transparent 0%,
      rgba(0,0,0,0.1) 10%,
      rgba(0,0,0,0.45) 22%,
      black 42%
    );
    mask-image: linear-gradient(
      to right,
      transparent 0%,
      rgba(0,0,0,0.1) 10%,
      rgba(0,0,0,0.45) 22%,
      black 42%
    );
  }
}

@media (max-width: 480px) {
  .nav-location { display: none; }
  .hero-body { padding: 40px 20px 56px; }
  .spec-strip {
    padding: 12px 20px;
    justify-content: flex-start;
    gap: 8px 20px;
  }
  .nav { padding: 0 20px; }
  .cta-row { gap: 24px; }
  .about-columns { padding: 32px 20px 48px; }
  /* On mobile: planet anchored top, dimmed full-bleed backdrop */
  .hero-planet {
    right: 0;
    top: 0;
    width: 100vw;
    height: 60vh;
  }
  .hero-planet img {
    opacity: 0.45;
    -webkit-mask-image: linear-gradient(
      to right,
      transparent 0%,
      rgba(0,0,0,0.3) 20%,
      black 55%
    );
    mask-image: linear-gradient(
      to right,
      transparent 0%,
      rgba(0,0,0,0.3) 20%,
      black 55%
    );
  }
}

/* ─── LEGAL PAGE (legal.html) ─────────────────────────────────────────── */
/* Additive block: privacy/terms prose. Uses existing tokens only, so
   dark and light themes both work without extra rules. */
.legal-toc {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
}
/* Give anchored sections/headings a little breathing room from the
   viewport edge when the contents list jumps to them. */
.legal-doc[id],
.legal-doc h3[id] {
  scroll-margin-top: 24px;
}
.legal-toc li {
  border-bottom: 1px solid var(--hairline);
}
.legal-toc a {
  display: block;
  padding: 9px 0 9px 12px;
  border-left: 2px solid transparent;
  font-size: 13px;
  color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.legal-toc li:first-child a {
  color: var(--fg);
  font-weight: 600;
}
.legal-toc a:hover {
  color: var(--fg);
}
/* Scrollspy: the section currently in view (see scripts/script.js). */
.legal-toc a.is-current {
  color: var(--fg);
  border-left-color: var(--fg);
}
.legal-doc .doc-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 4px 0 18px;
}
.legal-doc h3 {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--fg);
  margin: 28px 0 8px;
}
.legal-doc p,
.legal-doc li {
  font-size: 14.5px;
  max-width: 62ch;
}
.legal-doc ul,
.legal-doc ol {
  margin: 8px 0 14px 22px;
  display: grid;
  gap: 6px;
}
.legal-doc a {
  text-decoration: underline;
}
