/* Motion and the image-led components: reveals, reels, sticky photo cards, galleries, lightbox.
   Everything here is an enhancement. Without JavaScript (no .js on <html>) or with
   reduced motion, content is simply visible and still. */

:root { --ease: cubic-bezier(0.2, 0.7, 0.2, 1); --half-gap: 0.5rem; }

/* ---------- page-to-page transition ---------- */

@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out 0.22s ease both; }
::view-transition-new(root) { animation: vt-in 0.5s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }

/* ---------- header: scroll progress ---------- */

.top::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--marigold); transform-origin: left center; transform: scaleX(var(--progress, 0));
}
.top { transition: box-shadow 0.3s ease; }
.top.is-scrolled { box-shadow: 0 10px 30px -22px rgba(14, 59, 42, 0.7); }

/* ---------- reveal on scroll ---------- */

.js [data-reveal], .js [data-stagger] > * {
  opacity: 0; translate: 0 1.75rem;
  transition: opacity 0.8s var(--ease), translate 1s var(--ease);
  transition-delay: calc(var(--i, 0) * 90ms);
}
.js [data-reveal].is-in, .js [data-stagger].is-in > * { opacity: 1; translate: 0 0; }

/* images wipe open from the top and settle */
.js [data-reveal="wipe"] {
  opacity: 1; translate: 0 0; clip-path: inset(0 0 100% 0);
  transition: clip-path 1.2s cubic-bezier(0.65, 0, 0.2, 1);
  transition-delay: calc(var(--i, 0) * 120ms);
}
.js [data-reveal="wipe"].is-in { clip-path: inset(0 0 0 0); }
.js [data-reveal="wipe"] img { scale: 1.18; transition: scale 1.8s var(--ease), transform 0.9s var(--ease); }
.js [data-reveal="wipe"].is-in img { scale: 1; }

[data-stagger] > :nth-child(2) { --i: 1; }
[data-stagger] > :nth-child(3) { --i: 2; }
[data-stagger] > :nth-child(4) { --i: 3; }
[data-stagger] > :nth-child(5) { --i: 4; }
[data-stagger] > :nth-child(6) { --i: 5; }
[data-stagger] > :nth-child(7) { --i: 6; }
[data-stagger] > :nth-child(8) { --i: 7; }
[data-stagger] > :nth-child(n + 9) { --i: 8; }

/* headline words rise one after another */
.js [data-split] { visibility: hidden; }
.js [data-split].is-split { visibility: visible; }
[data-split] .w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-block: 0.1em 0.16em; margin-block: -0.1em -0.16em; }
[data-split] .w > span {
  display: inline-block; transform: translateY(115%);
  animation: word-up 0.95s var(--ease) forwards;
  animation-delay: calc(0.1s + var(--i) * 110ms);
}
@keyframes word-up { to { transform: none; } }

/* the flower turns as the page scrolls */
[data-spin] { rotate: calc(var(--scroll, 0) * 0.05deg); }

/* ---------- hover polish ---------- */

.btn { transition: transform 0.25s var(--ease), filter 0.2s ease, box-shadow 0.25s ease; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -12px rgba(0, 0, 0, 0.55); }
.link {
  text-decoration: none;
  background: linear-gradient(var(--marigold), var(--marigold)) 0 100% / 100% 0.09em no-repeat;
  transition: background-size 0.3s var(--ease);
}
.link:hover { background-size: 100% 0.32em; }
.zoom { overflow: hidden; }
.zoom img { transition: transform 0.9s var(--ease); }
a:hover .zoom img, .zoom:hover img { transform: scale(1.05); }
.tile:hover img { transform: scale(1.06); }
.tile__text { transition: translate 0.5s var(--ease); }
.tile:hover .tile__text { translate: 0 -0.4rem; }

/* ---------- image reel (home hero) ---------- */

.reel {
  overflow: hidden; margin-inline: calc(-1 * var(--gutter)); margin-top: clamp(2.5rem, 6vw, 5rem);
  padding-bottom: 2rem;
  mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent);
}
.reel__track { display: flex; align-items: flex-start; gap: calc(var(--half-gap) * 2); width: max-content; padding-inline: var(--gutter); }
.reel__track.is-looping, .ticker__track.is-looping { animation: loop 80s linear infinite; padding-inline: 0; }
.reel:hover .reel__track, .reel:focus-within .reel__track { animation-play-state: paused; }
@keyframes loop { to { transform: translateX(calc(-50% - var(--half-gap))); } }
.reel:not(:has(.is-looping)) { overflow-x: auto; }

.reel__item {
  position: relative; flex: none; display: block; overflow: hidden;
  height: clamp(11rem, 21vw, 18rem); border-radius: 10px; color: #fff; text-decoration: none;
}
.reel__item:nth-child(even) { margin-top: 2rem; }
.reel__item img { height: 100%; width: auto; max-width: none; transition: transform 0.9s var(--ease); }
.reel__item:hover img { transform: scale(1.06); }
.reel__item span {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2rem 0.9rem 0.7rem;
  font-size: 0.95rem; font-weight: 600;
  background: linear-gradient(to top, rgba(8, 28, 20, 0.8), transparent);
}

/* ---------- text ticker ---------- */

.ticker { overflow: hidden; padding-block: clamp(1.75rem, 4vw, 3.25rem); background: var(--field); --half-gap: 0rem; }
.ticker__track { display: flex; align-items: center; width: max-content; }
.ticker__track.is-looping { animation-duration: 38s; }
.ticker span {
  padding-inline: 0.22em; white-space: nowrap;
  font-size: clamp(3.5rem, 11vw, 10rem); font-weight: 700; font-stretch: 80%; line-height: 1; letter-spacing: -0.02em;
  color: var(--field); -webkit-text-stroke: 3px var(--leaf); paint-order: stroke fill;
}
.ticker span:nth-of-type(3n + 2) { color: var(--leaf); -webkit-text-stroke: 0; }
.ticker img { flex: none; width: clamp(2.5rem, 7vw, 6rem); height: auto; margin-inline: 0.5rem; animation: turn 14s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }

/* ---------- numbers ---------- */

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid #5f8571; }
.stat { padding: 1.75rem clamp(1rem, 2vw, 2rem) 0.5rem 0; }
.stat + .stat { padding-left: clamp(1rem, 2vw, 2rem); border-left: 1px solid #5f8571; }
.stat__n {
  display: block; font-size: clamp(3rem, 7vw, 6.5rem); font-weight: 600; font-stretch: 80%;
  line-height: 0.95; letter-spacing: -0.02em; color: var(--marigold); font-variant-numeric: tabular-nums lining-nums;
}
.stat__l { display: block; margin-top: 0.6rem; max-width: 14em; color: #c9d8cb; }
@media (max-width: 50rem) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid #5f8571; }
}

/* ---------- sticky photo cards (our beliefs) ---------- */

.stack__card {
  position: sticky; top: 0; height: 100vh; height: 100svh; min-height: 28rem; overflow: hidden;
  display: grid; align-items: end; color: #fff; background: var(--leaf);
}
.stack__card + .stack__card { border-radius: 1.75rem 1.75rem 0 0; box-shadow: 0 -24px 60px -20px rgba(0, 0, 0, 0.55); }
.stack__card > img { position: absolute; left: 0; top: -10%; width: 100%; height: 120%; object-fit: cover; }
.stack__card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(8, 28, 20, 0.88) 0%, rgba(8, 28, 20, 0.35) 45%, rgba(8, 28, 20, 0.1) 100%);
}
.stack__text { position: relative; z-index: 1; width: 100%; max-width: var(--max); margin-inline: auto; padding: 0 var(--gutter) clamp(2.5rem, 7vh, 5rem); }
.stack__line {
  max-width: 11em; font-size: clamp(2.6rem, 8.4vw, 8rem); font-weight: 600; font-stretch: 80%;
  line-height: 0.96; letter-spacing: -0.022em; text-wrap: balance;
}
.stack__cap { margin-top: 1.25rem; font-size: 0.95rem; color: #d6e2d6; }
.stack__cap a { color: #fff; }

/* ---------- full-bleed photo band ---------- */

.vista { position: relative; overflow: hidden; min-height: min(82vh, 46rem); display: grid; align-items: end; color: #fff; background: var(--leaf); }
.vista > img { position: absolute; left: 0; top: -12%; width: 100%; height: 124%; object-fit: cover; }
.vista::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(8, 28, 20, 0.85), rgba(8, 28, 20, 0.05) 65%); }
.vista__text { position: relative; z-index: 1; width: 100%; max-width: var(--max); margin-inline: auto; padding: 6rem var(--gutter) clamp(2rem, 5vw, 4rem); }
.vista__line { max-width: 18em; font-size: clamp(1.8rem, 4vw, 3.4rem); font-weight: 600; font-stretch: 84%; line-height: 1.04; letter-spacing: -0.018em; text-wrap: balance; }
.vista__cap { margin-top: 1rem; font-size: 0.95rem; color: #d6e2d6; }

/* ---------- framed photos ---------- */

.shot { overflow: hidden; border-radius: 10px; }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.cap { margin-top: 0.6rem; font-size: 0.95rem; color: var(--soft, var(--leaf-2)); }

.trip { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: clamp(0.75rem, 1.5vw, 1.25rem); align-items: start; }
.trip a { display: block; text-decoration: none; }
.trip .shot img { aspect-ratio: 4 / 5; }
.trip > :nth-child(2) { margin-top: clamp(1.5rem, 4vw, 3.5rem); }
.trip > :nth-child(3) { margin-top: clamp(3rem, 8vw, 7rem); }
.trip .cap { font-weight: 500; color: var(--leaf); }
.page-head + .trip-band { padding-bottom: clamp(3rem, 7vw, 6rem); }
@media (max-width: 40rem) {
  .trip { grid-template-columns: 1fr 1fr; }
  .trip > :first-child { grid-column: 1 / -1; }
  .trip > :first-child .shot img { aspect-ratio: 3 / 2; }
  .trip > :nth-child(2) { margin-top: 0; }
  .trip > :nth-child(3) { margin-top: 2rem; }
}

/* ---------- gallery rail ---------- */

.rail { margin-top: clamp(3.5rem, 7vw, 6rem); }
.rail__head { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; padding-top: clamp(1.5rem, 3vw, 2.25rem); border-top: 1px solid var(--rule); }
.rail__head h2 { font-size: clamp(1.7rem, 2.8vw, 2.4rem); font-weight: 600; font-stretch: 85%; line-height: 1.05; letter-spacing: -0.015em; }
.rail__head p { margin-top: 0.5rem; color: var(--soft); max-width: 34em; }
.rail__nav { display: flex; gap: 0.5rem; flex: none; }
.rail__nav button, .lightbox button {
  font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer;
  padding: 0.55rem 1.1rem; border-radius: 999px; border: 1px solid var(--rule, currentColor);
  background: transparent; color: inherit; transition: background 0.2s ease, color 0.2s ease;
}
.rail__nav button:hover { background: var(--accent); color: var(--on-accent); }
.rail__track {
  --edge: max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter)));
  display: flex; gap: clamp(0.75rem, 1.5vw, 1.25rem); margin-top: 1.75rem;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none;
  padding-inline: var(--edge); scroll-padding-inline: var(--edge);
}
.rail__track::-webkit-scrollbar { display: none; }
.rail__item { flex: none; width: min(80vw, 36rem); scroll-snap-align: start; }
.rail__item a { display: block; cursor: zoom-in; }
.rail__item img { aspect-ratio: 3 / 2; }
.rail--small .rail__item { width: min(62vw, 19rem); }
.rail--small .rail__item img { aspect-ratio: 4 / 5; }

/* ---------- lightbox ---------- */

.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(8, 20, 15, 0.94); color: #eef4ea; }
.lightbox::backdrop { background: rgba(8, 20, 15, 0.94); }
.lightbox[open] { animation: vt-in 0.3s var(--ease); }
.lightbox figure { height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; align-items: center; padding: 4.5rem 1rem 1.25rem; }
.lightbox img { max-width: min(94vw, 100rem); max-height: 100%; object-fit: contain; border-radius: 6px; }
.lightbox figcaption { padding-top: 0.9rem; text-align: center; max-width: 44em; }
.lightbox__bar { position: absolute; top: 1rem; left: 1rem; right: 1rem; display: flex; justify-content: space-between; gap: 0.5rem; }
.lightbox__bar div { display: flex; gap: 0.5rem; }
.lightbox button { border-color: rgba(238, 244, 234, 0.5); }
.lightbox button:hover { background: #eef4ea; color: var(--leaf); }

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .js [data-reveal], .js [data-stagger] > *, .js [data-reveal="wipe"] { opacity: 1; translate: 0 0; clip-path: none; transition: none; }
  .js [data-reveal="wipe"] img { scale: 1; transition: none; }
  [data-split] .w > span { animation: none; transform: none; }
  [data-spin] { rotate: none; }
  .ticker img { animation: none; }
  .btn:hover, a:hover .zoom img, .zoom:hover img, .tile:hover img, .reel__item:hover img { transform: none; }
  .tile:hover .tile__text { translate: 0 0; }
  .rail__track { scroll-behavior: auto; }
  .stack__card { position: relative; height: auto; min-height: 70vh; }
}
