/**
 * Teb Open — TEBKADEH CARE STUDIO hero (v2.0.03).
 *
 * Three-slide RTL brand experience. One design system across slides:
 * emerald podium photography + gold accents + editorial typography.
 * Light and dark are two separately art-directed surfaces (no inversion).
 *
 * Motion ownership: hero.js (GSAP). CSS transitions below are the graceful
 * no-JS / no-GSAP fallback; they are disabled when `.to-hero--gsap` is set
 * on the section so GSAP stays the single source of truth for motion.
 */

/* ---------- Section canvas ---------- */
.to-hero--studio {
        position: relative;
        isolation: isolate;
        overflow: hidden;
        padding-block: var(--to-space-6);
        border-bottom: 0;
        background:
                radial-gradient(1100px 480px at 88% -12%, var(--to-primary-soft) 0%, transparent 62%),
                radial-gradient(720px 320px at 6% 112%, var(--to-section-gold), transparent 70%),
                var(--to-bg);
}

/* House emerald→gold fading hairline (same recipe as header/footer seams). */
.to-hero--studio::after {
        content: '';
        position: absolute;
        inset-inline: 0;
        bottom: 0;
        height: 1px;
        background: linear-gradient(to left, var(--to-hairline-gold), var(--to-hairline-emerald) 28% 72%, var(--to-hairline-gold));
        opacity: 0.7;
        pointer-events: none;
        z-index: 1;
}

/* Dark art direction: deep, sophisticated, carefully illuminated —
 * never an inversion of the light surface. */
[data-theme='dark'] .to-hero--studio {
        background:
                radial-gradient(1100px 520px at 88% -14%, color-mix(in srgb, var(--to-primary) 11%, transparent) 0%, transparent 62%),
                radial-gradient(780px 360px at 4% 114%, color-mix(in srgb, var(--to-gold) 8%, transparent) 0%, transparent 70%),
                var(--to-bg);
}

@media (min-width: 1024px) {
        .to-hero--studio {
                padding-block: var(--to-space-7);
        }
}

/* ---------- Ambient background: restrained brand blobs ---------- */
.to-hero__bg {
        position: absolute;
        inset: 0;
        z-index: 0;
        pointer-events: none;
}

.to-hero__blob {
        position: absolute;
        border-radius: 50%;
        filter: blur(72px);
}

.to-hero__blob--a {
        width: 540px;
        height: 540px;
        top: -180px;
        inset-inline-start: -140px;
        background: color-mix(in srgb, var(--to-primary) 15%, transparent);
        animation: to-hero-drift 16s var(--to-ease) infinite alternate;
}

.to-hero__blob--b {
        width: 400px;
        height: 400px;
        bottom: -160px;
        inset-inline-end: -100px;
        background: color-mix(in srgb, var(--to-gold) 11%, transparent);
        animation: to-hero-drift 20s var(--to-ease) infinite alternate-reverse;
}

@keyframes to-hero-drift {
        from { transform: translate3d(0, 0, 0) scale(1); }
        to   { transform: translate3d(3%, 4%, 0) scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
        .to-hero__blob {
                animation: none;
        }
}

/* ---------- Layout grid (RTL-aware) ---------- */
.to-hero__inner {
        position: relative;
        z-index: 2;
        display: grid;
        grid-template-areas:
                'content art'
                'controls controls';
        grid-template-columns: minmax(0, 53fr) minmax(0, 47fr);
        gap: var(--to-space-6) var(--to-space-8);
        align-items: center;
}

.to-hero__slides {
        grid-area: content;
        display: grid;
        align-content: center;
        min-width: 0;
}

.to-hero__art {
        grid-area: art;
        position: relative;
        display: none;
        min-width: 0;
}

.to-hero__controls {
        grid-area: controls;
}

@media (min-width: 1024px) {
        .to-hero__art {
                /* Grid-stack: the three slide frames overlap in one cell so
                 * hidden frames can never stretch the column. */
                display: grid;
        }
}

/* ---------- Slides (grid-stack: no layout jumps) ---------- */
.to-hero-slide {
        grid-area: 1 / 1;
        min-width: 0;
        opacity: 0;
        visibility: hidden;
        transform: translateY(14px);
        pointer-events: none;
        transition:
                opacity 450ms var(--to-ease-out-soft),
                transform 450ms var(--to-ease-out-soft),
                visibility 0s linear 450ms;
}

.to-hero-slide.is-active {
        opacity: 1;
        visibility: visible;
        transform: none;
        pointer-events: auto;
        transition-delay: 0s;
}

/* GSAP owns all motion when available — kill the CSS fallback. */
.to-hero--gsap .to-hero-slide {
        transition: none;
}

/* During GSAP transitions the outgoing slide must stay paintable while
 * GSAP fades it out (its .is-active class is already gone). */
.to-hero--gsap .to-hero-slide.is-leaving {
        visibility: visible;
        pointer-events: none;
}

.to-hero--gsap .to-hero-slide-art.is-leaving {
        visibility: visible;
}

/* Swipe gesture: suppress text selection while dragging horizontally. */
.to-hero--studio.is-dragging {
        user-select: none;
        -webkit-user-select: none;
}

.to-hero--single .to-hero__nav,
.to-hero--single .to-hero__play {
        display: none;
}

@media (prefers-reduced-motion: reduce) {
        .to-hero-slide,
        .to-hero-slide-art {
                transition: none;
        }

        .to-hero__dot.is-filling .to-hero__dot-fill {
                animation: none;
        }
}

/* ---------- Typography hierarchy ---------- */
.to-hero__eyebrow {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        align-self: flex-start;
        padding: 6px 14px;
        border-radius: var(--to-radius-pill);
        background: var(--to-primary-soft);
        color: var(--to-primary-strong);
        font-size: var(--to-fs-s);
        font-weight: 700;
        margin: 0 0 var(--to-space-4);
        width: fit-content;
}

.to-hero__eyebrow .to-icon {
        width: 16px;
        height: 16px;
}

.to-hero__headline {
        margin: 0 0 var(--to-space-4);
        font-size: clamp(1.75rem, 1.15rem + 2.4vw, 2.875rem);
        font-weight: 800;
        line-height: 1.35;
        color: var(--to-text);
        max-width: 24ch;
}

.to-hero__desc {
        margin: 0 0 var(--to-space-5);
        font-size: var(--to-fs-l);
        line-height: 1.9;
        color: var(--to-text-2);
        max-width: 48ch;
}

.to-hero__cta {
        display: flex;
        flex-wrap: wrap;
        gap: var(--to-space-3);
}

/* ---------- Art column ---------- */
.to-hero__halo {
        position: absolute;
        width: 520px;
        height: 520px;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        border-radius: 50%;
        background: radial-gradient(circle, color-mix(in srgb, var(--to-primary) 20%, transparent) 0%, transparent 66%);
        filter: blur(46px);
        z-index: 0;
        animation: to-hero-halo 12s var(--to-ease) infinite alternate;
}

@keyframes to-hero-halo {
        from { opacity: 0.75; transform: translate(-50%, -50%) scale(0.98); }
        to   { opacity: 1; transform: translate(-49%, -51%) scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
        .to-hero__halo {
                animation: none;
        }
}

.to-hero__arc {
        position: absolute;
        width: 130%;
        aspect-ratio: 1;
        top: 50%;
        left: 50%;
        transform: translate(-52%, -54%);
        z-index: 0;
        opacity: 0.6;
        pointer-events: none;
}

/* Frames stack in the same grid cell; only the active one is visible. */
.to-hero-slide-art {
        grid-area: 1 / 1;
        position: relative;
        margin: 0;
        opacity: 0;
        visibility: hidden;
        transition: opacity 500ms var(--to-ease-out-soft), visibility 0s linear 500ms;
        z-index: 1;
}

.to-hero-slide-art.is-active {
        opacity: 1;
        visibility: visible;
}

.to-hero--gsap .to-hero-slide-art {
        transition: none;
}

.to-hero__picture,
.to-hero__img {
        display: block;
        width: 100%;
        height: 100%;
        border-radius: var(--to-radius-xl);
}

.to-hero__picture {
        aspect-ratio: 4 / 3;
        overflow: hidden;
        background: var(--to-surface-2);
        border: 1px solid color-mix(in oklab, var(--to-primary) 22%, var(--to-border));
        box-shadow: var(--to-shadow-3);
}

.to-hero__img {
        object-fit: cover;
        object-position: center;
}

/* In dark mode the frame sits deeper into the page surface with a
 * controlled highlight edge (dark art direction, not an inversion). */
[data-theme='dark'] .to-hero__picture {
        background: var(--to-surface);
        border-color: color-mix(in oklab, var(--to-primary) 26%, var(--to-border));
        box-shadow:
                0 20px 48px -16px rgba(0, 0, 0, 0.55),
                0 0 0 1px color-mix(in srgb, var(--to-primary) 8%, transparent) inset;
}

/* ---------- Controls bar ---------- */
.to-hero__controls {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--to-space-4);
        margin-top: var(--to-space-5);
        padding-top: var(--to-space-4);
        border-top: 1px solid var(--to-border);
}

.to-hero__nav {
        display: flex;
        align-items: center;
        gap: var(--to-space-2);
}

.to-hero__arrow {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: var(--to-radius-pill);
        border: 1px solid var(--to-border);
        background: var(--to-surface);
        color: var(--to-text-2);
        cursor: pointer;
        transition: background-color var(--to-dur-fast) var(--to-ease), color var(--to-dur-fast) var(--to-ease), border-color var(--to-dur-fast) var(--to-ease), transform var(--to-dur-fast) var(--to-ease);
}

.to-hero__arrow:hover {
        background: var(--to-primary-soft);
        border-color: color-mix(in oklab, var(--to-primary) 30%, var(--to-border));
        color: var(--to-primary-strong);
}

.to-hero__arrow:active {
        transform: scale(0.94);
}

.to-hero__arrow .to-icon {
        width: 20px;
        height: 20px;
}

.to-hero__dots {
        display: flex;
        align-items: center;
        gap: var(--to-space-1);
}

.to-hero__dot {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 44px;
        border: 0;
        background: transparent;
        cursor: pointer;
        padding: 0;
}

.to-hero__dot-track {
        position: relative;
        display: block;
        width: 28px;
        height: 4px;
        border-radius: var(--to-radius-pill);
        background: var(--to-border);
        overflow: hidden;
        transition: background-color var(--to-dur) var(--to-ease);
}

.to-hero__dot:hover .to-hero__dot-track {
        background: color-mix(in oklab, var(--to-primary) 30%, var(--to-border));
}

.to-hero__dot.is-active .to-hero__dot-track {
        background: color-mix(in oklab, var(--to-primary) 26%, var(--to-border));
}

.to-hero__dot-fill {
        position: absolute;
        inset: 0;
        border-radius: inherit;
        background: var(--to-primary-strong);
        transform: scaleX(0);
        transform-origin: 100% 50%; /* RTL: fills from the reading start */
}

.to-hero__dot.is-active:not(.is-filling) .to-hero__dot-fill {
        transform: scaleX(1);
}

/* No-GSAP autoplay fallback: CSS-driven progress. */
.to-hero__dot.is-filling .to-hero__dot-fill {
        animation: to-dot-fill linear forwards;
        animation-duration: var(--to-hero-interval, 7000ms);
}

@keyframes to-dot-fill {
        from { transform: scaleX(0); }
        to   { transform: scaleX(1); }
}

/* Play/pause */
.to-hero__play {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: var(--to-radius-pill);
        border: 1px solid var(--to-border);
        background: var(--to-surface);
        color: var(--to-text-2);
        cursor: pointer;
        transition: background-color var(--to-dur-fast) var(--to-ease), color var(--to-dur-fast) var(--to-ease), border-color var(--to-dur-fast) var(--to-ease);
}

.to-hero__play:hover {
        background: var(--to-primary-soft);
        border-color: color-mix(in oklab, var(--to-primary) 30%, var(--to-border));
        color: var(--to-primary-strong);
}

.to-hero__play-icon {
        position: absolute;
        inset: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        transform: scale(0.6);
        transition: opacity var(--to-dur-fast) var(--to-ease), transform var(--to-dur-fast) var(--to-ease);
}

.to-hero__play[aria-pressed='true'] .to-hero__play-icon--pause,
.to-hero__play[aria-pressed='false'] .to-hero__play-icon--play {
        opacity: 1;
        transform: scale(1);
}

/* Audience shortcuts: understated text links, never competing cards. */
.to-hero__aside {
        display: flex;
        align-items: center;
        gap: var(--to-space-4);
        min-width: 0;
}

.to-hero__audience {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--to-space-2) var(--to-space-4);
}

.to-hero__aud-link {
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 2px;
        min-height: 44px;
        font-size: var(--to-fs-s);
        font-weight: 600;
        color: var(--to-text-2);
        text-decoration: none;
        transition: color var(--to-dur-fast) var(--to-ease);
}

.to-hero__aud-link::after {
        content: '';
        position: absolute;
        inset-inline: 2px;
        bottom: 8px;
        height: 1.5px;
        background: var(--to-primary);
        transform: scaleX(0);
        transform-origin: 100% 50%;
        transition: transform var(--to-dur) var(--to-ease);
}

.to-hero__aud-link:hover,
.to-hero__aud-link:focus-visible {
        color: var(--to-primary-strong);
}

.to-hero__aud-link:hover::after,
.to-hero__aud-link:focus-visible::after {
        transform: scaleX(1);
}

/* ---------- Focus visibility ---------- */
.to-hero__arrow:focus-visible,
.to-hero__dot:focus-visible,
.to-hero__play:focus-visible {
        outline: none;
        box-shadow: var(--to-ring);
}

.to-hero__cta a:focus-visible {
        outline: none;
        box-shadow: var(--to-ring);
}

/* ---------- No-JS: keep the hero honest and usable ---------- */
/* Without JavaScript the first slide is fully visible and usable; the
 * slider controls (which need JS) are removed instead of lying there. */
html:not(.to-hero--js) .to-hero__controls {
        display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
        .to-hero__inner {
                grid-template-areas:
                        'content'
                        'art'
                        'controls';
                grid-template-columns: minmax(0, 1fr);
                gap: var(--to-space-5);
        }

        .to-hero__art {
                display: grid;
                max-width: 560px;
                width: 100%;
                margin-inline: auto;
        }

        .to-hero__headline {
                max-width: none;
        }

        .to-hero__desc {
                max-width: none;
        }
}

@media (max-width: 599px) {
        .to-hero--studio {
                padding-block: var(--to-space-5);
        }

        .to-hero__headline {
                font-size: clamp(1.625rem, 1.1rem + 2.6vw, 2rem);
        }

        .to-hero__cta {
                gap: var(--to-space-2);
        }

        .to-hero__cta .to-btn {
                flex: 1 1 auto;
                justify-content: center;
        }

        .to-hero__controls {
                flex-wrap: wrap;
                gap: var(--to-space-3);
        }

        .to-hero__aside {
                width: 100%;
                justify-content: space-between;
        }
}

@media (max-width: 380px) {
        .to-hero__eyebrow {
                font-size: var(--to-fs-xs);
                padding: 5px 12px;
        }

        .to-hero__desc {
                font-size: var(--to-fs-m);
        }
}
