/* ==========================================================================
   The Wine Atlas — hero
   ========================================================================== */

:root {
  --parchment: #ede3cf;
  --ivory: #f7f1e6;
  --burgundy: #6b1f2a;
  --burgundy-deep: #521620;
  --olive: #8a8a5c;
  --olive-light: #b9b58a;
  --charcoal: #1c1a17;
  --ink: #2a2622;

  --serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --sans: "Jost", "Helvetica Neue", Arial, sans-serif;

  /* Never closer to the edge than a landscape phone's notch */
  --gutter: max(clamp(1.25rem, 5vw, 5.5rem), env(safe-area-inset-left), env(safe-area-inset-right));
  --frame: clamp(.75rem, 2vw, 1.75rem);
  --gilt: #d8c9a3;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--charcoal);
  color: var(--ivory);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a { color: inherit; }

:focus-visible {
  outline: 1px solid var(--olive-light);
  outline-offset: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -4rem;
  z-index: 100;
  padding: .75rem 1rem;
  background: var(--ivory);
  color: var(--charcoal);
  font-size: .8125rem;
  letter-spacing: .08em;
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* --------------------------------------------------------------------------
   Shared type
   -------------------------------------------------------------------------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.75rem;
  font-family: var(--sans);
  font-size: .6875rem;
  font-weight: 400;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--olive-light);
}
.eyebrow::before {
  content: "";
  flex: 0 0 2.5rem;
  height: 1px;
  background: currentColor;
  opacity: .7;
}
.eyebrow--dark { color: var(--olive); }

/* --------------------------------------------------------------------------
   Buttons & links
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .9rem;
  min-height: 3.25rem;
  padding: 0 1.9rem;
  border: 1px solid transparent;
  font-family: var(--sans);
  font-size: .71875rem;
  font-weight: 400;
  letter-spacing: .24em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color .45s var(--ease),
    border-color .45s var(--ease),
    color .45s var(--ease);
}

.btn--primary {
  background: var(--burgundy);
  color: var(--ivory);
}
.btn--primary:hover {
  background: var(--burgundy-deep);
  border-color: rgba(247, 241, 230, .28);
}

.btn__arrow {
  flex-shrink: 0;
  width: 1.5rem;
  height: .625rem;
  transition: transform .45s var(--ease);
}
.btn:hover .btn__arrow { transform: translateX(4px); }

.btn--ghost {
  min-height: 2.75rem;
  padding: 0 1.4rem;
  border-color: rgba(247, 241, 230, .45);
  color: var(--ivory);
  font-size: .6875rem;
  letter-spacing: .2em;
}
.btn--ghost:hover {
  background: var(--ivory);
  border-color: var(--ivory);
  color: var(--burgundy);
}

.text-link {
  position: relative;
  display: inline-block;
  padding: .5rem 0;
  font-size: .71875rem;
  font-weight: 400;
  letter-spacing: .24em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--ivory);
}
.text-link::after {
  content: "";
  position: absolute;
  left: 0; right: .24em; bottom: .2rem;
  height: 1px;
  background: currentColor;
  opacity: .55;
  transform-origin: left;
  transition: transform .5s var(--ease), opacity .5s var(--ease);
}
.text-link:hover::after {
  opacity: 1;
  transform: scaleX(.4);
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: var(--charcoal);
}

.hero__media,
.hero__poster,
.hero__poster img,
.hero__final,
.hero__final img,
.hero__video,
.hero__veil,
.hero__scrim,
.hero__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero__media { z-index: -1; }

.hero__poster img,
.hero__final img,
.hero__video {
  object-fit: cover;
  /* Bias right: keeps the map route and the bottle clear of the copy */
  object-position: 62% 50%;
}

.hero__video {
  opacity: 0;
  transition: opacity 1.4s var(--ease);
}
.hero__video.is-playing { opacity: 1; }

/* Held final frame: shown when motion is off, autoplay is blocked or the film cannot load */
.hero__final {
  opacity: 0;
  transition: opacity .9s var(--ease);
}
.hero.is-static .hero__final,
html:not(.js) .hero__final { opacity: 1; }
.hero.is-static .hero__video { opacity: 0; }

/* Keeps the nav legible over the bright opening scenes */
.hero__veil {
  background: linear-gradient(180deg, rgba(22, 19, 16, .5) 0%, rgba(22, 19, 16, 0) 24%);
  pointer-events: none;
}

/* Light, directional shade: the label panel carries the contrast */
.hero__scrim {
  background:
    linear-gradient(90deg,
      rgba(22, 19, 16, .5) 0%,
      rgba(22, 19, 16, .3) 45%,
      rgba(22, 19, 16, 0) 70%),
    rgba(22, 19, 16, .08);
}

/* Hairline inset frame around the whole scene */
.hero__frame {
  inset: var(--frame);
  width: auto;
  height: auto;
  border: 1px solid rgba(247, 241, 230, .28);
  pointer-events: none;
}

.hero__scrim,
.hero__frame { transition: opacity 1.8s var(--ease); }
.js .hero:not(.is-revealed) .hero__scrim,
.js .hero:not(.is-revealed) .hero__frame { opacity: 0; }

.js .hero__content { transition: opacity 1.2s var(--ease); }
.js .hero.is-reset .hero__content { opacity: 0; transition-duration: .5s; }

.hero__content {
  position: relative;
  width: 100%;
  padding: 7rem var(--gutter) 6rem calc(var(--gutter) + 2rem);
}

/* The copy sits on a label, double-ruled like the one on the bottle */
.hero__label {
  width: min(34rem, 100%);
  padding: .625rem;
  border: 1px solid rgba(232, 220, 194, .6);
  background: rgba(22, 19, 16, .62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.hero__label-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3.25rem 3rem 3rem;
  border: 1px solid rgba(232, 220, 194, .35);
  text-align: center;
}

.hero__mark {
  margin: 0;
  font-size: .65625rem;
  font-weight: 400;
  letter-spacing: .4em;
  text-transform: uppercase;
  color: var(--gilt);
}

.hero__ornament {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.375rem 0 1.625rem;
  color: var(--gilt);
}
.hero__ornament::before,
.hero__ornament::after {
  content: "";
  width: 2.75rem;
  height: 1px;
  background: currentColor;
  opacity: .6;
}
.hero__ornament svg { width: 9px; height: 9px; }

.hero__title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 3.75vw, 3.4rem);
  font-weight: 300;
  line-height: 1.08;
  color: var(--ivory);
  text-wrap: balance;
}
.hero__title em {
  display: block;
  font-style: italic;
  font-weight: 300;
  color: #e8dcc2;
}

.hero__lede {
  max-width: 24rem;
  margin: 1.625rem 0 0;
  font-size: .9375rem;
  line-height: 1.8;
  color: rgba(247, 241, 230, .84);
  text-wrap: pretty;
}

.hero__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  margin-top: 2.25rem;
}
.hero__actions .btn--primary { border-color: rgba(232, 220, 194, .35); }
.hero__actions .text-link { color: rgba(247, 241, 230, .78); }

/* --------------------------------------------------------------------------
   Anchors
   -------------------------------------------------------------------------- */

.anchor { position: absolute; top: 0; }

/* --------------------------------------------------------------------------
   Entrance motion — quiet, staggered, once
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(14px);
    animation: reveal 1.4s var(--ease) forwards;
    animation-delay: calc(var(--d, 0) * .16s);
    animation-play-state: paused;
  }
  .js .hero.is-revealed .reveal { animation-play-state: running; }
}

@keyframes reveal { to { opacity: 1; transform: none; } }
@keyframes fade { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation: none !important;
  }
  .hero__video { display: none; }
  .hero__final { opacity: 1; }
}

/* --------------------------------------------------------------------------
   Mobile & small tablet: copy settles low over the film
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
  .hero {
    align-items: flex-end;
    min-height: 100svh;
  }

  .hero__poster img,
  .hero__final img,
  .hero__video { object-position: 68% 35%; }

  .hero__scrim {
    background:
      linear-gradient(180deg,
        rgba(22, 19, 16, .55) 0%,
        rgba(22, 19, 16, .1) 18%,
        rgba(22, 19, 16, .15) 34%,
        rgba(22, 19, 16, .45) 62%,
        rgba(22, 19, 16, .7) 100%);
  }

  .hero__content {
    min-width: 0;
    padding: 7rem calc(var(--frame) + .75rem) calc(var(--frame) + 3.5rem + env(safe-area-inset-bottom));
  }

  .hero__label { width: 100%; padding: .5rem; }
  .hero__label-inner { padding: 2rem 1.25rem 1.75rem; }
  .hero__ornament { margin: 1rem 0 1.25rem; }

  /* Sized from the label's inner width, so "Discover the world," always holds one line */
  .hero__title { font-size: clamp(1.625rem, calc((100vw - 6.75rem) / 7.7), 2.9rem); line-height: 1.06; }
  .hero__lede { margin-top: 1.125rem; line-height: 1.65; }

  .hero__actions {
    align-self: stretch;
    margin-top: 1.5rem;
    gap: .25rem;
  }
  .hero__actions .btn {
    width: 100%;
    gap: .6rem;
    padding: 0 1rem;
    font-size: .6875rem;
    letter-spacing: .16em;
  }

}

/* The narrowest phones: the button's words need the room */
@media (max-width: 359px) {
  .hero__actions .btn { gap: .5rem; letter-spacing: .12em; }
}

/* Upright phones: the frame is only a quarter of the film's width, so the crop
   tracks the subject: the glass, then the glass as it is lifted, then the grapes */
@media (max-width: 767px) and (orientation: portrait) {
  .hero__poster img,
  .hero__video { object-position: 52% 50%; }
  .hero__video { transition: opacity 1.4s var(--ease), object-position 1s var(--ease); }
  .hero__video.is-following { object-position: 65% 50%; }
  .hero.is-revealed .hero__video,
  .hero__final img { object-position: 80% 50%; }

  .hero { align-items: center; }
  .hero__content {
    padding-top: calc(var(--frame) + 3.5rem + env(safe-area-inset-bottom));
  }
}

/* Short landscape screens: keep the copy from crowding the header */
@media (min-width: 768px) and (max-height: 720px) {
  .hero__content { padding-top: 4rem; padding-bottom: 4rem; }
  .hero__label-inner { padding: 2.25rem 2.5rem 2rem; }
  .hero__ornament { margin: 1rem 0 1.25rem; }
  .hero__lede { margin-top: 1.25rem; }
  .hero__actions { margin-top: 1.5rem; }
}

/* Landscape phones: short viewport, so tighten the label and keep it above the fold */
@media (max-height: 500px) and (orientation: landscape) {
  .hero__content {
    padding: 2.5rem 0 2.5rem max(calc(var(--frame) + 1.5rem), calc(env(safe-area-inset-left) + .75rem));
  }
  .hero__label { width: min(28rem, 72vw); padding: .375rem; }
  .hero__label-inner { padding: 1.25rem 1.5rem; }
  .hero__ornament { display: none; }
  .hero__mark { margin-bottom: .75rem; }
  .hero__title { font-size: clamp(1.6rem, 4.2vw, 2.1rem); }
  .hero__lede { margin-top: .625rem; font-size: .875rem; line-height: 1.55; }
  .hero__actions { flex-direction: row; gap: 1.5rem; margin-top: 1rem; }
  .btn { min-height: 2.75rem; padding: 0 1.25rem; letter-spacing: .18em; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .hero__scrim {
    background:
      linear-gradient(90deg, rgba(22,19,16,.55) 0%, rgba(22,19,16,.3) 50%, rgba(22,19,16,0) 75%);
  }
}
