/* دليل ميداني رقمي: ورق بارد مائل للأخضر، حبر داكن، أزرق الرفراف للتفاعل، والمُغْرة للأبواب والعناوين الثانوية. */
:root {
  --bg: #f2f4f0;
  --surface: #fbfcfa;
  --surface-2: #e8ece6;
  --ink: #18211e;
  --muted: #5b6a64;
  --line: #d5ddd7;
  --accent: #0d6b70;
  --accent-ink: #ffffff;
  --accent-soft: #dcebea;
  --ochre: #9a6714;
  --ochre-soft: #f3e6cc;
  --ok-bg: #dcefe3; --ok-ink: #17583a;
  --warn-bg: #f7e8c9; --warn-ink: #714a07;
  --danger-bg: #f6dbd5; --danger-ink: #862313;
  --shadow-sm: 0 1px 2px rgba(20, 40, 35, .06);
  --shadow: 0 1px 2px rgba(20, 40, 35, .05), 0 6px 18px rgba(20, 40, 35, .08);
  --shadow-lg: 0 2px 4px rgba(20, 40, 35, .06), 0 14px 34px rgba(20, 40, 35, .14);

  --display: 'Reem Kufi', 'Noto Kufi Arabic', 'IBM Plex Sans Arabic', sans-serif;
  --entry: 'Amiri', 'Noto Naskh Arabic', serif;
  --body: 'Noto Naskh Arabic', 'Amiri', serif;
  --ui: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;

  --r-sm: 8px; --r: 14px; --r-lg: 20px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1513; --surface: #152019; --surface-2: #1c2a24; --ink: #e8efeb; --muted: #9db0a8; --line: #2a3b34;
    --accent: #5cc4c0; --accent-ink: #062322; --accent-soft: #173533; --ochre: #e0ac57; --ochre-soft: #3a2c13;
    --ok-bg: #163527; --ok-ink: #8fdcb3; --warn-bg: #3b2d11; --warn-ink: #f1c878; --danger-bg: #3e1912; --danger-ink: #f3a592;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.35), 0 6px 18px rgba(0,0,0,.35);
    --shadow-lg: 0 2px 4px rgba(0,0,0,.4), 0 14px 34px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1513; --surface: #152019; --surface-2: #1c2a24; --ink: #e8efeb; --muted: #9db0a8; --line: #2a3b34;
  --accent: #5cc4c0; --accent-ink: #062322; --accent-soft: #173533; --ochre: #e0ac57; --ochre-soft: #3a2c13;
  --ok-bg: #163527; --ok-ink: #8fdcb3; --warn-bg: #3b2d11; --warn-ink: #f1c878; --danger-bg: #3e1912; --danger-ink: #f3a592;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.35), 0 6px 18px rgba(0,0,0,.35);
  --shadow-lg: 0 2px 4px rgba(0,0,0,.4), 0 14px 34px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.85; }
a { color: var(--accent); text-underline-offset: 3px; }
img, video { max-width: 100%; display: block; }
svg.i { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.18em; }
.muted { color: var(--muted); font-size: .9em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 16px; top: -60px; z-index: 50; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: var(--r-sm); font-family: var(--ui); }
.skip:focus { top: 12px; }
main { max-width: 1200px; margin: 0 auto; padding-block: 28px 72px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); outline: none; }
:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; border-radius: 4px; }
main:focus, main:focus-visible { outline: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- الشريط العلوي ---------- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; gap: 10px; align-items: center; font-family: var(--display); font-size: 1.45rem; color: var(--ink); text-decoration: none; }
.brand svg { width: 34px; height: 34px; color: var(--accent); }
.topnav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; font-family: var(--ui); font-size: .95rem; }
.topnav a { color: var(--ink); text-decoration: none; padding: 8px 12px; border-radius: 999px; min-height: 40px; display: inline-flex; align-items: center; }
.topnav a:hover { background: var(--surface-2); }
.topnav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

@media (max-width: 600px) {
  .topbar { row-gap: 2px; padding-block: 6px; }
  .brand { font-size: 1.2rem; }
  .brand svg { width: 28px; height: 28px; }
  .topnav { width: 100%; justify-content: space-between; font-size: .9rem; }
  .topnav a { padding: 8px 10px; }
  .topnav .lbl { display: none; }
  .topnav .btn { padding: 8px 12px; min-width: 44px; justify-content: center; }
}
.btn {
  font-family: var(--ui); font-size: .92rem; font-weight: 600; cursor: pointer; border-radius: 999px; padding: 8px 18px; min-height: 42px;
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), background .15s;
}
.btn:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }

/* ---------- الرئيسية ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 36px; align-items: center; padding-block: 24px 12px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; gap: 24px; } }
.eyebrow { font-family: var(--ui); font-size: .85rem; font-weight: 600; color: var(--ochre); letter-spacing: .02em; margin: 0 0 4px; }
.hero h1 { font-family: var(--display); font-weight: 600; font-size: clamp(2.8rem, 7vw, 4.8rem); line-height: 1.15; margin: 0; text-wrap: balance; }
.subtitle { font-family: var(--entry); font-size: clamp(1.3rem, 3vw, 1.75rem); margin: 6px 0 14px; color: var(--muted); }
.lead { max-width: 60ch; margin: 0 0 22px; }
.search { position: relative; display: block; max-width: 560px; }
.search svg { position: absolute; inset-inline-start: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; font: 500 1rem var(--ui); padding: 14px 50px 14px 20px; min-height: 52px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.results { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; max-width: 560px; }
.results a { display: inline-flex; gap: 6px; align-items: baseline; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; text-decoration: none; font-family: var(--ui); font-size: .92rem; }
.results a:hover { border-color: var(--accent); }

.mosaic { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mosaic a { position: relative; border-radius: var(--r); overflow: hidden; aspect-ratio: 1; background: var(--surface-2); box-shadow: var(--shadow); max-width: 100%; }
.mosaic a:nth-child(1) { grid-column: span 2; grid-row: span 2; }
.mosaic img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.mosaic a:hover img { transform: scale(1.05); }
.mosaic span { position: absolute; inset: auto 0 0; padding: 18px 10px 6px; font-family: var(--entry); font-size: 1.05rem; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.65)); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 28px 0 0; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; }
.stats dt { font-family: var(--ui); font-size: .82rem; color: var(--muted); }
.stats dd { margin: 0; font-family: var(--display); font-size: 1.9rem; line-height: 1.3; color: var(--ink); font-variant-numeric: tabular-nums; }

.section-title { font-family: var(--display); font-weight: 600; font-size: 2rem; margin: 48px 0 4px; }
.section-note { color: var(--muted); max-width: 70ch; margin: 0; }

.letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; margin-top: 18px; }
.letter {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 104px;
  border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow-sm); transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s;
}
a.letter:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.letter .ch { font-family: var(--display); font-size: 2.5rem; line-height: 1.1; color: var(--accent); }
.letter .cnt { font-family: var(--ui); font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.letter.empty { background: transparent; border-style: dashed; box-shadow: none; }
.letter.empty .ch { color: var(--line); }

.more-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; margin-top: 18px; }
.card-link {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s;
}
.card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.card-link .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.card-link .ic svg { width: 24px; height: 24px; }
.card-link strong { display: block; font-family: var(--display); font-weight: 600; font-size: 1.2rem; }
.card-link small { color: var(--muted); font-family: var(--ui); }
.card-link .arrow { color: var(--muted); }

/* ---------- الصفحات الداخلية ---------- */
.crumbs { font-family: var(--ui); font-size: .88rem; color: var(--muted); margin-bottom: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.page-head h1 { font-family: var(--display); font-weight: 600; font-size: clamp(2rem, 5vw, 2.8rem); margin: 0; line-height: 1.3; }
.page-head h1 .count { font-family: var(--ui); font-size: 1rem; font-weight: 500; color: var(--muted); }
.page-meta { color: var(--muted); font-family: var(--ui); font-size: .92rem; margin: 10px 0 0; }

.fasl-index { display: flex; flex-wrap: wrap; gap: 8px; padding-block: 14px 4px; }
.fasl-index a {
  flex: none; display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 4px 14px; min-height: 38px; text-decoration: none; font-family: var(--ui); font-size: .9rem; color: var(--ink);
}
.fasl-index a:hover { border-color: var(--accent); color: var(--accent); }
.fasl-index .n { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }

.fasl { margin-top: 28px; scroll-margin-top: 130px; }
.fasl-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.fasl-head h2 { font-family: var(--display); font-weight: 600; font-size: 1.5rem; margin: 0; color: var(--ochre); display: flex; align-items: center; gap: 10px; }
.fasl-head h2 .count { font-family: var(--ui); font-size: .9rem; font-weight: 500; color: var(--muted); }

/* بطاقة الطائر */
.bird-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 14px; }
@media (max-width: 600px) {
  .bird-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .bird-card .nm { font-size: 1.05rem; }
  .bird-card .body { padding: 8px 10px 10px; }
}
.bird-card {
  display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.bird-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.bird-card .ph { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.bird-card .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.bird-card:hover .ph img { transform: scale(1.04); }
.bird-card .ph .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.bird-card .ph .noimg svg { width: 44px; height: 44px; opacity: .45; }
.bird-card .tags { position: absolute; inset: 8px 8px auto 8px; display: flex; gap: 6px; justify-content: space-between; pointer-events: none; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; font-family: var(--ui); font-size: .72rem; font-weight: 600; line-height: 1;
  padding: 5px 8px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--ink); backdrop-filter: blur(4px);
}
.tag svg { width: 13px; height: 13px; }
.tag.edited { background: var(--ochre); color: #fff; }
.bird-card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.bird-card .nm { font-family: var(--entry); font-weight: 700; font-size: 1.18rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bird-card .sci { font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: right; }
.bird-card .status { margin-top: auto; padding-top: 6px; display: flex; align-items: center; gap: 6px; font-family: var(--ui); font-size: .75rem; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok-ink); flex: none; }
.dot.NT, .dot.VU, .dot.DD { background: var(--warn-ink); }
.dot.EN, .dot.CR, .dot.EW, .dot.EX { background: var(--danger-ink); }

.more-wrap { display: flex; justify-content: center; margin-top: 16px; }

.order { margin-top: 30px; }
.order-title { font-family: var(--display); font-weight: 600; font-size: 1.35rem; color: var(--ochre); margin: 0 0 10px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.order-title bdi { font-family: Georgia, serif; font-style: italic; font-size: .9rem; color: var(--muted); font-weight: 400; }
.fam-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 8px; }
.fam-list a {
  display: grid; grid-template-columns: 1fr auto; gap: 0 10px; align-items: center; padding: 10px 14px; min-height: 56px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: border-color .15s, background .15s;
}
.fam-list a:hover { border-color: var(--accent); background: var(--accent-soft); }
.fam-list .fn-ar { font-family: var(--entry); font-weight: 700; font-size: 1.08rem; line-height: 1.4; }
.fam-list bdi { grid-column: 1; font-family: Georgia, serif; font-style: italic; font-size: .8rem; color: var(--muted); }
.fam-list .cnt { grid-row: 1 / span 2; grid-column: 2; font-family: var(--ui); font-size: .82rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 10px; font-variant-numeric: tabular-nums; }

/* ---------- صفحتا الطائر ---------- */
.bird-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.spread { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
@media (max-width: 920px) { .spread { grid-template-columns: 1fr; } }
.sheet { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 30px 30px 34px; box-shadow: var(--shadow); min-width: 0; }
@media (max-width: 520px) { .sheet { padding: 22px 18px 26px; } }
.sheet-head { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.place { margin: 0 0 14px; display: inline-flex; flex-wrap: wrap; gap: 6px; font-family: var(--ui); font-size: .8rem; font-weight: 600; color: var(--ochre); background: var(--ochre-soft); border-radius: 999px; padding: 3px 12px; }
.entry-title { font-family: var(--entry); font-weight: 700; font-size: clamp(2rem, 5vw, 2.7rem); margin: 0; line-height: 1.6; text-wrap: balance; }
.sheet-head.small .entry-title { font-size: 1.7rem; }
.sci { margin: 0; color: var(--muted); font-size: .95rem; }
.sci bdi[lang="la"] { font-style: italic; font-family: Georgia, serif; }
.page-no { position: absolute; top: 16px; inset-inline-end: 20px; font-family: var(--ui); font-size: .75rem; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 2px 10px; }
.bird-figure { margin: 0 0 14px; }
.bird-figure img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--r); background: var(--surface-2); }
.bird-figure figcaption { font-family: var(--ui); font-size: .76rem; color: var(--muted); margin-top: 6px; }
.field { margin-top: 18px; }
.field h3 { font-family: var(--display); font-weight: 600; font-size: 1.15rem; color: var(--accent); margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.field h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.field h4 { margin: 16px 0 6px; font-family: var(--ui); font-size: .95rem; }
.field p { margin: 0 0 8px; max-width: 70ch; }
@media (min-width: 700px) { .field p { text-align: justify; } }
.gap { color: var(--muted); font-size: .92rem; background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 12px; text-align: start !important; }
.fn {
  font-family: var(--ui); font-size: .66em; font-weight: 600; vertical-align: super; text-decoration: none; margin-inline-start: 2px;
  background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 1px 5px; line-height: 1;
}
.root-chips { display: flex; gap: 8px; margin: 4px 0 10px; }
.root-chips span { font-family: var(--entry); font-weight: 700; font-size: 1.7rem; width: 50px; height: 50px; display: grid; place-items: center; border: 1.5px solid var(--ochre); color: var(--ochre); border-radius: 12px; background: var(--ochre-soft); }
.entries { margin: 0; display: grid; gap: 8px; }
.entries div { padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.entries dt { font-family: var(--entry); font-weight: 700; font-size: 1.15rem; }
.entries dd { margin: 0; }
.ayah { font-family: var(--entry); font-size: 1.25rem; line-height: 2; margin: 8px 0; padding: 10px 16px; background: var(--accent-soft); border-radius: var(--r-sm); border-inline-start: 3px solid var(--accent); }
.facts { display: grid; grid-template-columns: auto 1fr; margin: 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.facts dt, .facts dd { padding: 8px 12px; border-bottom: 1px solid var(--line); margin: 0; }
.facts dt { font-family: var(--ui); font-size: .88rem; color: var(--muted); background: var(--surface-2); }
.facts dd { min-width: 0; overflow-wrap: anywhere; }
.facts dt:last-of-type, .facts dd:last-of-type { border-bottom: 0; }
.facts bdi[lang="la"] { font-style: italic; font-family: Georgia, serif; }
.iucn { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 1px 10px; font-family: var(--ui); font-size: .85rem; background: var(--ok-bg); color: var(--ok-ink); }
.iucn-NT, .iucn-VU, .iucn-DD { background: var(--warn-bg); color: var(--warn-ink); }
.iucn-EN, .iucn-CR, .iucn-EW, .iucn-EX { background: var(--danger-bg); color: var(--danger-ink); }
.media-block audio, .media-block video { width: 100%; }
.media-block audio { height: 44px; }
.media-block video { border-radius: var(--r); background: #000; aspect-ratio: 16 / 9; }
.notes { background: var(--surface-2); border-radius: var(--r); padding: 14px 16px 16px; }
.notes h3::after { background: color-mix(in srgb, var(--line) 70%, var(--muted)); }
.notes ol, .media-credits { font-family: var(--ui); font-size: .8rem; line-height: 1.8; padding-inline-start: 22px; margin: 0; }
.notes li { margin-bottom: 6px; overflow-wrap: anywhere; }
.notes li:target { background: var(--warn-bg); border-radius: 4px; }
.badge { display: inline-flex; align-items: center; font-family: var(--ui); font-size: .7rem; font-weight: 600; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge.pending { background: var(--warn-bg); color: var(--warn-ink); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); min-width: 0; }
.pager a:hover { border-color: var(--accent); }
.pager a.next { text-align: left; }
.pager small { font-family: var(--ui); color: var(--muted); font-size: .8rem; }
.pager strong { font-family: var(--entry); font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.prose { max-width: 780px; margin: 0 auto; background: var(--surface); padding: 32px; border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: var(--shadow); }
@media (max-width: 520px) { .prose { padding: 22px 18px; } }
.prose h1 { font-family: var(--display); font-weight: 600; margin-top: 0; }
.prose h2 { font-family: var(--display); font-weight: 600; font-size: 1.3rem; color: var(--accent); margin-top: 26px; }
.prose li { margin-bottom: 6px; }

.loading { display: grid; place-items: center; gap: 12px; color: var(--muted); padding: 90px 0; font-family: var(--ui); }
.loading::before { content: ""; width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
body.exporting { cursor: progress; }

.footer { border-top: 1px solid var(--line); background: var(--surface); padding-block: 28px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); text-align: center; font-family: var(--ui); font-size: .9rem; }
.footer p { margin: 0; }
.footer .title { font-family: var(--entry); font-size: 1.15rem; }

#print-root { display: none; }

/* ---------- الطباعة / PDF ---------- */
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  :root { --bg: #fff; --surface: #fff; --surface-2: #f2f4f2; --ink: #000; --muted: #555; --line: #bbb; --accent: #0d6b70; --ochre: #8a5c10; --ochre-soft: #fff; }
  body { font-size: 11.5pt; line-height: 1.75; background: #fff; }
  body::before, .topbar, main, .footer, .skip { display: none !important; }
  #print-root { display: block; }
  .cover { height: 250mm; display: flex; flex-direction: column; justify-content: center; text-align: center; page-break-after: always; }
  .cover h1 { font-family: var(--display); font-size: 40pt; margin: 0; }
  .sheet { box-shadow: none; border: none; border-radius: 0; padding: 0; page-break-after: always; break-after: page; }
  .sheet:last-child { page-break-after: auto; }
  .bird-figure img { max-height: 85mm; }
  .field { break-inside: avoid; }
  .notes { break-inside: auto; background: none; padding: 0; }
  a { color: inherit; text-decoration: none; }
  .fn { background: none; padding: 0; }
  .place { background: none; padding: 0; }
}
