/* ==========================================================================
   أديب — Addeeb · Ghost theme for sayedaddeeb.com
   RTL-first, logical properties only · light / dark / system
   Palette: لازورد ونحاس (lapis + brass), fixed — it does not follow Ghost's accent colour
   Fonts: IBM Plex Sans Arabic (everything) · Amiri (Quran verses only) · Scheherazade New subset (honorific ligatures)
   Contents: 1 tokens · 2 palette · 3 base · 4 header · 5 hero · 6 sections
             7 post cards · 8 books · 9 media + photos · 10 subscribe
             11 footer · 12 article · 13 Ghost editor cards (kg-*) · 14 archive
             15 contact · 16 search · 17 pages, book post, video post, error
             18 responsive
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
/* Honorific ligatures (﵁ ﵂ ﵃ ﵄ ﷺ …, U+FD40–FD4F, U+FDFA): Plex and Amiri lack the Unicode 14 ones,
   so a tiny Scheherazade New subset (OFL) supplies them. unicode-range = only downloaded when used. */
@font-face {
  font-family: "Addeeb Honorifics";
  src: url("../fonts/honorifics.woff2") format("woff2");
  unicode-range: U+FD40-FD4F, U+FDFA;
  size-adjust: 135%;
  font-display: swap;
}

:root {
  /* Type roles: one family for everything; Amiri is loaded for Quran verses only. */
  --font-ui: "Addeeb Honorifics", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-body: var(--font-ui);
  --font-heading: var(--font-ui);
  --font-display: var(--font-ui);
  --font-quran: "Addeeb Honorifics", "Amiri", "Traditional Arabic", "Times New Roman", serif;
  --article-size: 1.125rem;      /* 18px */
  --article-size-sm: 1.0625rem;  /* 17px on phones */
  --article-lh: 2.05;
  --heading-scale: .84;          /* the size values below were drawn for a naskh face, which runs small */
  --heading-weight: 600;
  --display-scale: .74;
  --display-weight: 700;
  --ayah-scale: 1.3;

  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;

  --container: 1200px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --measure: 42rem;
  --topbar-h: 72px;
  --navbar-h: 50px;

  --content-scale: 1;

  /* eight-point star (khatim) lattice, used as a mask so it takes palette colour */
  --star-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23000' stroke-width='1'%3E%3Cpath d='M16 16h48v48H16z'/%3E%3Cpath d='M40 6.06 73.94 40 40 73.94 6.06 40z'/%3E%3Cpath d='M40 0v6M40 74v6M0 40h6M74 40h6'/%3E%3Cpath d='M0 0l16 16M80 0 64 16M0 80l16-16M80 80 64 64' stroke-opacity='.55'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- 2. Palette ----------
   Light, then dark. Nothing else in this file names a brand colour.      */

:root {
  --bg: #f7f6f2;
  --bg-soft: #efede6;
  --surface: #ffffff;
  --surface-2: #f3f1ea;
  --text: #1a2130;
  --text-soft: #454e60;
  --muted: #5f6776;
  --border: #e2dfd6;
  --border-strong: #cbc7ba;

  --accent: #1e3d72;
  --accent-strong: #152c55;
  --accent-soft: rgba(30, 61, 114, .08);
  --accent-contrast: #ffffff;
  --gold: #b08a3e;
  --gold-ink: #7a5a17;
  --gold-soft: rgba(176, 138, 62, .14);

  --band-bg: #172f57;
  --band-text: #f3efe4;
  --band-muted: #b9c3d6;
  --band-gold: #d9bb78;

  --cover-1: #1e3d72;
  --cover-2: #7c5f25;
  --cover-3: #3d4658;
  --cover-ink: #f6f0e2;

  --pattern-ink: rgba(30, 61, 114, .13);
  --shadow-1: 0 1px 2px rgba(22, 30, 48, .06), 0 8px 24px -12px rgba(22, 30, 48, .18);
  --shadow-2: 0 2px 4px rgba(22, 30, 48, .06), 0 24px 56px -20px rgba(22, 30, 48, .32);
  --img-filter: none;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0c111c;
  --bg-soft: #101726;
  --surface: #151d2e;
  --surface-2: #1b2539;
  --text: #ebe7dd;
  --text-soft: #c3c7d1;
  --muted: #949cad;
  --border: #25304a;
  --border-strong: #35435f;

  --accent: #9dbcf2;
  --accent-strong: #c0d5fa;
  --accent-soft: rgba(157, 188, 242, .11);
  --accent-contrast: #0c1626;
  --gold: #d2b06a;
  --gold-ink: #dcbd7c;
  --gold-soft: rgba(210, 176, 106, .13);

  --band-bg: #131c30;
  --band-text: #ebe7dd;
  --band-muted: #a9b2c4;
  --band-gold: #d9bb78;

  --cover-1: #24467f;
  --cover-2: #7c5f25;
  --cover-3: #3a4359;

  --pattern-ink: rgba(157, 188, 242, .10);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-2: 0 2px 4px rgba(0, 0, 0, .4), 0 24px 56px -20px rgba(0, 0, 0, .75);
  --img-filter: brightness(.9) contrast(1.02);
  color-scheme: dark;
}

/* ---------- 3. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--navbar-h) + 1.5rem);
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img, svg, iframe { display: block; max-width: 100%; }
[hidden] { display: none !important; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
bdi { unicode-bidi: isolate; }

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

::selection { background: var(--gold-soft); }

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.skip-link {
  position: absolute;
  inset-block-start: -4rem;
  inset-inline-start: 1rem;
  z-index: 300;
  padding: .6rem 1rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--r-sm);
}
.skip-link:focus { inset-block-start: 1rem; }

.icon { width: 1.15rem; height: 1.15rem; flex: none; }

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 2.75rem;
  padding: .5rem 1.35rem;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: .95rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-outline { border-color: var(--border-strong); color: var(--text); background: transparent; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { min-height: 2.25rem; padding: .3rem .95rem; font-size: .875rem; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.5rem; height: 2.5rem;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-soft);
  transition: background-color .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }

.text-link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: .3em;
  text-decoration-thickness: 1px;
}
.text-link:hover { text-decoration-color: currentColor; }

/* the khatim ornament, drawn once and reused */
.khatim { width: 1em; height: 1em; flex: none; color: var(--gold); }

/* ---------- 4. Header ---------- */
.site-header {
  position: sticky;
  inset-block-start: calc(-1 * var(--topbar-h) - 1px); /* top bar scrolls away, nav row stays */
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-block-end: 1px solid var(--border);
}

.site-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--topbar-h);
}

.site-brand { display: inline-flex; align-items: center; gap: .8rem; margin-inline-end: auto; min-width: 0; }
.site-brand .khatim { font-size: 2.35rem; }
.site-brand-text { display: flex; flex-direction: column; min-width: 0; }
.site-brand-name {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: calc(1.45rem * var(--display-scale));
  line-height: 1.5;
  white-space: nowrap;
}
.site-brand-sub { font-size: .78rem; color: var(--muted); line-height: 1.3; }

.site-actions { display: flex; align-items: center; gap: .6rem; }
.member-links { display: flex; align-items: center; gap: .35rem; }
.member-link { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .7rem; font-size: .9rem; color: var(--text-soft); border-radius: var(--r-sm); }
.member-link:hover { color: var(--accent); background: var(--accent-soft); }

.theme-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.theme-switch button {
  display: grid;
  place-items: center;
  width: 2rem; height: 2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed="true"] { background: var(--accent); color: var(--accent-contrast); }
.theme-switch .icon { width: 1rem; height: 1rem; }

.site-navbar { border-block-start: 1px solid var(--border); }
.site-navbar-inner { display: flex; align-items: center; gap: 1.5rem; min-height: var(--navbar-h); }
.site-nav { margin-inline-end: auto; min-width: 0; }
.site-nav ul { display: flex; gap: clamp(.9rem, 1.9vw, 1.7rem); }
.site-nav a {
  position: relative;
  display: block;
  padding-block: .7rem;
  font-size: .95rem;
  color: var(--text-soft);
  white-space: nowrap;
}
.site-nav a:hover { color: var(--text); }
.site-nav .nav-current a { color: var(--accent); font-weight: 500; }
.site-nav .nav-current a::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-end: -1px;
  height: 2px;
  background: var(--gold);
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-width: 13.5rem;
  height: 2.25rem;
  padding-inline: .75rem .45rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: .875rem;
  transition: border-color .15s, color .15s;
}
.search-trigger:hover { border-color: var(--border-strong); color: var(--text); }
.search-trigger .icon { width: 1rem; height: 1rem; }
.search-trigger kbd, .search-foot kbd {
  margin-inline-start: auto;
  padding: .05rem .4rem;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  font-family: var(--font-ui);
  font-size: .72rem;
  color: var(--muted);
}

.mobile-only { display: none; }

/* drawer (mobile navigation) */
.drawer-backdrop, .drawer {
  position: fixed;
  z-index: 200;
  visibility: hidden;
  opacity: 0;
  transition: opacity .2s, visibility .2s;
}
.drawer-backdrop { inset: 0; background: rgba(8, 10, 14, .55); }
.drawer {
  inset-block: 0;
  inset-inline-end: 0;
  width: min(22rem, 88vw);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.1rem 1.4rem 1.6rem;
  background: var(--bg);
  border-inline-start: 1px solid var(--border);
  overflow-y: auto;
}
body.drawer-open .drawer-backdrop, body.drawer-open .drawer { visibility: visible; opacity: 1; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-nav a {
  display: block;
  padding-block: .8rem;
  border-block-end: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: calc(1.3rem * var(--display-scale));
  line-height: 1.6;
}
.drawer-nav .nav-current a { color: var(--accent); }
.drawer-foot { display: flex; flex-direction: column; gap: .8rem; margin-block-start: auto; }
.drawer-foot .theme-switch { align-self: flex-start; }
.drawer-row { display: flex; gap: .6rem; }
.drawer-row .btn { flex: 1; }

/* ---------- 5. Hero ---------- */
.hero { position: relative; overflow: hidden; border-block-end: 1px solid var(--border); }
.hero::before {
  /* star lattice fading out towards the text */
  content: "";
  position: absolute;
  inset: 0;
  background: var(--pattern-ink);
  -webkit-mask: var(--star-tile) 0 0 / 80px 80px, linear-gradient(to bottom, #000, transparent 85%);
  mask: var(--star-tile) 0 0 / 80px 80px, linear-gradient(to bottom, #000, transparent 85%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
  pointer-events: none;
}
.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
  padding-block: clamp(2.75rem, 5vw, 4rem) clamp(2.25rem, 4vw, 3.25rem);
}
.hero-text { container-type: inline-size; min-width: 0; }
.hero-name {
  font-family: var(--font-display);
  font-weight: 700;
  /* The name must stay on ONE line from 320px to 1920px. It is 10.5em wide in Plex bold,
     so 9.1cqi (= 95% of the column) always fits the text column; the vw line is the fallback for old browsers. */
  font-size: clamp(1.25rem, 3.9vw, 3.1rem);
  font-size: clamp(1.25rem, 9.1cqi, 3.75rem);
  line-height: 1.7;
  white-space: nowrap;
}
.hero-role {
  margin-block-start: .5rem;
  font-family: var(--font-display);
  font-size: calc(clamp(1.25rem, 2.2vw, 1.6rem) * var(--display-scale));
  line-height: 1.7;
  color: var(--gold-ink);
}
.hero-lede {
  max-width: 36rem;
  margin-block-start: 1.25rem;
  font-size: 1.0625rem;
  line-height: 1.95;
  color: var(--text-soft);
}
.hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-block-start: 2rem; }

.hero-portrait { position: relative; justify-self: center; width: min(31rem, 100%); padding: 1.4rem 1.4rem 0; }
.hero-life {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin-block-start: .35rem;
  font-family: var(--font-ui);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: .04em;
  white-space: nowrap;
  color: var(--text-soft);
}
.hero-life::after { content: ""; flex: 1 1 0; max-width: 5rem; min-width: 1rem; height: 1px; background: var(--gold); }
.hero-life span { color: var(--gold-ink); font-family: var(--font-display); font-size: 1.25rem; letter-spacing: 0; }
.arch {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 999px 999px var(--r-xs) var(--r-xs);
}
.arch::before {
  /* patterned arch standing behind the photo */
  content: "";
  position: absolute;
  inset: -1.4rem;
  inset-block-end: -1rem;
  border-radius: inherit;
  background: var(--accent);
  opacity: .5;
  -webkit-mask: var(--star-tile) center / 56px 56px;
  mask: var(--star-tile) center / 56px 56px;
}
.arch::after {
  /* hairline arch */
  content: "";
  position: absolute;
  inset: -.7rem;
  inset-block-end: -.5rem;
  border: 1.5px solid var(--gold);
  border-radius: inherit;
  pointer-events: none;
}
.arch img {
  position: relative;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 20%;
  border-radius: inherit;
  background: var(--surface-2);
  box-shadow: var(--shadow-2);
  filter: var(--img-filter);
}
.hero-caption {
  position: relative;
  margin-block-start: 1.5rem;
  line-height: 1.8;
  text-align: center;
  font-size: .875rem;
  color: var(--muted);
}

.hero-index {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-block-start: 1px solid var(--border);
}
.hero-index a {
  display: flex;
  align-items: baseline;
  gap: .7rem;
  padding: 1.15rem 1.25rem;
  border-inline-start: 1px solid var(--border);
  transition: background-color .15s;
}
.hero-index li:first-child a { border-inline-start: 0; padding-inline-start: 0; }
.hero-index a:hover { background: var(--accent-soft); }
.hero-index b {
  font-family: var(--font-display);
  font-size: calc(1.9rem * var(--display-scale));
  font-weight: var(--display-weight);
  line-height: 1.2;
  color: var(--accent);
}
.hero-index span { font-size: .95rem; color: var(--text-soft); }

@media (prefers-reduced-motion: no-preference) {
  .hero-portrait { animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; }
  .hero-text > * { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; }
  .hero-text > :nth-child(2) { animation-delay: .08s; }
  .hero-text > :nth-child(3) { animation-delay: .16s; }
  .hero-text > :nth-child(4) { animation-delay: .24s; }
  .hero-text > :nth-child(5) { animation-delay: .3s; }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } }
}

/* ---------- 6. Sections ---------- */
.section { padding-block: clamp(3rem, 6vw, 5rem); }
.section-alt { background: var(--bg-soft); border-block: 1px solid var(--border); }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  margin-block-end: clamp(1.5rem, 3vw, 2.25rem);
}
.section-title {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-family: var(--font-display);
  font-size: calc(clamp(1.75rem, 3.2vw, 2.25rem) * var(--display-scale));
  font-weight: var(--display-weight);
  line-height: 1.5;
}
.section-title .khatim { font-size: .62em; }
.section-desc { margin-block-start: .15rem; color: var(--muted); font-size: .95rem; }
.section-more {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding-block: .35rem;
  font-size: .95rem;
  font-weight: 500;
  color: var(--accent);
}
.section-more:hover { text-decoration: underline; text-underline-offset: .3em; }
.section-more .icon { width: .95rem; height: .95rem; }

/* ---------- 7. Post cards ---------- */
.post-feed {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(2rem, 3.5vw, 3rem) clamp(1.5rem, 2.5vw, 2.25rem);
}
.post-card { position: relative; display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.post-card-image {
  position: relative;
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.post-card-image img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: var(--img-filter);
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.post-card:hover .post-card-image img { transform: scale(1.03); }
/* pattern fallback: sits under the image and shows when there is none or it fails */
.post-card-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: .28;
  -webkit-mask: var(--star-tile) center / 64px 64px;
  mask: var(--star-tile) center / 64px 64px;
}
.post-card-image::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid color-mix(in srgb, var(--text) 9%, transparent);
  border-radius: inherit;
  pointer-events: none;
}
.post-card-body { display: flex; flex-direction: column; gap: .45rem; }
.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .9rem;
  font-size: .85rem;
  color: var(--muted);
}
.post-card-tag { color: var(--gold-ink); font-weight: 500; }
.post-card-title {
  font-family: var(--font-heading);
  font-size: calc(1.45rem * var(--heading-scale));
  font-weight: var(--heading-weight);
  line-height: 1.6;
  text-wrap: balance;
}
.post-card-title a::after { content: ""; position: absolute; inset: 0; } /* whole card is the link */
.post-card:hover .post-card-title { color: var(--accent); }
.post-card-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  font-size: .95rem;
  line-height: 1.85;
  color: var(--text-soft);
}

.post-card--featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  padding-block-end: clamp(2rem, 3.5vw, 3rem);
  border-block-end: 1px solid var(--border);
}
.post-card--featured .post-card-image { aspect-ratio: 16 / 10; border-radius: var(--r-md); }
.post-card--featured .post-card-title { font-size: calc(clamp(1.8rem, 3.2vw, 2.6rem) * var(--heading-scale)); line-height: 1.55; }
.post-card--featured .post-card-excerpt { -webkit-line-clamp: 4; line-clamp: 4; font-size: 1.0625rem; line-height: 1.95; }
.post-card--featured .post-card-body { gap: .8rem; }
.post-card-cta { display: inline-flex; align-items: center; gap: .35rem; margin-block-start: .4rem; font-weight: 500; color: var(--accent); }
.post-card-cta .icon { width: .95rem; height: .95rem; }

/* ---------- 8. Books ---------- */
.book-shelf {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)); /* six books fill one row; more wrap in sixes */
  gap: clamp(1.25rem, 2.2vw, 2rem);
}
.book-card { position: relative; display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.book-cover {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  aspect-ratio: 5 / 7;
  padding: 13% 12% 10%;
  border-radius: 2px var(--r-xs) var(--r-xs) 2px;
  background: var(--cover-1);
  color: var(--cover-ink);
  text-align: center;
  box-shadow: var(--shadow-1), inset -1px 0 0 rgba(255, 255, 255, .08);
  transition: transform .3s cubic-bezier(.2, .7, .2, 1), box-shadow .3s;
  container-type: inline-size;
}
.book-cover--image { padding: 0; overflow: hidden; background: #fff !important; } /* beats the nth-child cloth colours */
.book-cover--image::before { display: none; }
.book-cover--image::after { z-index: 1; width: 4%; }
.book-cover--image img { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; object-fit: contain; }
.book-card:nth-child(3n + 2) .book-cover { background: var(--cover-2); }
.book-card:nth-child(3n) .book-cover { background: var(--cover-3); }
.book-card:hover .book-cover { transform: translateY(-6px); box-shadow: var(--shadow-2); }
.book-cover::before {
  /* inner double rule, as on a cloth-bound Cairo edition */
  content: "";
  position: absolute;
  inset: 5%;
  border: 1px solid rgba(246, 240, 226, .5);
  outline: 1px solid rgba(246, 240, 226, .22);
  outline-offset: 3px;
  border-radius: 1px;
  pointer-events: none;
}
.book-cover::after {
  /* spine hinge on the binding side (inline-start in RTL books) */
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 7%;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .22), rgba(0, 0, 0, .22));
  border-inline-end: 1px solid rgba(255, 255, 255, .12);
  border-start-start-radius: inherit;
  border-end-start-radius: inherit;
}
.book-cover .khatim { position: relative; font-size: clamp(1rem, 11cqi, 1.5rem); color: rgba(246, 240, 226, .8); }
.book-cover-title {
  position: relative;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(.8rem, 9.5cqi, 1.5rem);
  line-height: 1.65;
  text-wrap: balance;
}
.book-cover-author { position: relative; font-size: clamp(.6rem, 5.6cqi, .8rem); opacity: .85; }
.book-title { font-family: var(--font-heading); font-size: calc(1.2rem * var(--heading-scale)); font-weight: var(--heading-weight); line-height: 1.6; }
.book-title a::after { content: ""; position: absolute; inset: 0; }
.book-meta { font-size: .85rem; color: var(--muted); }
.book-more { display: inline-flex; align-items: center; gap: .3rem; font-size: .875rem; color: var(--muted); }
.book-more .icon { width: .85rem; height: .85rem; }
.book-card:hover .book-title { color: var(--accent); }
.book-info { display: flex; flex-direction: column; gap: .15rem; }
.shelf-note { margin-block-start: 2.25rem; padding-block-start: 1.25rem; border-block-start: 1px solid var(--border); color: var(--text-soft); font-size: .95rem; }

/* ---------- 9. Media + photos ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2.5rem, 5vw, 4.5rem); align-items: start; }
.media-list li + li { border-block-start: 1px solid var(--border); }
.media-item { position: relative; display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 1.1rem; align-items: center; padding-block: 1.1rem; }
.media-list li:first-child .media-item { padding-block-start: 0; }
.media-thumb { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--r-sm); background: var(--surface-2); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; filter: var(--img-filter); }
.media-thumb .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 14, 22, .32);
  color: #fff;
}
.media-thumb .play svg { width: 1.9rem; height: 1.9rem; }
.media-source { font-size: .82rem; font-weight: 500; color: var(--gold-ink); }
.media-title { font-size: 1.02rem; font-weight: 500; line-height: 1.7; }
.media-title a::after { content: ""; position: absolute; inset: 0; }
.media-item:hover .media-title { color: var(--accent); }

.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.photo-card { position: relative; overflow: hidden; aspect-ratio: 1; border-radius: var(--r-sm); background: var(--surface-2); }
.photo-card:first-child { grid-column: span 2; grid-row: span 2; }
.photo-card img { width: 100%; height: 100%; object-fit: cover; filter: var(--img-filter); transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.photo-card:hover img { transform: scale(1.04); }
.photo-card figcaption {
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  padding: 2.2rem .9rem .7rem;
  background: linear-gradient(to top, rgba(8, 11, 18, .82), transparent);
  color: #fff;
  font-size: .82rem;
  line-height: 1.6;
  opacity: 0;
  transition: opacity .2s;
}
.photo-card:first-child figcaption, .photo-card:hover figcaption, .photo-card:focus-within figcaption { opacity: 1; }

/* ---------- 10. Subscribe (Ghost members form) ---------- */
.subscribe {
  position: relative;
  overflow: hidden;
  background: var(--band-bg);
  color: var(--band-text);
  border-block: 1px solid var(--border);
}
.subscribe::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--band-gold);
  opacity: .16;
  -webkit-mask: var(--star-tile) 0 0 / 80px 80px;
  mask: var(--star-tile) 0 0 / 80px 80px;
}
.subscribe-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 5vw, 4rem);
  padding-block: clamp(2.75rem, 5.5vw, 4.25rem);
}
.subscribe-title { font-family: var(--font-display); font-size: calc(clamp(1.8rem, 3.4vw, 2.4rem) * var(--display-scale)); font-weight: var(--display-weight); line-height: 1.5; }
.subscribe-text { margin-block-start: .4rem; color: var(--band-muted); line-height: 1.9; max-width: 32rem; }

.subscribe-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: .7rem; }
.subscribe-field {
  display: flex;
  gap: .4rem;
  padding: .35rem;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
.subscribe-field input {
  flex: 1;
  min-width: 0;
  padding: .55rem .9rem;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-size: 1rem;
}
.subscribe-field input::placeholder { color: var(--muted); }
.subscribe-field input:focus { outline: none; }
.subscribe-field:focus-within { outline: 2px solid var(--band-gold); outline-offset: 2px; }
.subscribe-field .btn { min-width: 7.5rem; }
.subscribe-note { font-size: .85rem; color: var(--band-muted); }

/* states — Ghost toggles .loading / .success / .error on the <form> */
.btn-loader { display: none; width: 1.1rem; height: 1.1rem; border: 2px solid currentColor; border-inline-start-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
[data-members-form].loading .btn-label { display: none; }
[data-members-form].loading .btn-loader { display: block; }
[data-members-form].loading button { pointer-events: none; opacity: .85; }
.form-message { display: none; align-items: flex-start; gap: .6rem; padding: .8rem 1rem; border-radius: var(--r-sm); font-size: .95rem; line-height: 1.7; }
.form-message .icon { margin-block-start: .25rem; }
.form-message--success { background: rgba(255, 255, 255, .1); border: 1px solid var(--band-gold); color: var(--band-text); }
.form-message--error { background: rgba(255, 255, 255, .1); border: 1px solid #f0a59b; color: var(--band-text); }
.form-message--error .icon { color: #f0a59b; }
.form-message--success .icon { color: var(--band-gold); }
[data-members-form].success .form-message--success,
[data-members-form].error .form-message--error { display: flex; }
[data-members-form].success .subscribe-field,
[data-members-form].success .subscribe-note { display: none; }
[data-members-form].error .subscribe-field { outline: 2px solid #f0a59b; outline-offset: 2px; }

/* ---------- 11. Footer ---------- */
.site-footer { background: var(--bg-soft); }
.subscribe + .site-footer { border-block-start: 0; }
.footer-main {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 2.5rem clamp(2rem, 5vw, 4.5rem);
  padding-block: clamp(2.5rem, 5vw, 3.75rem);
}
.footer-about p { max-width: 30rem; margin-block: 1rem 1.25rem; font-size: .95rem; line-height: 1.9; color: var(--text-soft); }
.footer-life { font-size: .95rem; font-weight: 500; color: var(--text); letter-spacing: .03em; }
.footer-dua { font-family: var(--font-display); font-size: calc(1.2rem * var(--display-scale)); color: var(--gold-ink); }
.footer-col h2 { margin-block-end: .9rem; font-size: 1rem; font-weight: 600; }
.footer-col li + li { margin-block-start: .5rem; }
.footer-col a { font-size: .95rem; color: var(--text-soft); }
.footer-col a:hover { color: var(--accent); }
.social-links { display: flex; gap: .35rem; margin-block-start: 1.1rem; margin-inline-start: -.6rem; }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 2rem;
  padding-block: 1.2rem;
  border-block-start: 1px solid var(--border);
  font-size: .85rem;
  color: var(--muted);
}

/* ---------- 12. Article ---------- */
.reading-progress {
  position: fixed;
  inset-block-start: 0;
  inset-inline-start: 0;
  z-index: 150;
  width: 0;
  height: 3px;
  background: var(--gold);
}

.article-header { padding-block: clamp(2.25rem, 5vw, 4rem) clamp(1.5rem, 3vw, 2.25rem); }
.article-header-inner { max-width: 54rem; margin-inline: auto; text-align: center; }
.breadcrumb { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; font-weight: 500; color: var(--gold-ink); }
.breadcrumb:hover { text-decoration: underline; text-underline-offset: .3em; }
.article-title {
  margin-block-start: .8rem;
  font-family: var(--font-display);
  font-size: calc(clamp(2.1rem, 5vw, 3.6rem) * var(--display-scale));
  font-weight: var(--display-weight);
  line-height: 1.5;
  text-wrap: balance;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .6rem 1.4rem;
  margin-block-start: 1.6rem;
  font-size: .9rem;
  color: var(--muted);
}
.article-author { display: inline-flex; align-items: center; gap: .65rem; color: var(--text); font-weight: 500; }
.article-author img {
  width: 2.5rem; height: 3rem;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 999px 999px var(--r-xs) var(--r-xs);
  filter: var(--img-filter);
}
.article-author small { display: block; font-size: .8rem; font-weight: 400; color: var(--muted); }
.article-author span { text-align: start; line-height: 1.5; }
.meta-item { display: inline-flex; align-items: center; gap: .4rem; }
.meta-item .icon { width: 1rem; height: 1rem; }

.font-size-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.font-size-control button {
  min-width: 2.4rem;
  height: 2.1rem;
  padding-inline: .5rem;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
  line-height: 1;
}
.font-size-control button:hover { color: var(--accent); }
.font-size-control button { display: inline-flex; align-items: center; justify-content: center; gap: .2rem; font-size: calc(1.1rem * var(--heading-scale)); }
.font-size-control button i { font-family: var(--font-ui); font-style: normal; font-weight: 500; font-size: .8rem; }
.font-size-control button:last-child { border-inline-start: 1px solid var(--border); }

.article-feature { max-width: 62rem; margin-inline: auto; }
.article-feature img {
  width: 100%;
  max-height: 34rem;
  object-fit: cover;
  border-radius: var(--r-md);
  background: var(--surface-2);
  filter: var(--img-filter);
}
figcaption {
  margin-block-start: .7rem;
  text-align: center;
  font-family: var(--font-ui);
  font-size: .85rem;
  line-height: 1.7;
  color: var(--muted);
}
figcaption a { text-decoration: underline; text-underline-offset: .25em; }

.article-layout { position: relative; padding-block: clamp(2rem, 4vw, 3.25rem) 0; }

.article-toc { display: none; }

/* the content column — same grid idea as Casper/Source so cards can break out */
.gh-content {
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--gutter), 1fr)
    [wide-start] minmax(0, 6rem)
    [main-start] min(var(--measure), 100% - 2 * var(--gutter)) [main-end]
    minmax(0, 6rem) [wide-end]
    minmax(var(--gutter), 1fr) [full-end];
  font-family: var(--font-body);
  font-size: calc(var(--article-size) * var(--content-scale));
  line-height: var(--article-lh);
  color: var(--text);
}
.gh-content > * { grid-column: main; min-width: 0; }
.gh-content > * + * { margin-block-start: 1.35em; }
.gh-content > p { text-align: start; hanging-punctuation: first; }
.gh-content h2, .gh-content h3 {
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
  line-height: 1.6;
  scroll-margin-top: 5rem;
}
.gh-content h2 {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-block-start: 2.2em;
  font-size: calc(1.65em * var(--heading-scale));
}
.gh-content h2::before {
  content: "";
  flex: none;
  width: .5em; height: .5em;
  background: var(--gold);
  /* small khatim */
  clip-path: polygon(50% 0, 62% 21%, 85% 15%, 79% 38%, 100% 50%, 79% 62%, 85% 85%, 62% 79%, 50% 100%, 38% 79%, 15% 85%, 21% 62%, 0 50%, 21% 38%, 15% 15%, 38% 21%);
}
.gh-content h3 { margin-block-start: 1.8em; font-size: calc(1.3em * var(--heading-scale)); }
.gh-content h2 + *, .gh-content h3 + * { margin-block-start: .6em; }
.gh-content a:not([class]) { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .3em; }
.gh-content strong { font-weight: 700; }
.gh-content ul, .gh-content ol { padding-inline-start: 1.5em; }
.gh-content ul { list-style: disc; }
.gh-content ol { list-style: arabic-indic; }
.gh-content li + li { margin-block-start: .4em; }
.gh-content li::marker { color: var(--gold-ink); }

/* Quran verse written inline as [ … ] in the post; JS wraps it */
.ayah {
  font-family: var(--font-quran);
  font-size: calc(1em * var(--ayah-scale));
  line-height: 1;
  color: var(--accent);
}
.ayah-mark { color: var(--gold); font-weight: 400; }

/* footnote references [1] → superscript links */
.fn-ref { font-family: var(--font-ui); font-size: .62em; line-height: 0; vertical-align: super; }
.fn-ref a {
  display: inline-block;
  min-width: 1.5em;
  margin-inline: .15em;
  padding: .28em .3em;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  line-height: 1;
  text-align: center;
  text-decoration: none;
}
.gh-content .fn-ref a { text-decoration: none; }
.fn-ref a:hover { background: var(--accent); color: var(--accent-contrast); }

/* optional extra: verse set apart as a blockquote */
.gh-content blockquote {
  position: relative;
  margin-inline: 0;
  margin-block: 2em .6em;
  padding: 1.5em clamp(1.25rem, 5vw, 2.75rem) 1.2em;
  border-block: 1px solid var(--gold);
  background: var(--gold-soft);
  text-align: center;
  font-family: var(--font-quran);
  font-size: calc(1.1em * var(--ayah-scale));
  line-height: 2;
}
.gh-content blockquote::before {
  content: "";
  position: absolute;
  inset-block-start: -.55rem;
  inset-inline: 0;
  margin-inline: auto;
  width: 1.1rem; height: 1.1rem;
  background: var(--gold);
  clip-path: polygon(50% 0, 62% 21%, 85% 15%, 79% 38%, 100% 50%, 79% 62%, 85% 85%, 62% 79%, 50% 100%, 38% 79%, 15% 85%, 21% 62%, 0 50%, 21% 38%, 15% 15%, 38% 21%);
}
.gh-content blockquote q { quotes: "﴿" "﴾"; }
.gh-content blockquote q::before, .gh-content blockquote q::after { color: var(--gold-ink); }
.gh-content blockquote cite { display: block; margin-block-start: .5em; font-family: var(--font-ui); font-size: .68em; font-style: normal; color: var(--muted); }

.gh-content hr {
  width: 100%;
  height: 1.2rem;
  margin-block: 2.5em 1em;
  border: 0;
  background:
    linear-gradient(var(--border-strong), var(--border-strong)) center / 100% 1px no-repeat;
  position: relative;
  overflow: visible;
}
.gh-content hr::after {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  margin-inline: auto;
  width: 1.2rem; height: 1.2rem;
  background: var(--gold);
  box-shadow: 0 0 0 .6rem var(--bg);
  clip-path: polygon(50% 0, 62% 21%, 85% 15%, 79% 38%, 100% 50%, 79% 62%, 85% 85%, 62% 79%, 50% 100%, 38% 79%, 15% 85%, 21% 62%, 0 50%, 21% 38%, 15% 15%, 38% 21%);
}

.signoff {
  margin-block-start: 2.2em !important;
  text-align: end !important;
  font-family: var(--font-heading);
  font-size: calc(1.2em * var(--heading-scale));
  font-weight: var(--heading-weight);
  color: var(--text-soft);
}

.footnotes { font-family: var(--font-ui); }
.gh-content .kg-card, .gh-content figcaption { line-height: 1.8; }
.gh-content .footnotes-title { margin-block: 0 .6rem; font-size: calc(1.5rem * var(--heading-scale)); }
.gh-content hr + .footnotes { margin-block-start: 1.75rem; }
.footnotes ol {
  padding-inline-start: 0;
  list-style: none;
  counter-reset: fn;
  font-size: .95rem;
  line-height: 1.85;
  color: var(--text-soft);
}
.footnotes li {
  counter-increment: fn;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: .25rem;
  padding: .3rem .4rem;
  border-radius: var(--r-xs);
  margin: 0 !important;
}
.footnotes li::before { content: counter(fn, arabic-indic); color: var(--accent); font-weight: 600; }
.footnotes li:target { background: var(--gold-soft); }
.fn-back { margin-inline-start: .4rem; color: var(--accent); text-decoration: none !important; }

.article-footer { max-width: calc(var(--measure) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.article-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  margin-block-start: 2.5rem;
  padding-block: 1rem;
  border-block: 1px solid var(--border);
}
.article-share-label { margin-inline-end: auto; font-size: .95rem; color: var(--text-soft); }
.copy-done { font-size: .85rem; color: var(--gold-ink); }

.author-card {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  margin-block: 2.5rem;
}
.author-card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 999px 999px var(--r-xs) var(--r-xs);
  outline: 1.5px solid var(--gold);
  outline-offset: 5px;
  filter: var(--img-filter);
}
.author-card h2 { font-family: var(--font-heading); font-size: calc(1.5rem * var(--heading-scale)); font-weight: var(--heading-weight); line-height: 1.6; }
.author-card h2 small { display: inline-block; font-size: .7em; font-weight: 400; color: var(--gold-ink); margin-inline-start: .8rem; }
.author-card p { margin-block: .35rem .8rem; font-size: .95rem; line-height: 1.9; color: var(--text-soft); }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border-block: 1px solid var(--border); }
.post-nav a { display: flex; flex-direction: column; gap: .3rem; padding: 1.5rem var(--gutter); background: var(--bg); transition: background-color .15s; }
.post-nav a:hover { background: var(--bg-soft); }
.post-nav a:last-child { text-align: end; align-items: flex-end; }
.post-nav-label { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--muted); }
.post-nav-label .icon { width: .9rem; height: .9rem; }
.post-nav-title { font-family: var(--font-heading); font-size: calc(1.3rem * var(--heading-scale)); font-weight: var(--heading-weight); line-height: 1.6; max-width: 26rem; }
.post-nav a:hover .post-nav-title { color: var(--accent); }

/* ---------- 13. Ghost editor cards (kg-*) ---------- */
.gh-content .kg-card { font-family: var(--font-ui); }
.gh-content .kg-card + *, .gh-content * + .kg-card { margin-block-start: 2.2rem; }
.gh-content .kg-width-wide { grid-column: wide; }
.gh-content .kg-width-full { grid-column: full; }
.kg-image-card img, .kg-gallery-image img { border-radius: var(--r-sm); background: var(--surface-2); filter: var(--img-filter); }
.kg-image-card img { margin-inline: auto; }
.kg-width-full img { width: 100%; border-radius: 0; }

.kg-gallery-container { display: flex; flex-direction: column; gap: .6rem; }
.kg-gallery-row { display: flex; gap: .6rem; }
.kg-gallery-image { flex: 1 1 0; min-width: 0; }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; }

.kg-bookmark-container {
  display: flex;
  min-height: 9.5rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  text-decoration: none !important;
  transition: border-color .15s, box-shadow .2s;
}
.kg-bookmark-container:hover { border-color: var(--accent); box-shadow: var(--shadow-1); }
.kg-bookmark-content { flex: 1 1 60%; display: flex; flex-direction: column; gap: .3rem; min-width: 0; padding: 1.1rem 1.3rem; }
.kg-bookmark-title { font-family: var(--font-heading); font-size: calc(1.25rem * var(--heading-scale)); font-weight: var(--heading-weight); line-height: 1.6; }
.kg-bookmark-description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: .9rem;
  line-height: 1.8;
  color: var(--text-soft);
}
.kg-bookmark-metadata { display: flex; align-items: center; gap: .5rem; margin-block-start: auto; padding-block-start: .4rem; font-size: .82rem; color: var(--muted); min-width: 0; }
.kg-bookmark-icon { width: 1.1rem; height: 1.1rem; border-radius: 3px; }
.kg-bookmark-author, .kg-bookmark-publisher { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kg-bookmark-publisher::before { content: "•"; margin-inline-end: .5rem; }
.kg-bookmark-thumbnail { position: relative; flex: 0 0 34%; min-height: 100%; }
.kg-bookmark-thumbnail img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: var(--img-filter); }

.kg-callout-card {
  display: flex;
  gap: .9rem;
  padding: 1.1rem 1.3rem;
  border-radius: var(--r-md);
  border-inline-start: 3px solid var(--gold);
  background: var(--gold-soft);
  font-size: 1rem;
  line-height: 1.9;
  color: var(--text);
}
.kg-callout-card-blue, .kg-callout-card-accent { border-inline-start-color: var(--accent); background: var(--accent-soft); }
.kg-callout-card-grey, .kg-callout-card-white { border-inline-start-color: var(--border-strong); background: var(--surface-2); }
.kg-callout-emoji { font-size: 1.2rem; line-height: 1.6; }
.kg-callout-text { min-width: 0; }

.kg-embed-card { display: flex; flex-direction: column; align-items: center; }
.kg-embed-card iframe {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.kg-embed-card figcaption, .kg-image-card figcaption, .kg-gallery-card figcaption, .kg-bookmark-card figcaption { width: 100%; }

/* ---------- 14. Archive (tag page) ---------- */
.archive-header { position: relative; overflow: hidden; border-block-end: 1px solid var(--border); }
.archive-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--pattern-ink);
  -webkit-mask: var(--star-tile) 0 0 / 80px 80px, linear-gradient(to bottom, #000, transparent);
  mask: var(--star-tile) 0 0 / 80px 80px, linear-gradient(to bottom, #000, transparent);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}
.archive-header-inner { position: relative; padding-block: clamp(2.5rem, 5vw, 4rem) 0; }
.archive-title { font-family: var(--font-display); font-size: calc(clamp(2.2rem, 5vw, 3.5rem) * var(--display-scale)); font-weight: var(--display-weight); line-height: 1.55; }
.archive-desc { max-width: 40rem; margin-block-start: .5rem; font-size: 1.0625rem; line-height: 1.9; color: var(--text-soft); }
.archive-count { color: var(--gold-ink); font-weight: 500; }
.section-tabs { display: flex; gap: clamp(1rem, 3vw, 2rem); margin-block-start: 2rem; overflow-x: auto; scrollbar-width: none; }
.section-tabs::-webkit-scrollbar { display: none; }
.section-tabs a { position: relative; display: inline-flex; align-items: baseline; gap: .45rem; padding-block: .8rem; white-space: nowrap; color: var(--text-soft); }
.section-tabs a small { font-size: .8rem; color: var(--muted); }
.section-tabs a:hover { color: var(--text); }
.section-tabs a[aria-current="page"] { color: var(--accent); font-weight: 500; }
.section-tabs a[aria-current="page"]::after { content: ""; position: absolute; inset-inline: 0; inset-block-end: 0; height: 2px; background: var(--gold); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-block-start: clamp(2.5rem, 5vw, 4rem);
  padding-block-start: 1.5rem;
  border-block-start: 1px solid var(--border);
}
.pagination-pages { display: flex; align-items: center; gap: .25rem; }
.pagination-pages a, .pagination-pages span {
  display: grid;
  place-items: center;
  min-width: 2.5rem; height: 2.5rem;
  padding-inline: .5rem;
  border-radius: var(--r-sm);
  font-size: 1rem;
  color: var(--text-soft);
}
.pagination-pages a:hover { background: var(--accent-soft); color: var(--accent); }
.pagination-pages [aria-current="page"] { background: var(--accent); color: var(--accent-contrast); font-weight: 600; }
.pagination .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.pagination-info { display: none; font-size: .9rem; color: var(--muted); }

/* ---------- 15. Contact ---------- */
.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
  padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3rem, 6vw, 5rem);
}
.contact-intro h1 { font-family: var(--font-display); font-size: calc(clamp(2.2rem, 5vw, 3.5rem) * var(--display-scale)); font-weight: var(--display-weight); line-height: 1.55; }
.contact-intro > p { margin-block-start: .8rem; font-size: 1.0625rem; line-height: 1.95; color: var(--text-soft); max-width: 30rem; }
.contact-ways { margin-block-start: 2rem; border-block-start: 1px solid var(--border); }
.contact-ways a { display: flex; align-items: center; gap: .9rem; padding-block: .95rem; border-block-end: 1px solid var(--border); color: var(--text-soft); }
.contact-ways a:hover { color: var(--accent); }
.contact-ways b { font-weight: 500; color: var(--text); margin-inline-end: auto; }
.contact-ways a:hover b { color: var(--accent); }
.contact-ways bdi { font-size: .9rem; }

.contact-form {
  display: grid;
  gap: 1.15rem;
  padding: clamp(1.4rem, 3.5vw, 2.25rem);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.field { display: grid; gap: .4rem; align-content: start; }
.field label { font-size: .9rem; font-weight: 500; }
.field label i { font-style: normal; color: var(--gold-ink); }
.field input, .field textarea {
  width: 100%;
  padding: .7rem .9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.7;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 10rem; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-hint { font-size: .82rem; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.15rem; align-items: start; }
.contact-form-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; }
.contact-form-foot p { font-size: .85rem; color: var(--muted); }
.contact-sent { display: none; align-items: flex-start; gap: .7rem; padding: 1rem 1.1rem; border-radius: var(--r-sm); background: var(--gold-soft); border: 1px solid var(--gold); line-height: 1.8; }
.contact-sent .icon { margin-block-start: .3rem; color: var(--gold-ink); }
.contact-form.sent .contact-sent { display: flex; }
.contact-form.loading .btn-label { display: none; }
.contact-form.loading .btn-loader { display: block; }
.contact-form.loading button { pointer-events: none; opacity: .85; }
.contact-error { display: flex; align-items: flex-start; gap: .6rem; font-size: .95rem; color: var(--text); }
.contact-error .icon { margin-block-start: .3rem; color: var(--gold-ink); }
.contact-form.sent > :not(.contact-sent) { display: none; }

/* ---------- 16. Search overlay ---------- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  justify-items: center;
  align-items: start;
  padding: min(12vh, 7rem) 1rem 1rem;
  background: rgba(8, 11, 18, .58);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  visibility: hidden;
  opacity: 0;
  transition: opacity .18s, visibility .18s;
}
body.search-open .search-overlay { visibility: visible; opacity: 1; }
.search-modal {
  display: flex;
  flex-direction: column;
  width: min(42rem, 100%);
  max-height: min(38rem, 100%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  transform: translateY(8px);
  transition: transform .18s;
}
body.search-open .search-modal { transform: none; }
.search-input-row { display: flex; align-items: center; gap: .8rem; padding: .4rem 1.2rem; border-block-end: 1px solid var(--border); }
.search-input-row > .icon { color: var(--muted); }
.search-input-row input {
  flex: 1;
  min-width: 0;
  padding-block: .95rem;
  border: 0;
  background: transparent;
  font-size: 1.125rem;
  color: var(--text);
}
.search-input-row input::placeholder { color: var(--muted); }
.search-input-row input:focus { outline: none; }
.search-input-row input::-webkit-search-cancel-button { display: none; }
.search-close { font-size: .85rem; padding: .25rem .6rem; border: 1px solid var(--border); border-radius: var(--r-xs); background: var(--surface-2); color: var(--muted); }
.search-close:hover { color: var(--text); }
.search-results { overflow-y: auto; padding: .6rem; overscroll-behavior: contain; }
.search-group-title { padding: .7rem .7rem .35rem; font-size: .82rem; font-weight: 500; color: var(--muted); }
.search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .1rem 1rem;
  padding: .65rem .7rem;
  border-radius: var(--r-sm);
}
.search-result[aria-selected="true"], .search-result:hover { background: var(--accent-soft); }
.search-result-title { font-family: var(--font-heading); font-size: calc(1.2rem * var(--heading-scale)); font-weight: var(--heading-weight); line-height: 1.6; }
.search-result-excerpt { grid-column: 1; font-size: .875rem; line-height: 1.75; color: var(--text-soft); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.search-result-meta { grid-row: 1; grid-column: 2; align-self: center; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.search-result--tag { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .7rem; }
.search-result--tag .khatim { font-size: 1rem; }
.search-result--tag .search-result-title { font-family: var(--font-ui); font-size: 1rem; font-weight: 500; }
.search-result--tag .search-result-meta { grid-row: auto; grid-column: auto; }
.search-results mark { background: var(--gold-soft); color: inherit; border-radius: 2px; box-shadow: 0 1px 0 var(--gold); }
.search-empty { padding: 2.2rem 1rem; text-align: center; color: var(--text-soft); }
.search-empty b { display: block; font-family: var(--font-heading); font-size: calc(1.3rem * var(--heading-scale)); color: var(--text); }
.search-foot {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.2rem;
  padding: .6rem 1.2rem;
  border-block-start: 1px solid var(--border);
  background: var(--surface-2);
  font-size: .8rem;
  color: var(--muted);
}
.search-foot kbd { margin-inline: 0 .35rem; background: var(--surface); }
.search-foot span:last-child { margin-inline-start: auto; }

/* ---------- 13b. More Ghost editor cards ---------- */
.kg-card figcaption { text-align: center; }
.kg-image-card a { display: block; }
.kg-embed-card > :not(figcaption) { max-width: 100%; }
.kg-embed-card .fluid-width-video-wrapper, .kg-embed-card iframe[src*="youtube"], .kg-embed-card iframe[src*="vimeo"] { width: 100%; }
.twitter-tweet, .instagram-media { margin-inline: auto !important; }

/* blockquote written in the editor ("alt" = the larger pull-quote style) */
.gh-content blockquote.kg-blockquote-alt {
  border: 0;
  background: none;
  font-family: var(--font-body);
  font-size: 1.3em;
  font-weight: 500;
  color: var(--text-soft);
}
.gh-content blockquote.kg-blockquote-alt::before { display: none; }

.kg-button-card { display: flex; justify-content: center; }
.kg-button-card.kg-align-left { justify-content: flex-start; }
.kg-button-card .kg-btn {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: .5rem 1.5rem;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 500;
  text-decoration: none;
}
.kg-button-card .kg-btn:hover { background: var(--accent-strong); }

.kg-toggle-card { padding: 1rem 1.25rem; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.kg-toggle-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; }
.kg-toggle-heading-text { font-size: 1.1rem; font-weight: 600; line-height: 1.6; }
.kg-toggle-card-icon { flex: none; width: 1.5rem; height: 1.5rem; padding: 0; border: 0; background: none; color: var(--muted); }
.kg-toggle-card-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; transition: transform .2s; }
.kg-toggle-card[data-kg-toggle-state="open"] .kg-toggle-card-icon svg { transform: rotate(180deg); }
.kg-toggle-content { margin-block-start: .6rem; font-size: 1rem; line-height: 1.9; color: var(--text-soft); }
.kg-toggle-card[data-kg-toggle-state="close"] .kg-toggle-content { display: none; }

.kg-file-card-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  text-decoration: none !important;
  transition: border-color .15s;
}
.kg-file-card-container:hover { border-color: var(--accent); }
.kg-file-card-contents { min-width: 0; }
.kg-file-card-title { font-size: 1.05rem; font-weight: 600; line-height: 1.6; }
.kg-file-card-caption { font-size: .9rem; color: var(--text-soft); }
.kg-file-card-metadata { font-size: .82rem; color: var(--muted); }
.kg-file-card-filesize::before { content: "•"; margin-inline: .4rem; }
.kg-file-card-icon { flex: none; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); }
.kg-file-card-icon svg { width: 1.4rem; height: 1.4rem; }

.kg-product-card-container {
  display: grid;
  gap: .75rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.kg-product-card-image { border-radius: var(--r-sm); }
.kg-product-card-title { font-size: 1.2rem; font-weight: 600; line-height: 1.6; }
.kg-product-card-description { font-size: .95rem; line-height: 1.9; color: var(--text-soft); }
.kg-product-card-rating { display: flex; gap: .1rem; color: var(--gold); }
.kg-product-card-rating-star { width: 1.1rem; height: 1.1rem; opacity: .3; }
.kg-product-card-rating-active { opacity: 1; }
.kg-product-card-rating-star svg { fill: currentColor; }
.kg-product-card-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 500;
  text-decoration: none !important;
}

.kg-audio-card { display: flex; gap: 1rem; padding: 1rem; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.kg-audio-thumbnail { flex: none; width: 5rem; height: 5rem; border-radius: var(--r-sm); object-fit: cover; background: var(--surface-2); }
.kg-audio-thumbnail.placeholder { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kg-audio-thumbnail.placeholder svg { width: 1.6rem; height: 1.6rem; fill: currentColor; }
.kg-audio-hide { display: none !important; }
.kg-audio-player-container { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: .4rem; }
.kg-audio-title { font-weight: 600; line-height: 1.6; }
.kg-audio-player, .kg-video-player { display: flex; align-items: center; gap: .6rem; direction: ltr; font-size: .82rem; color: var(--muted); }
.kg-audio-player button, .kg-video-player button { display: grid; place-items: center; padding: 0; border: 0; background: none; color: inherit; }
.kg-audio-player svg, .kg-video-player svg { width: 1.1rem; height: 1.1rem; fill: currentColor; }
.kg-audio-seek-slider, .kg-video-seek-slider { flex: 1; min-width: 0; accent-color: var(--accent); }
.kg-audio-volume-slider, .kg-video-volume-slider { width: 4.5rem; accent-color: var(--accent); }
.kg-audio-playback-rate, .kg-video-playback-rate { min-width: 2rem; font-weight: 600; }

.kg-video-card .kg-video-container { position: relative; overflow: hidden; border-radius: var(--r-md); background: #000; }
.kg-video-card video { display: block; width: 100%; height: auto; }
.kg-video-overlay, .kg-video-large-play-icon { position: absolute; inset: 0; display: grid; place-items: center; }
.kg-video-large-play-icon svg { width: 3.5rem; height: 3.5rem; fill: #fff; }
.kg-video-player-container { position: absolute; inset-inline: 0; inset-block-end: 0; padding: .6rem .9rem; background: linear-gradient(to top, rgba(0, 0, 0, .7), transparent); }
.kg-video-player { color: #fff; }
.kg-video-hide { display: none !important; }

.kg-header-card {
  display: grid;
  justify-items: center;
  gap: .6rem;
  padding: clamp(2.5rem, 7vw, 5rem) var(--gutter);
  background: var(--band-bg);
  color: var(--band-text);
  text-align: center;
  border-radius: var(--r-md);
}
.kg-header-card.kg-width-full { border-radius: 0; }
.kg-header-card h2, .kg-header-card-header, .kg-header-card-heading { margin: 0; font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 700; line-height: 1.5; color: inherit; }
.kg-header-card h2::before { display: none; }
.kg-header-card h3, .kg-header-card-subheader, .kg-header-card-subheading { margin: 0; font-size: 1.1rem; font-weight: 400; color: var(--band-muted); }
.kg-header-card-button { margin-block-start: .6rem; padding: .55rem 1.5rem; border-radius: var(--r-sm); background: var(--band-gold); color: #1a2130; font-weight: 600; text-decoration: none !important; }

.kg-signup-card, .kg-cta-card { padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.kg-signup-card-heading { font-size: 1.4rem; font-weight: 700; line-height: 1.5; }
.kg-signup-card-fields { display: flex; gap: .5rem; margin-block-start: .9rem; }
.kg-signup-card-input { flex: 1; min-width: 0; padding: .6rem .9rem; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--bg); }
.kg-signup-card-button { padding: .6rem 1.2rem; border: 0; border-radius: var(--r-sm); background: var(--accent); color: var(--accent-contrast); font-weight: 500; }
.kg-cta-sponsor-label { font-size: .82rem; color: var(--muted); }
.kg-cta-button { display: inline-flex; margin-block-start: .8rem; padding: .5rem 1.25rem; border-radius: var(--r-sm); background: var(--accent); color: var(--accent-contrast); text-decoration: none !important; }

.gh-content table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; font-family: var(--font-ui); font-size: .95rem; line-height: 1.8; }
.gh-content th, .gh-content td { padding: .6rem .8rem; border: 1px solid var(--border); text-align: start; vertical-align: top; }
.gh-content th { background: var(--surface-2); font-weight: 600; }
.gh-content pre { overflow-x: auto; padding: 1rem 1.2rem; border-radius: var(--r-md); background: var(--surface-2); direction: ltr; text-align: start; font-size: .9rem; line-height: 1.7; }
.gh-content code { padding: .1em .35em; border-radius: var(--r-xs); background: var(--surface-2); font-size: .88em; }
.gh-content pre code { padding: 0; background: none; }
.gh-content img { border-radius: var(--r-sm); }
/* forms pasted into a page with an HTML card (e.g. a page that keeps its own form) */
.gh-content form { display: grid; gap: 1rem; font-family: var(--font-ui); }
.gh-content form input:not([type="checkbox"]):not([type="radio"]), .gh-content form textarea {
  width: 100%;
  padding: .7rem .9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 1rem;
}
.gh-content form textarea { min-height: 9rem; }
.gh-content form button { justify-self: start; min-height: 2.75rem; padding: .5rem 1.5rem; border: 0; border-radius: var(--r-sm); background: var(--accent); color: var(--accent-contrast); font-weight: 500; }

/* callout colours chosen in the editor, toned to the palette */
.kg-callout-card-yellow { border-inline-start-color: var(--gold); background: var(--gold-soft); }
.kg-callout-card-green { border-inline-start-color: #3d8b6b; background: color-mix(in srgb, #3d8b6b 12%, transparent); }
.kg-callout-card-red { border-inline-start-color: #b4483c; background: color-mix(in srgb, #b4483c 11%, transparent); }
.kg-callout-card-pink { border-inline-start-color: #b05a86; background: color-mix(in srgb, #b05a86 11%, transparent); }
.kg-callout-card-purple { border-inline-start-color: #7560a8; background: color-mix(in srgb, #7560a8 12%, transparent); }

.kg-button-card.kg-align-center { justify-content: center; }
.kg-btn-accent, .kg-product-card-btn-accent { background: var(--accent); color: var(--accent-contrast); }
.kg-product-card-title-container { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }

.kg-file-card-filename { font-weight: 500; unicode-bidi: isolate; }
.kg-file-card-medium .kg-file-card-container { padding: .8rem 1rem; }
.kg-file-card-medium .kg-file-card-icon { width: 2.5rem; height: 2.5rem; }
.kg-file-card-small .kg-file-card-container { padding: .55rem .9rem; }
.kg-file-card-small .kg-file-card-icon { width: 2rem; height: 2rem; }
.kg-file-card-small .kg-file-card-caption { display: none; }

.kg-audio-time, .kg-video-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.kg-audio-current-time, .kg-video-current-time { color: inherit; }
.kg-audio-duration, .kg-video-duration { opacity: .8; }
.kg-audio-play-icon, .kg-audio-pause-icon, .kg-audio-mute-icon, .kg-audio-unmute-icon,
.kg-video-play-icon, .kg-video-pause-icon, .kg-video-mute-icon, .kg-video-unmute-icon { width: 2rem; height: 2rem; border-radius: 50%; cursor: pointer; }
.kg-audio-play-icon:hover, .kg-audio-pause-icon:hover, .kg-audio-mute-icon:hover, .kg-audio-unmute-icon:hover { background: var(--accent-soft); color: var(--accent); }

.kg-before-after-card > div { position: relative; overflow: hidden; border-radius: var(--r-md); }
.kg-before-after-card-image-before { position: absolute; inset-block: 0; inset-inline-start: 0; overflow: hidden; }
.kg-before-after-card-image-after img, .kg-before-after-card-image-before img { display: block; max-width: none; border-radius: 0; }

/* legacy NFT embed card */
.kg-nft-card { display: flex; justify-content: center; }
.kg-nft-card-container { display: block; width: 100%; max-width: 32rem; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text); text-decoration: none !important; }
.kg-nft-image { width: 100%; border-radius: 0; }
.kg-nft-metadata { padding: 1rem 1.25rem; }
.kg-nft-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.kg-nft-title { font-size: 1.1rem; font-weight: 600; line-height: 1.6; }
.kg-nft-opensea-logo { width: 4.5rem; height: auto; }
.kg-nft-creator { font-size: .9rem; color: var(--muted); }
.kg-nft-description { margin-block-start: .5rem; font-size: .9rem; line-height: 1.8; color: var(--text-soft); }

/* ---------- 17. Pages, book post, video post, comments, error ---------- */
.article-excerpt { max-width: 40rem; margin: 1rem auto 0; font-size: 1.1rem; line-height: 1.9; color: var(--text-soft); }

.book-header { border-block-end: 1px solid var(--border); background: var(--bg-soft); }
.book-header-inner {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 5vw, 4rem);
  max-width: 54rem;
  margin-inline: auto;
  padding-block: clamp(2rem, 5vw, 3.5rem);
}
.book-header .book-cover { box-shadow: var(--shadow-2); }
.book-header .breadcrumb { margin-block-end: .6rem; }
.book-header-title { font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 700; line-height: 1.5; text-wrap: balance; }
.book-header-author { margin-block-start: .5rem; font-size: 1.05rem; color: var(--text-soft); }
.book-header .article-meta { justify-content: flex-start; margin-block-start: 1.25rem; }
.book-original { max-width: var(--measure); margin: 2rem auto 0; padding-inline: var(--gutter); }
.book-original img { max-height: 26rem; width: auto; margin-inline: auto; border-radius: var(--r-sm); box-shadow: var(--shadow-1); }

.gh-content--video { --measure: 54rem; }

.article-comments { margin-block: 2.5rem; padding-block-start: 2rem; border-block-start: 1px solid var(--border); }
.article-comments h2 { margin-block-end: 1rem; font-size: 1.4rem; font-weight: 700; }

.page-header { padding-block: clamp(2.25rem, 5vw, 3.5rem) 0; }
.page-header-inner { max-width: calc(var(--measure) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.page-title { display: flex; align-items: center; gap: .7rem; font-size: clamp(1.9rem, 4.5vw, 2.8rem); font-weight: 700; line-height: 1.5; }
.page-title .khatim { font-size: .6em; }
.page-body { padding-block: clamp(1.5rem, 3vw, 2.25rem) clamp(3rem, 6vw, 5rem); }
.page-body .article-feature { margin-block-end: 2rem; padding-inline: var(--gutter); }

.author-header .archive-desc { max-width: 44rem; }
.empty-state { padding-block: 3rem; text-align: center; color: var(--text-soft); }

.error-page { display: grid; justify-items: center; gap: 1rem; padding-block: clamp(4rem, 12vw, 8rem); text-align: center; }
.error-code { font-size: clamp(4rem, 14vw, 7.5rem); font-weight: 700; line-height: 1; color: var(--accent); letter-spacing: .04em; }
.error-page .khatim { font-size: 2.5rem; }
.error-title { font-size: clamp(1.4rem, 3.5vw, 2rem); font-weight: 700; }
.error-text { max-width: 30rem; color: var(--text-soft); line-height: 1.9; }
.error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-block-start: .5rem; }

.search-status { padding: 2.2rem 1rem; text-align: center; color: var(--text-soft); }
.pagination span.btn { opacity: .45; }
.media-source:empty { display: none; }

@media (max-width: 640px) {
  .book-header-inner { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .book-header .book-cover { width: 11rem; }
  .book-header .article-meta { justify-content: center; }
  .kg-audio-card { flex-direction: column; }
  .kg-signup-card-fields { flex-direction: column; }
}

/* ---------- 18. Responsive ---------- */
@media (min-width: 1240px) {
  /* table of contents in the inline-start margin */
  .article-toc {
    display: block;
    position: absolute;
    inset-block: clamp(2rem, 4vw, 3.25rem) 0;
    inset-inline-start: max(var(--gutter), calc(50% - 600px));
    width: 10.5rem;
    pointer-events: none;
  }
  .article-toc-inner {
    position: sticky; inset-block-start: calc(var(--navbar-h) + 2rem); pointer-events: auto;
    max-block-size: calc(100vh - var(--navbar-h) - 4rem); overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
  }
  .article-toc .toc-sub a { padding-inline-start: 1.6rem; font-size: .84rem; }
  .article-toc h2 { font-size: .85rem; font-weight: 500; color: var(--muted); margin-block-end: .6rem; }
  .article-toc li a {
    display: block;
    padding: .3rem .8rem;
    border-inline-start: 2px solid var(--border);
    font-size: .9rem;
    line-height: 1.6;
    color: var(--text-soft);
  }
  .article-toc li a:hover { color: var(--accent); }
  .article-toc li a.is-active { border-inline-start-color: var(--gold); color: var(--accent); font-weight: 500; }
  .article-toc[data-empty] { display: none; }
}

@media (max-width: 1099px) {
  .site-header { inset-block-start: 0; }
  .site-topbar { min-height: 60px; }
  .site-navbar, .desktop-only { display: none; }
  .mobile-only { display: inline-grid; }
  .site-brand .khatim { font-size: 2rem; }
  .site-brand-name { font-size: calc(1.25rem * var(--display-scale)); }
  .site-brand-sub { display: none; }
  html { scroll-padding-top: 5rem; }

  .post-feed { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book-shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-main { grid-template-columns: 1fr 1fr; }
  .footer-about { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); text-align: center; }
  .hero-inner { padding-block-start: 2rem; gap: 1.75rem; }
  .hero-portrait { order: -1; width: min(27rem, 100%); padding: 1rem 1rem 0; }
  .arch::before { inset: -1rem; inset-block-end: -.7rem; }
  .arch::after { inset: -.5rem; inset-block-end: -.35rem; }
  .hero-life { justify-content: center; }
  .hero-name { font-size: clamp(1.25rem, 7.4vw, 3.5rem); font-size: clamp(1.25rem, 9.1cqi, 3.75rem); }
  .hero-life::before { content: ""; flex: 1 1 0; max-width: 5rem; min-width: 1rem; height: 1px; background: var(--gold); }
  .hero-lede { margin-inline: auto; }
  .hero-cta { justify-content: center; }
  .hero-index { grid-template-columns: 1fr 1fr; }
  .hero-index a { padding-inline: 1rem; border-block-end: 1px solid var(--border); }
  .hero-index li:nth-child(odd) a { border-inline-start: 0; padding-inline-start: 0; }
  .hero-index li:nth-last-child(-n + 2) a { border-block-end: 0; }
  .split, .subscribe-inner, .contact-layout { grid-template-columns: minmax(0, 1fr); }
  .post-card--featured { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  :root { --gutter: 1.125rem; }
  .section { padding-block: 2.5rem; }
  .section-head { margin-block-end: 1.25rem; }

  /* feed: one lead card, then compact rows (thumbnail + title) so a phone shows 4–5 posts per screen */
  .post-feed { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .post-card { padding-block: 1rem; border-block-end: 1px solid var(--border); }
  .post-feed > .post-card:last-child { border-block-end: 0; }
  .post-feed > .post-card:not(:first-child) { display: grid; grid-template-columns: 6.25rem minmax(0, 1fr); align-items: start; gap: .9rem; }
  .post-feed > .post-card:not(:first-child) .post-card-image { aspect-ratio: 1; border-radius: var(--r-sm); }
  .post-feed > .post-card:not(:first-child) .post-card-title { font-size: calc(1.3rem * var(--heading-scale)); line-height: 1.6; }
  .post-feed > .post-card:not(:first-child) .post-card-excerpt { display: none; }
  .post-feed > .post-card:not(:first-child) .post-card-body { gap: .2rem; }
  .post-feed > .post-card:first-child { padding-block-start: 0; }
  .post-feed > .post-card:first-child .post-card-title { font-size: calc(1.75rem * var(--heading-scale)); }
  .post-card--featured { gap: 1rem; padding-block-end: 1.25rem; }
  .post-card--featured .post-card-excerpt { -webkit-line-clamp: 3; line-clamp: 3; font-size: 1rem; line-height: 1.85; }
  .post-card-title { font-size: calc(1.4rem * var(--heading-scale)); }

  .hero-role { font-size: calc(1.3rem * var(--display-scale)); }
  .hero-lede { font-size: 1rem; line-height: 1.9; }
  .hero-cta .btn { flex: 1 1 auto; }
  .hero-index a { flex-direction: column; align-items: flex-start; gap: 0; padding-block: .85rem; }
  .hero-index b { line-height: 1.3; }
  .hero-index span { font-size: .875rem; }

  .article-header { padding-block: 1.75rem 1.25rem; }
  .article-header-inner { text-align: start; }
  .article-title { font-size: calc(2.15rem * var(--display-scale)); }
  .article-meta { justify-content: flex-start; gap: .5rem 1.1rem; margin-block-start: 1.1rem; }
  .article-author { flex-basis: 100%; }
  .font-size-control { margin-inline-start: auto; }
  .article-feature { margin-inline: calc(-1 * var(--gutter)); }
  .article-feature img { border-radius: 0; }
  .article-feature figcaption { padding-inline: var(--gutter); }
  .gh-content h2 { margin-block-start: 1.8em; }
  .gh-content blockquote { margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
  .footnotes ol { font-size: .9rem; }
  .footnotes li { grid-template-columns: 1.6rem minmax(0, 1fr); padding-inline: 0; }
  .fn-ref a { min-width: 1.7em; padding: .4em .35em; }

  .archive-header-inner { padding-block-start: 2rem; }
  .archive-title { font-size: calc(2.1rem * var(--display-scale)); }
  .section-tabs { margin-block-start: 1.25rem; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
  .subscribe-inner { padding-block: 2.5rem; gap: 1.25rem; }
  .subscribe-field .btn { width: 100%; }
  .footer-main { grid-template-columns: 1fr 1fr; gap: 2rem 1.5rem; padding-block: 2.25rem; }
  .footer-about { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; }
  .contact-layout { padding-block: 2rem 2.5rem; }
  .contact-form { margin-inline: calc(-.25 * var(--gutter)); }

  /* search becomes a full-height sheet */
  .search-overlay { padding: 0; }
  .search-modal { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; }
  .search-input-row { padding-inline: 1rem; min-height: 3.75rem; }
  .search-results { flex: 1; }
  .search-result { grid-template-columns: minmax(0, 1fr); }
  .search-result-meta { grid-row: auto; grid-column: 1; order: -1; color: var(--gold-ink); }
  .search-result--tag { grid-template-columns: auto minmax(0, 1fr) auto; }
  .search-result--tag .search-result-meta { order: 0; grid-column: auto; color: var(--muted); }
  /* books become a swipeable shelf */
  .book-shelf {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 44%;
    overflow-x: auto;
    scroll-snap-type: inline mandatory;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    padding-block: .5rem 1rem;
    scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
  }
  .book-shelf::-webkit-scrollbar { display: none; }
  .book-card { scroll-snap-align: start; }
  .media-item { grid-template-columns: 5.5rem minmax(0, 1fr); }
  .subscribe-field { flex-direction: column; }
  .subscribe-field input { flex: none; width: 100%; }
  .gh-content { font-size: calc(var(--article-size-sm) * var(--content-scale)); }
  .kg-bookmark-container { flex-direction: column-reverse; }
  .kg-bookmark-thumbnail { flex: none; aspect-ratio: 16 / 8; }
  .kg-gallery-row { gap: .35rem; }
  .author-card { grid-template-columns: 4.75rem minmax(0, 1fr); gap: 1.1rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav a:last-child { text-align: start; align-items: flex-start; }
  .field-row { grid-template-columns: 1fr; }
  .pagination-pages { display: none; }
  .pagination-info { display: block; }
  .article-share-label { flex-basis: 100%; }
  .search-foot span:not(:last-child) { display: none; }
}

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

@media print {
  .site-header, .site-footer, .subscribe, .reading-progress, .article-share, .article-toc, .post-nav { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---------- Ghost Portal iframes (sign-in window, "welcome back" notification) ----------
   Portal's documents are light. When the page is dark, an iframe whose color-scheme differs from
   its document gets an opaque white backdrop from the browser (a white box around the toast).
   Matching the iframe element's scheme to its content keeps it transparent. */
#ghost-portal-root iframe,
iframe.gh-portal-notification-iframe,
iframe[title^="portal-"] {
  color-scheme: light;
}
