/* ── Reset & Base ──────────────────────────────────────────────────────────── */

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

:root {
  --bg:        #000;
  --text:      #e8e4dc;
  --dim:       #888;
  --accent:    #c8b89a;
  --highlight: rgba(200, 184, 154, 0.12);
  --bubble-bg: rgba(6, 6, 10, 0.92);
  --mono:      'Courier New', Courier, monospace;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  overflow: hidden;
}

/* ── Nav ───────────────────────────────────────────────────────────────────── */

nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 24px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
  pointer-events: none;
}

nav * { pointer-events: auto; }

.site-name-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
}

.site-name {
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--text);
  text-decoration: none;
}

a.site-name-group .site-name {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.site-tagline {
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--accent);
  opacity: 1;
}

.nav-about {
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a.nav-about {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nav-about:hover { color: var(--text); }

/* ── Map ───────────────────────────────────────────────────────────────────── */

#map-container {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

#map-container picture {
  width: 100%;
  height: 100%;
  display: block;
}

#cmb-map {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  animation: mapPulse 8s ease-in-out infinite;
  transform-origin: center;
}

@keyframes mapPulse {
  0%   { filter: brightness(1.0)  saturate(1.0); }
  30%  { filter: brightness(1.35) saturate(1.4); }
  60%  { filter: brightness(1.05) saturate(1.1); }
  80%  { filter: brightness(1.5)  saturate(1.5); }
  100% { filter: brightness(1.0)  saturate(1.0); }
}

#depth-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#cosmic-web-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#grid-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* ── Hint ──────────────────────────────────────────────────────────────────── */

#hint {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--text);
  pointer-events: none;
  transition: opacity 0.5s;
  white-space: nowrap;
  text-align: center;
  text-shadow: 0 1px 6px rgba(0,0,0,0.9), 0 0 24px rgba(0,0,0,0.8);
}

#hint.hidden { opacity: 0; }

/* ── Bubble ────────────────────────────────────────────────────────────────── */

#bubble {
  position: fixed;
  width: 380px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: rgba(4, 4, 8, 0.97);
  border: 1px solid rgba(200, 184, 154, 0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 200;
  transition: opacity 0.2s;
}

#bubble.hidden { display: none; }

#bubble-close {
  position: absolute;
  top: 12px; right: 14px;
  background: none;
  border: none;
  color: var(--dim);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.15s;
  font-family: var(--mono);
  z-index: 1;
}

#bubble-close:hover { color: var(--text); }

#bubble-inner {
  overflow-y: auto;
  flex: 1;
  padding: 24px;
}

.coords-label {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--accent);
  margin-bottom: 10px;
}

.bubble-coords {
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--text);
  margin-bottom: 6px;
}

.bubble-coords span + span::before { content: "  "; }

.bubble-notable {
  font-size: 10px;
  color: var(--accent);
  line-height: 1.5;
  margin-bottom: 16px;
  font-style: italic;
}

.bubble-notable.hidden { display: none; }

.bubble-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.section-label {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--accent);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.transmission-status {
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.bubble-temps {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text);
  line-height: 1.8;
}


.bubble-words {
  font-size: 12px;
  line-height: 2;
  color: var(--text);
  word-spacing: 6px;
  letter-spacing: 0.05em;
}

.bubble-message {
  font-size: 12px;
  line-height: 1.85;
  color: var(--text);
  white-space: pre-wrap;
  min-height: 156px; /* 7 lines × 12px × 1.85 line-height */
}

.bubble-message .signal-word {
  color: var(--accent);
}

.bubble-date {
  font-size: 10px;
  color: var(--text);
  margin-top: 14px;
  letter-spacing: 0.1em;
  min-height: 1.4em;
}

.bubble-decoder {
  font-size: 10px;
  color: var(--text);
  margin-top: 5px;
  letter-spacing: 0.1em;
}

.bubble-decoder.hidden { display: none; }

.bubble-copy {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--dim);
  font-size: 18px;
  cursor: pointer;
  padding: 0 0 0 8px;
  font-family: var(--mono);
  transition: color 0.15s;
  line-height: 1;
}

.bubble-copy:hover { color: var(--accent); }
.bubble-copy.hidden { display: none; }

@media (max-width: 600px) {
  /* Bubble slides up from bottom as a sheet */
  #bubble {
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    max-height: 70vh;
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-radius: 0;
  }

  #bubble-inner {
    padding: 20px 20px 32px;
  }

  /* Larger tap target for close button */
  #bubble-close {
    top: 14px;
    right: 16px;
    font-size: 18px;
    padding: 8px 12px;
  }

  /* Allow hint to wrap on narrow screens */
  #hint {
    white-space: normal;
    width: 80%;
    bottom: 16px;
    font-size: 11px;
  }
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */

#bubble-inner::-webkit-scrollbar { width: 3px; }
#bubble-inner::-webkit-scrollbar-track { background: transparent; }
#bubble-inner::-webkit-scrollbar-thumb { background: rgba(200,184,154,0.2); }

/* ── About page ────────────────────────────────────────────────────────────── */

body.about-page {
  overflow: auto;
  background: #050508;
}

.about-content {
  max-width: 640px;
  margin: 100px auto 80px;
  padding: 0 24px;
}

.about-content h1 {
  font-size: 16px;
  letter-spacing: 0.15em;
  color: var(--accent);
  font-weight: normal;
  margin-bottom: 24px;
}

.about-content h2 {
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--accent);
  font-weight: normal;
  margin-top: 48px;
  margin-bottom: 20px;
  text-transform: uppercase;
}

.about-content p {
  font-size: 13px;
  line-height: 1.9;
  color: var(--text);
  margin-bottom: 16px;
}

.about-content section {
  margin-bottom: 16px;
}

.codec-live {
  font-size: 11px;
  line-height: 1.8;
  color: var(--accent);
  margin: 20px 0;
  padding: 16px;
  border-left: 2px solid rgba(200,184,154,0.2);
  white-space: pre;
  font-family: var(--mono);
  transition: opacity 0.4s;
}

.codec-display {
  font-size: 11px;
  line-height: 1.9;
  color: var(--accent);
  margin: 20px 0;
  padding: 16px;
  background: rgba(200,184,154,0.06);
  border: 1px solid rgba(200,184,154,0.18);
  white-space: pre-wrap;
}

.about-content blockquote {
  font-size: 12px;
  line-height: 2;
  color: var(--text);
  padding: 20px 24px;
  border-left: 2px solid rgba(200,184,154,0.3);
  margin: 20px 0;
  white-space: pre-wrap;
}

.mono { font-family: var(--mono); color: var(--accent); }

.credits {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.credits p {
  font-size: 12px;
  color: var(--text);
  line-height: 2;
}

.credits a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.credits a:hover { color: var(--text); }
