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

/* Custom focus styles */
.stat-input:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
    border-color: #0f766e;
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #0f766e;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #0d5b56;
}

/* Calculator card animations */
.calculator-card {
    animation: slideIn 0.3s ease-out;
}

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

/* Glass morphism enhancement */
.glass-panel {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Styles previously inline in index.html */
body { font-family: 'Inter', sans-serif; }
.gradient-bg { background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f766e 100%); }
.glass-panel { background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); }
.difficulty-badge-beginner { background: linear-gradient(135deg, #10b981, #059669); }
.difficulty-badge-intermediate { background: linear-gradient(135deg, #f59e0b, #d97706); }
.difficulty-badge-advanced { background: linear-gradient(135deg, #ef4444, #dc2626); }
.calculator-card { transition: all 0.3s ease; }
.calculator-card:hover { transform: translateY(-2px); box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1); }
.stat-input:focus { outline: none; box-shadow: 0 0 0 4px rgba(15,118,110,0.12); border-color: #0f766e; }
.result-highlight { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }
.tab-active { border-bottom: 3px solid #0f766e; color: #0f766e; }
.smooth-scroll { scroll-behavior: smooth; }

/* ===== UI polish additions ===== */
.gradient-bg { box-shadow: 0 8px 30px rgba(2,6,23,0.35); }
.difficulty-btn { transition: transform 160ms ease, box-shadow 160ms ease; }
.difficulty-btn:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(2,6,23,0.12); }
.btn, button { min-height: 44px; }
.card { transition: transform 180ms ease, box-shadow 180ms ease; }
.card:hover { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(2,6,23,0.08); }
.glass-panel { box-shadow: 0 20px 50px rgba(2,6,23,0.12); }

/* Mobile nav tweaks */
@media (max-width: 768px) {
    #nav-links.hidden { display: none !important; }
    #nav-links { display: block; position: absolute; right: 12px; top: 64px; background: rgba(255,255,255,0.95); padding: 12px; border-radius: 8px; box-shadow: 0 8px 30px rgba(2,6,23,0.12); z-index: 60; }
    #nav-links a { display: block; padding: 8px 10px; color: var(--ink); }
}

/* Footer tweak */
footer { border-top: 1px solid rgba(255,255,255,0.03); }

/* Small screens: reduce hero padding */
@media (max-width: 640px) {
    .hero { padding: 12px; }
}

/* ===== SEEING-THEORY INSPIRED ANIMATIONS ===== */

/* Hero animated canvas background */
#hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}
.hero-content { position: relative; z-index: 1; }

/* Scroll-reveal animations */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}
.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}
.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Staggered children animation */
.stagger-children > * {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.stagger-children.visible > *:nth-child(1) { transition-delay: 0ms; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(2) { transition-delay: 80ms; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(3) { transition-delay: 160ms; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(4) { transition-delay: 240ms; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(5) { transition-delay: 320ms; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(6) { transition-delay: 400ms; opacity: 1; transform: translateY(0); }

/* Simulation panel glow on hover */
.sim-panel {
    position: relative;
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.sim-panel:hover {
    transform: translateY(-4px);
    box-shadow: 0 25px 60px rgba(13, 148, 136, 0.12),
                0 0 0 1px rgba(13, 148, 136, 0.08);
}
.sim-panel::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px;
    height: 4px;
    border-radius: 12px 12px 0 0;
    background: linear-gradient(90deg, #0d9488, #6366f1, #f59e0b, #0d9488);
    background-size: 300% 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sim-panel:hover::before {
    opacity: 1;
    animation: shimmerBorder 3s linear infinite;
}
@keyframes shimmerBorder {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* Button ripple effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}
.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
    opacity: 0;
}
.btn-ripple:active::after {
    width: 200px; height: 200px;
    opacity: 0;
}

/* Counter number animation */
.counter-animate {
    display: inline-block;
    transition: transform 0.2s ease;
}
.counter-animate.bump {
    transform: scale(1.3);
}

/* CLT ball-drop trail */
.sample-trail {
    position: absolute;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #ef4444;
    pointer-events: none;
    animation: trailFade 0.8s ease-out forwards;
}
@keyframes trailFade {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.3); }
}

/* Floating label animation */
@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-30px); }
}
.float-label {
    position: absolute;
    animation: floatUp 1.2s ease-out forwards;
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
    color: #0d9488;
}

/* Population canvas pulse ring */
@keyframes pulseRing {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* Breathing glow for active simulation */
.sim-active {
    animation: breatheGlow 2s ease-in-out infinite;
}
@keyframes breatheGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(13, 148, 136, 0.08); }
    50% { box-shadow: 0 0 40px rgba(13, 148, 136, 0.18); }
}

/* Stat card hover lift */
.stat-card {
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.25s ease;
}
.stat-card:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

/* Learning resource cards */
.learning-card {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}
.learning-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
}
.learning-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--card-accent, #0d9488), transparent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}
.learning-card:hover::after {
    transform: scaleX(1);
}

/* Section title underline animation */
.section-title {
    position: relative;
    display: inline-block;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: -4px; left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #0d9488, #6366f1);
    border-radius: 2px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.section-title.visible::after {
    width: 60px;
}
