/* ==========================================================================
   GardenMotors.it — premium layer 2 (showcase)
   Hero cinematografico (Ken Burns + scrim + tipografia display),
   sequenza frame scroll-driven (frame scrubbing) con scrollytelling,
   split-text reveal, magnetic buttons, rail mobile, morph card→prodotto.
   Baseline no-JS / prefers-reduced-motion: statica e completa.
   Rollback: premium2.css è un file aggiuntivo: basta rimuoverne il <link>.
   ========================================================================== */

/* ---------- 1. Tipografia display (Fraunces) ---------- */
@font-face {
  font-family: 'Fraunces';
  src: url('/assets/fonts/fraunces-600-latin.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
h1, h2, h3 {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.hero h1 { text-wrap: balance; }
h2 { text-wrap: balance; }

/* ---------- 2. Hero cinematografico ---------- */
.hero.hero-media {
  border-radius: 24px;
  margin-top: 16px;
  min-height: clamp(430px, 60vh, 610px);
  display: flex;
  align-items: center;
}
.hero-media .hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: 62% 58%;
  z-index: 0;
  pointer-events: none;
}
.hero-media .hero-scrim {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(8, 30, 16, .92) 0%, rgba(8, 30, 16, .74) 36%, rgba(8, 30, 16, .34) 62%, rgba(8, 30, 16, .08) 100%),
    linear-gradient(180deg, rgba(8, 30, 16, .38) 0%, rgba(8, 30, 16, 0) 26%, rgba(8, 30, 16, 0) 60%, rgba(8, 30, 16, .55) 100%);
}
.hero.hero-media .hero-inner { padding: 68px 26px 74px; max-width: 640px; }
.hero-media .hero-inner h1 { text-shadow: 0 2px 24px rgba(0, 0, 0, .35); }
.hero-media .hero-inner p { text-shadow: 0 1px 14px rgba(0, 0, 0, .45); }
.hero-media .hero-cta .btn-outline { background-color: rgba(10, 36, 20, .42); border-color: rgba(255, 255, 255, .72); }
.hero-media .hero-cta .btn-outline:hover { background-color: rgba(10, 36, 20, .62); border-color: #fff; }
@media (prefers-reduced-motion: no-preference) {
  .hero-media .hero-bg { animation: gmKenBurns 32s ease-in-out infinite alternate; }
}
@keyframes gmKenBurns {
  from { transform: scale(1.045) translate3d(0, 0, 0); }
  to   { transform: scale(1.13) translate3d(-1.6%, -1.1%, 0); }
}
@media (max-width: 720px) {
  .hero.hero-media { min-height: 430px; border-radius: 20px; }
  .hero-media .hero-bg { object-position: 60% 52%; }
  .hero-media .hero-scrim {
    background:
      linear-gradient(180deg, rgba(8, 30, 16, .62) 0%, rgba(8, 30, 16, .48) 40%, rgba(8, 30, 16, .55) 68%, rgba(8, 30, 16, .90) 100%),
      linear-gradient(90deg, rgba(8, 30, 16, .35), rgba(8, 30, 16, .15));
  }
  .hero.hero-media .hero-inner { padding: 46px 20px 52px; }
  .hero-media .hero-inner p { text-shadow: 0 1px 16px rgba(0, 0, 0, .55); }
}

/* ---------- 3. Showcase: sequenza frame scroll-driven ---------- */
/* stato base (no-JS / reduced-motion): card con poster + beats impilati */
.showcase { margin: 42px 0; }
.showcase-pin {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  background: var(--green-deeper);
  box-shadow: 0 24px 60px rgba(12, 61, 30, .28);
}
.showcase-poster { width: 100%; height: auto; display: block; }
.showcase-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity .7s ease;
}
.showcase-canvas.painted { opacity: 1; }
.showcase-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(130% 90% at 10% 102%, rgba(8, 30, 16, .60), rgba(8, 30, 16, 0) 62%),
    linear-gradient(180deg, rgba(8, 30, 16, .16) 0%, rgba(8, 30, 16, 0) 34%, rgba(8, 30, 16, .38) 68%, rgba(8, 30, 16, .85) 100%);
  opacity: 0;
}
.showcase-beats {
  position: relative;
  background: var(--green-deeper);
  color: #fff;
  padding: 26px 26px 30px;
}
.showcase-beats h3 { color: #fff; margin-bottom: 6px; }
.showcase-beats p { color: rgba(255, 255, 255, .78); margin-bottom: 0; }
.showcase-beats .beat { padding: 16px 0; border-top: 1px solid rgba(255, 255, 255, .12); }
.showcase-beats .beat:first-child { border-top: 0; padding-top: 0; }
.showcase-beats .beat .btn { margin-top: 14px; }
.showcase-progress {
  position: absolute;
  left: 6vw;
  right: 6vw;
  bottom: 24px;
  height: 3px;
  border-radius: 3px;
  background: rgba(10, 30, 16, .5);
  box-shadow: 0 1px 6px rgba(0, 0, 0, .2);
  opacity: 0;
  transition: opacity .4s ease;
}
.showcase-progress i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 2px;
  background: var(--yellow);
  transform: scaleX(0);
  transform-origin: 0 50%;
}
/* stato enhanced (JS attivo): pin sticky full-bleed + canvas scrub */
html { overflow-x: clip; }
.showcase.scrub-on {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  height: 260vh;
  margin-top: 18px;
  margin-bottom: 46px;
}
.scrub-on .showcase-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  border-radius: 0;
  box-shadow: none;
}
.scrub-on .showcase-poster { height: 100%; object-fit: cover; }
.scrub-on .showcase-scrim { opacity: 1; }
.scrub-on .showcase-progress { opacity: 1; }
.scrub-on .showcase-beats {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: none;
  padding: 0;
}
.scrub-on .showcase-beats .beat {
  position: absolute;
  left: 6vw;
  right: 6vw;
  bottom: 9vh;
  max-width: 560px;
  border: 0;
  padding: 0;
  margin: 0;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .5s ease, transform .5s cubic-bezier(.2, .7, .2, 1);
  pointer-events: none;
}
.scrub-on .showcase-beats .beat.on { opacity: 1; transform: none; pointer-events: auto; }
.scrub-on .showcase-beats .beat h3 { font-size: clamp(1.5rem, 3.2vw, 2.2rem); text-shadow: 0 2px 22px rgba(0, 0, 0, .45); }
.scrub-on .showcase-beats .beat p { font-size: clamp(.98rem, 1.6vw, 1.12rem); color: rgba(255, 255, 255, .88); text-shadow: 0 1px 14px rgba(0, 0, 0, .4); }
@media (max-width: 760px) {
  .showcase { margin: 34px 0; }
  .scrub-on .showcase-beats .beat { bottom: 8vh; }
}

/* ---------- 4. Split-text reveal (h2[data-split]) ---------- */
h2[data-split] .wd {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: .18em;
  margin-bottom: -.18em;
}
h2[data-split] .wd-i {
  display: inline-block;
  transform: translateY(125%);
  transition: transform .85s cubic-bezier(.19, .7, .22, 1);
  transition-delay: var(--d, 0ms);
  will-change: transform;
}
h2[data-split].split-in .wd-i { transform: translateY(0); }

/* ---------- 5. Magnetic buttons ---------- */
.magnetic { transition: transform .32s cubic-bezier(.2, .8, .25, 1); will-change: transform; }

/* ---------- 6. Rail orizzontale (mobile) per i prodotti in evidenza ---------- */
@media (max-width: 760px) {
  .featured .pcard-grid {
    display: flex;
    gap: 12px;
    margin: 18px -20px 30px;
    padding: 4px 20px 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .featured .pcard-grid::-webkit-scrollbar { display: none; }
  .featured .pcard-grid > .pcard { flex: 0 0 min(74vw, 252px); scroll-snap-align: start; }
}

/* ---------- 7. Morph card → pagina prodotto (cross-document view transition) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .product-main-img { view-transition-name: gm-morph; }
  ::view-transition-old(gm-morph), ::view-transition-new(gm-morph) { animation-duration: .45s; }
}
