/* =========================================================
   SAMC BARBERS — Effects: intro, reveals, press feedback, ambience
   Everything that hides content is gated behind html.js so the
   page stays fully usable if JavaScript fails to load.
   ========================================================= */

/* ---------- Keyframes ---------- */
@keyframes faqOpen { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes zoomIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
/* ---------- Ambient background ----------
   Static soft gradients (no filter, no animation): painted once and then just
   composited, so the glass elements above never have to re-blur a moving backdrop. */
.ambient {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
}

.orb--1 {
    width: 70vw; height: 70vw;
    top: 20vh; left: -30vw;
    background: radial-gradient(circle, rgba(var(--gold-rgb), 0.06), transparent 65%);
}

.orb--2 {
    width: 60vw; height: 60vw;
    top: 45vh; right: -28vw;
    background: radial-gradient(circle, rgba(var(--gold-rgb), 0.045), transparent 65%);
}

.orb--3 {
    width: 50vw; height: 50vw;
    bottom: -25vh; left: 25vw;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.03), transparent 65%);
}

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 1001;
    pointer-events: none;
}

.scroll-progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold-light));
    transform-origin: left;
    transform: scaleX(var(--progress, 0));
    transition: transform 0.25s linear;
}

/* ---------- Scroll reveal ---------- */
/* Only compositor properties are animated. Items rise into place on a spring,
   growing slightly like an iOS card. This selector outranks each component's own
   transition, so it also carries their hover (transform), press (scale) and
   border/shadow transitions; the stagger delay applies to the entrance only. */
.js [data-reveal] {
    --reveal-delay: calc(var(--d, 0) * 0.08s);
    opacity: 0;
    translate: 0 36px;
    scale: 0.96;
    transition:
        opacity 0.8s var(--ease-out),
        translate 1s var(--spring),
        scale 1s var(--spring),
        transform 0.6s var(--spring),
        border-color 0.4s,
        box-shadow 0.5s var(--ease-out);
    transition-delay: var(--reveal-delay), var(--reveal-delay), var(--reveal-delay), 0s, 0s, 0s;
}

.js [data-reveal="left"] { translate: -44px 0; }

.js [data-reveal].is-visible { opacity: 1; translate: 0 0; scale: 1; }

/* Once the entrance has played, press feedback must react instantly */
.js [data-reveal].is-revealed {
    transition:
        opacity 0.8s var(--ease-out),
        translate 1s var(--spring),
        scale 0.45s var(--spring-bouncy),
        transform 0.6s var(--spring),
        border-color 0.4s,
        box-shadow 0.5s var(--ease-out);
}

/* =========================================================
   iOS PRESS FEEDBACK — everything tappable sinks a little and
   springs back on release. Uses the standalone `scale` property
   so it composes with the inline transforms set by tilt/magnetic.
   ========================================================= */
a, button, summary, [role="button"], [tabindex="0"] { -webkit-tap-highlight-color: transparent; }

:is(.btn, .socials a, .whatsapp-fixed, .scroll-top-btn, .close-modal, .slider-btn,
    .sound-toggle, .language-switcher button, .main-nav a, .extra-option):active { scale: 0.95; }

.play-overlay:active { scale: 0.9; }

:is(.service-card, .perk, .testimonial-card):active { scale: 0.98; }

.faq-item summary { transition: scale 0.45s var(--spring-bouncy); }
.faq-item summary:active { scale: 0.985; }

/* ---------- Hero entrance (after intro) ---------- */
.js [data-hero] {
    opacity: 0;
    translate: 0 30px;
}

.js body.is-ready [data-hero] {
    opacity: 1;
    translate: 0 0;
    transition:
        opacity 1.1s var(--ease-out),
        translate 1.2s var(--spring);
    transition-delay: calc(0.15s + var(--d, 0) * 0.12s);
}

.js .hero__title[data-hero] { clip-path: inset(0 0 100% 0); }
.js body.is-ready .hero__title[data-hero] {
    clip-path: inset(0 0 -10% 0);
    transition:
        opacity 1.1s var(--ease-out),
        translate 1.2s var(--ease-out),
        clip-path 1.4s var(--ease-ios);
    transition-delay: 0.27s;
}

/* =========================================================
   INTRO — a brief launch moment (~1s), like an iOS app opening:
   the crown draws, the wordmark rises, then everything fades away.
   ========================================================= */
.intro { display: none; }

.js .intro {
    display: grid;
    place-items: center;
    position: fixed;
    inset: 0;
    z-index: 20000;
    background: var(--dark);
    animation: introOut 0.45s var(--ease-out) 0.85s forwards;
}

.js body.is-loading { overflow: hidden; }

@keyframes introOut { to { opacity: 0; visibility: hidden; } }

.intro__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    animation: introZoom 0.45s var(--ease-out) 0.85s forwards;
}

@keyframes introZoom { to { transform: scale(1.06); } }

.intro__crown {
    width: 64px;
    margin-bottom: 12px;
    overflow: visible;
}

.intro__crown path,
.intro__crown circle {
    stroke: var(--gold);
    stroke-width: 2.4;
    stroke-linejoin: round;
    stroke-linecap: round;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: drawStroke 0.6s var(--ease-out) forwards;
}

.intro__crown circle { fill: var(--gold); fill-opacity: 0; animation: drawStroke 0.6s var(--ease-out) forwards, fillIn 0.3s 0.4s forwards; }

@keyframes drawStroke { to { stroke-dashoffset: 0; } }
@keyframes fillIn { to { fill-opacity: 1; } }

.intro__word {
    display: flex;
    gap: 0.04em;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(3rem, 12vw, 5.5rem);
    line-height: 1;
    letter-spacing: -0.02em;
    overflow: hidden;
    padding: 0 0.1em;
    color: var(--white);
}

.intro__word span {
    display: inline-block;
    transform: translateY(110%);
    animation: letterUp 0.6s var(--spring) forwards;
}

.intro__word span:nth-child(1) { animation-delay: 0.1s; }
.intro__word span:nth-child(2) { animation-delay: 0.14s; }
.intro__word span:nth-child(3) { animation-delay: 0.18s; }
.intro__word span:nth-child(4) { animation-delay: 0.22s; }

@keyframes letterUp { to { transform: translateY(0); } }

.intro__sub {
    font-family: var(--font-body);
    font-size: clamp(0.62rem, 2vw, 0.74rem);
    font-weight: 500;
    color: var(--gray-text);
    letter-spacing: 0.4em;
    opacity: 0;
    animation: subIn 0.4s var(--ease-out) 0.35s forwards;
}

@keyframes subIn { to { opacity: 1; } }

/* =========================================================
   SCROLL-DRIVEN HERO — like apple.com product pages: the photo
   drifts and dims while the headline lifts away. Native scroll
   timelines run on the compositor; unsupported browsers skip it.
   ========================================================= */
@supports (animation-timeline: scroll()) {
    @media (prefers-reduced-motion: no-preference) {
        .hero__bg {
            animation: heroBgScroll linear both;
            animation-timeline: scroll(root);
            animation-range: 0 100vh;
        }

        .hero__content {
            animation: heroContentScroll linear both;
            animation-timeline: scroll(root);
            animation-range: 0 75vh;
        }
    }
}

@keyframes heroBgScroll { to { translate: 0 22%; opacity: 0.35; } }
@keyframes heroContentScroll { to { translate: 0 -70px; scale: 0.96; opacity: 0; } }

/* =========================================================
   REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .js .intro { display: none; }
    .js [data-reveal], .js [data-hero] { opacity: 1; translate: none; scale: none; clip-path: none; }
}
