/* ZAD — a bilingual edition.
   The page is set like a printed book: one measure, ruled entries, gold used
   only where the logo already uses it. Arabic leads, English follows after the
   colophon rule, so a reader of either language gets a whole page rather than
   a translation hidden behind a toggle. */

@font-face {
  font-family: "Amiri";
  src: url("fonts/Amiri-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Amiri";
  src: url("fonts/Amiri-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Tajawal";
  src: url("fonts/Tajawal-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Tajawal";
  src: url("fonts/Tajawal-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Tajawal";
  src: url("fonts/Tajawal-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --paper: #d9edde;
  --paper-deep: #c6dec6;
  --ink: #1e3a26;
  --ink-soft: #456b4e;
  --ink-faint: #7a9a82;
  --accent: #3f6b48;
  --signal: #2c7a72;
  --gold: #b8904f;
  --rule: rgba(30, 58, 38, 0.16);
  --rule-soft: rgba(30, 58, 38, 0.08);
  --measure: 34rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #101711;
    --paper-deep: #16211a;
    --ink: #e2ede4;
    --ink-soft: #a7c0ae;
    --ink-faint: #71907a;
    --accent: #93c8a1;
    --signal: #6fc4b8;
    --gold: #d6ab68;
    --rule: rgba(226, 237, 228, 0.17);
    --rule-soft: rgba(226, 237, 228, 0.08);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--paper);
  /* Paper tooth. Generated in the file so nothing is fetched from outside. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='0.055'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.9;
  padding: clamp(2.5rem, 7vw, 6rem) 1.5rem clamp(4rem, 10vw, 8rem);
}

main {
  max-width: var(--measure);
  margin: 0 auto;
}

/* ── Masthead ──────────────────────────────────────────────── */

.mark {
  display: block;
  width: clamp(84px, 18vw, 116px);
  height: auto;
  margin-inline: auto;
  margin-bottom: 2.5rem;
}

.title {
  font-family: "Amiri", serif;
  font-weight: 700;
  font-size: clamp(3.6rem, 15vw, 6rem);
  line-height: 1;
  margin: 0;
  text-align: center;
}

.gloss {
  font-family: "Amiri", serif;
  font-size: clamp(1rem, 3.4vw, 1.2rem);
  color: var(--gold);
  text-align: center;
  margin: 1rem 0 0;
}
/* Amiri ships no true italic, and a synthesised slant on Arabic letterforms
   reads as a rendering fault. The English gloss can have the real thing. */
section[lang="en"] .gloss { font-style: italic; }

.standfirst {
  margin: 2.75rem 0 0;
  font-size: 1.06rem;
  color: var(--ink-soft);
}

/* ── Divider: the lozenge the logo already uses between its letters ───── */

.divider {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: clamp(3.5rem, 9vw, 5.5rem) 0;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}
.divider svg { display: block; width: 46px; height: 12px; }
.divider .lozenge { fill: var(--gold); }
.divider .lozenge.small { opacity: .5; }

/* ── Contents: the provisions, ruled like a book's index ───── */

h2 {
  font-family: "Amiri", serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 5vw, 1.9rem);
  line-height: 1.4;
  margin: 0 0 1.75rem;
  color: var(--accent);
}

.contents { list-style: none; margin: 0; padding: 0; }

.contents li {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: 0 1rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.contents li:first-child { border-top: 1px solid var(--rule-soft); }

.contents .num {
  font-family: "Amiri", serif;
  font-size: 1.15rem;
  color: var(--gold);
  line-height: 1.6;
  grid-row: span 2;
}
.contents .name {
  font-weight: 500;
  font-size: 1.08rem;
  line-height: 1.6;
}
.contents .note {
  color: var(--ink-soft);
  font-size: .96rem;
  line-height: 1.75;
}

/* ── Plates: the screens, set the way a book sets its figures ── */

.plate-hero {
  margin: clamp(2.5rem, 7vw, 3.5rem) auto 0;
  max-width: 17rem;
}
.plate-hero img,
.plate img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1.6rem;
  border: 1px solid var(--rule);
  box-shadow: 0 1.4rem 3rem -1.2rem rgba(30, 58, 38, 0.28);
}
@media (prefers-color-scheme: dark) {
  .plate-hero img,
  .plate img { box-shadow: 0 1.4rem 3rem -1.2rem rgba(0, 0, 0, 0.65); }
}

/* The strip runs past the measure on purpose: a reader scrolls it the way
   they would turn a plate section, rather than meeting a wall of thumbnails. */
.plates {
  display: flex;
  gap: 1.1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: .5rem .25rem 1.5rem;
  margin-inline: calc(50% - 50vw);
  padding-inline: max(1.5rem, calc(50vw - var(--measure) / 2));
  scrollbar-width: none;
}
.plates::-webkit-scrollbar { display: none; }

.plate {
  flex: 0 0 13.5rem;
  scroll-snap-align: center;
  margin: 0;
}
.plate figcaption {
  margin-top: .85rem;
  font-size: .88rem;
  line-height: 1.6;
  color: var(--ink-soft);
  text-align: center;
}
.plate figcaption b {
  display: block;
  font-weight: 500;
  color: var(--ink);
}

/* ── Prose ─────────────────────────────────────────────────── */

p { margin: 0 0 1.15rem; }
p:last-child { margin-bottom: 0; }

h3 {
  font-family: "Amiri", serif;
  font-weight: 700;
  font-size: 1.22rem;
  color: var(--accent);
  margin: 2.75rem 0 .65rem;
}

ul.plain { margin: 0 0 1.15rem; padding-inline-start: 1.15rem; }
ul.plain li { margin-bottom: .5rem; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em;
  direction: ltr;
  unicode-bidi: isolate;
  color: var(--signal);
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .22em; }
a:hover { color: var(--gold); }

/* ── Availability + footer ─────────────────────────────────── */

.status {
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 1.4rem 1.5rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: .98rem;
}
.status strong {
  display: block;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: .3rem;
}

.colophon {
  margin-top: clamp(3.5rem, 9vw, 5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule-soft);
  font-size: .9rem;
  color: var(--ink-faint);
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.4rem;
  justify-content: center;
}

/* ── The English half ──────────────────────────────────────── */

section[lang="en"] {
  direction: ltr;
  text-align: left;
}
section[lang="en"] .title,
section[lang="en"] .gloss { text-align: center; }
section[lang="en"] .contents .num { font-variant-numeric: tabular-nums; }

.edition-rule {
  margin: clamp(5rem, 13vw, 8rem) 0 clamp(3rem, 8vw, 4.5rem);
  border: 0;
  border-top: 1px solid var(--rule);
  position: relative;
}
.edition-rule::after {
  content: attr(data-label);
  position: absolute;
  top: -.72em;
  left: 50%;
  transform: translateX(-50%);
  background: var(--paper);
  padding: 0 1rem;
  font-size: .78rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ── Load ──────────────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(9px);
    animation: rise .85s cubic-bezier(.22, .68, .3, 1) forwards;
  }
  .reveal:nth-child(1) { animation-delay: .05s; }
  .reveal:nth-child(2) { animation-delay: .16s; }
  .reveal:nth-child(3) { animation-delay: .27s; }
  .reveal:nth-child(4) { animation-delay: .38s; }
}
@keyframes rise {
  to { opacity: 1; transform: none; }
}
