@font-face {
    font-family: 'Avva Shenouda';
    src: url('Avva_Shenouda.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --bg: #fdfdf9;
    --bg-card: #f8f7f2;
    --text: #2a2416;
    --text-light: #5a513d;
    --text-muted: #8a7f6a;
    --gold: #c9a961;
    --burgundy: #7a2828;
    --border: #d4cec0;
    --font-scale: 1.3;
}
[data-theme="dark"] {
    --bg: #1a1612;
    --bg-card: #231f18;
    --text: #e8e4d9;
    --text-light: #c4bead;
    --text-muted: #9a8f7a;
    --border: #3d3830;
    --burgundy: #d87070;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
a {
    color: var(--burgundy);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity 0.2s;
}
a:hover {
    opacity: 0.7;
}
html {
    font-size: calc(var(--font-scale) * 1em);
}
body {
    font-family: 'Crimson Pro', serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    transition: all 0.3s;
}
}
.container { max-width: 800px; margin: 0 auto; padding: 0; }
.btn:hover { transform: scale(1.05); }
.hour-header {
    text-align: center;
    padding: calc(3rem + env(safe-area-inset-top)) 0.625rem 2rem;
    border-bottom: 1px solid var(--border);
}
.hour-num {
    font-family: 'EB Garamond', serif;
    font-size: 4rem;
    color: var(--gold);
    font-weight: 700;
    line-height: 1;
}
.header-crosses {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.header-crosses img {
    width: 120px;
    height: auto;
    opacity: 0.9;
    filter: brightness(0) saturate(100%) invert(22%) sepia(18%) saturate(1844%) hue-rotate(314deg) brightness(92%) contrast(90%);
}
[data-theme="dark"] .header-crosses img {
    filter: brightness(0) saturate(100%) invert(56%) sepia(30%) saturate(1026%) hue-rotate(312deg) brightness(93%) contrast(89%);
}
.hour-title {
    font-family: 'EB Garamond', serif;
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--burgundy);
    margin: 0.5rem 0;
}
.hour-time {
    color: var(--text-muted);
    font-size: 1.1rem;
}
.section {
    margin-bottom: 3rem;
    max-width: calc(850px * var(--font-scale));
    margin-left: auto;
    margin-right: auto;
    padding: 0 0.625rem;
}
.section-title {
    font-family: 'EB Garamond', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--burgundy);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}
.prayer-text {
    font-size: 1.1rem;
    line-height: 1.9;
    margin-bottom: 1.5rem;
}
.prayer-text em {
    color: var(--burgundy);
    font-style: italic;
}
.psalm-verse {
    font-size: 1.1rem;
    line-height: 1.9;
    margin-bottom: 1rem;
}
/* Alleluia row - flex container for Alleluia text and Jump to Gospel link */
.alleluia-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.25rem;
    margin-bottom: 1rem;
}

.jump-gospel-btn {
    display: block;
    width: fit-content;
    padding: 0.3rem 0;
    font-size: 0.75rem;
    color: var(--burgundy);
    border: none;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}
.jump-gospel-btn:hover {
    opacity: 0.7;
}
@media (max-width: 600px) {
    .jump-gospel-btn {
        font-size: 0.7rem;
    }
}
.ornament {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 32px;
    direction: ltr;
    color: var(--gold);
    font-size: 1.5rem;
    margin: 2rem 0;
}
.ornament-cross {
    height: 36px;
    width: 36px;
    opacity: 0.9;
    filter: brightness(0) saturate(100%) invert(22%) sepia(18%) saturate(1844%) hue-rotate(314deg) brightness(92%) contrast(90%);
}
[data-theme="dark"] .ornament-cross {
    filter: brightness(0) saturate(100%) invert(56%) sepia(30%) saturate(1026%) hue-rotate(312deg) brightness(93%) contrast(89%);
}
.nav-hours {
    display: flex;
    gap: 0.625rem;
    padding: 2rem 0.625rem;
    border-top: 1px solid var(--border);
    overflow-x: auto;
}
.nav-hour {
    flex-shrink: 0;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    text-align: center;
    transition: all 0.2s;
}
.nav-hour:hover {
    background: var(--burgundy);
    color: var(--bg);
    border-color: var(--burgundy);
}
.nav-hour-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gold);
}
.nav-hour:hover .nav-hour-num { color: var(--bg); }

/* Navigation Overlay (Hamburger Menu) */
.nav-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    overflow-y: auto;
}
.nav-overlay.active { opacity: 1; visibility: visible; }
.nav-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text);
}
.nav-list {
    list-style: none;
    max-width: 600px;
    margin: 5rem auto 2rem;
    padding: 0 2rem;
}
.nav-item {
    border-bottom: 1px solid var(--border);
}
.nav-link {
    display: flex;
    justify-content: space-between;
    padding: 1.5rem 0;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}
.nav-link:hover { padding-left: 1rem; color: var(--burgundy); }


body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top);
    background: color-mix(in srgb, var(--bg-card) 80%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 101;
}

/* Add scroll margin to account for sticky headers */
.section {
    scroll-margin-top: calc((60px * var(--font-scale)) + env(safe-area-inset-top)); /* Sticky subheader (~40px) + buffer + notch */
}

/* Sticky Subheader */
.sticky-subheader {
    position: sticky;
    top: env(safe-area-inset-top);
    background: var(--bg-card); /* fallback */
    background: color-mix(in srgb, var(--bg-card) 80%, transparent);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    padding: 0;
    display: flex;
    align-items: stretch;
    font-size: 0.9rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
.sticky-subheader .hour-label {
    font-weight: 400;
    color: var(--text-light);
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sticky-subheader .section-dropdown {
    flex: 1 1 0%;
    min-width: 0;
    font-family: 'Crimson Pro', serif;
    font-size: 0.9rem;
    font-style: normal;
    color: var(--burgundy);
    background: transparent;
    border: none;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-radius: 0;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-weight: 600;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237a2828'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}
.sticky-subheader .section-dropdown:hover {
    background: rgba(0,0,0,0.04);
}
.prayer-content {
    padding: 2rem 0.625rem;
}
.sticky-subheader .hour-dropdown {
    flex: 0 0 auto;
    font-family: 'Crimson Pro', serif;
    font-size: 0.9rem;
    font-style: normal;
    color: var(--text-light);
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    width: fit-content;
    max-width: 130px;
    min-width: 115px;
    font-weight: 400;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235a513d'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 1.75rem;
}
.sticky-subheader .hour-dropdown:hover {
    background: rgba(0,0,0,0.04);
}
[data-theme="dark"] .sticky-subheader .section-dropdown:hover,
[data-theme="dark"] .sticky-subheader .hour-dropdown:hover {
    background: rgba(255,255,255,0.06);
}
[data-theme="dark"] .sticky-subheader .section-dropdown {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23d87070'/%3E%3C/svg%3E");
}
[data-theme="dark"] .sticky-subheader .hour-dropdown {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23c4bead'/%3E%3C/svg%3E");
}
@media (max-width: 768px) {
    .sticky-subheader {
        font-size: 0.8rem;
    }
    .sticky-subheader .hour-label {
        font-size: 0.75rem;
        max-width: 180px;
    }
    .sticky-subheader .section-dropdown {
        font-size: 0.7rem;
        padding: 0.4rem 0.5rem;
        padding-right: 1.5rem;
        background-position: right 0.5rem center;
    }
    .sticky-subheader .hour-dropdown {
        font-size: 0.7rem;
        max-width: 110px;
        min-width: 90px;
        padding: 0.4rem 0.5rem;
        padding-right: 1.5rem;
        background-position: right 0.35rem center;
    }
}

/* Settings icon button (cell 3 - fixed width) */
.settings-btn {
    flex: 0 0 auto;
    background: transparent;
    border: none;
    padding: 0.5rem 0.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.settings-btn img {
    width: calc(22px * var(--font-scale) / 1.3);
    height: calc(22px * var(--font-scale) / 1.3);
    display: block;
}
.settings-btn:hover {
    background: rgba(0,0,0,0.04);
}
[data-theme="dark"] .settings-btn:hover {
    background: rgba(255,255,255,0.06);
}
[data-theme="dark"] .settings-btn img {
    content: url('cog_wheel_dark.png');
}

/* Floating settings menu */
.settings-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 100;
    min-width: 200px;
}
.settings-menu.active {
    display: flex;
}

/* Settings row - horizontal layout */
.settings-row {
    display: flex;
    gap: 0.375rem;
    width: 100%;
}

/* Settings menu buttons */
.settings-menu-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.625rem;
    cursor: pointer;
    font-family: 'Crimson Pro', serif;
    font-size: 0.95rem;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
    flex: 1;
}
.settings-menu-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

/* Small font size buttons - equal width in row */
.settings-menu-btn-small {
    font-size: 0.85rem;
    padding: 0.5rem 0.4rem;
}

/* Active state for font reset button at 100% */
.settings-menu-btn-small.active {
    background: var(--burgundy);
    color: var(--bg);
    border-color: var(--burgundy);
}

.settings-menu-btn-small.active:hover {
    background: var(--burgundy);
    color: var(--bg);
    opacity: 0.9;
}

/* Toggle buttons with active state */
.settings-toggle {
    position: relative;
}

.settings-toggle.active {
    background: var(--burgundy);
    color: var(--bg);
    border-color: var(--burgundy);
}

.settings-toggle.active:hover {
    background: var(--burgundy);
    color: var(--bg);
    opacity: 0.9;
}

/* Remove light mode specific overrides - use default burgundy for all themes */

/* Line height icon */
.line-height-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.line-height-icon .line {
    width: 100%;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}

/* Comfy spacing - lines furthest apart */
.comfy-icon {
    gap: 6px;
}

/* Default spacing - medium gap */
.default-icon {
    gap: 3px;
}

/* Condensed spacing - lines closest together */
.condensed-icon {
    gap: 1px;
}
    background: var(--border);
}

@media (max-width: 768px) {
    .settings-btn {
        padding: 0.4rem 0.5rem;
    }
    .settings-menu {
        min-width: 150px;
    }
    .settings-menu-btn {
        font-size: 0.85rem;
        padding: 0.5rem;
    }
}


/* Hour description */
.hour-desc {
    color: var(--text-light);
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: calc(850px * var(--font-scale));
    margin: 1.5rem auto 0;
    text-align: left;
    padding: 0 0.625rem;
}



/* Make all sticky nav items scale with font size */
.sticky-subheader .hour-dropdown,
.sticky-subheader .section-dropdown {
    height: auto;
    min-height: 40px;
    display: flex;
    align-items: center;
    line-height: 1.4;
    box-sizing: border-box;
    font-size: calc(0.8rem * var(--font-scale));
    vertical-align: middle;
}

.settings-btn {
    min-height: 40px;
}

/* Ensure dropdown options also scale */
.sticky-subheader .hour-dropdown option,
.sticky-subheader .section-dropdown option {
    line-height: 1.6;
    padding: 0.5rem;
}

@media (max-width: 768px) {
    .sticky-subheader .hour-dropdown,
    .sticky-subheader .section-dropdown {
        min-height: 36px;
        line-height: 1.3;
        font-size: calc(0.7rem * var(--font-scale));
    }
    
    .settings-btn {
        min-height: 36px;
    }
}

/* Settings menu buttons scale with font size */
.settings-menu-btn {
    font-size: calc(0.9rem * var(--font-scale));
    padding: calc(0.625rem * var(--font-scale));
    line-height: 1.4;
}

/* Settings menu positioning adjusts with font scale */
.settings-menu {
    min-width: calc(180px * var(--font-scale));
}

@media (max-width: 768px) {
    .settings-menu-btn {
        font-size: calc(0.8rem * var(--font-scale));
        padding: calc(0.5rem * var(--font-scale));
    }
    .settings-menu {
        min-width: calc(150px * var(--font-scale));
    }
}

/* Coptic text styling */
.coptic-text {
    font-family: 'Avva Shenouda', serif;
    font-size: 1.05em;
    letter-spacing: 0.02em;
}

/* Annotation within Coptic text (e.g. "(41 times)") - reset to body font */
.coptic-annotation {
    font-family: 'Crimson Pro', serif;
    font-size: 0.9em;
    letter-spacing: normal;
}





/* Two-column Coptic and English layout */
.doxology {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem; /* 10px */
    align-items: start;
}

.doxology-coptic,
.doxology-english {
    color: var(--burgundy);
}

.doxology-coptic {
    font-family: 'Avva Shenouda', serif;
    font-size: 0.9em; /* 10% smaller to visually match English */
    letter-spacing: 0.02em;
    text-align: left;
}

.doxology-english {
    font-size: 1em; /* Standard size */
    text-align: left;
}

.doxology-separator {
    display: none;
}

@media (max-width: 600px) {
    .doxology {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

}

[data-line-height="comfy"] .hour-desc {
    line-height: 1.7;
}

[data-line-height="condensed"] .hour-desc {
    line-height: 1.5;
}

/* Line height settings */
[data-line-height="comfy"] .prayer-text,
[data-line-height="comfy"] .psalm-verse,
[data-line-height="comfy"] .litany-text {
    line-height: 1.8;
}

[data-line-height="default"] .prayer-text,
[data-line-height="default"] .psalm-verse,
[data-line-height="default"] .litany-text {
    line-height: 1.5;
}

[data-line-height="condensed"] .prayer-text,
[data-line-height="condensed"] .psalm-verse,
[data-line-height="condensed"] .litany-text {
    line-height: 1.3;
}

[data-line-height="comfy"] .hour-desc {
    line-height: 1.7;
}

[data-line-height="default"] .hour-desc {
    line-height: 1.5;
}

[data-line-height="condensed"] .hour-desc {
    line-height: 1.3;
}

/* Section header line height */
[data-line-height="comfy"] .section-title {
    line-height: 1.8;
}

[data-line-height="default"] .section-title {
    line-height: 1.5;
}

[data-line-height="condensed"] .section-title {
    line-height: 1.3;
}

/* Doxology/litany response line height */
/* English line heights */
[data-line-height="comfy"] .doxology-english {
    line-height: 1.8;
}

[data-line-height="default"] .doxology-english {
    line-height: 1.5;
}

[data-line-height="condensed"] .doxology-english {
    line-height: 1.3;
}

/* Coptic line heights (15% larger than English for readability) */
[data-line-height="comfy"] .doxology-coptic {
    line-height: 2.07; /* 1.8 * 1.15 */
}

[data-line-height="default"] .doxology-coptic {
    line-height: 1.725; /* 1.5 * 1.15 */
}

[data-line-height="condensed"] .doxology-coptic {
    line-height: 1.495; /* 1.3 * 1.15 */
}

/* Drop cap styling */
.drop-cap::first-letter {
    float: left;
    font-size: 3.5em;
    line-height: 0.85;
    padding-right: 10px;
    font-family: 'EB Garamond', serif;
    font-weight: 400;
    color: var(--burgundy);
}

/* RTL drop cap - disabled for Arabic */
.drop-cap[dir="rtl"]::first-letter {
    float: none;
    font-size: inherit;
    line-height: inherit;
    padding: 0;
    font-family: inherit;
    color: inherit;
}

/* Adjust drop cap size for different line heights */
[data-line-height="comfy"] .drop-cap::first-letter {
    font-size: 4.025em; /* 3.5em * 1.15 = 4.025em */
}

[data-line-height="condensed"] .drop-cap::first-letter {
    font-size: 4.025em; /* 3.5em * 1.15 = 4.025em */
}

/* ALLELUIA styling */
.alleluia {
    color: var(--burgundy);
    font-style: italic;
}

/* Litany number styling */
.litany-number {
    color: var(--burgundy);
    font-weight: 700;
}

/* ============================================================================
   LANGUAGE TOGGLE
   ============================================================================ */

/* Default: show English, hide Arabic */
body.lang-en [lang="ar"],
body:not(.lang-ar) [lang="ar"] {
    display: none;
}

/* Arabic mode: show Arabic, hide English */
body.lang-ar [lang="en"] {
    display: none;
}
body.lang-ar [lang="ar"] {
    display: revert;
}

/* RTL support for Arabic */
body.lang-ar .prayer-text,
body.lang-ar .prayer-content,
body.lang-ar .hour-desc,
body.lang-ar .section-title {
    direction: rtl;
    text-align: right;
}

body.lang-ar .hour-dropdown,
body.lang-ar .section-dropdown {
    direction: rtl;
}

body.lang-ar .sticky-subheader,
body.lang-ar .nav-hours {
    direction: rtl;
}

/* In RTL, flip the cell border sides */
body.lang-ar .sticky-subheader .section-dropdown {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background-position: left 0.75rem center;
    padding-left: 2rem;
    padding-right: 0.75rem;
}
body.lang-ar .sticky-subheader .hour-dropdown {
    background-position: left 0.5rem center;
    padding-left: 1.75rem;
    padding-right: 0.75rem;
}

body.lang-ar .settings-menu {
    right: auto;
    left: 0;
}

/* Doxology in Arabic mode: keep grid LTR so Coptic stays left, Arabic stays right */
body.lang-ar .doxology {
    direction: ltr;
    text-align: left;
}

/* Coptic text always LTR and left-aligned */
body.lang-ar .doxology-coptic {
    direction: ltr;
    text-align: left;
}

/* Arabic translation in doxology: RTL and right-aligned */
body.lang-ar .doxology-english[lang="ar"] {
    direction: rtl;
    text-align: right;
}

/* Contact Form */
.contact-form {
    max-width: 540px;
    margin: 0 auto;
}
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-family: 'EB Garamond', serif;
    font-size: 0.95rem;
    color: var(--text-light);
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    font-family: 'EB Garamond', serif;
    font-size: 1rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--burgundy);
}
.form-group textarea {
    resize: vertical;
    min-height: 120px;
}
.form-submit {
    text-align: right;
}
.form-submit button {
    font-family: 'EB Garamond', serif;
    font-size: 0.95rem;
    padding: 0.45rem 1.5rem;
    color: var(--bg);
    background: var(--burgundy);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.form-submit button:hover {
    opacity: 0.85;
}

/* ============================================================================
   FOOTNOTES
   ============================================================================ */

/* Footnote link styling - subtle dotted underline */
.footnote-link {
    text-decoration: underline dotted;
    text-decoration-color: var(--burgundy);
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
    cursor: pointer;
}
.footnote-link:hover {
    text-decoration-color: var(--burgundy);
}

/* Hide footnote styling when footnotes are disabled */
body.footnotes-off .footnote-link {
    text-decoration: none;
    cursor: inherit;
    pointer-events: none;
}

/* Footnote drawer overlay (dim background) */
.footnote-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.footnote-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Footnote drawer */
.footnote-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 80vh;
    background: var(--bg-card);
    background: color-mix(in srgb, var(--bg-card) 85%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
}
.footnote-drawer.active {
    transform: translateY(0);
}

/* Drawer handle */
.footnote-drawer-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 4px;
    cursor: grab;
    flex-shrink: 0;
}
.footnote-drawer-handle::after {
    content: '';
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
}

/* Drawer header */
.footnote-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.25rem 0.5rem;
    flex-shrink: 0;
    gap: 0.5rem;
}
.footnote-drawer-title {
    font-family: 'EB Garamond', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--burgundy);
    flex-shrink: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Pagination widget */
.footnote-pagination {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}
.footnote-page-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--burgundy);
    font-size: 1.1rem;
    line-height: 1;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}
.footnote-page-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] .footnote-page-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
}
.footnote-page-btn:disabled {
    opacity: 0.3;
    cursor: default;
}
.footnote-page-indicator {
    font-family: 'Crimson Pro', serif;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.footnote-drawer-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    line-height: 1;
    transition: all 0.2s;
}
.footnote-drawer-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text);
}
[data-theme="dark"] .footnote-drawer-close:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Drawer body - scrollable, matches prayer-text styling */
.footnote-drawer-body {
    overflow-y: auto;
    padding: 0 1.25rem 1.5rem;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.footnote-drawer-body p {
    font-family: 'Crimson Pro', serif;
    font-size: 1.1rem;
    line-height: 1.9;
    color: var(--text);
    margin-bottom: 0.75rem;
}
.footnote-drawer-body p:last-child {
    margin-bottom: 0;
}
.footnote-drawer-body em {
    color: var(--burgundy);
    font-style: italic;
}
.footnote-drawer-body blockquote {
    margin: 0.75rem 1.5rem;
    padding: 0.5rem 1rem;
    border-left: 3px solid var(--burgundy);
    font-style: italic;
    color: var(--text-muted);
}
.footnote-drawer-body .footnote-fig {
    float: right;
    width: 175px;
    margin: 0 0 0.75rem 1rem;
}
.footnote-drawer-body .footnote-fig img {
    width: 175px;
    height: 175px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}
.footnote-drawer-body .footnote-fig figcaption {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.25rem;
    line-height: 1.3;
}

/* Footnote line-height respects global setting */
[data-line-height="comfy"] .footnote-drawer-body p {
    line-height: 1.8;
}
[data-line-height="default"] .footnote-drawer-body p {
    line-height: 1.5;
}
[data-line-height="condensed"] .footnote-drawer-body p {
    line-height: 1.3;
}

/* Source section at bottom of drawer - compact one-liner */
.footnote-drawer-source {
    flex-shrink: 0;
    padding: 0.4rem 1.25rem;
    border-top: 1px solid var(--border);
    font-family: 'Crimson Pro', serif;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}
.footnote-drawer-source-label {
    font-weight: 600;
    color: var(--text-light);
    flex-shrink: 0;
}
.footnote-drawer-source a {
    color: var(--burgundy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* RTL support for footnote drawer */
body.lang-ar .footnote-drawer-header {
    direction: rtl;
}
body.lang-ar .footnote-drawer-body {
    direction: rtl;
    text-align: right;
}
body.lang-ar .footnote-drawer-body .footnote-fig {
    float: left;
    margin: 0 1rem 0.75rem 0;
}
body.lang-ar .footnote-drawer-body blockquote {
    border-left: none;
    border-right: 3px solid var(--burgundy);
}
body.lang-ar .footnote-drawer-source {
    direction: rtl;
    text-align: right;
}
/* ============================================
   Google Sign-In / User Account
   Paste this at the end of agpeya-style.css
   ============================================ */

/* Sign-In Card */
.sign-in-card {
    text-align: center;
    padding: 1rem 0.5rem;
}
.sign-in-heading {
    font-family: 'EB Garamond', serif;
    font-size: calc(1.15rem * var(--font-scale));
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}
.sign-in-subtitle {
    font-size: calc(0.85rem * var(--font-scale));
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Google Sign-In Button */
.google-sign-in-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 100px;
    background: var(--bg-card);
    cursor: pointer;
    font-family: 'Crimson Pro', serif;
    font-size: calc(1rem * var(--font-scale));
    font-weight: 600;
    color: var(--text);
    transition: background 0.2s, box-shadow 0.2s;
}
.google-sign-in-btn:hover {
    background: rgba(0,0,0,0.04);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
[data-theme="dark"] .google-sign-in-btn {
    background: #3a3530;
}
[data-theme="dark"] .google-sign-in-btn:hover {
    background: #443f38;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* User Profile (signed in) */
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
}
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}
.user-name {
    font-family: 'Crimson Pro', serif;
    font-size: calc(0.85rem * var(--font-scale));
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sign Out Button */
.sign-out-btn {
    color: var(--burgundy);
    font-size: calc(0.8rem * var(--font-scale));
    width: 100%;
    text-align: center;
}

/* Settings button avatar (when signed in) */
.settings-btn img.settings-btn-avatar {
    border-radius: 50%;
    object-fit: cover;
    width: 28px !important;
    height: 28px !important;
}
.settings-btn.has-avatar {
    padding: 0.25rem 0.4rem;
}
[data-theme="dark"] .settings-btn img.settings-btn-avatar {
    content: unset;
}

/* Settings Divider */
.settings-divider {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

/* Hide sign-in section in iOS app */
.capacitor-app #accountSection,
.capacitor-app #accountSection + .settings-divider {
    display: none;
}

/* Sign-In Error Message */
.sign-in-error {
    margin-top: 0.75rem;
    padding: 0.625rem;
    background: rgba(122, 40, 40, 0.08);
    border-radius: 8px;
    text-align: center;
    font-size: calc(0.8rem * var(--font-scale));
    color: var(--burgundy);
    line-height: 1.5;
}
.sign-in-error-help {
    margin-top: 0.25rem;
    font-size: calc(0.75rem * var(--font-scale));
    color: var(--text-muted);
}
[data-theme="dark"] .sign-in-error {
    background: rgba(216, 112, 112, 0.1);
}
