/* ============================================================
   PETX ENHANCE — layer di interattività di ultima generazione
   Brand: arancio #F9A82B · nero #1A1A1A · crema
   Caricato su tutte le pagine. Rispetta prefers-reduced-motion.
   ============================================================ */

/* ---------- 1. Barra di avanzamento scroll (brand orange) ---------- */
.px-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #F9A82B, #FFC55C);
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 0 8px rgba(249, 168, 43, 0.55);
    transition: width 0.08s linear;
}

/* ---------- 2. Reveal allo scroll ---------- */
.px-reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}
.px-reveal.px-in {
    opacity: 1;
    transform: translateY(0);
}
/* stagger automatico sui figli di una griglia rivelata */
.px-reveal.px-in[data-px-stagger] > * {
    animation: pxFadeUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.px-reveal.px-in[data-px-stagger] > *:nth-child(1) { animation-delay: 0.05s; }
.px-reveal.px-in[data-px-stagger] > *:nth-child(2) { animation-delay: 0.15s; }
.px-reveal.px-in[data-px-stagger] > *:nth-child(3) { animation-delay: 0.25s; }
.px-reveal.px-in[data-px-stagger] > *:nth-child(4) { animation-delay: 0.35s; }
.px-reveal.px-in[data-px-stagger] > *:nth-child(5) { animation-delay: 0.45s; }
.px-reveal.px-in[data-px-stagger] > *:nth-child(6) { animation-delay: 0.55s; }
@keyframes pxFadeUp {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 3. Tilt 3D sulle card (solo puntatori fini / desktop) ---------- */
@media (hover: hover) and (pointer: fine) {
    .px-tilt {
        transform-style: preserve-3d;
        transition: transform 0.25s ease, box-shadow 0.25s ease;
    }
    .px-tilt:hover {
        box-shadow: 0 24px 48px rgba(26, 26, 26, 0.10);
    }
}

/* ---------- 4. Torna su (zampetta) ---------- */
.px-top {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    width: 52px;
    height: 52px;
    border-radius: 9999px;
    background: #1A1A1A;
    color: #F9A82B;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    cursor: pointer;
    border: 2px solid #F9A82B;
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.9);
    transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.px-top.px-show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
.px-top:hover { transform: translateY(-3px) scale(1.05); }
.px-top:focus-visible { outline: 3px solid #F9A82B; outline-offset: 3px; }
.px-top svg { width: 26px; height: 26px; }

/* ---------- 5. Header compatto allo scroll ---------- */
header.px-shrunk nav {
    padding-top: 0.65rem !important;
    padding-bottom: 0.65rem !important;
    transition: padding 0.3s ease;
}
header nav { transition: padding 0.3s ease; }
header.px-shrunk { box-shadow: 0 6px 24px rgba(0, 0, 0, 0.07); }

/* ---------- 6. Micro-interazione bottoni / link CTA ---------- */
@media (hover: hover) {
    a[class*="bg-petx-orange"], button[class*="bg-petx-orange"] {
        transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    }
    a[class*="bg-petx-orange"]:hover, button[class*="bg-petx-orange"]:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 24px rgba(249, 168, 43, 0.40);
        filter: brightness(1.04);
    }
    a[class*="bg-petx-orange"]:active, button[class*="bg-petx-orange"]:active {
        transform: translateY(0);
    }
}

/* ---------- 7. Contatore animato ---------- */
.px-counter { font-variant-numeric: tabular-nums; }

/* ---------- Accessibilità: niente animazioni se l'utente le disattiva ---------- */
@media (prefers-reduced-motion: reduce) {
    .px-reveal { opacity: 1; transform: none; transition: none; }
    .px-reveal.px-in[data-px-stagger] > * { animation: none; }
    .px-progress { transition: none; }
    .px-top { transition: opacity 0.2s; transform: none; }
    @media (hover: hover) and (pointer: fine) {
        .px-tilt, .px-tilt:hover { transform: none !important; }
    }
}

/* ============================================================
   PETX ENHANCE v2 — super interattività
   ============================================================ */

/* ---------- 8. Shimmer animato sulle parole accent (PET, ecc.) ---------- */
h1 .text-petx-accent, h2 .text-petx-accent {
    background: linear-gradient(110deg, #F9A82B 0%, #FFD584 45%, #F9A82B 60%, #E8941A 100%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: pxShimmer 4.5s ease-in-out infinite;
}
@keyframes pxShimmer {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

/* ---------- 9. Marquee brand a scorrimento infinito ---------- */
.px-marquee {
    background: #1A1A1A;
    overflow: hidden;
    padding: 1.1rem 0;
    border-top: 1px solid rgba(249,168,43,0.25);
    border-bottom: 1px solid rgba(249,168,43,0.25);
    position: relative;
}
.px-marquee-track {
    display: flex;
    width: max-content;
    animation: pxMarquee 28s linear infinite;
}
.px-marquee:hover .px-marquee-track { animation-play-state: paused; }
.px-marquee-item {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #F9A82B;
    white-space: nowrap;
    padding: 0 1.6rem;
    display: flex;
    align-items: center;
    gap: 1.6rem;
}
.px-marquee-item::after { content: '🐾'; font-size: 0.85rem; }
@keyframes pxMarquee {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* ---------- 10. Glare (riflesso) sulle card tilt ---------- */
.px-glare {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(420px circle at var(--px-mx, 50%) var(--px-my, 50%),
                rgba(255, 215, 140, 0.22), transparent 65%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}
.px-tilt { position: relative; }
.px-tilt:hover .px-glare { opacity: 1; }

/* ---------- 11. Zoom morbido sulle immagini delle card ---------- */
@media (hover: hover) {
    .soft-card img, article img, a[href*="blog"] img {
        transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .soft-card:hover img, article:hover img, a[href*="blog"]:hover img {
        transform: scale(1.045);
    }
}

/* ---------- 12. Zampetta al click (burst decorativo) ---------- */
.px-paw-burst {
    position: fixed;
    width: 30px;
    height: 30px;
    pointer-events: none;
    z-index: 9998;
    color: #F9A82B;
    animation: pxPawPop 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes pxPawPop {
    0%   { transform: translate(-50%, -50%) scale(0.3) rotate(-12deg); opacity: 0.95; }
    60%  { transform: translate(-50%, -58%) scale(1.05) rotate(6deg); opacity: 0.85; }
    100% { transform: translate(-50%, -90%) scale(0.85) rotate(14deg); opacity: 0; }
}

/* ---------- 13. Sezione numeri PETX ---------- */
.px-stats {
    background: #1A1A1A;
    position: relative;
    overflow: hidden;
}
.px-stats::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(700px circle at 15% 0%, rgba(249,168,43,0.10), transparent 55%),
                radial-gradient(700px circle at 85% 100%, rgba(249,168,43,0.08), transparent 55%);
    pointer-events: none;
}
.px-stat-num {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: clamp(2.6rem, 6vw, 4rem);
    color: #F9A82B;
    line-height: 1;
}
.px-stat-label {
    color: rgba(255,255,255,0.78);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-top: 0.7rem;
}

/* ---------- 14. Divider animato (anima le .divider-line esistenti) ---------- */
.divider-line {
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.2s;
}
.divider-line.px-grow { transform: scaleX(1); }
/* gradiente brand sul divider */
.divider-line {
    background: linear-gradient(90deg, #F9A82B, #1A1A1A) !important;
}

/* ---------- Reduced motion v2 ---------- */
@media (prefers-reduced-motion: reduce) {
    h1 .text-petx-accent, h2 .text-petx-accent { animation: none; }
    .px-marquee-track { animation: none; flex-wrap: wrap; }
    .px-paw-burst { display: none; }
    .divider-line { transform: scaleX(1); transition: none; }
    .soft-card:hover img, article:hover img { transform: none; }
}

/* ===== FIX MENU MOBILE IN LANDSCAPE (iPhone orizzontale) =====
   Il menu a tendina ora scorre verticalmente quando il contenuto
   supera l'altezza dello schermo (es. iPhone in orizzontale),
   rendendo raggiungibili Contatti, FAQ e Blog. */
#mobile-menu {
    max-height: calc(100vh - 81px);   /* fallback: altezza viewport meno header */
    max-height: calc(100dvh - 81px);  /* dvh = gestisce correttamente la barra di Safari iOS */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* scroll fluido su iOS */
    overscroll-behavior: contain;      /* evita che lo scroll "trascini" la pagina sotto */
}
