/* ============================================================
   PHATHEAD ENHANCEMENTS — load AFTER styles.css
   Motion, cinematic hero, compact header, cinematic video cards
   ============================================================ */

/* ------------------------------------------------------------
   1. LUXURY REVEAL MOTION
   Elements get .reveal from motion.js (no-JS users see everything)
   ------------------------------------------------------------ */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.95s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.95s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Hero intro — plays once on page load */
@keyframes hero-rise {
  from {
    opacity: 0;
    transform: translateY(34px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-intro > * {
  animation: hero-rise 1.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-intro > *:nth-child(1) { animation-delay: 0.05s; }
.hero-intro > *:nth-child(2) { animation-delay: 0.16s; }
.hero-intro > *:nth-child(3) { animation-delay: 0.3s; }
.hero-intro > *:nth-child(4) { animation-delay: 0.44s; }
.hero-intro > *:nth-child(5) { animation-delay: 0.56s; }

/* Slow drift on the hero reel — subtle, cinematic */
@keyframes hero-drift {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-reel {
    animation: hero-drift 26s ease-in-out infinite alternate;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .hero-intro > * {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }

  .hero-reel {
    animation: none !important;
  }
}

/* ------------------------------------------------------------
   2. CINEMATIC HERO — lighter grade, film grain, vignette
   ------------------------------------------------------------ */
.video-hero::after {
  background:
    radial-gradient(120% 90% at 50% 40%, transparent 58%, rgba(5, 5, 5, 0.5) 100%),
    linear-gradient(90deg, rgba(5, 5, 5, 0.84) 0%, rgba(5, 5, 5, 0.52) 42%, rgba(5, 5, 5, 0.1) 100%),
    linear-gradient(0deg, rgba(5, 5, 5, 0.92) 0%, rgba(5, 5, 5, 0) 34%);
}

/* Play the hero reel everywhere — styles.css only enabled it when the
   visitor's phone had Reduce Motion off, which silently hid it on many
   iPhones. The reel is muted and looped, so it stays on. */
.hero-reel {
  display: block;
  opacity: 0.9;
}

.video-hero .hero-collage {
  display: none;
}

.video-hero.hero-video-disabled .hero-collage {
  display: grid;
}

.video-hero.hero-video-disabled .hero-reel {
  display: none;
}

.page-hero::before {
  opacity: 0.52;
}

.page-hero::after {
  background:
    radial-gradient(120% 100% at 50% 40%, transparent 56%, rgba(7, 7, 7, 0.46) 100%),
    linear-gradient(90deg, rgba(7, 7, 7, 0.88), rgba(7, 7, 7, 0.34));
}

/* Film grain across the site — very low opacity, no perf cost */
body::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  content: "";
  inset: 0;
  mix-blend-mode: overlay;
  opacity: 0.07;
  pointer-events: none;
  position: fixed;
  z-index: 60;
}

/* ------------------------------------------------------------
   3. COMPACT STICKY HEADER (desktop + mobile) + shrink on scroll
   ------------------------------------------------------------ */
.nav {
  min-height: 58px;
  padding: 10px 0;
  transition: min-height 0.35s ease, padding 0.35s ease;
}

.brand-mark {
  height: 36px;
  width: 36px;
}

.brand-copy strong {
  font-size: 1.28rem;
}

.site-header.is-scrolled .nav {
  min-height: 48px;
  padding: 6px 0;
}

html {
  scroll-padding-top: 76px;
}

/* Mobile: single row — logo + links, no giant stacked block */
@media (max-width: 900px) {
  .nav {
    align-items: center;
    flex-direction: row;
    gap: 12px;
    min-height: 54px;
    padding: 8px 0;
  }

  .brand {
    flex: 0 0 auto;
  }

  .nav-links {
    flex-wrap: nowrap;
    gap: 16px;
    justify-content: flex-end;
    overflow-x: auto;
    scrollbar-width: none;
    width: auto;
    flex: 1 1 auto;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  .nav-links .book-link {
    margin-left: 8px;
  }

  html {
    scroll-padding-top: 72px;
  }

  .menu-section,
  .menu-gallery-section,
  .process-section,
  .page-hero,
  .section {
    scroll-margin-top: 72px;
  }
}

@media (max-width: 640px) {
  html {
    scroll-padding-top: 66px;
  }

  /* Logo only — brand text lives in the hero anyway */
  .brand-copy {
    display: none;
  }

  .nav-links {
    justify-content: space-between;
  }

  .video-hero,
  .video-hero .hero-inner {
    min-height: calc(100svh - 58px);
  }
}

/* ------------------------------------------------------------
   4. CINEMATIC VIDEO CARDS — poster facade, no YouTube chrome
   Hover still auto-plays a muted preview. Click plays with sound.
   ------------------------------------------------------------ */
.video-frame {
  cursor: pointer;
}

.yt-facade {
  background: #000;
  inset: 0;
  overflow: hidden;
  position: absolute;
  z-index: 1;
}

.yt-facade .yt-poster {
  filter: grayscale(0.28) contrast(1.1);
  height: 100%;
  object-fit: cover;
  transform: scale(1.01);
  transition: filter 0.45s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  width: 100%;
}

.video-card:hover .yt-facade .yt-poster,
.video-card:focus-within .yt-facade .yt-poster {
  filter: grayscale(0) contrast(1.08);
  transform: scale(1.045);
}

/* poster fades out while the muted preview plays underneath */
.video-frame.is-previewing .yt-facade .yt-poster {
  opacity: 0;
}

.yt-play {
  align-items: center;
  background: rgba(5, 5, 5, 0.55);
  backdrop-filter: blur(3px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 0;
  display: flex;
  height: 58px;
  justify-content: center;
  left: 50%;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: background 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
  width: 58px;
  z-index: 2;
}

.yt-play::before {
  background: var(--paper);
  clip-path: polygon(22% 12%, 22% 88%, 86% 50%);
  content: "";
  height: 20px;
  transition: background 0.3s ease;
  width: 18px;
}

.video-card:hover .yt-play,
.video-card:focus-within .yt-play {
  background: var(--paper);
  transform: translate(-50%, -50%) scale(1.06);
}

.video-card:hover .yt-play::before,
.video-card:focus-within .yt-play::before {
  background: var(--ink);
}

.video-frame.is-playing .yt-facade,
.video-frame.is-playing .yt-play,
.video-frame.is-playing .video-hint {
  display: none;
}

.yt-preview-frame,
.yt-full-frame {
  border: 0;
  height: 100%;
  inset: 0;
  position: absolute;
  width: 100%;
  z-index: 0;
}

.video-frame.is-playing .yt-full-frame {
  z-index: 3;
}

.video-hint {
  z-index: 2;
}

/* ------------------------------------------------------------
   5. SMALL FIXES
   ------------------------------------------------------------ */
/* Keep the floating soundtrack button off the footer links / form */
.footer-inner {
  padding-right: 72px;
}

.booking-form {
  scroll-margin-top: 90px;
}

main {
  padding-bottom: 0;
}

.booking-panel {
  padding-bottom: 40px;
}

/* Tighter booking hero on phones (kills the dead gap) */
@media (max-width: 640px) {
  .page-hero {
    padding: 58px 0 46px;
  }
}
