/* ================================================================
   LA BOCCIA TUSCANY — MOTION SYSTEM
   Palette, typography, layout and every button's look stay exactly
   as they were. This file only changes *how* things move:
     1. Native browser motion (View Transitions, CSS grid interpolation)
        instead of JS-measured heights and opacity flicker.
     2. Physically believable easing (spring-like curves, a lerped
        parallax in animations.js) instead of 1:1 linear motion.
     3. Motion that respects the reader: reveal-once, no infinite loops
        on static UI, full prefers-reduced-motion support.
   All original class names (.reveal, .delay-1..4, .ken-burns,
   .parallax-layer, .glow-anim, .float-anim, .lift-on-hover,
   .scale-on-hover, .fade-in-page) keep working with no markup changes.
   ================================================================ */

/* ── 0. Native page-to-page transitions (progressive enhancement) ──
   Chromium-based browsers will cross-fade between pages of this site
   automatically. Unsupported browsers simply ignore this at-rule and
   navigate as before — there is no fallback needed. */
@view-transition {
  navigation: auto;
}

::view-transition-group(root) {
  animation-duration: 0.5s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

::view-transition-old(root) {
  animation: rf-fade-out 0.32s cubic-bezier(0.4, 0, 1, 1) both;
}

::view-transition-new(root) {
  animation: rf-fade-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes rf-fade-out {
  to { opacity: 0; }
}

@keyframes rf-fade-in {
  from { opacity: 0; transform: translateY(10px); }
}

/* Menu cards get a stable view-transition-name (set in js/main.js),
   so when the filter changes, each card glides natively to its new
   grid position instead of the whole grid blinking off and on. */
::view-transition-group(*) {
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── 1. Scroll reveals ──
   Same markup as before (.reveal, .delay-1..4). Elements without an
   explicit delay class get an automatic stagger index (--reveal-i)
   written by animations.js, so grids — menu cards, wine lists —
   cascade in on their own with no per-card class needed. */
.reveal {
  opacity: 0;
  transform: translateY(28px) scale(0.98);
  filter: blur(6px);
  transition:
    opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.9s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.7s ease-out;
  transition-delay: calc(var(--reveal-i, 0) * 70ms);
  will-change: transform, opacity, filter;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

/* Stagger entry delays (explicit, still take priority over --reveal-i) */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }

/* ── 2. Text reveal mask (unchanged API) ── */
.reveal-text-container {
  overflow: hidden;
  position: relative;
  display: block;
}

@keyframes textRevealUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.reveal-text {
  display: inline-block;
  animation: textRevealUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ── 3. Hero Ken Burns — slower, with a gentle drift so it reads as
   a living photograph rather than a mechanical zoom loop ── */
@keyframes kenBurns {
  0%   { transform: scale(1.04) translate3d(0, 0, 0); }
  50%  { transform: scale(1.12) translate3d(-1.4%, -1%, 0); }
  100% { transform: scale(1.04) translate3d(0, 0, 0); }
}

.ken-burns {
  animation: kenBurns 24s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  transform-origin: center center;
}

/* ── 4. Mouse parallax — animations.js now eases toward the pointer
   instead of snapping to it every mousemove event; this is just the
   paint hint for the browser. ── */
.parallax-layer {
  will-change: transform;
}

/* ── 5. Pairing / highlight glow (same trigger, smoother curve) ── */
@keyframes goldGlow {
  0%, 100% { box-shadow: 0 0 6px rgba(197, 160, 89, 0.18); }
  50%      { box-shadow: 0 0 22px rgba(197, 160, 89, 0.5); }
}

.glow-anim {
  animation: goldGlow 2.6s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

/* ── 6. Buttons — same colors, radius and padding everywhere.
   The old always-pulsing hover glow is replaced with a single light
   sheen sweep (plays once per hover, not on a loop) plus a tactile
   press. A click also spawns a soft ripple from the pointer, added
   by animations.js, so every tap gets instant visual confirmation.

   Bug fix: .btn-nav-book and .btn-mobile-book are <a> links with no
   explicit `display`, so they default to `display: inline`. Overflow
   doesn't clip properly on plain inline boxes, which is why the sheen
   was escaping the button and floating over the navbar. Giving them
   `inline-flex` (same as .btn-primary/.btn-outline already had) fixes
   the clipping and is visually identical — it's how the button was
   already being laid out via padding/line-height. ── */
.btn-primary,
.btn-outline,
.btn-nav-book,
.btn-mobile-book {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary::before,
.btn-outline::before,
.btn-nav-book::before,
.btn-mobile-book::before {
  content: '';
  position: absolute;
  top: -30%;
  left: -60%;
  width: 30%;
  height: 160%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.32), transparent);
  transform: skewX(-14deg);
  mix-blend-mode: overlay;
  pointer-events: none;
}

.btn-primary:hover::before,
.btn-outline:hover::before,
.btn-nav-book:hover::before,
.btn-mobile-book:hover::before {
  animation: rf-sheen 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes rf-sheen {
  to { left: 130%; }
}

.btn-primary:active,
.btn-outline:active,
.btn-nav-book:active,
.btn-mobile-book:active,
.filter-btn:active,
.pairing-selector-btn:active,
.btn-versions-toggle:active {
  transform: scale(0.96);
}

/* Magnetic pull toward the cursor (desktop only — animations.js sets
   --magnet-x/--magnet-y and skips this entirely on touch devices and
   for prefers-reduced-motion). Written out combined with each button's
   own hover transform, since a single element can only have one
   `transform` value in effect at a time. */
.btn-primary:hover {
  transform: translateY(-3px) translate(var(--magnet-x, 0px), var(--magnet-y, 0px));
}

.btn-outline:hover {
  transform: translateY(-3px) translate(var(--magnet-x, 0px), var(--magnet-y, 0px));
}

.btn-nav-book:hover {
  transform: translateY(-2px) scale(1.02) translate(var(--magnet-x, 0px), var(--magnet-y, 0px));
}

/* Click ripple host + ripple element, injected by animations.js */
.rf-ripple-host {
  position: relative;
  overflow: hidden;
}

.rf-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  mix-blend-mode: overlay;
  transform: scale(0);
  opacity: 1;
  pointer-events: none;
  animation: rf-ripple-out 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes rf-ripple-out {
  to { transform: scale(1); opacity: 0; }
}

/* ── 7. Image / card hover (same visual result, springier curve) ── */
.scale-on-hover {
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.card-hover-trigger:hover .scale-on-hover {
  transform: scale(1.05);
}

.lift-on-hover {
  transition:
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.lift-on-hover:hover {
  transform: translateY(-6px);
  box-shadow: 0 15px 35px rgba(139, 28, 42, 0.08);
}

/* ── 8. Page entry — a touch of scale added so it reads as settling
   into place rather than a flat fade ── */
@keyframes fadeInPage {
  from { opacity: 0; transform: translateY(14px) scale(0.995); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.fade-in-page {
  animation: fadeInPage 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ── 9. Ambient float (hero special card) ── */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.float-anim {
  animation: float 6.5s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

/* ── 10. Accordions & drawers ──
   These now animate with the CSS grid 0fr → 1fr technique instead of
   JS-measured max-height, so they open to the *exact* content height
   with no scrollHeight reads and no setTimeout snapping. See
   css/style.css (.menu-versions-drawer) and the inline <style> block
   in cantina.html (.accordion-content / .nested-content) — the
   mechanism lives with the components it belongs to; nothing here
   needs duplicating. */

/* ── 11. Reading progress — a slim line above the navbar that fills
   as you scroll the page. Small, quiet, and purely additive; it
   doesn't touch any existing element. ── */
.rf-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--chianti), var(--gold));
  z-index: 2000;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* ── 12. Stat counters (index.html "4.8 ★ / 100% / Elba") count up
   from 0 once they scroll into view instead of appearing pre-filled —
   same numbers, same styling, just a livelier arrival. ── */

/* ── 13. Respect the reader ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
