/**
 * SkiBum motion & visual polish — unified easing, reveals, surfaces.
 */

:root {
    --skibum-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --skibum-ease-luxe: cubic-bezier(0.19, 1, 0.22, 1);
    --skibum-ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
    --skibum-ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --skibum-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
    --skibum-shadow-md: 0 8px 28px rgba(15, 23, 42, 0.08);
    --skibum-shadow-lg: 0 16px 48px rgba(79, 117, 155, 0.12);
    --skibum-shadow-glow: 0 0 0 1px rgba(79, 117, 155, 0.08), 0 12px 40px rgba(79, 117, 155, 0.14);
    --skibum-surface: rgba(255, 255, 255, 0.94);
}

/* ——— Page transitions ——— */
@keyframes skibumPageEnter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#app > div[id$="-page"]:not(.hidden).skibum-page-enter {
    animation: skibumPageEnter 0.5s var(--skibum-ease-luxe, var(--skibum-ease-out)) both;
}

@keyframes skibumModalEnter {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

[id$="-modal"]:not(.hidden) .modal-panel,
[id$="-modal"]:not(.hidden) .card-bordered {
    animation: skibumModalEnter 0.38s var(--skibum-ease-out) both;
}

/* ——— Scroll reveals (override inline block with smoother motion) ——— */
.reveal-on-scroll .reveal-item {
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.7s var(--skibum-ease-out),
        transform 0.7s var(--skibum-ease-out);
}

.reveal-on-scroll.is-visible .reveal-item {
    opacity: 1;
    transform: translateY(0);
}

.reveal-on-scroll.is-visible .reveal-item.delay-1 { transition-delay: 0.05s; }
.reveal-on-scroll.is-visible .reveal-item.delay-2 { transition-delay: 0.1s; }
.reveal-on-scroll.is-visible .reveal-item.delay-3 { transition-delay: 0.15s; }
.reveal-on-scroll.is-visible .reveal-item.delay-4 { transition-delay: 0.2s; }
.reveal-on-scroll.is-visible .reveal-item.delay-5 { transition-delay: 0.25s; }
.reveal-on-scroll.is-visible .reveal-item.delay-6 { transition-delay: 0.3s; }

#features.features-showcase.is-visible .feature-block-compact:nth-child(1) { transition-delay: 0.05s; }
#features.features-showcase.is-visible .feature-block-compact:nth-child(2) { transition-delay: 0.12s; }
#features.features-showcase.is-visible .feature-block-compact:nth-child(3) { transition-delay: 0.19s; }
#features.features-showcase.is-visible .feature-block-compact:nth-child(4) { transition-delay: 0.26s; }

/* Hero load */
@keyframes skibumHeroIn {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

#hero .reveal-item,
#hero h1,
#hero .hero-search-wrap {
    animation: skibumHeroIn 0.85s var(--skibum-ease-out) both;
}

#hero .reveal-item.delay-1 { animation-delay: 0.08s; }
#hero .reveal-item.delay-2 { animation-delay: 0.16s; }
#hero .hero-search-wrap { animation-delay: 0.22s; }

#hero .absolute.inset-0 img {
    animation: skibumHeroKen 24s ease-in-out infinite alternate;
    transform-origin: center center;
}

@keyframes skibumHeroKen {
    from { transform: scale(1); }
    to { transform: scale(1.04); }
}

/* ——— Premium surfaces ——— */
.content-card-pro,
.skibum-card,
.stat-card-pro {
    background: var(--skibum-surface);
    border: 1px solid rgba(229, 231, 235, 0.85);
    border-radius: var(--skibum-radius-xl, 1.25rem);
    box-shadow: var(--skibum-shadow-sm);
    transition:
        box-shadow 0.35s var(--skibum-ease-smooth),
        border-color 0.3s ease,
        transform 0.35s var(--skibum-ease-out);
}

.section-title-pro {
    font-family: var(--skibum-font-display);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

/* Hero search */
.hero-search-wrap {
    border-radius: 1.25rem !important;
    box-shadow: var(--skibum-shadow-md);
    transition:
        transform 0.35s var(--skibum-ease-out),
        box-shadow 0.35s var(--skibum-ease-out),
        border-color 0.25s ease !important;
}

.hero-search-wrap:focus-within {
    transform: translateY(-2px);
    box-shadow: var(--skibum-shadow-glow);
}

.hero-search-wrap input {
    transition: color 0.2s ease;
}

/* Browse / map carousel */
.browse-resorts-track,
.map-carousel-track {
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 1rem;
    -webkit-overflow-scrolling: touch;
}

.resort-browse-card,
.map-carousel-run-card,
#resort-carousel.map-carousel-track .resort-browse-card {
    scroll-snap-align: start;
}

.resort-browse-card-btn,
.resort-browse-card .resort-browse-card-btn {
    border-radius: 1rem;
    overflow: hidden;
    transition:
        transform 0.32s var(--skibum-ease-out),
        box-shadow 0.32s ease;
}

@media (hover: hover) {
    .resort-browse-card-btn:hover,
    .resort-browse-card:hover .resort-browse-card-btn {
        transform: translateY(-4px);
        box-shadow: var(--skibum-shadow-lg);
    }
}

.resort-card-media {
    transition: transform 0.5s var(--skibum-ease-out);
}

@media (hover: hover) {
    .resort-browse-card:hover .resort-card-media img {
        transform: scale(1.04);
    }
    .resort-card-media img {
        transition: transform 0.55s var(--skibum-ease-out);
    }
}

/* App screen phone mockups (marketing) */
.app-phone-mockup {
    position: relative;
    width: 100%;
    max-width: 220px;
    margin: 0 auto;
    aspect-ratio: 9 / 19;
    border-radius: 1.75rem;
    padding: 0.5rem;
    background: linear-gradient(145deg, #1e293b, #334155);
    box-shadow:
        0 20px 50px rgba(15, 23, 42, 0.18),
        inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.app-phone-notch {
    position: absolute;
    top: 0.65rem;
    left: 50%;
    transform: translateX(-50%);
    width: 28%;
    height: 0.35rem;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.85);
    z-index: 2;
}
.app-phone-screen {
    height: 100%;
    border-radius: 1.35rem;
    overflow: hidden;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    font-family: var(--skibum-font-body, Inter, system-ui, sans-serif);
    font-size: 0.65rem;
}
.app-phone-header {
    padding: 1.6rem 0.75rem 0.5rem;
    font-weight: 700;
    font-size: 0.8rem;
    color: #0f172a;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}
.app-phone-body {
    flex: 1;
    padding: 0.5rem 0.65rem 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.app-phone-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.45rem;
    border-radius: 9999px;
    font-size: 0.55rem;
    font-weight: 600;
    background: rgba(79, 117, 155, 0.12);
    color: #334155;
    width: fit-content;
}
.app-phone-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.45rem;
    background: #fff;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}
.app-phone-row-icon {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    flex-shrink: 0;
}
.app-phone-row-title {
    font-weight: 600;
    color: #111827;
    line-height: 1.2;
}
.app-phone-row-sub {
    color: #6b7280;
    font-size: 0.52rem;
}
.app-phone-map {
    flex: 1;
    min-height: 4.5rem;
    border-radius: 0.5rem;
    background:
        linear-gradient(180deg, rgba(125, 175, 230, 0.35), rgba(241, 245, 249, 0.9)),
        repeating-linear-gradient(90deg, transparent, transparent 8px, rgba(79, 117, 155, 0.06) 8px, rgba(79, 117, 155, 0.06) 9px);
    position: relative;
    border: 1px solid #e2e8f0;
}
.app-phone-map-dot {
    position: absolute;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: #4f759b;
    box-shadow: 0 0 0 2px #fff;
}
.app-phone-stat {
    display: flex;
    justify-content: space-between;
    gap: 0.35rem;
}
.app-phone-stat-pill {
    flex: 1;
    text-align: center;
    padding: 0.35rem 0.2rem;
    background: #fff;
    border-radius: 0.45rem;
    border: 1px solid #e2e8f0;
}
.app-phone-stat-val {
    font-weight: 700;
    color: #4f759b;
    font-size: 0.7rem;
}
.app-phone-stat-lbl {
    color: #6b7280;
    font-size: 0.48rem;
}
.app-phone-mockup--map .app-phone-screen { background: #eef2f7; }
.app-phone-mockup--profile .app-phone-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f759b, #1e3a5f);
    margin: 0 auto 0.35rem;
}
.app-phone-badge-row {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
    flex-wrap: wrap;
}
.app-phone-badge {
    font-size: 0.48rem;
    padding: 0.15rem 0.35rem;
    border-radius: 9999px;
    background: rgba(224, 159, 62, 0.15);
    color: #92400e;
    font-weight: 600;
}

@media (min-width: 1024px) {
    .app-phone-mockup { max-width: 240px; }
}

/* Feature showcase frames */
.feature-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 10rem;
    max-height: 11.25rem;
    border-radius: 0.875rem;
    margin: 0 auto;
    width: 100%;
    font-size: 3.25rem;
    color: rgba(79, 117, 155, 0.55);
    background: linear-gradient(145deg, rgba(79, 117, 155, 0.08) 0%, rgba(26, 40, 31, 0.06) 100%);
    border: 1px dashed rgba(79, 117, 155, 0.18);
}
.feature-visual--map { color: rgba(79, 117, 155, 0.65); }
.feature-visual--reviews { color: rgba(224, 159, 62, 0.75); background: linear-gradient(145deg, rgba(224, 159, 62, 0.1) 0%, rgba(79, 117, 155, 0.06) 100%); }
.feature-visual--social { color: rgba(124, 58, 237, 0.55); background: linear-gradient(145deg, rgba(124, 58, 237, 0.08) 0%, rgba(79, 117, 155, 0.05) 100%); }
.feature-visual--ratings { color: rgba(5, 150, 105, 0.65); background: linear-gradient(145deg, rgba(5, 150, 105, 0.1) 0%, rgba(79, 117, 155, 0.06) 100%); }

.feature-block-compact .bg-gray-50\/60 {
    border-radius: 1.25rem;
    transition: box-shadow 0.35s ease, border-color 0.3s ease;
}

@media (hover: hover) {
    .feature-block-compact:hover .bg-gray-50\/60 {
        box-shadow: var(--skibum-shadow-md);
        border-color: rgba(79, 117, 155, 0.2) !important;
    }
}

.feature-block-compact .w-12,
.feature-block-compact .w-16 {
    transition: transform 0.4s var(--skibum-ease-spring), background 0.3s ease;
}

@media (hover: hover) {
    .feature-block-compact:hover .w-12,
    .feature-block-compact:hover .w-16 {
        transform: scale(1.06) translateY(-2px);
    }
}

/* Stats band */
#stats [id^="stat-"] {
    transition:
        transform 0.4s var(--skibum-ease-out),
        box-shadow 0.4s ease,
        background 0.3s ease,
        border-color 0.3s ease;
}

@media (hover: hover) {
    #stats [id^="stat-"]:hover {
        transform: translateY(-3px);
        box-shadow: 0 12px 36px rgba(0, 0, 0, 0.15);
    }
}

/* Map filter sheet */
#map-page .map-filters-panel {
    transition: transform 0.38s var(--skibum-ease-out);
}

#map-page .map-filters-overlay {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#map-page .map-filters-overlay:not(.hidden) {
    animation: skibumOverlayIn 0.3s ease both;
}

@keyframes skibumOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Run detail bottom bar */
.run-detail-bottom-bar {
    transition: box-shadow 0.3s ease, transform 0.35s var(--skibum-ease-out);
}

.run-detail-hero {
    transition: box-shadow 0.35s ease;
}

/* Inputs */
.search-input-pro,
input[type="search"],
input[type="text"]:not([type="checkbox"]) {
    transition:
        border-color 0.2s ease,
        box-shadow 0.25s ease,
        background 0.2s ease;
}

.search-input-pro:focus,
input:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 117, 155, 0.18);
}

/* Chips */
.map-pass-chip,
.map-descriptor-chip,
.explore-descriptor-chip,
.review-chip-filter {
    transition:
        background 0.22s ease,
        border-color 0.22s ease,
        color 0.22s ease,
        transform 0.2s var(--skibum-ease-out);
}

@media (hover: hover) {
    .map-pass-chip:hover,
    .map-descriptor-chip:hover,
    .explore-descriptor-chip:hover {
        transform: translateY(-1px);
    }
}

.map-descriptor-chip.descriptor-selected,
.explore-descriptor-chip.descriptor-selected {
    transform: scale(1.02);
}

/* Toast entrance */
@keyframes skibumToastIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.toast-container .toast {
    animation: skibumToastIn 0.4s var(--skibum-ease-out) both;
}

/* Focus rings — accessibility + polish */
a:focus-visible,
button:focus-visible,
.site-nav-link:focus-visible {
    outline: 2px solid var(--skibum-blue);
    outline-offset: 2px;
}

/* Stagger grids (JS adds .is-visible) */
.stagger-children:not(.is-visible) > * {
    opacity: 0;
    transform: translateY(16px);
}

.stagger-children.is-visible > * {
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 0.55s var(--skibum-ease-out),
        transform 0.55s var(--skibum-ease-out);
}

.stagger-children.is-visible > *:nth-child(1) { transition-delay: 0.04s; }
.stagger-children.is-visible > *:nth-child(2) { transition-delay: 0.08s; }
.stagger-children.is-visible > *:nth-child(3) { transition-delay: 0.12s; }
.stagger-children.is-visible > *:nth-child(4) { transition-delay: 0.16s; }
.stagger-children.is-visible > *:nth-child(5) { transition-delay: 0.2s; }
.stagger-children.is-visible > *:nth-child(6) { transition-delay: 0.24s; }

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

    #hero .absolute.inset-0 img {
        animation: none;
    }

    .reveal-on-scroll .reveal-item,
    .feature-block-compact {
        opacity: 1;
        transform: none;
    }
}
