/* NEMOCITY — "Golden Hour Toybox". Museum placards around a diorama: warm
   frosted-glass panels that sit NEXT TO the model, never chrome over it.
   Panels stay light at night (lit placards in a dark gallery). */

:root {
  --panel: rgba(252, 249, 242, 0.78);
  --panel-strong: rgba(252, 249, 242, 0.92);
  --ink: #2a2620;
  --ink-dim: rgba(42, 38, 32, 0.62);
  --ink-faint: rgba(42, 38, 32, 0.42);
  --line: rgba(60, 50, 40, 0.12);
  --line-strong: rgba(60, 50, 40, 0.22);
  --terracotta: #e07856;
  --terracotta-deep: #cd6240;
  --red: #e84f3d;
  --amber: #c98a2d;
  --green: #3e8e5a;
  --shadow: 0 10px 30px rgba(70, 50, 30, 0.14);
  --display: "Bricolage Grotesque", "Schibsted Grotesk", system-ui, sans-serif;
  --sans: "Schibsted Grotesk", -apple-system, system-ui, sans-serif;
  --mono: "Spline Sans Mono", ui-monospace, "SF Mono", monospace;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: #ffe9c2; /* day horizon — flashes before first paint, never black */
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
#scene:active { cursor: grabbing; }

/* ---------- placard base ---------- */
.placard {
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  color: var(--ink);
}

/* every panel fades 250 ms; photo + FPV hide the whole HUD */
.hud { transition: opacity 0.25s ease; z-index: 10; }
body.photo .hud,
body.fpv .hud {
  opacity: 0;
  pointer-events: none;
}

/* ---------- wordmark + stat chips (top-left) ---------- */
.brand {
  position: fixed;
  top: 18px;
  left: 18px;
  padding: 14px 18px 12px;
  max-width: min(420px, calc(100vw - 36px));
}
.brand__mark {
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.13em;
  line-height: 1;
}
.brand__tag {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
}
.stats {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.7);
  white-space: nowrap;
}
.chip__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}
.chip__num {
  font-family: var(--display);
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.chip--visitors {
  font-size: 11px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.chip--traffic.is-warn .chip__num { color: var(--amber); }
.chip--traffic.is-jam .chip__num { color: var(--red); animation: jamBlink 1.4s ease infinite; }
@keyframes jamBlink { 50% { opacity: 0.45; } }

/* odometer-roll digits */
.odo { display: inline-flex; height: 1em; overflow: hidden; line-height: 1; }
.odo-digit { display: block; height: 1em; overflow: hidden; }
.odo-roll { display: block; transition: transform 0.55s cubic-bezier(0.25, 0.8, 0.25, 1); }
.odo-roll span { display: block; height: 1em; line-height: 1; text-align: center; }

/* ---------- mode buttons (top-right) ---------- */
.modes {
  position: fixed;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 8px;
}
.mode-btn {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--ink);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.mode-btn:hover { background: var(--panel-strong); }
.mode-btn[aria-pressed="true"] {
  border-color: var(--terracotta);
  color: var(--terracotta-deep);
}
/* no pointer-lock walking on touch devices (v0) */
@media (hover: none) { #btn-walk { display: none; } }

/* ---------- traffic alert (top-center) ---------- */
.traffic-alert {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  border-color: rgba(232, 79, 61, 0.45);
  animation: alertPulse 1.8s ease infinite;
}
.traffic-alert.is-fixed { border-color: rgba(62, 142, 90, 0.45); animation: none; }
.traffic-alert__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  animation: jamBlink 1.4s ease infinite;
}
.traffic-alert.is-fixed .traffic-alert__dot { background: var(--green); animation: none; }
@keyframes alertPulse {
  50% { box-shadow: 0 10px 30px rgba(232, 79, 61, 0.28); }
}
#btn-fix {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 12px;
  color: #fff8ee;
  background: var(--red);
  border: none;
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
}
#btn-fix:hover { filter: brightness(1.08); }
#btn-fix[hidden] { display: none; }

/* ---------- City Hall paperwork drawer (right) ---------- */
.paperwork {
  position: fixed;
  right: 18px;
  bottom: 56px;
  width: 340px;
  max-width: calc(100vw - 36px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.paperwork__toggle {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.paperwork__toggle:hover { color: var(--ink); background: var(--panel-strong); }
.paperwork__toggle.has-new { border-color: var(--terracotta); color: var(--terracotta-deep); }
.paperwork__body {
  display: none;
  margin-top: 8px;
  width: 100%;
  max-height: 42vh;
  overflow: auto;
  padding: 6px 12px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.paperwork.is-open .paperwork__body { display: block; }
.permit { padding: 8px 0; border-bottom: 1px solid var(--line); }
.permit:last-child { border-bottom: none; }
.permit header {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  margin-bottom: 4px;
}
.permit pre {
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}
.permit__line {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-dim);
  margin-top: 3px;
}

/* ---------- petition desk (bottom-center) ---------- */
.petition {
  position: fixed;
  left: 50%;
  bottom: 44px;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 11;
}
.queue-chip {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--ink-dim);
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.lifecycle {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.lc-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.lc-chip.is-mine { border-color: var(--terracotta); }
.lc-chip.is-reading .lc-chip__label::after {
  content: "";
  display: inline-block;
  width: 1.1em;
  text-align: left;
  animation: ellipsis 1.2s steps(1) infinite;
}
@keyframes ellipsis {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}
.lc-chip.is-building .lc-chip__label::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #ff8a3d; /* construction orange */
  animation: jamBlink 1.2s ease infinite;
  vertical-align: 1px;
}
.lc-chip.is-built { border-color: rgba(62, 142, 90, 0.5); }
.lc-chip.is-built .lc-chip__label { color: var(--green); }
.lc-chip.is-rejected .lc-chip__label { color: var(--red); }
.lc-chip__view {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--terracotta-deep);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.petition__form {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px;
  border-radius: 999px;
}
.petition__input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  padding: 8px 14px;
}
.petition__input::placeholder { color: var(--ink-faint); }
.petition__input.pulse { animation: petitionPulse 1.1s ease 2; border-radius: 999px; }
@keyframes petitionPulse {
  50% { box-shadow: 0 0 0 4px rgba(224, 120, 86, 0.22); }
}
.petition__send {
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: #fff8ee;
  background: var(--terracotta);
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  cursor: pointer;
}
.petition__send:hover { background: var(--terracotta-deep); }
.petition__send:active { transform: translateY(1px); }
.petition__send:disabled { opacity: 0.6; cursor: default; }
.toast {
  font-size: 12px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-strong);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  max-width: 100%;
  text-align: center;
}
.toast.is-warn { border-color: rgba(232, 79, 61, 0.5); color: #8e2f1f; }

/* ---------- news ticker (bottom edge) ---------- */
.ticker {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.ticker__inner {
  display: inline-block;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink);
  animation: tickerScroll 40s linear infinite;
  will-change: transform;
}
.ticker__copy { display: inline-block; padding-right: 6em; }
@keyframes tickerScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- FPV overlay ---------- */
.fpv-ui { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
.fpv-ui[hidden] { display: none; }
.fpv-ui__crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: rgba(252, 249, 242, 0.92);
  box-shadow: 0 0 6px rgba(20, 15, 10, 0.5);
}
.fpv-ui__hint {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink);
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  opacity: 0.9;
}

/* ---------- photo mode hint (the only thing visible in photo mode) ---------- */
.photo-hint { display: none; }
body.photo .photo-hint {
  display: block;
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  color: var(--ink);
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  animation: photoHint 3s ease forwards;
}
@keyframes photoHint {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- status (bottom-left, quiet diagnostics) ---------- */
.status {
  position: fixed;
  left: 18px;
  bottom: 38px;
  z-index: 10;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--ink-dim);
  padding: 3px 9px;
  border-radius: 7px;
  background: rgba(252, 249, 242, 0.55);
  transition: opacity 0.25s ease;
}
body.photo .status, body.fpv .status { opacity: 0; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .brand { top: 12px; left: 12px; padding: 11px 14px 10px; }
  .brand__mark { font-size: 18px; }
  .brand__tag { font-size: 10px; }
  .chip { padding: 3px 8px; }
  .chip__num { font-size: 12px; }
  .modes { top: 12px; right: 12px; gap: 6px; }
  .mode-btn { padding: 6px 10px; font-size: 11px; }
  .traffic-alert { top: auto; bottom: 132px; width: max-content; max-width: calc(100vw - 24px); }
  .petition { bottom: 38px; }
  .petition__input { font-size: 16px; } /* prevent iOS zoom-on-focus */
  .paperwork { right: 12px; bottom: 44px; width: 280px; }
  .status { display: none; }
}
@media (max-width: 560px) {
  .paperwork { display: none; }
}
