/* ------------------------------------------------------------------
   Meridian — stylesheet
   A real-time sonification of the International Space Station.
   © 2026 Joshua Borsman. All rights reserved.

   Aligned with the artist's standard visual language for generative
   pages (cf. Ephemeris, Convergence, Lightcurve, Phase Space):
   dark ground, EB Garamond display, Inter body, JetBrains Mono
   technical, restrained palette, asterisk rules, "Begin" CTA.
   ------------------------------------------------------------------ */

:root {
  --void:        #04060a;
  --void-deep:   #020305;
  --surface:     rgba(255, 255, 255, 0.04);
  --hairline:    rgba(244, 241, 233, 0.14);
  --hairline-strong: rgba(244, 241, 233, 0.28);

  --ink:         #f4f1e9;
  --ink-soft:    #d6d1c5;
  --ink-mute:    #948f82;
  --ink-faint:   #6a665b;

  --signal:      #9af5ff;
  --signal-glow: rgba(154, 245, 255, 0.5);
  --live:        #ff8a8a;
  --warn:        #ffb073;

  --display: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --serif:   "EB Garamond", Georgia, serif;
  --ui:      "Inter", "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:    "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;

  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* ---------- Reset ---------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--void);
  color: var(--ink);
  font-family: var(--ui);
  font-feature-settings: "ss01", "cv11", "tnum";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

body {
  background:
    radial-gradient(ellipse 100% 70% at 50% 110%, rgba(154, 245, 255, 0.05), transparent 60%),
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(180, 140, 255, 0.04), transparent 60%),
    var(--void);
  min-height: 100dvh;
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  transition: color 200ms var(--ease-out), border-color 200ms var(--ease-out);
}
a:hover { color: var(--ink); border-bottom-color: var(--ink-mute); }
a:focus-visible {
  outline: 1px solid var(--signal);
  outline-offset: 3px;
  border-radius: 2px;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: rgba(154, 245, 255, 0.18); color: var(--ink); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.artist-link {
  color: inherit;
  border-bottom: 0 !important;
  text-decoration: none;
  transition: color 200ms var(--ease-out);
}
.artist-link:hover,
.artist-link:focus-visible { color: var(--ink); }

[hidden] { display: none !important; }

/* ---------- Atmosphere ---------- */

.grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 0.96  0 0 0 0 0.94  0 0 0 0 0.88  0 0 0 0.8 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
}

.vignette {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 49;
  background: radial-gradient(ellipse 80% 70% at 50% 50%, transparent 55%, rgba(0,0,0,0.45) 100%);
}

#globe {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: block;
  z-index: 0;
  cursor: grab;
  touch-action: none;
}
#globe:active { cursor: grabbing; }

/* ---------- Top frame: brand + nav ---------- */

.frame {
  position: fixed;
  top: 32px; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 40px;
  pointer-events: none;
}
.frame > * { pointer-events: auto; }

.frame__brand {
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 0;
}
.frame__brand:hover { color: var(--ink); }

.frame__nav {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.frame__nav a {
  color: var(--ink-soft);
  border-bottom: 0;
}
.frame__nav a:hover { color: var(--ink); }
.frame__sep { color: var(--ink-faint); }

/* ---------- HERO — title plate ---------- */

.hero {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 90px 32px 110px;
  pointer-events: none;
  animation: hero-in 1200ms 80ms var(--ease-out) both;
}
.hero > * { pointer-events: auto; }
.hero.is-leaving { animation: hero-out 1000ms var(--ease-out) both; }

/* Radial scrim so the title plate stays legible over the globe */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 55% 50% at 50% 50%,
    rgba(4, 6, 10, 0.62) 0%,
    rgba(4, 6, 10, 0.35) 45%,
    rgba(4, 6, 10, 0) 80%
  );
}

.hero__inner {
  position: relative;
  z-index: 1;
  max-width: 640px;
  width: 100%;
  text-align: center;
  text-shadow:
    0 0 14px rgba(4, 6, 10, 0.85),
    0 1px 2px rgba(4, 6, 10, 0.85);
}

.hero__title {
  margin: 0;
  font: 400 clamp(56px, 8vw, 96px)/1 var(--display);
  letter-spacing: 0.005em;
  color: var(--ink);
}

.hero__tagline {
  margin: 28px auto 6px;
  max-width: 38ch;
  font: 400 clamp(15px, 1.4vw, 18px)/1.5 var(--serif);
  font-style: italic;
  color: var(--ink);
  letter-spacing: 0.005em;
}

.hero__sub {
  margin: 0 auto 32px;
  max-width: 42ch;
  font: 300 clamp(13px, 1.05vw, 14px)/1.6 var(--ui);
  color: var(--ink-mute);
}

.hero__begin {
  display: inline-block;
  padding: 16px 32px;
  background: transparent;
  border: 1px solid var(--ink-soft);
  color: var(--ink);
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 44px;
  transition: border-color 200ms var(--ease-out), color 200ms var(--ease-out), background-color 200ms var(--ease-out);
}
.hero__begin:hover,
.hero__begin:focus-visible {
  border-color: var(--ink);
  background: rgba(244, 241, 233, 0.06);
  outline: none;
}

.hero__hint {
  margin: 24px 0 0;
  font: 400 10px/1 var(--mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.hero__hint kbd {
  display: inline-block;
  min-width: 18px;
  padding: 2px 5px 1px;
  margin: 0 4px;
  border: 1px solid var(--hairline-strong);
  border-radius: 2px;
  font: inherit;
  font-size: 9px;
  color: var(--ink-soft);
}

/* ---------- Performance ticker ---------- */

.ticker {
  position: fixed;
  left: 40px; right: 40px;
  bottom: 76px;
  z-index: 10;
  pointer-events: none;
  animation: ticker-in 1200ms 200ms var(--ease-out) both;
}
.ticker > * { pointer-events: auto; }

.ticker__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 32px;
  flex-wrap: wrap;
}

.ticker__cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ticker__k {
  font: 500 9px/1 var(--mono);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.ticker__v {
  font: 400 18px/1 var(--serif);
  font-style: italic;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.ticker__sep {
  font: 300 12px/1 var(--mono);
  font-style: normal;
  color: var(--ink-faint);
  padding: 0 2px;
}

.ticker__axis {
  font: 500 9px/1 var(--mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-left: 6px;
  font-style: normal;
}

/* The driver toggle is intentionally invisible — surface with `d` key
   or #driver hash. Kept in the DOM for keyboard / a11y. */
.driver-toggle {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

/* ---------- Driver panel ---------- */

.driver {
  position: fixed;
  top: 78px;
  right: 40px;
  z-index: 11;
  width: 340px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01)),
    rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid var(--hairline);
  animation: rise 500ms var(--ease-out) both;
}
.driver__head { display: flex; align-items: baseline; gap: 10px; padding: 12px 16px 10px; border-bottom: 1px dashed var(--hairline); }
.driver__title { margin: 0; font: 400 15px/1 var(--serif); font-style: italic; color: var(--ink); flex: 1; }
.driver__id { font: 500 9px/1 var(--mono); letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-mute); padding: 4px 7px; border: 1px solid var(--hairline); }
.driver__body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.driver__lede { margin: 0; font: 400 13px/1.55 var(--serif); font-style: italic; color: var(--ink-soft); }
.driver__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.driver__list li {
  display: grid; grid-template-columns: 60px 1fr; gap: 12px; align-items: baseline;
  font: 400 12px/1.4 var(--ui); color: var(--ink-soft);
}
.driver__ch { font: 500 9px/1.4 var(--mono); letter-spacing: 0.16em; color: var(--ink-mute); }
.driver__cv-toggle {
  margin-top: 6px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--hairline-strong);
  font: 500 10px/1 var(--mono); letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink); cursor: pointer;
  transition: border-color 200ms;
  width: fit-content;
}
.driver__cv-toggle:hover { border-color: var(--ink); }
.driver__cv-toggle[aria-pressed="true"] { border-color: var(--signal); color: var(--signal); }
.driver__cv-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); }
.driver__cv-toggle[aria-pressed="true"] .driver__cv-dot { background: var(--signal); box-shadow: 0 0 6px var(--signal-glow); }
.driver__note { margin: 0; font: 500 9px/1.5 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); }

/* ---------- About overlay — floating semi-transparent panel ----------
   Centred frosted column over the still-running globe. Audio keeps
   playing underneath; the planet stays visible through the blur. */

.about-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 40px 32px;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 65% at 50% 50%, rgba(4, 6, 10, 0.55), rgba(4, 6, 10, 0.25));
  animation: overlay-in 380ms var(--ease-out) both;
}
.about-overlay.is-leaving { animation: overlay-out 240ms var(--ease-in-out) both; }

.about-overlay__panel {
  pointer-events: auto;
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-strong) transparent;
  padding: 64px 56px 72px;
  background: rgba(4, 6, 10, 0.62);
  backdrop-filter: blur(32px) saturate(135%);
  -webkit-backdrop-filter: blur(32px) saturate(135%);
  border: 1px solid var(--hairline);
  border-radius: 1px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 32px 80px -40px rgba(0, 0, 0, 0.9);
}

.about-overlay__panel::-webkit-scrollbar { width: 4px; }
.about-overlay__panel::-webkit-scrollbar-track { background: transparent; }
.about-overlay__panel::-webkit-scrollbar-thumb { background: var(--hairline-strong); border-radius: 2px; }

.about-overlay__close {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 1;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--ink-soft);
  font: 400 22px/1 var(--display);
  cursor: pointer;
  transition: border-color 180ms, color 180ms;
}
.about-overlay__close:hover,
.about-overlay__close:focus-visible {
  border-color: var(--ink);
  color: var(--ink);
  outline: none;
}

.about__inner {
  max-width: none;
  margin: 0;
  padding: 0;
}

.about__masthead {
  text-align: center;
  margin: 0 0 48px;
}

.about__title {
  margin: 0;
  font: 400 clamp(40px, 5vw, 60px)/1 var(--display);
  color: var(--ink);
  letter-spacing: 0.005em;
}

.about__tagline {
  margin: 18px 0 0;
  font: 400 clamp(15px, 1.3vw, 17px)/1.5 var(--serif);
  font-style: italic;
  color: var(--ink-soft);
}

.about__rule {
  text-align: center;
  margin: 36px 0;
  font: 400 14px/1 var(--mono);
  letter-spacing: 1em;
  color: var(--ink-faint);
}

.about__section { margin: 0 0 8px; }

.about__section-title {
  margin: 0 0 16px;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.about__section p {
  margin: 0 0 16px;
  font: 400 15px/1.7 var(--ui);
  font-weight: 300;
  color: var(--ink-soft);
}
.about__section p em {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink);
}
.about__section a {
  color: var(--ink);
  border-bottom: 1px solid var(--hairline);
}
.about__section a:hover {
  color: var(--signal);
  border-bottom-color: var(--signal);
}

/* Related works cross-links */
.about__series {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.about__series li {
  font: 400 14px/1.5 var(--ui);
  color: var(--ink-soft);
}
.about__series a {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--ink);
  border-bottom: 0;
}
.about__series a:hover { color: var(--signal); }
.about__series span { color: var(--ink-mute); font-size: 13px; }

/* Defs lists (Colophon) */
.about__defs {
  margin: 0;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 24px;
  align-items: baseline;
}
.about__defs dt {
  font: 500 10px/1.5 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.about__defs dd {
  margin: 0;
  font: 400 14px/1.55 var(--ui);
  color: var(--ink-soft);
}

.about__rights {
  margin: 24px 0 0;
  font: 400 13px/1.5 var(--ui);
  color: var(--ink-mute);
  text-align: center;
}
.about__rights a { color: var(--ink-soft); border-bottom: 1px solid var(--hairline); }

/* Inline crew list inside the Live section */
.about__crew {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.about__crew li {
  font: 400 13px/1.5 var(--serif);
  color: var(--ink-soft);
}
.about__crew-placeholder { color: var(--ink-mute) !important; font-style: italic; }

.about__defs-unit {
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  text-transform: lowercase;
  margin-left: 2px;
}

/* Onboard live-video embed inside the About modal */
.about__live {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 12px 0 0;
  background: #000;
  border: 1px solid var(--hairline);
  overflow: hidden;
}
.about__live iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}
.about__live-poster {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; padding: 20px;
  background:
    radial-gradient(ellipse 80% 70% at 50% 40%, rgba(36, 86, 130, 0.5), transparent 70%),
    #04060a;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  font: 400 14px/1 var(--serif);
  font-style: italic;
  text-align: center;
}
.about__live-poster:hover { filter: brightness(1.1); }
.about__live-poster svg {
  width: 36px; height: 36px;
  color: var(--ink);
  filter: drop-shadow(0 0 12px var(--signal-glow));
}

body.is-about-open { overflow: hidden; }

/* Suppress the hero plate + performance ticker while the about modal
   is open — the semi-transparent panel intentionally lets the globe
   through, but text on text on text is unreadable. */
body.is-about-open .hero,
body.is-about-open .ticker { opacity: 0; pointer-events: none; transition: opacity 240ms var(--ease-out); }

/* Standalone about page (when accessed directly via /about.html) */
.page--about { overflow-y: auto; overflow-x: hidden; }
.page--about #globe { display: none; }
.about { padding: 130px 0 110px; min-height: 100dvh; }
.about .about__inner { padding: 0 40px; }

/* ---------- Colophon ---------- */

.colophon {
  position: fixed;
  bottom: 32px; left: 0; right: 0;
  z-index: 10;
  padding: 0 40px;
  display: flex;
  justify-content: center;
  gap: 24px;
  pointer-events: none;
}
.colophon > * { pointer-events: auto; }

.colophon__left {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font: 500 10px/1.4 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.colophon a {
  color: var(--ink-soft);
  border-bottom: 0;
}
.colophon a:hover { color: var(--ink); }
.colophon__rule { color: var(--ink-faint); }

/* ---------- Idle-hide — fade chrome out after inactivity ----------
   Cinema-style. Triggered by the absence of mousemove/touch for
   ~3.5 s. Everything fades but the canvas. The hero, the about
   overlay, and the driver panel are exempt while they're open. */

.frame,
.ticker,
.colophon {
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
}
body.is-idle .frame    { opacity: 0; transform: translateY(-4px); pointer-events: none; }
body.is-idle .ticker   { opacity: 0; transform: translateY(4px); pointer-events: none; }
body.is-idle .colophon { opacity: 0; transform: translateY(4px); pointer-events: none; }
body.is-idle #globe    { cursor: none; }
body.is-about-open.is-idle .frame,
body.is-about-open.is-idle .ticker,
body.is-about-open.is-idle .colophon { opacity: 1 !important; transform: none !important; pointer-events: auto !important; }

/* ---------- Noscript ---------- */

.noscript {
  position: fixed; inset: 0;
  display: grid;
  place-items: center;
  background: var(--void);
  z-index: 100;
  padding: 20px;
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- Animations ---------- */

@keyframes hero-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes hero-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-12px); visibility: hidden; }
}
@keyframes ticker-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes hud-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes overlay-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes overlay-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50%      { transform: scale(2.4); opacity: 0; }
}
@keyframes flash {
  0%   { color: var(--signal); text-shadow: 0 0 12px var(--signal-glow); }
  100% { color: var(--ink); text-shadow: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  .driver { width: 300px; }
}

@media (max-width: 720px) {
  .frame { top: max(20px, env(safe-area-inset-top, 0)); padding: 0 20px; }
  .frame__brand, .frame__nav { font-size: 9px; letter-spacing: 0.2em; }

  .hero { padding: 80px 22px 96px; }
  .hero__title { font-size: clamp(40px, 12vw, 64px); }
  .hero__tagline { font-size: 15px; }
  .hero__sub { font-size: 12px; }
  .hero__begin { padding: 14px 24px; font-size: 10px; }

  .ticker {
    left: 18px; right: 18px;
    bottom: max(58px, calc(env(safe-area-inset-bottom, 0) + 44px));
  }
  .ticker__row { gap: 16px; }
  .ticker__v { font-size: 15px; }
  .ticker__k { font-size: 8px; }

  .colophon {
    bottom: max(14px, env(safe-area-inset-bottom, 0));
    padding: 0 18px;
  }
  .colophon__left { font-size: 9px; letter-spacing: 0.14em; text-align: center; flex-wrap: wrap; justify-content: center; }

  .about-overlay { padding: 24px 16px; }
  .about-overlay__panel { padding: 56px 28px 56px; }
  .about-overlay__close { top: 14px; right: 14px; }
  .about__defs { grid-template-columns: 1fr; gap: 4px 0; }
  .about__defs dd { margin-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
