/* Custom CSS extensions */
@keyframes blob {
    0% { transform: translate(0px, 0px) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
    100% { transform: translate(0px, 0px) scale(1); }
}

.animate-blob {
    animation: blob 7s infinite;
}

.animation-delay-2000 {
    animation-delay: 2s;
}

html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: #f9f9f9; /* tech white */
}
::-webkit-scrollbar-thumb {
    background: #d6d3d1; /* stone-300 */
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
    background: #c2410c; /* orange-700 / rust */
}

/* Tech Grid Background / Blueprint style */
.bg-grid-engineering {
    background-size: 40px 40px;
    background-image: linear-gradient(to right, rgba(194, 65, 12, 0.08) 1px, transparent 1px),
                      linear-gradient(to bottom, rgba(194, 65, 12, 0.08) 1px, transparent 1px);
}

/* Code Font Style Override */
.font-mono-code {
    font-family: 'Fira Code', 'Courier New', Courier, monospace;
}

/* ===== Scroll Reveal Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(194, 65, 12, 0); }
    50% { box-shadow: 0 0 20px 4px rgba(194, 65, 12, 0.15); }
}

/* Reveal base state — hidden until observed */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered card delays */
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* Card hover glow */
.card-glow:hover {
    animation: glowPulse 2s ease-in-out infinite;
}

/* Tag shimmer effect */
@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.tag-shimmer {
    background: linear-gradient(90deg, transparent 30%, rgba(194, 65, 12, 0.08) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

/* Floating particles for header */
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33% { transform: translateY(-10px) rotate(2deg); }
    66% { transform: translateY(5px) rotate(-1deg); }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animation-delay-1000 {
    animation-delay: 1s;
}

.animation-delay-3000 {
    animation-delay: 3s;
}

.animation-delay-4000 {
    animation-delay: 4s;
}

/* ===== Tech Title Animations ===== */

/* Glitch effect */
@keyframes glitch {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
}

@keyframes glitchClip1 {
    0%, 100% { clip-path: inset(0 0 80% 0); }
    25% { clip-path: inset(20% 0 60% 0); }
    50% { clip-path: inset(40% 0 20% 0); }
    75% { clip-path: inset(60% 0 0 0); }
}

@keyframes glitchClip2 {
    0%, 100% { clip-path: inset(80% 0 0 0); }
    25% { clip-path: inset(60% 0 20% 0); }
    50% { clip-path: inset(20% 0 40% 0); }
    75% { clip-path: inset(0 0 60% 0); }
}

.glitch-title {
    position: relative;
    display: inline-block;
}

.glitch-title::before,
.glitch-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-title::before {
    color: #c2410c;
    animation: glitchClip1 3s infinite linear alternate-reverse;
    transform: translate(-2px, -1px);
    opacity: 0.7;
}

.glitch-title::after {
    color: #9a3412;
    animation: glitchClip2 3s infinite linear alternate-reverse;
    transform: translate(2px, 1px);
    opacity: 0.7;
}

.glitch-title:hover::before,
.glitch-title:hover::after {
    animation-duration: 0.3s;
}

/* Scan line */
@keyframes scanLine {
    0% { top: -10%; }
    100% { top: 110%; }
}

.scan-line::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(194, 65, 12, 0.4), transparent);
    animation: scanLine 4s linear infinite;
    z-index: 2;
}

/* Terminal cursor blink */
@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.terminal-cursor::after {
    content: '█';
    animation: cursorBlink 1s step-end infinite;
    color: #c2410c;
    font-size: 0.8em;
    margin-left: 2px;
}

/* Typing effect */
@keyframes typeIn {
    from { width: 0; }
    to { width: 100%; }
}

.type-in {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid #c2410c;
    animation: typeIn 1.5s steps(30) 0.5s forwards, cursorBlink 1s step-end 2s infinite;
    width: 0;
    display: inline-block;
}

/* Circuit node dots */
@keyframes circuitPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(194, 65, 12, 0.4); }
    50% { box-shadow: 0 0 8px 3px rgba(194, 65, 12, 0.2); }
}

.circuit-dot {
    width: 6px;
    height: 6px;
    background: #c2410c;
    border-radius: 50%;
    animation: circuitPulse 2s ease-in-out infinite;
}

/* Data stream lines */
@keyframes dataStream {
    0% { transform: translateY(-100%); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(100vh); opacity: 0; }
}

.data-stream {
    position: absolute;
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, transparent, rgba(194, 65, 12, 0.3), transparent);
    animation: dataStream 3s linear infinite;
}

/* Hex grid background pattern */
@keyframes hexPulse {
    0%, 100% { opacity: 0.03; }
    50% { opacity: 0.08; }
}

.hex-grid-bg {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23c2410c' fill-opacity='0.06'%3E%3Cpath d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.35V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.85L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.15V49h-2z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    animation: hexPulse 4s ease-in-out infinite;
}

/* Title reveal with stagger */
@keyframes titleSlideUp {
    from {
        opacity: 0;
        transform: translateY(60px) skewY(3deg);
        filter: blur(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0) skewY(0deg);
        filter: blur(0);
    }
}

.title-reveal {
    animation: titleSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

.title-reveal-delay-1 { animation-delay: 0.2s; }
.title-reveal-delay-2 { animation-delay: 0.4s; }
.title-reveal-delay-3 { animation-delay: 0.6s; }
.title-reveal-delay-4 { animation-delay: 0.8s; }

/* ===== Gallery Tech Animations ===== */

/* Staggered fade-in with glitch flicker */
@keyframes galleryReveal {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
        filter: blur(6px) brightness(1.5);
    }
    30% {
        opacity: 0.6;
        filter: blur(2px) brightness(1.2);
    }
    50% {
        opacity: 0.4;
        filter: blur(0) brightness(1);
    }
    70% {
        opacity: 0.9;
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0) brightness(1);
    }
}

.gallery-item {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
}

.gallery-item.revealed {
    animation: galleryReveal 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Scan line overlay on hover */
@keyframes galleryScan {
    0% { top: -100%; }
    100% { top: 200%; }
}

.gallery-item::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(180deg, transparent, rgba(194, 65, 12, 0.15), transparent);
    top: -100%;
    pointer-events: none;
    z-index: 2;
}

.gallery-item:hover::after {
    animation: galleryScan 0.8s linear;
}

/* Corner brackets on hover */
.gallery-item::before {
    content: '';
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(194, 65, 12, 0);
    z-index: 3;
    pointer-events: none;
    transition: all 0.4s ease;
}

.gallery-item:hover::before {
    border-color: rgba(194, 65, 12, 0.5);
    box-shadow: 0 0 15px rgba(194, 65, 12, 0.1);
}

/* Gallery heading glitch */
@keyframes headingGlitch {
    0%, 92%, 100% { transform: translate(0); opacity: 1; }
    93% { transform: translate(-3px, 1px); opacity: 0.8; }
    95% { transform: translate(2px, -1px); opacity: 0.9; }
    97% { transform: translate(-1px, 2px); opacity: 0.7; }
}

.gallery-heading {
    animation: headingGlitch 4s ease-in-out infinite;
}

/* Data line decoration */
@keyframes dataLine {
    0% { width: 0; opacity: 0; }
    50% { opacity: 1; }
    100% { width: 100%; opacity: 0.3; }
}

.gallery-data-line {
    height: 1px;
    background: linear-gradient(90deg, transparent, #c2410c, transparent);
    animation: dataLine 2s ease-out forwards;
}

/* ===== Hero Slideshow Tech Animations ===== */

/* Smooth Ken Burns default */
.slide-transition {
    transition: opacity 0.5s ease, transform 8s ease-out;
    animation: slideKenBurns 8s ease-out infinite alternate;
}

@keyframes slideKenBurns {
    0% { transform: scale(1); }
    100% { transform: scale(1.06); }
}

/* Glitch transition on slide change */
@keyframes slideGlitch {
    0% { opacity: 1; filter: brightness(1) saturate(1); clip-path: inset(0 0 0 0); }
    15% { opacity: 0.6; filter: brightness(1.8) saturate(0); clip-path: inset(10% 0 20% 0); }
    30% { opacity: 0.3; filter: brightness(2) saturate(0); clip-path: inset(40% 0 10% 0); transform: translate(3px, -2px); }
    50% { opacity: 0; filter: brightness(0.5); }
    100% { opacity: 0; }
}

.slide-glitch {
    animation: slideGlitch 0.3s ease-out forwards !important;
}

/* Scan line for slideshow */
@keyframes slideshowScan {
    0% { top: -20%; }
    100% { top: 120%; }
}

.slideshow-scan::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 8%;
    background: linear-gradient(180deg, transparent, rgba(194, 65, 12, 0.08), transparent);
    animation: slideshowScan 3s linear infinite;
    z-index: 1;
}

/* Mascot cards idle float */
.mascot-card {
    animation: mascotFloat 3s ease-in-out infinite;
}
@keyframes mascotFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.mascot-card:nth-child(2) { animation-delay: 0.4s; }
.mascot-card:nth-child(3) { animation-delay: 0.8s; }
.mascot-card:nth-child(4) { animation-delay: 1.2s; }
.mascot-card:nth-child(5) { animation-delay: 1.6s; }
