/* Custom CSS for Taiwan Advanced Geothermal Developer */

/* Base styles */
:root {
    --ice-primary: #475569;
    --ice-secondary: #334155;
    --frost-primary: #6366f1;
    --frost-secondary: #4f46e5;
    --snow-accent: #e6ecff;
    --transition-base: all 0.3s ease;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom animations */
@keyframes fade-in-up {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in-left {
    0% {
        opacity: 0;
        transform: translateX(-30px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fade-in-right {
    0% {
        opacity: 0;
        transform: translateX(30px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes particle-float {
    0%, 100% {
        transform: translateY(0px) translateX(0px) rotate(0deg);
        opacity: 0.3;
    }
    25% {
        transform: translateY(-20px) translateX(10px) rotate(90deg);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-10px) translateX(-10px) rotate(180deg);
        opacity: 0.4;
    }
    75% {
        transform: translateY(-30px) translateX(5px) rotate(270deg);
        opacity: 0.7;
    }
}

/* Animation classes */
.animate-fade-in-up {
    animation: fade-in-up 1s ease-out;
}

.animate-fade-in-left {
    animation: fade-in-left 1s ease-out;
}

.animate-fade-in-right {
    animation: fade-in-right 1s ease-out;
}

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

/* Navigation enhancements */
#navbar {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-link {
    position: relative;
    overflow: hidden;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--geothermal-primary), var(--geothermal-secondary));
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Hero section background image optimization */
#home {
    background-attachment: fixed;
}

#home .bg-cover {
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

/* Responsive background image */
@media (max-width: 768px) {
    #home {
        background-attachment: scroll;
    }
    
    #home .bg-cover {
        background-size: cover;
        background-position: center center;
    }
}

/* Hero section particles */
.particles-container {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: particle-float 6s ease-in-out infinite;
}

.particle:nth-child(1) {
    top: 20%;
    left: 20%;
    animation-delay: 0s;
    animation-duration: 8s;
}

.particle:nth-child(2) {
    top: 60%;
    left: 80%;
    animation-delay: 2s;
    animation-duration: 6s;
}

.particle:nth-child(3) {
    top: 80%;
    left: 40%;
    animation-delay: 4s;
    animation-duration: 10s;
}

.particle:nth-child(4) {
    top: 30%;
    left: 70%;
    animation-delay: 1s;
    animation-duration: 7s;
}

.particle:nth-child(5) {
    top: 70%;
    left: 10%;
    animation-delay: 3s;
    animation-duration: 9s;
}

/* Button enhancements */
.btn-primary {
    background: linear-gradient(135deg, var(--frost-primary), var(--frost-secondary));
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary::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-primary:hover::before {
    left: 100%;
}

.btn-secondary {
    position: relative;
    overflow: hidden;
}

.btn-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: width 0.3s ease;
}

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

/* Service cards */
.service-card {
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(79, 70, 229, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.service-card:hover::before {
    opacity: 1;
}

/* Project cards */
.project-card {
    position: relative;
    overflow: hidden;
}

.project-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(99, 102, 241, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover::after {
    opacity: 1;
}

/* Scroll animations */
.scroll-animate {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease-out;
}

.scroll-animate.animate {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced form styles */
input:focus,
textarea:focus,
select:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Loading animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Pulse animation for stats */
.pulse-stats {
    animation: pulse 2s infinite;
}

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

/* Gradient text effects */
.gradient-text {
    background: linear-gradient(135deg, var(--frost-primary), var(--frost-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Enhanced shadows */
.shadow-glow {
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.25);
}

.shadow-glow-hover:hover {
    box-shadow: 0 20px 60px rgba(99, 102, 241, 0.3);
}

/* Enhanced text contrast */
.enhanced-contrast {
    color: #1e293b !important;
    font-weight: 500;
}

.enhanced-contrast-heading {
    color: #0f172a !important;
    font-weight: 600;
}

/* Mission box background image optimization */
.mission-box {
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

/* Enhanced text shadows for readability over natural landscape */
.mission-text-shadow {
    text-shadow: 
        2px 2px 4px rgba(0,0,0,0.8),
        0 0 8px rgba(0,0,0,0.5),
        0 0 16px rgba(0,0,0,0.3);
}

.mission-text-shadow-light {
    text-shadow: 
        1px 1px 3px rgba(0,0,0,0.7),
        0 0 6px rgba(0,0,0,0.4),
        0 0 12px rgba(0,0,0,0.2);
}

/* Improved readability */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.025em;
}

p, li, span {
    color: #475569;
    line-height: 1.7;
}

/* Responsive typography */
@media (max-width: 768px) {
    .particles-container {
        display: none;
    }
    
    .service-card,
    .project-card {
        margin-bottom: 1rem;
    }
}

/* Dark mode support (if needed in future) */
@media (prefers-color-scheme: dark) {
    .nav-link {
        color: rgba(255, 255, 255, 0.8);
    }
}

/* Print styles */
@media print {
    .particles-container,
    .animate-bounce,
    nav {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .btn-primary {
        border: 2px solid;
    }
    
    .service-card,
    .project-card {
        border: 2px solid;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .particles-container {
        display: none;
    }
}

/* Focus styles for accessibility */
button:focus,
a:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--frost-primary);
    outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--frost-primary);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}