/* ==========================================================================
   VISIONS OF NYC — main.css
   Tokens, reset, layout, typography, nav, hero, footer.
   ========================================================================== */

/* ---------- Tokens ---------- */

:root {
  --ink: #0A0A0B;
  --carbon: #141416;
  --bone: #EDEAE4;
  --ash: #8B8A86;
  --signal: #E8FF2A;

  --font-display: 'Anton', sans-serif;
  --font-body: 'Instrument Sans', sans-serif;
  --font-mono: 'Space Mono', monospace;

  --nav-h: 64px;
  --gutter: clamp(16px, 3vw, 40px);
  --title-size: clamp(4rem, 18vw, 16rem);
}

/* ---------- Reset ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--carbon) var(--ink);
}

body {
  background: var(--ink);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

/* Accessibility floor: visible signal focus rings everywhere */
:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

::selection {
  background: var(--signal);
  color: var(--ink);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Scroll lock while lightbox / overlay is open */
body.is-locked {
  overflow: hidden;
}

/* ---------- Type utilities ---------- */

.mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--ash);
}

/* ==========================================================================
   Nav
   ========================================================================== */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  padding: 0 var(--gutter);
  mix-blend-mode: normal;
}

.nav__logo {
  display: block;
  flex: 0 0 auto;
}

.nav__logo img {
  height: 40px;
  width: auto;
  /* source PNG is navy on transparent — render bone-white on the dark page */
  filter: brightness(0) invert(0.93);
}

.nav__counter {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--ash);
  white-space: nowrap;
}

.nav__index {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bone);
  padding: 10px 20px;
  border: 1px solid rgba(237, 234, 228, 0.35);
  transition: color 0.3s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.3s ease;
}

/* signal fill swipes in from the left on hover, exits to the right on leave */
.nav__index::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--signal);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav__index:hover::before,
.nav__index:focus-visible::before {
  transform: scaleX(1);
  transform-origin: left;
}

.nav__index:hover,
.nav__index:focus-visible {
  color: var(--ink);
  border-color: var(--signal);
}

@media (prefers-reduced-motion: reduce) {
  .nav__index::before {
    transition: none;
  }
}

@media (max-width: 720px) {
  .nav__counter {
    display: none;
  }
}

/* ==========================================================================
   Index overlay (all 13 sections)
   ========================================================================== */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--ink);
  overflow-y: auto;
  visibility: hidden;
  opacity: 0;
}

.overlay.is-open {
  visibility: visible;
  opacity: 1;
}

.overlay__inner {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--nav-h) + 24px) var(--gutter) 48px;
}

.overlay__close {
  position: fixed;
  top: 0;
  right: var(--gutter);
  height: var(--nav-h);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone);
}

.overlay__list {
  width: 100%;
}

.overlay__row {
  display: flex;
  align-items: baseline;
  gap: clamp(12px, 2.5vw, 32px);
  padding: clamp(2px, 0.6vh, 8px) 0;
  border-bottom: 1px solid rgba(237, 234, 228, 0.08);
  color: var(--bone);
}

.overlay__row .overlay__num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ash);
  flex: 0 0 3ch;
}

.overlay__row .overlay__name {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5.2vh, 4rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  transition: color 0.25s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.overlay__row:hover .overlay__name,
.overlay__row:focus-visible .overlay__name {
  color: var(--signal);
  transform: translateX(0.35em);
}

.overlay__row[aria-current='page'] .overlay__num {
  color: var(--signal);
}

/* shared hover thumbnail — one video element, src swapped per row */
.overlay__thumb {
  position: fixed;
  z-index: 71;
  width: 240px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  pointer-events: none;
  opacity: 0;
  right: clamp(24px, 8vw, 120px);
  top: 50%;
  transform: translateY(-50%);
  transition: opacity 0.25s ease;
}

.overlay__thumb.is-visible {
  opacity: 1;
}

@media (hover: none), (max-width: 720px) {
  .overlay__thumb {
    display: none;
  }
}

/* ==========================================================================
   Hero — pinned video + title (metamorphosis driven by hero.js)
   ========================================================================== */

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: clip;
  /* the grid scrolls up UNDER the pinned hero while the clip window closes */
  z-index: 5;
  /* full-viewport while pinned but must never block clicks on the grid below */
  pointer-events: none;
}

.hero__media {
  position: absolute;
  inset: 0;
  overflow: clip;
  /* hero.js scrubs this toward the first grid cell */
  clip-path: inset(0px 0px 0px 0px);
  will-change: clip-path;
  background: var(--carbon);
}

.hero__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
}

/* once the metamorphosis completes, the video docks into the grid tile */
.hero__video.is-docked {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  transform: none !important;
}

.hero__title {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: var(--title-size);
  font-weight: 400;
  line-height: 0.85;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  text-align: center;
  color: var(--bone);
  mix-blend-mode: difference;
  pointer-events: none;
  user-select: none;
}

.hero__title .char {
  display: inline-block;
  white-space: pre; /* keeps space chars from collapsing in multi-word titles */
  will-change: transform, opacity;
}

.hero__meta {
  position: absolute;
  left: var(--gutter);
  bottom: clamp(20px, 4vh, 48px);
  display: flex;
  gap: 2.5em;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--ash);
  z-index: 2;
}

.hero__scrollcue {
  position: absolute;
  right: var(--gutter);
  bottom: clamp(20px, 4vh, 48px);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--ash);
  z-index: 2;
}

/* ==========================================================================
   Next-section footer
   ========================================================================== */

.next {
  position: relative;
  display: block;
  margin-top: clamp(80px, 14vh, 160px);
  overflow: clip;
}

.next__link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56vh;
  text-align: center;
}

.next__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.45;
  transition: opacity 0.6s ease;
}

.next__link:hover .next__video,
.next__link:focus-visible .next__video {
  opacity: 0.75;
}

.next__label {
  position: absolute;
  top: clamp(20px, 5vh, 48px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--ash);
  z-index: 2;
}

.next__title {
  position: relative;
  z-index: 2;
  font-family: var(--font-display);
  font-size: clamp(3rem, 12vw, 11rem);
  font-weight: 400;
  line-height: 0.9;
  text-transform: uppercase;
  color: var(--bone);
  mix-blend-mode: difference;
  transition: color 0.3s ease;
}

/* ---------- Site footer ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
  padding: 28px var(--gutter) 36px;
  font-size: 0.8125rem;
  color: var(--ash);
}

.footer a {
  color: var(--bone);
  position: relative;
}

.footer a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: var(--signal);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.footer a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ==========================================================================
   Reduced motion — real code path (JS checks the same query and skips
   Lenis, pin/scrub, parallax and FLIP; this handles the CSS side)
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .hero {
    height: 72vh; /* static header, no pin */
  }
}
