/*
 * Bayan Library: the landing page.
 * Every colour is a token from src/constants/palette.ts (docs/DESIGN-SYSTEM.md), dark and light,
 * with the same names. Neue Montreal for the interface, KFGQPC Uthmanic Hafs for the Qur'an. No monospace anywhere.
 */

@font-face { font-family: "Neue Montreal"; src: url("../fonts/NeueMontreal-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Neue Montreal"; src: url("../fonts/NeueMontreal-Medium.otf") format("opentype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "UthmanicHafs"; src: url("../fonts/UthmanicHafs.ttf") format("truetype"); font-display: swap; }

/* ---------- tokens: palette.ts, dark (the default) ---------- */
:root,
[data-theme="dark"] {
  --black: #020002;
  --ink: #ffffff;
  --read: rgba(255, 255, 255, 0.88);
  --soft: rgba(255, 255, 255, 0.75);
  --mute: rgba(255, 255, 255, 0.55);
  --dim: rgba(255, 255, 255, 0.42);
  --fill: #141314;
  --field: #1d1c1d;
  --raised: #262526;
  --panel: #161616;
  --panel2: #222222;
  --line: rgba(255, 255, 255, 0.1);
  --glass: rgba(40, 40, 42, 0.55);
  --highlight: rgba(255, 255, 255, 0.18);
  --backdrop: rgba(0, 0, 0, 0.6);
  /* fade(a) = the ground at a; wash(a) = the foreground at a */
  --ground-rgb: 2, 0, 2;
  --ink-rgb: 255, 255, 255;
  color-scheme: dark;
}

[data-theme="light"] {
  --black: #f6f5f1;
  --ink: #141314;
  --read: rgba(20, 19, 20, 0.86);
  --soft: rgba(20, 19, 20, 0.76);
  --mute: rgba(20, 19, 20, 0.62);
  --dim: rgba(20, 19, 20, 0.52);
  --fill: #eceae5;
  --field: #e6e3de;
  --raised: #dcd9d3;
  --panel: #eceae5;
  --panel2: #e3e0da;
  --line: rgba(20, 19, 20, 0.1);
  --glass: rgba(255, 255, 255, 0.62);
  --highlight: rgba(20, 19, 20, 0.12);
  --backdrop: rgba(20, 19, 20, 0.32);
  --ground-rgb: 246, 245, 241;
  --ink-rgb: 20, 19, 20;
  color-scheme: light;
}

:root {
  /* on a photo: white over a scrim, in both themes */
  --on-photo: #ffffff;
  --on-photo-soft: rgba(255, 255, 255, 0.85);
  --on-photo-mute: rgba(255, 255, 255, 0.68);
  --on-photo-inv: #020002;
  --on-photo-fill: rgba(255, 255, 255, 0.18);

  /* spacing: G is the one gutter every text block starts on */
  --g: 24px;
  --s-xs: 4px;
  --s-s: 8px;
  --s-m: 12px;
  --s-l: 16px;
  --s-xl: 20px;
  --s-xxl: 32px;
  --dock-btn-h: 56px;
  --r-card: 28px;
  --r-inner: 20px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --wrap: 1180px;

  --sans: "Neue Montreal", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Arabic: the mushaf face for the Qur'an; the scholars' prose in the reader's own Naskh */
  --quran: "UthmanicHafs", "Geeza Pro", "Noto Naskh Arabic", serif;
  --arabic: "Geeza Pro", "Noto Naskh Arabic", "Amiri", "Traditional Arabic", "Segoe UI", serif;
}

/* ---------- base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--black);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 20px;
  line-height: 25px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img, svg, canvas { display: block; }
::selection { background: var(--highlight); }

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

.wrap { width: 100%; max-width: calc(var(--wrap) + var(--g) * 2); margin: 0 auto; padding: 0 var(--g); }
.tabular { font-variant-numeric: tabular-nums; }
.ar { font-family: var(--arabic); direction: rtl; unicode-bidi: isolate; font-weight: 400; }
.quran { font-family: var(--quran); direction: rtl; unicode-bidi: isolate; font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- type ---------- */
.display {
  margin: 0;
  font-weight: 500;
  font-size: clamp(42px, 5vw, 72px);
  line-height: 1.04;
  letter-spacing: -0.028em;
  text-wrap: balance;
}
.display .quiet { color: var(--mute); }
.hero .display .quiet { display: block; }

.h2 {
  margin: 0;
  font-weight: 500;
  font-size: clamp(36px, 4.6vw, 60px);
  line-height: 1.04;
  letter-spacing: -0.024em;
  text-wrap: balance;
}
.h2 .quiet { color: var(--mute); }
.h3 { margin: 0; font-weight: 500; font-size: 24px; line-height: 29px; letter-spacing: -0.005em; }
.lead { margin: 0; font-weight: 400; font-size: 21px; line-height: 31px; color: var(--soft); text-wrap: pretty; }
.read { margin: 0; font-weight: 400; font-size: 19px; line-height: 29px; color: var(--read); text-wrap: pretty; }
.body { margin: 0; font-weight: 400; font-size: 18px; line-height: 26px; color: var(--soft); text-wrap: pretty; }
.caption { margin: 0; font-weight: 400; font-size: 18px; line-height: 22px; color: var(--mute); }
.small { font-weight: 400; font-size: 15px; line-height: 20px; color: var(--mute); }
.label { font-weight: 500; font-size: 15px; line-height: 20px; color: var(--mute); letter-spacing: 0.01em; }

/* ---------- buttons: solid fills only, never outlined ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--dock-btn-h);
  padding: 0 28px;
  border-radius: calc(var(--dock-btn-h) / 2);
  background: var(--ink);
  color: var(--black);
  font-weight: 500;
  font-size: 19px;
  line-height: 24px;
  white-space: nowrap;
  transition: transform 0.18s var(--ease), background-color 0.3s var(--ease), opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn.gray { background: var(--panel2); color: var(--ink); }
.btn.gray:hover { background: var(--raised); }
.btn:not(.gray):hover { opacity: 0.9; }
.btn.sm { height: 44px; padding: 0 20px; font-size: 17px; }
.btn .arrow { transition: transform 0.25s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

.glass {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  display: inline-grid;
  place-items: center;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  color: var(--ink);
  transition: transform 0.18s var(--ease);
}
.glass:active { transform: scale(0.94); }
.glass svg { width: 20px; height: 20px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 20px;
  background: var(--panel2);
  color: var(--ink);
  font-weight: 500;
  font-size: 17px;
  white-space: nowrap;
}
.chip.on { background: var(--ink); color: var(--black); }
.chip .k { color: var(--mute); font-weight: 400; }
.chip.on .k { color: inherit; opacity: 0.7; }

/* ---------- nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  transition: background-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.nav.scrolled {
  background: rgba(var(--ground-rgb), 0.72);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: 0 1px 0 var(--line);
}
.nav .wrap { display: flex; align-items: center; gap: var(--g); height: 72px; }
/* the Bayan lockup (assets/brand), drawn in ink through a mask so it follows the theme */
.logo {
  display: block;
  height: 24px;
  aspect-ratio: 1538 / 404;
  background: var(--ink);
  -webkit-mask: url("../brand/lockup-horizontal.svg") center / contain no-repeat;
  mask: url("../brand/lockup-horizontal.svg") center / contain no-repeat;
}
.brand { display: inline-flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand .product { color: var(--mute); font-size: 20px; line-height: 24px; padding-left: 12px; border-left: 1px solid var(--line); }
.nav-links { display: flex; gap: 28px; margin-left: auto; }
.nav-links a { color: var(--soft); font-size: 17px; transition: color 0.2s; }
.nav-links a:hover { color: var(--ink); }
.nav-actions { display: flex; align-items: center; gap: 12px; margin-left: 12px; }
.theme-toggle .sun { display: none; }
[data-theme="light"] .theme-toggle .sun { display: block; }
[data-theme="light"] .theme-toggle .moon { display: none; }

@media (max-width: 920px) {
  .nav-links { display: none; }
  .nav-actions { margin-left: auto; }
}
@media (max-width: 480px) {
  .brand .product { display: none; }
}

/* ---------- section scaffolding ---------- */
section { position: relative; }
.section { padding: 136px 0; }
.section + .section { padding-top: 0; }
.section-head { display: grid; gap: 20px; max-width: 780px; margin-bottom: 56px; }
.section-head .eyebrow { margin-bottom: 4px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--mute); font-size: 17px; line-height: 22px; font-weight: 500; }
.eyebrow .mark { width: 14px; height: 14px; color: var(--ink); }
@media (max-width: 720px) {
  .section { padding: 96px 0; }
  .section-head { margin-bottom: 40px; }
}

.card {
  background: var(--fill);
  border-radius: var(--r-card);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ---------- reveal: gentle, and still for reduced motion ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- hero ---------- */
.hero { padding: 152px 0 0; overflow: hidden; }
.hero-photo {
  position: absolute;
  inset: 0 0 auto 0;
  height: 760px;
  pointer-events: none;
  overflow: hidden;
}
.hero-photo .img {
  position: absolute;
  inset: -60px;
  background: url("../photos/gold.jpg") center 30% / cover no-repeat;
  opacity: 0.55;
  filter: saturate(1.1);
}
[data-theme="light"] .hero-photo .img { opacity: 0.42; }
.hero-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(var(--ground-rgb), 0.34) 0%, rgba(var(--ground-rgb), 0.76) 46%, var(--black) 86%);
}
.hero .wrap { position: relative; }
.hero-copy { display: grid; justify-items: center; text-align: center; gap: 28px; max-width: 1180px; margin: 0 auto; }
.hero-copy .lead { max-width: 720px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 18px 0 8px;
  border-radius: 20px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--soft);
  font-size: 16px;
  font-weight: 500;
}
.pill .dot { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 13px; background: var(--ink); color: var(--black); }
.pill .dot svg { width: 13px; height: 13px; }
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.hero-meta { display: flex; gap: 10px 22px; flex-wrap: wrap; justify-content: center; color: var(--mute); font-size: 16px; font-weight: 400; }
.hero-meta span { display: inline-flex; align-items: center; gap: 22px; }
.hero-meta span + span::before { content: ""; width: 4px; height: 4px; border-radius: 2px; background: var(--dim); margin-left: -12px; margin-right: -10px; }
@media (max-width: 560px) {
  .hero-meta { flex-direction: column; align-items: center; gap: 6px; }
  .hero-meta span + span::before { display: none; }
}

/* the four building blocks */
.blocks { margin-top: 72px; }
.tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.tab {
  position: relative;
  height: 48px;
  padding: 0 22px;
  border-radius: 24px;
  background: var(--panel2);
  color: var(--soft);
  font-size: 18px;
  font-weight: 500;
  overflow: hidden;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--black); }
.tab .meter {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  transform-origin: left;
  transform: scaleX(0);
  background: rgba(var(--ground-rgb), 0.38);
}
.tab[aria-selected="true"] .meter.run { animation: meter var(--dwell, 9s) linear forwards; }
@keyframes meter { to { transform: scaleX(1); } }

.stage {
  position: relative;
  padding: 28px;
  min-height: 600px;
  overflow: hidden;
}
.stage::before {
  /* a faint warm light from the top edge, like the hero photo, so the card sits in the same room */
  content: "";
  position: absolute;
  inset: -40% -10% auto;
  height: 70%;
  background: radial-gradient(60% 60% at 50% 0%, rgba(var(--ink-rgb), 0.05), transparent 70%);
  pointer-events: none;
}
.panel { display: none; position: relative; }
.panel.on { display: block; animation: panelIn 0.6s var(--ease); }
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .panel.on { animation: none; } }
.panel-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.panel-foot .h3 { font-size: 22px; line-height: 28px; }
.panel-foot .small { max-width: 520px; }
@media (max-width: 720px) {
  .stage { padding: 16px; min-height: 0; }
  .blocks { margin-top: 56px; }
  .tab { height: 44px; padding: 0 16px; font-size: 16px; }
}

/* agentic search */
.agentic { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; }
@media (max-width: 920px) { .agentic { grid-template-columns: 1fr; } }
.trace { display: grid; align-content: start; gap: 16px; }
.ask {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 14px 14px 14px 22px;
  border-radius: 30px;
  background: var(--field);
  color: var(--ink);
  font-size: 18px;
  line-height: 24px;
  font-weight: 500;
}
.ask .ask-text { flex: 1; min-width: 0; }
.ask .ask-text:empty::before { content: attr(data-placeholder); color: var(--mute); }
.ask .send { flex-shrink: 0; width: 36px; height: 36px; border-radius: 18px; background: var(--ink); color: var(--black); display: grid; place-items: center; }
.ask .send svg { width: 16px; height: 16px; }
.caret { display: inline-block; width: 2px; height: 20px; margin-left: 2px; vertical-align: -4px; background: var(--ink); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.thinking { display: flex; align-items: center; gap: 14px; height: 56px; color: var(--soft); font-size: 18px; transition: opacity 0.4s var(--ease); }
.thinking canvas { width: 56px; height: 56px; flex-shrink: 0; }
.thinking.done { color: var(--mute); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.step {
  padding: 16px 18px;
  border-radius: var(--r-inner);
  background: var(--panel2);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.step.in { opacity: 1; transform: none; }
.step .label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.step .label span:last-child { white-space: nowrap; }
.step p { margin: 0; font-size: 17px; line-height: 23px; font-weight: 500; }
.step p b { font-weight: 500; color: var(--ink); }
.step p span { color: var(--mute); font-weight: 400; }
.queries { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.queries li { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 17px; line-height: 22px; opacity: 0; transition: opacity 0.4s var(--ease); }
.queries li.in { opacity: 1; }
.queries .ar { font-size: 19px; }
.qtype {
  flex-shrink: 0;
  height: 26px;
  padding: 0 10px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  background: var(--raised);
  color: var(--soft);
  font-size: 14px;
  font-weight: 500;
}
.queries .own { color: var(--mute); font-weight: 400; }

.results { display: grid; align-content: start; gap: 12px; }
.results-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 4px 0; }

.passage {
  position: relative;
  border-radius: 24px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.passage.in { opacity: 1; transform: none; }
.passage .cover { position: absolute; inset: 0 0 auto 0; height: 4px; background-size: cover; background-position: center; opacity: 0.9; }
.passage header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px 12px; padding: 20px 20px 0; }
.passage header .who { display: grid; gap: 2px; min-width: 0; flex: 1 1 220px; }
.passage header .who .ar { font-size: 20px; line-height: 28px; font-weight: 500; color: var(--ink); text-align: left; direction: rtl; }
.passage header .who .small { font-size: 15px; }
.passage .ayah { flex-shrink: 0; height: 30px; padding: 0 12px; border-radius: 15px; background: var(--panel2); color: var(--soft); font-size: 14px; display: inline-flex; align-items: center; }
.passage .text {
  margin: 14px 20px 0;
  font-family: var(--arabic);
  font-size: 19px;
  line-height: 36px;
  color: var(--read);
  direction: rtl;
  text-align: right;
  max-height: 144px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent);
  mask-image: linear-gradient(180deg, #000 60%, transparent);
}
/* the ayah as the scholar quotes it, in his edition's spelling: set apart in ink, not in the mushaf face */
.passage .text .q { color: var(--ink); font-weight: 500; }
.passage footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 20px 18px; }
.passage footer .cite { font-family: var(--arabic); direction: rtl; font-size: 17px; color: var(--mute); }

.rule-line { margin: 4px 4px 0; font-size: 16px; line-height: 22px; color: var(--mute); font-weight: 400; }
.rule-line b { color: var(--ink); font-weight: 500; }

/* extraction */
.extract { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px; align-items: stretch; }
.extract .arrow-col { display: grid; place-items: center; color: var(--mute); }
.extract .arrow-col svg { width: 28px; height: 28px; }
@media (max-width: 920px) {
  .extract { grid-template-columns: 1fr; }
  .extract .arrow-col svg { transform: rotate(90deg); }
}
.pane { border-radius: var(--r-inner); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); display: flex; flex-direction: column; min-width: 0; }
.pane-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.pane-head .h3 { font-size: 18px; line-height: 22px; }
.code {
  margin: 0;
  padding: 18px;
  overflow: auto;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 24px;
  color: var(--soft);
  white-space: pre;
  font-variant-numeric: tabular-nums;
  tab-size: 2;
  scrollbar-width: none;
}
.code::-webkit-scrollbar { display: none; }
.code.wrapl { white-space: pre-wrap; word-break: break-word; }
.code .p { color: var(--mute); }
.code .k { color: var(--mute); }
.code .s { color: var(--ink); }
.code .n { color: var(--ink); }
.code .c { color: var(--mute); }
.code .f { color: var(--ink); font-weight: 500; }
.code .ar { font-family: var(--arabic); font-size: 16px; }
.code mark { background: var(--highlight); color: var(--ink); border-radius: 6px; padding: 1px 4px; }
.code .del { text-decoration: line-through; text-decoration-color: var(--mute); color: var(--mute); }
.notes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
@media (max-width: 920px) { .notes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .notes { grid-template-columns: 1fr; } }
.note { padding: 16px 18px; border-radius: var(--r-inner); background: var(--panel2); display: grid; gap: 6px; align-content: start; }
.note b { font-weight: 500; font-size: 17px; line-height: 22px; }
.note span { font-weight: 400; font-size: 15px; line-height: 20px; color: var(--mute); }

/* chunking */
.chunking { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px; }
@media (max-width: 920px) { .chunking { grid-template-columns: 1fr; } }
.cuts { padding: 18px; display: grid; gap: 10px; }
.cut { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; padding: 14px 16px; border-radius: 16px; background: var(--panel2); align-items: center; }
.cut .ar { font-size: 18px; line-height: 30px; color: var(--read); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; grid-column: 1 / -1; }
.cut .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cut .bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.cut .bar i { display: block; height: 100%; background: var(--ink); border-radius: 2px; transform-origin: left; transform: scaleX(0); transition: transform 1.1s var(--ease); }
.panel.on .cut .bar i { transform: scaleX(var(--w)); }
.tag { height: 26px; padding: 0 10px; border-radius: 13px; display: inline-flex; align-items: center; background: var(--raised); color: var(--soft); font-size: 14px; font-weight: 500; white-space: nowrap; }
.cuts .seam { display: flex; align-items: center; gap: 10px; color: var(--mute); font-size: 14px; font-weight: 400; padding: 0 6px; }
.cuts .seam::before, .cuts .seam::after { content: ""; flex: 1; border-top: 1px dashed var(--line); }

.coverage { padding: 18px; display: grid; gap: 9px; }
.cov { display: grid; grid-template-columns: minmax(0, 1fr) 62px; gap: 4px 12px; align-items: center; }
.cov .name { font-size: 15px; line-height: 20px; color: var(--soft); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cov .ayahs { font-size: 15px; line-height: 20px; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.cov .bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.cov .bar i { display: block; height: 100%; background: var(--soft); transform-origin: left; transform: scaleX(0); transition: transform 1.2s var(--ease); }
.panel.on .cov .bar i { transform: scaleX(var(--w)); }
.rules { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
@media (max-width: 1080px) { .rules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .rules { grid-template-columns: 1fr; } }

/* retrieval */
.flow { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: stretch; }
@media (max-width: 1080px) { .flow { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .flow { grid-template-columns: 1fr; } }
.node { position: relative; padding: 18px; border-radius: var(--r-inner); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 10px; align-content: start; }
.node .step-n { color: var(--mute); font-size: 14px; font-weight: 500; }
.node .h3 { font-size: 20px; line-height: 25px; }
.node .small { font-size: 15px; }
.node .ar.big { font-size: 24px; line-height: 38px; color: var(--ink); text-align: right; }
.form { display: grid; gap: 4px; padding: 12px 14px; border-radius: 14px; background: var(--panel2); }
.form .ar { font-size: 19px; line-height: 30px; text-align: right; color: var(--ink); }
.lanes { display: grid; gap: 10px; }
.lane { padding: 14px; border-radius: 14px; background: var(--panel2); display: grid; gap: 8px; }
.lane .row { display: flex; gap: 6px; flex-wrap: wrap; }
.pulse { position: relative; height: 2px; border-radius: 1px; background: var(--line); overflow: hidden; }
.pulse::after { content: ""; position: absolute; inset: 0 auto 0 -30%; width: 30%; background: linear-gradient(90deg, transparent, var(--ink), transparent); animation: pulse 2.4s var(--ease) infinite; }
.lane:nth-child(2) .pulse::after { animation-delay: 0.6s; }
@keyframes pulse { to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .pulse::after { animation: none; left: 0; width: 100%; opacity: 0.4; } }
.funnel { display: grid; gap: 6px; }
.funnel i { display: block; height: 8px; border-radius: 4px; background: var(--soft); }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
@media (max-width: 720px) { .stat-row { grid-template-columns: 1fr; } }
.stat-row .note b { font-size: 28px; line-height: 32px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }

/* ---------- the shelf ---------- */
.shelf { padding: 104px 0 0; }
.shelf-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.shelf-head .read { max-width: 560px; }
.marquee {
  position: relative;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee + .marquee { margin-top: 12px; }
.track { display: flex; gap: 12px; width: max-content; animation: scroll var(--dur, 80s) linear infinite; }
.marquee.rev .track { animation-direction: reverse; }
.marquee:hover .track { animation-play-state: paused; }
@keyframes scroll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .track { animation: none; flex-wrap: wrap; width: auto; justify-content: center; }
  .track [aria-hidden="true"] { display: none; }
  .marquee { -webkit-mask-image: none; mask-image: none; }
}
.book {
  display: grid;
  gap: 2px;
  justify-items: end;
  padding: 14px 20px;
  border-radius: var(--r-inner);
  background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line);
  white-space: nowrap;
}
.book .ar { font-size: 20px; line-height: 30px; color: var(--ink); font-weight: 500; }
.book .by { font-family: var(--arabic); direction: rtl; font-size: 15px; line-height: 20px; color: var(--mute); }

/* ---------- numbers ---------- */
.numbers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-top: 104px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.num { padding: 36px var(--g) 32px 0; display: grid; gap: 10px; align-content: start; }
.num + .num { padding-left: var(--g); border-left: 1px solid var(--line); }
.num b { font-weight: 500; font-size: clamp(40px, 4.4vw, 60px); line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.num span { font-weight: 400; font-size: 17px; line-height: 23px; color: var(--mute); max-width: 240px; }
@media (max-width: 920px) {
  .numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .num:nth-child(3) { padding-left: 0; border-left: 0; }
  .num:nth-child(n + 3) { border-top: 1px solid var(--line); }
}
@media (max-width: 480px) {
  .numbers { grid-template-columns: 1fr; }
  .num, .num + .num { padding-left: 0; border-left: 0; }
  .num + .num { border-top: 1px solid var(--line); }
}

/* ---------- confidence (bento) ---------- */
.bento { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
.tile { padding: 28px; display: flex; flex-direction: column; gap: 14px; min-height: 360px; overflow: hidden; position: relative; }
.tile.w3 { grid-column: span 3; }
.tile.w2 { grid-column: span 2; }
.tile .body { max-width: 520px; }
.tile .viz { margin-top: auto; padding-top: 12px; }
@media (max-width: 1080px) {
  .tile.w2 { grid-column: span 3; }
  .tile.w2:last-child { grid-column: span 6; }
}
@media (max-width: 720px) {
  .bento { grid-template-columns: 1fr; }
  .tile.w3, .tile.w2, .tile.w2:last-child { grid-column: auto; }
  .tile { padding: 22px; min-height: 0; }
}
.wrote { display: grid; gap: 10px; }
.wrote .row { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 14px; align-items: center; padding: 14px 16px; border-radius: 16px; background: var(--panel2); }
.wrote .row .label { font-size: 14px; }
.wrote .row .val { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.wrote .row .val .ar { font-size: 17px; line-height: 26px; }
.wrote .row.answer .val { justify-content: stretch; }
.wrote .row.answer .ar { font-size: 18px; line-height: 32px; color: var(--read); text-align: right; display: block; width: 100%; }
.wrote .counter { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 4px 0; }
.wrote .counter b { font-size: 40px; line-height: 1; letter-spacing: -0.03em; font-weight: 500; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .wrote .row { grid-template-columns: 1fr; } .wrote .row .val { justify-content: flex-start; } }

.citation { border-radius: 20px; background: var(--panel2); padding: 18px 20px; display: grid; gap: 14px; }
.citation .big { font-family: var(--arabic); direction: rtl; text-align: right; font-size: 30px; line-height: 44px; font-weight: 500; color: var(--ink); }
.citation dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 18px; }
.citation dt { font-size: 14px; line-height: 24px; color: var(--mute); font-weight: 500; }
.citation dd { margin: 0; text-align: right; font-size: 15px; line-height: 24px; color: var(--soft); font-weight: 400; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.citation dd.ar { font-size: 16px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
/* segmented control: fill, the selected segment solid ink (DESIGN-SYSTEM: Chip / segmented control) */
.segmented { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 22px; background: var(--panel2); }
.segmented span { height: 36px; padding: 0 16px; border-radius: 18px; display: inline-flex; align-items: center; font-size: 16px; color: var(--soft); }
.segmented span.on { background: var(--ink); color: var(--black); }
.filter-code { margin-top: 12px; border-radius: 16px; background: var(--panel2); padding: 12px 16px; font-size: 15px; line-height: 22px; color: var(--soft); font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filter-code b { color: var(--ink); font-weight: 500; }

.scripts { display: grid; gap: 8px; }
.script { display: grid; gap: 2px; padding: 12px 16px; border-radius: 16px; background: var(--panel2); }
.script .quran { font-size: 22px; line-height: 40px; text-align: right; color: var(--ink); }
.script .ar { font-size: 19px; line-height: 30px; text-align: right; color: var(--ink); }
.script .en { font-size: 16px; line-height: 22px; color: var(--ink); font-weight: 400; }
.script .small { font-size: 13px; line-height: 16px; }

.address { display: grid; gap: 10px; }
.address .req { border-radius: 16px; background: var(--panel2); padding: 12px 16px; font-size: 16px; line-height: 22px; font-variant-numeric: tabular-nums; }
.address .req .verb { color: var(--mute); margin-right: 8px; }
.address ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.address li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 6px 2px; border-bottom: 1px solid var(--line); }
.address li:last-child { border-bottom: 0; }
.address li .ar { font-size: 16px; line-height: 24px; color: var(--soft); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.address li b { font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; min-width: 72px; text-align: right; }

/* ---------- developers ---------- */
.disciplines .book { padding: 12px 18px; }
.disciplines .book .ar { font-size: 18px; line-height: 26px; color: var(--mute); font-weight: 400; }
.disciplines .book.now { background: var(--ink); box-shadow: none; }
.disciplines .book.now .ar { color: var(--black); font-weight: 500; }
.disciplines .book.next { background: var(--panel2); }
.disciplines .book.next .ar { color: var(--ink); font-weight: 500; }
.dev-caption { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: baseline; margin: 24px 0 56px; }
.dev-caption .read { max-width: 640px; }

.ide { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); overflow: hidden; }
@media (max-width: 1000px) { .ide { grid-template-columns: 1fr; } }
.ide-tabs { display: flex; gap: 4px; padding: 10px 10px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ide-tabs::-webkit-scrollbar { display: none; }
.ide-tab { height: 40px; padding: 0 16px; border-radius: 14px 14px 0 0; color: var(--mute); font-size: 16px; font-weight: 500; white-space: nowrap; position: relative; }
.ide-tab[aria-selected="true"] { color: var(--ink); background: var(--panel2); }
.ide-left { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); }
@media (max-width: 1000px) { .ide-left { border-right: 0; border-bottom: 1px solid var(--line); } }
.ide-body { position: relative; flex: 1; min-height: 440px; }
.ide-body .code { padding: 22px 24px; font-size: 16px; line-height: 26px; height: 100%; }
.ide-body .code .ar { font-size: 17px; }
.copy { position: absolute; top: 14px; right: 14px; height: 34px; padding: 0 14px; border-radius: 17px; background: var(--panel2); color: var(--soft); font-size: 14px; font-weight: 500; transition: background-color 0.2s; }
.copy:hover { background: var(--raised); color: var(--ink); }
.ide-right { display: flex; flex-direction: column; min-width: 0; background: rgba(var(--ink-rgb), 0.015); }
.resp-head { display: flex; justify-content: space-between; align-items: center; height: 51px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--soft); }
.status i { width: 8px; height: 8px; border-radius: 4px; background: var(--ink); }
.ide-right .code { padding: 20px; font-size: 15px; line-height: 24px; white-space: pre-wrap; word-break: break-word; flex: 1; }
.provenance { padding: 14px 20px; border-top: 1px solid var(--line); }

.integrations { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
@media (max-width: 1000px) { .integrations { grid-template-columns: 1fr; } }
.integ { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.integ .icon { width: 48px; height: 48px; border-radius: 24px; background: var(--panel2); display: grid; place-items: center; color: var(--ink); }
.integ .icon svg { width: 22px; height: 22px; }
.integ .snippet { margin-top: auto; border-radius: 16px; background: var(--panel2); }
.integ .snippet .code { padding: 14px 16px; font-size: 14px; line-height: 22px; }
.toolset { display: flex; flex-wrap: wrap; gap: 6px; }
.models { display: grid; gap: 10px; margin-top: auto; }
.models .grp { display: grid; gap: 8px; }
.models .grp .label { font-size: 13px; }
.models .row { display: flex; flex-wrap: wrap; gap: 6px; }
.models .tag.yours { background: var(--panel2); color: var(--mute); }

/* ---------- principles ---------- */
.principles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1080px) { .principles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .principles { grid-template-columns: 1fr; } }
.principle { padding: 28px; display: flex; flex-direction: column; gap: 16px; min-height: 320px; }
.principle .n { font-size: 15px; color: var(--mute); font-variant-numeric: tabular-nums; }
.principle blockquote { margin: 0; min-height: 96px; font-size: 28px; line-height: 32px; letter-spacing: -0.015em; font-weight: 500; text-wrap: balance; }
.principle .body { font-size: 17px; line-height: 24px; }
.principle .proof { margin-top: auto; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--mute); padding-top: 14px; border-top: 1px solid var(--line); font-weight: 400; }
.principle .proof svg { width: 14px; height: 14px; color: var(--ink); flex-shrink: 0; }

/* ---------- compare ---------- */
.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .compare { grid-template-columns: 1fr; } }
.side { padding: 32px; display: grid; gap: 22px; align-content: start; }
.side.with { background: var(--ink); color: var(--black); box-shadow: none; }
.side.with .caption { color: rgba(var(--ground-rgb), 0.7); }
.side.without { background: transparent; }
.side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.side li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 14px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line); font-size: 18px; line-height: 24px; }
.side.with li { border-top-color: rgba(var(--ground-rgb), 0.14); }
.side li svg { width: 20px; height: 20px; margin-top: 2px; }
.side.without li { color: var(--soft); font-weight: 400; }
.side.without li svg { color: var(--mute); }
.side li .ar { font-size: 18px; }
.side .last { color: var(--ink); font-weight: 500; }

/* ---------- faq ---------- */
.faq-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 56px; }
@media (max-width: 920px) { .faq-grid { grid-template-columns: 1fr; gap: 32px; } }
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 24px 0;
  font-size: 22px;
  line-height: 28px;
  font-weight: 500;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .plus { position: relative; width: 36px; height: 36px; flex-shrink: 0; border-radius: 18px; background: var(--panel2); transition: transform 0.3s var(--ease), background-color 0.3s; }
.faq summary .plus::before, .faq summary .plus::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 2px; margin: -1px 0 0 -7px; border-radius: 1px; background: var(--ink); transition: transform 0.3s var(--ease); }
.faq summary .plus::after { transform: rotate(90deg); }
.faq details[open] summary .plus { background: var(--ink); }
.faq details[open] summary .plus::before, .faq details[open] summary .plus::after { background: var(--black); }
.faq details[open] summary .plus::after { transform: rotate(0deg); }
.faq .answer { padding: 0 64px 28px 0; }
.faq .answer .read + .read { margin-top: 12px; }
@media (max-width: 560px) { .faq .answer { padding-right: 0; } .faq summary { font-size: 20px; line-height: 26px; } }

/* ---------- closing, on a photo ---------- */
.closing { padding: 0 0 136px; }
.on-photo {
  position: relative;
  overflow: hidden;
  border-radius: 36px;
  color: var(--on-photo);
  isolation: isolate;
}
.on-photo .photo { position: absolute; inset: -60px; z-index: -2; background: url("../photos/verse.jpg") center / cover no-repeat; }
/* a scrim of .5 at its lightest: white, soft (85%) and mute (68%) text and the quiet button pass 4.5:1 over this photo's lightest patch (scripts/photo-tones.json) */
.on-photo::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.56) 50%, rgba(0, 0, 0, 0.66)); }
.closing-inner { display: grid; justify-items: center; text-align: center; gap: 28px; padding: 96px var(--g) 88px; }
.epigraph { display: grid; gap: 6px; justify-items: center; }
.epigraph .quran { font-size: clamp(40px, 6vw, 64px); line-height: 1.6; color: var(--on-photo); }
.epigraph .en { font-size: 18px; line-height: 24px; font-weight: 400; color: var(--on-photo-soft); }
.epigraph .ref { font-size: 15px; line-height: 20px; font-weight: 400; color: var(--on-photo-mute); }
.closing .h2 { color: var(--on-photo); max-width: 820px; }
.closing .lead { color: var(--on-photo-soft); max-width: 640px; }
.btn.photo-solid { background: var(--on-photo); color: var(--on-photo-inv); }
.btn.photo-quiet { background: var(--on-photo-fill); color: var(--on-photo); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.btn.photo-quiet:hover { background: rgba(255, 255, 255, 0.26); }

/* ---------- footer ---------- */
.footer { padding: 72px 0 48px; border-top: 1px solid var(--line); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); gap: 32px; }
@media (max-width: 920px) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .footer-grid .about { grid-column: 1 / -1; } }
.footer .about { display: grid; gap: 16px; align-content: start; max-width: 360px; }
.footer h4 { margin: 0 0 14px; font-size: 15px; line-height: 20px; color: var(--mute); font-weight: 500; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer li a, .footer li span { font-size: 17px; line-height: 22px; color: var(--soft); font-weight: 400; }
.footer li a:hover { color: var(--ink); }
.footer li .soon { color: var(--mute); }
.fine { display: flex; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.fine p { margin: 0; max-width: 760px; }
.fine a { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.fine a:hover { text-decoration-color: var(--mute); }
