/* ─────────────────────────────────────────────────────────────────────────
   Quranic — design tokens
   Palette lifted from Ayah Reels: night-sky charcoal, one warm gold.
   Gold is spent only on the single most-desired action in view.
   ───────────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/assets/fonts/Inter-Variable-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Uthmanic Hafs';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/UthmanicHafs.woff2') format('woff2');
}

:root {
  color-scheme: dark;

  --bg: #0d1117;
  --bg-deep: #080b0f;
  --surface: #161b22;
  --raised: #1f2630;
  --stroke: #2a313b;
  --stroke-soft: rgba(42, 49, 59, 0.55);
  --stroke-strong: #3a434f;

  --gold: #d4a947;
  --gold-bright: #eec96b;
  --gold-deep: #a8842f;
  --gold-ink: #14100a;
  --gold-8: rgba(212, 169, 71, 0.08);
  --gold-14: rgba(212, 169, 71, 0.14);
  --gold-24: rgba(212, 169, 71, 0.24);
  --gold-40: rgba(212, 169, 71, 0.4);

  --ink: #f2efe6;
  --ink-2: #9ba3ae;
  --ink-3: #5f6874;
  --ink-4: #3c434d;

  --danger: #e0655a;
  --ok: #6fc28f;

  --font-ui: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-quran: 'Uthmanic Hafs', 'Amiri Quran', 'Scheherazade New', 'Noto Naskh Arabic', serif;
  --font-arabic-ui: 'IBM Plex Sans Arabic', 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  --radius: 2px;
  --nav-h: 64px;
  --gutter: clamp(20px, 4vw, 48px);
  --container: 1280px;
  --narrow: 860px;

  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --dur: 0.32s;
  --dur-slow: 0.9s;

  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --shadow-2: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 30px 80px -24px rgba(0, 0, 0, 0.75);
  --glow-gold: 0 0 0 1px var(--gold-24), 0 0 24px -4px var(--gold-40);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: 'cv11', 'ss01', 'ss03', 'calt';
  overflow-x: clip;
}
h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
input[type='search']::-webkit-search-cancel-button, input[type='search']::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
input[type='number'] { -moz-appearance: textfield; appearance: textfield; }
input[type='number']::-webkit-inner-spin-button, input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
img, svg, canvas, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--gold-40); color: var(--ink); }
:focus-visible { outline: 1.5px solid var(--gold); outline-offset: 3px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--stroke); border: 2px solid var(--bg-deep); }
::-webkit-scrollbar-thumb:hover { background: var(--stroke-strong); }

/* Film grain over everything: the flat charcoal reads as a material, not
   a #hex. Kept far below the threshold where it would look like noise. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Type ───────────────────────────────────────────────────────────────── */
.display {
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.02;
  font-size: clamp(44px, 7.2vw, 96px);
  text-wrap: balance;
}
.h1 { font-weight: 500; letter-spacing: -0.03em; line-height: 1.08; font-size: clamp(34px, 4.6vw, 56px); text-wrap: balance; }
.h2 { font-weight: 500; letter-spacing: -0.025em; line-height: 1.12; font-size: clamp(26px, 3.2vw, 38px); text-wrap: balance; }
.h3 { font-weight: 500; letter-spacing: -0.015em; line-height: 1.25; font-size: clamp(19px, 1.9vw, 23px); }
.lead { font-size: clamp(17px, 1.4vw, 20px); line-height: 1.55; color: var(--ink-2); max-width: 58ch; text-wrap: pretty; }
.body { color: var(--ink-2); max-width: 64ch; text-wrap: pretty; }
.small { font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.mono { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.gold { color: var(--gold); }
.num { font-variant-numeric: tabular-nums; }

/* Small, tracked, gold label with a leading rule — the section marker
   used across the site. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}
.eyebrow::before { content: ''; width: 22px; height: 1px; background: var(--gold); opacity: 0.8; }
.eyebrow.plain::before { display: none; }

/* Quran type. Always RTL, always generous leading: the Uthmani face
   stacks marks above and below the baseline. */
.quran {
  font-family: var(--font-quran);
  direction: rtl;
  unicode-bidi: isolate;
  line-height: 2.05;
  font-weight: 400;
  text-align: right;
  font-feature-settings: normal;
  letter-spacing: 0;
}
.arabic-ui { font-family: var(--font-arabic-ui); direction: rtl; unicode-bidi: isolate; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.narrow { width: min(100% - 2 * var(--gutter), var(--narrow)); margin-inline: auto; }
.section { padding-block: clamp(72px, 10vw, 140px); position: relative; }
.section-tight { padding-block: clamp(48px, 6vw, 88px); }
.hairline { height: 1px; background: var(--stroke); border: 0; margin: 0; }
.hairline-fade {
  height: 1px; border: 0; margin: 0;
  background: linear-gradient(90deg, transparent, var(--stroke-strong) 20%, var(--stroke-strong) 80%, transparent);
}
.stack > * + * { margin-top: var(--stack, 16px); }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ── Motion ─────────────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }
.reveal-x { opacity: 0; transform: translateX(-16px); transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); transition-delay: calc(var(--i, 0) * 70ms); }
.reveal-x.in { opacity: 1; transform: none; }
.reveal-scale { opacity: 0; transform: scale(0.96); transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-spring); transition-delay: calc(var(--i, 0) * 70ms); }
.reveal-scale.in { opacity: 1; transform: none; }

@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ink {
  from { clip-path: inset(0 0 0 100%); }
  to { clip-path: inset(0 0 0 0); }
}

/* Gold sweep across text — used once, when a verse first appears, so the
   Arabic reads as written rather than pasted. */
.gold-sweep {
  background: linear-gradient(100deg, var(--ink) 0%, var(--ink) 40%, var(--gold-bright) 50%, var(--ink) 60%, var(--ink) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 2.6s var(--ease-in-out) 1;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .reveal-x, .reveal-scale { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ── Top navigation ─────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  transition: background var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(13, 17, 23, 0.72);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom-color: var(--stroke-soft);
}
.nav-inner { display: flex; align-items: center; gap: 32px; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 600; letter-spacing: -0.02em; font-size: 16px; }
.brand-mark { width: 26px; height: 26px; color: var(--gold); transition: transform 0.8s var(--ease-spring); }
.brand:hover .brand-mark { transform: rotate(45deg); }
.nav-links { display: flex; align-items: center; gap: 4px; margin-inline-start: 8px; }
.nav-link {
  position: relative;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  transition: color var(--dur) var(--ease-out);
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 12px; right: 12px; bottom: 2px;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--dur) var(--ease-out);
}
.nav-link:hover, .nav-link[aria-current='page'] { color: var(--ink); }
.nav-link:hover::after, .nav-link[aria-current='page']::after { transform: scaleX(1); transform-origin: left; }
.nav-spacer { flex: 1; }
.nav-search {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px 0 12px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 13.5px;
  min-width: 240px;
  background: rgba(22, 27, 34, 0.5);
  transition: border-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.nav-search:hover { border-color: var(--stroke-strong); color: var(--ink); background: var(--surface); }
.nav-search svg { width: 15px; height: 15px; flex: none; }
.nav-search .kbd { margin-inline-start: auto; }
.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--stroke);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  color: var(--ink-3);
  line-height: 1.3;
}
.nav-burger { display: none; width: 40px; height: 40px; align-items: center; justify-content: center; color: var(--ink); }
.nav-burger svg { width: 20px; height: 20px; }
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav.open .nav-links {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    padding: 12px var(--gutter) 20px;
    background: rgba(13, 17, 23, 0.96);
    border-bottom: 1px solid var(--stroke);
    animation: rise 0.3s var(--ease-out);
  }
  .nav.open .nav-link { padding: 12px 4px; font-size: 16px; }
  .nav.open .nav-link::after { display: none; }
  .nav-search { min-width: 0; }
  .nav-search span:not(.kbd) { display: none; }
  .nav-search .kbd { display: none; }
  .nav-burger { display: inline-flex; }
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  transition: border-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out), background var(--dur) var(--ease-out), transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { border-color: var(--gold); color: var(--gold-bright); }
.btn:active { transform: translateY(1px); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn-gold::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease-out);
}
.btn-gold:hover { background: var(--gold-bright); border-color: var(--gold-bright); color: var(--gold-ink); box-shadow: 0 0 0 1px var(--gold-24), 0 12px 32px -8px var(--gold-40); }
.btn-gold:hover::before { transform: translateX(120%); }
.btn-ghost { border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--stroke-strong); color: var(--ink); background: var(--surface); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; gap: 8px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: 52px; padding: 0 28px; font-size: 15px; }
.btn[disabled], .btn[aria-disabled='true'] { opacity: 0.45; pointer-events: none; }
.btn .arrow { transition: transform var(--dur) var(--ease-out); }
.btn:hover .arrow { transform: translateX(3px); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink-2);
  transition: color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { color: var(--gold-bright); border-color: var(--stroke); background: var(--surface); }
.icon-btn.done { color: var(--ok); }

/* ── Text link ──────────────────────────────────────────────────────────── */
.link {
  color: var(--gold);
  background: linear-gradient(var(--gold), var(--gold)) no-repeat 0 100% / 0 1px;
  transition: background-size var(--dur) var(--ease-out);
}
.link:hover { background-size: 100% 1px; }
.link-quiet { color: var(--ink-2); transition: color var(--dur) var(--ease-out); }
.link-quiet:hover { color: var(--ink); }

/* ── Cards & surfaces ───────────────────────────────────────────────────── */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.card:hover { border-color: var(--stroke-strong); }
.card-glow::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, var(--gold) 0%, transparent 45%, transparent 55%, var(--gold-40) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out);
  pointer-events: none;
}
.card-glow:hover::before { opacity: 1; }

/* Hairline grid: cells share borders, like a ledger. The lines are the
   cells' outlines meeting in a 1px gap, so an incomplete last row leaves
   the page showing rather than a slab of stroke colour. */
.cells, .surah-grid, .wbw, .juz-grid, .pipeline, .signals, .checks, .connect, .demo, .job-list, .pager, .verse-nav {
  display: grid; gap: 1px; background: var(--bg); border: 1px solid var(--stroke); border-radius: var(--radius); overflow: hidden;
}
.cells > *, .surah-grid > *, .wbw > *, .juz-grid > *, .pipeline > *, .signals > *, .checks > *, .connect > *, .demo > *, .job-list > *, .pager > *, .verse-nav > * {
  outline: 1px solid var(--stroke);
}
.cell { background: var(--bg); padding: 28px; position: relative; transition: background var(--dur) var(--ease-out); }
.cell:hover { background: var(--surface); }

/* ── Tags & badges ──────────────────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-2);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  white-space: nowrap;
}
.tag-gold { color: var(--gold); border-color: var(--gold-24); background: var(--gold-8); }
.tag-dot::before { content: ''; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }

/* Verse reference in a rub-el-hizb frame. */
.ref {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex: none;
}
.ref svg { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--gold); opacity: 0.55; fill: none; stroke: currentColor; stroke-width: 1; }
.ref span { position: relative; }

/* ── Inputs ─────────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  color: var(--ink);
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.input::placeholder { color: var(--ink-3); }
.input:hover { border-color: var(--stroke-strong); }
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-14); }
.select { appearance: none; padding-inline-end: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ba3ae' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.field { display: grid; gap: 8px; }
.label { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }

/* Range slider: hairline track, gold thumb. */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; }
.range:focus { outline: none; }
.range::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(90deg, var(--gold) var(--fill, 50%), var(--stroke) var(--fill, 50%)); }
.range::-moz-range-track { height: 2px; background: var(--stroke); }
.range::-moz-range-progress { height: 2px; background: var(--gold); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -6px; background: var(--bg); border: 2px solid var(--gold); border-radius: 50%; transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur) var(--ease-out); }
.range::-moz-range-thumb { width: 12px; height: 12px; background: var(--bg); border: 2px solid var(--gold); border-radius: 50%; }
.range:hover::-webkit-slider-thumb, .range:focus-visible::-webkit-slider-thumb { transform: scale(1.25); box-shadow: 0 0 0 5px var(--gold-14); }

/* Segmented control. */
.seg { display: inline-flex; border: 1px solid var(--stroke); border-radius: var(--radius); padding: 2px; gap: 2px; background: var(--bg); }
.seg button {
  height: 30px; padding: 0 12px;
  font-size: 12.5px; font-weight: 600;
  color: var(--ink-2);
  border-radius: 1px;
  transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed='true'] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset; }
.seg button[aria-pressed='true'].gold-on { color: var(--gold-bright); }

.switch { position: relative; width: 38px; height: 22px; border: 1px solid var(--stroke-strong); border-radius: 11px; background: var(--bg); transition: background var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out); flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink-2); transition: transform var(--dur) var(--ease-spring), background var(--dur) var(--ease-out); }
.switch[aria-checked='true'] { background: var(--gold); border-color: var(--gold); }
.switch[aria-checked='true']::after { transform: translateX(16px); background: var(--gold-ink); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 14px; }

/* Color swatches. */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.12); position: relative; transition: transform var(--dur) var(--ease-spring); }
.swatch:hover { transform: scale(1.12); }
.swatch[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--gold); }
.swatch-custom { display: grid; place-items: center; background: conic-gradient(#f2efe6, #d4a947, #6fc28f, #5aa0e0, #c86ee0, #f2efe6); overflow: hidden; }
.swatch-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ── Code ───────────────────────────────────────────────────────────────── */
.code {
  position: relative;
  background: var(--bg-deep);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
  overflow-x: auto;
  white-space: pre;
}
.code .c { color: var(--ink-3); }
.code .g { color: var(--gold); }
.code .copy { position: absolute; top: 8px; right: 8px; }

/* ── Toasts ─────────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: grid; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  background: var(--raised);
  border: 1px solid var(--stroke-strong);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--ink);
  box-shadow: var(--shadow-2);
  animation: rise 0.35s var(--ease-out);
  pointer-events: auto;
}
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.25s; }
.toast svg { width: 15px; height: 15px; color: var(--gold); flex: none; }
.toast.error { border-left-color: var(--danger); }
.toast.error svg { color: var(--danger); }

/* ── Search palette ─────────────────────────────────────────────────────── */
.palette-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(8, 11, 15, 0.7); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: fade 0.2s var(--ease-out); }
.palette {
  position: fixed; z-index: 201;
  left: 50%; top: min(12vh, 120px);
  width: min(100% - 32px, 720px);
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2), 0 0 0 1px rgba(0, 0, 0, 0.4);
  animation: palette-in 0.32s var(--ease-spring);
  overflow: hidden;
}
@keyframes palette-in { from { opacity: 0; transform: translate(-50%, -8px) scale(0.985); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.palette-head { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 58px; border-bottom: 1px solid var(--stroke); }
.palette-head svg { width: 18px; height: 18px; color: var(--gold); flex: none; }
.palette-input { flex: 1; height: 100%; background: none; border: 0; outline: none; font-size: 17px; color: var(--ink); }
.palette-input::placeholder { color: var(--ink-3); }
.palette-list { max-height: min(60vh, 520px); overflow-y: auto; overscroll-behavior: contain; }
.palette-hint { padding: 22px 18px; font-size: 13.5px; color: var(--ink-3); display: grid; gap: 10px; }
.palette-hint .row { flex-wrap: wrap; gap: 8px; }
.palette-foot { display: flex; align-items: center; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--stroke); font-size: 12px; color: var(--ink-3); }
.palette-foot .row { gap: 6px; }
.palette-foot .kbd { font-size: 10px; }

/* ── Search results (shared by palette and /search) ─────────────────────── */
.result {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--stroke-soft);
  transition: background var(--dur) var(--ease-out);
  cursor: pointer;
}
.result:hover, .result[aria-selected='true'] { background: var(--raised); }
.result[aria-selected='true'] { box-shadow: inset 2px 0 0 var(--gold); }
.result .quran { font-size: 22px; line-height: 1.9; color: var(--ink); }
.result-en { font-size: 13.5px; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }
.result-meta { display: flex; gap: 10px; align-items: center; font-size: 11.5px; color: var(--ink-3); margin-top: 6px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
.result mark { background: none; color: var(--gold-bright); font-weight: inherit; }
.result .quran mark { text-shadow: 0 0 18px var(--gold-40); }
.result-surah .quran { font-size: 28px; }

/* ── Verse block ────────────────────────────────────────────────────────── */
.verse {
  position: relative;
  display: grid;
  gap: 18px;
  padding: 28px 0 32px;
  border-bottom: 1px solid var(--stroke-soft);
  scroll-margin-top: calc(var(--nav-h) + 24px);
}
.verse:target { animation: verse-flash 2.4s var(--ease-out); }
@keyframes verse-flash { 0% { background: var(--gold-8); } 100% { background: transparent; } }
.verse-head { display: flex; align-items: center; gap: 14px; }
.verse-meta { display: flex; gap: 14px; font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; color: var(--ink-3); }
.verse-actions { margin-inline-start: auto; display: flex; gap: 2px; opacity: 0.55; transition: opacity var(--dur) var(--ease-out); }
.verse:hover .verse-actions, .verse:focus-within .verse-actions { opacity: 1; }
.verse-ar { font-size: clamp(28px, 3.4vw, 40px); color: var(--ink); text-wrap: pretty; padding-inline-end: 6px; }
.verse-ar .end { font-size: 0.72em; color: var(--gold); margin-inline-start: 0.35em; margin-inline-end: 0.1em; user-select: none; }
.verse-en { font-size: 16.5px; line-height: 1.65; color: var(--ink-2); max-width: 70ch; }
.verse-tr { font-size: 14px; line-height: 1.6; color: var(--ink-3); font-style: italic; max-width: 70ch; }
.verse-hint { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.verse-hint svg { width: 13px; height: 13px; }
.sajdah { color: var(--gold); }

/* Words: each one is a target. Hover draws a hairline under it; a
   selected word turns gold. */
.word {
  position: relative;
  display: inline;
  cursor: pointer;
  padding: 0.08em 0.06em;
  border-radius: 3px;
  transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-out), text-shadow var(--dur) var(--ease-out);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.word:hover { color: var(--gold-bright); background: var(--gold-8); }
.word.on { color: var(--gold-bright); background: var(--gold-14); text-shadow: 0 0 22px var(--gold-40); box-shadow: 0 0 0 1px var(--gold-24); }
.verse.selecting .word:not(.on) { color: var(--ink-2); }

/* Floating selection bar. */
.selbar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 150;
  transform: translate(-50%, 24px);
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 16px;
  background: rgba(31, 38, 48, 0.92);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2), 0 0 0 1px rgba(0, 0, 0, 0.5);
  transition: transform 0.45s var(--ease-spring), opacity 0.3s var(--ease-out);
  max-width: calc(100% - 32px);
}
.selbar.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.selbar-count { font-size: 13px; color: var(--ink-2); margin-inline-end: 8px; white-space: nowrap; }
.selbar-count b { color: var(--gold-bright); font-weight: 600; }
.selbar .sep { width: 1px; height: 22px; background: var(--stroke-strong); margin: 0 4px; }
@media (max-width: 640px) {
  .selbar { flex-wrap: wrap; justify-content: center; padding: 10px; gap: 6px; }
  .selbar .btn { flex: 1; }
  .selbar .sep { display: none; }
}

/* Transparency checkerboard: how designers see “no background”. */
.checker {
  background-color: #1a1f27;
  background-image:
    linear-gradient(45deg, #232a34 25%, transparent 25%),
    linear-gradient(-45deg, #232a34 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #232a34 75%),
    linear-gradient(-45deg, transparent 75%, #232a34 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--stroke); padding: 56px 0 40px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 32px; }
.footer h4 { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 14px; font-weight: 600; }
.footer li + li { margin-top: 8px; }
.footer a { font-size: 14px; color: var(--ink-2); transition: color var(--dur); }
.footer a:hover { color: var(--gold-bright); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--stroke-soft); font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.spinner { width: 16px; height: 16px; border: 1.5px solid var(--stroke-strong); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.8s linear infinite; }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(111, 194, 143, 0.5); animation: live 2s infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(111, 194, 143, 0.5); } 70% { box-shadow: 0 0 0 8px rgba(111, 194, 143, 0); } 100% { box-shadow: 0 0 0 0 rgba(111, 194, 143, 0); } }
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 100%; z-index: 101; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright)); pointer-events: none; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); flex-wrap: wrap; }
.breadcrumbs a { color: var(--ink-2); transition: color var(--dur); }
.breadcrumbs a:hover { color: var(--gold-bright); }
.breadcrumbs svg { width: 12px; height: 12px; opacity: 0.6; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 1000; padding: 10px 14px; background: var(--gold); color: var(--gold-ink); font-weight: 600; transition: top var(--dur); }
.skip:focus { top: 12px; }
.ornament { color: var(--gold); opacity: 0.7; }
.marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.marquee-track { display: flex; gap: 64px; width: max-content; animation: marquee 90s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee[dir='rtl'] .marquee-track { animation-name: marquee-rtl; }
@keyframes marquee-rtl { to { transform: translateX(50%); } }

/* ── Page shell ─────────────────────────────────────────────────────────── */
main { padding-top: var(--nav-h); }
.page-head { padding: clamp(40px, 6vw, 88px) 0 clamp(28px, 4vw, 48px); display: grid; gap: 18px; }
.page-head .lead { margin-top: 4px; }

/* ── Landing hero ───────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: calc(100svh - var(--nav-h));
  display: grid;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero-vignette {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 50% at 50% 42%, rgba(212, 169, 71, 0.07), transparent 70%),
    linear-gradient(180deg, transparent 60%, var(--bg) 100%);
}
.hero-inner { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 48px; align-items: center; padding: 64px 0 96px; }
.hero-copy { display: grid; gap: 28px; }
.hero-copy .display .line { display: block; overflow: hidden; }
.hero-copy .display .line span { display: inline-block; transform: translateY(110%); animation: hero-line 1.1s var(--ease-out) forwards; animation-delay: calc(var(--i) * 110ms + 120ms); }
@keyframes hero-line { to { transform: none; } }
.hero-copy .lead { animation: rise 1s var(--ease-out) 0.55s both; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; animation: rise 1s var(--ease-out) 0.7s both; }
.hero-side { display: grid; gap: 14px; justify-items: end; text-align: right; font-size: 14px; color: var(--ink-2); animation: rise 1s var(--ease-out) 0.9s both; }
.hero-side li { display: flex; align-items: center; gap: 10px; }
.hero-side li::after { content: ''; width: 6px; height: 6px; background: var(--gold); transform: rotate(45deg); opacity: 0.9; }
.hero-stats { display: flex; gap: 40px; padding-top: 8px; animation: rise 1s var(--ease-out) 0.85s both; }
.hero-stats .stat b { display: block; font-size: 28px; font-weight: 500; letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.hero-stats .stat span { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.hero-scroll { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: 8px; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); animation: fade 1.2s 1.6s both; }
.hero-scroll i { display: block; width: 1px; height: 36px; background: linear-gradient(var(--gold), transparent); animation: scroll-hint 2s var(--ease-in-out) infinite; transform-origin: top; }
@keyframes scroll-hint { 0% { transform: scaleY(0); opacity: 0; } 40% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1) translateY(20px); opacity: 0; } }
@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; padding: 48px 0 80px; }
  .hero-side { display: none; }
}

/* Big hero search. */
.hero-search { position: relative; max-width: 620px; animation: rise 1s var(--ease-out) 0.62s both; }
.hero-search .input { height: 58px; padding: 0 130px 0 52px; font-size: 16.5px; background: rgba(22, 27, 34, 0.7); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-color: var(--stroke-strong); }
.hero-search .input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-14), 0 20px 60px -20px var(--gold-40); }
.hero-search svg.lead-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--gold); pointer-events: none; }
.hero-search .btn { position: absolute; right: 7px; top: 7px; height: 44px; }
.hero-search .ghost-text { position: absolute; left: 52px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--ink-3); font-size: 16.5px; white-space: nowrap; overflow: hidden; max-width: calc(100% - 190px); }
.hero-search .ghost-text span { display: inline-block; animation: ghost 5.5s var(--ease-out) infinite; }
@keyframes ghost { 0% { opacity: 0; transform: translateY(8px); } 8%, 82% { opacity: 1; transform: none; } 92%, 100% { opacity: 0; transform: translateY(-8px); } }
.hero-search .input:not(:placeholder-shown) ~ .ghost-text, .hero-search .input:focus ~ .ghost-text { display: none; }
.hero-search .hero-caret { display: none; }
@media (max-width: 600px) {
  .hero-search .input { padding-right: 56px; }
  .hero-search .btn span { display: none; }
  .hero-search .btn { padding: 0 12px; }
}

/* ── Verse ticker ───────────────────────────────────────────────────────── */
.ticker { padding: 24px 0; border-block: 1px solid var(--stroke-soft); background: linear-gradient(180deg, transparent, rgba(22, 27, 34, 0.4), transparent); }
.ticker .quran { font-size: 26px; color: var(--ink-2); white-space: nowrap; line-height: 1.6; }
.ticker .quran em { font-style: normal; color: var(--gold); font-size: 0.7em; margin: 0 0.6em; }

/* ── Demo: verse → transparent PNG ──────────────────────────────────────── */
.demo { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.demo > div { background: var(--bg); padding: 36px; min-height: 380px; display: grid; align-content: center; gap: 24px; }
.demo .verse-ar { font-size: clamp(30px, 3vw, 42px); text-align: center; }
.demo-out { position: relative; }
.demo-out .checker { position: absolute; inset: 0; opacity: 0.55; }
.demo-out canvas, .demo-out img { position: relative; margin: auto; max-width: 100%; height: auto; }
.demo-label { position: absolute; top: 14px; left: 16px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; color: var(--ink-3); display: flex; gap: 8px; align-items: center; z-index: 2; }
.demo-label i { width: 6px; height: 6px; background: var(--gold); border-radius: 50%; }
.demo-cursor { position: absolute; width: 18px; height: 18px; z-index: 5; pointer-events: none; opacity: 0; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6)); transition: transform 0.7s var(--ease-in-out), opacity 0.3s; }
@media (max-width: 860px) { .demo { grid-template-columns: 1fr; } .demo > div { min-height: 300px; padding: 28px; } }

/* ── Feature ledger ─────────────────────────────────────────────────────── */
.features { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.feature { display: grid; gap: 14px; align-content: start; min-height: 240px; }
.feature-icon { width: 36px; height: 36px; color: var(--gold); display: grid; place-items: center; border: 1px solid var(--gold-24); background: var(--gold-8); border-radius: var(--radius); transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur) var(--ease-out); }
.feature-icon svg { width: 18px; height: 18px; }
.cell:hover .feature-icon { transform: translateY(-2px); box-shadow: var(--glow-gold); }
.feature h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.feature p { font-size: 14.5px; color: var(--ink-2); line-height: 1.6; }
.feature .cell-index { position: absolute; top: 20px; right: 22px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); }
@media (max-width: 960px) { .features { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .features { grid-template-columns: 1fr; } .feature { min-height: 0; } }

/* Steps. */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; counter-reset: step; }
.step { display: grid; gap: 12px; position: relative; padding-top: 22px; }
.step::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--stroke); }
.step::after { content: ''; position: absolute; top: 0; left: 0; width: 0; height: 1px; background: var(--gold); transition: width 1.2s var(--ease-out); transition-delay: calc(var(--i) * 200ms); }
.step.in::after { width: 100%; }
.step-n { font-family: var(--font-mono); font-size: 12px; color: var(--gold); letter-spacing: 0.08em; }
.step h3 { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; }
.step p { color: var(--ink-2); font-size: 15px; }
@media (max-width: 800px) { .steps { grid-template-columns: 1fr; gap: 28px; } }

/* Studio showcase band. */
.band { position: relative; border-block: 1px solid var(--stroke); background: radial-gradient(70% 90% at 50% 100%, rgba(212, 169, 71, 0.09), transparent 60%), var(--bg-deep); overflow: hidden; }
.band-inner { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 56px; align-items: center; }
.band-visual { position: relative; aspect-ratio: 4 / 3; border: 1px solid var(--stroke); background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-2); }
.band-visual .checker { position: absolute; inset: 0; opacity: 0.35; }
.band-visual .quran { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 40px; font-size: clamp(30px, 4vw, 54px); color: var(--gold-bright); text-shadow: 0 0 40px var(--gold-40), 0 4px 24px rgba(0, 0, 0, 0.6); }
.band-visual .ctrl { position: absolute; left: 20px; right: 20px; bottom: 18px; display: flex; gap: 8px; }
.band-visual .ctrl i { height: 3px; flex: 1; background: var(--stroke-strong); border-radius: 2px; overflow: hidden; position: relative; }
.band-visual .ctrl i::after { content: ''; position: absolute; inset: 0; width: var(--w, 40%); background: var(--gold); }
@media (max-width: 900px) { .band-inner { grid-template-columns: 1fr; gap: 32px; } }

/* Shorty teaser. */
.teaser { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.pipeline-mini { display: grid; gap: 10px; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); }
.pipeline-mini li { display: grid; grid-template-columns: 22px 110px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--stroke-soft); align-items: center; }
.pipeline-mini li b { color: var(--gold); font-weight: 600; }
.pipeline-mini li span:last-child { color: var(--ink-3); font-family: var(--font-ui); font-size: 13px; }
@media (max-width: 900px) { .teaser { grid-template-columns: 1fr; } }

/* ── Surah index ────────────────────────────────────────────────────────── */
.surah-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.surah-card { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px 20px; background: var(--bg); transition: background var(--dur) var(--ease-out); position: relative; }
.surah-card::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 2px; background: var(--gold); transform: scaleY(0); transition: transform var(--dur) var(--ease-out); transform-origin: bottom; }
.surah-card:hover { background: var(--surface); }
.surah-card:hover::after { transform: scaleY(1); transform-origin: top; }
.surah-card .name { display: block; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.surah-card .meaning { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.surah-card .quran { display: block; font-size: 26px; line-height: 1.3; color: var(--ink); text-align: right; transition: color var(--dur); }
.surah-card:hover .quran { color: var(--gold-bright); }
.surah-card .count { display: block; font-size: 11px; color: var(--ink-3); text-align: right; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; }
.surah-filter { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.surah-filter .input { max-width: 380px; }

/* ── Surah reading page ─────────────────────────────────────────────────── */
.surah-hero { padding: clamp(40px, 6vw, 80px) 0 32px; display: grid; gap: 24px; }
.surah-title { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end; }
.surah-title .quran { font-size: clamp(48px, 7vw, 84px); line-height: 1.2; color: var(--ink); text-align: left; direction: rtl; }
.surah-facts { display: flex; gap: 28px; flex-wrap: wrap; }
.surah-facts div b { display: block; font-size: 17px; font-weight: 500; }
.surah-facts div span { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.bismillah { text-align: center; padding: 28px 0 8px; display: grid; gap: 14px; justify-items: center; }
.bismillah .quran { font-size: clamp(30px, 4vw, 44px); text-align: center; color: var(--gold-bright); }
.bismillah .rule { width: 160px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.reader { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 56px; align-items: start; }
.rail { position: sticky; top: calc(var(--nav-h) + 24px); display: grid; gap: 18px; }
.rail-nav { display: flex; gap: 6px; }
.rail-nav .btn { flex: 1; }
.jump { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.rail .small { line-height: 1.6; }
.rail-tools { display: grid; gap: 8px; }
.rail-tools .btn { justify-content: flex-start; }
.pager { grid-template-columns: 1fr 1fr; margin-top: 48px; }
.pager a { background: var(--bg); padding: 22px 24px; display: grid; gap: 6px; transition: background var(--dur); }
.pager a:hover { background: var(--surface); }
.pager a:last-child { text-align: right; }
.pager .small { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.pager .name { font-weight: 600; font-size: 16px; }
.pager .quran { font-size: 22px; color: var(--gold); line-height: 1.4; }
.pager a:first-child .quran { text-align: left; }
@media (max-width: 960px) { .reader { grid-template-columns: 1fr; } .rail { position: static; } .surah-title { grid-template-columns: 1fr; } .surah-title .quran { text-align: right; } }

/* ── Verse page ─────────────────────────────────────────────────────────── */
.verse-page { display: grid; gap: 40px; }
.verse-stage { position: relative; padding: clamp(28px, 4vw, 56px) 0 12px; display: grid; gap: 28px; }
.verse-stage .verse-ar { font-size: clamp(34px, 4.6vw, 58px); line-height: 2; }
.verse-stage .verse-en { font-size: clamp(17px, 1.5vw, 20px); color: var(--ink); max-width: 76ch; line-height: 1.6; }
.verse-stage .verse-tr { font-size: 15px; }
.verse-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 16px 0; border-block: 1px solid var(--stroke-soft); }
.verse-toolbar .spacer { flex: 1; }
.wbw { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); direction: rtl; }
.wbw > div { background: var(--bg); padding: 16px 14px; display: grid; gap: 6px; text-align: center; transition: background var(--dur); cursor: pointer; }
.wbw > div:hover { background: var(--surface); }
.wbw > div.on { background: var(--gold-8); box-shadow: inset 0 0 0 1px var(--gold-24); }
.wbw .quran { font-size: 28px; text-align: center; line-height: 1.6; color: var(--ink); }
.wbw > div.on .quran { color: var(--gold-bright); }
.wbw .tr { font-size: 12px; color: var(--ink-3); direction: ltr; font-style: italic; }
.wbw .en { font-size: 13px; color: var(--ink-2); direction: ltr; }
.wbw .i { font-family: var(--font-mono); font-size: 10px; color: var(--ink-4); direction: ltr; }
.verse-nav { grid-template-columns: 1fr 1fr; }
.verse-nav a { background: var(--bg); padding: 18px 20px; display: grid; gap: 4px; transition: background var(--dur); }
.verse-nav a:hover { background: var(--surface); }
.verse-nav a:last-child { text-align: right; }
.verse-nav .small { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; }
.verse-nav .quran { font-size: 20px; color: var(--ink-2); line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.verse-nav a:first-child .quran { text-align: left; }
.context { display: grid; gap: 0; border: 1px solid var(--stroke); border-radius: var(--radius); }
.context .verse { padding: 20px 22px; }
.context .verse:last-child { border-bottom: 0; }
.context .verse-ar { font-size: 26px; }
.context .verse.current { background: var(--gold-8); }

/* ── Search page ────────────────────────────────────────────────────────── */
.search-page { display: grid; gap: 24px; }
.search-box { position: relative; }
.search-box .input { height: 60px; font-size: 18px; padding: 0 56px 0 52px; }
.search-box svg.lead-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--gold); }
.search-box .clear { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
.search-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search-tools .status { font-size: 13px; color: var(--ink-3); margin-inline-start: auto; }
.search-results { border: 1px solid var(--stroke); border-radius: var(--radius); overflow: hidden; }
.search-results .result:last-child { border-bottom: 0; }
.search-empty { padding: 56px 20px; text-align: center; display: grid; gap: 10px; justify-items: center; color: var(--ink-3); }
.search-empty .quran { font-size: 40px; color: var(--ink-4); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--stroke); border-radius: var(--radius); font-size: 13px; color: var(--ink-2); transition: border-color var(--dur), color var(--dur), background var(--dur); }
.chip:hover { border-color: var(--gold); color: var(--gold-bright); background: var(--gold-8); }
.chip .quran { font-size: 17px; line-height: 1; }

/* ── Word page ──────────────────────────────────────────────────────────── */
.word-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 40px; align-items: center; }
.word-hero .quran { font-size: clamp(64px, 10vw, 120px); line-height: 1.3; color: var(--gold-bright); text-shadow: 0 0 60px var(--gold-24); }
.word-facts { display: flex; gap: 28px; flex-wrap: wrap; }
.glosses { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 720px) { .word-hero { grid-template-columns: 1fr; } }

/* ── Studio ─────────────────────────────────────────────────────────────── */
.studio { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 1px; background: var(--stroke); border: 1px solid var(--stroke); border-radius: var(--radius); overflow: hidden; min-height: 640px; }
.studio-panel { background: var(--bg); padding: 24px; display: grid; gap: 22px; align-content: start; overflow-y: auto; max-height: calc(100svh - var(--nav-h) - 48px); }
.studio-stage { background: var(--bg); position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.studio-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--stroke); flex-wrap: wrap; }
.studio-bar .spacer { flex: 1; }
.studio-canvas { position: relative; display: grid; place-items: center; padding: 40px; overflow: auto; min-height: 380px; }
.studio-canvas.ground-checker { background-color: #1a1f27; }
.studio-canvas.ground-black { background: #000; }
.studio-canvas.ground-white { background: #fff; }
.studio-canvas.ground-photo { background: url('/assets/img/ground.jpg') center / cover; }
.studio-canvas .checker { position: absolute; inset: 0; opacity: 0.6; pointer-events: none; }
.studio-canvas canvas { position: relative; max-width: 100%; height: auto; filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.35)); }
.studio-words { padding: 16px; border-top: 1px solid var(--stroke); display: grid; gap: 10px; }
.studio-words .verse-ar { font-size: 30px; }
.studio-words .hint { font-size: 12px; color: var(--ink-3); display: flex; gap: 14px; flex-wrap: wrap; }
.studio-section { display: grid; gap: 12px; }
.studio-section > .label { display: flex; align-items: center; justify-content: space-between; }
.studio-section > .label output { font-family: var(--font-mono); font-size: 11px; color: var(--gold); text-transform: none; letter-spacing: 0; }
.studio-picker { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 8px; }
.studio-nav { display: flex; gap: 6px; }
.studio-nav .btn { flex: 1; }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.preset { border: 1px solid var(--stroke); border-radius: var(--radius); padding: 12px 8px 10px; display: grid; gap: 8px; justify-items: center; transition: border-color var(--dur), background var(--dur); }
.preset:hover { border-color: var(--stroke-strong); background: var(--surface); }
.preset[aria-pressed='true'] { border-color: var(--gold); background: var(--gold-8); }
.preset .quran { font-size: 22px; line-height: 1.2; color: var(--ink); }
.preset.p-glow .quran { color: var(--gold-bright); text-shadow: 0 0 12px var(--gold-bright), 0 0 24px var(--gold-40); }
.preset.p-classic .quran { text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8); }
.preset.p-outline .quran { -webkit-text-stroke: 0.6px var(--ink); color: transparent; }
.preset span { font-size: 11px; color: var(--ink-2); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.studio-empty { display: grid; gap: 12px; justify-items: center; text-align: center; color: var(--ink-3); }
.studio-empty .quran { font-size: 44px; color: var(--ink-4); }
@media (max-width: 960px) {
  .studio { grid-template-columns: 1fr; }
  .studio-panel { max-height: none; order: 2; }
  .studio-stage { order: 1; }
}

/* ── Shorty ─────────────────────────────────────────────────────────────── */
.shorty-hero { position: relative; min-height: 80svh; display: grid; align-items: center; background: var(--bg-deep); border-bottom: 1px solid var(--stroke); overflow: hidden; isolation: isolate; }
.shorty-hero .hero-canvas { opacity: 0.9; }
.shorty-hero .hero-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.shorty-frame { position: relative; margin-inline: auto; width: min(100%, 300px); aspect-ratio: 9 / 16; border: 1px solid var(--stroke-strong); border-radius: 6px; background: linear-gradient(180deg, #11161d, #0b0f14); box-shadow: var(--shadow-2), 0 0 0 6px rgba(255, 255, 255, 0.02); overflow: hidden; }
.shorty-frame .scene { position: absolute; inset: 0; background: radial-gradient(80% 60% at 50% 30%, rgba(212, 169, 71, 0.18), transparent 70%); }
.shorty-frame .subject { position: absolute; left: 50%; top: 36%; width: 92px; height: 92px; border-radius: 50%; transform: translate(-50%, -50%); background: radial-gradient(circle at 35% 35%, #3a4350, #161b22); box-shadow: 0 0 0 1px var(--stroke-strong), 0 20px 40px rgba(0, 0, 0, 0.5); animation: subject 8s var(--ease-in-out) infinite; }
@keyframes subject { 0%, 100% { transform: translate(-60%, -50%); } 50% { transform: translate(-40%, -48%); } }
.shorty-frame .track { position: absolute; left: 50%; top: 36%; width: 150px; height: 150px; border: 1px dashed var(--gold-40); transform: translate(-50%, -50%); animation: subject 8s var(--ease-in-out) infinite; }
.shorty-frame .caption { position: absolute; left: 16px; right: 16px; bottom: 22%; text-align: center; font-weight: 700; font-size: 17px; line-height: 1.25; letter-spacing: -0.01em; }
.shorty-frame .caption span { display: inline-block; padding: 2px 4px; opacity: 0.55; transition: opacity 0.2s, color 0.2s; }
.shorty-frame .caption span.hot { opacity: 1; color: #efc75f; }
.shorty-frame .bar { position: absolute; left: 16px; right: 16px; bottom: 14px; height: 2px; background: var(--stroke-strong); }
.shorty-frame .bar i { display: block; height: 100%; width: 0; background: #efc75f; animation: bar 8s linear infinite; }
@keyframes bar { to { width: 100%; } }
.shorty-frame .why { position: absolute; top: 14px; left: 14px; right: 14px; font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); display: flex; justify-content: space-between; }
.shorty-frame .why b { color: var(--ok); font-weight: 600; }

.pipeline { grid-template-columns: repeat(8, minmax(0, 1fr)); position: relative; }
.pipeline > div { background: var(--bg); padding: 22px 16px 20px; display: grid; gap: 10px; align-content: start; position: relative; min-height: 190px; }
.pipeline .pn { font-family: var(--font-mono); font-size: 11px; color: var(--gold); }
.pipeline .pt { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.pipeline .pd { font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.pipeline > div::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--gold); transform: scaleX(0); transform-origin: left; }
.pipeline > div.lit::after { animation: lit 1.4s var(--ease-out) forwards; }
@keyframes lit { 0% { transform: scaleX(0); opacity: 1; } 60% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0.25; } }
.pipeline > div.lit { background: var(--surface); }
@media (max-width: 1100px) { .pipeline { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 600px) { .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.beats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.beat { display: grid; gap: 8px; padding-top: 18px; border-top: 1px solid var(--stroke); }
.beat b { font-size: 16px; }
.beat p { font-size: 14px; color: var(--ink-2); }
@media (max-width: 800px) { .beats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.checks { }
.checks > div { background: var(--bg); display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: 18px 22px; align-items: center; }
.checks b { font-size: 14.5px; }
.checks span { font-size: 14px; color: var(--ink-2); }
@media (max-width: 700px) { .checks > div { grid-template-columns: 1fr; gap: 6px; } }

.signals { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.signals > div { background: var(--bg); padding: 22px; display: grid; gap: 10px; align-content: start; }
.signals b { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.signals li { font-size: 13.5px; color: var(--ink-2); padding: 4px 0; border-bottom: 1px solid var(--stroke-soft); }
.signals li:last-child { border-bottom: 0; }
@media (max-width: 800px) { .signals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.connect { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.connect > div { background: var(--bg); padding: 28px; display: grid; gap: 16px; align-content: start; }
.connect .status-line { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); }
.connect .status-line .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-4); }
.connect .status-line.ok .dot { background: var(--ok); box-shadow: 0 0 12px rgba(111, 194, 143, 0.6); }
.connect .status-line.bad .dot { background: var(--danger); }
.job-list { }
.job-list > div { background: var(--bg); padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13px; }
.job-list .state { font-family: var(--font-mono); font-size: 11px; color: var(--gold); text-transform: uppercase; }
.job-list .src { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-list .meter { grid-column: 1 / -1; height: 2px; background: var(--stroke); }
.job-list .meter i { display: block; height: 100%; background: var(--gold); transition: width 0.6s var(--ease-out); }
@media (max-width: 860px) { .connect { grid-template-columns: 1fr; } }

/* ── Juz ────────────────────────────────────────────────────────────────── */
.juz-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.juz-card { background: var(--bg); padding: 22px; display: grid; gap: 8px; transition: background var(--dur); }
.juz-card:hover { background: var(--surface); }
.juz-card .n { font-family: var(--font-mono); font-size: 11px; color: var(--gold); letter-spacing: 0.1em; }
.juz-card .quran { font-size: 22px; color: var(--ink); text-align: left; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.juz-card .range { font-size: 12.5px; color: var(--ink-3); }

/* ── About / prose ──────────────────────────────────────────────────────── */
.prose { display: grid; gap: 18px; color: var(--ink-2); font-size: 16.5px; line-height: 1.7; }
.prose h2 { color: var(--ink); margin-top: 24px; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul { display: grid; gap: 8px; padding-inline-start: 18px; list-style: square; }
.prose ::marker { color: var(--gold); }

/* ── 404 ────────────────────────────────────────────────────────────────── */
.lost { min-height: calc(100svh - var(--nav-h)); display: grid; place-items: center; text-align: center; }
.lost .quran { font-size: clamp(40px, 6vw, 72px); color: var(--gold-bright); }
