/* SPECCOM — landing page styles.
   The object and its inscription are raymarched in WebGL (assets/js/forge.js);
   everything here is the DOM layer around it and the no-WebGL / no-JS fallback. */

@font-face {
  font-family: "Michroma";
  src: url("../fonts/michroma-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-300-normal.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --void: #050403;
  --pale: #f3e3c6;
  --gold: #ffb347;
  --ember: #e8892f;
  --dim: rgba(243, 227, 198, 0.6);
  --faint: rgba(243, 227, 198, 0.34);
  --gutter: clamp(16px, 3vw, 32px);
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --display: "Michroma", "Arial Black", system-ui, sans-serif;
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  color: var(--pale);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  background:
    radial-gradient(ellipse 60% 50% at 50% 46%, #1a0f06 0%, transparent 70%),
    var(--void);
  font-family: var(--mono);
}

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

#forge {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 1.4s ease;
  touch-action: none;
  cursor: crosshair;
}
.gl #forge { opacity: 1; }

/* ---------- Stage ---------- */

.stage {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 4vh, 40px);
  padding: 0 var(--gutter);
  pointer-events: none;
  text-align: center;
}

/* Fallback wordmark: shown only when WebGL never takes over. It waits a beat so
   a capable browser never flashes it before the canvas is ready. */
.wordmark {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(34px, 9vw, 140px);
  line-height: 1;
  letter-spacing: 0.08em;
  padding-left: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff1d6 0%, #ffbe62 50%, #b8621c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 24px rgba(255, 160, 60, 0.3));
  opacity: 0;
  animation: reveal 1s ease 0.9s forwards;
}

.gl .wordmark {
  /* WebGL cuts the visible wordmark into the monolith; keep the heading for assistive tech. */
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  animation: none;
}

.lede {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  opacity: 0;
  animation: reveal 1s ease 1.4s forwards;
}
.lede p { margin: 0; }

.subline {
  font-size: clamp(10px, 1.05vw, 13px);
  font-weight: 500;
  letter-spacing: 0.62em;
  padding-left: 0.62em; /* balance the trailing letter-spacing */
  text-transform: uppercase;
  color: var(--pale);
  white-space: nowrap;
}

.tagline {
  font-size: clamp(12px, 1.2vw, 15px);
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--dim);
  white-space: nowrap;
}
.tagline-text { display: inline-block; min-height: 1.4em; }
.tagline-text .untyped { visibility: hidden; }
/* The caret rides between the typed text and the invisible remainder. */
.tagline-text.typing span:first-child::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-right: -0.55em;
  vertical-align: -0.17em;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(255, 170, 70, 0.7);
  animation: caret 0.9s steps(1) infinite;
}

.gl .lede {
  position: absolute;
  left: 50%;
  top: var(--mark-bottom, 62%);
  transform: translate(-50%, 0);
  animation: none;
  transition: opacity 0.9s ease;
}
.gl .subline {
  letter-spacing: 0.2em;
  opacity: 0;
  transition: letter-spacing 2.2s cubic-bezier(0.16, 0.8, 0.2, 1), padding 2.2s cubic-bezier(0.16, 0.8, 0.2, 1), opacity 1.2s ease;
  padding-left: 0.2em;
}
.gl.finished .lede { opacity: 1; }
.gl.finished .subline { letter-spacing: 0.62em; padding-left: 0.62em; opacity: 1; }
.gl.away .lede { opacity: 0; }
.gl.away .subline { opacity: 1; letter-spacing: 0.62em; padding-left: 0.62em; }

@media (max-width: 520px) {
  .subline, .gl.finished .subline, .gl.away .subline { letter-spacing: 0.42em; padding-left: 0.42em; }
}

/* ---------- Boot sequence + readout ---------- */

.boot, .readout {
  position: fixed;
  top: calc(var(--gutter) + env(safe-area-inset-top, 0px));
  font-size: 11px;
  line-height: 1.75;
  letter-spacing: 0.08em;
  color: var(--faint);
  white-space: pre;
  pointer-events: none;
}
.boot {
  left: calc(var(--gutter) + env(safe-area-inset-left, 0px));
  transition: opacity 1.4s ease;
}
.boot b { color: var(--gold); font-weight: 500; }
.boot em { color: var(--ember); font-style: normal; }
.boot.done { opacity: 0; }

.readout {
  right: calc(var(--gutter) + env(safe-area-inset-right, 0px));
  display: none;
  flex-direction: column;
  align-items: flex-end;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 1.6s ease 0.4s;
}
.readout span:first-child { color: var(--dim); }
.gl .readout { display: flex; }
.gl.revealed .readout { opacity: 1; }
@media (max-width: 520px) {
  .readout { display: none !important; }
}

/* ---------- HUD ---------- */

.hud {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--gutter);
  padding-bottom: calc(var(--gutter) + env(safe-area-inset-bottom, 0px));
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--faint);
  opacity: 0;
  animation: reveal 1.2s ease 1.6s forwards;
}
.gl .hud { animation: none; transition: opacity 1.6s ease 0.6s; }
.gl.revealed .hud { opacity: 1; }

.hud-controls {
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 40px);
}

.hud-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: -8px -12px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  border-radius: 2px;
  transition: color 0.3s ease;
}
.hud-button[hidden] { display: none; }
.hud-button:hover, .sound[aria-pressed="true"] { color: var(--pale); }
.hud-button:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }

.sound-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 10px;
}
.sound-eq i {
  width: 2px;
  height: 2px;
  background: currentColor;
  transition: height 0.3s ease;
}
.sound[aria-pressed="true"] .sound-eq i {
  background: var(--gold);
  animation: eq 1.1s ease-in-out infinite alternate;
}
.sound[aria-pressed="true"] .sound-eq i:nth-child(2) { animation-delay: -0.4s; animation-duration: 0.8s; }
.sound[aria-pressed="true"] .sound-eq i:nth-child(3) { animation-delay: -0.7s; animation-duration: 1.3s; }
.sound[aria-pressed="true"] .sound-eq i:nth-child(4) { animation-delay: -0.2s; animation-duration: 0.95s; }

@keyframes eq {
  from { height: 2px; }
  to { height: 10px; }
}
@keyframes reveal {
  to { opacity: 1; }
}
@keyframes caret {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .wordmark, .lede, .hud { animation-delay: 0s; animation-duration: 0.01s; }
  .gl .subline { transition: none; }
  .tagline-text.typing span:first-child::after { display: none; }
  .sound[aria-pressed="true"] .sound-eq i { animation: none; height: 6px; }
}

@media (max-width: 520px) {
  .hud { font-size: 9px; letter-spacing: 0.16em; }
}
@media (max-width: 400px) {
  .hud-year { display: none; }
}
