/* ============================================================================
   Notes on the Quran — Classical Manuscript
   Cream parchment · Gilt · EB Garamond + Cormorant + Amiri
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400..800;1,400..800&family=Cormorant+Garamond:ital,wght@0,300..700;1,300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&family=Amiri:ital,wght@0,400;0,700;1,400;1,700&display=swap');

:root {
  --paper:      #f6f0e0;
  --paper-2:    #efe6cf;
  --table:      #e6dab8;
  --page-shadow: 0 1px 2px rgba(122,94,29,0.08), 0 8px 30px -8px rgba(122,94,29,0.18), 0 30px 60px -20px rgba(122,94,29,0.15);
  --ink:        #2a1f14;
  --ink-soft:   #564228;
  --ink-mute:   #8a6f4c;
  --rule:       #d8c599;
  --rule-soft:  #e9dcb6;
  --gilt:       #b08a3e;
  --gilt-deep:  #7a5e1d;
  --emerald:    #2a5947;

  --serif:   'EB Garamond', Georgia, serif;
  --display: 'Cormorant Garamond', 'EB Garamond', serif;
  --sans:    'Source Sans 3', system-ui, -apple-system, sans-serif;
  --arabic:  'Amiri', 'Scheherazade New', 'Noto Naskh Arabic', serif;

  --text-size: 19px;
  --line: 1.75;
  --measure: 42rem;
  --measure-wide: 50rem;
  --measure-full: 78rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  background-image:
    radial-gradient(ellipse at top, rgba(176,138,62,0.06), transparent 55%),
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,0,0,0.012) 2px 4px);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--text-size);
  line-height: var(--line);
  font-feature-settings: "liga","onum","kern";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

main, header, nav, footer { position: relative; z-index: 1; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  color: var(--ink);
  margin: 2em 0 0.6em;
  line-height: 1.15;
  letter-spacing: 0;
}
h1 { font-size: 3rem; }
h2 { font-size: 2.2rem; }
h3 { font-size: 1.6rem; font-weight: 600; }
h4 { font-size: 1.2rem; font-weight: 600; color: var(--gilt-deep); }

p { margin: 0 0 1em; }
p:first-of-type { margin-top: 0; }

a {
  color: var(--gilt-deep);
  text-decoration: none;
  background-image: linear-gradient(transparent calc(100% - 1px), currentColor 1px);
  background-size: 0% 100%;
  background-repeat: no-repeat;
  transition: background-size .25s ease, color .25s ease;
  padding-bottom: 1px;
}
a:hover { color: var(--emerald); background-size: 100% 100%; }

img { max-width: 100%; height: auto; display: block; margin: 1.5em auto; border-radius: 2px; }
figure { margin: 2em 0; text-align: center; }

blockquote {
  margin: 1.5em 0;
  padding: 0.4em 1.2em 0.4em 1.4em;
  border-left: 2px solid var(--gilt);
  font-style: italic;
  color: var(--ink-soft);
}

hr {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: 2em 0;
}

::selection { background: rgba(176,138,62,0.30); color: var(--ink); }

/* ----- Top bar ----- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: 78rem; margin: 0 auto;
  padding: 0.85em 1.5em;
  display: flex; align-items: center; gap: 1.4em;
}
.topbar .brand {
  font-family: var(--display); font-style: italic;
  font-size: 1.2rem; font-weight: 500;
  color: var(--ink); letter-spacing: 0.02em;
  white-space: nowrap;
}
.topbar .brand a { background: none; color: inherit; }
.topbar .brand .ornament { color: var(--gilt); margin: 0 0.4em; font-style: normal; }

.topbar nav {
  display: flex; gap: 1.5em;
  font-family: var(--sans); font-size: 0.78rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.18em;
  margin-left: auto;
  color: var(--ink-soft);
}
.topbar nav a { color: var(--ink-soft); background: none; }
.topbar nav a.active { color: var(--gilt-deep); }
.topbar nav a:hover { color: var(--gilt-deep); }

.theme-toggle { display: none; } /* Classical Manuscript is single-treatment */

/* ----- Page layouts ----- */
.page { max-width: var(--measure); margin: 0 auto; padding: 5rem 3rem 7rem; }
.page-wide { max-width: var(--measure-wide); margin: 0 auto; padding: 5rem 3rem 7rem; }
.page-full { max-width: var(--measure-full); margin: 0 auto; padding: 4.5rem 2.5rem 6.5rem; }

/* ----- Chapter head ----- */
.chapter-head {
  text-align: center;
  margin: 0 0 3rem;
}
.chapter-head .eyebrow {
  font-family: var(--sans);
  font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 0.6em;
}
.chapter-head h1 {
  margin: 0.3rem 0 0.6rem;
  font-size: 3.6rem;
  font-weight: 500; font-style: italic;
  letter-spacing: -0.005em;
}
.chapter-head .ornament-rule {
  margin: 1rem auto 0;
  width: 70%; max-width: 320px;
}

/* ----- Decorative ornament rule ----- */
.ornament-rule {
  display: block;
  text-align: center;
  margin: 2rem auto;
  height: 18px;
}
.ornament-rule svg { height: 100%; width: 70%; max-width: 320px; color: var(--gilt); display: block; margin: 0 auto; }

.section-break {
  text-align: center;
  margin: 3.5em 0 3em;
  letter-spacing: 0.6em;
  color: var(--gilt);
  font-size: 1.2rem;
}
.section-break::before { content: "❋ ❋ ❋"; }

/* ----- Arabic text ----- */
[dir="rtl"], .arabic, p[dir="rtl"] {
  font-family: var(--arabic) !important;
  font-size: 1.3em !important;
  line-height: 1.85 !important;
  text-align: right;
  direction: rtl;
  margin: 0.8em 0 1em !important;
  color: var(--emerald);
  font-weight: 400;
}

/* ----- Verse, citation, insight ----- */
.translation,
.chapter-body p strong:only-child {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.02em;
  line-height: 1.6;
  color: var(--ink);
}
.chapter-body p:has(> strong:only-child) {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.4em;
}

.citation {
  font-family: var(--sans);
  font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--gilt-deep);
  text-align: right;
  margin: -0.2em 0 1.4em;
  font-style: normal;
}
.citation strong { font-weight: 600; }

.insight {
  margin: 1.2em 0 1.4em;
  background: linear-gradient(180deg, rgba(176,138,62,0.08), rgba(176,138,62,0.02));
  border-left: 2px solid var(--gilt);
  padding: 0.9em 1.2em;
  font-style: italic;
  font-size: 1em;
  line-height: 1.6;
  color: var(--ink-soft);
  border-radius: 0 3px 3px 0;
}
.insight-label {
  display: block;
  font-family: var(--sans);
  font-size: 0.7rem; font-weight: 700;
  font-style: normal;
  letter-spacing: 0.32em;
  color: var(--gilt-deep);
  margin-bottom: 0.3em;
}
.insight-sep { display: none; }
.insight p { margin: 0; }
.insight p + p { margin-top: 0.6em; }

/* ----- Drop cap on first body paragraph ----- */
.chapter-body p.has-dropcap:first-letter,
.chapter-body p.dropcap:first-letter {
  font-family: var(--display);
  font-weight: 600;
  font-style: normal;
  font-size: 4em;
  float: left;
  line-height: 0.85;
  margin: 0.05em 0.12em 0 0;
  color: var(--gilt-deep);
}
/* Never give Arabic a drop cap */
.chapter-body p[dir="rtl"]:first-letter,
.chapter-body p.arabic:first-letter,
.chapter-body p.citation:first-letter,
.insight p:first-letter {
  all: revert;
}

/* ----- Body prose ----- */
.chapter-body { color: var(--ink-soft); }
.chapter-body p { line-height: 1.75; color: var(--ink-soft); }
.chapter-body strong { color: var(--ink); font-weight: 600; }
.chapter-body em { font-style: italic; }

/* Subhead — for inline strong-heading paragraphs that aren't proper headings */
.subhead {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gilt-deep);
  margin: 2em 0 0.7em;
  text-align: left;
}

/* ----- Tables ----- */
table {
  width: 100%; border-collapse: collapse;
  margin: 1.6em 0;
  font-family: var(--sans); font-size: 0.92em;
}
table th, table td {
  padding: 0.6em 0.8em;
  border-bottom: 1px solid var(--rule-soft);
  text-align: left; vertical-align: top;
}
table th {
  font-weight: 600; color: var(--ink);
  border-bottom: 1px solid var(--rule);
}

ul, ol { padding-left: 1.6em; margin: 0.8em 0 1.2em; }
li { margin-bottom: 0.4em; line-height: 1.65; }

/* ----- Footer ----- */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 6rem;
  padding: 2.5rem 1.5rem 3rem;
  text-align: center;
  color: var(--ink-mute);
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}
.site-footer .ornament { color: var(--gilt); margin-bottom: 1rem; font-size: 1.4em; letter-spacing: 0.6em; }

/* ----- Chapter prev/next ----- */
.chapter-nav {
  display: flex; justify-content: space-between; gap: 1.4em;
  margin-top: 4rem; padding-top: 2.2rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
}
.chapter-nav a {
  flex: 1;
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  padding: 1em 1.2em;
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  color: var(--ink-soft);
  transition: all 0.25s ease;
}
.chapter-nav a:hover {
  border-color: var(--gilt);
  color: var(--gilt-deep);
}
.chapter-nav .label {
  display: block;
  font-size: 0.7rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.22em;
  color: var(--ink-mute);
  margin-bottom: 0.3em;
}
.chapter-nav .title {
  font-family: var(--display); font-style: italic;
  font-size: 1.05rem;
  color: var(--ink);
}
.chapter-nav .next { text-align: right; }

/* ============================================================================
   Landing page
   ============================================================================ */

.hero {
  text-align: center;
  padding: 5.5rem 1.5rem 2rem;
}
.hero .ornament-top {
  color: var(--gilt);
  font-size: 1.4rem;
  letter-spacing: 0.6em;
  margin-bottom: 1rem;
}
.hero .arabic-bismillah {
  font-family: var(--arabic);
  font-size: 3rem;
  color: var(--emerald);
  line-height: 1.1;
  margin: 1rem 0 1.6rem;
}
.hero h1 {
  font-size: 5rem;
  margin: 0 0 0.4rem;
  font-weight: 500; font-style: italic;
  color: var(--ink);
  line-height: 0.98;
  letter-spacing: -0.01em;
}
.hero .subtitle {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--ink-mute);
  margin: 1rem 0 1.4rem;
}
.hero .author {
  font-family: var(--display); font-style: italic;
  font-size: 1.5rem;
  color: var(--gilt-deep);
  margin: 0;
}

.volumes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  max-width: 78rem;
  margin: 4rem auto 2rem;
  padding: 0 1.5rem;
}
.volume-card {
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 3.2rem 2.4rem 2.6rem;
  text-align: center;
  position: relative; overflow: hidden;
  transition: all 0.3s ease;
  text-decoration: none; color: var(--ink);
  background-image: linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  display: block;
}
.volume-card:hover {
  transform: translateY(-3px);
  border-color: var(--gilt);
  box-shadow: 0 14px 30px -16px rgba(122,94,29,0.35);
}
.volume-card .roman {
  font-family: var(--display); font-style: italic;
  font-weight: 500;
  font-size: 5rem;
  color: var(--gilt);
  line-height: 1;
  margin-bottom: 0.4rem;
}
.volume-card .vol-label {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 1rem;
}
.volume-card h3 {
  font-family: var(--display); font-style: italic;
  font-size: 1.5rem; font-weight: 500;
  color: var(--ink);
  margin: 0.4rem 0 1rem;
}
.volume-card .desc {
  font-family: var(--serif);
  font-size: 0.96rem;
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 1.4rem;
}
.volume-card .meta {
  font-family: var(--sans);
  font-size: 0.74rem; letter-spacing: 0.06em;
  color: var(--ink-mute);
  border-top: 1px solid var(--rule-soft);
  padding-top: 1rem;
  margin-top: 1rem;
}
.volume-card .open-cta {
  font-family: var(--sans);
  font-size: 0.74rem; letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gilt-deep);
  margin-top: 0.8rem;
  display: inline-block;
}

/* ============================================================================
   Volume index (Table of contents)
   ============================================================================ */

.toc {
  list-style: none;
  padding: 0;
  margin: 1.8rem 0;
}
.toc-part {
  font-family: var(--display); font-style: italic;
  font-size: 1rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gilt-deep);
  border-bottom: 1px solid var(--rule);
  padding: 1.4em 0 0.4em;
  margin-top: 0.5em;
}
.toc-part:first-child { margin-top: 0; padding-top: 0.6em; }
.toc li {
  display: flex; align-items: baseline; gap: 0.5em;
  padding: 0.55em 0;
  border-bottom: 1px dotted var(--rule-soft);
  margin: 0;
}
.toc li a {
  display: flex; width: 100%; align-items: baseline; gap: 0.5em;
  background: none; color: var(--ink); padding: 0;
}
.toc li a:hover { color: var(--gilt-deep); }
.toc .num {
  font-family: var(--sans);
  font-size: 0.78rem; font-weight: 500;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
  width: 2.5em;
  flex-shrink: 0;
}
.toc .title {
  font-family: var(--display); font-style: italic;
  font-size: 1.1rem;
  flex-grow: 0;
  color: var(--ink);
}
.toc .leader {
  flex-grow: 1;
  height: 1em;
  margin: 0 0.4em;
  border-bottom: 1px dotted var(--rule);
  position: relative; bottom: 0.25em;
}
.toc .page-num {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-mute);
  flex-shrink: 0;
}

/* ----- Search box ----- */
.search-wrap { margin: 1rem 0 1.6rem; position: relative; }
.search-input {
  width: 100%;
  padding: 0.7em 1em 0.7em 2.4em;
  font-family: var(--serif);
  font-size: 1rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease;
}
.search-input:focus { border-color: var(--gilt); }
.search-icon {
  position: absolute; left: 0.8em; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-mute);
  pointer-events: none;
}
.toc li.hidden, .toc-part.hidden { display: none; }

/* ----- Mobile ----- */
/* Wide tables: scrollable wrapper so columns never blow out the layout */
.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.6em -0.5rem;
  padding: 0 0.5rem;
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  background: var(--paper);
}
.table-wrap table {
  margin: 0;
  min-width: 100%;
  white-space: normal;
  font-size: 0.92em;
}
.table-wrap table td, .table-wrap table th {
  white-space: normal;
  word-break: normal;
  hyphens: auto;
  -webkit-hyphens: auto;
  min-width: 5em;
  max-width: 22em;
}






/* ============================================================================
   Wide-screen enhancements — manuscript page floating on a "table"
   ============================================================================ */

@media (min-width: 900px) {
  :root {
    --text-size: 21px;
    --measure: min(85vw, 70rem);
    --measure-wide: min(90vw, 80rem);
  }

  /* Outer body becomes the "table" — slightly darker than paper */
  body {
    background:
      radial-gradient(ellipse at top, rgba(176,138,62,0.04), transparent 55%),
      repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,0,0,0.012) 2px 4px),
      var(--table);
  }

  /* The reading area becomes a literal "page" — paper on the table */
  main.page,
  main.page-wide {
    position: relative;
    background: var(--paper);
    box-shadow: var(--page-shadow);
    margin: 1.4rem auto 3rem;
    padding: 5rem 5.5rem 6rem;
    border: 1px solid rgba(176,138,62,0.18);
    border-radius: 2px;
    background-image:
      radial-gradient(ellipse at top, rgba(176,138,62,0.05), transparent 50%),
      repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,0,0,0.012) 2px 4px);
  }

  /* Subtle decorative gilt squares at each corner of the page (like a manuscript) */
  main.page::before,
  main.page::after,
  main.page-wide::before,
  main.page-wide::after {
    content: "";
    position: absolute;
    width: 14px; height: 14px;
    border: 1px solid var(--gilt);
    opacity: 0.4;
    pointer-events: none;
  }
  main.page::before, main.page-wide::before {
    top: 1rem; left: 1rem;
    border-right: none; border-bottom: none;
  }
  main.page::after, main.page-wide::after {
    top: 1rem; right: 1rem;
    border-left: none; border-bottom: none;
  }

  /* Page-full (homepage) keeps its full-width layout but on the table */
  main.page-full {
    background: var(--paper);
    box-shadow: var(--page-shadow);
    margin: 1.4rem auto 3rem;
    border: 1px solid rgba(176,138,62,0.18);
    border-radius: 2px;
  }

  /* Bigger headings, more refined ornaments */
  .chapter-head h1 { font-size: 4rem; }
  .hero h1 { font-size: 5.4rem; }
  .hero .arabic-bismillah { font-size: 3.2rem; }
  .chapter-head .ornament-rule { width: 280px; }

  /* TOC entries: more refined */
  .toc li { padding: 0.7em 0; }
  .toc .title { font-size: 1.18rem; }
  .toc-part { font-size: 1.08rem; padding: 1.6em 0 0.5em; }
}

@media (min-width: 1440px) {
  :root {
    --text-size: 22px;
    --measure: min(80vw, 80rem);
    --measure-wide: min(85vw, 90rem);
  }
  main.page, main.page-wide { padding: 6rem 6.5rem 7rem; }
  .hero h1 { font-size: 6rem; }
  .hero .arabic-bismillah { font-size: 3.8rem; }
  .chapter-head h1 { font-size: 4.4rem; }
  /* Larger gilt corner marks at very wide screens */
  main.page::before, main.page::after,
  main.page-wide::before, main.page-wide::after {
    width: 18px; height: 18px;
  }
}

@media (min-width: 1920px) {
  :root {
    --text-size: 24px;
    --measure: min(70vw, 90rem);
    --measure-wide: min(75vw, 100rem);
  }
  main.page, main.page-wide { padding: 7rem 8rem 8rem; max-width: var(--measure); }
  .hero h1 { font-size: 6.6rem; }
  .chapter-head h1 { font-size: 5rem; }
  body {
    background:
      radial-gradient(ellipse 70% 80% at center, var(--table) 0%, var(--table) 60%, color-mix(in srgb, var(--table) 80%, var(--ink) 8%) 100%),
      var(--table);
    background-attachment: fixed;
  }
}

/* ============================================================================
   QHD / 4K monitors (≥ 2560 px) — keep page proportions on huge screens
   ============================================================================ */

@media (min-width: 2560px) {
  :root {
    --text-size: 26px;
    --measure: min(65vw, 120rem);
    --measure-wide: min(70vw, 130rem);
  }
  main.page, main.page-wide {
    padding: 8rem 10rem 9rem;
    max-width: var(--measure);
  }
  .hero h1 { font-size: 7.6rem; }
  .chapter-head h1 { font-size: 5.6rem; }
  .topbar-inner { max-width: 100rem; }
}

/* ============================================================================
   8K and beyond (≥ 3840 px) — top out the column so reading stays comfortable
   ============================================================================ */

@media (min-width: 3840px) {
  :root {
    --text-size: 30px;
    --measure: min(55vw, 140rem);
  }
}

/* TABLET (≤ 1024px) */
@media (max-width: 900px) {
  .page-full { max-width: none; padding: 3rem 2rem 5rem; }
  .volumes { gap: 1.6rem; }
  .hero { padding: 4rem 1.5rem 3rem; }
  .hero h1 { font-size: 3.4rem; }
  .topbar-inner { max-width: 100%; padding: 0.7em 1.4em; }
}

/* MOBILE (≤ 720px) */
@media (max-width: 720px) {
  :root { --text-size: 17px; --measure: 100%; --measure-wide: 100%; }
  body { -webkit-text-size-adjust: 100%; }

  .topbar-inner {
    padding: 0.6em 1em;
    gap: 0.6em;
    flex-wrap: wrap;
    justify-content: space-between;
  }
  .topbar .brand { font-size: 1rem; flex: 0 1 auto; }
  .topbar nav {
    gap: 0.7em;
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: 0;
    width: auto;
  }

  .hero { padding: 3.2rem 1.2rem 2.5rem; }
  .hero h1 { font-size: 2.4rem; line-height: 1.05; }
  .hero .arabic-bismillah { font-size: 2rem; }
  .hero .author { font-size: 1.15rem; }
  .hero .subtitle { font-size: 0.7rem; letter-spacing: 0.24em; }

  .chapter-head h1 { font-size: 2rem; line-height: 1.1; }
  .chapter-head .eyebrow { font-size: 0.7rem; letter-spacing: 0.22em; }

  .page, .page-wide, .page-full { padding: 1.6rem 1.1rem 3.5rem; }

  .volumes { gap: 1.4rem; padding: 0 1.1rem; grid-template-columns: 1fr; }
  .volume-card { padding: 1.8rem 1.4rem; }
  .volume-card .roman { font-size: 3.2rem; }
  .volume-card h3 { font-size: 1.3rem; }

  .chapter-nav { flex-direction: column; gap: 0.8em; }
  .chapter-nav .next { text-align: left; }

  /* Drop cap: smaller and tighter on mobile */
  .chapter-body p.has-dropcap:first-letter,
  .chapter-body p.dropcap:first-letter {
    font-size: 3em;
    margin: 0.05em 0.08em 0 0;
  }

  /* Arabic verse: scale down so long verses don't overflow */
  [dir="rtl"], .arabic, p[dir="rtl"] {
    font-size: 1.15em !important;
    line-height: 1.8 !important;
  }
  .hero .arabic-bismillah { font-size: 1.8rem; }
  /* TOC item titles: allow wrap, smaller leader */
  .toc li { padding: 0.5em 0; flex-wrap: wrap; }
  .toc .num { width: 2em; }
  .toc .title { font-size: 1rem; flex-basis: calc(100% - 4em); }
  .toc .leader { display: none; }
  .toc .page-num { display: none; }

  /* Insight: tighter padding */
  .insight { padding: 0.7em 0.9em; font-size: 0.95em; }

  /* Wide tables get extra side-scroll affordance on mobile */
  .table-wrap {
    margin-left: -1.1rem;
    margin-right: -1.1rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .table-wrap::after {
    content: "›";
    position: sticky;
    right: 0.5em;
    color: var(--gilt);
    font-size: 1.2rem;
  }

  /* Footer: reduce padding */
  .site-footer { padding: 2rem 1rem 2.5rem; }
}

/* SMALL PHONE (≤ 480px) */
@media (max-width: 480px) {
  :root { --text-size: 16px; }
  .topbar .brand { font-size: 0.92rem; }
  .topbar .brand .ornament { margin: 0 0.3em; }
  .topbar nav { font-size: 0.62rem; gap: 0.55em; letter-spacing: 0.1em; }
  .hero h1 { font-size: 2rem; }
  .hero .arabic-bismillah { font-size: 1.7rem; }
  .chapter-head h1 { font-size: 1.7rem; }
  .volume-card .roman { font-size: 2.8rem; }
  .chapter-body p.has-dropcap:first-letter,
  .chapter-body p.dropcap:first-letter { font-size: 2.6em; }
  [dir="rtl"], .arabic, p[dir="rtl"] {
    font-size: 1.05em !important;
    line-height: 1.75 !important;
  }
  .page, .page-wide, .page-full { padding: 1.3rem 0.9rem 3rem; }
  .table-wrap { margin-left: -0.9rem; margin-right: -0.9rem; }
}

/* ----- Print ----- */




/* ============================================================================
   Lists in chapter body (commentary bullets + numbered sub-points)
   ============================================================================ */

.chapter-body ul,
.chapter-body ol {
  margin: 1.1em 0 1.3em;
  padding-left: 2em;
}
.chapter-body ul {
  list-style: none;
  padding-left: 1.6em;
}
.chapter-body ul > li {
  position: relative;
  margin: 0.55em 0;
  line-height: 1.7;
  color: var(--ink-soft);
}
.chapter-body ul > li::before {
  content: "▪";
  position: absolute;
  left: -1.1em;
  top: 0.05em;
  color: var(--gilt);
  font-size: 0.9em;
}
.chapter-body ol {
  list-style: none;
  counter-reset: ol-item;
  padding-left: 2em;
}
.chapter-body ol > li {
  position: relative;
  margin: 0.55em 0;
  line-height: 1.7;
  color: var(--ink-soft);
  counter-increment: ol-item;
}
.chapter-body ol > li::before {
  content: counter(ol-item) ".";
  position: absolute;
  left: -1.8em;
  top: 0;
  width: 1.5em;
  text-align: right;
  font-family: var(--display);
  font-style: italic;
  font-weight: 600;
  color: var(--gilt-deep);
}
/* Nested list — slightly tighter */
.chapter-body ul ul,
.chapter-body ul ol,
.chapter-body ol ul,
.chapter-body ol ol {
  margin: 0.4em 0 0.6em;
}
/* Strong/em inside list items inherit body colours nicely */
.chapter-body li strong { color: var(--ink); }
.chapter-body li em { font-style: italic; }


/* ============================================================================
   Preserve docx underlines (pandoc emits these as <span class="underline">)
   ============================================================================ */
.underline,
span.underline,
.chapter-body .underline {
  text-decoration: underline;
  text-decoration-thickness: 0.6px;
  text-underline-offset: 0.18em;
  text-decoration-color: currentColor;
}
/* Bold + underline reads a touch heavier */
.chapter-body strong .underline,
.chapter-body .underline strong {
  text-decoration: underline;
  text-decoration-thickness: 0.9px;
  text-decoration-color: currentColor;
}
/* Arabic verse underlines — match the emerald verse colour and sit slightly lower
   so they don't collide with the descender marks on the script */
.chapter-body p[dir="rtl"] .underline,
.chapter-body .arabic .underline,
[dir="rtl"] .underline,
.arabic .underline {
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-decoration-thickness: 0.7px;
  text-underline-offset: 0.25em;
}

/* ============================================================================
   Body lists — prominent gilt bullets, indented numbered sub-points
   ============================================================================ */

.chapter-body ul,
.chapter-body ol {
  margin: 1.1em 0 1.4em;
}

/* Bullet points (▪) — custom marker for prominence */
.chapter-body ul {
  list-style: none;
  padding-left: 2.4em;
}
.chapter-body ul > li {
  position: relative;
  padding-left: 0.4em;
  margin: 0.5em 0;
  line-height: 1.72;
  color: var(--ink-soft);
  text-align: left;
}
.chapter-body ul > li::before {
  content: "▪";
  color: var(--gilt-deep);
  position: absolute;
  left: -1.1em;
  top: 0;
  font-size: 1.3em;
  line-height: 1.4;
  font-weight: 700;
}

/* Numbered sub-points — deeper indent so they read as nested under the prior bullet */
.chapter-body ol {
  list-style: none;
  counter-reset: chnum;
  padding-left: 4.5em;
}
.chapter-body ol > li {
  position: relative;
  counter-increment: chnum;
  padding-left: 0.4em;
  margin: 0.55em 0;
  line-height: 1.72;
  color: var(--ink-soft);
  text-align: left;
}
.chapter-body ol > li::before {
  content: counter(chnum) ".";
  color: var(--gilt-deep);
  position: absolute;
  left: -1.8em;
  top: 0;
  font-family: var(--display);
  font-style: italic;
  font-weight: 600;
  font-size: 1.15em;
  width: 1.6em;
  text-align: right;
}

/* When an <ol> immediately follows a <ul>, treat it as sub-list — slightly deeper */
.chapter-body ul + ol {
  padding-left: 5.5em;
  margin-top: -0.4em;
}

/* Nested lists indent further */
.chapter-body ul ul,
.chapter-body ol ol,
.chapter-body ul ol,
.chapter-body ol ul {
  margin: 0.4em 0 0.6em;
  padding-left: 2.4em;
}

/* Mobile: reduce indents a touch */
@media (max-width: 720px) {
  .chapter-body ul { padding-left: 1.8em; }
  .chapter-body ol { padding-left: 3em; }
  .chapter-body ul + ol { padding-left: 3.6em; }
  .chapter-body ul > li::before { left: -1em; font-size: 1.2em; }
  .chapter-body ol > li::before { left: -1.5em; font-size: 1.05em; }
}



/* ============================================================================
   Justify English prose (left-aligned for Arabic / RTL)
   ============================================================================ */
.chapter-body p,
.chapter-body li,
.chapter-body blockquote p {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  -webkit-hyphens: auto;
}
.chapter-body p[dir="rtl"],
.chapter-body p.arabic,
.chapter-body p:lang(ar),
.chapter-body p.citation {
  text-align: right;
  hyphens: none;
  -webkit-hyphens: none;
}
.chapter-body p.citation {
  /* citation lines are short — keep them right-aligned but not justified */
  text-justify: auto;
}
/* The drop-cap paragraph should stay justified too */
.chapter-body p.has-dropcap { text-align: justify; }

/* On narrow screens, keep justify but disable hyphens to avoid awkward breaks */
@media (max-width: 480px) {
  .chapter-body p,
  .chapter-body li,
  .chapter-body blockquote p {
    text-align: left;
    hyphens: none;
    -webkit-hyphens: none;
  }
}
