/* ==========================================================================
   The Islamic Dilemma — stylesheet

   The organising idea: this is a critical edition. Quotations are ruled and
   colour-coded by tradition (rubric red for biblical text, after rubricated
   manuscript initials; deep green for Quranic text). Nothing else in the
   palette competes with that distinction.
   ========================================================================== */

/* --- Tokens ------------------------------------------------------------- */

:root {
  --paper:        #f4f2ed;
  --paper-2:      #eae7df;
  --paper-3:      #e0dcd2;
  --ink:          #1a1f24;
  --ink-soft:     #454d55;
  --muted:        #6f767d;
  --field:        #233240;
  --field-ink:    #e9e6df;
  --rule:         #d5d0c5;
  --rule-soft:    #e3dfd6;

  --rubric:       #7c1f2c;
  --rubric-tint:  #fbf1f0;
  --verdant:      #1f6b5e;
  --verdant-tint: #edf4f1;
  --amber:        #8a6414;
  --amber-tint:   #faf3e4;

  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --prose:   "Source Serif 4", Charter, Georgia, serif;
  --chrome:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --naskh:   "Amiri", "Scheherazade New", "Noto Naskh Arabic", "Traditional Arabic", serif;

  --measure: 70ch;
  --shell:   min(1140px, 100% - 3rem);
  --rail:    9rem;
  --bleed:   7rem;

  --step: 1.6rem;
}

[data-theme="dark"] {
  --paper:        #15191d;
  --paper-2:      #1c2126;
  --paper-3:      #242a30;
  --ink:          #e9e5dd;
  --ink-soft:     #b8bcc0;
  --muted:        #8e959b;
  --field:        #0e1216;
  --field-ink:    #e9e6df;
  --rule:         #2f363d;
  --rule-soft:    #262d33;

  --rubric:       #dd8189;
  --rubric-tint:  #241a1c;
  --verdant:      #6fc4b1;
  --verdant-tint: #14211f;
  --amber:        #d3ac5c;
  --amber-tint:   #221d12;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:#15191d; --paper-2:#1c2126; --paper-3:#242a30;
    --ink:#e9e5dd; --ink-soft:#b8bcc0; --muted:#8e959b;
    --field:#0e1216; --field-ink:#e9e6df;
    --rule:#2f363d; --rule-soft:#262d33;
    --rubric:#dd8189; --rubric-tint:#241a1c;
    --verdant:#6fc4b1; --verdant-tint:#14211f;
    --amber:#d3ac5c; --amber-tint:#221d12;
  }
}

/* --- Reset -------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 6rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--prose);
  font-size: 17px;
  line-height: 1.72;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }
img { height: auto; display: block; }

:focus-visible {
  outline: 2px solid var(--rubric);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute; top: .5rem; left: .5rem; z-index: 99;
  background: var(--field); color: var(--field-ink);
  padding: .7rem 1.1rem; font-family: var(--chrome); font-size: .9rem;
  width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}
.skip:focus { width: auto; height: auto; clip-path: none; }

/* --- Masthead ----------------------------------------------------------- */

.masthead {
  position: sticky; top: 0; z-index: 40;
  background: var(--field);
  color: var(--field-ink);
  border-bottom: 3px solid var(--rubric);
}

.masthead__bar {
  width: var(--shell); margin-inline: auto;
  display: flex; align-items: center; gap: 1rem;
  min-height: 4.4rem;
}

.brand { display: flex; align-items: center; gap: .85rem; text-decoration: none; color: inherit; margin-right: auto; }
.brand__mark svg { width: 30px; height: 21px; display: block; }
.brand__mark rect { fill: #b9414e; }
.brand__mark .mark--b { fill: #3f9c8b; }
.brand__words { display: flex; flex-direction: column; }
.brand__name {
  font-family: var(--display); font-weight: 700; font-size: 1.22rem;
  letter-spacing: -.012em; line-height: 1.15;
}
.brand__tag {
  font-family: var(--chrome); font-size: .74rem; letter-spacing: .01em;
  color: #a9b4bf; line-height: 1.3;
}

.theme-btn, .menu-btn {
  background: transparent; border: 1px solid rgba(255,255,255,.22);
  color: inherit; cursor: pointer; border-radius: 3px;
  font-family: var(--chrome); font-size: .82rem;
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .45rem .7rem;
}
.theme-btn { padding: .45rem; }
.theme-btn svg { width: 17px; height: 17px; fill: currentColor; }
.theme-btn:hover, .menu-btn:hover { border-color: rgba(255,255,255,.5); }

.menu-btn { display: none; }
.menu-btn__bars { display: inline-flex; flex-direction: column; gap: 3px; }
.menu-btn__bars i { width: 15px; height: 1.6px; background: currentColor; display: block; }

/* Grouped section navigation */
.sitenav {
  width: var(--shell); margin-inline: auto;
  display: flex; flex-wrap: wrap; align-items: stretch;
  padding: .1rem 0 .55rem;
  border-top: 1px solid rgba(255,255,255,.12);
}
.sitenav__group { display: flex; align-items: center; padding-right: .8rem; margin-right: .8rem; }
.sitenav__group + .sitenav__group { border-left: 1px solid rgba(255,255,255,.14); padding-left: .8rem; }
.sitenav__group:last-child { margin-right: 0; padding-right: 0; }
.sitenav__glabel {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.sitenav__list { display: flex; gap: .8rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.sitenav a {
  font-family: var(--chrome); font-size: .815rem; color: #dfe4e9;
  text-decoration: none; padding: .34rem 0;
  border-bottom: 2px solid transparent; display: block; white-space: nowrap;
}
.sitenav a:hover { border-bottom-color: rgba(255,255,255,.4); }
.sitenav a[aria-current="page"] { color: #fff; border-bottom-color: var(--rubric); font-weight: 500; }

/* --- Page shell --------------------------------------------------------- */

.page { width: var(--shell); margin: 0 auto 5rem; }

.page__head {
  padding: 3.2rem 0 1.8rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.6rem;
}
.page__title {
  font-family: var(--display);
  font-size: clamp(2.1rem, 1.3rem + 3vw, 3.4rem);
  font-weight: 700; line-height: 1.06; letter-spacing: -.022em;
  margin: 0 0 .7rem; max-width: 20ch;
}
.page__stand {
  font-size: 1.16rem; line-height: 1.6; color: var(--ink-soft);
  max-width: 58ch; margin: 0;
}

.page__body > p,
.page__body > ul,
.page__body > ol,
.page__body > h3,
.page__body > .h-sec,
.page__body > .callout,
.page__body > .quote,
.page__body > .datalist,
.page__body > .qa,
.page__body > .person,
.page__body > .rasm,
.shelf__blurb { max-width: var(--measure); }

/* Figures, tables and grids reach past the reading column on wide screens. */
.timeline, .table-wrap, .plate, .deck, .books, .glossary, .filter, .shelf__head {
  max-width: none;
}
@media (min-width: 1100px) { .page { padding-left: var(--rail); } }

/* --- Prose -------------------------------------------------------------- */

p { margin: 0 0 1.15rem; }
.page__body > p, .page__body > ul, .page__body > ol { max-width: var(--measure); }

@media (min-width: 900px) {
  .page__body > p { text-align: justify; hyphens: auto; }
}

a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: .18em; }
a:hover { text-decoration-color: currentColor; }

strong { font-weight: 600; }

.h-sec {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.45rem, 1.1rem + 1.2vw, 1.95rem);
  line-height: 1.2; letter-spacing: -.015em;
  margin: 3.2rem 0 1.1rem; position: relative;
  padding-bottom: .5rem; border-bottom: 1px solid var(--rule-soft);
  display: flex; align-items: baseline; gap: .6rem;
}
.h-sec__rail {
  font-family: var(--chrome); font-size: .78rem; font-weight: 500;
  color: var(--rubric); flex: none; letter-spacing: .01em;
}
.h-sec__text { flex: 1; }
.h-sec__link {
  font-family: var(--chrome); font-size: .9rem; color: var(--rule);
  text-decoration: none; opacity: 0; transition: opacity .15s;
}
.h-sec:hover .h-sec__link { opacity: 1; }

@media (min-width: 1100px) {
  .h-sec__rail { position: absolute; left: calc(-1 * var(--rail)); width: calc(var(--rail) - 1.5rem); text-align: right; }
}

h3 {
  font-family: var(--display); font-weight: 600; font-size: 1.24rem;
  line-height: 1.3; letter-spacing: -.008em;
  margin: 2.2rem 0 .6rem;
}
h4 { font-family: var(--chrome); font-size: .95rem; font-weight: 600; margin: 1.6rem 0 .4rem; }

ul, ol { margin: 0 0 1.3rem; padding-left: 1.3rem; }
li { margin-bottom: .5rem; }
li::marker { color: var(--muted); }

/* Reference links — the tradition is encoded in the underline colour. */
.ref { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .16em; white-space: nowrap; }
.ref--bible { color: var(--rubric); text-decoration-color: color-mix(in srgb, var(--rubric) 40%, transparent); }
.ref--quran { color: var(--verdant); text-decoration-color: color-mix(in srgb, var(--verdant) 40%, transparent); }
.ref--out   { text-decoration-color: var(--rule); }
.ref:hover { text-decoration-color: currentColor; }

/* --- Quotation blocks --------------------------------------------------- */

.quote {
  margin: 1.9rem 0; padding: 1.05rem 0 1.05rem 1.4rem;
  border-left: 3px solid var(--rule);
  background: transparent;
}
.quote--bible { border-left-color: var(--rubric); background: var(--rubric-tint); }
.quote--quran { border-left-color: var(--verdant); background: var(--verdant-tint); }
.quote--bible, .quote--quran { padding-right: 1.2rem; }

.quote__head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem;
  margin-bottom: .55rem;
}
.quote__ref {
  font-family: var(--chrome); font-size: .82rem; font-weight: 600; letter-spacing: .005em;
}
.quote--bible .quote__ref { color: var(--rubric); }
.quote--quran .quote__ref { color: var(--verdant); }

.quote__links { display: flex; gap: .75rem; margin-left: auto; }
.quote__links a {
  font-family: var(--chrome); font-size: .75rem; color: var(--muted);
  text-decoration: none; border-bottom: 1px solid var(--rule);
}
.quote__links a:hover { color: var(--ink); border-bottom-color: currentColor; }

.quote__text { margin: 0; font-size: 1.06rem; line-height: 1.66; }
.quote__text p { margin: 0 0 .7rem; }
.quote__text p:last-child { margin-bottom: 0; }

.quote__arabic {
  font-family: var(--naskh); font-size: 1.85rem; line-height: 2.1;
  margin: 0 0 .6rem; color: var(--ink);
}

.quote__note {
  margin-top: .8rem; padding-top: .7rem;
  border-top: 1px solid var(--rule-soft);
  font-size: .93rem; line-height: 1.6; color: var(--ink-soft);
}

/* --- Callouts ----------------------------------------------------------- */

.callout {
  margin: 2rem 0; padding: 1.1rem 1.3rem;
  border: 1px solid var(--rule); border-radius: 4px;
  background: var(--paper-2);
}
.callout--key     { border-color: color-mix(in srgb, var(--amber) 45%, var(--rule)); background: var(--amber-tint); }
.callout--caution { border-left: 3px solid var(--rubric); }
.callout__title { font-family: var(--chrome); font-size: .88rem; font-weight: 600; margin: 0 0 .45rem; }
.callout__body { font-size: .98rem; }
.callout__body > *:last-child { margin-bottom: 0; }
.callout__body ul { margin-bottom: 0; }

/* --- Tables ------------------------------------------------------------- */

.table-wrap { overflow-x: auto; margin: 2rem 0; }
.ctable { width: 100%; border-collapse: collapse; font-size: .95rem; min-width: 640px; }
.ctable th, .ctable td { padding: .8rem .9rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule-soft); }
.ctable thead th {
  font-family: var(--chrome); font-size: .8rem; font-weight: 600;
  border-bottom: 2px solid var(--ink); background: transparent;
}
.ctable tbody th { font-weight: 600; width: 22%; }
.ctable .col--bible { color: var(--rubric); }
.ctable .col--quran { color: var(--verdant); }
.ctable tbody tr:hover { background: var(--paper-2); }

@media (min-width: 1100px) {
  .table-wrap--wide .ctable { font-size: .95rem; }
}

/* --- Data list (manuscripts, readings) ---------------------------------- */

.datalist { list-style: none; padding: 0; margin: 1.8rem 0; }
.datalist > li {
  display: grid; grid-template-columns: 6.5rem 1fr; gap: 0 1.2rem;
  padding: .95rem 0; border-top: 1px solid var(--rule-soft); margin: 0;
}
.datalist > li:last-child { border-bottom: 1px solid var(--rule-soft); }
.datalist__key {
  font-family: var(--chrome); font-size: .8rem; font-weight: 600;
  color: var(--rubric); padding-top: .18rem;
}
.datalist__val { font-size: .98rem; }
.datalist__val strong { display: block; font-family: var(--display); font-size: 1.06rem; font-weight: 600; margin-bottom: .1rem; }
@media (max-width: 520px) {
  .datalist > li { grid-template-columns: 1fr; gap: .25rem; }
}

/* --- Plates (images / drawings) ----------------------------------------- */

.plate { margin: 2.2rem 0; }
.plate img, .plate__drawn {
  border: 1px solid var(--rule); background: var(--paper-2); border-radius: 2px; overflow: hidden;
}
.plate__drawn svg { display: block; width: 100%; height: auto; }
.plate figcaption {
  font-family: var(--chrome); font-size: .8rem; line-height: 1.55;
  color: var(--muted); margin-top: .6rem; max-width: 60ch;
}
.plate__credit { display: block; margin-top: .15rem; }


/* --- Home: the facing-pages hero ---------------------------------------- */

.hero { padding: 3.4rem 0 2.6rem; }
.hero__grid { display: grid; gap: 2.4rem; }

@media (min-width: 940px) {
  .hero__grid { grid-template-columns: 1fr 1fr; align-items: center; gap: 3.2rem; }
}

.hero__title {
  font-family: var(--display);
  font-size: clamp(2.5rem, 1.2rem + 5vw, 4.4rem);
  font-weight: 700; line-height: 1.02; letter-spacing: -.03em;
  margin: 0 0 1.1rem;
}
.hero__lead { font-size: 1.2rem; line-height: 1.62; color: var(--ink-soft); margin: 0 0 1.6rem; max-width: 42ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .7rem; }

.btn {
  font-family: var(--chrome); font-size: .9rem; font-weight: 500;
  padding: .68rem 1.15rem; border-radius: 3px; text-decoration: none;
  border: 1px solid var(--ink); color: var(--ink); display: inline-block;
}
.btn--solid { background: var(--field); border-color: var(--field); color: var(--field-ink); }
.btn--solid:hover { background: var(--rubric); border-color: var(--rubric); }
.btn--ghost:hover { background: var(--paper-2); }

/* the spread itself */
.spread {
  display: grid; grid-template-columns: 1fr 1fr;
  border: 1px solid var(--rule); background: var(--paper-2);
  border-radius: 2px; overflow: hidden; position: relative;
}
.spread::after {
  content: ""; position: absolute; inset-block: 0; left: 50%; width: 1px;
  background: var(--rule);
}
.spread__page { padding: 1.5rem 1.2rem; min-height: 17rem; }
.spread__page--greek { background: color-mix(in srgb, var(--rubric-tint) 70%, var(--paper)); }
.spread__page--arabic { background: color-mix(in srgb, var(--verdant-tint) 70%, var(--paper)); display: flex; flex-direction: column; }

.spread__label {
  font-family: var(--chrome); font-size: .68rem; color: var(--muted);
  margin: 0 0 .9rem; line-height: 1.4;
}
.spread__greek {
  font-family: var(--prose); font-size: .82rem; line-height: 1.95;
  letter-spacing: .06em; word-break: break-all; color: var(--ink);
  margin: 0;
}
.spread__greek .nomen { border-top: 1px solid currentColor; }
.spread__gloss { font-size: .78rem; color: var(--muted); margin: .9rem 0 0; font-style: italic; line-height: 1.5; }

.spread__arabic {
  font-family: var(--naskh); font-size: 1.55rem; line-height: 2.2;
  direction: rtl; text-align: right; margin: auto 0; position: relative;
}
.spread__arabic span { display: block; }
.spread__arabic .pointed { position: absolute; inset: 0; opacity: 0; }

body.is-loaded .spread__arabic .bare    { animation: fadeOut .9s ease 1.4s forwards; }
body.is-loaded .spread__arabic .pointed { animation: fadeIn  .9s ease 1.4s forwards; }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes fadeIn  { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .spread__arabic .bare { opacity: 0; }
  .spread__arabic .pointed { opacity: 1; animation: none; }
  .spread__arabic .bare { animation: none; }
}

/* home section cards */
.deck { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); margin: 2.4rem 0; }
@media (min-width: 700px)  { .deck { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .deck { grid-template-columns: repeat(3, 1fr); } }

.deck__item { background: var(--paper); padding: 1.4rem 1.3rem; text-decoration: none; color: inherit; display: block; }
.deck__item:hover { background: var(--paper-2); }
.deck__no { font-family: var(--chrome); font-size: .72rem; color: var(--muted); display: block; margin-bottom: .5rem; }
.deck__t { font-family: var(--display); font-weight: 600; font-size: 1.1rem; margin: 0 0 .35rem; line-height: 1.25; }
.deck__d { font-size: .92rem; color: var(--ink-soft); margin: 0; line-height: 1.55; }

/* --- Timeline ----------------------------------------------------------- */

.timeline { margin: 2.2rem 0; }
.timeline svg { width: 100%; height: auto; display: block; }
.tl-axis  { stroke: var(--rule); stroke-width: 1.5; }
.tl-tick  { stroke: var(--rule); stroke-width: 1; }
.tl-year  { font-family: var(--chrome); font-size: 9px; fill: var(--muted); }
.tl-label { font-family: var(--chrome); font-size: 10px; fill: var(--ink); }
.tl-sub   { font-family: var(--chrome); font-size: 8.5px; fill: var(--muted); }
.tl-dot-b { fill: var(--rubric); }
.tl-dot-q { fill: var(--verdant); }
.tl-band  { fill: var(--verdant); opacity: .10; }

/* --- Q&A (Muslim responses) --------------------------------------------- */

.qa { border-top: 1px solid var(--rule); margin: 2.2rem 0 0; }
.qa__item { border-bottom: 1px solid var(--rule); padding: 1.4rem 0; }
.qa__claim {
  font-family: var(--display); font-weight: 600; font-size: 1.15rem;
  line-height: 1.35; margin: 0 0 .3rem; display: flex; gap: .7rem;
}
.qa__no { font-family: var(--chrome); font-size: .8rem; color: var(--muted); flex: none; padding-top: .25rem; }
.qa__strong {
  font-size: .98rem; color: var(--ink-soft);
  border-left: 2px solid var(--verdant); padding-left: .9rem; margin: .7rem 0 .9rem;
}
.qa__strong b { font-family: var(--chrome); font-size: .78rem; font-weight: 600; color: var(--verdant); display: block; margin-bottom: .2rem; }
.qa__reply b { font-family: var(--chrome); font-size: .78rem; font-weight: 600; color: var(--rubric); display: block; margin-bottom: .2rem; }
.qa__reply { border-left: 2px solid var(--rubric); padding-left: .9rem; font-size: .98rem; }
.qa__reply > *:last-child { margin-bottom: 0; }

/* --- Person entries ----------------------------------------------------- */

.person { display: grid; gap: 1.4rem; padding: 1.9rem 0; border-top: 1px solid var(--rule); }
.person:last-of-type { border-bottom: 1px solid var(--rule); }
@media (min-width: 640px) { .person { grid-template-columns: 6.5rem 1fr; } }

.person__art svg, .person__art img { width: 100%; border-radius: 2px; border: 1px solid var(--rule); display: block; }
.person__name { font-family: var(--display); font-weight: 700; font-size: 1.3rem; margin: 0 0 .1rem; line-height: 1.2; }
.person__role { font-family: var(--chrome); font-size: .82rem; color: var(--muted); margin: 0 0 .8rem; }
.person__body > *:last-child { margin-bottom: 0; }
.person__body h5 { font-family: var(--chrome); font-size: .8rem; font-weight: 600; margin: 1rem 0 .2rem; color: var(--ink-soft); }

/* --- Books -------------------------------------------------------------- */

.shelf { margin: 2.6rem 0; }
.shelf__head { border-bottom: 2px solid var(--ink); padding-bottom: .5rem; margin-bottom: .3rem; }
.shelf__title { font-family: var(--display); font-weight: 700; font-size: 1.55rem; margin: 0; letter-spacing: -.015em; }
.shelf__blurb { font-size: .98rem; color: var(--ink-soft); margin: .7rem 0 1.6rem; max-width: 62ch; }

.books { display: grid; gap: 1px; background: var(--rule-soft); border: 1px solid var(--rule-soft); }
@media (min-width: 780px) { .books { grid-template-columns: 1fr 1fr; } }

.book { display: grid; grid-template-columns: 92px 1fr; gap: 1.15rem; padding: 1.25rem; background: var(--paper); height: 100%; }
.book__art svg { width: 92px; height: auto; display: block; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.cover__title { font-family: var(--display); font-weight: 600; }
.cover__author { font-family: var(--chrome); }
.book__title { font-family: var(--display); font-weight: 600; font-size: 1.05rem; line-height: 1.28; margin: 0 0 .15rem; }
.book__meta { font-family: var(--chrome); font-size: .78rem; color: var(--muted); margin: 0 0 .5rem; }
.book__blurb { font-size: .92rem; line-height: 1.55; margin: 0 0 .6rem; }
.book__links { display: flex; gap: .7rem; flex-wrap: wrap; margin: 0; }
.book__links a {
  font-family: var(--chrome); font-size: .73rem; color: var(--muted);
  text-decoration: none; border-bottom: 1px solid var(--rule);
}
.book__links a:hover { color: var(--ink); border-bottom-color: currentColor; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* --- Filter box (books, glossary) --------------------------------------- */

.filter { display: flex; align-items: center; gap: .7rem; margin: 0 0 2rem; flex-wrap: wrap; }
.filter input {
  font-family: var(--chrome); font-size: .92rem; padding: .55rem .8rem;
  border: 1px solid var(--rule); border-radius: 3px;
  background: var(--paper); color: var(--ink); min-width: 15rem; flex: 1 1 15rem; max-width: 26rem;
}
.filter__count { font-family: var(--chrome); font-size: .8rem; color: var(--muted); }
.is-hidden { display: none !important; }

/* --- Glossary ----------------------------------------------------------- */

.glossary { column-gap: 2.4rem; }
@media (min-width: 860px) { .glossary { columns: 2; } }
.gloss { break-inside: avoid; margin: 0 0 1.5rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--rule-soft); }
.gloss__term { font-family: var(--display); font-weight: 600; font-size: 1.1rem; margin: 0 0 .1rem; }
.gloss__ar { font-family: var(--naskh); font-size: 1.25rem; color: var(--verdant); margin-left: .5rem; font-weight: 400; }
.gloss__gr { font-family: var(--prose); color: var(--rubric); margin-left: .5rem; font-weight: 400; font-size: 1rem; }
.gloss__def { font-size: .95rem; margin: .3rem 0 0; line-height: 1.6; }

/* --- Rasm demonstration ------------------------------------------------- */

.rasm { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); margin: 2rem 0; }
@media (min-width: 620px) { .rasm { grid-template-columns: 1fr 1fr; } }
.rasm__cell { background: var(--paper); padding: 1.3rem; text-align: center; }
.rasm__glyph { font-family: var(--naskh); font-size: 2.9rem; line-height: 1.8; direction: rtl; margin: 0 0 .4rem; }
.rasm__cell:first-child .rasm__glyph { color: var(--verdant); }
.rasm__read { font-family: var(--chrome); font-size: .85rem; font-weight: 600; margin: 0 0 .2rem; }
.rasm__gloss { font-size: .88rem; color: var(--ink-soft); margin: 0; }

/* --- Pager -------------------------------------------------------------- */

.pager {
  display: flex; justify-content: space-between; gap: 1.5rem;
  margin-top: 4rem; padding-top: 1.4rem; border-top: 1px solid var(--rule);
}
.pager__link { text-decoration: none; color: inherit; max-width: 20rem; }
.pager__link--next { text-align: right; margin-left: auto; }
.pager__dir { display: block; font-family: var(--chrome); font-size: .74rem; color: var(--muted); margin-bottom: .15rem; }
.pager__name { font-family: var(--display); font-weight: 600; font-size: 1.02rem; line-height: 1.3; border-bottom: 1px solid var(--rule); }
.pager__link:hover .pager__name { border-bottom-color: var(--ink); }

/* --- Footer ------------------------------------------------------------- */

.footer { background: var(--field); color: var(--field-ink); padding: 3rem 0 1.6rem; margin-top: 4rem; }
.footer__grid { width: var(--shell); margin-inline: auto; display: grid; gap: 2rem; }
@media (min-width: 800px) { .footer__grid { grid-template-columns: 1.4fr 1fr 1fr; gap: 3rem; } }

.footer__mission { font-size: 1rem; line-height: 1.65; color: #c8d0d8; margin: 0; max-width: 40ch; }
.footer__col h5 { font-family: var(--chrome); font-size: .82rem; font-weight: 600; margin: 0 0 .7rem; color: #fff; }
.footer__col ul { list-style: none; padding: 0; margin: 0; }
.footer__col li { font-family: var(--chrome); font-size: .84rem; color: #9dabb8; margin-bottom: .5rem; line-height: 1.45; }
.footer__col a, .footer a { color: #e2e8ee; }
.footer .ref--out { text-decoration-color: rgba(255,255,255,.3); }

.footer__base {
  width: var(--shell); margin: 2.4rem auto 0; padding-top: 1.3rem;
  border-top: 1px solid rgba(255,255,255,.14);
  font-family: var(--chrome); font-size: .77rem; color: #8b98a5; line-height: 1.6;
}
.footer__base p { margin: 0 0 .4rem; max-width: 70ch; }
.footer__legal { color: #6f7d8a; }

/* --- Wide-screen breakouts ---------------------------------------------
   Declared last on purpose: these override the component margins above. */

@media (min-width: 1100px) {
  .timeline, .table-wrap, .plate--wide, .deck {
    width: calc(100% + var(--rail));
    margin-left: calc(-1 * var(--rail));
    margin-right: 0;
  }
}

/* --- Small screens ------------------------------------------------------ */

@media (max-width: 900px) {
  :root { --shell: min(1140px, 100% - 2rem); }
  .page { padding-left: 0; }
  .sitenav__group + .sitenav__group { border-left: 0; padding-left: 0; }
  body { font-size: 16.5px; }

  .menu-btn { display: inline-flex; }

  .sitenav {
    display: none; flex-direction: column; gap: 0;
    padding: .6rem 0 1.2rem;
  }
  .sitenav.is-open { display: flex; }
  .sitenav__group { flex-direction: column; align-items: stretch; gap: .1rem; padding: .7rem 0; border-bottom: 1px solid rgba(255,255,255,.1); }
  .sitenav__group:last-child { border-bottom: 0; }
  .sitenav__list { flex-direction: column; gap: 0; }
  .sitenav a { padding: .45rem 0; border-bottom: 0; }
  .sitenav a[aria-current="page"] { border-bottom: 0; color: #ff9aa4; }

  .masthead { position: static; }
  .pager { flex-direction: column; }
  .pager__link--next { text-align: left; margin-left: 0; }
  .quote__links { margin-left: 0; }
}

@media print {
  .masthead, .footer, .pager, .filter, .theme-btn { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .page { width: 100%; }
  a::after { content: " (" attr(href) ")"; font-size: 8pt; color: #555; }
  .ref::after { content: ""; }
}
