:root {
    /* Light theme (default) */
    --bg-primary: #F5F2EB;
    /* Aged parchment */
    --bg-secondary: #EDE8DF;
    /* Slightly darker parchment */
    --text-primary: #1A1A1A;
    /* Liturgical black */
    --text-secondary: #4A4A4A;
    /* Softer black */
    --accent-red: #C41E3A;
    /* Cardinal red - for NU, holidays */
    --accent-green: #2D5A27;
    /* Liturgical green - for DA */
    --border-color: #1A1A1A;
}

[data-theme="dark"] {
    --bg-primary: #1A1A1A;
    --bg-secondary: #2A2A2A;
    --text-primary: #F5F2EB;
    --text-secondary: #B8B8B8;
    --accent-red: #E85A70;
    --accent-green: #5FAD56;
    --border-color: #F5F2EB;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'IBM Plex Mono', monospace;
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
}

h1,
h2,
h3,
h4,
h5,
h6,
.serif {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    letter-spacing: normal;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.grid {
    display: grid;
    gap: 1rem;
}

/* Navigation */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-logo {
    font-family: 'Instrument Serif', serif;
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a:hover {
    text-decoration: underline;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    cursor: pointer;
    font-family: inherit;
}

.theme-toggle:hover {
    background-color: var(--text-primary);
    color: var(--bg-primary);
}

/* Footer */
.main-footer {
    border-top: 1px solid var(--border-color);
    padding: 2rem 1rem;
    margin-top: 4rem;
    background-color: var(--bg-secondary);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-title {
    font-family: 'Instrument Serif', serif;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.footer-section a {
    display: block;
    margin-bottom: 0.5rem;
}

.footer-section a:hover {
    text-decoration: underline;
}

.footer-bottom {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Components */
.card {
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    background-color: var(--bg-primary);
}

.card:hover {
    /* Subtle lift or highlight if desired, but brutalism often stays flat */
}

.btn {
    display: inline-block;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.btn:hover {
    background-color: var(--text-primary);
    color: var(--bg-primary);
}

/* Status Indicators */
.status-da {
    color: var(--accent-green);
}

.status-nu {
    color: var(--accent-red);
}

/* Typography Helpers */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

/* Calendar Styles */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: var(--border-color);
    border: 1px solid var(--border-color);
}

.calendar-cell {
    background-color: var(--bg-primary);
    padding: 0.5rem;
    min-height: 80px;
    position: relative;
    color: var(--text-primary);
}

.calendar-header {
    background-color: var(--bg-secondary);
    padding: 0.5rem;
    text-align: center;
    font-weight: bold;
    color: var(--text-primary);
}

.day-number {
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.holiday-marker {
    color: var(--accent-red);
    font-size: 1.2rem;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

.calendar-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
}

.calendar-cell.empty {
    background-color: var(--bg-secondary);
}

.is-sunday {
    background-color: var(--bg-secondary);
    color: var(--accent-red);
}

/* Removed specific dark mode tint for Sundays to ensure better contrast */

.is-holiday {
    color: var(--accent-red);
}

.calendar-header:last-child {
    color: var(--accent-red);
}

/* Responsive */
@media (max-width: 768px) {
    .main-nav {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-logo {
        grid-column: 1;
        grid-row: 1;
    }

    .theme-toggle {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
    }

    .nav-links {
        grid-column: 1 / -1;
        grid-row: 2;
        display: flex;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        gap: 1rem;
        /* Hide scrollbar */
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-links a {
        white-space: nowrap;
        font-size: 0.9rem;
        padding: 0.25rem 0;
    }

    .calendar-cell {
        min-height: 60px;
        padding: 0.25rem;
        font-size: 0.9rem;
    }

    .holiday-marker {
        font-size: 1rem;
    }

    .nav-text {
        display: none;
    }
}