/* ==========================================================================
   Coffee journey: scroll-driven selection section
   Plain CSS, also valid as an SCSS partial (rename to _coffee-journey.scss)

   Default (no JS / reduced motion): stacked list of stages + final visual.
   .is-animated (added by JS): pinned, scroll-driven layout.
   ========================================================================== */

.journey {
  /* Palette: swap these to match the brand system */
  --bg: #eae3d1; /* matches the video background */
  --ceramic: #f7f5f0;
  --ink: #1f1a16;
  --muted: #5f564e;
  --faint: #9a9088;
  --line: rgba(31, 26, 22, 0.14);
  --line-strong: rgba(31, 26, 22, 0.26);
  --accent: #2e4a3a;
  --accent-hover: #1d3126;

  /* Type */
  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;

  /* Layout */
  --pad: clamp(1.25rem, 5vw, 4.5rem);
  --gap: clamp(2rem, 5vw, 6rem);
  --header-h: 72px; /* fixed .cc-header height once sticky (topbar collapsed) */
  color: var(--ink);
  font-family: var(--font-body);
  padding-block: clamp(4rem, 9vw, 8rem);
}

/* ---------- Static / fallback layout ---------- */

.journey__pin {
  display: flex;
  flex-direction: column;
  gap: clamp(3rem, 6vw, 5rem);
  max-width: 40rem;
  margin-inline: auto;
  padding-inline: var(--pad);
}

.journey__visual {
  position: relative;
  z-index: 1;
  width: min(100%, 44rem);
  margin-inline: auto;
  pointer-events: none;
}

.progress {
  display: none;
}

/* ---------- Typography ---------- */

.journey__title {
  margin: 0 0 clamp(1.5rem, 3vw, 2.5rem);
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2rem, 3.3vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.panel {
  position: relative;
  max-width: 32rem;
}

.panel--intro .panel__body {
  padding-top: 1.5rem;
}

.panel__index {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0 0 1rem;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  display: none;
}

.panel__index::after {
  content: "";
  width: 2.5rem;
  height: 1px;
  background: currentColor;
}

.panel__title {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 2.1vw, 2.2rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.panel__text {
  max-width: 30rem;
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.cta {
  display: inline-block;
  margin-top: 1.75rem;
  padding: 10px 15px;
  border: 1px solid #3b3330;
  border-radius: 6px;
  line-height: 1.2;
  color: var(--accent);
  font:500 .85rem Inter,sans-serif;
  font-weight: 400;
  text-decoration: none;
  transition: color 0.3s var(--ease, ease), border-color 0.3s var(--ease, ease);
  background: #3b3330;
  color: #fff;
  transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.cta:hover {
  background: #96591d;
  border-color:  #96591d;
  color: #fff;
  transform: translateY(-2px);
}

.cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ---------- Visual (scroll-scrubbed video) ---------- */

.journey__video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  -webkit-mask-image: linear-gradient(to right, transparent, #fff 20%, #fff 80%, transparent), linear-gradient(to bottom, transparent, #fff 20%, #fff 80%, transparent);
  -webkit-mask-composite: intersect;
  mask-composite: intersect;
}

/* Hidden while JS primes decoding (play -> pause), so the video is never
   seen running on its own. JS removes the class once it is parked. */
.journey__video.is-priming {
  opacity: 0;
}
.journey__video {
  transition: opacity 0.25s ease;
}

/* ---------- Animated layout: mobile and tablet first ---------- */

.journey.is-animated {
  padding-block: 0;


  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
}

.journey.is-animated .journey__pin {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  row-gap: 0.75rem;
  height: 100vh;
  height: 100lvh;
  max-width: none;
  margin-inline: 0;
  /* bottom: progress strip (2.25rem) + the floating pill/WhatsApp row (5rem) */
  padding: calc(var(--header-h) + 0.75rem) var(--pad) 7.5rem;
  overflow: hidden;
}

.journey.is-animated .journey__visual {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  margin-inline: 0;
  overflow: hidden;
  will-change: transform;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent), linear-gradient(180deg, transparent, #000 6%, #000 94%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent), linear-gradient(180deg, transparent, #000 6%, #000 94%, transparent);
  mask-composite: intersect;
}

.journey.is-animated .journey__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-position: center;
}

.journey.is-animated .panel {
  grid-area: 2 / 1;
  align-self: end;
  z-index: 2;
  will-change: transform, opacity;
}

.journey.is-animated .progress {
  position: absolute;
  bottom: 5.5rem;            /* clears the locator pill / WhatsApp button */
  left: 50%;
  z-index: 3;
  display: block;
  width: min(22rem, calc(100% - 2 * var(--pad)));
  translate: -50% 0;
}

.progress__list {
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 0;
  list-style: none;
}

.progress__item {
  width: 2rem;
  color: var(--faint);
  font-size: 0.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: center;
  transition: color 0.3s ease;
}

.progress__item.is-active {
  color: var(--ink);
}

.progress__track {
  position: relative;
  height: 1px;
  margin: 0.6rem 1rem 0; /* 1rem = half an item, so the line runs centre to centre */
  background: var(--line-strong);
}

.progress__fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(var(--p, 0));
  transform-origin: left center;
}

/* ---------- Animated layout: desktop ---------- */

@media (min-width: 992px) {
  .journey.is-animated .journey__pin {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
    column-gap: var(--gap);
    height: 100vh;
    padding-top: calc(var(--header-h) + 2rem);
    padding-bottom: 5.5rem;
  }

  .journey.is-animated .journey__visual {
    grid-area: 1 / 2;
  }

  .journey.is-animated .panel {
    align-self: center;
  }

  .journey.is-animated .panel--left {
    grid-area: 1 / 1;
  }

  .journey.is-animated .panel--right {
    grid-area: 1 / 2;
  }

  .journey.is-animated .progress {
    bottom: 2rem;
  }
}

/* ---------- Small phones ---------- */

@media (max-width: 575.98px) {
  .journey__title {
    margin-bottom: 1.25rem;
    font-size: 1.6rem;
  }

  .panel--intro .panel__body {
    padding-top: 1rem;
  }

  .panel__index {
    margin-bottom: 0.6rem;
  }

  .panel__title {
    margin-bottom: 0.6rem;
    font-size: 1.4rem;
  }

  .panel__text {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .cta {
    margin-top: 0.9rem;
    padding: 9px 14px;
  }

  .journey.is-animated .journey__pin {
    --header-h: 64px;
    padding-bottom: 6.75rem;
  }
  .journey.is-animated .progress {
    bottom: 4.75rem;
  }
  .progress__item {
    width: 1.6rem;
    font-size: 0.7rem;
  }
  .progress__track {
    margin: 0.5rem 0.8rem 0;
  }
}

/* Very short phones (landscape): drop the progress strip, give text the room */
@media (max-width: 991.98px) and (max-height: 520px) {
  .journey.is-animated .progress { display: none; }
  .journey.is-animated .journey__pin { padding-bottom: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cta,
  .progress__item {
    transition: none;
  }
}