/* ============================================================
   Above the Treeline — dark editorial gallery
   Photos carry the color; the chrome is a near-black wall.
   ============================================================ */

:root {
  /* Color — OKLCH. Dark mode only. */
  --bg:       oklch(0.14 0.000 0);
  --surface:  oklch(0.19 0.006 110);
  --ink:      oklch(0.95 0.005 110);
  --muted:    oklch(0.66 0.010 110);
  --primary:  oklch(0.78 0.090 110);
  --accent:   oklch(0.80 0.130 78);
  --line:     oklch(0.30 0.006 110);

  /* Type */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;

  /* Rhythm */
  --gap: clamp(0.5rem, 1.2vw, 1rem);
  --pad: clamp(1.25rem, 5vw, 5rem);
  --section: clamp(4rem, 12vh, 9rem);

  /* Motion */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);

  /* Z-index scale (semantic) */
  --z-grid: 1;
  --z-nav: 100;
  --z-skip: 150;
  --z-lightbox: 1000;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 50%;
  top: -100px;
  transform: translateX(-50%);
  z-index: var(--z-skip);
  background: var(--accent);
  color: oklch(0.18 0.02 78);
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border-radius: 6px;
  transition: top 0.2s var(--ease-out-quart);
}
.skip-link:focus { top: 0.75rem; }

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem var(--pad);
  transition: background 0.4s var(--ease-out-quart), backdrop-filter 0.4s, border-color 0.4s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: color-mix(in oklch, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom-color: var(--line);
}
.nav__brand {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.nav__mark { color: var(--primary); font-size: 0.85em; }
.nav__links { display: flex; gap: 1.75rem; }
.nav__links a {
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  position: relative;
  padding: 0.25rem 0;
  transition: color 0.25s var(--ease-out-quart);
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease-out-expo);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after { transform: scaleX(1); }

/* ---------- Hero (living-mist stage) ---------- */
.hero {
  position: relative;
  height: 100svh;
  min-height: 600px;
  display: grid;
  align-items: end;
  overflow: hidden;
}
.hero__layer { position: absolute; left: 0; }
.hero__sky {
  top: -32%; left: 0;              /* overscan so the parallax drift never opens an edge */
  width: 100%; height: 164%;       /* explicit box; global "img{height:auto}" would collapse it on tall screens */
  object-fit: cover;
  z-index: 0;
  will-change: transform;
}
.hero__fog {
  position: absolute;
  inset: -48% 0;                   /* overscan so the parallax shift never reveals an edge */
  z-index: 1;
  mix-blend-mode: screen;          /* dark fog vanishes, mist glows over the photo */
  opacity: 0.7;
  pointer-events: none;
}
.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(to top, var(--bg), transparent 24%),
    linear-gradient(100deg, color-mix(in oklch, var(--bg) 62%, transparent) 0%, transparent 52%),
    linear-gradient(to top, color-mix(in oklch, var(--bg) 24%, transparent), transparent 42%);
}
.hero__inner {
  position: relative;
  z-index: 5;
  padding: var(--pad);
  padding-bottom: clamp(2.5rem, 7vh, 5rem);
  max-width: 56rem;
}
.hero__kicker {
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 1rem;
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.5rem, 7vw, 4.25rem);
  line-height: 1;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin-bottom: 1.25rem;
  text-shadow: 0 2px 36px rgba(0, 0, 0, 0.45);
}
.hero__lede {
  max-width: 38ch;
  color: oklch(0.9 0.005 110);
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.3rem);
  line-height: 1.55;
  text-wrap: pretty;
  text-shadow: 0 1px 20px rgba(0, 0, 0, 0.5);
}
.hero__cue {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 2.25rem;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.4rem;
  transition: border-color 0.3s, gap 0.3s var(--ease-out-expo);
}
.hero__cue:hover { border-color: var(--primary); gap: 0.9rem; }
.hero__cue-arrow { animation: bob 2.4s var(--ease-out-quart) infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

/* ---------- Gallery ---------- */
.gallery {
  padding: var(--section) var(--pad);
}
.gallery__head {
  max-width: 64rem;
  margin: 0 auto clamp(2.5rem, 6vh, 4rem);
  text-align: center;
}
.gallery__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 1.5rem + 2.5vw, 3.25rem);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.gallery__sub {
  color: var(--muted);
  margin-top: 0.75rem;
  font-size: 1.05rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 2rem;
}
.filter {
  font-family: var(--font-body);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 1.15rem;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, background 0.25s, transform 0.25s var(--ease-out-expo);
}
.filter:hover { color: var(--ink); border-color: var(--primary); transform: translateY(-1px); }
.filter.is-active {
  color: var(--bg);
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

/* Masonry via CSS columns — respects each photo's aspect ratio */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 8px;             /* tiny rows; JS sets each tile's row span = its height */
  grid-auto-flow: row dense;       /* pack the mosaic tightly */
  gap: var(--gap);
  max-width: 1500px;
  margin: 0 auto;
}
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }
.grid .tile { margin: 0; }
.grid .tile img { display: block; width: 100%; height: 100%; object-fit: cover; }

.tile {
  position: relative;
  break-inside: avoid;
  margin-bottom: var(--gap);
  overflow: hidden;
  border-radius: 4px;
  cursor: zoom-in;
  background: var(--surface);
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  padding: 0;
  color: inherit;
}
.tile img {
  width: 100%;
  transition: transform 0.7s var(--ease-out-expo), filter 0.5s;
}
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, color-mix(in oklch, var(--bg) 85%, transparent), transparent 55%);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out-quart);
  pointer-events: none;
}
.tile:hover::after, .tile:focus-visible::after { opacity: 1; }

.tile__meta {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 1.1rem 1.15rem;
  z-index: 1;
  transform: translateY(0.6rem);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out-quart), transform 0.4s var(--ease-out-expo);
  pointer-events: none;
}
.tile:hover .tile__meta, .tile:focus-visible .tile__meta { opacity: 1; transform: translateY(0); }
.tile__name { font-family: var(--font-display); font-size: 1.1rem; font-weight: 500; }
.tile__loc { display: block; font-size: 0.8rem; color: var(--primary); letter-spacing: 0.02em; margin-top: 0.15rem; }

.grid__empty { text-align: center; color: var(--muted); padding: 3rem 0; }

/* ---------- Mountain index (panel of peaks) ---------- */
.view[hidden] { display: none; }

.peaks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: clamp(0.75rem, 1.5vw, 1.35rem);
  max-width: 1500px;
  margin: 0 auto;
}
.peak {
  position: relative;
  display: block;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  overflow: hidden;
  border-radius: 6px;
  aspect-ratio: 4 / 5;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}
.peak__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9) brightness(0.8);
  transition: transform 0.8s var(--ease-out-expo), filter 0.6s var(--ease-out-quart);
}
.peak::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, color-mix(in oklch, var(--bg) 94%, transparent), transparent 58%);
  pointer-events: none;
}
.peak:hover .peak__img,
.peak:focus-visible .peak__img { filter: saturate(1) brightness(0.95); }
.peak__body {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 1;
  padding: 1.3rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.peak__name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.3rem, 1.1rem + 0.7vw, 1.8rem);
  letter-spacing: -0.015em;
  line-height: 1.04;
  text-wrap: balance;
}
.peak__meta {
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: oklch(0.86 0.01 110);
  min-height: 1.1em;               /* reserve the line so cards align even without region/elevation */
}
.peak__elev { color: var(--primary); }

/* ---------- Album view (immersive trip into one mountain) ---------- */
.album { display: block; }

/* Inside an album, only the album shows — hero, nav, and the other
   sections are removed so the mountain is the whole page */
body.viewing-album .hero,
body.viewing-album .nav,
body.viewing-album .band,
body.viewing-album .about,
body.viewing-album .outro,
body.viewing-album .footer { display: none; }

.album__hero {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);   /* full-bleed out of the section padding */
  margin-top: calc(-1 * var(--section));
  height: 82svh;
  min-height: 460px;
  overflow: hidden;
  display: grid;
  align-items: end;
}
.album__hero-img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  animation: albumKenBurns 14s var(--ease-out-quart) forwards;
}
@keyframes albumKenBurns { to { transform: scale(1); } }
.album__hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, var(--bg) 1%, transparent 55%),
    linear-gradient(105deg, color-mix(in oklch, var(--bg) 55%, transparent), transparent 55%);
}
.album__hero-inner {
  position: relative;
  z-index: 1;
  max-width: 60rem;
  padding: 0 var(--pad) clamp(2.5rem, 7vh, 5rem);
}
.album__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.75rem, 1.8rem + 5vw, 5.5rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  text-wrap: balance;
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.5);
}
.album__meta {
  margin-top: 1rem;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
}
.album__intro {
  margin-top: 1.25rem;
  max-width: 52ch;
  color: oklch(0.9 0.006 110);
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem);
  line-height: 1.55;
  text-wrap: pretty;
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.5);
}
.album__back {
  position: fixed;                  /* floats with the viewport — no scroll-up needed */
  top: clamp(1rem, 3vh, 1.75rem);
  left: clamp(1rem, 4vw, 2rem);
  z-index: 200;                     /* above album content, below the lightbox */
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: color-mix(in oklch, var(--bg) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  padding: 0.5rem 1.15rem;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, transform 0.3s var(--ease-out-expo), background 0.25s;
}
.album__back:hover { border-color: var(--primary); transform: translateX(-3px); }

/* One big feature frame, then the rest as a random masonry */
.album__body {
  max-width: 1500px;
  margin: clamp(2.5rem, 7vh, 4.5rem) auto 0;
}
.album__feature {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 8;
  margin-bottom: var(--gap);
}
.album__feature img { height: 100%; object-fit: cover; }
.album__feature .tile__name { font-size: 1.3rem; }
@media (max-width: 720px) {
  .album__feature { aspect-ratio: 4 / 3; }
}

/* Reveal-on-scroll (enhances already-visible default) */
.js-reveal .tile,
.js-reveal .peak { opacity: 0; transform: translateY(24px); }
.js-reveal .tile.is-in,
.js-reveal .peak.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}

/* ---------- About ---------- */
.about {
  padding: var(--section) var(--pad);
  border-top: 1px solid var(--line);
}
.about__inner { max-width: 38rem; margin: 0 auto; }
.about__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}
.about p { color: oklch(0.88 0.006 110); margin-bottom: 1.1rem; text-wrap: pretty; max-width: 68ch; }
.about p:last-child { margin-bottom: 0; }

/* ---------- Parallax band ---------- */
.band {
  position: relative;
  height: clamp(60svh, 80vh, 90svh);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.band__media {
  position: absolute;
  inset: -15% 0;            /* overscan so parallax never reveals an edge */
  z-index: 0;
}
.band__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
}
.band__scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, color-mix(in oklch, var(--bg) 35%, transparent), transparent 30%, transparent 70%, color-mix(in oklch, var(--bg) 35%, transparent)),
    color-mix(in oklch, var(--bg) 30%, transparent);
}
.band__quote {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 28ch;
  text-align: center;
  padding: 0 var(--pad);
}
.band__quote p {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.6rem, 1.1rem + 3vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
  text-shadow: 0 2px 30px rgba(0,0,0,0.5);
}
.band__quote cite {
  display: block;
  margin-top: 1.25rem;
  font-style: normal;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
}

/* ---------- Outro (closing video, 16:9) ---------- */
.outro {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);          /* full-bleed across the screen */
  height: clamp(420px, 72svh, 780px);     /* wide band: cover crops top/bottom */
  overflow: hidden;
  display: grid;
  place-items: center;
}
.outro__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;                        /* fill + crop top/bottom, no resize/stretch */
  z-index: 0;
}
.outro__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(120% 80% at 50% 50%, transparent 35%, color-mix(in oklch, var(--bg) 50%, transparent)),
    color-mix(in oklch, var(--bg) 22%, transparent);
}
.outro__text {
  position: relative;
  z-index: 2;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.5rem, 1.8rem + 4vw, 5rem);
  letter-spacing: -0.02em;
  color: var(--ink);
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.55);
}

/* ---------- Footer ---------- */
.footer {
  padding: clamp(2rem, 6vh, 3.5rem) var(--pad);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Lightbox ---------- */
.lightbox {
  width: 100vw;
  height: 100svh;
  max-width: 100vw;
  max-height: 100svh;
  margin: 0;
  padding: 0;
  border: 0;
  background: color-mix(in oklch, var(--bg) 92%, black);
  color: var(--ink);
  overflow: hidden;
}
.lightbox::backdrop { background: rgba(0, 0, 0, 0.6); }
.lightbox[open] {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
}
.lightbox__figure {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: clamp(1rem, 4vh, 3rem) clamp(0.5rem, 2vw, 2rem);
  height: 100%;
  min-width: 0;
}
.lightbox__img {
  max-width: 100%;
  max-height: 78svh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.8);
}
.lightbox__caption { text-align: center; }
.lightbox__title { font-family: var(--font-display); font-size: 1.35rem; font-weight: 500; }
.lightbox__loc { display: block; color: var(--primary); font-size: 0.9rem; letter-spacing: 0.03em; margin-top: 0.3rem; }

.lightbox__close,
.lightbox__nav {
  background: color-mix(in oklch, var(--surface) 70%, transparent);
  color: var(--ink);
  border: 1px solid var(--line);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.25s, border-color 0.25s, transform 0.25s var(--ease-out-expo);
  backdrop-filter: blur(8px);
}
.lightbox__close:hover,
.lightbox__nav:hover { background: var(--surface); border-color: var(--primary); }

.lightbox__close {
  position: absolute;
  top: 1.1rem; right: 1.1rem;
  width: 2.75rem; height: 2.75rem;
  border-radius: 999px;
  font-size: 1rem;
  z-index: 2;
}
.lightbox__nav {
  width: 3.25rem; height: 3.25rem;
  border-radius: 999px;
  font-size: 1.6rem;
  line-height: 1;
  margin: 0 clamp(0.75rem, 2vw, 1.75rem);
  align-self: center;
}
.lightbox__nav--prev { grid-column: 1; }
.lightbox__nav--next { grid-column: 3; }
.lightbox__nav:hover { transform: scale(1.06); }

.lightbox__img.is-swapping { opacity: 0; transition: opacity 0.18s; }

@media (max-width: 560px) {
  .lightbox__nav { width: 2.75rem; height: 2.75rem; font-size: 1.3rem; margin: 0 0.4rem; }
  .lightbox__close { top: 0.75rem; right: 0.75rem; }
}

/* ---------- Lightbox entrance ---------- */
.lightbox[open] .lightbox__figure { animation: lbIn 0.45s var(--ease-out-expo); }
@keyframes lbIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero__bg { transform: none; }
  .js-reveal .tile,
  .js-reveal .peak { opacity: 1; transform: none; }
}
