/* Vibespace — Taipei night-market palette.
   Signage colour bleeding onto a plum-dark ground, the way a wet street at
   night reflects a stall sign. Glow is a large-radius coloured shadow, never a
   stroked text outline. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/web/archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #0D0A14;
  --asphalt: #1A1522;
  --slab: #241C2F;

  --lantern: #F5333F;
  --betel: #3DF2C0;
  --orchid: #FF4FA3;

  --rice: #F2ECE0;
  --rice-dim: #9C93A8;
  --rice-faint: #665C74;

  /* Data colours, validated against the panel surface for CVD and contrast.
     Deliberately less bright than the UI accents above: these carry meaning,
     so they must sit in one lightness band rather than compete. */
  --plus: #CA7D00;
  --minus: #00AE80;

  --sans: "Archivo", ui-sans-serif, system-ui, "Helvetica Neue", sans-serif;
  --cjk: "PingFang TC", "Noto Sans CJK TC", "Microsoft JhengHei", ui-sans-serif, sans-serif;

  --pad: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--rice);
  font-family: var(--sans);
  -webkit-text-size-adjust: 100%;
}

#map { position: absolute; inset: 0; }

/* ---------- top bar ---------- */

#bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  padding: calc(var(--safe-top) + 10px) var(--pad) 18px;
  background: linear-gradient(to bottom, rgba(13, 10, 20, .85), rgba(13, 10, 20, 0));
  /* The bar is a gradient over the map; only the button itself takes taps. */
  pointer-events: none;
}
#advanced-toggle { pointer-events: auto; }

#advanced-toggle, #reset {
  flex: none;
  padding: 7px 12px;
  border: 1px solid #3A3147;
  border-radius: 999px;
  background: rgba(26, 21, 34, 0.82);
  color: var(--rice-dim);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
#advanced-toggle[aria-expanded="true"] { color: var(--orchid); border-color: var(--orchid); }

/* ---------- axis sliders ---------- */

#advanced {
  position: absolute;
  z-index: 6;
  top: calc(var(--safe-top) + 58px);
  right: var(--pad);
  width: min(320px, calc(100vw - 2 * var(--pad)));
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--pad);
  border: 1px solid #3A3147;
  border-radius: 14px;
  background: rgba(26, 21, 34, 0.97);
  box-shadow: 0 18px 50px -12px #000;
}

.slider-row {
  display: grid;
  grid-template-columns: 1fr 34px;
  align-items: center;
  gap: 4px 10px;
  margin-bottom: 9px;
  font-size: 12px;
  color: var(--rice-dim);
}
.slider-row output {
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--rice);
}
.slider-row input {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
  accent-color: var(--orchid);
}

#reset { width: 100%; margin-top: 4px; }

/* ---------- markers ---------- */

.maplibregl-ctrl-group {
  background: rgba(26, 21, 34, .92) !important;
  border: 1px solid #3A3147;
}
.maplibregl-ctrl-group button + button { border-top-color: #3A3147; }
.maplibregl-ctrl-icon { filter: invert(1) hue-rotate(180deg); }
.maplibregl-ctrl-attrib {
  background: rgba(13, 10, 20, .8) !important;
  font-size: 10px;
}
.maplibregl-ctrl-attrib a { color: var(--rice-faint); }

/* ---------- detail sheet ---------- */

#sheet {
  position: absolute;
  z-index: 7;
  left: 0; right: 0; bottom: 0;
  max-height: 78vh;
  overflow-y: auto;
  padding: 16px var(--pad) calc(var(--safe-bottom) + 20px);
  border-top: 1px solid #3A3147;
  border-radius: 18px 18px 0 0;
  background: var(--asphalt);
  box-shadow: 0 -20px 60px -20px #000;
  animation: rise .18s ease-out;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0 } }
@media (prefers-reduced-motion: reduce) { #sheet { animation: none } }

#sheet-close {
  position: absolute;
  top: 10px; right: 12px;
  width: 32px; height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--slab);
  color: var(--rice-dim);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

/* The one bold move: the Chinese name hung vertically, like a stall sign. */
.place {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 16px;
}
.sign {
  writing-mode: vertical-rl;
  font-family: var(--cjk);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: .06em;
  max-height: 8.2em;
  padding: 2px 5px 2px 0;
  border-right: 1px solid #3A3147;
  color: var(--orchid);
  text-shadow: 0 0 26px rgba(255, 79, 163, .45);
}
.place h2 {
  margin: 2px 0 3px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -.01em;
}
.meta {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--rice-faint);
}
.summary {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.52;
  color: var(--rice);
  max-width: 62ch;
}

.shot {
  width: 100%;
  height: 152px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 12px;
  background: var(--slab);
}

.contact {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--rice-dim);
}
.contact a { color: var(--betel); }
.contact .zh { font-family: var(--cjk); }

.actions { display: flex; gap: 8px; margin-top: 4px; }
.actions a {
  flex: 1;
  padding: 11px;
  border-radius: 10px;
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.go { background: var(--orchid); color: var(--ink); box-shadow: 0 0 26px -6px var(--orchid); }

/* ---------- fingerprint ---------- */

.fingerprint { margin: 0 0 14px; }
.fp-caption {
  margin: 0 0 7px;
  font-size: 12px;
  color: var(--rice-faint);
}
.fp-row {
  display: grid;
  grid-template-columns: 7.6em 1fr 3.1em;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin: 0 0 2px;
  padding: 2px 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 11.5px;
  color: var(--rice-dim);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.fp-row[aria-expanded="true"] { color: var(--rice); }
.fp-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--rice-faint);
}
.fp-row[aria-expanded="true"] .fp-value { color: var(--rice); }
.fp-track { position: relative; height: 13px; }
.fp-zero {
  position: absolute; left: 50%; top: 0; bottom: 0;
  width: 1px; background: #3A3147;
}
.fp-bar {
  position: absolute; top: 3px; height: 7px;
  border-radius: 2px;
}
.fp-why {
  margin: 1px 0 9px;
  padding-left: calc(7.6em + 9px);
  font-size: 12px;
  line-height: 1.5;
  color: var(--rice-dim);
  max-width: 60ch;
}

/* ---------- boot overlay ---------- */

#boot {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: var(--pad);
  background: var(--ink);
  transition: opacity .3s;
}
#boot.done { opacity: 0; pointer-events: none; }
#boot-inner { width: min(340px, 100%); text-align: left; }
#boot-title {
  margin: 0 0 10px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--orchid);
  text-shadow: 0 0 34px rgba(255, 79, 163, .5);
}
#boot-note {
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--rice-dim);
  max-width: 46ch;
}
#boot-track {
  height: 3px;
  border-radius: 2px;
  background: var(--slab);
  overflow: hidden;
}
#boot-fill {
  height: 100%;
  width: 0;
  background: var(--betel);
  box-shadow: 0 0 16px var(--betel);
  transition: width .2s;
}
#boot-pct {
  margin: 8px 0 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--rice-faint);
}
#boot-note.error { color: var(--lantern); }
