/* =====================================================================
   NOCTIS v2 — home.css
   page-specific layout for `/` (hero, tonight, map preview, pass).
   no new tokens; everything pulls from tokens.css.
   ===================================================================== */

/* ---------- shared section frame --------------------------------- */
.section {
  padding: var(--section-y) var(--pad-x);
  position: relative;
}
.section__head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 60ch;
  margin-bottom: clamp(2.5rem, 6vw, 5rem);
}

/* Seam softener: when a dark section sits next to a non-dark one in
   light theme, a 60px gradient on the boundary blurs the otherwise
   hard cream→warm-black cut. Built off the *current* section's top
   so the gradient color matches what's appearing above.
   (The `.section--dark` palette override itself lives in
   primitives.css so it's available on every page.) */
.section--dark + .section:not(.section--dark),
.section--dark + .footer {
  position: relative;
}
.section--dark + .section:not(.section--dark)::before,
.section--dark + .footer::before {
  content: "";
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 60px;
  background: linear-gradient(
    180deg,
    oklch(0.10 0.005 60) 0%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
}
.section:not(.section--dark) + .section--dark,
.footer + .section--dark {
  position: relative;
}
.section:not(.section--dark) + .section--dark::before,
.footer + .section--dark::before {
  content: "";
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 60px;
  background: linear-gradient(
    180deg,
    var(--page-bg, oklch(0.96 0.012 75)) 0%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
}
/* In dark theme the page bg is already dark, so the seam is invisible
   regardless. We tell the seam pseudo where to source its starting
   color via a CSS custom property exposed by the root theme. */
:root[data-theme="light"] { --page-bg: oklch(0.96 0.012 75); }
:root[data-theme="dark"],
:root                     { --page-bg: oklch(0.13 0.012 60); }

/* =============================================================== */
/* 1 · HERO                                                          */
/* =============================================================== */
.hero {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: var(--pad-x);
  background: var(--bg-deep);
  overflow: hidden;
}

/* the ken-burns animation lives on .hero__bg-zoom (an inner wrapper),
   not directly on the img — that way the parallax JS can target the
   outer .hero__bg for translate3d without fighting the keyframe. */
.hero__bg {
  position: absolute;
  inset: 0;
  z-index: -3;
  width: 100%; height: 100%;
  will-change: transform;
}
.hero__bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  /* warm tint — pulls any source toward midnight tungsten */
  filter: brightness(0.55) contrast(1.12) saturate(0.85)
          sepia(0.18) hue-rotate(-10deg);
  animation: ken-burns 28s ease-in-out infinite;
  will-change: transform;
}
@keyframes ken-burns {
  0%, 100% { transform: scale(1.04) translate3d(0, 0, 0); }
  50%      { transform: scale(1.10) translate3d(-1.2%, -0.6%, 0); }
}

.hero__overlay {
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 18% 80%,
      rgb(var(--img-tint-r) var(--img-tint-g) var(--img-tint-b) / 0.18),
      transparent 60%),
    linear-gradient(180deg,
      rgb(0 0 0 / 0.45) 0%,
      rgb(0 0 0 / 0.50) 35%,
      rgb(0 0 0 / 0.88) 100%);
}
.hero__grain {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* small wordmark stamp in upper-left, *not* the nav brand */
.hero__stamp {
  position: absolute;
  top: clamp(5rem, 10vh, 7.5rem);
  left: var(--pad-x);
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(240, 232, 216, 0.7);
}

.hero__content {
  align-self: end;
  max-width: min(54rem, 92%);
  padding: 0 0 clamp(5rem, 12vh, 9rem);
  /* spotlight--soft pulls the warm radial here (instead of the whole
     hero) so the photo stays the dramatic backdrop and the cursor only
     warms the writing area */
}
/* hero text never themes — the photo is locked dark.
   text-shadow gives the characters their own contrast halo instead
   of using a bounded reading-panel (which was the v1 "visible dark
   rectangle" bug). */
.hero__title {
  color: #f3ecdd;
  line-height: 0.95;
  text-shadow: 0 2px 18px rgb(0 0 0 / 0.45);
}
[lang^="zh"] .hero__title { letter-spacing: 0; }
.hero__subtitle {
  margin-top: clamp(1.25rem, 2.5vh, 1.75rem);
  max-width: 30ch;
  font-family: var(--font-sans);
  font-size: var(--type-lead);
  line-height: 1.55;
  color: rgba(240, 232, 216, 0.82);
  text-shadow: 0 1px 8px rgb(0 0 0 / 0.4);
}
.hero__actions {
  margin-top: clamp(2rem, 4vh, 3rem);
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.5rem, 4vw, 3rem);
}
.hero .link-arrow {
  color: rgba(240, 232, 216, 0.92);
  border-color: rgba(240, 232, 216, 0.32);
}
.hero .link-arrow:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.hero__meta {
  position: absolute;
  bottom: clamp(1.25rem, 3vh, 2.25rem);
  left: var(--pad-x);
  display: flex;
  gap: 0.7em;
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(240, 232, 216, 0.48);
}
.hero__sep { opacity: 0.45; }

.hero__scroll {
  position: absolute;
  right: var(--pad-x);
  bottom: clamp(1.25rem, 3vh, 2.25rem);
  width: 1px; height: 64px;
  overflow: hidden;
}
.hero__scroll-line {
  display: block;
  width: 100%; height: 100%;
  background: linear-gradient(180deg, transparent 0%, var(--accent) 60%, transparent 100%);
  transform: translateY(-100%);
  animation: scrollLine 2.4s var(--ease-out) infinite;
}
@keyframes scrollLine {
  0%   { transform: translateY(-100%); }
  60%  { transform: translateY(100%); }
  100% { transform: translateY(100%); }
}

@media (max-width: 720px) {
  .hero__scroll { display: none; }
  .hero__title { font-size: clamp(3rem, 14vw, 5rem); }
  .hero__stamp { top: 4.5rem; }
  .hero__meta  { font-size: 10px; gap: 0.5em; letter-spacing: 0.12em; }
}


/* =============================================================== */
/* 2 · TONIGHT — asymmetric editorial grid                          */
/* =============================================================== */
.tonight {
  background: var(--bg);
}

.tonight__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: clamp(2rem, 4vw, 4rem);
  perspective: 1200px;
}

/* Card hover — focused card pops, the other two dim back. Pure CSS
   sibling logic on the grid: when the grid is hovered, any card that
   ISN'T the one under the cursor fades to 0.55. */
.tonight__grid .card {
  transform-style: preserve-3d;
  transform:
    rotateX(var(--rx, 0deg))
    rotateY(var(--ry, 0deg));
  transition:
    opacity   var(--t-base) var(--ease-out),
    transform 220ms var(--ease-out);
}
.tonight__grid:hover .card:not(:hover) { opacity: 0.55; }
.tonight__grid .card:hover {
  transform:
    rotateX(var(--rx, 0deg))
    rotateY(var(--ry, 0deg))
    translateY(-6px);
}
@media (prefers-reduced-motion: reduce) {
  .tonight__grid .card { transform: none !important; }
}

.tonight__grid .card .img > img {
  transition:
    filter    var(--t-slow)  var(--ease-out),
    transform var(--t-slow)  var(--ease-out);
}
.tonight__grid .card:hover .img > img.is-loaded {
  transform: scale(1.045);
  filter: var(--img-tint-hover) brightness(1.08);
}

/* Title underline grows L→R on hover */
.tonight__grid .card__title {
  position: relative;
  display: inline-block;
  align-self: flex-start;
}
.tonight__grid .card__title::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width var(--t-slow) var(--ease-out);
}
.tonight__grid .card:hover .card__title::after { width: 100%; }
.tonight__grid > .card:nth-child(1) {
  grid-column: 1; grid-row: 1 / span 2;
}
.tonight__grid > .card:nth-child(2) {
  grid-column: 2; grid-row: 1;
}
.tonight__grid > .card:nth-child(3) {
  grid-column: 2; grid-row: 2;
}
/* big card uses a portrait crop; the two right cards stay landscape */
.tonight__grid > .card:nth-child(1) .img { aspect-ratio: 5 / 6; }
.tonight__grid > .card:nth-child(2) .img,
.tonight__grid > .card:nth-child(3) .img { aspect-ratio: 16 / 10; }
.tonight__grid > .card:nth-child(1) .card__title { font-size: clamp(2rem, 3vw, 2.75rem); }

@media (max-width: 880px) {
  .tonight__grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .tonight__grid > .card { grid-column: 1; grid-row: auto; }
  .tonight__grid > .card .img { aspect-ratio: 4 / 3; }
}


/* =============================================================== */
/* 3 · MAP PREVIEW                                                  */
/* =============================================================== */
.map-preview {
  position: relative;
  isolation: isolate;
  background: var(--bg-deep);
  padding: 0;
  height: clamp(440px, 70vh, 660px);
  overflow: hidden;
}
.map-preview__map {
  position: absolute; inset: 0;
  z-index: 0;
  /* No CSS filter — that road plus layer-paint tinting in
     map-preview.js together pushed the basemap to a solid black slab.
     Tinting only happens via the JS, never doubled here. */
}
.map-preview__map canvas { outline: 0 !important; }
.maplibregl-ctrl-attrib,
.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right,
.maplibregl-ctrl-top-right { display: none !important; }

.map-preview__panel {
  position: absolute;
  top: 50%; left: var(--pad-x);
  transform: translateY(-50%);
  z-index: 2;
  max-width: 30rem;
  padding: clamp(1.75rem, 3vw, 2.75rem);
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  backdrop-filter: saturate(140%) blur(18px);
  -webkit-backdrop-filter: saturate(140%) blur(18px);
  border: var(--border);
  display: flex; flex-direction: column;
  gap: var(--space-3);
}
.map-preview__attrib {
  position: absolute;
  right: 0.6rem; bottom: 0.45rem;
  z-index: 2;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: rgba(240, 232, 216, 0.32);
  pointer-events: none;
}
.map-preview__hint {
  position: absolute;
  top: clamp(0.75rem, 2vw, 1.25rem);
  right: clamp(0.75rem, 2vw, 1.5rem);
  z-index: 2;
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(240, 232, 216, 0.45);
  background: color-mix(in oklab, var(--bg-deep) 70%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 6px 10px;
  pointer-events: none;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .map-preview__hint { display: none; }
}
.map-preview__panel .map-preview__desc {
  font-family: var(--font-sans);
  font-size: var(--type-body);
  line-height: 1.6;
  color: var(--fg-soft);
  max-width: 32ch;
  margin: 0;
}
.map-preview__panel .link-arrow { align-self: flex-start; margin-top: var(--space-2); }

.map-dot-wrap {
  pointer-events: none;
  width: 0; height: 0;
}
.map-dot-wrap.is-clickable {
  pointer-events: auto;
  cursor: pointer;
  /* invisible hit area around the visual dot */
  padding: 12px;
  margin: -12px;
}
.map-dot-wrap.is-clickable:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
  border-radius: 50%;
}
.map-dot-wrap.is-clickable:hover .map-dot,
.map-dot-wrap.is-clickable:focus-visible .map-dot {
  width: 14px; height: 14px; margin: -7px;
  box-shadow:
    0 0 22px 6px color-mix(in oklab, var(--accent) 70%, transparent),
    0 0 8px 2px var(--accent);
}
.map-dot-wrap.is-clickable .map-dot {
  transition: width 240ms var(--ease-out),
              height 240ms var(--ease-out),
              margin 240ms var(--ease-out),
              box-shadow 240ms var(--ease-out);
}

/* back button + meta in the swapped-in place card */
.map-panel__back {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0;
  margin-bottom: var(--space-3);
  background: transparent;
  border: 0;
  font-family: var(--font-sans);
  font-size: var(--type-eyebrow);
  letter-spacing: var(--track-meta);
  text-transform: uppercase;
  color: var(--fg-muted);
  cursor: pointer;
  transition: color var(--t-base) var(--ease-out);
}
.map-panel__back:hover { color: var(--accent); }
.map-panel__meta {
  font-family: var(--font-sans);
  font-size: var(--type-eyebrow);
  letter-spacing: var(--track-meta);
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0;
}
.map-dot {
  width: 11px; height: 11px;
  margin: -5.5px;
  border-radius: 50%;
  background: radial-gradient(circle,
    color-mix(in oklab, var(--accent) 100%, white 16%) 0%,
    color-mix(in oklab, var(--accent) 75%, transparent) 50%,
    transparent 100%);
  box-shadow:
    0 0 14px 4px oklch(0.72 0.105 68 / 0.60),
    0 0 4px  1px oklch(0.72 0.105 68);
  animation: dotPulse 4s ease-in-out infinite;
}
.maplibregl-marker:nth-child(odd) .map-dot { animation-delay: -1.2s; }
.maplibregl-marker:nth-child(3n)  .map-dot { animation-delay: -2.4s; }
@keyframes dotPulse {
  0%, 100% { opacity: 0.55; transform: scale(0.9); }
  50%      { opacity: 1;    transform: scale(1.25); }
}

@media (max-width: 720px) {
  .map-preview__panel {
    top: auto;
    bottom: 1.25rem;
    left: 1rem;
    right: 1rem;
    transform: none;
    max-width: none;
  }
}


/* =============================================================== */
/* 4 · PASS PREVIEW                                                 */
/* =============================================================== */
.pass {
  position: relative;
  isolation: isolate;
  background: var(--bg-deep);
  padding: clamp(7rem, 16vw, 14rem) var(--pad-x);
  text-align: center;
  overflow: hidden;
}
.pass__bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: -3;
  opacity: 0.42;
  filter: brightness(0.55) contrast(1.08) saturate(0.65) sepia(0.20);
}
.pass__overlay {
  position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background: linear-gradient(180deg,
    rgb(0 0 0 / 0.50) 0%,
    rgb(0 0 0 / 0.62) 50%,
    rgb(0 0 0 / 0.78) 100%);
}
.pass__inner {
  max-width: 40rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}
.pass__title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 1.04;
  color: #f0e8d8;
  margin: 0;
}
[lang^="zh"] .pass__title { letter-spacing: 0; }
.pass__desc {
  font-family: var(--font-sans);
  font-size: var(--type-lead);
  line-height: 1.7;
  color: rgba(240, 232, 216, 0.78);
  max-width: 28ch;
  margin: 0;
}
.pass .link-arrow {
  color: rgba(240, 232, 216, 0.92);
  border-color: rgba(240, 232, 216, 0.32);
  margin-top: var(--space-3);
}
.pass .link-arrow:hover {
  color: var(--accent);
  border-color: var(--accent);
}


/* =============================================================== */
/* shared eyebrow + section title display rules for home            */
/* =============================================================== */
.section__title { margin: 0; }
