.hero.hero-2d{min-height:100svh;background:#030509}
.hero.hero-2d .baghdad-fallback{filter:none;transform:none}
.hero.hero-2d .hero-scene-shade{background:linear-gradient(180deg,rgba(2,4,7,.32) 0%,rgba(2,4,7,.24) 42%,rgba(2,4,7,.7) 100%),linear-gradient(90deg,rgba(2,4,7,.28),rgba(2,4,7,.08) 50%,rgba(2,4,7,.3))}
.hero.hero-2d .hero-layout{min-height:100svh;display:flex;align-items:center;justify-content:center;padding-top:clamp(122px,15vh,176px)!important;padding-bottom:clamp(68px,9vh,110px)!important}
.hero.hero-2d .hero-body{width:min(1080px,100%);margin:0 auto;padding:0;text-align:center;filter:drop-shadow(0 18px 34px rgba(0,0,0,.56))}
.hero.hero-2d .hero-arabic{font-size:clamp(38px,5vw,70px);line-height:1.55;text-align:center;color:#f0e5d5}
.hero.hero-2d .hero-arabic-ref{margin:3px 0 38px;text-align:center;font-size:13px;color:rgba(240,229,213,.62)}
.hero.hero-2d .hero-display{font-family:'Inter','IBM Plex Sans Thai',system-ui,sans-serif;font-size:clamp(54px,8.8vw,126px);font-weight:620;line-height:.94;letter-spacing:-.055em;text-align:center;color:#f4ecdf;text-wrap:balance}
.hero.hero-2d .hero-display.hero-quote{max-width:1180px;margin-inline:auto;font-size:clamp(36px,5.9vw,82px);line-height:1.01;letter-spacing:-.045em}
.hero.hero-2d .hero-display .br{display:block}
.hero.hero-2d .hero-display em{font-style:normal;font-weight:760;color:transparent;background:linear-gradient(90deg,#320706 0%,#741611 18%,#f6d7b9 38%,#ff745d 52%,#8c1d17 72%,#320706 100%);background-size:240% 100%;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;animation:heritage-shine 7s linear infinite}
.hero.hero-2d .hero-sub{max-width:min(1500px,calc(100vw - 80px));margin:34px auto 0;font-size:clamp(13px,1.1vw,18px);line-height:1.9;text-align:center;color:rgba(244,236,223,.68)}
.hero.hero-2d .hero-quote-translation{display:block;white-space:nowrap}
@keyframes heritage-shine{from{background-position:220% 50%}to{background-position:-20% 50%}}

/* PR #354 glass treatment for the existing article feed. */
body.idx-home .idx-row{background:rgba(255,255,255,.018);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);box-shadow:inset 0 1px 1px rgba(255,255,255,.07)}
body.idx-home .idx-row:hover{background:rgba(255,255,255,.035)}

/* Scroll Portrait Wall is applied from บัยตุลฮิกมะฮ์ downward, not as a long empty scene. */
.scroll-flow-item{opacity:0;transform:translate3d(0,28px,0);transform-origin:50% 50%;transition:opacity .7s ease,transform .85s cubic-bezier(.16,1,.3,1)}
.scroll-flow-item.is-flow-visible{opacity:1;transform:none}
#archive,#membership-access{content-visibility:auto;contain-intrinsic-size:auto 900px}
/* The category stack is much taller than 900px on phones. Reserving it with
   content-visibility moved the real final card beyond the apparent footer
   until the section was rendered, so this variable-height section stays in
   normal document flow. */
#categories{content-visibility:visible;contain-intrinsic-size:none}
.portrait-wall{height:auto;min-height:0}
.portrait-wall-stage{position:relative;top:auto;min-height:0;overflow:visible}
.portrait-wall-hint span{font-size:0}
.portrait-wall-hint span::after{content:'เลื่อนสำรวจตั้งแต่บัยตุลฮิกมะฮ์ · กดภาพเพื่ออ่านแฟ้มฉบับเต็ม';font-size:12px}

/* Membership access cards retained from PR #354, with direct static markup. */
.heritage-membership{position:relative;padding:clamp(92px,10vw,148px) clamp(22px,4vw,64px);overflow:hidden;background:#05070a;border-top:0}
.heritage-membership-head{width:min(1120px,100%);margin:0 auto;text-align:center;background:transparent!important;box-shadow:none!important}
.heritage-membership-head h2{margin:0;padding:.08em 0 .12em;font-family:'IBM Plex Sans Thai',system-ui,sans-serif;font-size:clamp(46px,7vw,92px);font-weight:650;line-height:1.18;letter-spacing:-.05em;color:#fff;background:transparent!important;box-shadow:none!important;border:0!important}
.heritage-membership-head h2 span{display:block;padding:.04em 0 .12em;color:transparent;background:linear-gradient(90deg,#320706 0%,#741611 18%,#f6d7b9 38%,#ff745d 52%,#8c1d17 72%,#320706 100%);background-size:240% 100%;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;animation:heritage-shine 7s linear infinite}
.heritage-membership-grid{width:min(1120px,100%);margin:42px auto 0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}
.heritage-membership-card{position:relative;min-height:190px;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:18px;text-align:center;padding:44px 28px;border:1px solid rgba(245,241,234,.3);border-radius:24px;background:linear-gradient(145deg,rgba(255,255,255,.045),rgba(255,255,255,.012));color:rgba(245,241,234,.92);box-shadow:inset 0 1px 0 rgba(255,255,255,.07);transition:transform .35s cubic-bezier(.2,.7,.2,1),border-color .35s ease}
.heritage-membership-card:hover{transform:translateY(-7px);border-color:rgba(216,27,55,.72)}
/* สมาชิกก่อตั้ง - a slightly stronger brand-red accent (no gold, no promo wash) */
.heritage-membership-card.featured{border-color:rgba(216,27,55,.72);box-shadow:inset 0 1px 0 rgba(255,255,255,.08)}
/* restrained informational chip (จำกัด 30 หมายเลข) - quiet outline, theme-safe, no fill */
.heritage-membership-badge{position:absolute;top:-11px;left:50%;transform:translateX(-50%);font-family:var(--ui,'D-DIN','Inter',system-ui,sans-serif);font-size:10px;font-weight:600;letter-spacing:.12em;text-transform:uppercase;padding:5px 14px;border-radius:999px;background:transparent;color:inherit;border:1px solid currentColor;opacity:.72;white-space:nowrap}
.heritage-membership-tier{font-family:var(--serif,'IBM Plex Sans Thai',system-ui,sans-serif);font-size:clamp(27px,2.7vw,36px);font-weight:600;color:#fff}
.heritage-membership-price{margin:0;font-family:var(--serif,'IBM Plex Sans Thai',system-ui,sans-serif);color:inherit;line-height:1;display:flex;align-items:baseline;gap:4px;justify-content:center}
.heritage-membership-price b{font-size:clamp(34px,3.4vw,44px);font-weight:700;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.heritage-membership-price span{font-size:14px;font-weight:500;opacity:.62}
.heritage-membership-btn{padding:11px 28px;border-radius:999px;background:#fff;color:#07090c;font-size:14px;font-weight:600}
.heritage-membership-note{width:min(880px,100%);margin:28px auto 0;font-size:13px;line-height:1.8;text-align:center;color:rgba(255,255,255,.5)}

@media(max-width:1100px){.hero.hero-2d .hero-quote-translation{white-space:normal}}
@media(max-width:820px){.hero.hero-2d .hero-layout{padding-top:118px!important;padding-bottom:62px!important}.hero.hero-2d .hero-body{padding:0 4px}.hero.hero-2d .hero-display{font-size:clamp(47px,12.5vw,76px)}.hero.hero-2d .hero-display.hero-quote{font-size:clamp(31px,7.8vw,50px);line-height:1.05}.hero.hero-2d .hero-sub{max-width:min(680px,calc(100vw - 40px))}.portrait-wall-stage{display:flex;overflow-x:auto;overflow-y:hidden}.heritage-membership-grid{grid-template-columns:1fr}.heritage-membership-card{min-height:0}}
@media(max-width:560px){.hero.hero-2d .hero-arabic{font-size:clamp(31px,9vw,44px)}.hero.hero-2d .hero-display{font-size:clamp(42px,12.8vw,64px)}.hero.hero-2d .hero-display.hero-quote{font-size:clamp(27px,8.6vw,39px)}.hero.hero-2d .hero-sub{font-size:14px}.heritage-membership{padding-inline:18px}.heritage-membership-head h2{font-size:clamp(40px,12vw,60px)}}
@media(prefers-reduced-motion:reduce){.hero.hero-2d .hero-display em,.heritage-membership-head h2 span{animation:none}.scroll-flow-item{opacity:1;transform:none;transition:none}.heritage-membership-card{transition:none}}

/* =========================================================
   INDEX THEME COMPLETION
   The photographic hero, intro, category imagery, portrait
   cards, and footer remain deliberate dark islands.
   ========================================================= */
html {
  overflow-x: clip;
}

body.idx-home {
  --home-canvas: oklch(12.71% 0.0088 253.66);
  --home-canvas-alt: oklch(16.5% 0.011 253.66);
  --home-surface: oklch(19.5% 0.012 253.66);
  --home-ink: oklch(93.95% 0.0205 81.78);
  --home-muted: oklch(75% 0.016 75);
  --home-faint: oklch(65% 0.014 75);
  --home-rule: oklch(93.95% 0.0205 81.78 / 0.12);
  --home-rule-strong: oklch(93.95% 0.0205 81.78 / 0.24);
  --home-accent: oklch(58.77% 0.1949 27.26);
  --home-accent-strong: oklch(49.34% 0.1857 27.49);
  --home-accent-soft: oklch(58.77% 0.1949 27.26 / 0.13);
  --home-state: oklch(70.9% 0.1139 82.58);
  --home-focus: oklch(58.77% 0.1949 27.26);
  --home-shadow: oklch(7% 0.009 253.66 / 0.28);
  --home-overlay: oklch(7% 0.009 253.66 / 0.58);
  --home-control-size: 2.75rem;
  --home-control-visual-size: 2.375rem;
  --home-focus-width: 0.1875rem;
  --home-focus-offset: 0.1875rem;
  --home-dur-micro: 120ms;
  --home-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  overflow-x: clip;
  color-scheme: dark;
}

html:not(.dark-mode) body.idx-home {
  --home-canvas: oklch(97.08% 0.0086 84.57);
  --home-canvas-alt: oklch(93.6% 0.0149 80.71);
  --home-surface: oklch(97.98% 0.0086 84.57);
  --home-ink: oklch(25.2% 0.0106 60.97);
  --home-muted: oklch(46.19% 0.0164 67.4);
  --home-faint: oklch(51.94% 0.018 67.42);
  --home-rule: oklch(25.2% 0.0106 60.97 / 0.13);
  --home-rule-strong: oklch(25.2% 0.0106 60.97 / 0.28);
  --home-accent: oklch(49.34% 0.1857 27.49);
  --home-accent-strong: oklch(42% 0.16 27.49);
  --home-accent-soft: oklch(91% 0.035 27.49);
  --home-state: oklch(47.22% 0.0953 66.08);
  --home-focus: oklch(58.77% 0.1949 27.26);
  --home-shadow: oklch(25.2% 0.0106 60.97 / 0.08);
  --home-overlay: oklch(12.71% 0.0088 253.66 / 0.48);

  --bg-primary: var(--home-canvas);
  --bg-secondary: var(--home-surface);
  --bg-tertiary: var(--home-canvas-alt);
  --text-primary: var(--home-ink);
  --text-secondary: var(--home-muted);
  --text-tertiary: var(--home-faint);
  --border-primary: var(--home-rule);
  --border-secondary: var(--home-rule-strong);
  --ink: var(--home-canvas);
  --ink-2: var(--home-surface);
  --ink-3: var(--home-canvas-alt);
  --paper: var(--home-ink);
  --paper-2: var(--home-muted);
  --text: var(--home-ink);
  --text-dim: var(--home-muted);
  --text-mute: var(--home-faint);
  --gold: var(--home-accent);
  --gold-bright: var(--home-accent-strong);
  --rule: var(--home-rule);
  --rule-strong: var(--home-rule-strong);
  --header-bg: var(--home-surface);
  --header-text: var(--home-ink);
  --header-text-dim: var(--home-muted);
  --header-border: var(--home-rule);
  --header-icon-border: var(--home-rule-strong);

  background: var(--home-canvas);
  color: var(--home-ink);
  color-scheme: light;
}

/* Compact glass utility controls: a 38px visual shell inside a 44px tap target. */
body.idx-home :is(#themeToggleBtn, #searchToggleBtn) {
  display: grid;
  position: relative;
  place-items: center;
  width: var(--home-control-size);
  height: var(--home-control-size);
  min-width: var(--home-control-size);
  min-height: var(--home-control-size);
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: oklch(93.95% 0.0205 81.78 / 0.78);
  transition:
    transform var(--home-dur-micro) var(--home-ease-out),
    color var(--home-dur-micro) var(--home-ease-out);
}

body.idx-home :is(#themeToggleBtn, #searchToggleBtn)::before {
  content: "";
  position: absolute;
  inset: calc((var(--home-control-size) - var(--home-control-visual-size)) / 2);
  pointer-events: none;
  border: 1px solid oklch(93.95% 0.0205 81.78 / 0.22);
  border-radius: inherit;
  background: oklch(100% 0 0 / 0.055);
  -webkit-backdrop-filter: blur(14px) saturate(1.35);
  backdrop-filter: blur(14px) saturate(1.35);
  box-shadow:
    inset 0 1px 0 oklch(100% 0 0 / 0.1),
    0 8px 24px oklch(7% 0.009 253.66 / 0.18);
  transition:
    transform var(--home-dur-micro) var(--home-ease-out),
    border-color var(--home-dur-micro) var(--home-ease-out),
    background-color var(--home-dur-micro) var(--home-ease-out),
    box-shadow var(--home-dur-micro) var(--home-ease-out);
}

body.idx-home :is(#themeToggleBtn, #searchToggleBtn) svg {
  position: relative;
  z-index: 1;
  width: 1.0625rem;
  height: 1.0625rem;
  pointer-events: none;
}

body.idx-home :is(#themeToggleBtn, #searchToggleBtn):active {
  transform: none;
}

body.idx-home :is(#themeToggleBtn, #searchToggleBtn):active::before {
  transform: scale(0.94);
}

body.idx-home :is(#themeToggleBtn, #searchToggleBtn):disabled,
body.idx-home :is(#themeToggleBtn, #searchToggleBtn)[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 63.99rem) {
  body.idx-home .chrome-right {
    gap: 0.5rem;
  }

  html:not(.dark-mode) body.idx-home :is(#themeToggleBtn, #searchToggleBtn) {
    color: var(--home-ink);
  }

  html:not(.dark-mode) body.idx-home :is(#themeToggleBtn, #searchToggleBtn)::before {
    border-color: oklch(25.2% 0.0106 60.97 / 0.16);
    background: oklch(100% 0 0 / 0.58);
    box-shadow:
      inset 0 1px 0 oklch(100% 0 0 / 0.82),
      0 8px 22px oklch(25.2% 0.0106 60.97 / 0.08);
  }
}

body.idx-home :where(
  a,
  button,
  input,
  .wisdom-card,
  .cat-panel,
  .works-book,
  .portrait-wall-card
):focus-visible {
  outline: var(--home-focus-width) solid var(--home-focus) !important;
  outline-offset: var(--home-focus-offset);
}

@media (hover: hover) and (pointer: fine) {
  body.idx-home :is(#themeToggleBtn, #searchToggleBtn):hover {
    color: oklch(70% 0.178 27.26);
    transform: translateY(-1px);
  }

  body.idx-home :is(#themeToggleBtn, #searchToggleBtn):hover::before {
    border-color: oklch(70% 0.178 27.26 / 0.52);
    background: oklch(100% 0 0 / 0.085);
    box-shadow:
      inset 0 1px 0 oklch(100% 0 0 / 0.14),
      0 10px 28px oklch(7% 0.009 253.66 / 0.24);
  }
}

/* Light paper flow from บัยตุลฮิกมะฮ์ through support. */
html:not(.dark-mode) body.idx-home .section,
html:not(.dark-mode) body.idx-home #categories,
html:not(.dark-mode) body.idx-home .section-support {
  background: var(--home-canvas);
  color: var(--home-ink);
}

html:not(.dark-mode) body.idx-home #archive,
html:not(.dark-mode) body.idx-home .cat-panel-knowledge,
html:not(.dark-mode) body.idx-home .heritage-membership {
  background: var(--home-canvas-alt);
  color: var(--home-ink);
}

html:not(.dark-mode) body.idx-home .cat-panel-works,
html:not(.dark-mode) body.idx-home .parchment {
  background: var(--home-surface);
  color: var(--home-ink);
}

html:not(.dark-mode) body.idx-home .hikmah-section,
html:not(.dark-mode) body.idx-home .section-support,
html:not(.dark-mode) body.idx-home .parchment {
  border-color: var(--home-rule);
}

html:not(.dark-mode) body.idx-home :is(
  .section-title,
  .works-showcase-title,
  .knowledge-preview-title,
  .heritage-membership-head h2,
  .quote-ar
) {
  color: var(--home-ink);
}

body.idx-home :is(
  .section-title,
  .works-showcase-title,
  .knowledge-preview-title,
  .heritage-membership-head h2
) {
  min-width: 0;
  overflow-wrap: anywhere;
}

html:not(.dark-mode) body.idx-home :is(
  .section-title em,
  .knowledge-preview-title em
) {
  color: var(--home-accent);
}

html:not(.dark-mode) body.idx-home :is(
  .section-lede,
  .works-showcase-copy,
  .knowledge-preview-copy,
  .support-compact-text
) {
  color: var(--home-muted);
}

/* The legacy category header uses ID selectors; match that scope in light mode. */
html:not(.dark-mode) body.idx-home #categories .section-title {
  color: var(--home-ink);
}

html:not(.dark-mode) body.idx-home #categories .section-lede {
  color: var(--home-muted);
}

html:not(.dark-mode) body.idx-home .hikmah-section .section-eyebrow,
html:not(.dark-mode) body.idx-home .hikmah-section .section-eyebrow::before,
html:not(.dark-mode) body.idx-home .works-showcase-title em {
  color: var(--home-state);
}

html:not(.dark-mode) body.idx-home .hikmah-section .section-eyebrow::before {
  background: var(--home-state);
}

/* Latest articles. */
html:not(.dark-mode) body.idx-home .idx-row {
  border-color: var(--home-rule);
  background: var(--home-surface);
  color: var(--home-ink);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: 0 1px 2px var(--home-shadow);
}

html:not(.dark-mode) body.idx-home .idx-row:last-child {
  border-bottom-color: var(--home-rule);
}

html:not(.dark-mode) body.idx-home .idx-row::before {
  background: var(--home-accent);
}

html:not(.dark-mode) body.idx-home .idx-row:hover {
  border-color: var(--home-accent);
  background: var(--home-canvas);
}

html:not(.dark-mode) body.idx-home :is(
  .idx-num,
  .idx-cat,
  .idx-meta,
  .idx-arrow
) {
  color: var(--home-faint);
}

html:not(.dark-mode) body.idx-home .idx-title {
  color: var(--home-ink);
}

html:not(.dark-mode) body.idx-home .idx-row:hover .idx-title,
html:not(.dark-mode) body.idx-home .idx-row:hover .idx-arrow {
  color: var(--home-accent);
}

html:not(.dark-mode) body.idx-home .archive-footer .btn {
  border-color: var(--home-rule-strong);
  background: var(--home-surface);
  color: var(--home-ink);
}

html:not(.dark-mode) body.idx-home .archive-footer .btn:hover {
  border-color: var(--home-accent);
  background: var(--home-accent-soft);
  color: var(--home-accent);
}

/* Books and civilisation previews. */
html:not(.dark-mode) body.idx-home .cat-panel-works,
html:not(.dark-mode) body.idx-home .cat-panel-knowledge {
  border-color: var(--home-rule);
  box-shadow: none;
}

html:not(.dark-mode) body.idx-home .works-book {
  border-color: var(--home-rule);
  background: var(--home-canvas);
  box-shadow: 0 1px 2px var(--home-shadow);
}

html:not(.dark-mode) body.idx-home .works-book-cover {
  background: var(--home-canvas-alt);
}

html:not(.dark-mode) body.idx-home .works-book-title {
  color: var(--home-ink);
}

html:not(.dark-mode) body.idx-home .works-book:hover,
html:not(.dark-mode) body.idx-home .works-book:focus-visible {
  border-color: var(--home-state);
  box-shadow: 0 1px 2px var(--home-shadow);
}

html:not(.dark-mode) body.idx-home .portrait-wall-hint {
  color: var(--home-muted);
}

html:not(.dark-mode) body.idx-home .portrait-wall-hint::after {
  background: var(--home-rule-strong);
}

html:not(.dark-mode) body.idx-home .knowledge-preview-cta {
  color: var(--home-accent);
}

/* Membership is part of the Index dark canvas, never a separate panel. */
body.idx-home .heritage-membership,
body.idx-home .heritage-membership-head,
body.idx-home .heritage-membership-head h2 {
  background: #05070a !important;
}

/* Membership. */
html:not(.dark-mode) body.idx-home .heritage-membership-head h2 span {
  color: var(--home-accent);
  background: none;
  -webkit-text-fill-color: currentColor;
  animation: none;
}

html:not(.dark-mode) body.idx-home .heritage-membership-card {
  border-color: var(--home-rule);
  background: var(--home-surface);
  color: var(--home-ink);
  box-shadow: 0 1px 2px var(--home-shadow);
}

html:not(.dark-mode) body.idx-home .heritage-membership-card:hover {
  border-color: var(--home-accent);
}

html:not(.dark-mode) body.idx-home .heritage-membership-card.featured {
  border-color: var(--home-state);
  box-shadow: 0 1px 2px var(--home-shadow);
}

html:not(.dark-mode) body.idx-home .heritage-membership-tier {
  color: var(--home-ink);
}

html:not(.dark-mode) body.idx-home .heritage-membership-note {
  color: var(--home-muted);
}

html:not(.dark-mode) body.idx-home .heritage-membership-btn {
  background: var(--home-ink);
  color: var(--home-canvas);
}

html.dark-mode body.idx-home :is(
  .heritage-membership-note,
  .portrait-wall-hint
) {
  color: var(--home-faint);
}

/* Quote and support. */
html:not(.dark-mode) body.idx-home .quote-eyebrow {
  color: var(--home-muted);
  text-shadow: none;
}

html:not(.dark-mode) body.idx-home .quote-eyebrow::before,
html:not(.dark-mode) body.idx-home .quote-eyebrow::after {
  background: var(--home-rule-strong);
}

html:not(.dark-mode) body.idx-home .quote-th {
  color: var(--home-muted);
}

html:not(.dark-mode) body.idx-home .quote-author-line {
  color: var(--home-state);
}

html:not(.dark-mode) body.idx-home .quote-dot {
  border-color: var(--home-rule-strong);
  background: transparent;
  color: var(--home-muted);
}

html:not(.dark-mode) body.idx-home .quote-dot.active {
  border-color: var(--home-state);
  background: var(--home-state);
  color: var(--home-canvas);
}

html:not(.dark-mode) body.idx-home .quote-dot:hover,
html:not(.dark-mode) body.idx-home .quote-dot:focus-visible {
  border-color: var(--home-accent);
  color: var(--home-accent);
}

html:not(.dark-mode) body.idx-home .tea-btn {
  border-color: var(--home-rule-strong);
  background: var(--home-surface);
  color: var(--home-ink);
}

html:not(.dark-mode) body.idx-home .tea-btn:hover {
  border-color: var(--home-accent);
  color: var(--home-accent);
}

html:not(.dark-mode) body.idx-home .qr-inner {
  border-color: var(--home-rule);
  background: var(--home-surface);
  color: var(--home-ink);
}

html:not(.dark-mode) body.idx-home .qr-note {
  color: var(--home-muted);
}

/* Header: light on mobile; still white over the desktop hero. */
@media (max-width: 63.99rem) {
  html:not(.dark-mode) body.idx-home .chrome-wordmark {
    color: var(--home-ink);
  }
}

@media (min-width: 64rem) {
  body.idx-home #themeToggleBtn {
    display: grid;
  }

  html:not(.dark-mode) body.idx-home .chrome--scrolled {
    background: var(--home-surface) !important;
    border-bottom-color: var(--home-rule) !important;
  }

  html:not(.dark-mode) body.idx-home .chrome--scrolled :is(
    .chrome-wordmark,
    nav.chrome-nav .nav-item,
    .chrome-icon-btn
  ) {
    color: var(--home-ink);
  }

  html:not(.dark-mode) body.idx-home .chrome--scrolled :is(
    .chrome-icon-btn,
    #inlineSearchInput
  ) {
    border-color: var(--home-rule-strong);
  }

  html:not(.dark-mode) body.idx-home .chrome--scrolled :is(
    #themeToggleBtn,
    #searchToggleBtn
  ) {
    color: var(--home-ink);
  }

  html:not(.dark-mode) body.idx-home .chrome--scrolled :is(
    #themeToggleBtn,
    #searchToggleBtn
  )::before {
    border-color: oklch(25.2% 0.0106 60.97 / 0.16);
    background: oklch(100% 0 0 / 0.58);
    box-shadow:
      inset 0 1px 0 oklch(100% 0 0 / 0.82),
      0 8px 22px oklch(25.2% 0.0106 60.97 / 0.08);
  }

  html:not(.dark-mode) body.idx-home .chrome--scrolled #inlineSearchInput {
    color: var(--home-ink);
  }

  html:not(.dark-mode) body.idx-home .chrome--scrolled #inlineSearchInput::placeholder {
    color: var(--home-faint);
  }
}

@media (min-width: 64rem) and (max-width: 89.99rem) {
  body.idx-home .inline-search-wrap {
    display: none;
  }

  body.idx-home #searchToggleBtn {
    display: grid;
  }
}

/* Search overlay and inline results follow the Index theme. */
html:not(.dark-mode) body.idx-home .search-overlay {
  width: 100%;
  height: 100dvh;
  background: var(--home-overlay);
  color: var(--home-ink);
}

html:not(.dark-mode) body.idx-home .search-modal-card,
html:not(.dark-mode) body.idx-home .inline-search-dropdown {
  border-color: var(--home-rule);
  background: var(--home-surface);
  color: var(--home-ink);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: 0 1px 2px var(--home-shadow);
}

html:not(.dark-mode) body.idx-home :is(
  .search-modal-title,
  .search-input,
  .search-empty-state strong,
  .search-result-title,
  .inline-dd-title
) {
  color: var(--home-ink);
  text-shadow: none;
}

html:not(.dark-mode) body.idx-home .search-input-field-wrapper,
html:not(.dark-mode) body.idx-home .search-result-item,
html:not(.dark-mode) body.idx-home .search-modal-footer,
html:not(.dark-mode) body.idx-home .inline-dd-footer {
  border-color: var(--home-rule);
}

html:not(.dark-mode) body.idx-home :is(
  .search-input-icon,
  .search-empty-state p,
  .search-empty-state .keyboard-tip,
  .search-result-excerpt,
  .search-hint,
  .inline-dd-footer,
  .inline-dd-empty
) {
  color: var(--home-faint);
}

html:not(.dark-mode) body.idx-home .search-input::placeholder {
  color: var(--home-faint);
}

html:not(.dark-mode) body.idx-home :is(
  .search-result-cat,
  .inline-dd-cat
) {
  color: var(--home-muted);
  text-shadow: none;
}

html:not(.dark-mode) body.idx-home .search-esc-badge,
html:not(.dark-mode) body.idx-home .search-empty-state code,
html:not(.dark-mode) body.idx-home .search-hint kbd {
  border-color: var(--home-rule-strong);
  background: var(--home-canvas-alt);
  color: var(--home-muted);
}

html:not(.dark-mode) body.idx-home .search-result-item:hover,
html:not(.dark-mode) body.idx-home .search-result-item.active,
html:not(.dark-mode) body.idx-home .inline-dd-item:hover,
html:not(.dark-mode) body.idx-home .inline-dd-item.active {
  border-color: var(--home-accent);
  background: var(--home-accent-soft);
}

html:not(.dark-mode) body.idx-home .search-result-item:hover .search-result-title,
html:not(.dark-mode) body.idx-home .search-result-item.active .search-result-title,
html:not(.dark-mode) body.idx-home .inline-dd-item:hover .inline-dd-title,
html:not(.dark-mode) body.idx-home .inline-dd-item.active .inline-dd-title {
  color: var(--home-accent-strong);
}

html:not(.dark-mode) body.idx-home .search-highlight {
  background: var(--home-accent-soft);
  color: var(--home-accent-strong);
}

/* Utility control remains legible in both modes. */


/* #ifp-update-toast is now styled site-wide by pwa-register.js's injected default
   (the refined frosted pill, theme-split by html.dark-mode). The homepage-only
   overrides were removed so home inherits that universal default unchanged. */
@media (prefers-reduced-motion: reduce) {
  body.idx-home :is(#themeToggleBtn, #searchToggleBtn),
  body.idx-home :is(#themeToggleBtn, #searchToggleBtn)::before {
    transition-duration: 0ms;
  }
}

/* Cinematic Al-Andalus hero · responsive still-image layer · documentary grade. */
body.idx-home {
  --hero-haze-cool: oklch(58% 0.055 240 / 0.12);
}

.hero.hero-2d .baghdad-scene {
  overflow: hidden;
  pointer-events: none;
  background: var(--home-canvas);
}

.hero.hero-2d .baghdad-fallback,
.hero.hero-2d .baghdad-fallback img,
.hero.hero-2d .cinematic-hero-haze {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero.hero-2d .baghdad-fallback {
  display: block;
  background-image: none;
  filter: none;
  transform: none;
}

.hero.hero-2d .baghdad-fallback img {
  display: block;
  object-fit: cover;
  object-position: 50% 50%;
  filter: saturate(0.94) contrast(1.03);
}

.hero.hero-2d .cinematic-hero-haze {
  background:
    radial-gradient(ellipse at 23% 24%, var(--hero-haze-cool), transparent 38%),
    radial-gradient(ellipse at 78% 48%, color-mix(in oklch, var(--hero-haze-cool) 64%, transparent), transparent 35%);
  mix-blend-mode: screen;
  opacity: 0.44;
  pointer-events: none;
}

@media (min-width: 900px) {
  .hero.hero-2d .baghdad-fallback img {
    object-position: 50% 44%;
  }
}

/* =========================================================
   INDEX LIGHT THEME · PHASE 1
   Palette A: pure white / black / brand red. This layer is
   intentionally scoped to the Index sentinel so the shared
   dark-mode policy and every subpage remain untouched.
   ========================================================= */
html.index-light-theme {
  color-scheme: light;
  background: #ffffff;
}

html.index-light-theme body.idx-home {
  --home-canvas: #ffffff;
  --home-surface: #f7f7f8;
  --home-canvas-alt: #eeeef0;
  --home-heading: #1a1a1a;
  --home-ink: #1a1a1a;
  --home-copy: #2a2a2e;
  --home-muted: rgba(26, 26, 26, 0.62);
  --home-faint: rgba(26, 26, 26, 0.45);
  --home-rule: rgba(0, 0, 0, 0.08);
  --home-rule-strong: rgba(0, 0, 0, 0.14);
  --home-accent: #d81b37;
  --home-accent-strong: #9e1b2f;
  --home-accent-soft: rgba(216,27,55, 0.1);
  --home-state: #d81b37;
  --home-focus: #9e1b2f;
  --home-shadow: rgba(0, 0, 0, 0.1);
  --home-overlay: rgba(26, 26, 26, 0.24);
  --home-glass-bg: rgba(255, 255, 255, 0.62);
  --home-glass-solid: #ffffff;
  --home-glass-border: rgba(0, 0, 0, 0.1);
  --home-glass-shadow: 0 18px 44px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  --home-skeleton-base: rgba(0, 0, 0, 0.05);
  --home-skeleton-sheen: rgba(0, 0, 0, 0.1);

  --bg-primary: var(--home-canvas);
  --bg-secondary: var(--home-surface);
  --bg-tertiary: var(--home-canvas-alt);
  --text-primary: var(--home-copy);
  --text-secondary: var(--home-muted);
  --text-tertiary: var(--home-faint);
  --border-primary: var(--home-rule);
  --border-secondary: var(--home-rule-strong);
  --ink: var(--home-canvas);
  --ink-2: var(--home-surface);
  --ink-3: var(--home-canvas-alt);
  --paper: var(--home-heading);
  --paper-2: var(--home-copy);
  --bone: var(--home-muted);
  --text: var(--home-copy);
  --text-dim: var(--home-muted);
  --text-mute: var(--home-muted);
  --gold: var(--home-accent);
  --gold-bright: var(--home-accent-strong);
  --rule: var(--home-rule);
  --rule-strong: var(--home-rule-strong);
  --header-bg: var(--home-glass-bg);
  --header-text: var(--home-heading);
  --header-text-dim: var(--home-muted);
  --header-border: var(--home-glass-border);
  --header-icon-border: var(--home-rule-strong);

  background: var(--home-canvas);
  color: var(--home-copy);
  color-scheme: light;
}

html.index-light-theme body.idx-home ::selection {
  background: var(--home-accent);
  color: #ffffff;
}

/* White page flow: every non-photographic surface follows the three light layers. */
html.index-light-theme body.idx-home :is(
  .section,
  #categories,
  .section-support
) {
  background: var(--home-canvas) !important;
  color: var(--home-copy);
}

html.index-light-theme body.idx-home :is(
  #archive,
  .cat-panel-knowledge,
  .heritage-membership
) {
  background: var(--home-canvas-alt) !important;
  color: var(--home-copy);
}

html.index-light-theme body.idx-home :is(
  .cat-panel-works,
  .parchment
) {
  background: var(--home-surface) !important;
  color: var(--home-copy);
}

html.index-light-theme body.idx-home :is(
  .hikmah-section,
  .section-support,
  .parchment,
  .cat-panel-works,
  .cat-panel-knowledge
) {
  border-color: var(--home-rule);
}

html.index-light-theme body.idx-home :is(
  .section-title,
  .works-showcase-title,
  .knowledge-preview-title,
  .heritage-membership-head h2,
  .quote-ar,
  .works-book-title
) {
  color: var(--home-heading);
}

html.index-light-theme body.idx-home :is(
  .section-lede,
  .works-showcase-copy,
  .knowledge-preview-copy,
  .support-compact-text,
  .quote-th,
  .heritage-membership-note,
  .portrait-wall-hint,
  .qr-note
) {
  color: var(--home-muted);
}

html.index-light-theme body.idx-home :is(
  .section-title em,
  .works-showcase-title em,
  .knowledge-preview-title em,
  .hikmah-section .section-eyebrow,
  .hikmah-section .section-eyebrow::before,
  .cat-panel-num,
  .portrait-wall-region,
  .quote-author-line,
  .knowledge-preview-cta
) {
  color: var(--home-accent);
}

html.index-light-theme body.idx-home .hikmah-section .section-eyebrow::before {
  background: var(--home-accent);
}

html.index-light-theme body.idx-home .hikmah-house-name {
  color: var(--home-muted);
}

/* Hero: retain the original Al-Andalus colour image beneath the light editorial wash. */
html.index-light-theme body.idx-home .hero.hero-2d,
html.index-light-theme body.idx-home .hero.hero-2d .baghdad-scene {
  background: var(--home-canvas) !important;
}

html.index-light-theme body.idx-home .hero.hero-2d .baghdad-fallback img {
  opacity: 1;
  filter: saturate(0.94) contrast(1.03);
}

html.index-light-theme body.idx-home .hero.hero-2d .hero-scene-shade {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66) 0%, rgba(255, 255, 255, 0.6) 48%, rgba(255, 255, 255, 0.86) 100%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06) 52%, rgba(255, 255, 255, 0.24));
}

html.index-light-theme body.idx-home .hero.hero-2d .cinematic-hero-haze {
  background: radial-gradient(ellipse at 50% 36%, rgba(255, 255, 255, 0.42), transparent 56%);
  mix-blend-mode: normal;
  opacity: 0.28;
}

html.index-light-theme body.idx-home .hero.hero-2d .hero-body {
  filter: none;
}

html.index-light-theme body.idx-home .hero.hero-2d :is(
  .hero-arabic,
  .hero-display
) {
  color: var(--home-heading);
  text-shadow: 0 1px 0 #ffffff, 0 0 28px rgba(255, 255, 255, 0.92);
}

html.index-light-theme body.idx-home .hero.hero-2d :is(
  .hero-arabic-ref,
  .hero-sub
) {
  color: var(--home-copy);
  text-shadow: 0 1px 0 #ffffff, 0 0 20px rgba(255, 255, 255, 0.94);
}

html.index-light-theme body.idx-home .hero.hero-2d .hero-sub cite {
  color: var(--home-muted);
}

html.index-light-theme body.idx-home .hero.hero-2d .hero-display em {
  color: var(--home-accent);
  background: none;
  -webkit-text-fill-color: currentColor;
  animation: none;
}

/* Header, navigation drawer, mega menu, and search use light liquid glass. */
html.index-light-theme body.idx-home {
  --mobile-nav-surface: rgba(255, 255, 255, 0.96);
  --mobile-nav-surface-raised: rgba(0, 0, 0, 0.045);
  --mobile-nav-glass: var(--home-glass-bg);
  --mobile-nav-glass-solid: var(--home-glass-solid);
  --mobile-nav-glass-border: var(--home-glass-border);
  --mobile-nav-text: var(--home-heading);
  --mobile-nav-text-muted: var(--home-muted);
  --mobile-nav-line: var(--home-rule-strong);
  --mobile-nav-accent: var(--home-accent);
  --mobile-nav-focus: var(--home-accent-strong);
}

html.index-light-theme body.idx-home .chrome {
  color: var(--home-muted);
  background: rgba(255, 255, 255, 0.96) !important;
  border-bottom-color: var(--home-glass-border) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

html.index-light-theme body.idx-home .chrome :is(
  .chrome-mark,
  .chrome-wordmark,
  .chrome-time,
  nav.chrome-nav .nav-item,
  .chrome-icon-btn
) {
  color: var(--home-heading);
}

html.index-light-theme body.idx-home .chrome-beta {
  color: var(--home-muted);
  border-color: var(--home-rule-strong);
}

html.index-light-theme body.idx-home :is(
  #themeToggleBtn,
  #searchToggleBtn
) {
  color: var(--home-heading);
}

html.index-light-theme body.idx-home :is(
  #themeToggleBtn,
  #searchToggleBtn
)::before {
  border-color: var(--home-glass-border);
  background: var(--home-glass-bg);
  box-shadow: var(--home-glass-shadow);
}

html.index-light-theme body.idx-home :is(
  .nav-mega-viewport,
  .search-modal-card,
  .inline-search-dropdown
) {
  border-color: var(--home-glass-border);
  background: var(--home-glass-bg);
  color: var(--home-copy);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: var(--home-glass-shadow);
}

/* The mega menu sits over editorial imagery and Arabic display type.  Keep that
   context out of the reading layer: this surface is intentionally more opaque
   than the home-page cards while retaining a restrained frosted edge. */
html.index-light-theme body.idx-home .nav-mega-viewport {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(0, 0, 0, 0.14);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
  backdrop-filter: blur(18px) saturate(1.08);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

html.index-light-theme body.idx-home .nav-mega-highlight,
html.index-light-theme body.idx-home .nav-mega-link-highlight {
  background: rgba(0, 0, 0, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

html.index-light-theme body.idx-home :is(
  .nav-mega-kicker,
  .search-result-cat,
  .inline-dd-cat
) {
  color: var(--home-accent);
}

html.index-light-theme body.idx-home :is(
  .nav-mega-intro strong,
  .nav-mega-link,
  .search-modal-title,
  .search-input,
  .search-empty-state strong,
  .search-result-title,
  .inline-dd-title
) {
  color: var(--home-heading);
}

html.index-light-theme body.idx-home :is(
  .nav-mega-intro p,
  .nav-mega-link-desc,
  .search-input-icon,
  .search-empty-state p,
  .search-empty-state .keyboard-tip,
  .search-result-excerpt,
  .search-hint,
  .inline-dd-footer,
  .inline-dd-empty
) {
  color: var(--home-muted);
}

html.index-light-theme body.idx-home :is(
  .nav-mega-intro p,
  .nav-mega-link-desc
) {
  color: #4d4a44;
}

html.index-light-theme body.idx-home .search-input::placeholder,
html.index-light-theme body.idx-home #inlineSearchInput::placeholder {
  color: var(--home-muted);
}

html.index-light-theme body.idx-home .search-overlay {
  background: rgba(26, 26, 26, 0.24);
}

html.index-light-theme body.idx-home .mobile-nav-shell {
  --mobile-nav-surface: rgba(255, 255, 255, 0.96);
  --mobile-nav-surface-raised: rgba(0, 0, 0, 0.045);
  --mobile-nav-glass: var(--home-glass-bg);
  --mobile-nav-glass-solid: var(--home-glass-solid);
  --mobile-nav-glass-border: var(--home-glass-border);
  --mobile-nav-text: var(--home-heading);
  --mobile-nav-text-muted: var(--home-muted);
  --mobile-nav-line: var(--home-rule-strong);
  --mobile-nav-accent: var(--home-accent);
  --mobile-nav-focus: var(--home-accent-strong);
}

html.index-light-theme body.idx-home .mobile-nav-backdrop {
  background: rgba(26, 26, 26, 0.24);
}

html.index-light-theme body.idx-home .mobile-nav-drawer {
  background: var(--home-glass-bg);
  border-left-color: var(--home-glass-border);
  box-shadow: var(--home-glass-shadow);
}

/* Article feed and membership cards keep glass visible over the light layers. */
html.index-light-theme body.idx-home .idx-row {
  border-color: var(--home-glass-border);
  background: var(--home-glass-bg);
  color: var(--home-copy);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: var(--home-glass-shadow);
}

html.index-light-theme body.idx-home .idx-row:last-child {
  border-bottom-color: var(--home-glass-border);
}

html.index-light-theme body.idx-home .idx-row:hover {
  border-color: var(--home-accent);
  background: rgba(255, 255, 255, 0.86);
}

html.index-light-theme body.idx-home .idx-row::before {
  background: var(--home-accent);
}

html.index-light-theme body.idx-home :is(
  .idx-num,
  .idx-cat,
  .idx-meta,
  .idx-arrow
) {
  color: var(--home-muted);
}

html.index-light-theme body.idx-home .idx-title {
  color: var(--home-heading);
}

html.index-light-theme body.idx-home .idx-row:hover :is(
  .idx-title,
  .idx-arrow
) {
  color: var(--home-accent-strong);
}

html.index-light-theme body.idx-home :is(
  .archive-footer .btn,
  .tea-btn,
  .lastread-chip
) {
  border-color: var(--home-rule-strong);
  background: var(--home-surface);
  color: var(--home-copy);
  box-shadow: 0 1px 2px var(--home-shadow);
}

html.index-light-theme body.idx-home :is(
  .archive-footer .btn,
  .tea-btn,
  .lastread-chip
):hover {
  border-color: var(--home-accent);
  background: var(--home-accent-soft);
  color: var(--home-accent-strong);
}

html.index-light-theme body.idx-home .heritage-membership {
  background: var(--home-canvas-alt) !important;
}

html.index-light-theme body.idx-home :is(
  .heritage-membership-head,
  .heritage-membership-head h2
) {
  background: transparent !important;
}

html.index-light-theme body.idx-home .heritage-membership-head h2 span {
  color: var(--home-accent);
  background: none;
  -webkit-text-fill-color: currentColor;
  animation: none;
}

html.index-light-theme body.idx-home .heritage-membership-card {
  border-color: var(--home-glass-border);
  background: var(--home-glass-bg);
  color: var(--home-copy);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: var(--home-glass-shadow);
}

html.index-light-theme body.idx-home .heritage-membership-card:is(:hover, .featured) {
  border-color: var(--home-accent);
}

html.index-light-theme body.idx-home .heritage-membership-tier {
  color: var(--home-heading);
}

html.index-light-theme body.idx-home .heritage-membership-btn {
  background: var(--home-heading);
  color: #ffffff;
}

/* Photographic cards retain their original colour; UI accents stay red, never gold. */
html.index-light-theme body.idx-home .wisdom-card {
  border-color: rgba(0, 0, 0, 0.16);
  background-color: var(--home-copy);
  background-blend-mode: normal;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html.index-light-theme body.idx-home .wisdom-card :is(h3, .wisdom-index) {
  color: #ffffff;
}

html.index-light-theme body.idx-home .wisdom-card p {
  color: rgba(255, 255, 255, 0.78);
}

html.index-light-theme body.idx-home .wisdom-status {
  border-color: rgba(216,27,55, 0.72);
  color: #ffffff;
  background: rgba(158,27,47, 0.76);
}

html.index-light-theme body.idx-home .wisdom-status-external {
  border-color: rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.86);
  background: rgba(26, 26, 26, 0.62);
}

html.index-light-theme body.idx-home .wisdom-link {
  color: #ffffff;
  text-decoration-color: var(--home-accent);
}

html.index-light-theme body.idx-home .cat-panel {
  border-color: var(--home-rule-strong);
  background: var(--home-copy);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.12);
}

html.index-light-theme body.idx-home :is(
  .cat-panel-bg,
  .cat-panel-video
) {
  filter: brightness(0.74) saturate(0.9);
}

html.index-light-theme body.idx-home .cat-panel:hover :is(
  .cat-panel-bg,
  .cat-panel-video
) {
  filter: brightness(0.84) saturate(1);
}

html.index-light-theme body.idx-home .cat-panel-overlay {
  background: linear-gradient(180deg, rgba(26, 26, 26, 0.08) 18%, rgba(26, 26, 26, 0.26) 52%, rgba(26, 26, 26, 0.86) 100%);
}

html.index-light-theme body.idx-home .cat-panel-body {
  text-shadow: 0 4px 22px rgba(0, 0, 0, 0.82);
}

html.index-light-theme body.idx-home :is(
  .cat-panel-title,
  .cat-panel-sub,
  .cat-panel-cta
) {
  color: #ffffff;
}

html.index-light-theme body.idx-home .cat-panel-title em {
  color: var(--home-accent);
}

html.index-light-theme body.idx-home .works-book {
  border-color: var(--home-rule);
  background: var(--home-canvas);
  box-shadow: 0 1px 2px var(--home-shadow);
}

html.index-light-theme body.idx-home .works-book-cover {
  background: var(--home-canvas-alt);
}

html.index-light-theme body.idx-home .works-book:is(:hover, :focus-visible) {
  border-color: var(--home-accent);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.1);
}

html.index-light-theme body.idx-home .portrait-wall-card {
  border-color: rgba(0, 0, 0, 0.14);
  background: var(--home-copy);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.14);
}

html.index-light-theme body.idx-home .portrait-wall-card img {
  filter: saturate(0.78) brightness(0.82);
}

html.index-light-theme body.idx-home .portrait-wall-card:is(:hover, :focus-visible) img {
  filter: saturate(0.92) brightness(0.96);
}

html.index-light-theme body.idx-home .portrait-wall-card h4 {
  color: #ffffff;
}

html.index-light-theme body.idx-home .portrait-wall-card::after {
  background: linear-gradient(180deg, transparent 34%, rgba(26, 26, 26, 0.2) 55%, rgba(26, 26, 26, 0.94));
}

/* Quote, support, utility controls, and footer complete the light flow. */
html.index-light-theme body.idx-home .quote-eyebrow {
  color: var(--home-muted);
  text-shadow: none;
}

html.index-light-theme body.idx-home .quote-eyebrow::before,
html.index-light-theme body.idx-home .quote-eyebrow::after {
  background: var(--home-rule-strong);
}

html.index-light-theme body.idx-home .quote-dot {
  border-color: var(--home-rule-strong);
  background: transparent;
  color: var(--home-muted);
}

html.index-light-theme body.idx-home .quote-dot.active {
  border-color: var(--home-accent);
  background: var(--home-accent);
  color: #ffffff;
}

html.index-light-theme body.idx-home .qr-inner {
  border-color: var(--home-rule);
  background: var(--home-canvas);
  color: var(--home-copy);
}

html.index-light-theme body.idx-home .pixel-book__spine {
  background: var(--home-accent);
  box-shadow: 0 3px 0 var(--home-accent-strong);
}

html.index-light-theme body.idx-home .pixel-book__page {
  background: var(--home-canvas);
}

html.index-light-theme body.idx-home .pixel-book__page--left {
  box-shadow: 3px 3px 0 var(--home-canvas-alt), 6px 6px 0 var(--home-accent);
}

html.index-light-theme body.idx-home .pixel-book__page--right {
  box-shadow: -3px 3px 0 var(--home-canvas-alt), -6px 6px 0 var(--home-accent);
}

html.index-light-theme body.idx-home .pixel-book__lines {
  background: var(--home-copy);
  box-shadow: 0 5px 0 var(--home-copy), 25px 0 0 var(--home-copy), 25px 5px 0 var(--home-copy);
}

html.index-light-theme body.idx-home .pixel-book__spark {
  background: var(--home-accent);
}

html.index-light-theme body.idx-home .naytun-error {
  color: var(--home-accent-strong);
}



html.index-light-theme body.idx-home :is(
  #readingProgress,
  #readingProgressBar
) {
  background: var(--home-accent);
}

/* The shared footer owns its surface. The light homepage does not opt into a
   separate footer variant and therefore must not recolor it locally. */

/* Index-local skeleton: tokens.css is intentionally not imported on home. */
html.index-light-theme body.idx-home .skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: var(--home-skeleton-base);
}

html.index-light-theme body.idx-home .skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent 0, var(--home-skeleton-sheen) 50%, transparent 100%);
  animation: index-light-skeleton-shimmer 1.35s ease-in-out infinite;
}

html.index-light-theme body.idx-home .skeleton-swap > .skeleton-real {
  opacity: 0;
  transition: opacity 0.4s ease;
}

html.index-light-theme body.idx-home .skeleton-swap.skeleton-done > .skeleton-real {
  opacity: 1;
}

html.index-light-theme body.idx-home .skeleton-swap.skeleton-done > .skeleton-block {
  display: none;
}

@keyframes index-light-skeleton-shimmer {
  to { transform: translateX(100%); }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html.index-light-theme body.idx-home :is(
    .chrome,
    .nav-mega-viewport,
    .mobile-nav-drawer,
    .search-modal-card,
    .inline-search-dropdown,
    .idx-row,
    .heritage-membership-card
  ) {
    background: var(--home-glass-solid) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.index-light-theme body.idx-home .skeleton::after {
    animation: none;
  }

  html.index-light-theme body.idx-home .skeleton-swap > .skeleton-real {
    transition: none;
  }
}

/* Mobile navigation polish: soften the directory-like rows into calm cards. */
@media (max-width: 1023px) {
  html.index-light-theme body.idx-home .mobile-nav-drawer {
    border-radius: 26px 0 0 26px;
  }

  html.index-light-theme body.idx-home .mobile-nav-scroll {
    padding-inline-start: max(18px, env(safe-area-inset-left));
    padding-inline-end: max(18px, env(safe-area-inset-right));
  }

  html.index-light-theme body.idx-home #mobileNavShell nav.chrome-nav {
    gap: 8px;
  }

  html.index-light-theme body.idx-home #mobileNavShell .mobile-menu-heading {
    padding: 14px 4px 6px;
  }

  html.index-light-theme body.idx-home #mobileNavShell #navMenu > :is(
    .nav-item:not(.nav-support),
    .nav-mega-group
  ) {
    border: 1px solid var(--home-glass-border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.055), inset 0 1px 0 rgba(255, 255, 255, 0.86);
  }

  html.index-light-theme body.idx-home #mobileNavShell #navMenu > .nav-mega-group {
    overflow: hidden;
  }

  html.index-light-theme body.idx-home #mobileNavShell #navMenu > .nav-item:not(.nav-support),
  html.index-light-theme body.idx-home #mobileNavShell #navMenu > .nav-mega-group > .nav-mega-trigger {
    border-bottom: 0 !important;
    border-radius: 15px !important;
    background: transparent;
  }

  html.index-light-theme body.idx-home #mobileNavShell #navMenu > .nav-item[aria-current="page"] {
    border-color: rgba(216,27,55, 0.24);
    background: rgba(216,27,55, 0.075);
  }

  html.index-light-theme body.idx-home #mobileNavShell #navMenu > .nav-mega-group.is-open {
    border-color: rgba(216,27,55, 0.2);
  }

  html.index-light-theme body.idx-home #mobileNavShell #navMenu > .nav-mega-group.is-open > .nav-mega-trigger {
    border-bottom: 1px solid var(--home-glass-border) !important;
    border-radius: 15px 15px 0 0 !important;
    background: rgba(216,27,55, 0.055);
  }

  html.index-light-theme body.idx-home #mobileNavShell .nav-mega-mobile-slot {
    background: rgba(0, 0, 0, 0.022);
  }

  html.index-light-theme body.idx-home #mobileNavShell .nav-mega-panel-inner {
    padding: 5px 8px 10px;
  }

  html.index-light-theme body.idx-home #mobileNavShell .nav-mega-link {
    border-bottom-color: var(--home-rule) !important;
    border-radius: 10px;
  }

  html.index-light-theme body.idx-home #mobileNavShell nav.chrome-nav .nav-item[aria-current="page"]::before,
  html.index-light-theme body.idx-home #mobileNavShell nav.chrome-nav .nav-mega-trigger.active::before {
    left: 7px;
    top: 14px;
    bottom: 14px;
    width: 3px;
    border-radius: 999px;
  }

  html.index-light-theme body.idx-home #mobileNavShell nav.chrome-nav :is(.nav-item, .nav-mega-link):focus-visible {
    outline: 2px solid var(--home-accent-strong);
    outline-offset: -3px;
  }

  html.index-light-theme body.idx-home .mobile-nav-footer .nav-support {
    border-radius: 16px;
  }
}

@media (max-width: 260px) {
  html.index-light-theme body.idx-home .mobile-nav-drawer {
    border-radius: 18px 0 0 18px;
  }

  html.index-light-theme body.idx-home .mobile-nav-scroll {
    padding-inline-start: max(10px, env(safe-area-inset-left));
    padding-inline-end: max(10px, env(safe-area-inset-right));
  }
}


/* =========================================================
   PR #872 · PR #354 HERO CONTEXT + MAXIMS
   Pure-white / black / red adaptation; no cream or gold.
   ========================================================= */
html.index-light-theme body.idx-home .hero.hero-2d {
  background: #1a1a1a;
}
html.index-light-theme body.idx-home .hero.hero-2d .baghdad-fallback img {
  object-position: 50% 48%;
  filter: grayscale(.16) saturate(.72) contrast(1.08);
}
html.index-light-theme body.idx-home .hero.hero-2d .cinematic-hero-haze {
  display: none;
}
html.index-light-theme body.idx-home .hero.hero-2d .hero-scene-shade {
  background:
    linear-gradient(180deg, rgba(0,0,0,.42) 0%, rgba(0,0,0,.28) 45%, rgba(0,0,0,.72) 100%),
    linear-gradient(90deg, rgba(0,0,0,.30), rgba(0,0,0,.08) 50%, rgba(0,0,0,.30));
}
html.index-light-theme body.idx-home .hero.hero-2d .hero-arabic,
html.index-light-theme body.idx-home .hero.hero-2d .hero-display {
  color: #ffffff;
  text-shadow: 0 2px 24px rgba(0,0,0,.72);
}
html.index-light-theme body.idx-home .hero.hero-2d .hero-arabic-ref,
html.index-light-theme body.idx-home .hero.hero-2d .hero-sub,
html.index-light-theme body.idx-home .hero.hero-2d .hero-sub cite {
  color: rgba(255,255,255,.82);
  text-shadow: 0 2px 14px rgba(0,0,0,.78);
}
/* Hero "shining example" - same light-sweep family as the membership
   word: a REPEATING gradient translated by whole periods, so the loop is
   seamless with no hard reset and no flash at the wrap point. The old
   non-repeating gradient jumped on restart, which read as a one-time
   pass. Only paint properties are set here - no metrics, no nowrap - so
   typography and the hero's line breaks are untouched.
   Runs slower than the membership word so the two are related but not
   locked in step. */
html.index-light-theme body.idx-home .hero.hero-2d .hero-display em {
  color: #a02a1e;
  background-image: repeating-linear-gradient(110deg,#7d1712 0%,#c0392b 18%,#ff6b5e 23%,#ffffff 25%,#ff6b5e 27%,#c0392b 32%,#7d1712 50%);
  background-size: 200% 100%;
  background-position: 100% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: membership-shine-loop 12s linear infinite;
}
html.index-light-theme body.idx-home .heritage-membership-head .heritage-shimmer {
  display: block;
}
/* Shared block layout for both heading lines. Block (not inline) matters:
   background-clip:text then paints ONE background box over the whole
   element, so a heading that wraps to two lines still reads as a single
   continuous gradient surface instead of restarting per line. */
html.index-light-theme body.idx-home .heritage-membership-head .heritage-shimmer > span {
  display: block;
  width: fit-content;
  margin-inline: auto;
  padding: .04em .08em .12em;
  color: #a02a1e;
}
/* ── full-heading light-sweep - same system as the hero phrase ──
   Identical repeating red-family gradient and membership-shine-loop
   keyframes; only the tempo differs (15s here vs 12s on the hero), so
   the two belong to one family without running in step. The whole
   heading animates as one surface - no per-word spans. Paint-only, so
   there is no movement, layout shift or reflow, and Thai wrapping is
   untouched. */
html.index-light-theme body.idx-home .heritage-membership-head .heritage-shimmer > .heritage-membership-title {
  /* balance the two lines instead of orphaning the last word, and keep
     Thai on normal break opportunities rather than breaking anywhere */
  text-wrap: balance;
  overflow-wrap: normal;
  background-image: repeating-linear-gradient(110deg,#7d1712 0%,#c0392b 18%,#ff6b5e 23%,#ffffff 25%,#ff6b5e 27%,#c0392b 32%,#7d1712 50%);
  background-size: 200% 100%;
  background-position: 100% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: membership-shine-loop 15s linear infinite;
}
/* Supporting line: quieter than the title, reads as a subtitle. */
html.index-light-theme body.idx-home .heritage-membership-head .heritage-shimmer > .heritage-membership-tagline {
  margin-top: .34em;
  max-width: 22ch;
  font-size: clamp(15px,1.5vw,21px);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -.01em;
  color: var(--home-muted,rgba(26,26,26,.62));
}
@media (min-width: 821px) {
  html.index-light-theme body.idx-home .heritage-membership-head .heritage-shimmer > .heritage-membership-tagline {
    max-width: 46ch;
  }
}
/* reduced motion: no sweep - the heading rests as solid brand red rather
   than a frozen bright gradient slice. Specificity matches the sweep rule
   above so it reliably wins. */
@media (prefers-reduced-motion: reduce) {
  html.index-light-theme body.idx-home .heritage-membership-head .heritage-shimmer > .heritage-membership-title {
    background-image: none;
    color: #a02a1e;
    -webkit-text-fill-color: currentColor;
    animation: none;
  }
}
@keyframes membership-shine-loop {
  from { background-position: 100% 50%; }
  to { background-position: -100% 50%; }
}
/* Thai has no inter-word spaces, so the browser's dictionary can split a
   transliterated term mid-word (e.g. กาลานุกรมฮิจเราะห์ → ฮิ | จเราะห์).
   Keep such terms whole. The term is short relative to the card, so this
   cannot cause overflow. */
.heritage-membership-desc .nb { white-space: nowrap; }

html.index-light-theme body.idx-home .heritage-maxims {
  padding: clamp(44px,7vw,82px) 0;
  overflow: hidden;
  color: #1a1a1a;
  background: #ffffff;
  border-block: 1px solid rgba(0,0,0,.14);
}
html.index-light-theme body.idx-home .heritage-maxims h2 {
  margin: 0 auto clamp(28px,4vw,48px);
  padding-inline: clamp(22px,4vw,64px);
  max-width: 1440px;
  font-family: 'IBM Plex Sans Thai',system-ui,sans-serif;
  font-size: clamp(25px,3.2vw,46px);
  line-height: 1.25;
  letter-spacing: -.025em;
  color: #1a1a1a;
}
html.index-light-theme body.idx-home .heritage-maxims-viewport {
  overflow: hidden;
  /* Vertical breathing room so the overflow-hidden ticker never shears the
     Amiri harakat (top marks) or the lower kasrah - at EVERY width. */
  padding-top: 10px;
  padding-bottom: 4px;
}
html.index-light-theme body.idx-home .heritage-maxims-track {
  display: flex;
  width: max-content;
  white-space: nowrap;
  font-family: var(--arabic);
  font-size: clamp(34px,5vw,72px);
  /* Full leading + a small top nudge so stacked vowel marks clear the line box.
     (Previously only ≥1024px got this room; mobile kept 1.5 and clipped.) */
  line-height: 2.0;
  padding-top: 0.14em;
  color: #2a2a2e;
  animation: heritage-maxims-slide 92s linear infinite;
}
html.index-light-theme body.idx-home .heritage-maxims-track span {
  display: inline-flex;
  align-items: center;
  gap: clamp(48px,6vw,90px);
  padding-inline-end: clamp(48px,6vw,90px);
}
html.index-light-theme body.idx-home .heritage-maxims-track em {
  font-family: 'IBM Plex Sans Thai',system-ui,sans-serif;
  font-style: normal;
  color: #c0392b;
}
/* Desktop ticker: a touch more top room still (the base rule above already gives
   every width enough leading for the Amiri harakat; this only refines desktop). */
@media (min-width: 1024px) {
  html.index-light-theme body.idx-home .heritage-maxims-viewport {
    padding-top: 14px;
  }
  html.index-light-theme body.idx-home .heritage-maxims-track {
    line-height: 2.05;
  }
}
@keyframes heritage-maxims-slide {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (max-width: 560px) {
  html.index-light-theme body.idx-home .hero.hero-2d .baghdad-fallback img {
    object-position: 50% 50%;
  }
  html.index-light-theme body.idx-home .heritage-maxims {
    padding-block: 38px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html.index-light-theme body.idx-home .hero.hero-2d .hero-display em,
  html.index-light-theme body.idx-home .heritage-membership-head .heritage-shimmer > span,
  html.index-light-theme body.idx-home .heritage-maxims-track {
    animation: none;
  }
  /* static refined red - no frozen gradient slice, matching the
     membership word's reduced-motion rest state */
  html.index-light-theme body.idx-home .hero.hero-2d .hero-display em {
    background-image: none;
    color: #a02a1e;
    -webkit-text-fill-color: currentColor;
  }
}

/* Founding single-card membership callout (B2: FIQH+/PRO tier ladder retired) */
.heritage-membership-grid--single{grid-template-columns:minmax(0,540px);justify-content:center}
.heritage-membership-grid--duo{grid-template-columns:repeat(2,minmax(0,340px));justify-content:center;align-items:stretch}
/* Placed after the --duo definition so it wins over the base grid rule on
   mobile (equal specificity → later source wins); stacks the two tiers. */
@media(max-width:720px){.heritage-membership-grid--duo{grid-template-columns:minmax(0,420px)}}
.heritage-membership-desc{font-family:var(--thai,'Sarabun',system-ui,sans-serif);font-size:15px;line-height:1.7;margin:0;max-width:40ch;opacity:.85}
