/* --- UNIVERSAL STYLES FOR THE ENTIRE SITE --- */

/* 1. Define CSS Variables for Theming */
:root {
    --primary: #60a5fa;
    --secondary: #dc2626;
    --bg-dark: rgba(30, 41, 59, 0.7);
    --bg-darker: rgba(15, 23, 42, 0.9);
    --text-light: #f1f5f9;
    --text-muted: #94a3b8;
    --card-bg: rgba(30, 41, 59, 0.4);
    --card-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    --font-primary: 'Space Grotesk', sans-serif;
    --radius-main: 20px;
    --radius-small: 12px;
}

/* 2. Light & Dark Mode Color Palettes */
body.light-mode {
    --primary: #3b82f6;
    --secondary: #ec4899;
    --bg-dark: rgba(219, 234, 254, 0.8);
    --bg-darker: rgba(252, 231, 243, 0.95);
    --text-light: #1e293b;
    --text-muted: #64748b;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
    background: linear-gradient(135deg, #dbeafe 0%, #fce7f3 100%);
    color: var(--text-light);
}

body.dark-mode {
    --primary: #60a5fa;
    --secondary: #dc2626;
    --bg-dark: rgba(30, 41, 59, 0.7);
    --bg-darker: rgba(15, 23, 42, 0.9);
    --text-light: #f1f5f9;
    --text-muted: #94a3b8;
    --card-bg: rgba(30, 41, 59, 0.4);
    --card-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, #2a1520 0%, #3d1a35 100%);
    color: var(--text-light);
}

/* 3. Base & Layout Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: var(--font-primary);
    transition: background 0.3s ease, color 0.3s ease;
    padding: 2rem 1rem;
    gap: 2rem;
    overflow-x: hidden;
}

/* Header Styles */
.site-header {
    text-align: center;
    position: relative;
    display: inline-block;
    margin: 0 auto 0.5rem;
    justify-self: center;
}

.logo-link {
    display: inline-block;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    height: 60px;
}

.logo {
    height: 60px;
    width: auto;
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* Logo visibility based on theme */
body.dark-mode .logo-light {
    opacity: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

body.dark-mode .logo-dark {
    opacity: 1;
}

body.light-mode .logo-dark {
    opacity: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

body.light-mode .logo-light {
    opacity: 1;
}

/* Logo hover effect */
body.dark-mode .logo-link:hover .logo-dark,
body.dark-mode .theme-toggle:hover .logo-dark {
    opacity: 0;
}

body.dark-mode .logo-link:hover .logo-light,
body.dark-mode .theme-toggle:hover .logo-light {
    opacity: 1;
}

body.light-mode .logo-link:hover .logo-light,
body.light-mode .theme-toggle:hover .logo-light {
    opacity: 0;
}

body.light-mode .logo-link:hover .logo-dark,
body.light-mode .theme-toggle:hover .logo-dark {
    opacity: 1;
}

/* Footer Styles */
.footer {
    margin-top: 1.5rem;
    text-align: center;
    padding: 0.8rem 0;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: inline-block;
    position: relative;
    height: 30px;
    width: 120px;
}

.theme-toggle .logo {
    height: 30px;
    width: 120px;
    object-fit: contain;
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

@keyframes timerPulse {
    0% {
        text-shadow: 0 0 10px rgba(0, 255, 163, 0.3);
    }
    50% {
        text-shadow: 0 0 20px rgba(0, 255, 163, 0.5);
    }
    100% {
        text-shadow: 0 0 10px rgba(0, 255, 163, 0.3);
    }
}

.container {
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
    background: var(--card-bg);
    border-radius: var(--radius-main);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Media Queries */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.75rem;
        gap: 1rem;
    }
    
    .container {
        max-width: 100%;
        padding: 1.5rem 1rem;
        border-radius: 16px;
    }
    
    .time-block {
        min-width: 65px;
        padding: 0.6rem 0.3rem;
        min-height: 70px;
    }
    
    .time-block span:first-child {
        font-size: clamp(1.5rem, 5vw, 1.8rem);
    }
    
    .time-block .label {
        font-size: 0.65rem;
    }
    
    .countdown {
        gap: 0.5rem;
        margin: 1.5rem 0;
    }
    .site-header {
        margin: 0 auto 5rem;
    }
}

h1 {
    font-size: clamp(1.3rem, 4vw, 1.7rem);
    margin-bottom: 2rem;
    color: var(--text-light);
    font-weight: 700;
    text-transform: lowercase;
    letter-spacing: -0.5px;
}

.countdown {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
    margin: 2rem 0;
    padding: 0;
    width: 100%;
}

.time-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.5rem;
    background: var(--bg-dark);
    border-radius: var(--radius-small);
    transition: transform 0.3s ease, background 0.3s ease;
    min-height: 80px;
}

.time-block span:first-child {
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.3rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
}

.time-block .label {
    font-size: clamp(0.7rem, 2vw, 0.9rem);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.date-info {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.message {
    font-size: clamp(0.9rem, 3vw, 1.05rem);
    margin-bottom: 1.5rem;
    font-weight: 500;
    color: var(--text-light);
    min-height: 1.2em;
}

.message.pre-start { color: var(--text-light); }
.message.during { color: var(--secondary); }

/* Days Passed Section */
.days-passed-section {
    margin: 2rem 0;
}

.days-passed-card {
    background: var(--bg-dark);
    border-radius: var(--radius-small);
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.days-passed-number {
    font-size: clamp(2rem, 8vw, 3.5rem);
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.5rem;
    font-variant-numeric: tabular-nums;
}

.days-passed-label {
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    color: var(--text-muted);
    text-transform: lowercase;
    letter-spacing: 0.5px;
    margin-bottom: 1.5rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.8rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 10px;
    transition: width 1s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    font-weight: 500;
}

/* --- HALL-OF-COMMITMENT-SPECIFIC STYLES --- */
/* (This section can be expanded if hall.html has more unique styles) */
.hall-header {
    text-align: center;
    margin: 1rem auto 2.9rem;
}

/* --- SHARED COMPONENT STYLES (Footer, etc.) --- */
.footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: var(--accent);
}

.footer-logo {
    height: 20px;
    width: auto;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.footer a:hover .footer-logo {
    opacity: 1;
}

/* Theme-aware logo logic */
.dark-mode .footer-logo-light,
.light-mode .footer-logo-dark {
    display: none;
}

.dark-mode .footer-logo-dark,
.light-mode .footer-logo-light {
    display: inline-block;
}

/* Theme Toggle Button */
.theme-toggle:hover {
    background-color: var(--bg-secondary);
    color: var(--accent);
}

.theme-icon {
    width: 24px;
    height: 24px;
}

/* Show/hide icons based on theme */
.dark-mode .sun-icon,
.light-mode .moon-icon {
    display: none;
}

.dark-mode .moon-icon,
.light-mode .sun-icon {
    display: block;
}

/* --- WARNING: This is for demonstration and is NOT recommended for UX --- */

@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }

    .countdown {
        gap: 0.5rem;
        padding: 0.3rem;
    }

    .time-block {
        padding: 0.6rem;
    }
}

@media (max-width: 380px) {
    .countdown {
        gap: 0.3rem;
    }

    .time-block {
        padding: 0.4rem;
    }

    .time-block span:first-child {
        font-size: clamp(1.4rem, 4vw, 1.8rem);
    }

    .time-block .label {
        font-size: clamp(0.6rem, 1.5vw, 0.7rem);
    }
}