/* ============================================================
   Estela Estate — Scroll Film
   Scroll-scrubbed video sequence with HTML text overlays.
   No dependencies. Text is never burned into the video.
   ============================================================ */

/* Falls back to the film's own palette when used standalone, but inherits
   the site's tokens from styles.css whenever it's embedded in a page. */
:root {
  --sf-cream: var(--cream, #EFE7DA);
  --sf-cream-dim: var(--cream-dim, #C4B8A1);
  --sf-gold: var(--gold, #C6A15B);
  --sf-black: var(--noir, #0B0A09);
}

/* ---------- One pinned viewport, shots stacked as layers ----------
   Per-shot sticky sections leave a viewport-tall dead gap between
   each shot where nothing scrubs. One viewport removes it. */

.sf-film {
  position: relative;
  background: var(--sf-black);
  color: var(--sf-cream);
  /* Fallback height for no-JS / JS-error; the engine overwrites it
     with the sum of the shots' data-len values. */
  height: 100vh;
}

.sf-viewport {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh; /* avoids mobile URL-bar resize jumps */
  overflow: hidden;
  background: var(--sf-black);
}

.sf-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  will-change: opacity;
}

/* Without JS the engine never sets opacity, so the hero would be black.
   The first shot's poster stands in as a still hero image. */
.sf-layer:first-child {
  opacity: 1;
  visibility: visible;
}

/* Clips unreachable (missing upload, bad deploy): fall all the way back to
   the original static hero so the page still reads as designed. */
.sf-film--unavailable .sf-viewport {
  background: var(--sf-black) url("../img/hero.jpg") center 55% / cover no-repeat;
}
.sf-film--unavailable .sf-media,
.sf-film--unavailable .sf-hint,
.sf-film--unavailable .sf-skip { display: none; }

.sf-film--unavailable .sf-layer { opacity: 0; visibility: hidden; }
.sf-film--unavailable .sf-layer:first-child { opacity: 1; visibility: visible; }
.sf-film--unavailable .sf-line { opacity: 1; transform: none; }

.sf-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* Promote to its own layer so scrubbing doesn't repaint the text */
  will-change: transform;
  transform: translateZ(0);
}

/* Vignette + bottom scrim so cream text always clears its background */
.sf-layer::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 40%, rgba(11,10,9,.55) 100%),
    linear-gradient(to top, rgba(11,10,9,.65) 0%, transparent 38%);
}

/* ---------- Text overlays ---------- */

.sf-copy {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 0 8vw;
  text-align: center;
  pointer-events: none;
}

/* Opening shot keeps the site's existing left-aligned hero composition
   rather than the centred cinematic captions used later in the film. */
.sf-copy--hero {
  place-items: center start;
  text-align: left;
  padding: 0;
}
.sf-copy--hero .sf-line { width: 100%; }

.sf-line {
  grid-area: 1 / 1;
  opacity: 0;
  transform: translateY(14px);
  transition: none; /* driven per-frame by JS, not by transition */
  will-change: opacity, transform;
}

.sf-wordmark {
  font-family: "Jost", "Futura", "Century Gothic", system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(2.2rem, 7vw, 5.5rem);
  letter-spacing: .34em;
  /* letter-spacing adds trailing space on the last glyph; pull it back
     so the wordmark stays optically centred */
  text-indent: .34em;
  line-height: 1;
  margin: 0;
}

.sf-eyebrow {
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  font-size: clamp(.7rem, 1.6vw, .95rem);
  letter-spacing: .42em;
  text-indent: .42em;
  margin: 1.4em 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2em;
}

.sf-eyebrow::before,
.sf-eyebrow::after {
  content: "";
  width: clamp(28px, 7vw, 72px);
  height: 1px;
  background: currentColor;
  opacity: .55;
}

.sf-statement {
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  font-weight: 300;
  font-size: clamp(1.5rem, 4.2vw, 3.2rem);
  line-height: 1.25;
  letter-spacing: .02em;
  margin: 0;
  text-wrap: balance;
}

.sf-place {
  font-family: "Jost", "Futura", "Century Gothic", system-ui, sans-serif;
  font-size: clamp(.68rem, 1.5vw, .9rem);
  letter-spacing: .38em;
  text-indent: .38em;
  opacity: .8;
  margin: 0;
}

/* ---------- Scroll hint + skip ---------- */

/* Absolute inside the pinned viewport, not fixed — a fixed cue would
   hang over the shop content for the rest of the page. */
.sf-hint {
  position: absolute;
  left: 50%;
  bottom: 2.5rem;
  translate: -50% 0;
  z-index: 4;
  font-family: "Jost", system-ui, sans-serif;
  font-size: .62rem;
  letter-spacing: .34em;
  text-indent: .34em;
  color: var(--sf-cream);
  opacity: .0;
  pointer-events: none;
  transition: opacity .6s ease;
}
.sf-hint.is-visible { opacity: .65; }

.sf-hint i {
  display: block;
  width: 1px;
  height: 34px;
  margin: .9rem auto 0;
  background: linear-gradient(to bottom, currentColor, transparent);
  animation: sf-drift 2.4s ease-in-out infinite;
}

@keyframes sf-drift {
  0%, 100% { transform: scaleY(.4); transform-origin: top; opacity: .3; }
  50%      { transform: scaleY(1);  transform-origin: top; opacity: 1; }
}

/* This is a shop, not a showreel — anyone who came to buy wine must be
   able to leave the film immediately. */
.sf-skip {
  position: absolute;
  right: clamp(1rem, 4vw, 2.5rem);
  bottom: clamp(1.5rem, 4vw, 2.5rem);
  z-index: 5;
  appearance: none;
  border: 1px solid rgba(239,231,218,.35);
  background: rgba(11,10,9,.35);
  backdrop-filter: blur(6px);
  color: var(--sf-cream);
  font-family: "Jost", system-ui, sans-serif;
  font-size: .62rem;
  letter-spacing: .28em;
  text-indent: .28em;
  padding: .85em 1.4em;
  border-radius: 2px;
  cursor: pointer;
  transition: opacity .4s ease, border-color .3s ease, background .3s ease;
}
.sf-skip:hover,
.sf-skip:focus-visible {
  border-color: rgba(239,231,218,.75);
  background: rgba(11,10,9,.6);
}
.sf-skip[hidden] { display: none; }

/* ---------- Boot mark ----------
   Deliberately NOT a page preloader. The poster paints immediately, so
   blocking the page would only add delay. This appears over the poster
   only if the first clip is still loading after a grace period, and most
   visitors on a decent connection never see it at all. */

.sf-boot {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: 1.1rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity .5s ease;
}
.sf-boot.is-on { opacity: 1; }
.sf-boot[hidden] { display: none; }

.sf-boot__name {
  font-family: "Jost", "Century Gothic", system-ui, sans-serif;
  font-weight: 300;
  font-size: clamp(.72rem, 1.8vw, .95rem);
  letter-spacing: .58em;
  text-indent: .58em;
  color: var(--sf-cream);
}

/* Echoes the rules either side of ESTATE in the real wordmark. */
.sf-boot__rule {
  display: block;
  width: clamp(110px, 22vw, 190px);
  height: 1px;
  background: rgba(240, 232, 215, .22);
  overflow: hidden;
}
.sf-boot__rule i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--sf-gold);
  transform-origin: left center;
  animation: sf-fill 1.6s cubic-bezier(.5, 0, .3, 1) infinite;
}

@keyframes sf-fill {
  0%        { transform: scaleX(0);   transform-origin: left center; }
  48%       { transform: scaleX(1);   transform-origin: left center; }
  52%       { transform: scaleX(1);   transform-origin: right center; }
  100%      { transform: scaleX(0);   transform-origin: right center; }
}

@media (prefers-reduced-motion: reduce) {
  .sf-boot__rule i { animation: none; opacity: .5; }
}

/* ---------- Loading ---------- */

.sf-loader {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  background: var(--sf-black);
  transition: opacity .8s ease;
}
.sf-loader.is-done { opacity: 0; pointer-events: none; }

.sf-loader-bar {
  width: min(180px, 40vw);
  height: 1px;
  background: rgba(239,231,218,.18);
  overflow: hidden;
}
.sf-loader-bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--sf-cream);
  transition: width .3s ease;
}

/* ---------- Accessibility / fallbacks ---------- */

@media (prefers-reduced-motion: reduce) {
  .sf-line { transition: none; }
  .sf-hint span { animation: none; }
}

/* Screen-reader transcript of the film's copy — the text lives in the DOM
   as real markup, so it is indexable and translatable. */
.sf-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%);
  white-space: nowrap; border: 0;
}
