/* ECHIVO — #city · "Golden hour, Oradea" — horizontal gallery + next-cities split-flap board.
   Default (mobile / reduced motion / no JS) = native horizontal swipe with scroll-snap.
   #city.is-pinned (desktop, set by city.js) = pinned scene, track translates X. */

#city {
  --city-ink: #070a14;
  padding: clamp(88px, 12vh, 160px) 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, var(--night) 0%, rgba(5, 7, 13, 0) 18vh),
    radial-gradient(120% 70% at 50% 0%, rgba(20, 29, 51, 0.65), transparent 70%),
    var(--night);
  isolation: isolate;
}

#city .city-pin { position: relative; display: flex; flex-direction: column; }
#city .city-track { display: contents; }

/* ---------- ambient layers ---------- */
#city .city-glow {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 55% at 70% 100%, rgba(245, 200, 130, 0.22), transparent 70%),
    radial-gradient(45% 40% at 15% 90%, rgba(255, 138, 91, 0.12), transparent 70%);
  opacity: 0.7;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 72%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 0%, #000 72%, transparent 100%);
}
#city .city-ghost {
  position: absolute; left: 0; top: 50%; z-index: -1; pointer-events: none;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: clamp(9rem, 34vh, 22rem);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(245, 200, 130, 0.075);
  display: none;
}
#city .city-ghost span { display: block; will-change: transform; }

/* ---------- intro ---------- */
#city .city-intro { order: 1; padding: 0 var(--gutter); }
#city .city-intro__eyebrow,
#city .city-next__eyebrow { display: inline-flex; align-items: center; gap: 0.6em; margin: 0 0 22px; }
#city .city-intro__eyebrow svg,
#city .city-next__eyebrow svg { width: 16px; height: 16px; }
#city svg { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
#city .city-intro__title { font-size: var(--t-h1); margin: 0; line-height: 0.9; }
#city .city-gold {
  background: linear-gradient(100deg, #fff3dc 0%, var(--gold) 40%, var(--terracotta) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#city .city-intro__title .city-line { overflow: hidden; display: block; padding-bottom: 0.04em; }
#city .city-intro__line { margin: 22px 0 0; font-size: clamp(1.05rem, 1.5vw, 1.4rem); font-weight: 500; }
#city .city-intro__hint {
  display: none; align-items: center; gap: 10px; margin: 44px 0 0;
  font-size: var(--t-eyebrow); font-weight: 650; letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-3);
}
#city .city-intro__hint svg { width: 18px; height: 18px; color: var(--gold); animation: city-nudge 1.8s var(--ease-out) infinite; }
@keyframes city-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(8px); } }

/* ---------- the reel ---------- */
#city .city-reel {
  order: 2;
  list-style: none; margin: 0;
  display: flex; align-items: flex-start; gap: 16px;
  padding: 40px var(--gutter) 8px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter);
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
#city .city-reel::-webkit-scrollbar { display: none; }
#city .city-reel:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; border-radius: 12px; }
#city .city-reel::after { content: ""; flex: 0 0 1px; } /* end gutter */

#city .city-frame { flex: none; margin: 0; scroll-snap-align: start; width: 78vw; max-width: 460px; }
#city .city-frame--wide { width: 86vw; max-width: 540px; }
#city .city-frame__media {
  --ar: 3 / 4;
  position: relative; overflow: hidden;
  aspect-ratio: var(--ar);
  border-radius: var(--radius);
  background: var(--midnight);
  box-shadow: 0 0 0 1px var(--hairline), 0 40px 90px -40px rgba(0, 0, 0, 0.85), 0 30px 70px -45px rgba(245, 200, 130, 0.35);
  transform: translateZ(0);
}
#city .city-frame--square .city-frame__media { --ar: 1 / 1; }
#city .city-frame--wide .city-frame__media { --ar: 4 / 3; }
#city .city-frame--portrait .city-frame__media { --ar: 4 / 5; }
#city .city-frame__media::after { /* golden-hour wash + inner rim */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 7, 13, 0) 55%, rgba(5, 7, 13, 0.45) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
#city .city-frame__media img {
  position: absolute; top: 0; left: -12%;
  width: 124%; max-width: none; height: 100%;
  object-fit: cover;
}
#city .city-frame__label {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 4px 0;
  font-size: 0.74rem; font-weight: 750; letter-spacing: 0.2em; text-transform: uppercase; line-height: 1.2;
}
#city .city-frame__label svg { width: 16px; height: 16px; flex: none; color: var(--gold); }
#city .city-frame__num { font-family: var(--mono); font-weight: 500; letter-spacing: 0.05em; color: var(--text-3); }

/* ---------- progress ---------- */
#city .city-progress {
  order: 3;
  display: flex; align-items: center; gap: 16px;
  padding: 26px var(--gutter) 0;
}
#city .city-progress__count { font-family: var(--mono); font-size: 0.75rem; color: var(--text-3); white-space: nowrap; }
#city .city-progress__now { color: var(--gold); font-weight: 600; }
#city .city-progress__bar { position: relative; flex: 1; height: 1px; background: var(--hairline); overflow: hidden; }
#city .city-progress__bar i {
  position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--amber), var(--gold));
  box-shadow: 0 0 12px rgba(245, 200, 130, 0.8);
}

/* ---------- next cities ---------- */
#city .city-next { order: 4; padding: clamp(72px, 10vh, 120px) var(--gutter) 0; }
#city .city-next__title { font-size: var(--t-h2); margin: 0 0 30px; }
#city .city-board { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
#city .city-chip {
  --chip-fs: clamp(13px, 1.25vw, 18px);
  display: inline-flex; align-items: center; gap: 0.55em;
  padding: 0.6em 0.75em;
  border-radius: 16px;
  font-size: var(--chip-fs);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 18px 40px -24px rgba(0, 0, 0, 0.8);
  color: var(--text-2);
}
#city .city-chip.is-live {
  color: var(--text);
  border-color: rgba(245, 200, 130, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 0 0 1px rgba(245, 200, 130, 0.12), 0 0 44px -6px rgba(245, 200, 130, 0.45);
}
#city .city-chip__plain { font-weight: 750; letter-spacing: 0.16em; font-family: var(--mono); }
#city .city-chip.is-built .city-chip__plain {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
#city .city-dot { width: 0.5em; height: 0.5em; border-radius: 50%; background: var(--text-3); flex: none; }
#city .is-live .city-dot { background: var(--gold); box-shadow: 0 0 10px var(--gold); animation: city-pulse 1.8s ease-in-out infinite; }
@keyframes city-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 200, 130, 0.7), 0 0 10px var(--gold); } 60% { box-shadow: 0 0 0 7px rgba(245, 200, 130, 0), 0 0 10px var(--gold); } }
#city .city-word { display: inline-flex; gap: 1px; }
#city .city-sep { color: var(--text-3); font-weight: 700; padding: 0 0.1em; }
#city .city-flap {
  position: relative; display: inline-grid; place-items: center;
  width: 1.05em; height: 1.5em;
  border-radius: 4px;
  background: linear-gradient(180deg, #1b2236 0%, #141a2b 49%, #0d1220 51%, #121828 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 1px 0 rgba(0, 0, 0, 0.6);
  font-family: var(--mono); font-weight: 700; line-height: 1;
  perspective: 120px;
  contain: size layout style; /* fixed-size cell: a letter swap re-lays out only this cell (no paint clip: the gold glow stays) */
}
#city .city-flap::after { /* the split */
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(0, 0, 0, 0.7);
}
#city .city-flap b { display: block; font-weight: inherit; backface-visibility: hidden; transform-origin: 50% 50%; }
#city .city-board.is-settled .city-flap { perspective: none; }
#city .city-board.is-settled .city-flap b { backface-visibility: visible; }
#city .city-word--status .city-flap { color: var(--text-3); }
#city .is-live .city-word--status .city-flap { color: var(--gold); text-shadow: 0 0 10px rgba(245, 200, 130, 0.7); }
#city .city-next__note { margin: 22px 0 0; font-size: var(--t-small); color: var(--text-3); }

/* =====================================================================
   PINNED (desktop): one viewport, the track slides horizontally.
   ===================================================================== */
#city.is-pinned { padding: 0; }
#city.is-pinned .city-pin { display: block; height: 100vh; height: 100svh; overflow: hidden; }
#city.is-pinned .city-ghost { display: block; }
#city.is-pinned .city-track {
  display: flex; align-items: center;
  height: 100%; width: max-content;
  padding: 0 10vw 0 var(--gutter);
  gap: 8vw;
  will-change: transform;
}
#city.is-pinned .city-intro { flex: none; width: min(46vw, 660px); padding: 0; }
#city.is-pinned .city-intro__hint { display: inline-flex; }
#city.is-pinned .city-reel {
  display: flex; align-items: center; gap: 6vw;
  padding: 0; overflow: visible; scroll-snap-type: none;
}
#city.is-pinned .city-reel::after { display: none; }
#city.is-pinned .city-frame { width: auto; max-width: none; }
#city.is-pinned .city-frame__media { height: var(--h, 58vh); border-radius: var(--radius-lg); }
#city.is-pinned .city-frame--tall { --h: 64vh; }
#city.is-pinned .city-frame--square { --h: 52vh; }
#city.is-pinned .city-frame--wide { --h: 50vh; }
#city.is-pinned .city-frame--portrait { --h: 58vh; }
#city.is-pinned .city-frame--big.city-frame--square { --h: 62vh; }
#city.is-pinned .city-frame--big.city-frame--tall { --h: 70vh; }
#city.is-pinned .city-frame--up { margin-top: -12vh; }
#city.is-pinned .city-frame--down { margin-top: 14vh; }
#city.is-pinned .city-frame__media img { will-change: transform; }
#city.is-pinned .city-next { flex: none; width: max-content; max-width: 84vw; padding: 0; }
#city.is-pinned .city-chip { --chip-fs: clamp(11px, 0.92vw, 15px); gap: 0.45em; }
#city.is-pinned .city-progress {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: max(28px, 4.5vh);
  padding: 0;
}

/* Reduced motion on desktop: still a calm native swipe, a little larger. */
@media (min-width: 760px) {
  #city:not(.is-pinned) .city-frame { width: 34vw; max-width: 520px; }
  #city:not(.is-pinned) .city-frame--wide { width: 44vw; max-width: 640px; }
}
@media (prefers-reduced-motion: reduce) {
  #city .city-intro__hint svg, #city .is-live .city-dot { animation: none; }
}

/* Phones: one consistent card ratio so the swipe row has no ragged gaps. */
@media (max-width: 759px) {
  #city .city-frame,
  #city .city-frame--wide { width: 80vw; max-width: 420px; }
  #city .city-frame .city-frame__media { --ar: 4 / 5; }
  /* the swipe parallax moves the photo: give the photo its own layer so the rounded card never repaints */
  #city .city-frame__media img { will-change: transform; }
}

/* lowPower (phones / touch / low memory; .is-lite set by city.js): the "live" dot pings with transform/opacity
   (compositor) instead of an animated box-shadow (a repaint every frame). */
#city.is-lite .is-live .city-dot { position: relative; animation: none; }
#city.is-lite .is-live .city-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: rgba(245, 200, 130, 0.55);
  animation: city-ping 1.8s ease-out infinite;
}
@keyframes city-ping { 0% { transform: scale(1); opacity: .8; } 65%, 100% { transform: scale(2.8); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #city.is-lite .is-live .city-dot::after { animation: none; opacity: 0; } }
