/* ---------- reset & root ---------- */
*,
*::before,
*::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Space Grotesk', system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

:root {
  /* Backgrounds — warmed slightly toward the cream/green of the logo
     so the dark UI feels related to the brand instead of cold black. */
  --bg:    #0a0d09;
  --bg-1:  #11150e;
  --bg-2:  #181d15;
  --line:        rgba(255,255,255,0.08);
  --line-strong: rgba(255,255,255,0.18);
  --text:       #ecf0e6;
  --text-dim:   #a4ad9f;
  --text-faint: #6b7268;

  /* Brand — direct from the logo */
  --accent:        #22c96a;                    /* logo green */
  --accent-hover:  #18b35d;                    /* darker green for hover */
  --accent-on:     #04210e;                    /* dark text that sits on a green button */
  --accent-glow:   rgba(34,201,106,0.55);
  --accent-glow-strong: rgba(34,201,106,0.75);
  --accent-soft:   rgba(34,201,106,0.12);
  --accent-edge:   rgba(34,201,106,0.32);

  /* Logo cream — used very sparingly as a warm secondary tone */
  --cream:         #efece2;

  /* Globe data palette — kept warm for legibility against satellite imagery.
     These intentionally do NOT use the brand green so origin/destination/
     route lines pop against green continents and blue oceans. */
  --route-line:    #ff7a1a;
  --route-origin:  #22c96a;                    /* green = "go" — also brand-cohesive */
  --route-dest:    #ff2d6f;
  --route-via:     #4dd0e1;

  --shadow: 0 30px 80px -20px rgba(0,0,0,0.6);
  --radius: 14px;
  --panel-w: 420px;
}

a { color: inherit; }

/* ---------- loader ---------- */
.loader {
  position: fixed; inset: 0;
  background: var(--bg);
  display: grid; place-items: center;
  z-index: 100;
  transition: opacity 0.6s ease;
}
.loader.hidden { opacity: 0; pointer-events: none; }
.loader-inner { text-align: center; }
.loader-logo {
  width: 96px; height: 96px;
  border-radius: 22px;
  display: block;
  margin: 0 auto 22px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.06),
    0 18px 60px -12px var(--accent-glow-strong),
    0 0 80px var(--accent-soft);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50%      { transform: scale(1.08); opacity: 1; }
}
.loader-text {
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.06em;
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------- topbar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: var(--panel-w);
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px;
  z-index: 30;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: block;
  object-fit: cover;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.08),
    0 6px 18px -6px rgba(34,200,110,0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.brand:hover .brand-mark {
  transform: rotate(-4deg) scale(1.04);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.12),
    0 8px 24px -6px rgba(34,200,110,0.7);
}
.brand-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.topbar-nav {
  display: flex; align-items: center; gap: 22px;
}
.nav-link {
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--text); }
.cta {
  background: var(--accent);
  color: var(--accent-on);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  box-shadow: 0 8px 24px -8px var(--accent-glow);
}
.cta:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 12px 30px -8px var(--accent-glow-strong);
}

/* ---------- stage ---------- */
.stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr var(--panel-w);
  grid-template-rows: 1fr;             /* lock the single row to the stage height */
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  overflow: hidden;                    /* never let the inner grid scroll the page */
}
.stage > * { min-width: 0; min-height: 0; }   /* allow flex/overflow children to shrink */

/* ---------- Cesium widget overrides ---------- */
#globe { position: absolute; inset: 0; }
.cesium-viewer,
.cesium-viewer-cesiumWidgetContainer,
.cesium-widget,
.cesium-widget canvas {
  width: 100% !important;
  height: 100% !important;
  background: var(--bg) !important;
}
.cesium-viewer-bottom { display: none !important; }
.cesium-credits {
  position: absolute;
  bottom: 10px; right: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  opacity: 0.6;
  z-index: 4;
  pointer-events: auto;
  text-align: right;
  max-width: 60%;
}
.cesium-credits:hover { opacity: 1; }
.cesium-credits a { color: var(--text-dim); text-decoration: none; }
.cesium-credits a:hover { color: var(--accent); }
.cesium-credits img { height: 14px; vertical-align: middle; opacity: 0.8; }
.cesium-credit-lightbox-overlay {
  background: rgba(5,6,10,0.9) !important;
  backdrop-filter: blur(8px);
}
.cesium-credit-lightbox {
  background: var(--bg-1) !important;
  border: 1px solid var(--line-strong) !important;
  color: var(--text) !important;
  font-family: 'Space Grotesk', sans-serif !important;
}

/* ---------- globe ---------- */
.globe-pane {
  position: relative;
  background:
    radial-gradient(ellipse at 60% 40%, rgba(34,201,106,0.07), transparent 60%),
    radial-gradient(ellipse at 30% 70%, rgba(255,180,100,0.04), transparent 55%),
    var(--bg);
  overflow: hidden;
}
#globe {
  position: absolute; inset: 0;
}
.globe-overlay {
  position: absolute; inset: 0;
  pointer-events: none;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 88px 56px 32px;
}
.overlay-top { max-width: 540px; }
.kicker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}
.hero-title {
  margin: 0 0 14px;
  font-size: clamp(32px, 4.4vw, 58px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.02em;
}
.hero-sub {
  font-size: 16px;
  color: var(--text-dim);
  max-width: 460px;
  margin: 0 0 18px;
  line-height: 1.55;
}
.hero-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-faint);
}
.hero-meta span {
  color: var(--text);
  font-weight: 500;
}
.overlay-hint {
  display: flex; align-items: center; gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
  animation: pulse 1.6s ease-in-out infinite;
}

/* ---------- panel ---------- */
.panel {
  position: relative;
  background: var(--bg-1);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  z-index: 5;
  height: 100%;
}
.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.tab {
  flex: 1;
  padding: 16px 12px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.tab:disabled { opacity: 0.4; cursor: not-allowed; }
.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.tab:not(:disabled):not(.active):hover { color: var(--text-dim); }

.panel-view {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.panel-view.hidden { display: none; }

/* search */
.search {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.search input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.search input::placeholder { color: var(--text-faint); }
.search input:focus { border-color: var(--accent); }

/* list */
.list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.list::-webkit-scrollbar { width: 6px; }
.list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

.list-item {
  display: flex; gap: 14px;
  padding: 14px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.list-item:hover { background: var(--bg-2); }
.list-item.active {
  background: var(--bg-2);
  border-color: var(--accent-edge);
}
.list-item-num {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
}
.list-item-body { flex: 1; min-width: 0; }
.list-item-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item-route {
  font-size: 12px;
  color: var(--text-faint);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item-dist {
  font-size: 11px;
  color: var(--accent-2);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 4px;
}

.list-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

/* detail view */
.detail-view {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.detail-view::-webkit-scrollbar { width: 6px; }
.detail-view::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

.back-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  padding: 14px 20px 0;
  cursor: pointer;
  align-self: flex-start;
  transition: color 0.15s;
}
.back-btn:hover { color: var(--text); }

#detailContent {
  padding: 16px 20px 32px;
}
.detail-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.detail-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 14px;
}
.detail-route {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 18px;
  font-size: 13px;
}
.detail-route-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.detail-route-row:last-child { margin-bottom: 0; }
.detail-route-icon {
  width: 18px; flex-shrink: 0;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.detail-route-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  width: 70px;
  flex-shrink: 0;
}
.detail-route-value { color: var(--text); }
.detail-waypoints {
  margin-top: 10px;
  padding-left: 28px;
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.detail-waypoints li {
  list-style: none;
  position: relative;
}
.detail-waypoints li::before {
  content: '·';
  position: absolute;
  left: -12px;
  color: var(--accent);
}

.detail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}
.detail-stat {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.detail-stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.detail-stat-value {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.detail-section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 8px;
}
/* ---------- gas calculator ---------- */
.gas-calc {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 22px;
}
.gas-fields {
  display: grid;
  gap: 10px;
}
.gas-field {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: center;
  gap: 10px;
}
.gas-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.gas-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  transition: border-color 0.15s;
}
.gas-input-wrap:focus-within { border-color: var(--accent); }
.gas-input-wrap input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 0;
  -moz-appearance: textfield;
}
.gas-input-wrap input::-webkit-outer-spin-button,
.gas-input-wrap input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.gas-unit {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.gas-unit-pre { margin-right: 4px; }
.gas-result {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  display: grid;
  gap: 6px;
}
.gas-result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
}
.gas-result-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.gas-result-value {
  color: var(--text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.gas-result-total .gas-result-label { color: var(--text-dim); }
.gas-result-total .gas-result-value {
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
}

.detail-actions {
  display: flex; flex-direction: column; gap: 10px;
}
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent);
  color: var(--accent-on);
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  box-shadow: 0 12px 30px -10px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 16px 36px -10px var(--accent-glow-strong);
}
.btn-secondary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent;
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--line-strong);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--bg-2);
}

/* tooltip */
.scene-tooltip { pointer-events: none; }
.tip {
  background: rgba(10,13,20,0.96);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  max-width: 240px;
}
.tip-title { font-weight: 600; margin-bottom: 4px; }
.tip-route {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
}

/* ---------- about ---------- */
.about {
  background: var(--bg-1);
  border-top: 1px solid var(--line);
  padding: 100px 56px;
}
.about-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
}
.about h2 {
  font-size: clamp(28px, 3vw, 40px);
  margin: 0 0 18px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.about p {
  color: var(--text-dim);
  line-height: 1.65;
  font-size: 16px;
}
.about a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-edge);
}
.steps {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 18px;
}
.steps li {
  display: flex; gap: 14px;
  font-size: 16px;
  color: var(--text-dim);
  line-height: 1.5;
}
.steps li span {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
}
.steps em {
  color: var(--accent);
  font-style: normal;
  font-weight: 500;
}

/* ---------- footer ---------- */
.foot {
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 24px 56px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px;
  color: var(--text-faint);
  font-family: 'JetBrains Mono', monospace;
}
.foot-links { display: flex; gap: 20px; }
.foot a { text-decoration: none; transition: color 0.15s; }
.foot a:hover { color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  :root { --panel-w: 380px; }
  .globe-overlay { padding: 88px 32px 32px; }
}

@media (max-width: 880px) {
  .stage {
    grid-template-columns: 1fr;
    grid-template-rows: 55dvh 45dvh;
    height: 100dvh;
  }
  .globe-pane { order: 0; }     /* explicit: globe on top */
  .panel      { order: 1; }     /* explicit: list below */
  .panel { border-left: none; border-top: 1px solid var(--line); }
  .globe-overlay { padding: 80px 24px 24px; }
  .hero-title { font-size: clamp(28px, 7vw, 36px); }
  .hero-sub { display: none; }
  .topbar { right: 0; padding: 14px 18px; }   /* full-width topbar when panel is stacked below */
  .topbar-nav { gap: 14px; }
  .nav-link { display: none; }
  .about { padding: 60px 24px; }
  .about-inner { grid-template-columns: 1fr; gap: 40px; }
  .foot { padding: 20px 24px; flex-direction: column; gap: 10px; text-align: center; }
}
