/* Custom Properties */
:root {
    --pumpkin: #FF7A00;
    --deep-orange: #E95E00;
    --bone: #F6F1E8;
    --night: #0A0A0A;
    --slime: #6CFD6C;
    --candle: #FFE08A;
}

/* Theme Colors */
[data-theme="treat"] {
    --accent: var(--pumpkin);
}

[data-theme="trick"] {
    --accent: var(--slime);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--night);
    color: var(--bone);
    overflow-x: hidden;
    position: relative;
}

/* Grain Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
}

/* Custom Cursor */
@media (pointer: fine) {
    body {
        cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ctext y='20' font-size='20'%3E🎃%3C/text%3E%3C/svg%3E") 12 12, auto;
    }
}

/* Spooky Moving Fog */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background: 
        radial-gradient(ellipse 1000px 500px at 20% 50%, rgba(180, 180, 200, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse 900px 450px at 80% 70%, rgba(160, 160, 180, 0.35) 0%, transparent 45%),
        radial-gradient(ellipse 1100px 550px at 50% 30%, rgba(170, 170, 190, 0.45) 0%, transparent 55%),
        radial-gradient(ellipse 950px 500px at 30% 80%, rgba(150, 150, 170, 0.38) 0%, transparent 48%);
    animation: fogDrift 30s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes fogDrift {
    0%, 100% { 
        transform: translateX(0) translateY(0);
    }
    25% { 
        transform: translateX(-10%) translateY(-3%);
    }
    50% { 
        transform: translateX(-20%) translateY(2%);
    }
    75% { 
        transform: translateX(-10%) translateY(-2%);
    }
}

/* Container */
.container {
    position: relative;
    z-index: 2;
}

/* Color Classes */
.bg-night { background-color: var(--night); }
.text-bone { color: var(--bone); }
.text-pumpkin { color: var(--pumpkin); }
.text-accent { color: var(--accent); }

/* Buttons */
.btn-primary {
    background: var(--accent);
    color: var(--night);
    border: 2px solid var(--accent);
    transition: all 0.3s ease;
    position: relative;
}

.btn-primary:hover {
    background: transparent;
    color: var(--accent);
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--accent);
    color: var(--night);
}

/* Hover Shake Animation */
@media (prefers-reduced-motion: no-preference) {
    .hover-shake:hover {
        animation: shake 0.3s ease-in-out;
    }
}

@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-2deg); }
    75% { transform: rotate(2deg); }
}

/* Tooltip "boo" Effect */
.btn-primary::before,
.btn-secondary::before {
    content: 'boo';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: var(--accent);
    color: var(--night);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

@media (prefers-reduced-motion: no-preference) {
    .btn-primary:hover::before,
    .btn-secondary:hover::before {
        opacity: 1;
        transform: translateX(-50%) translateY(-10px);
    }
}

/* Contract Pill */
.contract-pill {
    background: var(--accent);
    color: var(--night);
    display: inline-block;
}

/* Hero Logo Floating Animation */
.hero-logo {
    animation: float 3s ease-in-out infinite;
}

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

/* Pumpkin Glow */
.pumpkin-glow {
    position: relative;
}

.pumpkin-glow::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 40px;
    background: radial-gradient(ellipse, var(--pumpkin) 0%, transparent 70%);
    opacity: 0.5;
    filter: blur(20px);
}

/* Countdown Ring */
.countdown-container {
    width: 200px;
    height: 200px;
}

.countdown-ring {
    transform: rotate(-90deg);
}

.countdown-ring-bg {
    fill: none;
    stroke: var(--bone);
    stroke-width: 8;
    opacity: 0.1;
}

.countdown-ring-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 565.48;
    transition: stroke-dashoffset 1s linear;
}

/* Cards */
.card {
    background: rgba(255, 122, 0, 0.05);
    border: 1px solid var(--accent);
    transition: all 0.3s ease;
}

.card:hover {
    background: rgba(255, 122, 0, 0.1);
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.gallery-item {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    border: 2px solid var(--accent);
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item.hidden {
    display: none;
}

/* Filter Chips */
.filter-chip {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-chip:hover,
.filter-chip.active {
    background: var(--accent);
    color: var(--night);
}

/* Step Numbers */
.step-number {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--accent);
    color: var(--night);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    flex-shrink: 0;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: none;
    border: none;
    color: var(--bone);
    font-size: 3rem;
    cursor: pointer;
    line-height: 1;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent);
    color: var(--night);
    border: none;
    font-size: 3rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.lightbox-prev { left: 2rem; }
.lightbox-next { right: 2rem; }

/* Confetti */
.confetti {
    position: fixed;
    width: 20px;
    height: 20px;
    background: var(--pumpkin);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    animation: fall 1.5s linear forwards;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .hover-shake:hover {
        animation: none;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}
