/* The beige theme (December 2026 design): parchment background with Coptic crosses, glassy
   warm cards with a dark brown outline, the GE Arabic fonts, and reading pages drawn as a white
   page in a ruled frame with a Coptic cross at each corner. Loaded after app.css; it changes the
   brand colours app.css is built on, then restyles the pieces the design changes. */

/* GE fonts (Boutros International): Arabic only, so Latin text and digits in Latin keep Cairo. */
@font-face {
    font-family: 'GE Dinar Two';
    src: url('../fonts/ge/ge-dinar-two-light.woff2') format('woff2');
    font-weight: 100 450;
    font-display: block; /* preloaded: a short wait instead of a fallback font first */
    unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200D, U+00AB, U+00BB, U+201C-201D;
}
@font-face {
    font-family: 'GE Dinar Two';
    src: url('../fonts/ge/ge-dinar-two-medium.woff2') format('woff2');
    font-weight: 451 900;
    font-display: block; /* preloaded: a short wait instead of a fallback font first */
    unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200D, U+00AB, U+00BB, U+201C-201D;
}
@font-face {
    font-family: 'GE Hili';
    src: url('../fonts/ge/ge-hili-book.woff2') format('woff2');
    font-weight: 100 900;
    font-display: block; /* preloaded: a short wait instead of a fallback font first */
    unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200D, U+201C-201D;
}
/* Amiri (Khaled Hosny, SIL Open Font Licence: assets/fonts/amiri/OFL-Amiri.txt): a Naskh in the
   style of the Bulaq press, Arabic letters only. */
@font-face {
    font-family: 'Amiri';
    src: url('../fonts/amiri/amiri-regular.woff2') format('woff2');
    font-weight: 100 749; /* the reading text is set at 700: in Amiri it reads in the regular face */
    font-display: block;
    unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+00AB, U+00BB, U+201C-201D, U+25CC;
}
@font-face {
    font-family: 'Amiri';
    src: url('../fonts/amiri/amiri-bold.woff2') format('woff2');
    font-weight: 750 900;
    font-display: block;
    unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+00AB, U+00BB, U+201C-201D, U+25CC;
}
@font-face {
    font-family: 'GE Flow';
    src: url('../fonts/ge/ge-flow-regular.woff2') format('woff2');
    font-weight: 100 900;
    font-display: block; /* preloaded: a short wait instead of a fallback font first */
    unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200D, U+00AB, U+00BB, U+201C-201D;
}

:root {
    --font-ui: 'GE Dinar Two', 'Cairo', var(--coptic-font), sans-serif;
    --font-quote: 'GE Hili', 'GE Dinar Two', 'Cairo', var(--coptic-font), sans-serif;
    --font-flow: 'GE Flow', 'GE Dinar Two', 'Cairo', var(--coptic-font), sans-serif;

    /* app.css builds on these: the whole app moves from navy to brown */
    --brand-navy: #3a1c13;
    --brand-oxblood: #8e1408;
    --brand-deep-red: #4a1d12;
    --brand-gold: #ecc99a;
    --brand-grey: #f1e2c4;
    --page-bg: #f1e2c4;
    --page-text: #24160f;
    --surface-text: #2c1a12;
    --muted-text: #6e5643;
    --border-soft: rgba(74, 29, 18, 0.22);
    --modal-overlay: rgba(42, 22, 14, 0.78);

    --ink: #24160f;
    --ink-soft: #5d4535;
    --outline: #440b00;
    --tab-red: #990000;
    /* The tile rectangle from the Figma design: #581D00 at 20% fading into #BE3F00, top right to
       bottom (handles (1.07, 0) → (0.5, 1) on a 606 × 172 tile ≈ 243deg), the layer at about 25%
       opacity, as the mockup's colours show; outline #440B00, 2 px; radius 34 px; shadow 0 4 5 5%. */
    --glass: linear-gradient(243deg, rgba(88, 29, 0, 0.05) 0%, rgba(190, 63, 0, 0.25) 100%);
    --tile-shadow: 0 4px 5px rgba(0, 0, 0, 0.05);
    --glass-strong: linear-gradient(165deg, rgba(214, 186, 150, 0.62) 0%, rgba(196, 160, 120, 0.55) 100%);
    --banner: linear-gradient(90deg, #5c2719 0%, #7a4632 52%, #a3805f 100%);
    --banner-text: #fff7ea;
    --paper: #ffffff;
    --paper-ink: #111111;
    --paper-shadow: 0 14px 44px rgba(92, 56, 24, 0.22);
    --page-image: url('../img/background-land.webp');
}

:root[data-color-theme="dark"] {
    /* still dark: app.css paints buttons with it under light text */
    --brand-navy: #5a3a28;
    --brand-oxblood: #b8321f;
    --page-bg: #17100b;
    --page-text: #f2e5cf;
    --surface-bg: #24180f;
    --surface-text: #f2e5cf;
    --muted-text: #c8b296;
    --border-soft: rgba(233, 201, 160, 0.22);
    --modal-overlay: rgba(10, 6, 4, 0.86);

    --ink: #f2e5cf;
    --ink-soft: #cdb597;
    --outline: rgba(233, 201, 160, 0.55);
    --tab-red: #a8160c;
    --glass: linear-gradient(243deg, rgba(88, 29, 0, 0.3) 0%, rgba(190, 63, 0, 0.32) 100%);
    --tile-shadow: 0 4px 5px rgba(0, 0, 0, 0.25);
    --glass-strong: linear-gradient(165deg, rgba(88, 62, 42, 0.62) 0%, rgba(62, 42, 28, 0.6) 100%);
    --banner: linear-gradient(90deg, #3a170e 0%, #552c1e 55%, #6f5039 100%);
    --paper: #1e1510;
    --paper-ink: #efe0c6;
    --paper-shadow: 0 14px 44px rgba(0, 0, 0, 0.45);
    --page-image: url('../img/background-land-dark.webp');
}

body {
    font-family: var(--font-ui);
    background-color: var(--page-bg);
    color: var(--page-text);
}

/* The parchment stays still behind the page (a fixed layer, as iOS ignores background-attachment). */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--page-bg) var(--page-image) center / cover no-repeat;
    pointer-events: none;
}

/* Phones and tablets held upright get the portrait copy, so it is never stretched */
@media (orientation: portrait) {
    :root { --page-image: url('../img/background-port.webp'); }
    :root[data-color-theme="dark"] { --page-image: url('../img/background-port-dark.webp'); }
}

h1, h2, h3, h4, h5, h6, .display-large { font-family: var(--font-ui); font-weight: 500; }

/* ---------- Top buttons: logo and gear on the left; the red «الرجوع» tab ---------- */

.app-logo-nav,
.burger-nav {
    left: 22px;
    right: auto;
    width: 66px;
    height: 66px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(74, 29, 18, 0.18);
}
.app-logo-nav { top: 22px; }
.app-logo-nav img { width: 50px; height: 50px; }
.burger-nav { top: 102px; color: #5a2a1c; font-size: 1.15rem; }
.burger-nav .fa-lg { font-size: 1.7em; }

.back-nav {
    top: 186px;
    left: 0;
    width: 62px;
    height: auto;
    padding: 18px 4px 16px;
    border-radius: 0 6px 6px 0;
    flex-direction: column;
    gap: 8px;
    background: var(--tab-red);
    color: #fff;
    font-family: var(--font-ui);
    font-size: 0.98rem;
    box-shadow: 4px 6px 16px rgba(60, 10, 0, 0.25);
}
.back-nav:hover { color: #fff; filter: brightness(1.08); }
.back-nav i { font-size: 1.35rem; }

.to-top-nav { background: #fff; color: #5a2a1c; }
:root[data-color-theme="dark"] .burger-nav,
:root[data-color-theme="dark"] .to-top-nav { background: #4a3324; color: #f0dcb8; box-shadow: 0 0 0 1.5px rgba(233, 201, 160, 0.45), 0 6px 18px rgba(0, 0, 0, 0.4); }
:root[data-color-theme="dark"] .app-logo-nav { background: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); }

/* Room on the left for the fixed buttons on wide screens */
@media (min-width: 992px) {
    main.container { max-width: min(1320px, calc(100vw - 210px)); }
}

@media (max-width: 991.98px) {
    .app-logo-nav, .burger-nav { top: 14px; width: 54px; height: 54px; }
    .app-logo-nav { left: 14px; }
    .app-logo-nav img { width: 40px; height: 40px; }
    .burger-nav { left: 78px; }
    .back-nav { top: 150px; width: 46px; padding: 12px 2px; font-size: 0.78rem; gap: 4px; }
    .back-nav i { font-size: 1.05rem; }
}

/* ---------- Glass cards (home, reader toolbars) ---------- */

.glass-card {
    background: var(--glass);
    border: 2px solid var(--outline);
    border-radius: 34px;
    color: var(--ink);
    box-shadow: var(--tile-shadow);
}

.reader-toolbar,
.reader-controls-card,
.install-tip {
    background: var(--glass) !important;
    border: 1.5px solid var(--outline);
    color: var(--ink) !important;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

/* ---------- Home ----------
   Sizes follow the mockup (content 1970 px wide there): every length below is that length
   divided by 1970, in cqi (1cqi = 1% of the home column's width), so the boxes keep the
   mockup's proportions at any desktop width. */

.home-v2 {
    container-type: inline-size;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2.8cqi;             /* 55 px */
    color: var(--ink);
}
.today-loading #homeGrid { display: none; }

.home-welcome {
    display: flex;
    align-items: center;
    gap: 2.8cqi;
    min-height: 14.2cqi;     /* 280 px */
    padding: 1.4cqi 2.2cqi;
    border-radius: 2.6cqi;
    background: var(--glass-strong);
    border: 0;
}
.home-welcome-title { flex: 1 1 auto; min-width: 0; }
.home-welcome h1 {
    margin: 0;
    font-weight: 500;
    font-size: 3.9cqi;
    line-height: 1.3;
    color: var(--ink);
}
.home-welcome p {
    margin: 0.6cqi 0 0;
    font-weight: 300;
    font-size: 2.5cqi;
    color: var(--ink);
}
.home-welcome-date {
    flex: 0 0 auto;
    display: grid;
    padding-inline-start: 3.2cqi;
    border-inline-start: 2px solid var(--outline);
    color: var(--ink);
    font-weight: 300;
    font-size: 2.15cqi;
    line-height: 1.45;
    text-align: start;
}
.home-welcome-date:hover { color: var(--ink); }
.home-welcome-date:hover span:first-child { text-decoration: underline; text-underline-offset: 5px; }
.home-welcome-date strong { font-weight: 500; }

.home-verse {
    display: flex;
    align-items: center;
    gap: 3cqi;
    min-height: 7.7cqi;      /* 152 px */
    padding: 1cqi 2.6cqi;
    border-radius: 2.6cqi;
    background: var(--banner);
    color: var(--banner-text);
    box-shadow: 0 10px 26px rgba(70, 30, 16, 0.22);
}
.home-verse:hover { color: var(--banner-text); }
.home-verse-text {
    flex: 1 1 auto;
    margin: 0;
    font-family: var(--font-flow);
    font-size: 2cqi;
    line-height: 1.6;
}
.home-verse-ref {
    flex: 0 0 auto;
    display: grid;
    text-align: center;
    font-family: var(--font-flow);
}
.home-verse-ref strong { font-weight: 400; font-size: 2.3cqi; }
.home-verse-ref small { opacity: 0.8; font-family: var(--font-ui); font-weight: 300; font-size: 1cqi; }

/* RTL grid, first column on the right: 283 | 620 | 283 283 283 px, gaps 55 px,
   small tiles 283 × 270 px, the Bible tile two rows high */
.home-tiles {
    display: grid;
    grid-template-columns: minmax(0, 283fr) minmax(0, 620fr) minmax(0, 283fr) minmax(0, 283fr) minmax(0, 283fr);
    grid-template-areas:
        "alhan  bible agpeya  agpeya   agpeya"
        "coptic bible vespers psalmody liturgy";
    gap: 2.8cqi;
}
.home-tile {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.6cqi 1.2cqi;
    border-radius: 2.74cqi;   /* 34 px */
    text-align: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.tile-alhan, .tile-coptic, .tile-vespers, .tile-psalmody, .tile-liturgy { aspect-ratio: 283 / 270; }
.home-tile:hover { color: var(--ink); transform: translateY(-3px); box-shadow: 0 10px 18px rgba(0, 0, 0, 0.1); }
.home-tile-title {
    font-weight: 500;
    font-size: 3.2cqi;
    line-height: 1.3;
}
.tile-alhan { grid-area: alhan; }
.tile-coptic { grid-area: coptic; }
.tile-bible { grid-area: bible; justify-content: flex-start; align-items: stretch; text-align: start; padding: 2.4cqi 2.2cqi; }
.tile-agpeya { grid-area: agpeya; justify-content: flex-start; align-items: flex-start; text-align: start; padding: 2.4cqi 2.8cqi; }
.tile-vespers { grid-area: vespers; }
.tile-psalmody { grid-area: psalmody; }
.tile-liturgy { grid-area: liturgy; }

.tile-bible .home-tile-title,
.tile-agpeya .home-tile-title { font-size: 4.2cqi; white-space: nowrap; }

.home-agpeya-now {
    margin-top: auto;
    font-weight: 300;
    font-size: 2.2cqi;
}
.home-agpeya-now strong { font-weight: 500; }

.home-psalm { display: grid; gap: 1cqi; margin-top: 2.6cqi; }
.home-psalm-label { font-weight: 300; font-size: 1.4cqi; }
.home-psalm-text {
    position: relative;
    quotes: none;
    padding-inline: 3.4cqi 1cqi;
    font-family: var(--font-quote);
    font-size: 1.8cqi;
    line-height: 1.75;
}
.home-psalm-text::before,
.home-psalm-text::after {
    position: absolute;
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 2.2cqi;
    color: var(--outline);
}
.home-psalm-text::before { content: '\f10d'; inset-inline-start: 0; top: 0; }
.home-psalm-text::after { content: '\f10e'; inset-inline-end: -1cqi; bottom: -0.4cqi; }
.home-psalm-ref { padding-inline-start: 3.4cqi; font-weight: 300; font-size: 1.4cqi; text-align: end; }

.home-more {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.2cqi;
}
.home-more-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0.7cqi 1.8cqi;
    border-radius: 999px;
    border-width: 1.5px;
    font-weight: 500;
    font-size: max(1rem, 1.3cqi);
}
.home-more-link:hover { color: var(--ink); filter: brightness(1.04); }
.home-more-link i { color: #7a3a24; }
:root[data-color-theme="dark"] .home-more-link i { color: #e2b98b; }

.home-synaxarion {
    margin: 0;
    text-align: center;
    font-weight: 500;
    font-size: 2.2cqi;
    line-height: 1.7;
}
.home-synaxarion a { color: var(--ink); }
.home-synaxarion a:hover { text-decoration: underline; text-underline-offset: 6px; }
.home-synaxarion-sep { margin: 0 12px; opacity: 0.6; }

/* 485 × 138 px */
.home-api {
    justify-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24.6cqi;
    aspect-ratio: 485 / 138;
    border-radius: 2.74cqi;
    font-weight: 500;
    font-size: 2.5cqi;
}
.home-api:hover { color: var(--ink); filter: brightness(1.04); }
.home-api [lang="en"] { font-family: 'Cairo', sans-serif; font-weight: 600; }

@media (max-width: 1199.98px) {
    .home-tiles {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        grid-template-areas:
            "agpeya agpeya agpeya bible bible bible"
            "alhan alhan alhan bible bible bible"
            "coptic coptic coptic bible bible bible"
            "vespers vespers psalmody psalmody liturgy liturgy";
        gap: 22px;
    }
    .home-tile { min-height: 150px; aspect-ratio: auto !important; padding: 22px 16px; border-radius: 26px; }
    .home-tile-title { font-size: 2rem; }
    .tile-bible .home-tile-title, .tile-agpeya .home-tile-title { font-size: 2.2rem; }
    .tile-bible, .tile-agpeya { padding: 26px; }
    .home-welcome { padding: 22px 30px; border-radius: 28px; min-height: 0; }
    .home-welcome h1 { font-size: 2.2rem; }
    .home-welcome p { font-size: 1.3rem; }
    .home-welcome-date { font-size: 1.15rem; padding-inline-start: 26px; }
    .home-verse { padding: 18px 26px; border-radius: 28px; min-height: 0; }
    .home-verse-text { font-size: 1.25rem; }
    .home-verse-ref strong { font-size: 1.35rem; }
    .home-verse-ref small { font-size: 0.8rem; }
    .home-agpeya-now { font-size: 1.25rem; }
    .home-psalm { gap: 10px; margin-top: 18px; }
    .home-psalm-label, .home-psalm-ref { font-size: 1rem; }
    .home-psalm-text { font-size: 1.15rem; padding-inline: 40px 10px; }
    .home-psalm-text::before, .home-psalm-text::after { font-size: 1.4rem; }
    .home-psalm-ref { padding-inline-start: 40px; }
    .home-more { gap: 12px; }
    .home-more-link { padding: 9px 18px; font-size: 1rem; }
    .home-synaxarion { font-size: 1.35rem; }
    .home-api { width: auto; aspect-ratio: auto; padding: 16px 48px; border-radius: 22px; font-size: 1.35rem; }
    .home-v2 { gap: 26px; }
}

@media (max-width: 991.98px) {
    .home-v2 { gap: 22px; }
    .home-welcome { flex-direction: column; align-items: stretch; gap: 16px; padding: 22px; }
    .home-welcome-date {
        padding: 14px 0 0;
        border-inline-start: 0;
        border-top: 2px solid var(--outline);
        grid-template-columns: repeat(2, auto);
        justify-content: start;
        column-gap: 18px;
        font-size: 1.05rem;
    }
    .home-verse { flex-direction: column; align-items: stretch; gap: 10px; padding: 20px 22px; }
    .home-verse-ref { text-align: start; }
    .home-tiles {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        grid-template-areas:
            "agpeya agpeya agpeya agpeya agpeya agpeya"
            "bible bible bible bible bible bible"
            "alhan alhan alhan coptic coptic coptic"
            "vespers vespers psalmody psalmody liturgy liturgy";
        gap: 14px;
    }
    .home-tile { min-height: 120px; border-radius: 24px; padding: 18px 12px; }
    .home-tile-title { font-size: 1.45rem; }
    .tile-bible, .tile-agpeya { padding: 22px; }
    .tile-bible .home-tile-title, .tile-agpeya .home-tile-title { font-size: 1.9rem; }
    .home-psalm { margin-top: 14px; }
    .home-api { padding: 14px 40px; }
}

/* ---------- Reading pages: a white page in a ruled frame with Coptic crosses ---------- */

.reader-shell .prayer-card.reader-content {
    position: relative;
    overflow: visible;
    border-radius: 0;
    background: var(--paper) !important;
    color: var(--paper-ink) !important;
    box-shadow: var(--paper-shadow);
    padding: 58px 64px 64px;
}
.reader-shell .prayer-card.reader-content::before,
.reader-continuous .reader-shell #prayerSlider::before {
    content: '';
    position: absolute;
    inset: 26px;
    pointer-events: none;
    --c: 30px;     /* cross size */
    --w: 3px;      /* rule width */
    background:
        url('../img/coptic-cross.svg') left top / var(--c) var(--c) no-repeat,
        url('../img/coptic-cross.svg') right top / var(--c) var(--c) no-repeat,
        url('../img/coptic-cross.svg') left bottom / var(--c) var(--c) no-repeat,
        url('../img/coptic-cross.svg') right bottom / var(--c) var(--c) no-repeat,
        linear-gradient(#111, #111) center calc(var(--c) / 2 - var(--w) / 2) / calc(100% - var(--c) * 2 - 10px) var(--w) no-repeat,
        linear-gradient(#111, #111) center calc(100% - var(--c) / 2 + var(--w) / 2) / calc(100% - var(--c) * 2 - 10px) var(--w) no-repeat,
        linear-gradient(#111, #111) calc(var(--c) / 2 - var(--w) / 2) center / var(--w) calc(100% - var(--c) * 2 - 10px) no-repeat,
        linear-gradient(#111, #111) calc(100% - var(--c) / 2 + var(--w) / 2) center / var(--w) calc(100% - var(--c) * 2 - 10px) no-repeat;
}
:root[data-color-theme="dark"] .reader-shell .prayer-card.reader-content::before,
:root[data-color-theme="dark"] .reader-continuous .reader-shell #prayerSlider::before {
    filter: invert(0.9) sepia(0.35);
}

.reader-shell .prayer-card.reader-content > .prayer-card-head,
.kholagy-reader .prayer-card.reader-content > .prayer-card-head {
    background: transparent !important;
    color: var(--paper-ink) !important;
    border-bottom: 3px solid currentColor !important;
    /* The title sits midway between the frame's top rule and the rule under the header. */
    margin: 0 4px 26px;
    padding: var(--head-top, 12px) 4px var(--head-bottom, 26px);
}
.reader-shell .prayer-card.reader-content .prayer-card-title {
    font-family: 'GE Dinar Two', 'Cairo', var(--coptic-font), sans-serif;
    font-weight: 500; /* GE Dinar Two Medium */
    line-height: 1.5;
    font-size: clamp(1.3rem, 2.2vw, 2rem);
    color: var(--paper-ink);
}
.reader-shell .prayer-card.reader-content > .prayer-card-body,
.kholagy-reader .prayer-card.reader-content > .prayer-card-body {
    background: transparent !important;
    padding-inline: 4px;
}

@media (max-width: 767.98px) {
    .reader-shell .prayer-card.reader-content { padding: 34px 18px 40px; }
    .reader-shell .prayer-card.reader-content::before,
    .reader-continuous .reader-shell #prayerSlider::before { inset: 6px; --c: 18px; --w: 2px; }
    .reader-shell .prayer-card.reader-content > .prayer-card-head { margin: 0 0 18px; padding: var(--head-top, 0px) 0 var(--head-bottom, 16px); }
}

/* ---------- Footer: on the parchment, no white band ---------- */
body > footer,
body > footer.bg-white {
    background: transparent !important;
    border-top: 1.5px solid var(--border-soft) !important;
    color: var(--ink-soft) !important;
    font-weight: 300;
}
body > footer a { color: var(--ink); font-weight: 500; }

/* Inside the paper the text needs no second box */
.reader-shell .prayer-card.reader-content .text-block {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding-inline: 0;
}

/* The page sliders clip their content; leave room for the paper's shadow */
.reader-shell .swiper { padding-bottom: 34px; margin-bottom: -20px; }

/* ---------- Dark mode: app.css paints these navy; brown instead ---------- */
:root[data-color-theme="dark"] .badge-pill,
:root[data-color-theme="dark"] .back-chip,
:root[data-color-theme="dark"] .detail-accordion,
:root[data-color-theme="dark"] .detail-accordion summary,
:root[data-color-theme="dark"] .content-line,
:root[data-color-theme="dark"] .text-block,
:root[data-color-theme="dark"] .verse-block,
:root[data-color-theme="dark"] .reader-jump,
:root[data-color-theme="dark"] .reader-date-picker-input,
:root[data-color-theme="dark"] .wizard-form .form-control,
:root[data-color-theme="dark"] .wizard-form .form-select,
:root[data-color-theme="dark"] .kholagy-lang-toggle,
:root[data-color-theme="dark"] .section-list-item {
    background-color: #33231a !important;
}
:root[data-color-theme="dark"] .prayer-card-head,
:root[data-color-theme="dark"] .section-list-head {
    background-color: #3d2a1e !important;
}
/* On the dark paper, reading blocks sit straight on the page */
:root[data-color-theme="dark"] .reader-shell .prayer-card.reader-content .verse-block,
:root[data-color-theme="dark"] .reader-shell .prayer-card.reader-content .text-block,
:root[data-color-theme="dark"] .reader-shell .prayer-card.reader-content .content-line {
    background-color: transparent !important;
}
:root[data-color-theme="dark"] .reader-shell .prayer-card.reader-content > .prayer-card-head {
    background-color: transparent !important;
}

/* Phones: the red back tab joins the top row of buttons instead of covering the page */
@media (max-width: 991.98px) {
    .back-nav {
        top: 14px;
        left: 142px;
        width: auto;
        height: 54px;
        padding: 0 16px;
        flex-direction: row;
        gap: 8px;
        border-radius: 27px;
        font-size: 0.95rem;
    }
}

/* Hub pages' light cards take the glass look */
.bento-card.bg-white-pure,
:root:not([data-color-theme="dark"]) .bento-card.bg-brand-gold {
    background: var(--glass) !important;
    border: 2px solid var(--outline);
    color: var(--ink);
}
/* (in dark mode gold cards stay gold, with their dark text, as before) */

/* The settings window opens straight from the gear, over the whole page */
.menu-settings-modal { position: fixed; z-index: 1080; }

/* ── Patron saint and fathers (شفيع الكنيسة، ألحان الآباء) ─────────────────── */
.menu-settings-panel { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.menu-settings-subtitle { font-size: 1rem; font-weight: 800; margin: 0 0 2px; text-align: start; }
.menu-settings-panel .menu-settings-hint { font-size: .8rem; margin: -6px 0 8px; text-align: start; }
.menu-field-grid { display: grid; gap: 8px; text-align: start; margin: 4px 0 6px; }
.menu-field { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: .88rem; }
.menu-field input,
.menu-field select {
    font: inherit;
    font-weight: 700;
    min-height: 38px;
    width: 100%;
    padding: 4px 10px;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--surface-text) 25%, transparent);
    background: transparent;
    color: inherit;
}
.menu-field input::placeholder { color: var(--muted-text); font-weight: 500; }

.reader-switches { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.reader-extra-controls .reader-switches { margin-inline-end: auto; }
.reader-extra-controls .reader-switches .reader-switch { margin-inline-end: 0; }
.reader-prefs-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--brand-navy) 35%, transparent);
    background: transparent;
    color: var(--brand-navy);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
}
:root[data-color-theme="dark"] .reader-prefs-btn { color: var(--surface-text); border-color: color-mix(in srgb, var(--surface-text) 35%, transparent); }

/* A passage said only when a father is present: hidden unless the switch is on, and by rank. */
.kholagy-reader:not(.show-fathers) .is-fathers-line,
.kholagy-reader.fathers-rank-none .is-fathers-line:not([data-fathers-rank="any"]),
.kholagy-reader.fathers-rank-bishop .is-fathers-line[data-fathers-rank="metropolitan"],
.kholagy-reader.fathers-rank-metropolitan .is-fathers-line[data-fathers-rank="bishop"] { display: none !important; }

.father-name, .father-slot.is-filled { font-weight: 800; color: var(--brand-oxblood); }
:root[data-color-theme="dark"] .father-name,
:root[data-color-theme="dark"] .father-slot.is-filled { color: #e8b27a; }

.swiper-slide.is-patron .prayer-card-title::after {
    content: 'شفيع الكنيسة';
    display: block;
    width: fit-content;
    margin: 6px auto 0;
    padding: 1px 12px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 800;
    font-family: inherit;
    background: var(--brand-oxblood);
    color: #fff;
}
.menu-settings-panel { width: min(100%, 360px); overflow-x: hidden; }
.menu-settings-panel .menu-select-row > span { flex: 0 0 auto; }
.menu-settings-panel .menu-select-row select { min-width: 0; max-width: 64%; text-overflow: ellipsis; }
.swiper-slide.is-day-saint .prayer-card-title::after {
    content: 'تذكار اليوم';
    display: block; width: fit-content; margin: 6px auto 0; padding: 1px 12px;
    border-radius: 999px; font-size: .72rem; font-weight: 800; font-family: inherit;
    background: var(--brand-navy); color: #fff;
}

/* ---------- Continuous reader: one page, prayer after prayer, under one sticky header ---------- */
/* The card naming the book and the service goes: the header names them. (A date picker moves
   into the font and switches card.) */
.reader-continuous .reader-shell > .reader-toolbar { display: none !important; }
.reader-continuous .reader-controls-card > .reader-date-picker { justify-content: center; margin: 0; }

.reader-continuous .reader-shell #prayerSlider.prayer-swiper {
    overflow: visible;
    position: relative;
    background: var(--paper);
    color: var(--paper-ink);
    box-shadow: var(--paper-shadow);
    padding: 0 64px 64px; /* the top of the page, frame included, is the sticky header's */
    margin-bottom: 0;
}
.reader-continuous #prayerSlider > .swiper-wrapper {
    display: block;
    transform: none !important;
    height: auto !important;
}
.reader-continuous #prayerSlider .swiper-slide {
    width: auto !important;
    height: auto !important;
    margin: 0 0 34px;
}
.reader-continuous #prayerSlider .swiper-slide:last-child { margin-bottom: 0; }
.reader-continuous .reader-shell .prayer-card.reader-content {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0;
    border: 0;
}
.reader-continuous .reader-shell .prayer-card.reader-content::before { display: none; }

/* Each prayer's own title: a heading in the text, without arrows. */
.reader-continuous .reader-shell .prayer-card.reader-content > .prayer-card-head {
    border-bottom: 1px solid color-mix(in srgb, currentColor 45%, transparent) !important;
    margin: 0 0 22px;
    padding: 6px 0 12px;
}
.reader-continuous .prayer-card.reader-content > .prayer-card-head .prayer-nav-btn { visibility: hidden; }
.reader-continuous .reader-shell .prayer-card.reader-content .prayer-card-head .prayer-card-title {
    font-size: clamp(1.15rem, 1.8vw, 1.6rem);
}

/* The sticky top keeps the page exactly as it is at the top: the buttons, the font and switches
   card, the gap under it, then the paper's top edge (crosses and rules) and the header. app.js
   measures the first three into --controls-top / --reader-head-top. */
.reader-continuous .reader-controls-card {
    position: sticky;
    top: var(--controls-top, 0px);
    z-index: 31;
    background: var(--glass), var(--page-bg) !important; /* opaque: the text passes under it */
}
.reader-continuous .reader-sticky-head {
    position: sticky;
    top: var(--reader-head-top, 0px);
    z-index: 30;
    margin: 0 -64px 30px;
    padding: 70px 64px 26px; /* 48px of paper above the title's 22px, as on the page */
    background: var(--paper) !important;
    color: var(--paper-ink) !important;
    --c: 30px;
    --w: 3px;
    --frame: 26px;
}
/* The frame's top: two crosses, the rule between them, and the side rules down to the header's
   rule. The paper's own frame (on #prayerSlider) carries on below. */
.reader-continuous .reader-sticky-head::before {
    content: '';
    position: absolute;
    top: var(--frame);
    left: var(--frame);
    right: var(--frame);
    bottom: 0;
    pointer-events: none;
    background:
        url('../img/coptic-cross.svg') left top / var(--c) var(--c) no-repeat,
        url('../img/coptic-cross.svg') right top / var(--c) var(--c) no-repeat,
        linear-gradient(#111, #111) center calc(var(--c) / 2 - var(--w) / 2) / calc(100% - var(--c) * 2 - 10px) var(--w) no-repeat,
        linear-gradient(#111, #111) calc(var(--c) / 2 - var(--w) / 2) calc(var(--c) + 5px) / var(--w) 100% no-repeat,
        linear-gradient(#111, #111) calc(100% - var(--c) / 2 + var(--w) / 2) calc(var(--c) + 5px) / var(--w) 100% no-repeat;
}
:root[data-color-theme="dark"] .reader-continuous .reader-sticky-head::before { filter: invert(0.9) sepia(0.35); }
/* The header's own rule, between the side rules. */
.reader-continuous .reader-sticky-head::after {
    content: '';
    position: absolute;
    left: calc(var(--frame) + var(--c) / 2 - var(--w) / 2);
    right: calc(var(--frame) + var(--c) / 2 - var(--w) / 2);
    bottom: 0;
    height: 3px;
    background: currentColor;
    pointer-events: none;
}
.reader-continuous .reader-sticky-head .reader-sticky-title {
    font-family: 'GE Dinar Two', 'Cairo', var(--coptic-font), sans-serif;
    font-weight: 500;
    line-height: 1.5;
    font-size: clamp(1.3rem, 2.2vw, 2rem);
    color: var(--paper-ink);
    cursor: pointer;
}
.reader-continuous .reader-sticky-head .prayer-card-head-inner { position: relative; z-index: 1; }
@media (max-width: 767.98px) {
    .reader-continuous .reader-shell #prayerSlider.prayer-swiper { padding: 0 18px 40px; }
    .reader-continuous .reader-sticky-head { margin: 0 -18px 22px; padding: 38px 18px 16px; --c: 18px; --w: 2px; --frame: 6px; }
}
/* Each prayer opens with its title, in warm brown (gold in dark mode) so it stands apart from the
   black text and the red Coptic; the first one is left out, the header above already names it. */
:root { --prayer-title-ink: #8a4a26; }
:root[data-color-theme="dark"] { --prayer-title-ink: var(--brand-gold); }
.reader-continuous #prayerSlider > .swiper-wrapper > .swiper-slide:first-child .prayer-card.reader-content > .prayer-card-head { display: none; }
.reader-continuous #prayerSlider .swiper-slide { margin-bottom: 46px; }
.reader-continuous .reader-shell .prayer-card.reader-content > .prayer-card-head {
    color: var(--prayer-title-ink) !important;
    border-bottom: 1.5px solid color-mix(in srgb, var(--prayer-title-ink) 55%, transparent) !important;
    margin: 0 0 22px;
    padding: 8px 0 12px;
}
.reader-continuous .reader-shell .prayer-card.reader-content > .prayer-card-head .prayer-card-title { color: var(--prayer-title-ink); }
.reader-continuous .reader-shell .prayer-card.reader-content > .prayer-card-head .prayer-card-title .text-muted { color: inherit !important; opacity: .75; }
.reader-sticky-title .reader-sticky-ref { display: block; font-size: .62em; font-weight: 300; opacity: .75; margin-top: 2px; }

/* Above the header while it is stuck: the page's colour, not the text passing under it. */
body.reader-stuck::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* The same parchment as the fixed layer behind the page, cut off at the header. */
    background: var(--page-bg) var(--page-image) center / cover no-repeat;
    clip-path: inset(0 0 calc(100% - var(--reader-head-top, 0px)) 0);
    z-index: 25; /* over the text, under the header (30), the card (31) and the buttons */
    pointer-events: none;
}

/* Verse numbers: small and raised beside the verse, as in a printed Bible, not words of their own. */
.bible-verse-inline strong,
.reading-verse-num {
    font-size: .6em;
    font-weight: 700;
    vertical-align: super;
    line-height: 0;
    margin-inline: 5px 2px;
    opacity: .85;
}

/* The Arabic font of the texts read, chosen in the settings (الخط العربي); the headers keep GE Dinar
   Two Medium. Coptic text keeps its own font: its rules name --coptic-font themselves. */
:root { --reader-arabic-font: 'GE Dinar Two'; }
:root[data-arabic-font="cairo"] { --reader-arabic-font: 'Cairo'; }
:root[data-arabic-font="hili"] { --reader-arabic-font: 'GE Hili'; }
:root[data-arabic-font="amiri"] { --reader-arabic-font: 'Amiri'; }
.reader-shell .prayer-card-body,
.tafseer-body,
.menu-font-sample-ar {
    font-family: var(--reader-arabic-font), 'GE Dinar Two', 'Cairo', var(--coptic-font), sans-serif;
}
.menu-font-sample-ar { direction: rtl; text-align: center; }

/* Font size slider in the settings */
.menu-font-size-row { margin-bottom: 0; }
.menu-font-size-row output { font-weight: 500; min-width: 3.5em; text-align: left; }
.menu-font-size { width: 100%; margin: 2px 0 12px; accent-color: var(--brand-oxblood, #7d1606); }

/* The arrows beside a reader's title: drawn in the page's ink like its rules, not white buttons
   floating on the paper. A thin ink ring; filled with ink when pressed or hovered. */
.reader-shell .prayer-nav-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    color: var(--paper-ink);
    border: 1.5px solid currentColor;
    box-shadow: none;
    font-size: .95rem;
    transition: background-color .15s ease, color .15s ease, opacity .15s ease;
}
.reader-shell .prayer-nav-btn:not(:disabled):hover,
.reader-shell .prayer-nav-btn:not(:disabled):active {
    background: var(--paper-ink);
    color: var(--paper);
}
.reader-shell .prayer-nav-btn:focus-visible { outline: 2px solid var(--paper-ink); outline-offset: 3px; }
.reader-shell .prayer-nav-btn:disabled { opacity: .22; }
@media (max-width: 767.98px) {
    .reader-shell .prayer-nav-btn { width: 34px; height: 34px; font-size: .85rem; }
}
/* Dark mode: the sticky header is the page's paper too (the old dark style made headers navy). */
:root[data-color-theme="dark"] .reader-continuous .reader-shell .reader-sticky-head {
    background: var(--paper) !important;
    color: var(--paper-ink) !important;
}

/* Home: the Bible tile in the same dark banner as the day's verse above it. */
.home-tile.tile-bible {
    background: var(--banner) !important;
    color: var(--banner-text) !important;
    border-color: transparent !important;
    box-shadow: 0 10px 26px rgba(70, 30, 16, 0.22);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
.home-tile.tile-bible:hover { color: var(--banner-text) !important; box-shadow: 0 14px 30px rgba(70, 30, 16, 0.28); }
.tile-bible .home-psalm-text::before,
.tile-bible .home-psalm-text::after { color: color-mix(in srgb, var(--banner-text) 70%, transparent); }
.tile-bible .home-psalm-label,
.tile-bible .home-psalm-ref { opacity: .85; }

/* Home: the Agpeya tile opens the current hour; a small link in its corner opens all the hours. */
.tile-agpeya { position: relative; padding: 0 !important; }
.home-agpeya-link {
    flex: 1 1 auto;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 2.4cqi 2.8cqi;
    color: inherit;
    border-radius: inherit;
}
.home-agpeya-link:hover { color: inherit; }
.home-agpeya-all {
    position: absolute;
    inset-inline-end: 2.2cqi;
    bottom: 1.8cqi;
    display: inline-flex;
    align-items: center;
    gap: .5em;
    padding: .35em 1em;
    border: 1.5px solid var(--outline);
    border-radius: 999px;
    font-size: max(.85rem, 1.15cqi);
    font-weight: 500;
    color: var(--ink);
    background: color-mix(in srgb, var(--page-bg) 55%, transparent);
}
.home-agpeya-all:hover { color: var(--page-bg); background: var(--outline); }
.home-agpeya-all i { font-size: .75em; }
@media (max-width: 991.98px) {
    .home-agpeya-link { padding: 26px 26px 64px; }
    .home-agpeya-all { inset-inline-end: 18px; bottom: 16px; }
}
/* The Bible tile holds only its title now: larger, in the middle of the tile. */
.home-tile.tile-bible { justify-content: center; align-items: center; text-align: center; }
.home-tile.tile-bible .home-tile-title { font-size: 6cqi; line-height: 1.25; white-space: normal; }
@media (max-width: 991.98px) {
    .home-tile.tile-bible { min-height: 150px; }
    .home-tile.tile-bible .home-tile-title { font-size: 2.8rem; }
}

/* دلال أسبوع الآلام: the days, then a day's services, as one grid read in order. */
.hw-guide { display: grid; gap: 22px; }
.hw-guide-head { border-radius: 28px; padding: 26px 30px; }
.hw-guide-head h1 { margin: 6px 0 0; font-weight: 500; font-size: clamp(1.8rem, 3.2vw, 2.8rem); }
.hw-guide-head p { margin: 8px 0 0; font-weight: 300; font-size: 1.1rem; }
.hw-guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.hw-guide-tile {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-height: 104px;
    padding: 18px 22px;
    border-radius: 24px;
    color: var(--ink);
    transition: transform .2s ease, box-shadow .2s ease;
}
.hw-guide-tile:hover { color: var(--ink); transform: translateY(-2px); box-shadow: 0 10px 18px rgba(0, 0, 0, .1); }
.hw-guide-title { font-weight: 500; font-size: 1.35rem; line-height: 1.35; }
.hw-guide-note { font-weight: 300; font-size: .95rem; opacity: .8; }
@media (max-width: 575.98px) {
    .hw-guide-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .hw-guide-tile { min-height: 88px; padding: 14px 16px; }
    .hw-guide-title { font-size: 1.1rem; }
}
/* «**» rubric lines in the دلال files */
.orso-rubric { color: var(--prayer-title-ink, #8a4a26); font-size: .92em; }
.katameros-reading-text .text-block + .text-block { margin-top: .9em; }
/* The fathers' names in Coptic, in the settings */
.menu-coptic-input { font-family: var(--coptic-font, 'Avva Shenouda', 'Antinoou', serif); text-align: left; }
