/*
 * Cinematic Animation System
 * Premium, refined animations inspired by gallery/museum aesthetics
 * Slow, deliberate, elegant - never flashy
 */

/* ========================================
   CORE ANIMATION PRINCIPLES
   ======================================== */

:root {
    /* Cinematic timing - refined and minimal */
    --cinematic-fast: 500ms cubic-bezier(0.16, 1, 0.3, 1);
    --cinematic-medium: 800ms cubic-bezier(0.16, 1, 0.3, 1);
    --cinematic-slow: 1000ms cubic-bezier(0.16, 1, 0.3, 1);
    --cinematic-very-slow: 1200ms cubic-bezier(0.16, 1, 0.3, 1);

    /* Smooth ease for refined motion */
    --ease-refined: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-subtle: cubic-bezier(0.33, 1, 0.68, 1);
    --ease-elegant: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   PAGE LOAD SEQUENCE
   ======================================== */

/* Black curtain fade out */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 10000;
    pointer-events: none;
    animation: curtainRise 800ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes curtainRise {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Hero title character reveal */
.hero-title {
    overflow: hidden;
}

.hero-title-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(100%);
    animation: charReveal 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes charReveal {
    0% {
        opacity: 0;
        transform: translateY(100%) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Stagger character animations */
.hero-title-char:nth-child(1) { animation-delay: 300ms; }
.hero-title-char:nth-child(2) { animation-delay: 350ms; }
.hero-title-char:nth-child(3) { animation-delay: 400ms; }
.hero-title-char:nth-child(4) { animation-delay: 450ms; }
.hero-title-char:nth-child(5) { animation-delay: 500ms; }

/* Hero image subtle scale reveal */
.hero-background {
    opacity: 0;
    transform: scale(1.02);
    animation: heroImageReveal 1000ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 200ms;
}

@keyframes heroImageReveal {
    0% {
        opacity: 0;
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   SCROLL-TRIGGERED REVEALS
   ======================================== */

/* Base reveal state - hidden by default */
.cinematic-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--cinematic-slow),
                transform var(--cinematic-slow);
}

/* Revealed state */
.cinematic-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered children */
.cinematic-reveal-stagger > * {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity var(--cinematic-medium),
                transform var(--cinematic-medium);
}

.cinematic-reveal-stagger.revealed > *:nth-child(1) {
    animation: fadeUpSubtle 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0ms;
}
.cinematic-reveal-stagger.revealed > *:nth-child(2) {
    animation: fadeUpSubtle 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 100ms;
}
.cinematic-reveal-stagger.revealed > *:nth-child(3) {
    animation: fadeUpSubtle 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 200ms;
}
.cinematic-reveal-stagger.revealed > *:nth-child(4) {
    animation: fadeUpSubtle 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 300ms;
}

@keyframes fadeUpSubtle {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Image reveal with clip-path mask */
.cinematic-image-reveal {
    opacity: 0;
    clip-path: inset(0 0 100% 0);
    transition: opacity var(--cinematic-slow),
                clip-path var(--cinematic-slow);
}

.cinematic-image-reveal.revealed {
    opacity: 1;
    clip-path: inset(0 0 0% 0);
}

/* ========================================
   SUBTLE PARALLAX
   ======================================== */

.cinematic-parallax {
    transition: transform 1.5s ease;
    will-change: transform;
}

/* Applied via JS based on scroll position */
.cinematic-parallax-slow {
    /* Moves 20% of scroll distance */
}

.cinematic-parallax-medium {
    /* Moves 30% of scroll distance */
}

.cinematic-parallax-fast {
    /* Moves 50% of scroll distance */
}

/* ========================================
   SECTION TRANSITIONS
   ======================================== */

/* Smooth color transition between sections */
section {
    position: relative;
    transition: background-color var(--cinematic-very-slow);
}

/* Anticipatory fade for elements leaving viewport */
.cinematic-exit {
    transition: opacity var(--cinematic-medium),
                transform var(--cinematic-medium);
}

.cinematic-exit.exiting {
    opacity: 0.3;
    transform: scale(0.98);
}

/* ========================================
   REFINED HOVER STATES
   ======================================== */

/* Navigation links - elegant underline draw */
.cinematic-link {
    position: relative;
    transition: color 0.8s ease;
}

.cinematic-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.8s ease;
}

.cinematic-link:hover::after {
    transform: scaleX(1);
}

/* Subtle scale hover - maximum 1.02 */
.cinematic-hover-scale {
    transition: transform 0.8s ease,
                box-shadow 0.8s ease;
}

.cinematic-hover-scale:hover {
    transform: scale(1.02);
}

/* Image reveals on hover with overlay */
.cinematic-image-hover {
    position: relative;
    overflow: hidden;
}

.cinematic-image-hover img {
    transition: transform 1.2s ease;
}

.cinematic-image-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
    opacity: 0;
    transition: opacity 1s ease;
    z-index: 1;
}

.cinematic-image-hover:hover img {
    transform: scale(1.03);
}

.cinematic-image-hover:hover::before {
    opacity: 1;
}

/* Card hover - refined lift */
.cinematic-card {
    transition: transform 0.8s ease,
                box-shadow 0.8s ease;
}

.cinematic-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

/* ========================================
   TYPOGRAPHY ANIMATIONS
   ======================================== */

/* Headline reveal - fade up with slight delay */
.cinematic-headline {
    opacity: 0;
    transform: translateY(15px);
}

.cinematic-headline.revealed {
    animation: headlineReveal 700ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes headlineReveal {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Body text - fade in with slight delay after headline */
.cinematic-body-text {
    opacity: 0;
    transform: translateY(10px);
}

.cinematic-body-text.revealed {
    animation: bodyTextReveal 700ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 150ms;
}

@keyframes bodyTextReveal {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sophisticated link hover - underline grows smoothly */
.cinematic-text-link {
    position: relative;
    display: inline-block;
    color: inherit;
    text-decoration: none;
    transition: color 0.8s ease;
}

.cinematic-text-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, var(--golden-light), var(--color-secondary), var(--golden-light));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.8s ease;
    box-shadow: 0 0 4px rgba(212, 165, 44, 0.3);
}

.cinematic-text-link:hover {
    color: var(--golden-light);
    text-shadow: 0 0 6px rgba(232, 197, 90, 0.2);
}

.cinematic-text-link:hover::after {
    transform: scaleX(1);
}

/* ========================================
   BUTTON ANIMATIONS
   ======================================== */

/* Refined button hover - no bounce, just elegance */
.cinematic-button {
    position: relative;
    overflow: hidden;
    border: none;
    outline: none;
    border-radius: var(--radius-full);
    transition: transform 0.8s ease,
                box-shadow 0.8s ease,
                background-color 0.8s ease;
}

.cinematic-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.08),
        transparent
    );
    transition: left 1.5s ease;
}

.cinematic-button:hover {
    transform: translateY(-1px);
}

.cinematic-button:hover::before {
    left: 100%;
}

/* ========================================
   GALLERY/GRID ANIMATIONS
   ======================================== */

/* Album/image grid items fade up in sequence */
.cinematic-grid-item {
    opacity: 0;
    transform: translateY(15px);
}

.cinematic-grid-item.revealed {
    animation: gridItemReveal 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes gridItemReveal {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger delays for grid */
.cinematic-grid-item:nth-child(1) { animation-delay: 0ms; }
.cinematic-grid-item:nth-child(2) { animation-delay: 60ms; }
.cinematic-grid-item:nth-child(3) { animation-delay: 120ms; }
.cinematic-grid-item:nth-child(4) { animation-delay: 180ms; }
.cinematic-grid-item:nth-child(5) { animation-delay: 240ms; }
.cinematic-grid-item:nth-child(6) { animation-delay: 300ms; }
.cinematic-grid-item:nth-child(7) { animation-delay: 360ms; }
.cinematic-grid-item:nth-child(8) { animation-delay: 420ms; }

/* ========================================
   ACCENT ANIMATIONS (Subtle pink touches)
   ======================================== */

/* Subtle glow on focus elements */
.cinematic-glow-accent {
    position: relative;
}

.cinematic-glow-accent::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: radial-gradient(circle, var(--golden-light), var(--color-secondary));
    border-radius: inherit;
    opacity: 0;
    filter: blur(8px);
    z-index: -1;
    transition: opacity 0.8s ease;
}

.cinematic-glow-accent:hover::after,
.cinematic-glow-accent:focus::after {
    opacity: 0.2;
}

/* ========================================
   SCROLL PROGRESS INDICATOR
   ======================================== */

.cinematic-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 9999;
}

.cinematic-scroll-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--golden-rich), var(--golden-light), var(--color-secondary), var(--golden-light), var(--golden-rich));
    background-size: 200% auto;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1s ease;
    animation: goldShimmer 3s linear infinite;
}

@keyframes goldShimmer {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

/* ========================================
   LOADING STATES
   ======================================== */

/* Skeleton loading with elegant shimmer */
.cinematic-skeleton {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
    border-radius: 8px;
}

.cinematic-skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.06),
        transparent
    );
    animation: shimmer 1500ms ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* ========================================
   REDUCED MOTION SUPPORT
   ======================================== */

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

    .cinematic-parallax {
        transform: none !important;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Delays for orchestrated sequences */
.cinematic-delay-1 { animation-delay: 100ms; }
.cinematic-delay-2 { animation-delay: 200ms; }
.cinematic-delay-3 { animation-delay: 300ms; }
.cinematic-delay-4 { animation-delay: 400ms; }
.cinematic-delay-5 { animation-delay: 500ms; }

/* Visibility control */
.cinematic-hidden {
    opacity: 0;
    pointer-events: none;
}

.cinematic-visible {
    opacity: 1;
    pointer-events: auto;
}

/* Performance hints */
.cinematic-gpu {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}
