/* CityWide411 — styles */
:root {
  --bg: #06070a;
  --neon: #e6ff00;
  --neon-soft: rgba(230, 255, 0, 0.55);
  --neon-glow: 0 0 6px rgba(230, 255, 0, 0.55), 0 0 18px rgba(230, 255, 0, 0.22);
  --ink: #e9ecef;
  --muted: rgba(233, 236, 239, 0.55);
  --mono: 'Share Tech Mono', 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ui-pad: clamp(14px, 2.2vw, 28px);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
#stage { position: fixed; inset: 0; cursor: grab; touch-action: none; }
#stage.dragging { cursor: grabbing; }
#stage.hovering { cursor: pointer; }
#stage canvas { display: block; }

/* ---------- Labels (projected from 3D) ---------- */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.label {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  font-family: var(--mono);
  color: var(--neon);
  text-shadow: 0 0 2px rgba(0,0,0,.9), 0 1px 2px rgba(0,0,0,.9), var(--neon-glow);
  line-height: 1.25;
  letter-spacing: 0.02em;
  will-change: transform, opacity;
  opacity: 0;
  transition: opacity .25s ease;
  white-space: nowrap;
  padding: 10px 12px;
  background: transparent;
}
.label.visible { opacity: 1; }
.label .name { font-size: 15px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.label .meta { font-size: 10.5px; opacity: .85; margin-top: 2px; }
.label .time { font-size: 13px; margin-top: 3px; letter-spacing: .08em; }
.label .time .sec { opacity: .6; }
.label .time .tzn { opacity: .7; margin-left: 6px; font-size: 10.5px; }
.label .tag { font-size: 10px; opacity: .6; margin-top: 2px; letter-spacing: .12em; text-transform: uppercase; display: none; }
.label.hover .tag, .label.focus .tag { display: block; }
.label.hover { text-shadow: 0 0 2px rgba(0,0,0,1), 0 0 8px rgba(230,255,0,.7), 0 0 24px rgba(230,255,0,.35); }

/* Brand panels carry their own logo; only show a label when focused */
.label.brand:not(.focus) { display: none; }
.label.brand .name { font-size: clamp(22px, 2.8vw, 36px); }
.label.brand.focus { padding-top: 14px; }
.label.brand .extra { max-width: min(620px, 70vw); white-space: normal; font-size: 12.5px; line-height: 1.6; }
.label.brand .extra p { margin: 0 0 8px; }
.label.brand .extra code { font-family: var(--mono); font-size: 11px; color: var(--neon); }

/* Expanded card when a city is focused */
.label.focus { padding: 16px 18px; pointer-events: auto; }
.label.focus .name { font-size: clamp(20px, 2.6vw, 34px); letter-spacing: .08em; }
.label.focus .meta { font-size: 12.5px; margin-top: 6px; }
.label.focus .time { font-size: clamp(16px, 2vw, 22px); margin-top: 8px; }
.label.focus .tag { display: block; font-size: 11px; margin-top: 6px; }
.label .extra { display: none; margin-top: 10px; font-size: 11.5px; line-height: 1.6; opacity: .8; }
.label.focus .extra { display: block; }
.label .extra b { opacity: .55; font-weight: 400; display: inline-block; width: 7.5em; }
.label .cta { display: none; margin-top: 12px; }
.label.focus .cta { display: inline-block; }
.label .cta a {
  color: #0a0a0a; background: var(--neon); text-decoration: none; font-family: var(--mono);
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase; padding: 8px 12px; border-radius: 3px;
  box-shadow: var(--neon-glow); text-shadow: none;
}
.label .cta a:hover { filter: brightness(1.08); }

/* ---------- Top bar ---------- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: calc(var(--ui-pad) * .6) var(--ui-pad);
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(6,7,10,.75), rgba(6,7,10,0));
}
#topbar > * { pointer-events: auto; }
#topbar, #foot { opacity: 0; transition: opacity .8s ease .3s; }
#topbar.in, #foot.in { opacity: 1; }
a.brand { display: inline-flex; align-items: center; }
#logo { height: 64px; width: auto; max-width: 48vw; object-fit: contain; object-position: left; display: block; filter: drop-shadow(0 0 10px rgba(230,255,0,.25)); }
.topbar-center { justify-self: center; }
.topbar-right { justify-self: end; display: flex; align-items: center; gap: 22px; }
.stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; font-family: var(--mono); }
.stat span { color: var(--neon); font-size: 15px; text-shadow: var(--neon-glow); letter-spacing: .06em; }
.stat small { color: var(--muted); font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; margin-top: 4px; }
button.ghost {
  appearance: none; background: rgba(255,255,255,.04); color: var(--ink);
  border: 1px solid rgba(255,255,255,.14); border-radius: 999px; padding: 8px 14px;
  font: 500 12px var(--sans); letter-spacing: .04em; cursor: pointer;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color .2s, background .2s, color .2s;
}
button.ghost:hover { border-color: var(--neon-soft); color: var(--neon); }
button.ghost kbd { font: 10px var(--mono); border: 1px solid rgba(255,255,255,.2); border-radius: 4px; padding: 1px 5px; margin-left: 8px; opacity: .7; }

/* search */
#search { position: relative; width: min(380px, 44vw); }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-55%); color: var(--muted); font-size: 16px; pointer-events: none; }
#search-input {
  width: 100%; appearance: none; background: rgba(255,255,255,.05); color: var(--ink);
  border: 1px solid rgba(255,255,255,.12); border-radius: 999px; padding: 10px 16px 10px 38px;
  font: 400 13.5px var(--sans); outline: none; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: border-color .2s, background .2s;
}
#search-input::placeholder { color: var(--muted); }
#search-input:focus { border-color: var(--neon-soft); background: rgba(255,255,255,.07); }
#search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); margin: 0; padding: 6px; list-style: none;
  background: rgba(10,12,16,.92); border: 1px solid rgba(255,255,255,.1); border-radius: 14px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); display: none; max-height: 320px; overflow: auto;
}
#search-results.open { display: block; }
#search-results li { padding: 9px 12px; border-radius: 9px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
#search-results li small { color: var(--muted); font-family: var(--mono); font-size: 11px; }
#search-results li:hover, #search-results li.active { background: rgba(230,255,0,.1); color: var(--neon); }

/* ---------- Hint / footer ---------- */
.hint {
  position: fixed; left: 50%; bottom: calc(var(--ui-pad) + 18px); transform: translateX(-50%); z-index: 15;
  display: flex; align-items: center; gap: 14px; padding: 10px 18px; border-radius: 999px;
  background: rgba(10,12,16,.45); border: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: 12px; color: var(--muted); letter-spacing: .02em; white-space: nowrap;
  transition: opacity .6s ease, transform .6s ease; pointer-events: none;
}
.hint b { color: var(--ink); font-weight: 500; }
.hint .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--neon); opacity: .7; }
.hint.hide { opacity: 0; transform: translate(-50%, 8px); }
#credits-link { display: none; color: var(--neon); text-decoration: none; pointer-events: auto; }
#foot {
  position: fixed; left: var(--ui-pad); right: var(--ui-pad); bottom: 12px; z-index: 10;
  display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); letter-spacing: .04em; pointer-events: none;
}

/* ---------- Focus UI ---------- */
.focus-ui { position: fixed; inset: 0; z-index: 18; pointer-events: none; }
.focus-ui[hidden] { display: none; }
#focus-close { position: absolute; left: var(--ui-pad); bottom: calc(var(--ui-pad) + 18px); pointer-events: auto; }
.focus-nav { position: absolute; right: var(--ui-pad); bottom: calc(var(--ui-pad) + 18px); display: flex; gap: 8px; pointer-events: auto; }
.focus-nav button { width: 40px; height: 40px; padding: 0; font-size: 20px; line-height: 1; }

/* ---------- Loader / landing ---------- */
#loader {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: radial-gradient(ellipse at center, #0c0e14 0%, #05060a 70%);
  transition: opacity .9s ease, background .8s ease;
}
#loader.ready { background: transparent; pointer-events: none; }  /* the 3D logo panel takes over */
#loader.done { opacity: 0; pointer-events: none; }
.loader-logo { width: min(62vw, 760px); filter: drop-shadow(0 0 22px rgba(230,255,0,.35)); transition: opacity .6s ease; }
#loader.ready .loader-logo { opacity: 0; }
.loader-panel {
  position: absolute; left: 50%; bottom: clamp(28px, 7vh, 72px); transform: translateX(-50%);
  display: grid; justify-items: center; gap: 14px; pointer-events: auto;
}
.loader-bar { width: 260px; height: 2px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; }
#loader-fill { height: 100%; width: 0; background: var(--neon); box-shadow: var(--neon-glow); transition: width .25s ease; }
.loader-text { font: 11px var(--mono); color: var(--neon); letter-spacing: .25em; text-transform: uppercase; opacity: .8; }
.loader-count { font: 10.5px var(--mono); color: var(--muted); letter-spacing: .18em; text-transform: uppercase; min-height: 14px; }
button.explore {
  appearance: none; cursor: pointer; margin-top: 4px;
  background: var(--neon); color: #0a0a0a; border: 0; border-radius: 3px; padding: 13px 26px;
  font: 600 12.5px var(--mono); letter-spacing: .2em; text-transform: uppercase;
  box-shadow: 0 0 10px rgba(230,255,0,.55), 0 0 36px rgba(230,255,0,.25);
  transition: transform .2s ease, box-shadow .2s ease, opacity .3s ease;
}
button.explore:hover { transform: translateY(-1px); box-shadow: 0 0 14px rgba(230,255,0,.75), 0 0 48px rgba(230,255,0,.35); }
button.explore:disabled { opacity: .35; cursor: progress; box-shadow: none; }

/* ---------- Credits dialog ---------- */
dialog#credits {
  width: min(720px, 92vw); max-height: 80vh; border: 1px solid rgba(255,255,255,.1); border-radius: 18px;
  background: rgba(10,12,16,.96); color: var(--ink); padding: 26px 28px; overflow: auto;
}
dialog#credits::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(6px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dialog-head h2 { margin: 0; font: 600 18px var(--sans); letter-spacing: .02em; }
.muted { color: var(--muted); }
#credits code { font-family: var(--mono); font-size: 12px; color: var(--neon); }
#credits-list { list-style: none; padding: 0; margin: 16px 0 0; columns: 2; column-gap: 28px; font-size: 12px; line-height: 1.5; }
#credits-list li { break-inside: avoid; margin-bottom: 8px; }
#credits-list b { font-weight: 600; color: var(--ink); }
#credits-list a { color: var(--neon); text-decoration: none; }
#credits-list a:hover { text-decoration: underline; }
#credits-list .lic { color: var(--muted); font-family: var(--mono); font-size: 10.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  #topbar { grid-template-columns: auto 1fr; gap: 10px 8px; padding: 12px 14px; }
  .topbar-center { grid-column: 1 / -1; justify-self: stretch; order: 3; }
  #search { width: 100%; }
  #logo { height: 34px !important; }
  .topbar-right { gap: 12px; }
  .stat:first-child { display: none; }
  .stat span { font-size: 13px; }
  button.ghost { padding: 7px 10px; font-size: 11px; }
  #search-input { padding: 9px 14px 9px 34px; font-size: 13px; }
  .label.focus { padding: 10px 12px; }
  .label.focus .extra { font-size: 10.5px; }
  .focus-nav button { width: 36px; height: 36px; }
  .label .name { font-size: 13px; }
  .label .meta { font-size: 9.5px; }
  .label .time { font-size: 11.5px; }
  .hint { font-size: 11px; gap: 10px; padding: 8px 14px; bottom: calc(var(--ui-pad) + 54px); }
  .hint span:nth-child(3), .hint span:nth-child(4) { display: none; }
  #foot span:last-child { display: none; }
  #credits-btn { display: none; }
  #credits-link { display: inline; }
  #credits-list { columns: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .label, .hint, #loader { transition: none; }
}
