/* ===================================
   Daily Office - Modern Minimalist Styles
   =================================== */

/* ===================================
   RESET & BASE STYLES
   =================================== */

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

:root {
    --color-text: #2c3e50;
    --color-text-light: #7f8c8d;
    --color-border: #e0e0e0;
    --color-background: #ffffff;
    --color-accent: #3498db;
    --color-sacred: #d4af37;
    --color-mystery: #1a1a2e;
    --color-twilight: #16213e;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: Georgia, "Times New Roman", Times, serif;
    --font-sacred: 'Cinzel', serif;
    --font-liturgical: 'Crimson Text', serif;
}

body {
    font-family: var(--font-liturgical);
    font-size: 18px;
    line-height: 1.7;
    color: var(--color-text);
    background-color: #f8f9fa;
}

body.day-page {
    background: linear-gradient(180deg, rgba(26, 26, 46, 1) 0%, rgba(22, 33, 62, 1) 50%, rgba(15, 32, 39, 1) 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* ===================================
   NAVIGATION
   =================================== */

.navigation {
    background: linear-gradient(135deg, var(--color-mystery) 0%, var(--color-twilight) 100%);
    padding: 1rem 2rem;
    border-bottom: 2px solid var(--color-sacred);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.navigation a {
    color: var(--color-sacred);
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    font-family: var(--font-sans);
    font-weight: 500;
}

.navigation a:hover {
    background-color: rgba(212, 175, 55, 0.15);
    border-color: var(--color-sacred);
}

/* ===================================
   DAY PAGE
   =================================== */

.daily-office {
    max-width: 800px;
    margin: 2rem auto;
    background: rgba(255, 255, 255, 0.97);
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 1px rgba(212, 175, 55, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

@supports (backdrop-filter: blur(10px)) {
    .daily-office {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
    }
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 3px solid var(--color-border);
    position: relative;
}

.liturgical-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem 0 0.5rem;
    margin-top: 1.5rem;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
    font-family: var(--font-sans);
}

.liturgical-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-light);
    font-weight: 600;
}

.liturgical-seal {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.seal-ornament {
    color: var(--color-sacred);
    font-size: 0.9rem;
    opacity: 0.6;
}

.color-swatch {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--color-sacred);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 0 0 2px rgba(255, 255, 255, 0.5),
        0 0 20px rgba(212, 175, 55, 0.2);
    position: relative;
}

.color-swatch::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px solid rgba(212, 175, 55, 0.3);
    pointer-events: none;
}

.color-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: 0.05em;
}

/* Legacy support: allow templates using .liturgical-color to
   render using the same visual language as the new liturgical
   color seal/banner components. */
.liturgical-color {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background-color: rgba(255, 255, 255, 0.9);
}
.page-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-top: 0.5rem;
    color: var(--color-text);
}

.page-header h2.observance {
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--color-text-light);
    margin-top: 0.5rem;
}

/* ===================================
   OFFICE SECTIONS
   =================================== */

.office-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.office-section:last-of-type {
    border-bottom: none;
}

.office-section h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-text);
}

.office-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-light);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.opening-sentence,
.antiphon,
.reading,
.collect {
    margin-bottom: 1rem;
}

.scripture,
.lesson-ref,
.psalm-ref {
    font-style: italic;
    color: var(--color-text);
    line-height: 1.7;
}

.collect p {
    line-height: 1.8;
    text-align: left;
}

/* ===================================
   INDEX PAGE
   =================================== */

.index-header {
    position: relative;
    text-align: center;
    padding: 8rem 2rem;
    min-height: 100vh; /* Fallback for older browsers */
    min-height: 100dvh; /* Dynamic viewport height for modern browsers */
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f2027 100%);
    background-attachment: fixed;
    color: #f5f5f5;
    overflow: hidden;
}

.index-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 50% 30%, rgba(212, 175, 55, 0.12) 0%, transparent 50%);
    pointer-events: none;
    opacity: 0.5;
}

@media (prefers-reduced-motion: no-preference) {
    .index-header::before {
        animation: subtle-shimmer 20s ease-in-out infinite;
    }
}

@keyframes subtle-shimmer {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.08) 0%, transparent 60%);
    opacity: 0.5;
}

@media (prefers-reduced-motion: no-preference) {
    .hero-overlay {
        animation: divine-glow 8s ease-in-out infinite;
    }
}

@keyframes divine-glow {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}

.sacred-symbol {
    font-size: 3rem;
    color: var(--color-sacred);
    margin-bottom: 2rem;
    opacity: 0.9;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

@media (prefers-reduced-motion: no-preference) {
    .sacred-symbol {
        animation: gentle-pulse 4s ease-in-out infinite;
    }
}

@keyframes gentle-pulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.05); opacity: 1; }
}

.index-header h1 {
    font-family: var(--font-sacred);
    font-size: 4.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #f5f5f5;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), 0 0 30px rgba(212, 175, 55, 0.3);
}

.sacred-verse {
    font-family: var(--font-liturgical);
    font-size: 1.4rem;
    font-style: italic;
    line-height: 1.8;
    color: rgba(245, 245, 245, 0.95);
    margin: 3rem auto;
    padding: 2rem;
    max-width: 600px;
    border-left: 3px solid var(--color-sacred);
    border-right: 3px solid var(--color-sacred);
    background: rgba(255, 255, 255, 0.05);
}

@supports (backdrop-filter: blur(10px)) {
    .sacred-verse {
        background: rgba(255, 255, 255, 0.03);
        backdrop-filter: blur(10px);
    }
}

.sacred-verse cite {
    display: block;
    margin-top: 1rem;
    font-size: 1rem;
    font-style: normal;
    color: var(--color-sacred);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: var(--font-sans);
    font-weight: 600;
}

.hero-nav {
    position: absolute;
    top: 2rem;
    left: 2rem;
    z-index: 10;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-link-print {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-sacred);
    text-decoration: none;
    padding: 0.8rem 1.5rem;
    border: 2px solid var(--color-sacred);
    border-radius: 4px;
    background: rgba(212, 175, 55, 0.1);
    transition: all 0.3s ease;
    display: inline-block;
    will-change: transform;
}

@supports (backdrop-filter: blur(10px)) {
    .nav-link-print {
        backdrop-filter: blur(10px);
    }
}

.nav-link-print:hover {
    background: rgba(212, 175, 55, 0.2);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
    transform: translateY(-2px);
}

.tagline {
    font-family: var(--font-liturgical);
    font-size: 1.3rem;
    font-style: italic;
    color: var(--color-sacred);
    margin-bottom: 2rem;
    letter-spacing: 0.02em;
}

.site-description {
    font-family: var(--font-liturgical);
    font-size: 1.1rem;
    line-height: 1.8;
    color: rgba(245, 245, 245, 0.9);
    max-width: 700px;
    margin: 0 auto 2.5rem;
    padding: 0 1rem;
}


.calendar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.month {
    margin-bottom: 3rem;
}

.month h2 {
    font-family: var(--font-liturgical);
    font-size: 2.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--color-text);
    text-align: center;
}

.calendar-grid {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: linear-gradient(135deg, var(--color-mystery) 0%, var(--color-twilight) 100%);
    color: var(--color-sacred);
    border-bottom: 2px solid var(--color-sacred);
}

.weekday-header {
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--color-border);
}

.calendar-week:last-child {
    border-bottom: none;
}

.calendar-day {
    min-height: 120px;
    padding: 0.75rem;
    border-right: 1px solid var(--color-border);
    position: relative;
    background: white;
    display: flex;
    flex-direction: column;
}

.calendar-day:nth-child(7) {
    border-right: none;
}

.calendar-day.empty {
    background: #f8f9fa;
}

.calendar-day.has-data {
    text-decoration: none;
    color: var(--color-text);
    transition: background-color 0.2s, transform 0.1s;
    cursor: pointer;
}

.calendar-day.has-data:hover {
    background-color: #f0f7ff;
    transform: scale(1.02);
}

.liturgical-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
}

.calendar-day .day-number {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.calendar-day .observance {
    font-family: var(--font-liturgical);
    font-size: 0.85rem;
    color: var(--color-text);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Sunday styling */
.calendar-day:nth-child(7n+1).has-data .day-number {
    color: var(--color-sacred);
}

/* ===================================
   FOOTER
   =================================== */

.index-footer {
    font-family: var(--font-liturgical);
    text-align: center;
    padding: 2rem;
    background: white;
    border-top: 1px solid var(--color-border);
}

.legend {
    margin-top: 2rem;
}

.legend h3 {
    font-family: var(--font-liturgical);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-text-light);
}

.color-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.legend-item {
    font-family: var(--font-liturgical);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #ddd;
}

.page-footer {
    text-align: center;
    padding: 2rem;
    color: rgba(245, 245, 245, 0.7);
    font-size: 0.9rem;
    background: transparent;
}

.page-footer a {
    color: var(--color-sacred);
}

.attribution {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.attribution a {
    color: var(--color-accent);
    text-decoration: none;
}

.attribution a:hover {
    text-decoration: underline;
}

/* ===================================
   PRINT STYLES
   =================================== */

@media print {
    /* Hide screen-only elements */
    .no-print,
    .navigation,
    .page-footer,
    .print-header {
        display: none !important;
    }

    /* Reset page styles for print */
    body {
        font-family: var(--font-serif);
        font-size: 10pt;
        line-height: 1.4;
        color: #000;
        background: white;
        margin: 0;
        padding: 0;
    }

    /* Page setup */
    @page {
        size: letter;
        margin: 0.5in 0.6in;
    }

    /* Daily office page */
    .daily-office {
        max-width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
        border-radius: 0;
        background: white;
    }

    .page-header {
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem;
        border-bottom: 2px solid #000;
    }

    .liturgical-banner {
        padding: 0.5rem 0;
        margin-top: 0.5rem;
    }

    .liturgical-label {
        font-size: 7pt;
    }

    .color-swatch {
        width: 30px;
        height: 30px;
        border-width: 2px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }

    .color-swatch::after {
        display: none;
    }

    .seal-ornament {
        font-size: 8pt;
    }

    .color-name {
        font-size: 8pt;
    }

    .page-header h1 {
        font-size: 14pt;
        margin-top: 0;
    }

    .page-header h2.observance {
        font-size: 11pt;
        margin-top: 0.2rem;
    }

    /* Sections */
    .office-section {
        margin-bottom: 0.5rem;
        padding-bottom: 0.4rem;
        border-bottom: 1px solid #ccc;
        page-break-inside: avoid;
    }

    .office-section h3 {
        font-size: 12pt;
        margin-bottom: 0.3rem;
    }

    .office-section h4 {
        font-size: 9pt;
        margin-top: 0.3rem;
        margin-bottom: 0.2rem;
    }

    .opening-sentence,
    .antiphon,
    .reading,
    .collect {
        margin-bottom: 0.4rem;
        page-break-inside: avoid;
    }

    .scripture,
    .lesson-ref,
    .psalm-ref,
    .collect p {
        font-size: 10pt;
        line-height: 1.3;
    }

    /* Compact readings */
    .readings {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .collects {
        page-break-inside: avoid;
    }

    /* Page breaks for all-days page */
    .page-break {
        page-break-after: always;
    }

    .page-break:last-child {
        page-break-after: auto;
    }

    /* Ensure sections stay together */
    .morning-prayer,
    .evening-prayer,
    .collects {
        page-break-inside: avoid;
    }
}

@media screen and (max-width: 768px) {
    .daily-office {
        margin: 1rem;
        padding: 1.5rem;
    }

    .navigation {
        padding: 0.75rem 1rem;
    }

    .liturgical-banner {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem 0;
    }

    .liturgical-seal {
        gap: 0.5rem;
    }

    .color-swatch {
        width: 50px;
        height: 50px;
    }

    .liturgical-label,
    .color-name {
        font-size: 0.7rem;
    }

    .index-header {
        padding: 4rem 1.5rem;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .hero-nav {
        position: absolute;
        top: 1rem;
        left: 1rem;
    }

    .nav-link-print {
        font-size: 0.75rem;
        padding: 0.6rem 1rem;
    }

    .index-header h1 {
        font-size: 2.5rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .site-description {
        font-size: 0.95rem;
        padding: 0 0.5rem;
    }

    .sacred-verse {
        font-size: 1.1rem;
        padding: 1.5rem;
        margin: 2rem auto;
    }

    .sacred-symbol {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }

    .calendar-day {
        min-height: 90px;
        padding: 0.5rem;
    }

    .calendar-day .day-number {
        font-size: 1.1rem;
    }

    .calendar-day .observance {
        font-size: 0.7rem;
        -webkit-line-clamp: 2;
    }

    .weekday-header {
        padding: 0.75rem 0.25rem;
        font-size: 0.75rem;
    }

    .month h2 {
        font-size: 1.5rem;
    }
}
