@font-face { font-family: 'EB Garamond'; src: url('/fonts/EBGaramond_400Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'EB Garamond'; src: url('/fonts/EBGaramond_400Regular_Italic.ttf') format('truetype'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'EB Garamond'; src: url('/fonts/EBGaramond_600SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Amiri'; src: url('/fonts/Amiri_400Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Amiri'; src: url('/fonts/Amiri_700Bold.ttf') format('truetype'); font-weight: 600 700; font-display: swap; }

/* Same palette as app/src/theme.ts */
:root {
  --paper: #FFFFFF;
  --paper-muted: #F8F6F1;
  --ink: #1E1B17;
  --muted: #6E675D;
  --rubric: #9B2226;
  --gold: #B8912F;
  --gold-wash: #FBF3DF;
  --rule: #E4DED3;
  --ink-soft: #3A342D;
  --gold-ink: #6D5415;
  --shadow: rgba(30, 27, 23, .32);
  --serif: 'EB Garamond', Garamond, 'Times New Roman', serif;
  --measure: 68rem;
  color-scheme: light;
}
/* Dark: follows the system unless the visitor picked a theme (data-theme on <html>, set by /theme.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15120F; --paper-muted: #1D1915; --ink: #EDE6DA; --ink-soft: #CFC6B8; --muted: #9D9486;
    --rubric: #E0716A; --gold: #CFA24A; --gold-wash: #2A2216; --gold-ink: #E3C27A; --rule: #342D25;
    --shadow: rgba(0, 0, 0, .55); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #15120F; --paper-muted: #1D1915; --ink: #EDE6DA; --ink-soft: #CFC6B8; --muted: #9D9486;
  --rubric: #E0716A; --gold: #CFA24A; --gold-wash: #2A2216; --gold-ink: #E3C27A; --rule: #342D25;
  --shadow: rgba(0, 0, 0, .55); color-scheme: dark;
}
[lang="ar"] { --serif: 'Amiri', 'Traditional Arabic', 'Times New Roman', serif; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-size: 1.1875rem; line-height: 1.6;
  text-rendering: optimizeLegibility;
}
[lang="ar"] body { font-size: 1.25rem; line-height: 1.85; }
img { max-width: 100%; height: auto; }
a { color: var(--rubric); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.wrap { max-width: var(--measure); margin: 0 auto; padding-inline: clamp(1rem, 4vw, 2.5rem); }
.skip { position: absolute; inset-inline-start: -9999px; }
.skip:focus { inset-inline-start: 1rem; top: 1rem; background: var(--paper); padding: .5rem 1rem; z-index: 10; }

/* Header */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: 0.9rem; }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--ink); text-decoration: none; font-size: 1.3rem; font-weight: 600; letter-spacing: .01em; }
.brand img { width: 2.25rem; height: 2.25rem; border-radius: .5rem; border: 1px solid var(--rule); }
.nav { display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: center; font-size: 1.05rem; }
.nav a { color: var(--ink); text-decoration: none; }
.nav a:hover { color: var(--rubric); }
/* Language dropdown: <details>, no script */
.langs { position: relative; }
.langs summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem;
  padding: .25rem .7rem; border: 1px solid var(--rule); border-radius: 99px; color: var(--ink); user-select: none;
}
.langs summary::-webkit-details-marker { display: none; }
.langs summary::after { content: ''; width: .4rem; height: .4rem; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); margin-inline-start: .15rem; transition: transform .15s; }
.langs[open] summary::after { transform: translateY(1px) rotate(225deg); }
.langs summary:hover, .langs[open] summary { border-color: var(--gold); }
.langs svg { color: var(--rubric); flex: none; }
.langs ul {
  position: absolute; inset-inline-end: 0; top: calc(100% + .4rem); z-index: 20; min-width: 10rem;
  list-style: none; margin: 0; padding: .35rem; background: var(--paper);
  border: 1px solid var(--rule); border-radius: .6rem; box-shadow: 0 12px 28px -12px var(--shadow);
}
.langs li a, .langs li span { display: block; padding: .35rem .75rem; border-radius: .4rem; text-decoration: none; color: var(--ink); }
.langs li a:hover { background: var(--paper-muted); color: var(--rubric); }
.langs [aria-current] { color: var(--rubric); background: var(--gold-wash); }
.langs [lang="ar"] { font-family: 'Amiri', serif; }

/* Hero */
.hero { padding-block: clamp(2.5rem, 7vw, 5.5rem) clamp(2rem, 5vw, 4rem); }
.hero .wrap { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.eyebrow { font-variant: small-caps; letter-spacing: .12em; color: var(--rubric); font-size: 1rem; margin: 0 0 .75rem; }
[lang="ar"] .eyebrow { font-variant: normal; letter-spacing: 0; }
h1 { font-size: clamp(2.4rem, 5.4vw, 3.9rem); line-height: 1.08; font-weight: 400; margin: 0 0 1.25rem; letter-spacing: -.01em; }
[lang="ar"] h1 { line-height: 1.45; letter-spacing: 0; }
h1 em { color: var(--rubric); font-style: italic; }
[lang="ar"] h1 em { font-style: normal; }
.lede { font-size: clamp(1.2rem, 2vw, 1.4rem); color: var(--ink-soft); margin: 0 0 2rem; max-width: 34rem; }
.stores { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.store {
  display: inline-flex; flex-direction: column; justify-content: center; min-width: 11rem;
  padding: .55rem 1.2rem; border-radius: .6rem; border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper); text-decoration: none; line-height: 1.2;
}
.store small { font-size: .78rem; opacity: .8; letter-spacing: .03em; }
.store strong { font-size: 1.2rem; font-weight: 600; }
.store[aria-disabled="true"] { background: var(--paper); color: var(--ink); border-color: var(--rule); cursor: default; }
.store[aria-disabled="true"] small { color: var(--rubric); opacity: 1; }

/* The verse card: one verse page of the app, drawn in HTML */
.card {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 1.1rem;
  padding: 1.5rem 1.6rem 1.4rem; box-shadow: 0 1px 0 var(--rule), 0 24px 48px -28px var(--shadow);
  position: relative;
}
.card::before { content: ''; position: absolute; inset: .45rem; border: 1px solid var(--gold-wash); border-radius: .8rem; pointer-events: none; }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; color: var(--muted); font-size: .95rem; border-bottom: 1px solid var(--rule); padding-bottom: .6rem; margin-bottom: 1rem; }
.card-top b { color: var(--ink); font-weight: 600; font-size: 1.05rem; }
.tabs { display: inline-flex; border: 1px solid var(--rule); border-radius: 99px; overflow: hidden; font-size: .88rem; }
.tabs span { padding: .1rem .7rem; }
.tabs .on { background: var(--ink); color: var(--paper); }
.verse { font-size: 1.3rem; line-height: 1.5; margin: 0 0 1rem; }
.verse sup { color: var(--rubric); font-size: .8rem; margin-inline-end: .3rem; font-weight: 600; }
.overview { font-size: 1.02rem; line-height: 1.6; margin: 0 0 1rem; color: var(--ink-soft); }
[lang="ar"] .overview { font-size: 1.12rem; }
.overview .f { color: var(--rubric); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.chips li { font-size: .85rem; padding: .1rem .6rem; border-radius: 99px; background: var(--gold-wash); color: var(--gold-ink); }
.card-foot { margin-top: 1rem; padding-top: .7rem; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; font-size: .9rem; color: var(--muted); }

/* Numbers */
.facts { border-block: 1px solid var(--rule); background: var(--paper-muted); }
.facts ul { list-style: none; margin: 0; padding: 1.6rem 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 1.25rem; text-align: center; }
.facts b { display: block; font-size: 2.3rem; line-height: 1; font-weight: 400; color: var(--rubric); font-variant-numeric: oldstyle-nums; }
.facts span { font-size: 1rem; color: var(--muted); }

/* Sections */
section { padding-block: clamp(3rem, 7vw, 5.5rem); }
section + section { border-top: 1px solid var(--rule); }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); line-height: 1.15; font-weight: 400; margin: 0 0 1rem; }
[lang="ar"] h2 { line-height: 1.5; }
h2::before { content: '✠'; display: block; color: var(--gold); font-size: 1.1rem; margin-bottom: .6rem; }
h3 { font-size: 1.35rem; font-weight: 600; margin: 0 0 .4rem; }
.intro { max-width: 44rem; font-size: 1.25rem; color: var(--ink-soft); margin: 0 0 2.5rem; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: clamp(1.5rem, 3vw, 2.5rem); }
.grid3 p { margin: 0; color: var(--ink-soft); }
.step-n { color: var(--rubric); font-variant: small-caps; letter-spacing: .1em; font-size: .95rem; }

/* Vision */
.vision { background: var(--paper-muted); }
.vision .wrap { max-width: 52rem; }
.vision blockquote { margin: 0 0 2rem; padding: 0; font-size: clamp(1.35rem, 2.6vw, 1.7rem); line-height: 1.45; font-style: italic; color: var(--ink); }
[lang="ar"] .vision blockquote { font-style: normal; }
.vision blockquote cite { display: block; margin-top: .6rem; font-size: 1rem; font-style: normal; color: var(--rubric); }
.vision p { font-size: 1.2rem; }
.pillars { list-style: none; padding: 0; margin: 2rem 0; display: grid; gap: 1.25rem; }
.pillars li { padding-inline-start: 1.4rem; border-inline-start: 2px solid var(--gold); }
.pillars b { color: var(--rubric); font-weight: 600; }
.help { margin-top: 2.5rem; padding: 1.4rem 1.6rem; border: 1px solid var(--gold); border-radius: .8rem; background: var(--paper); }
.help h3 { color: var(--rubric); }
.help p { margin: 0; font-size: 1.1rem; }

/* Languages */
.lang-table { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.lang { border: 1px solid var(--rule); border-radius: .8rem; padding: 1.1rem 1.25rem; }
.lang .name { font-size: 1.5rem; }
.lang .name[lang="ar"] { font-family: 'Amiri', serif; }
.lang ul { list-style: none; padding: 0; margin: .5rem 0 0; font-size: 1rem; color: var(--ink-soft); }
.lang li::before { content: '✓'; color: var(--rubric); margin-inline-end: .45rem; }
.lang li.no { color: var(--muted); }
.lang li.no::before { content: '·'; color: var(--muted); }
.lang.next { border-style: dashed; background: var(--paper-muted); }

/* Fathers */
.fathers { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); column-gap: 3rem; }
.fathers li { padding: .9rem 0; border-bottom: 1px solid var(--rule); }
.fathers .who { color: var(--rubric); font-size: 1.2rem; }
.fathers .when { color: var(--muted); font-size: .95rem; margin-inline-start: .4rem; }
.fathers .on { display: block; font-size: 1rem; color: var(--ink-soft); }

/* Prose pages (privacy, support) */
.prose { max-width: 44rem; padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.prose h1 { font-size: clamp(2.2rem, 4.5vw, 3rem); }
.prose h2 { font-size: 1.6rem; margin-top: 2.5rem; }
.prose h2::before { display: none; }
.prose .updated { color: var(--muted); }
.prose li { margin-bottom: .4rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); background: var(--paper-muted); padding-block: 2.5rem; font-size: 1rem; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1.5rem 3rem; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.site-footer p { margin: 0; max-width: 36rem; }

@media (max-width: 60rem) { .facts ul { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 30rem) { .facts ul { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 52rem) {
  .hero .wrap { grid-template-columns: 1fr; }
  .nav .sec { display: none; }
}

/* Theme toggle */
.theme-toggle {
  display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; padding: 0; cursor: pointer;
  border: 1px solid var(--rule); border-radius: 99px; background: transparent; color: var(--rubric);
}
.theme-toggle:hover { border-color: var(--gold); }
.theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-toggle .sun { display: none; } :root:not([data-theme="light"]) .theme-toggle .moon { display: block; } }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
.no-js .theme-toggle { display: none; }
