/* ==========================================================================
   STUDIO CASTELLIN - ANIMATIONS STYLESHEET
   Scroll Animations, Transitions & Micro-interactions
   ========================================================================== */

/* Keyframe Animations
   ========================================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0) translateX(-50%);
    }

    40% {
        transform: translateY(-20px) translateX(-50%);
    }

    60% {
        transform: translateY(-10px) translateX(-50%);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(212, 175, 55, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes drawLine {
    from {
        stroke-dashoffset: 1000;
    }

    to {
        stroke-dashoffset: 0;
    }
}

/* Fade In on Scroll
   ========================================================================== */
.fade-in {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger Delays for Multiple Elements */
.fade-in:nth-child(1) {
    transition-delay: 0s;
}

.fade-in:nth-child(2) {
    transition-delay: 0.1s;
}

.fade-in:nth-child(3) {
    transition-delay: 0.2s;
}

.fade-in:nth-child(4) {
    transition-delay: 0.3s;
}

.fade-in:nth-child(5) {
    transition-delay: 0.4s;
}

.fade-in:nth-child(6) {
    transition-delay: 0.5s;
}

.fade-in:nth-child(7) {
    transition-delay: 0.6s;
}

.fade-in:nth-child(8) {
    transition-delay: 0.7s;
}

/* Parallax Effect
   ========================================================================== */
.parallax {
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Hero Parallax */
.hero-background img {
    transform: scale(1.1);
    transition: transform 30s ease-out;
}

.hero:hover .hero-background img {
    transform: scale(1.15);
}

/* Hover Transitions
   ========================================================================== */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.hover-scale {
    transition: transform var(--transition-base);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.3);
}

/* Button Animations
   ========================================================================== */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

/* Loading States
   ========================================================================== */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}

/* Skeleton Loading
   ========================================================================== */
.skeleton {
    background: linear-gradient(90deg,
            var(--color-bg-secondary) 0%,
            var(--color-bg-tertiary) 50%,
            var(--color-bg-secondary) 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    border-radius: var(--radius-md);
}

/* Text Reveal Animation
   ========================================================================== */
.text-reveal {
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    opacity: 0;
    transform: translateY(100%);
    animation: fadeInUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.text-reveal span:nth-child(1) {
    animation-delay: 0.1s;
}

.text-reveal span:nth-child(2) {
    animation-delay: 0.2s;
}

.text-reveal span:nth-child(3) {
    animation-delay: 0.3s;
}

.text-reveal span:nth-child(4) {
    animation-delay: 0.4s;
}

.text-reveal span:nth-child(5) {
    animation-delay: 0.5s;
}

/* Line Drawing Animation
   ========================================================================== */
.draw-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.draw-line.animate {
    animation: drawLine 2s ease-out forwards;
}

/* Modal Animations
   ========================================================================== */
.modal {
    animation: fadeIn 0.3s ease-out;
}

.modal-backdrop {
    animation: fadeIn 0.3s ease-out;
}

/* Page Transition
   ========================================================================== */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-bg);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

.page-transition.active {
    opacity: 1;
}

/* Scroll Progress Bar
   ========================================================================== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--color-accent) 0%, var(--color-burgundy) 100%);
    z-index: var(--z-fixed);
    transition: width 0.1s linear;
}

/* Image Zoom on Hover
   ========================================================================== */
.image-zoom-container {
    overflow: hidden;
    border-radius: var(--radius-lg);
}

.image-zoom {
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.image-zoom-container:hover .image-zoom {
    transform: scale(1.1);
}

/* Gradient Border Animation
   ========================================================================== */
.gradient-border {
    position: relative;
    border-radius: var(--radius-lg);
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(45deg,
            var(--color-accent),
            var(--color-burgundy),
            var(--color-accent));
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.gradient-border:hover::before {
    opacity: 1;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Counter Animation
   ========================================================================== */
.counter {
    font-variant-numeric: tabular-nums;
}

/* Card Flip Animation
   ========================================================================== */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* Ripple Effect
   ========================================================================== */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Typewriter Effect
   ========================================================================== */
.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--color-accent);
    white-space: nowrap;
    animation: typing 3s steps(40) 1s forwards, blink 0.75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink {

    from,
    to {
        border-color: transparent;
    }

    50% {
        border-color: var(--color-accent);
    }
}

/* Focus States for Accessibility
   ========================================================================== */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
}

/* Motion Preferences
   ========================================================================== */
@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;
    }

    .parallax {
        transform: none !important;
    }
}

/* Print Styles
   ========================================================================== */
@media print {

    .navbar,
    .scroll-indicator,
    .theme-toggle,
    .lightbox,
    .menu-toggle {
        display: none !important;
    }

    .section {
        page-break-inside: avoid;
    }
}