@font-face {
  font-family: "Amiri";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/amiri-regular-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Amiri";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/amiri-bold-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --color-bg: #fbf8f2;
  --color-surface: #ffffff;
  --color-surface-elevated: #ffffff;
  --color-text: #1b1b1b;
  --color-muted: #6b6b6b;
  --color-border: #e4ddd0;
  --color-accent: #0b6e4f;
  --color-link: #0b6e4f;
  --color-link-hover: #084d37;
  --color-quote-bg: #f2ebd9;
  --color-quote-border: #c7b387;
  --color-focus: #0b6e4f;
  --theme-color-meta: #fbf8f2;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #15171c;
  --color-surface: #1c1f25;
  --color-surface-elevated: #242832;
  --color-text: #ece8df;
  --color-muted: #9c9c9c;
  --color-border: #2a2d35;
  --color-accent: #5fb793;
  --color-link: #5fb793;
  --color-link-hover: #8ed0b3;
  --color-quote-bg: #20242c;
  --color-quote-border: #3f4854;
  --color-focus: #8ed0b3;
  --theme-color-meta: #15171c;
}

:root[data-theme="sepia"] {
  color-scheme: light;
  --color-bg: #f4ecd8;
  --color-surface: #fbf3dd;
  --color-surface-elevated: #fff8e4;
  --color-text: #5b4636;
  --color-muted: #8a715a;
  --color-border: #d9cbb0;
  --color-accent: #8a5a2b;
  --color-link: #8a5a2b;
  --color-link-hover: #5b3a15;
  --color-quote-bg: #ebe0c3;
  --color-quote-border: #c1a776;
  --color-focus: #8a5a2b;
  --theme-color-meta: #f4ecd8;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --color-bg: #15171c;
    --color-surface: #1c1f25;
    --color-surface-elevated: #242832;
    --color-text: #ece8df;
    --color-muted: #9c9c9c;
    --color-border: #2a2d35;
    --color-accent: #5fb793;
    --color-link: #5fb793;
    --color-link-hover: #8ed0b3;
    --color-quote-bg: #20242c;
    --color-quote-border: #3f4854;
    --color-focus: #8ed0b3;
    --theme-color-meta: #15171c;
  }
}

:root {
  --reader-scale: 1;
  --font-body: "Iowan Old Style", "Charter", Georgia, "Times New Roman", serif;
  --font-heading: "Avenir Next", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-arabic: "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
}
:root[data-font-size="s"]  { --reader-scale: 0.9; }
:root[data-font-size="m"]  { --reader-scale: 1; }
:root[data-font-size="l"]  { --reader-scale: 1.15; }
:root[data-font-size="xl"] { --reader-scale: 1.3; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
}
[lang="ar"], .arabic {
  font-family: var(--font-arabic);
  direction: rtl;
  unicode-bidi: isolate;
  font-size: 1.25em;
  line-height: 2;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
