/* Welcome page: a full-screen 3D scene with text and the zone dock on top. */

body.hub {
  overflow: hidden;
  height: 100dvh;
  background:
    radial-gradient(ellipse 80% 60% at 50% 30%, #0c1426 0%, var(--bg) 70%);
}

.scene {
  position: fixed;
  inset: 0;
  touch-action: none;
  cursor: grab;
}
.scene.is-dragging { cursor: grabbing; }
.scene.is-hovering { cursor: pointer; }
.scene canvas { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity 900ms ease; }
.scene canvas.is-ready { opacity: 1; }

/* ---------- Text ---------- */

.hub-head {
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  left: var(--gutter);
  z-index: 10;
  max-width: 400px;
  pointer-events: none;
}
.hub-head h1 {
  margin: 6px 0 12px;
  font-size: clamp(56px, 8vw, 96px);
  text-shadow: 0 2px 12px rgba(0,0,0,.8);
}
.hub-intro {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  max-width: 34ch;
  text-shadow: 0 1px 8px var(--bg);
}

/* ---------- Labels over the 3D stations ---------- */

.tags { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.zone-tag {
  position: absolute;
  left: 0; top: 0;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  min-height: 34px;
  background: rgba(6, 10, 18, 0.8);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 400ms, border-color 160ms, color 160ms, background 160ms;
  will-change: transform;
}
.zone-tag::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.zone-tag::after {
  /* The line down to the station. */
  content: "";
  position: absolute;
  left: 50%; top: 100%;
  width: 1px; height: 18px;
  background: linear-gradient(var(--line-2), transparent);
}
.zone-tag b { font-weight: 600; }
.tags.is-ready .zone-tag { opacity: 1; }
.zone-tag.is-active { border-color: var(--accent); color: var(--accent); background: rgba(8, 30, 44, 0.92); }
.zone-tag[data-zone="garden"]::before { background: var(--grow); box-shadow: 0 0 8px var(--grow); }
.zone-tag[data-zone="lab"]::before { background: var(--term); box-shadow: 0 0 8px var(--term); }
.zone-tag[data-zone="comms"]::before { background: var(--signal); box-shadow: 0 0 8px var(--signal); }

/* ---------- Dock ---------- */

.dock {
  position: fixed;
  z-index: 10;
  left: var(--gutter);
  bottom: max(24px, env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
}
.dock__item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 18px 10px 12px;
  background: rgba(11, 16, 25, 0.86);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 160ms, background 160ms, transform 160ms;
}
.dock__item:hover,
.dock__item.is-active { border-color: var(--accent); background: rgba(10, 32, 46, 0.95); color: var(--ink); transform: translateY(-2px); }
.dock__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  color: var(--accent);
  line-height: 1;
}
.dock__text strong { display: block; font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; }
.dock__text span { display: block; font-size: 12px; color: var(--ink-3); }

.status {
  position: fixed;
  z-index: 10;
  right: var(--gutter);
  bottom: max(24px, env(safe-area-inset-bottom));
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  pointer-events: none;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(6, 9, 17, 0.72);
  backdrop-filter: blur(6px);
}
.status__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--signal);
}
.status.is-online .status__dot { background: var(--term); box-shadow: 0 0 6px var(--term); }

/* ---------- Phone and narrow screens ---------- */

@media (max-width: 760px) {
  .hub-head { right: var(--gutter); max-width: none; }
  .hub-head h1 { font-size: clamp(44px, 14vw, 64px); margin: 4px 0 8px; }
  .hub-intro { font-size: 13px; }

  .dock {
    left: 12px; right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    gap: 8px;
  }
  .dock__item {
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-height: 0;
    padding: 10px 12px;
  }
  .dock__num { font-size: 20px; }
  .dock__text strong { font-size: 13px; }
  .dock__text span { font-size: 11px; }

  .status__hint { display: none; }
  .status {
    left: 50%; right: auto;
    transform: translateX(-50%);
    justify-content: center;
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 112px);
  }
  .zone-tag { font-size: 11px; padding: 5px 10px 5px 8px; min-height: 30px; }
}

@media (max-width: 360px) {
  .dock__text span { display: none; }
}

/* Short screens (phone held sideways). */
@media (max-height: 520px) and (min-width: 561px) {
  .hub-intro { display: none; }
  .hub-head h1 { font-size: 44px; }
  .dock__item { min-height: 48px; padding: 6px 14px 6px 10px; }
}

/* ---------- No WebGL: the dock becomes the page ---------- */

body.no-webgl .scene,
body.no-webgl .tags,
body.no-webgl .status { display: none; }
body.no-webgl .hub-head,
body.no-webgl .dock {
  position: static;
  margin: 0;
  padding: 40px var(--gutter) 0;
}
body.no-webgl .dock { flex-direction: column; padding-bottom: 48px; max-width: 520px; }
body.no-webgl .dock__item { flex-direction: row; align-items: center; min-height: 64px; }
body.no-webgl {
  overflow: auto;
  height: auto;
  background:
    radial-gradient(ellipse 120% 60% at 50% 140%, #1d5fa0 0%, #0b2a4a 45%, var(--bg) 70%);
}
