/* ─────────────────────────────────────────────────────────────────────────
   STREETS OF NUEVA YORK — styles
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --bg: #0a0a0b;
  --bg-2: #0e0f12;
  --ink: #f4f1ea;
  --ink-dim: rgba(244, 241, 234, 0.55);
  --ink-faint: rgba(244, 241, 234, 0.32);
  --accent: #ff5b2e;       /* construction-cone orange — very NY */
  --frame: rgba(255, 255, 255, 0.06);
  --tile-w: 300px;
  --tile-h: 380px;
}

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

html, body { height: 100%; }

body {
  background:
    radial-gradient(120% 120% at 50% 0%, #14151a 0%, var(--bg) 55%, #060607 100%);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  cursor: default;
}

/* ── stage / canvas surface ─────────────────────────────────────────────── */
.stage {
  position: fixed;
  inset: 0;
  cursor: grab;
  touch-action: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}
body.ready .stage { opacity: 1; }
.stage.grabbing { cursor: grabbing; }

/* ── tiles ──────────────────────────────────────────────────────────────── */
.tile {
  position: absolute;
  top: 0; left: 0;
  width: var(--tile-w);
  height: var(--tile-h);
  will-change: transform, opacity;
  transform: translate3d(-9999px, -9999px, 0);
  overflow: hidden;
  border-radius: 4px;
  background: #15161a;
  box-shadow: 0 18px 50px -28px rgba(0, 0, 0, 0.9);
  outline: 1px solid var(--frame);
  outline-offset: -1px;
  transition: box-shadow .5s ease, outline-color .5s ease;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 0;
  transform: scale(1.08);
  filter: blur(12px) saturate(0.7);
  transition: opacity 1s ease, transform 1.2s cubic-bezier(.16,1,.3,1), filter 1.2s ease;
}
.tile.loaded img {
  opacity: 1;
  transform: scale(1);
  filter: blur(0) saturate(1);
}
.tile.is-hover {
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.95);
  outline-color: rgba(255, 255, 255, 0.18);
}
.tile.is-hover img { filter: saturate(1.05) contrast(1.02); }

/* caption */
.tile figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 28px 14px 12px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.02em;
  background: linear-gradient(to top, rgba(0,0,0,0.72), transparent);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .45s ease, transform .45s ease;
}
.tile.is-hover figcaption { opacity: 1; transform: none; }
.cap-idx { color: var(--accent); font-weight: 500; }
.cap-loc { color: rgba(255,255,255,0.85); }

/* ── atmosphere ─────────────────────────────────────────────────────────── */
.vignette {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 60;
  background: radial-gradient(120% 100% at 50% 45%, transparent 52%, rgba(0,0,0,0.55) 100%);
}
.grain {
  position: fixed; inset: -50%;
  pointer-events: none;
  z-index: 61;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 6s steps(6) infinite;
}
@keyframes grain {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-6%, 4%); }
  40%  { transform: translate(4%, -6%); }
  60%  { transform: translate(-3%, 5%); }
  80%  { transform: translate(5%, -3%); }
  100% { transform: translate(0, 0); }
}

/* ── HUD ────────────────────────────────────────────────────────────────── */
.hud {
  position: fixed;
  z-index: 70;
  pointer-events: none;
  padding: clamp(18px, 3vw, 38px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: 100%;
}
.hud-top { top: 0; align-items: flex-start; }
.hud-bottom { bottom: 0; }

.wordmark .kicker {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.wordmark h1 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: clamp(30px, 5.5vw, 68px);
  line-height: 0.92;
  letter-spacing: -0.01em;
}
.wordmark h1 em {
  font-style: italic;
  color: var(--accent);
}

.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
}
.meta .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(255, 91, 46, 0.6);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,91,46,0.5); }
  70%  { box-shadow: 0 0 0 9px rgba(255,91,46,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,91,46,0); }
}

.hint {
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  transition: opacity .8s ease, transform .8s ease;
}
.hint .sep { color: var(--ink-faint); }
body.explored .hint { opacity: 0; transform: translateY(8px); }

/* ── lightbox ───────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0;
  z-index: 90;
  pointer-events: none;
}
.lightbox.show { pointer-events: auto; }
.lb-backdrop {
  position: absolute; inset: 0;
  z-index: 1;
  background: rgba(6, 6, 7, 0.86);
  backdrop-filter: blur(14px);
  opacity: 0;
  transition: opacity .5s ease;
}
.lightbox.show .lb-backdrop { opacity: 1; }

.lb-img {
  position: fixed;
  z-index: 2;
  object-fit: cover;
  border-radius: 5px;
  box-shadow: 0 60px 140px -40px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transition: left .58s cubic-bezier(.16,1,.3,1), top .58s cubic-bezier(.16,1,.3,1),
              width .58s cubic-bezier(.16,1,.3,1), height .58s cubic-bezier(.16,1,.3,1),
              opacity .35s ease;
  will-change: left, top, width, height;
}
.lightbox.show .lb-img { opacity: 1; }

.lb-info {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: clamp(20px, 5vh, 48px);
  transform: translateX(-50%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity .5s ease .15s;
}
.lightbox.show .lb-info { opacity: 1; }
.lb-idx {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--accent);
}
.lb-title {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-size: clamp(22px, 4vw, 34px);
  font-style: italic;
}
.lb-loc {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 0.08em;
}
.lb-close {
  margin-top: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

/* ── responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hint span:nth-child(n+5) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .tile img { transition: opacity .4s ease; transform: none; filter: none; }
}
