:root {
    --font-sans: 'Inter', sans-serif;
    --font-serif: 'Lora', serif;

    --background-color-light: #f8f9fa;
    --text-color-light: #212529;
    --primary-color-light: #0d6efd;
    --card-bg-light: #ffffff;
    --border-color-light: #dee2e6;
    --scrollbar-thumb-light: #adb5bd;
    --link-color-light: #1DB954;

    --background-color-dark: #121212;
    --text-color-dark: #e9ecef;
    --primary-color-dark: #4dabf7;
    --card-bg-dark: #1e1e1e;
    --border-color-dark: #343a40;
    --scrollbar-thumb-dark: #495057;
    --link-color-dark: #1ED760;


    --background-color: var(--background-color-light);
    --text-color: var(--text-color-light);
    --primary-color: var(--primary-color-light);
    --card-bg: var(--card-bg-light);
    --border-color: var(--border-color-light);
    --scrollbar-thumb: var(--scrollbar-thumb-light);
    --link-color: var(--link-color-light);
    
    font-size: 16px;
}

[data-theme="dark"] {
    --background-color: var(--background-color-dark);
    --text-color: var(--text-color-dark);
    --primary-color: var(--primary-color-dark);
    --card-bg: var(--card-bg-dark);
    --border-color: var(--border-color-dark);
    --scrollbar-thumb: var(--scrollbar-thumb-dark);
    --link-color: var(--link-color-dark);
}

a {
    color: var(--link-color);
}

a:hover {
    opacity: 0.8;
}

a.back-to-masses,
a.back-to-masses:hover,
a.back-to-masses:focus,
a.back-to-masses:active {
    color: inherit;
    text-decoration: none;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

body.landing-page {
    min-height: 100vh;
    overflow: hidden;
}

body.modal-open {
    overflow: hidden;
}

.font-size-small { font-size: 18px; }
.font-size-medium { font-size: 20px; }
.font-size-large { font-size: 22px; }
.font-size-xlarge { font-size: 24px; }

.landing-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
    padding: clamp(1rem, 3vw, 2rem);
    max-width: 960px;
    margin: 0 auto;
}

.landing-header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.landing-header p {
    font-size: 1.2rem;
    color: var(--text-color);
    opacity: 0.8;
    margin: 0;
}

.landing-main {
    margin-top: 1.25rem;
    margin-bottom: 8vh;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.date-selector {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.date-selector p {
    margin: 0;
}

.date-selector .input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.landing-logo {
    margin-top: 3rem;
    width: 3rem;
    height: 3rem;
    opacity: 0.5;
    user-select: none;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    box-sizing: border-box;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
}

.date-selector input[type="text"] {
    padding: 0.8rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-color);
    min-width: 170px;
    text-align: center;
    box-sizing: border-box;
    font-family: var(--font-sans);
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.readings-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.readings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 1rem;
    position: sticky;
    top: 0;
    background-color: var(--background-color);
    z-index: 10;
}

.home-link {
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--text-color);
}

.accessibility {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.accessibility button {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 5px;
    cursor: pointer;
    width: 35px;
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
}

.accessibility button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.theme-icon-light { display: none; }
.theme-icon-dark { display: block; }
[data-theme="dark"] .theme-icon-light { display: block; }
[data-theme="dark"] .theme-icon-dark { display: none; }


.date-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    text-align: center;
}

.date-nav-btn {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: var(--primary-color);
    padding: 0 0.5rem;
}

#reading-date-picker {
    padding: 0.5rem;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-color);
    font-family: var(--font-sans);
    font-size: 1rem;
    text-align: center;
    cursor: pointer;
    width: 150px;
}

.reading-section {
    margin-top: 5rem;
    margin-bottom: 5rem;
    padding-bottom: 5rem;
    border-bottom: 1px solid var(--border-color);
}

#reading-body > .reading-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.reading-meta {
    text-align: center;
    padding: 10rem 0 8rem;
    filter: drop-shadow(0 4px 2px rgba(0, 0, 0, 0.1));
}

.liturgical-title-main {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 2.2rem;
    margin: 0 0 0.25rem 0;
    line-height: 1.3;
}

.liturgical-title-alt {
    font-family: var(--font-serif);
    font-weight: normal;
    font-size: 1.2rem;
    margin: 0.75rem 0 0.25rem 0;
    line-height: 1.3;
}

.liturgical-subtitle {
    font-family: var(--font-sans);
    font-weight: normal;
    font-size: 1rem;
    opacity: 0.8;
    margin: 0;
}

.liturgical-cycle {
    font-family: var(--font-sans);
    font-weight: normal;
    font-size: 1rem;
    opacity: 0.8;
    margin-top: 1.5rem;
}

.info-span {
    cursor: help;
}

.reading-title {
    font-family: var(--font-sans);
    font-weight: 700;
    margin-bottom: 0;
    font-size: 1.1rem;
}

.reading-citation {
    font-family: var(--font-sans);
    font-style: italic;
    font-size: 1rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-top: 0.2rem;
    margin-bottom: 1rem;
}

.lectionary-number {
    font-size: 1.2rem;
}

.reading-text-paragraph {
    font-family: var(--font-serif);
    font-size: 1.1em;
    line-height: 1.8;
    margin-top: 0;
    margin-bottom: 1em;
}

.reading-text-paragraph:last-child {
    margin-bottom: 0;
}

.psalm-response {
    font-family: var(--font-serif);
    font-weight: 700;
    font-style: normal;
    font-size: 1.1em;
    line-height: 1.8;
    margin-top: 0;
    margin-bottom: 1em;
}

.reading-conclusion {
    font-family: var(--font-sans);
    font-weight: 700;
    margin-top: 1.5rem;
}

.reading-conclusion p {
    margin: 0.25rem 0;
}

.static-font-size {
    font-size: 1.1rem;
}

.or-divider {
    text-align: left;
    font-family: var(--font-sans);
    font-weight: 700;
    margin: 1.5rem 0;
    opacity: 0.8;
}

#reading-body-wrapper {
    position: relative;
    min-height: 100px;
}

.loader-container {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
    z-index: 20;
}

body.loading .loader-container {
    display: block;
}

.loader {
    display: inline-block;
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

#loading-verse {
    font-size: 0.9rem;
    margin-top: 1.5rem;
    opacity: 0.7;
    font-style: italic;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-message-container {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
    z-index: 20;
}

.error-logo {
    width: 10rem;
    height: 10rem;
    opacity: 0.5;
    margin-bottom: 1rem;
}

body.error .site-footer,
body.error #reading-body-wrapper {
    display: none;
}

.error-details {
    margin-top: 1rem;
    font-size: 0.8rem;
    font-family: monospace;
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    background: var(--card-bg);
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.flatpickr-calendar {
    background-color: var(--card-bg-light);
    border: 1px solid var(--border-color-light);
    left: 50% !important;
    transform: translateX(-50%) !important;
}
.flatpickr-day, .flatpickr-weekday {
    color: var(--text-color-light);
}
.flatpickr-day.today {
    border-color: var(--primary-color-light);
}
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange {
    background-color: var(--primary-color-light);
    border-color: var(--primary-color-light);
    color: #fff;
}
.flatpickr-months .flatpickr-month, .flatpickr-current-month .flatpickr-monthDropdown-months {
    color: var(--text-color-light);
}
.flatpickr-months .flatpickr-prev-month svg, .flatpickr-months .flatpickr-next-month svg {
    fill: var(--text-color-light);
}
.numInput, .arrowUp, .arrowDown {
    border: 1px solid var(--border-color-light) !important;
    color: var(--text-color-light) !important;
}

.site-footer {
    margin-top: 5rem;
    padding: 5rem 1rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.8;
}

.footer-logo {
    height: 60px;
    width: auto;
    margin: 0.5rem 0;
}

.footer-info p {
    margin: 0.2rem 0;
}

.church-name {
    font-weight: 700;
}

.cc-icons {
  width: 32px;
  display: flex;
  justify-content: center;
  margin: auto;
  padding: 2rem 0 1rem;
  gap: 4px;
  cursor: pointer;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--card-bg);
    color: var(--text-color);
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    font-size: 14px;
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
}

.modal-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.modal-section h3 {
    margin-top: 0;
}

.modal-section h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

html {
    scrollbar-color: var(--scrollbar-thumb) var(--background-color);
    scrollbar-width: thin;
}

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--background-color);
}

::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    border-radius: 6px;
    border: 3px solid var(--background-color);
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-color);
}

.modal-content::-webkit-scrollbar {
    width: 12px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--card-bg);
}

.modal-content::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    border-radius: 6px;
    border: 3px solid var(--card-bg);
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-color);
}


@media (max-width: 600px) {
    .home-link {
        font-size: 1.2rem;
    }

    .liturgical-title-main {
        font-size: 1.5rem;
    }
    .liturgical-subtitle {
        font-size: 1rem;
    }
}

body.loading #reading-body-wrapper,
body.loading .site-footer {
    display: none;
}