/**
 * GAT Insulation - Animations & Effects
 * Elegant animations for a premium user experience
 */

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

@keyframes gradientFlow {
    0% { opacity: 1; }
    50% { opacity: 0.9; }
    100% { opacity: 1; }
}

@keyframes textReveal {
    from {
        clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

@keyframes lineExpand {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   SCROLL ANIMATION CLASSES
   ============================================ */

/* Initial hidden state */
.animate-on-scroll {
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-on-scroll.fade-up {
    transform: translateY(50px);
}

.animate-on-scroll.fade-down {
    transform: translateY(-50px);
}

.animate-on-scroll.fade-left {
    transform: translateX(-50px);
}

.animate-on-scroll.fade-right {
    transform: translateX(50px);
}

.animate-on-scroll.scale-up {
    transform: scale(0.8);
}

.animate-on-scroll.zoom-in {
    transform: scale(0.9);
}

/* Visible state */
.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
}

/* Stagger delays for children */
.stagger-children > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-children > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-children > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-children > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-children > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-children > *:nth-child(6) { transition-delay: 0.6s; }

/* ============================================
   HERO SECTION ENHANCEMENTS
   ============================================ */

.hero {
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0.6) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    animation: fadeInUp 1s ease-out;
}

.hero h1 {
    overflow: hidden;
}

.hero h1 span {
    display: inline-block;
    animation: fadeInUp 0.8s ease-out 0.3s both;
    background: linear-gradient(135deg, var(--accent-gold), #e8c078);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    animation: fadeInUp 0.8s ease-out 0.5s both;
}

.hero-buttons {
    animation: fadeInUp 0.8s ease-out 0.7s both;
}

/* Animated gradient border for primary buttons */
.hero .btn-primary {
    position: relative;
    background: linear-gradient(135deg, var(--accent-gold), #c9973e);
    background-size: 200% 200%;
    animation: gradientFlow 3s ease infinite;
    box-shadow: 0 4px 15px rgba(212, 168, 75, 0.4);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero .btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(212, 168, 75, 0.5);
}

.hero .btn-outline {
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.8);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero .btn-outline::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 ease;
}

.hero .btn-outline:hover::before {
    left: 100%;
}

.hero .btn-outline:hover {
    background: rgba(255,255,255,0.1);
    border-color: #fff;
    transform: translateY(-3px);
}

/* ============================================
   SECTION HEADERS
   ============================================ */

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-header h2 {
    position: relative;
    display: inline-block;
}

.section-header .accent-line {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-gold), #e8c078);
    margin: 15px auto 0;
    transform-origin: center;
    transition: width 0.5s ease;
}

.section-header:hover .accent-line {
    width: 100px;
}

/* ============================================
   SERVICE CARDS ENHANCED
   ============================================ */

.service-card-image {
    position: relative;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(212,168,75,0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.service-card-image:hover::after {
    opacity: 1;
}

.service-card-image:hover {
    transform: translateY(-12px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.service-card-img {
    position: relative;
    overflow: hidden;
}

.service-card-img::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: skewX(-25deg);
    z-index: 1;
    transition: left 0.7s ease;
}

.service-card-image:hover .service-card-img::before {
    left: 150%;
}

.service-card-content h3 {
    transition: color 0.3s ease;
}

.service-card-image:hover .service-card-content h3 {
    color: var(--accent-gold);
}

.service-card-content .learn-more {
    position: relative;
    overflow: hidden;
}

.service-card-content .learn-more svg {
    transition: transform 0.3s ease;
}

.service-card-image:hover .learn-more svg {
    transform: translateX(5px);
}

/* ============================================
   BRANCH CARDS ENHANCED
   ============================================ */

.branch-card {
    position: relative;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.branch-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-gold), #e8c078);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
    z-index: 1;
}

.branch-card:hover::before {
    transform: scaleX(1);
}

.branch-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
}

.branch-card-image img {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.branch-card:hover .branch-card-image img {
    transform: scale(1.1);
}

/* ============================================
   ABOUT SECTION ENHANCED
   ============================================ */

.about-grid {
    position: relative;
}

.about-content {
    position: relative;
}

.about-content h2 {
    position: relative;
    display: inline-block;
}

.about-content h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-gold), #e8c078);
}

.about-image {
    position: relative;
    overflow: hidden;
}

.about-image::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    border: 3px solid var(--accent-gold);
    border-radius: 0;
    z-index: -1;
    opacity: 0.5;
}

.about-image::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: -20px;
    width: 100px;
    height: 100px;
    border: 3px solid var(--accent-gold);
    border-radius: 0;
    z-index: -1;
    opacity: 0.5;
}

.about-image img {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.about-image:hover img {
    transform: scale(1.05);
}

/* ============================================
   CONTACT BAR ENHANCED
   ============================================ */

.contact-bar {
    position: relative;
    overflow: hidden;
}

.contact-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212,168,75,0.1), transparent);
    animation: shimmer 3s infinite;
}

.contact-bar-item {
    transition: all 0.3s ease;
}

.contact-bar-item:hover {
    transform: translateY(-2px);
    color: var(--accent-gold);
}

.contact-bar-item svg {
    transition: transform 0.3s ease;
}

.contact-bar-item:hover svg {
    transform: scale(1.2);
}

/* ============================================
   CTA SECTION ENHANCED
   ============================================ */

.cta-section {
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(212,168,75,0.1) 0%, transparent 50%);
    animation: float 6s ease-in-out infinite;
}

/* ============================================
   BUTTON ENHANCEMENTS
   ============================================ */

.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-gold), #c9973e);
    box-shadow: 0 4px 15px rgba(212, 168, 75, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(212, 168, 75, 0.4);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-outline {
    position: relative;
    border: 2px solid var(--accent-gold);
    color: var(--accent-gold);
    background: transparent;
}

.btn-outline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: var(--accent-gold);
    transition: width 0.4s ease;
    z-index: -1;
}

.btn-outline:hover::before {
    width: 100%;
}

.btn-outline:hover {
    color: #fff;
}

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

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    animation: float 2s ease-in-out infinite;
}

.scroll-indicator a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.scroll-indicator .mouse {
    width: 26px;
    height: 40px;
    border: 2px solid rgba(255,255,255,0.8);
    border-radius: 15px;
    position: relative;
}

.scroll-indicator .mouse::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 8px;
    background: rgba(255,255,255,0.8);
    border-radius: 2px;
    animation: scrollMouse 1.5s ease-in-out infinite;
}

@keyframes scrollMouse {
    0%, 100% { top: 8px; opacity: 1; }
    50% { top: 20px; opacity: 0.3; }
}

/* ============================================
   LOADING ANIMATION
   ============================================ */

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.loaded {
    opacity: 0;
    visibility: hidden;
}

.page-loader .loader {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   COUNTER ANIMATION
   ============================================ */

.counter {
    font-variant-numeric: tabular-nums;
}

/* ============================================
   SMOOTH REVEAL
   ============================================ */

.reveal {
    position: relative;
    overflow: hidden;
}

.reveal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--accent-gold);
    transform: translateX(-101%);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.reveal.active::before {
    transform: translateX(101%);
}

/* ============================================
   TEXT GRADIENT
   ============================================ */

.text-gradient {
    background: linear-gradient(135deg, var(--accent-gold), #e8c078, var(--accent-gold));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 3s linear infinite;
}

/* ============================================
   PARALLAX EFFECT
   ============================================ */

.parallax-container {
    perspective: 1px;
    overflow-x: hidden;
    overflow-y: auto;
}

.parallax-layer {
    transform-style: preserve-3d;
}

/* ============================================
   GLOW EFFECTS
   ============================================ */

.glow {
    box-shadow: 0 0 20px rgba(212, 168, 75, 0.3);
}

.glow-text {
    text-shadow: 0 0 20px rgba(212, 168, 75, 0.5);
}

/* ============================================
   HOVER LIFT
   ============================================ */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

/* ============================================
   IMAGE ZOOM ON HOVER
   ============================================ */

.img-zoom {
    overflow: hidden;
}

.img-zoom img {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.img-zoom:hover img {
    transform: scale(1.1);
}

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

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

    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }
}
