/* ============================================================
   Big Bang Demolition — Modern Industrial Theme
   Overrides Pico CSS defaults for dark industrial aesthetic
   ============================================================ */

/* --- Pico CSS Custom Properties Override --- */
:root[data-theme="dark"] {
    --pico-font-family: "Source Sans 3", system-ui, sans-serif;
    --pico-font-size: 16px;
    --pico-line-height: 1.6;
    --pico-background-color: #0a0a0a;
    --pico-color: #e4e4e4;
    --pico-primary: #FF6B00;
    --pico-primary-hover: #ea580c;
    --pico-primary-focus: rgba(255, 107, 0, 0.25);
    --pico-primary-inverse: #ffffff;
    --pico-secondary: #6b7280;
    --pico-secondary-hover: #9ca3af;
    --pico-muted-color: #9ca3af;
    --pico-muted-border-color: #374151;
    --pico-card-background-color: #1a1a1a;
    --pico-card-sectioning-background-color: #111111;
    --pico-form-element-background-color: #111827;
    --pico-form-element-border-color: #374151;
    --pico-form-element-focus-color: #FF6B00;
}

/* --- Base Resets for Pico/Tailwind compatibility --- */
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

main {
    padding: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: "Oswald", sans-serif;
    line-height: 1.1;
    margin-bottom: 0;
    --pico-font-weight: 700;
}

a {
    --pico-color: inherit;
    --pico-text-decoration: none;
}

a:hover {
    --pico-text-decoration: none;
}

/* --- Navigation Active State --- */
.nav-active {
    color: #FF6B00 !important;
    position: relative;
}

.nav-active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background-color: #FF6B00;
}

/* --- Hero Background Pattern --- */
.hero-bg-pattern {
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(255, 107, 0, 0.03) 2px,
            rgba(255, 107, 0, 0.03) 4px
        );
}

/* --- Scroll margin for anchored sections --- */
[id] {
    scroll-margin-top: 6rem;
}

/* --- Form Overrides --- */
input, select, textarea {
    --pico-background-color: #111827;
    --pico-border-color: #374151;
}

input:focus, select:focus, textarea:focus {
    --pico-border-color: #FF6B00;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
}

/* --- HTMX Indicator --- */
.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    opacity: 1;
}

/* --- 404 Wrecking Ball Animation --- */
.wrecking-ball-container {
    width: 200px;
    height: 200px;
    margin: 0 auto;
    position: relative;
}

.wrecking-crane {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.crane-arm {
    width: 4px;
    height: 20px;
    background: #374151;
    margin: 0 auto;
}

.crane-cable {
    width: 2px;
    height: 60px;
    background: #6b7280;
    margin: 0 auto;
    transform-origin: top center;
    animation: swingCable 3s ease-in-out infinite;
}

.wrecking-ball {
    width: 50px;
    height: 50px;
    background: radial-gradient(circle at 35% 35%, #6b7280, #374151);
    border-radius: 50%;
    margin: 0 auto;
    position: relative;
    transform-origin: top center;
    animation: swingBall 3s ease-in-out infinite;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.ball-shine {
    width: 15px;
    height: 15px;
    background: radial-gradient(circle, rgba(255,255,255,0.3), transparent);
    border-radius: 50%;
    position: absolute;
    top: 8px;
    left: 12px;
}

.rubble-pile {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 30px;
}

.rubble-piece {
    position: absolute;
    background: #374151;
    border: 1px solid #4b5563;
}

.r1 { width: 20px; height: 12px; bottom: 0; left: 10px; transform: rotate(-5deg); }
.r2 { width: 15px; height: 10px; bottom: 5px; left: 35px; transform: rotate(12deg); background: #4b5563; }
.r3 { width: 25px; height: 8px; bottom: 0; left: 55px; transform: rotate(-3deg); }
.r4 { width: 12px; height: 14px; bottom: 2px; left: 85px; transform: rotate(8deg); background: #4b5563; }
.r5 { width: 18px; height: 10px; bottom: 0; left: 70px; transform: rotate(-10deg); }

@keyframes swingCable {
    0%, 100% { transform: rotate(-15deg); }
    50% { transform: rotate(15deg); }
}

@keyframes swingBall {
    0%, 100% { transform: translateX(-40px); }
    50% { transform: translateX(40px); }
}

/* --- Mobile Menu Transition --- */
#mobile-menu.open {
    max-height: 400px;
    opacity: 1;
}

/* --- Hamburger Animation --- */
#mobile-menu-toggle.active #hamburger-top {
    transform: rotate(45deg) translate(4px, 4px);
}

#mobile-menu-toggle.active #hamburger-mid {
    opacity: 0;
}

#mobile-menu-toggle.active #hamburger-bot {
    transform: rotate(-45deg) translate(3px, -3px);
    width: 1.5rem;
}

/* --- Pico Overrides for Tailwind integration --- */
section {
    padding: 0;
}

article {
    padding: 0;
    margin: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

/* Remove Pico's container behavior on body/main */
body > main,
body > header,
body > footer {
    --pico-block-spacing-vertical: 0;
    --pico-block-spacing-horizontal: 0;
    padding: 0;
}

/* Remove Pico container max-width restrictions */
body > main > section,
body > header,
body > footer {
    max-width: none;
}

/* Ensure links don't get Pico's underline styles in nav */
nav a {
    --pico-text-decoration: none;
}

/* --- Smooth Scrolling --- */
html {
    scroll-behavior: smooth;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .wrecking-ball,
    .crane-cable {
        animation: none;
    }

    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* --- Print Styles --- */
@media print {
    header, footer, .hero-bg-pattern {
        display: none;
    }

    body {
        background: white;
        color: black;
    }
}
