/* Sky City hub: plain CSS port of the Tailwind mockup (no build step, CSP-safe). */

:root {
  --hub-bg: #0a0f1d;
  --hub-cyan: #4df2ff;
  --hub-teal: #1fa8b5;
  --hub-panel: rgba(13, 43, 54, 0.5);
  --hub-line: rgba(77, 242, 255, 0.25);
  --hub-text: #e2e8f0;
  --hub-muted: #94a3b8;
  --hub-glow: 0 0 15px rgba(77, 242, 255, 0.25);
  --hub-glow-strong: 0 0 25px rgba(77, 242, 255, 0.6);
  --volcano-magma: #f59e0b;
  --volcano-lava: #ef4444;
  --volcano-ash: #1e293b;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--hub-bg);
  color: var(--hub-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  -webkit-font-smoothing: antialiased;
}

.hub {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
}

/* Background layer: uses the image when present, otherwise the gradient. */
.hub-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    url("../img/backgrounds/sky-city.jpg") center / cover no-repeat,
    radial-gradient(circle at 60% 30%, rgba(31, 168, 181, 0.35), transparent 55%),
    linear-gradient(180deg, #0d2b36 0%, #0a0f1d 100%);
  background-size: cover;
  background-position: center;
  filter: brightness(0.85);
  transition: transform 0.7s ease-out;
}


.hub-scan {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 40%, rgba(10, 15, 29, 0.4));
}

.hub-title {
  position: absolute;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  width: min(42rem, calc(100% - 2rem));
  text-align: center;
  padding: 0.75rem 1.5rem;
  border: 1px solid rgba(77, 242, 255, 0.3);
  border-radius: 0.5rem;
  background: rgba(13, 43, 54, 0.4);
  backdrop-filter: blur(8px);
  box-shadow: var(--hub-glow);
  transition: border-color 0.3s, box-shadow 0.3s;
}

@media (min-width: 48rem) {
  .hub-title {
    left: calc(50% + 11rem);
    width: min(36rem, calc(100% - 24rem));
  }
}

.hub-title:hover {
  border-color: var(--hub-cyan);
  box-shadow: var(--hub-glow-strong);
}

.hub-title h1 {
  margin: 0.25rem 0 0;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--hub-cyan);
  text-shadow: 0 0 8px rgba(77, 242, 255, 0.5);
}

.hub-kicker {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(77, 242, 255, 0.7);
  font-weight: 600;
}

.hub-nav {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 2;
  width: 18rem;
  max-width: 85%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 7rem 1.5rem 1.5rem;
  background: linear-gradient(to right, rgba(10, 15, 29, 0.6), transparent);
  backdrop-filter: blur(4px);
  border-right: 1px solid rgba(77, 242, 255, 0.1);
}

.hub-node {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--hub-text);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.3s, transform 0.3s;
}

.hub-node:hover,
.hub-node:focus-visible,
.hub-node.is-current {
  opacity: 1;
}

.hub-node:hover .hub-name,
.hub-node:focus-visible .hub-name {
  color: var(--hub-cyan);
}

.hub-dot {
  flex: 0 0 auto;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 1px solid #94a3b8;
  background: rgba(10, 15, 29, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}

.hub-dot::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #94a3b8;
}

.hub-node:hover .hub-dot,
.hub-node:focus-visible .hub-dot {
  border-color: var(--hub-cyan);
  box-shadow: var(--hub-glow);
}

.hub-node:hover .hub-dot::after,
.hub-node:focus-visible .hub-dot::after {
  background: var(--hub-cyan);
}

.hub-dot-current {
  border: 2px solid var(--hub-cyan);
  background: rgba(13, 43, 54, 0.8);
  box-shadow: var(--hub-glow);
}

.hub-dot-current::after { background: var(--hub-cyan); }

.hub-node-text {
  display: flex;
  flex-direction: column;
}

.hub-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--hub-muted);
}

.hub-node.is-current .hub-label { color: var(--hub-cyan); font-weight: 700; }

.hub-name {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--hub-text);
  transition: color 0.3s;
}

.hub-footer {
  position: absolute;
  left: 1.5rem;
  bottom: 1.5rem;
  z-index: 2;
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(77, 242, 255, 0.5);
}

.hub-telemetry {
  position: absolute;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 2;
  width: min(24rem, calc(100% - 3rem));
  padding: 1.25rem;
  border: 1px solid rgba(77, 242, 255, 0.2);
  border-radius: 0.5rem;
  background: var(--hub-panel);
  backdrop-filter: blur(8px);
  box-shadow: var(--hub-glow);
  transition: border-color 0.3s;
}

.hub-telemetry:hover { border-color: rgba(77, 242, 255, 0.5); }

.hub-telemetry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(77, 242, 255, 0.2);
}

.hub-telemetry h2 {
  margin: 0;
  font-size: 0.875rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #f1f5f9;
}

.hub-badge {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid rgba(77, 242, 255, 0.2);
  background: rgba(77, 242, 255, 0.1);
  color: var(--hub-cyan);
}

.hub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  font-size: 0.75rem;
}

.hub-cell {
  padding: 0.625rem;
  border-radius: 0.375rem;
  border: 1px solid rgba(51, 65, 85, 0.4);
  background: rgba(10, 15, 29, 0.4);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.hub-cell-wide { grid-column: span 2; }

.hub-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--hub-cyan);
}

.hub-value small {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--hub-muted);
}

.hub-value-small {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--hub-cyan);
}

.hub-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.hub-bar {
  width: 100%;
  height: 0.375rem;
  border-radius: 999px;
  background: #1e293b;
  border: 1px solid #334155;
  overflow: hidden;
}

.hub-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--hub-cyan);
  box-shadow: 0 0 8px #4df2ff;
}

.hub-bar-92 { width: 92%; }

/* Pulse on the current node only, and only when motion is allowed. */
@media (prefers-reduced-motion: no-preference) {
  .hub-dot-current {
    animation: hub-pulse 4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  }
  .hub-bg { animation: hub-drift 30s ease-in-out infinite alternate; }
}

@keyframes hub-pulse {
  0%, 100% { box-shadow: var(--hub-glow); }
  50% { box-shadow: var(--hub-glow-strong); }
}

@keyframes hub-drift {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}

/* Interactive mesh sits above the backdrop but below the UI, and ignores the pointer. */
.hub-mesh {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Volcano monitoring station (amber alert palette). */
.hub-volcano {
  position: absolute;
  top: 7rem;
  left: 19rem;
  z-index: 2;
  width: 24rem;
  max-width: calc(100% - 20rem);
  padding: 1rem 1.25rem;
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 0.5rem;
  background: var(--hub-panel);
  backdrop-filter: blur(8px);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.15);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.hub-volcano:hover {
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.3);
}

.hub-volcano-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.6rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
}

.hub-volcano h2 {
  margin: 0;
  font-size: 0.875rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #f1f5f9;
}

.hub-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hub-pulse {
  position: relative;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--volcano-magma);
}

.hub-tag {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid rgba(245, 158, 11, 0.2);
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
}

.hub-stack {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  font-size: 0.75rem;
}

.hub-panel {
  padding: 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid rgba(51, 65, 85, 0.5);
  background: rgba(10, 15, 29, 0.6);
}

.hub-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.hub-volcano .hub-value { color: var(--volcano-magma); }

.hub-wave {
  position: relative;
  height: 2.5rem;
  border-radius: 0.375rem;
  border: 1px solid var(--volcano-ash);
  background: rgba(2, 6, 23, 0.8);
  overflow: hidden;
}

.hub-wave svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: rgba(245, 158, 11, 0.7);
  stroke-width: 1.5;
}

.hub-wave::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 95%, rgba(245, 158, 11, 0.05) 95%);
  background-size: 20px 100%;
}

.hub-volcano .hub-cell {
  background: rgba(10, 15, 29, 0.6);
}

.hub-volcano .hub-value,
.hub-volcano .hub-value-small {
  color: var(--volcano-magma);
}

.hub-neutral {
  align-self: flex-start;
  font-size: 0.6rem;
  text-transform: uppercase;
  padding: 0 0.25rem;
  border-radius: 0.25rem;
  border: 1px solid rgba(52, 211, 153, 0.2);
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
}

.hub-meter {
  height: 0.75rem;
  padding: 2px;
  border-radius: 0.25rem;
  border: 1px solid var(--volcano-ash);
  background: rgba(2, 6, 23, 0.8);
  overflow: hidden;
}

.hub-meter-fill {
  height: 100%;
  border-radius: 0.25rem;
  background: linear-gradient(90deg, #d97706, #fbbf24, var(--volcano-lava));
  box-shadow: 0 0 10px var(--volcano-magma);
}

.hub-meter-44 { width: 44%; }

.hub-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
  font-size: 0.5rem;
  color: #64748b;
}

.hub-temp {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid var(--volcano-ash);
  background: rgba(15, 23, 42, 0.4);
  font-size: 0.6875rem;
}

.hub-ok { color: #34d399; font-size: 0.6rem; }

@media (prefers-reduced-motion: no-preference) {
  .hub-pulse::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--volcano-magma);
    opacity: 0.75;
    animation: hub-ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
  }
}

@keyframes hub-ping {
  75%, 100% { transform: scale(2.2); opacity: 0; }
}

/* Small screens: stack the nav above the telemetry. */
@media (max-width: 1100px) {
  .hub {
    height: 100vh;
    overflow-y: auto;
  }
  .hub-volcano,
  .hub-telemetry {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    width: auto;
    margin: 0 1.5rem 1.5rem 19rem;
  }
  .hub-volcano { margin-top: 7rem; }
  .hub-footer { display: none; }
}

@media (max-width: 760px) {
  .hub-nav {
    position: relative;
    top: auto;
    left: auto;
    bottom: auto;
    width: auto;
    max-width: none;
    flex-direction: row;
    flex-wrap: wrap;
    margin: 7.5rem 1rem 1rem;
    padding: 0;
    gap: 0.75rem;
    background: none;
    border-right: 0;
  }
  .hub-node { flex: 1 1 40%; }
  .hub-dot { width: 2.25rem; height: 2.25rem; }
  .hub-volcano,
  .hub-telemetry { margin: 0 1rem 1rem; }
  .hub-volcano { margin-top: 0; }
}
