/* ─── script.dev splash ────────────────────────────────────────────────
   Two doors. Starry backdrop with a subtle baseline accent split — left
   half tints toward Para's blue, right half toward ParaBun's amber.
   On card hover, the whole page floods with that card's accent
   color via :has() — no JS, the screen visibly commits to your choice
   while the card is highlighted.
   ───────────────────────────────────────────────────────────────────── */

:root {
  --bg: #050811;
  --bg-elev: #0c1020;
  --rule: #1a2240;
  --text: #e8e6dd;
  --text-dim: #8a8b94;
  --text-faint: #4a4d5a;
  --star-primary: #6db4ff;
  --star-companion: #ffa855;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Spectral", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Dark background goes on html only. body stays transparent so the
   negative-z-index body::before (starfield) and body::after (flood)
   render underneath the body's own painted layer. The previous version
   put bg-color on body too, which silently covered both pseudos. */
html {
  background-color: var(--bg);
}

/* Subtle horizontal accent split as a body background-image only —
   left tints blue (Para), right tints amber (ParaBun), center stays
   transparent so the starfield underneath shows through. */
body {
  position: relative;
  overflow-x: hidden;
  background-image: linear-gradient(
    to right,
    rgba(109, 180, 255, 0.08) 0%,
    transparent 32%,
    transparent 68%,
    rgba(255, 168, 85, 0.07) 100%
  );
}

/* ─── Starfield + nebulae ─────────────────────────────────────────────
   Same shape as the subsites — sparse halo'd stars + dim pinpricks +
   a couple of soft nebulae. Static, no parallax. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background-image:
    /* Soft nebulae */
    radial-gradient(ellipse 60vw 50vh at 78% 18%, rgba(109, 180, 255, 0.1), transparent 65%),
    radial-gradient(ellipse 55vw 45vh at 18% 78%, rgba(255, 168, 85, 0.08), transparent 65%),
    /* Bright stars with halos */
      radial-gradient(
        2px 2px at 12% 24%,
        rgba(255, 255, 255, 0.85) 25%,
        rgba(255, 255, 255, 0.18) 55%,
        transparent 100%
      ),
    radial-gradient(2px 2px at 38% 4%, rgba(255, 255, 255, 0.75) 25%, rgba(255, 255, 255, 0.14) 55%, transparent 100%),
    radial-gradient(2px 2px at 65% 60%, rgba(180, 210, 255, 0.85) 25%, rgba(109, 180, 255, 0.18) 55%, transparent 100%),
    radial-gradient(2px 2px at 85% 32%, rgba(255, 255, 255, 0.85) 25%, rgba(255, 255, 255, 0.18) 55%, transparent 100%),
    /* Dim pinpricks */ radial-gradient(1px 1px at 28% 68%, rgba(255, 255, 255, 0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 44% 88%, rgba(255, 255, 255, 0.45) 50%, transparent 100%),
    radial-gradient(1px 1px at 58% 12%, rgba(255, 255, 255, 0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 72% 38%, rgba(255, 255, 255, 0.45) 50%, transparent 100%),
    radial-gradient(1px 1px at 86% 70%, rgba(255, 255, 255, 0.4) 50%, transparent 100%),
    radial-gradient(1px 1px at 6% 88%, rgba(255, 255, 255, 0.45) 50%, transparent 100%),
    radial-gradient(1px 1px at 92% 14%, rgba(255, 255, 255, 0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 22% 48%, rgba(255, 255, 255, 0.4) 50%, transparent 100%),
    radial-gradient(1px 1px at 50% 76%, rgba(255, 255, 255, 0.45) 50%, transparent 100%),
    radial-gradient(1px 1px at 78% 92%, rgba(255, 168, 85, 0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 16% 6%, rgba(109, 180, 255, 0.5) 50%, transparent 100%);
  background-size: 100vw 100vh;
}

/* ─── Per-card nebulae ──────────────────────────────────────────────
   Each ellipse scales from 0 (collapsed at the card's screen position)
   to 1 (full spread) on card hover. transform-origin uses CSS vars
   set by JS (--primary-origin-x/y, --companion-origin-x/y) so the
   swoop starts from the card's actual viewport position regardless of
   layout. transform-box: view-box maps the percentage origin into
   viewBox coords; with preserveAspectRatio="none" the SVG stretches
   to viewport so 1 viewBox unit = 1% viewport — the JS percentages
   map directly. */
.nebula {
  position: fixed;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: -1;
  /* Counter-scale vertically so preserveAspectRatio="none" stretch
     doesn't elongate clouds on portrait. To avoid letterboxing, the
     pre-scale SVG height is OVER-EXTENDED beyond viewport — after the
     scaleY brings it back, it fills the viewport exactly.
       height = 100vh / yscale → so post-scale height = 100vh
       top    = (100vh - height)/2 → centered, negative on portrait
     On landscape (yscale = 1): height = 100vh, top = 0 — no change. */
  --y-scale: var(--nebula-y-scale, 1);
  height: calc(100vh / var(--y-scale));
  top: calc((100vh - 100vh / var(--y-scale)) / 2);
  transform-origin: 50% 50%;
  transform: scaleY(var(--y-scale));
}

.nebula ellipse {
  transform-box: view-box;
  transform: scale(0);
  opacity: 0;
  transition:
    transform 900ms cubic-bezier(0.2, 0.7, 0.25, 1),
    opacity 280ms ease;
}

/* transform-origin set per-ellipse in JS (in pixels via inline style),
   so the swoop starts from each card's actual rendered position
   regardless of viewport size. The previous CSS-var-with-percentage
   approach was ambiguous about how transform-box interpreted the unit. */

/* Stagger — each successive particle delays slightly so they fan out
   in sequence instead of all moving in lockstep. The transition-delay
   applies in both directions so retracts also stagger naturally. */
.nebula ellipse:nth-of-type(1) {
  transition-delay: 0ms;
}
.nebula ellipse:nth-of-type(2) {
  transition-delay: 40ms;
}
.nebula ellipse:nth-of-type(3) {
  transition-delay: 80ms;
}
.nebula ellipse:nth-of-type(4) {
  transition-delay: 120ms;
}
.nebula ellipse:nth-of-type(5) {
  transition-delay: 160ms;
}
.nebula ellipse:nth-of-type(6) {
  transition-delay: 200ms;
}
.nebula ellipse:nth-of-type(7) {
  transition-delay: 240ms;
}

body:has(.brand-card.primary:hover) .nebula-primary ellipse,
body:has(.brand-card.primary:focus-visible) .nebula-primary ellipse {
  transform: scale(1);
  opacity: 1;
}

body:has(.brand-card.companion:hover) .nebula-companion ellipse,
body:has(.brand-card.companion:focus-visible) .nebula-companion ellipse {
  transform: scale(1);
  opacity: 1;
}

/* ─── Layout ──────────────────────────────────────────────────────── */

.splash {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  gap: 2.5rem;
}

.brands {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.brand-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.7rem;
  row-gap: 0.1rem;
  align-items: baseline;
  padding: 1.25rem 1.5rem;
  min-width: 13rem;
  background: color-mix(in srgb, var(--bg-elev) 70%, transparent);
  border: 1px solid var(--rule);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    border-color 200ms ease,
    transform 200ms ease;
}

.brand-card:hover,
.brand-card:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

.brand-card.primary:hover,
.brand-card.primary:focus-visible {
  border-color: color-mix(in srgb, var(--star-primary) 60%, transparent);
}

.brand-card.companion:hover,
.brand-card.companion:focus-visible {
  border-color: color-mix(in srgb, var(--star-companion) 60%, transparent);
}

.brand-dot {
  grid-row: 1 / span 2;
  align-self: center;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.brand-dot[data-star="primary"] {
  background: var(--star-primary);
  box-shadow: 0 0 10px var(--star-primary);
}
.brand-dot[data-star="companion"] {
  background: var(--star-companion);
  box-shadow: 0 0 10px var(--star-companion);
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  font-variation-settings:
    "opsz" 144,
    "SOFT" 30;
}

.brand-role {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text-dim);
  font-variation-settings:
    "opsz" 36,
    "SOFT" 50;
}

.brand-url {
  grid-column: 2;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text-faint);
  margin-top: 0.4rem;
  letter-spacing: 0.02em;
}

.brand-card:hover .brand-url,
.brand-card:focus-visible .brand-url {
  color: var(--text-dim);
}

.splash-footer {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}

.splash-footer a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
}

.splash-footer a:hover {
  color: var(--text-dim);
  border-bottom-color: var(--text-dim);
}

::selection {
  background: rgba(109, 180, 255, 0.25);
  color: var(--text);
}
