@import url("https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Inter:wght@400;500;600;700&display=swap");
body { overflow-x: hidden; }
.mobile-tabbar { display: none; }
.topbar.topbar { min-height: 88px; height: 88px; padding-inline: clamp(24px, 5vw, 86px); gap: clamp(18px, 2vw, 30px); background: color-mix(in srgb,var(--surface) 95%,transparent); }
.topbar > .brand { flex: 0 0 auto; font-family: Georgia, "Times New Roman", serif; font-size: 22px; letter-spacing: .08em; text-transform: uppercase; }
.topbar > .brand b { color: var(--gold); }
.topbar .brand-logo { width: 54px; height: 54px; padding: 0; object-fit: contain; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.primary-nav { flex: 0 1 auto; min-width: 0; gap: 8px; margin: auto; overflow-x: auto; scrollbar-width: none; }
.primary-nav::-webkit-scrollbar { display: none; }
.primary-nav > a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; color: var(--muted); background: color-mix(in srgb,var(--green) 4%,var(--surface)); border-radius: 999px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.primary-nav > a:hover, .primary-nav > a[aria-current="page"] { color: var(--green2); background: color-mix(in srgb,var(--green) 9%,var(--surface)); }
.primary-nav .mobile-menu-link, .primary-nav .mobile-menu-links, .primary-nav .drawer-head, .primary-nav .drawer-only, .nav-backdrop { display: none; }
.header-utilities { display: flex; flex: 0 0 auto; align-items: center; gap: clamp(18px, 2vw, 28px); padding-left: clamp(18px, 2vw, 28px); border-left: 1px solid var(--line); }
.header-utilities a { color: var(--green2); font-size: 13px; font-weight: 850; text-decoration: none; white-space: nowrap; }
.header-utilities a:hover, .header-utilities a[aria-current="page"] { color: var(--gold); }
.nav-actions { flex: 0 0 auto; align-items: center; }
.theme-button, .auth-button { min-height: 44px; padding: 0 15px; color: var(--green2); background: transparent; border: 0; border-radius: 999px; cursor: pointer; font: 800 13px Inter,"Segoe UI",sans-serif; white-space: nowrap; }
.theme-button { display: inline-flex; align-items: center; gap: 7px; background: color-mix(in srgb,var(--gold) 8%,var(--surface)); border: 1px solid color-mix(in srgb,var(--gold) 38%,var(--line)); }
.theme-button:hover { background: color-mix(in srgb,var(--gold) 16%,var(--surface)); }
.theme-icon { display: grid; place-items: center; width: 18px; height: 18px; line-height: 0; }
.theme-icon svg { display: block; }
.auth-button:hover { color: var(--gold); }
.site-footer { display: block; padding: 0; font-family: Inter, "Segoe UI", Arial, sans-serif; -webkit-font-smoothing: antialiased; color: rgba(255, 251, 242, .7); background: radial-gradient(900px 420px at 85% 0%, rgba(201, 154, 46, .14), transparent 70%), radial-gradient(700px 400px at 0% 100%, rgba(23, 108, 80, .35), transparent 70%), #071f15; border-top: 1px solid rgba(201, 154, 46, .25); font-size: 13px; }
.footer-app { display: flex; align-items: center; justify-content: space-between; gap: 32px; margin: 0; padding: 64px clamp(24px, 5vw, 80px) 56px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.footer-app-copy { max-width: 640px; }
.footer-eyebrow { display: inline-block; padding: 6px 12px; color: #efd37a; background: rgba(201, 154, 46, .12); border: 1px solid rgba(201, 154, 46, .3); border-radius: 999px; font: 700 10px/1 Inter, "Segoe UI", sans-serif; letter-spacing: .14em; text-transform: uppercase; }
.footer-app h2 { margin: 16px 0 10px; color: #fffaf0; font: 500 clamp(28px, 3.2vw, 40px)/1.15 Fraunces, Georgia, serif; letter-spacing: -.01em; }
.footer-app p { margin: 0; font-size: 15px; line-height: 1.75; }
.store-badges { display: flex; flex-wrap: wrap; gap: 12px; flex: 0 0 auto; }
.store-badge { display: inline-flex; align-items: center; gap: 12px; min-width: 176px; min-height: 58px; padding: 0 20px 0 16px; color: #fffaf0; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 251, 242, .2); border-radius: 14px; text-decoration: none; }
.store-badge:hover { background: rgba(255, 255, 255, .12); border-color: rgba(239, 211, 122, .55); transform: translateY(-2px); }
.store-badge:focus-visible { outline: 2px solid #efd37a; outline-offset: 3px; }
.store-badge svg { width: 26px; height: 26px; flex: 0 0 auto; }
.store-badge span { display: flex; flex-direction: column; font: 600 17px/1.15 Inter, "Segoe UI", sans-serif; }
.store-badge small { color: rgba(255, 251, 242, .65); font-size: 10px; font-weight: 600; letter-spacing: .04em; }
.footer-ayah { margin: 28px 0 0 !important; color: #efd37a; font: 400 30px/1.7 Amiri, "Scheherazade New", "Traditional Arabic", serif; text-align: left; }
.footer-ayah-en { margin: 4px 0 0 !important; font-size: 12px; font-style: italic; color: rgba(255, 251, 242, .55); }
.footer-main { display: grid; grid-template-columns: minmax(260px, .75fr) minmax(520px, 1.25fr); gap: clamp(50px, 8vw, 160px); margin: 0; padding: 64px clamp(24px, 5vw, 80px); }
.footer-about { max-width: 440px; }
.footer-brand span { font: 600 24px/1 Fraunces, Georgia, serif; }
.footer-about p { margin: 22px 0 0; font-size: 14px; line-height: 1.8; }
.footer-brand { color: #fffaf0; }
.footer-brand .brand-logo { width: 46px; height: 46px; border-radius: 14px; }
.footer-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 34px; }
.footer-links > div { display: flex; flex-direction: column; align-items: flex-start; gap: 13px; }
.footer-links h2 { margin: 0 0 8px; color: #efd37a; font: 600 11px/1.2 Inter, "Segoe UI", sans-serif; letter-spacing: .16em; text-transform: uppercase; }
.footer-links a, .footer-links span { color: rgba(255, 251, 242, .72); font-size: 14px; font-weight: 400; text-decoration: none; line-height: 1.4; }
.footer-links a:hover { color: #fffaf0; transform: translateX(2px); }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 0; padding: 22px clamp(24px, 5vw, 80px); border-top: 1px solid rgba(255, 255, 255, .1); font-size: 12px; color: rgba(255, 251, 242, .55); }
.site-footer .footer-bottom p { margin: 0; }
.site-footer .footer-bottom a { color: rgba(255, 251, 242, .8); text-decoration: none; }
.site-footer .footer-bottom a:hover { color: #efd37a; }

@media (max-width: 1320px) and (min-width: 1101px) {
  .topbar.topbar { padding-inline: 24px; gap: 13px; }
  .topbar > .brand { font-size: 19px; }
  .topbar .brand-logo { width: 48px; height: 48px; }
  .primary-nav { gap: 5px; }
  .primary-nav > a { min-height: 40px; padding-inline: 10px; font-size: 11px; }
  .header-utilities { gap: 14px; padding-left: 14px; }
  .header-utilities a, .theme-button, .auth-button { font-size: 11px; }
  .theme-button, .auth-button { padding-inline: 11px; }
}
@media (max-width: 1100px) {
  .topbar { min-height: 68px !important; height: 68px !important; padding: 0 16px; gap: 10px; }
  .topbar .brand-logo { width: 44px; height: 44px; }
  .topbar > .brand { font-size: 18px; }
  .menu-toggle { display: block; margin-left: auto; }
  .topbar .primary-nav { position: absolute; top: 68px; right: 0; left: 0; display: none; flex-direction: column; gap: 4px; max-height: calc(100svh - 68px); margin: 0; padding: 18px; overflow-y: auto; background: color-mix(in srgb,var(--surface) 97%,transparent); border-bottom: 1px solid var(--line); box-shadow: 0 18px 36px rgba(0,47,29,.12); }
  .topbar .primary-nav.open { display: flex; }
  .topbar .primary-nav a { width: 100%; min-height: 46px; display: flex; align-items: center; padding: 0 14px; border-radius: 10px; font-size: 14px; }
  .topbar nav a[aria-current="page"] { background: color-mix(in srgb,var(--green) 9%,transparent); }
  .primary-nav .mobile-menu-link { display: flex; }
  .primary-nav .mobile-menu-links { display: block; height: 1px; margin: 8px 0; background: var(--line); }
  .header-utilities { display: none; }
  .menu-toggle { min-width: 48px; min-height: 44px; padding: 0 10px; color: var(--green); border: 1px solid var(--line); border-radius: 10px; font-size: 12px; font-weight: 800; }
  .footer-main { grid-template-columns: 1fr; gap: 44px; }
  .footer-app { flex-wrap: wrap; }
  .site-footer { align-items: stretch; }
}
@media (max-width: 700px) {
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  button, .button, a { -webkit-tap-highlight-color: transparent; }
  .mobile-tabbar { position: fixed; z-index: 50; top: auto; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(5,1fr); gap: 0; min-height: calc(68px + env(safe-area-inset-bottom)); max-height: none; margin: 0; padding: 7px 8px env(safe-area-inset-bottom); overflow: visible; background: color-mix(in srgb,var(--surface) 96%,transparent); border-top: 1px solid var(--line); border-bottom: 0; box-shadow: 0 -10px 30px rgba(0,47,29,.09); backdrop-filter: blur(18px); }
  .mobile-tabbar a { display: grid; justify-items: center; align-content: center; gap: 3px; min-width: 0; min-height: 52px; padding: 3px; color: var(--muted); border-radius: 10px; font-size: 9px; font-weight: 800; text-decoration: none; }
  .mobile-tabbar a span { font-size: 20px; line-height: 1; }
  .mobile-tabbar a[aria-current="page"] { color: var(--green); background: color-mix(in srgb,var(--green) 8%,transparent); }
  .nav-actions { gap: 8px; margin-right: 2px; }
  .theme-button { order: 2; display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 50%; }
  .theme-label { display: none; }
  .auth-button { display: inline-flex; max-width: 76px; min-height: 0px; padding: 0 8px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .mushaf-focus .mobile-tabbar { display: none; }
  .site-footer { padding-bottom: 12px; }
}
@media (max-width: 620px) {
  .footer-links { grid-template-columns: 1fr 1fr; row-gap: 40px; }
  .footer-links > div:last-child { grid-column: 1 / -1; }
  .footer-bottom { align-items: flex-start; flex-direction: column; }
  .footer-app { flex-direction: column; align-items: flex-start; padding-top: 44px; }
  .store-badges { width: 100%; }
  .store-badge { flex: 1 1 150px; min-width: 0; }
}

/* Collapsed navigation: a drawer that slides in from the left. */
@media (max-width: 1320px) {
  .topbar.topbar { backdrop-filter: none; background: var(--surface); }
  .topbar .menu-toggle { order: -1; display: grid; place-items: center; width: 44px; min-width: 44px; height: 44px; min-height: 44px; margin: 0; padding: 0; color: var(--green2); background: transparent; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
  .topbar .menu-toggle:hover { border-color: var(--green); }
  .topbar > .brand { margin-right: auto; }
  .topbar .primary-nav { position: fixed; top: 0; bottom: 0; left: 0; right: auto; z-index: 100; display: flex; flex-direction: column; gap: 2px; width: min(310px, 86vw); max-height: none; margin: 0; padding: 0 14px calc(18px + env(safe-area-inset-bottom)); overflow-y: auto; background: var(--surface); border: 0; border-right: 1px solid var(--line); border-radius: 0 22px 22px 0; box-shadow: 18px 0 50px rgba(0, 30, 20, .2); transform: translateX(-105%); visibility: hidden; transition: transform .28s ease, visibility .28s; }
  .topbar .primary-nav.open { display: flex; transform: translateX(0); visibility: visible; }
  .topbar .primary-nav > a { width: 100%; min-height: 48px; display: flex; align-items: center; padding: 0 14px; color: var(--ink); background: transparent; border-radius: 12px; font-size: 15px; font-weight: 600; }
  .topbar .primary-nav > a:hover { background: color-mix(in srgb, var(--green) 6%, transparent); }
  .topbar .primary-nav > a[aria-current="page"] { color: var(--green2); background: color-mix(in srgb, var(--green) 10%, transparent); box-shadow: inset 3px 0 0 var(--gold); }
  .primary-nav .drawer-only, .primary-nav .mobile-menu-link { display: flex; }
  .primary-nav .mobile-menu-links { display: block; height: 1px; margin: 10px 4px; background: var(--line); }
  .primary-nav .drawer-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 -14px 10px; padding: 16px 14px 14px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .drawer-head .brand { font-family: Fraunces, Georgia, serif; font-size: 20px; letter-spacing: .06em; text-transform: uppercase; }
  .drawer-head .brand b { color: var(--gold); }
  .drawer-head .brand-logo { width: 40px; height: 40px; padding: 0; background: transparent; border: 0; box-shadow: none; }
  .drawer-close { display: grid; place-items: center; width: 38px; height: 38px; color: var(--ink); background: color-mix(in srgb, var(--green) 6%, transparent); border: 0; border-radius: 50%; font-size: 24px; line-height: 1; cursor: pointer; }
  .nav-backdrop:not([hidden]) { position: fixed; inset: 0; z-index: 99; display: block; background: rgba(4, 20, 13, .45); backdrop-filter: blur(2px); animation: nav-fade .2s ease; }
  body.menu-open { overflow: hidden; }
  body.menu-open .topbar { z-index: 200; }
}
@keyframes nav-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .topbar .primary-nav { transition: none; } .nav-backdrop:not([hidden]) { animation: none; } }

/* Account links (toggle with $authEnabled in partials/layout.php). */
.auth-button[hidden], body[data-auth="off"] .open-auth { display: none !important; }
.nav-actions { align-items: center; }
.auth-cta { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; color: #fffbf2; background: #03472d; border: 1px solid rgba(212,166,59,.45); border-radius: 999px; font: 800 13px Inter,"Segoe UI",sans-serif; text-decoration: none; white-space: nowrap; box-shadow: 0 8px 18px rgba(1,58,35,.14); }
.auth-cta:hover { background: #002f1d; border-color: var(--gold); }
[data-theme="night"] .auth-cta { color: #071711; background: #efd37a; border-color: #efd37a; }
.primary-nav .mobile-account-name { padding: 6px 14px 2px; color: var(--muted); font-size: 12px; font-weight: 700; }
.primary-nav .mobile-account-action { width: 100%; min-height: 48px; align-items: center; padding: 0 14px; color: #a33; background: transparent; border: 0; border-radius: 12px; font: 600 15px Inter,"Segoe UI",sans-serif; text-align: left; cursor: pointer; }
.primary-nav .mobile-account-buttons { display: none; gap: 8px; padding: 12px 4px 4px; }
.mobile-account-buttons a { flex: 1; display: grid; place-items: center; min-height: 46px; border-radius: 12px; font-size: 14px; font-weight: 800; text-decoration: none; }
.mobile-auth-ghost { color: var(--green2); border: 1px solid var(--line); }
.mobile-auth-cta { color: #fffbf2; background: #03472d; }
[data-theme="night"] .mobile-auth-cta { color: #071711; background: #efd37a; }
@media (max-width: 1320px) and (min-width: 1101px) { .auth-cta { min-height: 36px; padding: 0 12px; font-size: 11px; } }
@media (max-width: 1320px) { .primary-nav .mobile-account-buttons { display: flex; } }
@media (max-width: 700px) { .auth-cta { display: none; } }
@media (max-width: 1599px) and (min-width: 1321px) {
  .theme-button .theme-label { display: none; }
  .theme-button { width: 44px; padding: 0; justify-content: center; }
  .primary-nav { gap: 6px; }
  .primary-nav > a { padding: 0 12px; }
  .header-utilities { gap: 18px; padding-left: 18px; }
  .auth-button { padding-inline: 10px; }
}
@media (max-width: 1440px) and (min-width: 1321px) {
  .topbar { gap: 18px; }
  .primary-nav > a { padding: 0 10px; font-size: 12px; }
  .header-utilities { gap: 14px; padding-left: 14px; }
  .header-utilities a, .auth-button, .auth-cta { font-size: 12px; }
  .auth-cta { padding: 0 13px; }
}
