@font-face {
    font-family: "Kitab";
    src:
        url("/assets/fonts/Kitab-Regular.woff2") format("woff2"),
        url("/assets/fonts/Kitab-Regular.ttf") format("truetype");
    font-display: swap;
}

:root {
    --bg: #eef8f6;
    --bg-elevated: rgba(247, 255, 253, 0.8);
    --surface: rgba(248, 255, 253, 0.86);
    --surface-strong: #fcfffe;
    --text: #123532;
    --muted: #5e807c;
    --line: rgba(4, 148, 140, 0.12);
    --accent: #37b8a6;
    --accent-strong: #04948c;
    --shadow: 0 20px 60px rgba(4, 148, 140, 0.1);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --container: min(1180px, calc(100vw - 32px));
}

body[data-theme="dark"] {
    --bg: #081a18;
    --bg-elevated: rgba(10, 29, 27, 0.82);
    --surface: rgba(12, 35, 33, 0.84);
    --surface-strong: #0f2d2a;
    --text: #ebfaf7;
    --muted: #99c5bf;
    --line: rgba(143, 235, 224, 0.12);
    --accent: #3fd0bc;
    --accent-strong: #8af0de;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: "Segoe UI", "SF Pro Text", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(157, 232, 223, 0.52), transparent 34%),
        radial-gradient(circle at top right, rgba(216, 246, 239, 0.8), transparent 28%),
        linear-gradient(180deg, var(--bg) 0%, #e0f3ef 100%);
    color: var(--text);
}
body[data-theme="dark"] {
    background:
        radial-gradient(circle at top left, rgba(24, 133, 122, 0.34), transparent 38%),
        linear-gradient(180deg, #051210 0%, var(--bg) 100%);
}
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; }
.container { width: var(--container); margin: 0 auto; }
.narrow { max-width: 720px; }
.inline-form { margin: 0; }
.inline-row {
    display: grid;
    grid-template-columns: 1fr 140px auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
.stack-form {
    display: grid;
    gap: 12px;
}
.stack-form label {
    display: grid;
    gap: 8px;
    color: var(--muted);
}
.surface {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}
.glass {
    backdrop-filter: blur(18px);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--line);
}
.site-header { position: sticky; top: 0; z-index: 30; }
.site-header .container,
.section-head,
.header-actions,
.hero,
.surah-header,
.ayah-toolbar,
.ayah-columns,
.surah-meta,
.surah-topline,
.hero-meta {
    display: flex;
    gap: 16px;
}
.site-header .container {
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
}
.header-progress-shell {
    padding: 0 0 12px;
}
.header-progress-track {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(4, 148, 140, 0.12);
    overflow: hidden;
}
.header-progress-fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-strong), #6ed8c8);
    box-shadow: 0 0 18px rgba(4, 148, 140, 0.2);
    transition: width 180ms ease;
}
body:not(.page-surah) .header-progress-shell {
    display: none;
}
.brand { display: inline-flex; align-items: center; gap: 14px; }
.brand-mark {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-strong), #6ed8c8);
    color: white;
    font-weight: 700;
}
.brand-copy { display: grid; }
.brand small, .muted { color: var(--muted); }
.header-actions { align-items: center; }
.header-menu-toggle { display: none; }
.edition-picker, .compare-row label { display: grid; gap: 8px; color: var(--muted); }
.header-edition-picker {
    min-width: 320px;
}
.hero-edition-picker { width: 100%; }
select, input, .button, .icon-button {
    border: 1px solid var(--line);
    background: var(--surface-strong);
    color: var(--text);
    border-radius: 14px;
}
select, input { padding: 12px 14px; }
.button, .icon-button {
    padding: 11px 16px;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}
.button:hover, .icon-button:hover, .surah-card:hover, .ayah-card:hover { transform: translateY(-3px); }
.icon-button.is-active {
    border-color: rgba(4, 148, 140, 0.42);
    background: rgba(4, 148, 140, 0.16);
}
.hero {
    padding: 42px 0 16px;
    justify-content: space-between;
    align-items: end;
}
.auth-shell,
.account-shell,
.library-shell,
.admin-shell { padding: 40px 0; }
.auth-card { padding: 24px; }
.hero-copy { max-width: 760px; }
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.75rem;
    color: var(--accent-strong);
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.6rem, 5vw, 4.8rem); line-height: 0.98; }
h2 { font-size: 1.2rem; }
.lede { margin-top: 18px; max-width: 62ch; font-size: 1.08rem; color: var(--muted); }
.hero-meta {
    min-width: 320px;
    padding: 20px;
    border-radius: var(--radius-lg);
    flex-direction: column;
}
.hero-meta > div {
    display: grid;
    gap: 6px;
}
.hero-meta strong { font-size: 1.1rem; }
.auth-alt {
    margin-top: 16px;
}
.auth-alt a {
    color: var(--accent-strong);
}
.reading-overview,
.ayah-day-shell {
    padding: 20px 0 0;
}
.reading-overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.95fr);
    gap: 18px;
}
.reading-feature-card,
.dashboard-shortcut,
.ayah-day-card,
.search-panel .surface,
.surah-hero .surface {
    padding: 22px;
}
.reading-feature-card {
    display: grid;
    min-height: 258px;
    align-content: space-between;
    gap: 28px;
    background: linear-gradient(180deg, rgba(252, 255, 254, 0.95), rgba(239, 251, 248, 0.9));
}
.reading-feature-symbol {
    font-family: "Kitab", serif;
    font-size: 4em;
    font-weight: 700;
    line-height: 1;
    direction: rtl;
}
.reading-feature-footer {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
}
.reading-feature-footer strong {
    font-size: clamp(1.15rem, 2vw, 1.55rem);
    line-height: 1.2;
}
.reading-feature-footer span {
    color: var(--muted);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.reading-side-stack {
    display: grid;
    gap: 18px;
}
.dashboard-shortcut {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 120px;
}
.dashboard-shortcut-copy {
    display: grid;
    gap: 10px;
}
.dashboard-shortcut-copy strong {
    font-size: 1.12rem;
}
.dashboard-shortcut-copy p {
    color: var(--muted);
    line-height: 1.55;
}
.dashboard-shortcut-arrow {
    color: var(--accent-strong);
    font-size: 1.9rem;
    line-height: 1;
}
.dashboard-shortcut.is-static .dashboard-shortcut-arrow {
    font-size: 1.4rem;
}
.section-link {
    color: var(--accent-strong);
    font-weight: 600;
}
.ayah-day-card {
    display: grid;
    gap: 18px;
}
.section-head { align-items: center; justify-content: space-between; margin-bottom: 18px; }
.pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(4, 148, 140, 0.1);
    color: var(--accent-strong);
    font-size: 0.82rem;
}
.arabic-display, .ayah-text-ar {
    font-size: clamp(1.6rem, 2.8vw, 2.35rem);
    line-height: 1.95;
    font-family: "Kitab", serif;
}
.translation-display, .ayah-text-tr { font-size: 1rem; line-height: 1.8; }
.pinned-list { display: grid; gap: 12px; }
.account-saved-group {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}
.pinned-snippet {
    padding: 14px;
    border-radius: 18px;
    background: rgba(4, 148, 140, 0.06);
}
.search-panel { padding: 10px 0 20px; }
.search-input input { width: 100%; font-size: 1.05rem; }
.search-results { margin-top: 18px; display: grid; gap: 12px; }
.search-hit {
    display: block;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.35);
}
mark {
    background: rgba(129, 234, 213, 0.62);
    color: inherit;
    padding: 0 4px;
    border-radius: 6px;
}
.directory-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0 18px;
}
.sort-switch {
    display: inline-flex;
    gap: 6px;
    padding: 6px;
    border-radius: 999px;
    background: rgba(4, 148, 140, 0.08);
}
.sort-switch a {
    padding: 10px 14px;
    border-radius: 999px;
    color: var(--muted);
}
.sort-switch a.active {
    background: var(--surface-strong);
    color: var(--text);
}
.surah-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    padding-bottom: 40px;
}
.surah-card {
    padding: 20px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}
.surah-card.is-completed {
    border-color: rgba(4, 148, 140, 0.34);
    background: linear-gradient(180deg, rgba(249, 255, 254, 0.95), rgba(236, 251, 248, 0.96));
    box-shadow: 0 14px 34px rgba(4, 148, 140, 0.08);
}
.surah-card h3 {
    margin: 12px 0 8px;
    min-height: 3.9em;
    display: block;
    line-height: 1.3;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.surah-topline, .surah-meta {
    justify-content: space-between;
    color: var(--muted);
    font-size: 0.9rem;
}
.surah-topline {
    min-height: 40px;
    align-items: flex-start;
}
.surah-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.surah-number.is-completed {
    color: var(--accent-strong);
    box-shadow: inset 0 0 0 1px rgba(4, 148, 140, 0.16);
}
.surah-number-check {
    position: absolute;
    right: -3px;
    bottom: -4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #ebfaf7;
    color: var(--accent-strong);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: inset 0 0 0 1px rgba(4, 148, 140, 0.16);
}
.surah-meta {
    margin-top: auto;
    align-items: flex-end;
    gap: 10px;
}
.surah-type {
    display: inline-flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 6px;
    text-align: right;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.surah-name-ar {
    display: inline-flex;
    align-items: center;
    font-family: "Kitab", serif;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
    direction: rtl;
}
.surah-type-label {
    display: inline-flex;
    min-height: 1.4em;
    align-items: center;
}
.surah-number {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(4, 148, 140, 0.12);
    display: inline-grid;
    place-items: center;
    color: var(--accent-strong);
}
.surah-hero { padding: 34px 0 18px; }
.surah-header { justify-content: space-between; align-items: center; }
.surah-facts { display: flex; gap: 10px; flex-wrap: wrap; }
.compare-row { margin-top: 18px; }
.compare-row {
    display: flex;
    gap: 14px;
    align-items: end;
    flex-wrap: wrap;
}
.compare-row select { min-width: 260px; }
.subtle-link {
    white-space: nowrap;
}
.ayah-stream { display: grid; gap: 18px; padding-bottom: 40px; }
.ayah-load-more-shell {
    padding-bottom: 32px;
}
.ayah-load-more {
    display: flex;
    justify-content: center;
    padding: 16px 20px;
}
.ayah-card {
    padding: 20px 22px;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}
.ayah-card.is-active {
    border-color: rgba(4, 148, 140, 0.42);
    box-shadow: 0 16px 40px rgba(4, 148, 140, 0.14);
}
.ayah-toolbar { justify-content: space-between; align-items: start; }
.ayah-index {
    color: var(--text);
    font-weight: 500;
}
.ayah-actions { display: flex; gap: 10px; }
.ayah-columns {
    align-items: stretch;
    justify-content: flex-start;
    gap: 26px;
    margin-top: 18px;
    flex-direction: column;
}
.ayah-columns > * { flex: 1; }
.ayah-arabic-stack {
    display: grid;
    gap: 16px;
    justify-items: right;
    align-content: start;
    text-align: start;
    width: 100%;
    max-width: none;
}
.ayah-text-ar {
    text-align: start;
    max-width: 32ch;
    margin: 0 auto;
}
.ayah-text-transliteration {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--muted);
    font-style: normal;
    max-width: 70ch;
    text-align: center;
    margin: 0 auto;
}
.ayah-text-tr {
    display: block;
    min-width: 0;
    text-align: left;
    width: 100%;
}
.ayah-text-tr .translation-block {
    width: 100%;
}
.ayah-text-tr .translation-block p:last-child {
    font-size: 1.04rem;
    line-height: 1.8;
}
.translation-block + .translation-block {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.translation-label {
    color: var(--accent-strong);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}
.read-more-shell {
    padding-bottom: 40px;
}
.read-more-card {
    padding: 22px;
}
.read-more-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 14px;
}
.read-more-link {
    display: grid;
    gap: 6px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(4, 148, 140, 0.06);
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}
.read-more-link:hover {
    transform: translateY(-2px);
    border-color: rgba(4, 148, 140, 0.3);
}
.read-more-link strong {
    color: var(--accent-strong);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
}
.fade-in {
    opacity: 0;
    transform: translateY(10px);
    animation: riseIn 500ms ease forwards;
}
.fade-in:nth-child(2n) { animation-delay: 40ms; }
.fade-in:nth-child(3n) { animation-delay: 80ms; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
@keyframes riseIn {
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
    .reading-overview-grid { grid-template-columns: 1fr; }
    .hero { flex-direction: column; align-items: stretch; }
    .surah-header, .ayah-columns { flex-direction: column; }
    .reading-feature-card {
        min-height: 220px;
    }
    .reading-feature-footer {
        flex-direction: column;
        align-items: flex-start;
    }
    .ayah-arabic-stack,
    .ayah-text-tr {
        flex-basis: auto;
        width: 100%;
        max-width: none;
    }
    .ayah-text-tr {
        align-items: start;
    }
    .ayah-arabic-stack,
    .ayah-text-ar,
    .ayah-text-transliteration {
        text-align: center;
    }
}

@media (max-width: 720px) {
    .site-header .container {
        position: relative;
        align-items: center;
    }
    .header-menu-toggle {
        display: inline-flex;
        margin-left: auto;
    }
    .header-actions {
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        left: 0;
        z-index: 40;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        padding: 14px;
        border: 1px solid var(--line);
        border-radius: 20px;
        background: var(--surface-strong);
        box-shadow: var(--shadow);
    }
    .header-actions > * {
        width: 100%;
    }
    .header-actions[hidden] {
        display: none;
    }
    .header-progress-shell {
        padding-bottom: 10px;
    }
    .compare-row select { min-width: 100%; }
    .inline-row { grid-template-columns: 1fr; }
    .reading-feature-card,
    .dashboard-shortcut,
    .ayah-day-card {
        padding: 18px;
    }
    .reading-feature-symbol {
        font-size: 4em;
    }
}
