/* The 99 Names · a tree of the Garden, in Kiswah Night or Haram Ivory.
   Tokens follow Sahib Brand Guidelines v1.0 (Kiswah Night). "Light" values are proposed: brightened Lamp for lit stars. */

:root {
  --font-display: "Marcellus", serif;
  --font-text: "Jost", -apple-system, "SF Pro Text", Roboto, sans-serif;
  --font-arabic: "Amiri", "Geeza Pro", "Noto Naskh Arabic", serif;
  --radius-card: 22px; --radius-pill: 999px;
  --gutter: clamp(16px, 3.4vw, 48px);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --leaf-ink: #241E17;            /* names on the leaves: every leaf is light, in either theme */
  --ar-scale: 1;                  /* Arabic size per style: Lateef draws small, so IndoPak is scaled up */
}
[data-theme="kiswah"] {
  --bg-canvas: #0E0D0B;
  --bg-surface: #1B1915;
  --bg-raised: #28241E;
  --text-primary: #EADBB0;
  --text-secondary: #A8997A;
  --text-accent: #C9A55C;
  --display-gold: #C9A55C;
  --action-primary: #C9A55C;
  --action-primary-label: #0E0D0B;
  --control-selected: #C9A55C;
  --line-hairline: rgb(234 219 176 / .12);
  --light: #F3DFA6;              /* proposed: Lamp lifted for light */
  --brass: #6B5A3E;              /* proposed: Lamp darkened toward Kiswah */
  --lf-gold-hi: #E4CB8C; --lf-gold-lo: #B08A43; --leaf-edge: #7A5D25;   /* proposed: name leaves at night, a deeper gold until learned */
  --strand-hi: #FFF4D2; --strand-lo: #C9A55C; --strand-glow: #E8C46A; --strand-mode: night;   /* proposed: the tree of light */
  --ring: #E9CF8A; --pool: #C9A55C; --seat-core: #0E0D0B; --seat-edge: #1E1A12; --allah: #F3DB95; --halo-o: .26; --shadow-o: 0; --leaf-o: 1;
  --lf-foil-hi: #FFF9E0; --lf-foil-lo: #F2C968;   /* a learned leaf: bright lantern light */
  --crown-glow: #C9A55C;
  --glass: rgb(40 36 30 / .82);
  --glass-strong: rgb(40 36 30 / .95);
  --panel: rgb(27 25 21 / .85);
  --card-bg: rgb(27 25 21 / .94);
  --card-shadow: inset 0 0 0 1px rgb(201 165 92 / .22), 0 30px 60px -30px rgb(0 0 0 / .8);
  --scrim: 14 13 11;
  --stage-bg: radial-gradient(ellipse 70% 60% at 50% 40%, #17150f 0%, rgb(14 13 11 / 0) 70%), linear-gradient(to bottom, #0E0D0B 0%, #0E0D0B 55%, #100f0c 100%);
  --cloud-o: .2; --cloud-filter: sepia(.6) brightness(.5);
  color-scheme: dark;
}
[data-theme="ivory"] {
  --bg-canvas: #F6F0E4;
  --bg-surface: #FCF9F2;
  --bg-raised: #E7DAC2;
  --text-primary: #2B2620;
  --text-secondary: #6E6353;
  --text-accent: #7F612C;
  --display-gold: #A88446;
  --action-primary: #7F612C;
  --action-primary-label: #F6F0E4;
  --control-selected: #7F612C;
  --line-hairline: rgb(43 38 32 / .1);
  --light: #7F612C;              /* by day, light is Gold Text */
  --brass: #B9A47E;
  --lf-gold-hi: #EEDDAE; --lf-gold-lo: #C8A257; --leaf-edge: #8E6E32;   /* proposed: name leaves by day, a deeper gold until learned */
  --strand-hi: #B8924C; --strand-lo: #6E5428; --strand-glow: #F3DFA6; --strand-mode: day;   /* proposed: the tree of light, gold thread by day */
  --ring: #B8924C; --pool: #F3DFA6; --seat-core: #FFF9EA; --seat-edge: #F0DFAE; --allah: #7F612C; --halo-o: .0; --shadow-o: .18; --leaf-o: 1;
  --lf-foil-hi: #FFFBEC; --lf-foil-lo: #EEC761;   /* a learned leaf: bright gold foil */
  --crown-glow: #FFF8E2;
  --glass: rgb(252 249 242 / .8);
  --glass-strong: rgb(252 249 242 / .96);
  --panel: rgb(252 249 242 / .85);
  --card-bg: rgb(252 249 242 / .96);
  --card-shadow: inset 0 0 0 1px rgb(168 132 70 / .25), 0 30px 60px -34px rgb(43 38 32 / .35);
  --scrim: 246 240 228;
  --stage-bg: radial-gradient(ellipse 60% 50% at 50% 30%, #FFFDF6 0%, rgb(255 253 246 / 0) 70%), linear-gradient(to bottom, #F3EBDB 0%, #F6F0E4 45%, #EFE5D1 100%);
  --cloud-o: .9; --cloud-filter: brightness(1.22) saturate(.35) contrast(.8);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--bg-raised) var(--bg-canvas); }
body { margin: 0; background: var(--bg-canvas); color: var(--text-primary); font: 400 17px/1.6 var(--font-text); -webkit-font-smoothing: antialiased; overflow-x: clip; }
p, h1, h2, h3 { margin: 0; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
::selection { background: var(--bg-raised); color: var(--light); }
:focus-visible { outline: 2px solid var(--control-selected); outline-offset: 3px; border-radius: 4px; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.skip { position: fixed; left: 16px; top: -80px; z-index: 100; background: var(--bg-surface); color: var(--text-primary); padding: 12px 18px; border-radius: var(--radius-pill); text-decoration: none; }
.skip:focus { top: 16px; }

/* ---------- Bar ---------- */
.bar { position: absolute; z-index: 20; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 24px; padding: 20px var(--gutter); pointer-events: none; }
.bar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text-primary); min-height: 48px; }
.brand img { width: 28px; height: 28px; }
[data-theme="kiswah"] .mark-light, [data-theme="ivory"] .mark-dark { display: none; }
[data-script="uthmani"] { --font-arabic: "Amiri Quran", "Amiri", serif; --ar-scale: 1; }
[data-script="indopak"] { --font-arabic: "Lateef", "Amiri", serif; --ar-scale: 1.28; }
/* The Arabic style menu: a quiet pill in the bar, opening a short list that shows each style in its own letters */
.script { position: relative; flex: none; }
.script-btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border: 0; border-radius: var(--radius-pill); cursor: pointer;
  background: var(--glass); color: var(--text-primary); font: 500 14px/1 var(--font-text); box-shadow: inset 0 0 0 1px var(--line-hairline); backdrop-filter: blur(6px); }
.script-label { color: var(--text-secondary); }
.script-btn[aria-expanded="true"] { box-shadow: inset 0 0 0 1.5px var(--control-selected); }
.script-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 240px; padding: 6px; border-radius: 18px;
  background: var(--card-bg); box-shadow: var(--card-shadow); backdrop-filter: blur(14px); display: grid; gap: 2px; }
.script-menu button { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 6px 14px; border: 0; border-radius: 12px;
  background: none; cursor: pointer; color: var(--text-primary); font: 500 15px/1 var(--font-text); text-align: left; }
.script-menu button:hover { background: var(--bg-raised); }
.script-menu button[aria-checked="true"] { background: var(--bg-raised); box-shadow: inset 0 0 0 1.5px var(--control-selected); }
.script-menu b { font-weight: 400; color: var(--light); font-size: 26px; line-height: 1.5; }
.s-naskh { font-family: "Amiri", serif; }
.s-uthmani { font-family: "Amiri Quran", "Amiri", serif; }
.s-indopak { font-family: "Lateef", "Amiri", serif; font-size: 33px !important; }
.theme-toggle { flex: none; }
[data-theme="kiswah"] .theme-toggle .i-moon, [data-theme="ivory"] .theme-toggle .i-sun { display: none; }
.brand span { font: 400 20px/1 var(--font-display); letter-spacing: .14em; padding-top: 2px; }
.themes { margin-left: auto; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.themes::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 40px; padding: 0 16px; border: 0; border-radius: var(--radius-pill); cursor: pointer;
  background: var(--glass); color: var(--text-secondary); font: 500 14px/1 var(--font-text);
  box-shadow: inset 0 0 0 1px var(--line-hairline); transition: color .25s, box-shadow .25s, background-color .25s;
  backdrop-filter: blur(6px);
}
.chip:hover { color: var(--text-primary); }
.chip[aria-pressed="true"] { color: var(--light); box-shadow: inset 0 0 0 1.5px var(--control-selected); background: var(--glass-strong); }

/* ---------- The sky ---------- */
.stage { position: relative; height: 100vh; height: 100svh; min-height: 560px; overflow: hidden; background: var(--stage-bg); touch-action: none; transition: background .5s; }
.dust, .shafts { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.shafts { animation: shafts 12s ease-in-out infinite alternate; }
@keyframes shafts { from { opacity: .75; } to { opacity: 1; } }
.sky { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; user-select: none; -webkit-user-select: none; }
.sky.is-dragging { cursor: grabbing; }
[data-view] { transition: transform .7s var(--ease-out); }
.sky.is-dragging [data-view], .sky.is-zooming [data-view] { transition: none; }

/* The tree: one dark silhouette, trunk to stem, with a fine gilt edge, standing on a hill above a river, clouds in the sky */
.seg path { fill: none; stroke-linecap: round; }
.node .leafshadow { fill: rgb(20 18 6 / var(--shadow-o)); }
/* The ground of light: a pool and rings under the tree, three rings rippling outward in turn */
.ground-pool { fill: url(#pool); }
.ring { fill: none; stroke: var(--ring); stroke-width: calc(1px / var(--zs, 1)); opacity: var(--o, .4); }
.ring.ripple { transform-box: fill-box; transform-origin: center; animation: ripple 7.8s cubic-bezier(.2,.6,.3,1) var(--rd, 0s) infinite; opacity: 0; }
@keyframes ripple { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(8.6); opacity: 0; } }
.light-tree { pointer-events: none; }
/* Close up: crisp vector strands over the painted light, which stays beneath as their glow */
.crisp { display: none; fill: none; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.sky.is-close .crisp { display: inline; }
.sky.is-zooming .crisp, .sky.is-dragging .crisp { display: none; }
.sky.is-zooming .light-tree, .sky.is-dragging .light-tree { opacity: 1; }
.crisp.add { mix-blend-mode: plus-lighter; }
.sky.is-close .light-tree { opacity: .6; }
/* The arrival: while the view rises up the tree, the interface waits */
body.is-flying .intro, body.is-flying .dock, body.is-flying .zoom, body.is-flying .bar { opacity: 0; pointer-events: none; }
.bar, .zoom, .dock { transition: opacity .9s var(--ease-out); }
.sky.is-flying [data-view] { transition: none; }
.sky.is-waiting .node, .sky.is-waiting .light-g { opacity: 0; }
.seg .hit { stroke: transparent; pointer-events: stroke; }
.seg[data-branch] { cursor: pointer; }

.clouds { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.cl { position: absolute; width: clamp(360px, 42vw, 820px); height: auto; opacity: var(--cloud-o); filter: var(--cloud-filter); will-change: transform; transition: opacity .6s;
  animation: drift var(--dur, 60s) ease-in-out infinite alternate; }
.cl-a { left: -12%; top: 6%; --dur: 70s; }
.cl-b { right: -14%; top: 14%; --dur: 84s; animation-direction: alternate-reverse; }
.cl-c { left: -8%; top: 34%; width: clamp(300px, 30vw, 600px); --dur: 66s; }
.cl-d { right: -10%; top: 38%; width: clamp(300px, 32vw, 640px); --dur: 76s; animation-direction: alternate-reverse; }
@keyframes drift { from { transform: translateX(-3vw); } to { transform: translateX(3vw); } }

/* Light climbing the branches to a theme's names, or to the name that is open; widths held constant through zoom */
.paths { filter: url(#glow); pointer-events: none; }
.sap { fill: none; stroke: var(--light); stroke-width: calc(2px / var(--zs, 1)); stroke-linecap: round; stroke-dasharray: 3 9; opacity: 0;
  animation: sap-in .6s var(--ease-out) var(--d, 0s) forwards, flow 1.4s linear infinite; }
.sap.one { stroke-dasharray: none; stroke-width: calc(1.6px / var(--zs, 1)); }
@keyframes sap-in { to { opacity: .95; } }
@keyframes flow { to { stroke-dashoffset: -12; } }

.center .seat { fill: url(#seat-light); }
.center .allah { font: 700 calc(62px * var(--ar-scale))/1 var(--font-arabic); fill: var(--allah); text-anchor: middle; filter: url(#glow); }
/* The progress ring is dashed in user units, so it scales with the sky; its width is divided by the zoom to stay a hairline */
.progress-track { fill: none; stroke: var(--display-gold); stroke-opacity: .14; stroke-width: calc(2px / var(--zs, 1)); }
.progress { fill: none; stroke: var(--light); stroke-width: calc(2.5px / var(--zs, 1)); stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease-out); filter: url(#glow); }

.node { cursor: pointer; outline: none; }
.node .hit { fill: transparent; }
.node { cursor: pointer; outline: none; }
.node .leafshape { stroke: var(--leaf-edge); stroke-opacity: .6; stroke-width: 1; vector-effect: non-scaling-stroke; opacity: var(--leaf-o); transition: stroke .35s, stroke-opacity .35s, opacity .35s; }
.node .vein { stroke: #8A6A30; stroke-opacity: .16; stroke-width: 1; vector-effect: non-scaling-stroke; }
.node .bloom { transform: scale(var(--bs, 1)); transform-box: fill-box; transform-origin: center; transition: transform .45s var(--ease-out), opacity .35s; }
.node .halo { fill: url(#halo); opacity: var(--halo-o); pointer-events: none; transition: opacity .4s; }
.node .label { font: 400 calc(15px * var(--ar-scale))/1 var(--font-arabic); fill: var(--leaf-ink); opacity: var(--label-o, .9); pointer-events: none; transition: opacity .35s; }
/* A learned name turns its leaf to gold foil: a light rim and a breathing glow */
.node.is-learned .leafshape { fill: url(#lf-foil); stroke: #FFF6D8; stroke-opacity: 1; stroke-width: 1.8; opacity: 1; }
.node.is-learned .halo { opacity: .5; animation: breathe var(--twd, 6s) ease-in-out var(--tw, 0s) infinite; }
@keyframes breathe { 0%, 100% { opacity: .25; } 50% { opacity: .6; } }
.node .sparkle { fill: #FFF6D8; stroke: #C9A55C; stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0; pointer-events: none; transform-box: fill-box; transform-origin: center; }
.node.is-learned .sparkle { opacity: 1; animation: twinkle 3.2s ease-in-out var(--tw, 0s) infinite; }
@keyframes twinkle { 0%, 100% { transform: scale(.7) rotate(0deg); } 50% { transform: scale(1.15) rotate(45deg); } }
.sky.has-focus .node:not(.is-on):not(.is-active) .sparkle { opacity: 0; }
.node:hover, .node:focus-visible, .node.is-active { --bs: 1.12; }
.node:hover .leafshape, .node:focus-visible .leafshape, .node.is-on .leafshape { stroke: var(--light); stroke-opacity: 1; stroke-width: 1.6; }
.node.is-on .halo, .node.is-active .halo { opacity: .7; animation: none; }
.node.is-active .leafshape { stroke: var(--light); stroke-opacity: 1; stroke-width: 2; filter: url(#glow); }
.sky.has-focus .node:not(.is-on):not(.is-active) .bloom { opacity: .3; }
.sky.has-focus .node:not(.is-on):not(.is-active) .halo { opacity: 0; animation: none; }

.satellite .mark { fill: var(--glass); stroke: var(--light); stroke-width: 1.2; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.satellite .label { font: 400 calc(13px * var(--ar-scale))/1 var(--font-arabic); fill: var(--text-primary); }
.satellite { cursor: pointer; }
.satellite:hover .mark, .satellite:focus-visible .mark { stroke-dasharray: none; }

/* Arrival: the trunk rises, the branches grow outward, then the leaves open from the heart of the tree out */
.is-arriving .node { opacity: 0; animation: unfold .6s var(--ease-out) forwards; animation-delay: var(--d, 0s); }
.is-arriving .node .bloom { animation: bud .8s var(--ease-out) both; animation-delay: var(--d, 0s); }
/* Each leaf stirs gently on its own, as if in a breeze */
.node .bloom { animation: stir var(--fd, 4s) ease-in-out var(--fdl, 0s) infinite alternate; }
@keyframes stir { from { transform: rotate(-2.2deg) scale(var(--bs, 1)); } to { transform: rotate(2.2deg) scale(var(--bs, 1)); } }
@keyframes grow-up { from { transform: scaleY(0); opacity: 0; } }
@keyframes unfold { to { opacity: var(--o, 1); } }
@keyframes bud { from { transform: scale(0); } }

/* ---------- Overlay copy ---------- */
.intro { position: absolute; z-index: 10; left: var(--gutter); bottom: 40px; max-width: 420px; pointer-events: none; transition: opacity .4s; }
.intro h1 { font: 400 clamp(36px, 4vw, 58px)/1.02 var(--font-display); letter-spacing: -0.012em; }
.intro p { margin-top: 14px; color: var(--text-secondary); font-size: 16px; line-height: 1.55; max-width: 30em; }
.stage.card-open .intro, .stage.is-explored .intro { opacity: 0; }
/* A soft haze of the sky behind the title, so the meadow never runs through the words */
.intro::before { content: ""; position: absolute; z-index: -1; left: calc(-1 * var(--gutter) - 120px); right: -200px; top: -150px; bottom: -110px;
  background: radial-gradient(closest-side, rgb(var(--scrim) / .9) 0%, rgb(var(--scrim) / .78) 40%, rgb(var(--scrim) / .38) 70%, rgb(var(--scrim) / .12) 86%, rgb(var(--scrim) / 0) 100%); }

.zoom { position: absolute; z-index: 10; left: var(--gutter); top: 50%; transform: translateY(-50%); display: grid; gap: 8px; }
.round { width: 48px; height: 48px; display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer; background: var(--glass); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--line-hairline); backdrop-filter: blur(6px); }
.round:hover { color: var(--light); }

.dock { position: absolute; z-index: 10; right: var(--gutter); bottom: 40px; display: flex; align-items: center; gap: 20px; }
.count { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 12px 18px; border-radius: var(--radius-pill); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-hairline); backdrop-filter: blur(6px); color: var(--text-secondary); font-size: 14px; white-space: nowrap; }
.count b { font: 600 24px/1 var(--font-text); color: var(--display-gold); font-variant-numeric: tabular-nums; }
.views { display: flex; gap: 4px; padding: 4px; border-radius: var(--radius-pill); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-hairline); backdrop-filter: blur(6px); }
.views button { height: 44px; padding: 0 18px; border: 0; border-radius: var(--radius-pill); background: none; cursor: pointer; color: var(--text-secondary); font: 500 15px/1 var(--font-text); }
.views button[aria-pressed="true"] { background: var(--bg-raised); color: var(--text-primary); font-weight: 600; }
.stage.card-open .dock { opacity: 0; pointer-events: none; }

/* ---------- The card ---------- */
.card {
  position: absolute; z-index: 30; top: 88px; right: var(--gutter); bottom: 32px; width: min(440px, calc(100% - 2 * var(--gutter)));
  overflow-y: auto; scrollbar-width: thin; padding: 28px 28px 24px; border-radius: var(--radius-card);
  background: var(--card-bg); box-shadow: var(--card-shadow);
  backdrop-filter: blur(14px); animation: rise .45s var(--ease-out);
}
.card[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.close { position: absolute; top: 14px; right: 14px; background: var(--bg-raised); }
.card-meta { margin-top: 10px; font-size: 14px; line-height: 1.45; color: var(--text-secondary); }
.card-ar { margin-top: 52px; font: 400 calc(64px * var(--ar-scale))/1.4 var(--font-arabic); color: var(--light); text-align: right; }
.card-tr { margin-top: 4px; font: 400 30px/1.15 var(--font-display); }
.card-en { margin-top: 4px; color: var(--text-secondary); font-size: 17px; }
.card-learn { margin-top: 18px; }
.known { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; cursor: pointer; font: 500 15px/1 var(--font-text); color: var(--text-primary); }
.known input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.known span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; box-shadow: inset 0 0 0 1.5px var(--brass); color: transparent; transition: background-color .25s, color .25s, box-shadow .25s; }
.known span .ic { width: 16px; height: 16px; }
.known input:checked + span { background: var(--display-gold); color: var(--bg-canvas); box-shadow: none; }
.known input:focus-visible + span { outline: 2px solid var(--control-selected); outline-offset: 3px; }
.card-sec { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-hairline); }
.card-sec h3 { font: 600 14px/1.4 var(--font-text); color: var(--text-secondary); letter-spacing: .02em; margin-bottom: 8px; }
.card-ref-ar { font: 400 calc(26px * var(--ar-scale))/1.85 var(--font-arabic); text-align: right; }
.card-ref-en { margin-top: 6px; font-size: 16px; line-height: 1.55; }
.card-ref-src { margin-top: 8px; font: 500 14px/1.4 var(--font-text); color: var(--text-secondary); }
.card-voc { font: 400 calc(32px * var(--ar-scale))/1.6 var(--font-arabic); color: var(--light); text-align: right; }
.card-when { margin-top: 4px; font-size: 16px; line-height: 1.55; color: var(--text-primary); }
.card-themes { display: flex; flex-wrap: wrap; gap: 8px; }
.card-themes .chip { height: 40px; font-size: 14px; }
.card-nav { display: flex; justify-content: space-between; margin-top: 22px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 22px; border: 0; border-radius: var(--radius-pill); cursor: pointer; font: 600 15px/1 var(--font-text); }
.btn-quiet { background: none; color: var(--text-accent); padding: 0 8px; }
.btn-primary { background: var(--action-primary); color: var(--action-primary-label); }
.btn-primary:hover { background: color-mix(in oklab, var(--action-primary), #fff 12%); }

.card.learn { bottom: auto; max-height: calc(100% - 120px); padding-bottom: 32px; }
.learn-ar { font-size: calc(88px * var(--ar-scale)); text-align: center; margin: 48px 0 24px; }
.learn-answer { text-align: center; }
.learn-answer .card-ref-ar { text-align: center; margin-top: 18px; }
.learn-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 28px; }
.learn-note { margin-top: 20px; text-align: center; font-size: 14px; color: var(--text-secondary); }

/* ---------- The list ---------- */
.list { padding: 96px var(--gutter) 80px; background: var(--bg-canvas); }
.list-in { max-width: 1180px; margin: 0 auto; }
.list-head h2 { font: 400 clamp(34px, 3.4vw, 46px)/1.08 var(--font-display); }
.list-head p { margin-top: 12px; max-width: 46em; color: var(--text-primary); }
.list-head .src, .list-note { color: var(--text-secondary); font-size: 15px; }
.list-body { margin-top: 40px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 40px; }
.list-col h3 { font: 600 14px/1.4 var(--font-text); color: var(--text-secondary); padding-bottom: 10px; border-bottom: 1px solid var(--line-hairline); }
.list-col ol { list-style: none; margin: 0; padding: 0; }
.row { width: 100%; display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; min-height: 56px; padding: 6px 0; border: 0; border-bottom: 1px solid var(--line-hairline); background: none; cursor: pointer; text-align: left; }
.row i { font: 500 14px/1 var(--font-text); font-style: normal; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.row b { display: block; font: 500 16px/1.3 var(--font-text); }
.row small { display: block; font-size: 14px; color: var(--text-secondary); }
.row span[lang="ar"] { font: 400 calc(24px * var(--ar-scale))/1.3 var(--font-arabic); color: var(--light); }
.row.is-learned i { color: var(--display-gold); }
.row:hover b { color: var(--light); }
.list.is-filtered .row:not(.is-in) { display: none; }
.list.is-filtered .list-col.is-empty { display: none; }
.list-filter { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--text-primary); }

.foot { padding: 32px var(--gutter) 48px; border-top: 1px solid var(--line-hairline); color: var(--text-secondary); font-size: 14px; }
.foot p { max-width: 1180px; margin: 0 auto; }
.foot-links { max-width: 1180px; margin: 12px auto 0; display: flex; flex-wrap: wrap; gap: 4px 20px; }
.foot-links a { display: inline-flex; align-items: center; min-height: 44px; font: 500 15px/20px var(--font-text); color: var(--text-accent); text-decoration: none; }
.foot-links a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Narrow screens: the card becomes a sheet ---------- */
@media (max-width: 760px) {
  .bar { flex-wrap: wrap; gap: 8px; padding-top: 12px; }
  .themes { margin-left: 0; width: 100%; order: 3; }
  .script { margin-left: auto; }
  .script-label { display: none; }
  .intro { bottom: 148px; }
  .intro p { font-size: 15px; }
  .zoom { top: auto; bottom: 84px; left: var(--gutter); right: auto; transform: none; display: flex; }
  /* The intro and dock sit on a scrim of the night, so text never lies over names */
  .stage::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 46%; z-index: 5; pointer-events: none;
    background: linear-gradient(to bottom, rgb(var(--scrim) / 0), rgb(var(--scrim) / .88) 38%, var(--bg-canvas) 70%); transition: opacity .4s; }
  .stage.is-explored::after, .stage.card-open::after { opacity: 0; }
  .stage::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 150px; z-index: 5; pointer-events: none;
    background: linear-gradient(to top, rgb(var(--scrim) / 0), rgb(var(--scrim) / .85) 45%, var(--bg-canvas)); }
  .count { padding: 12px 14px; }
  .count span { display: none; }
  .count b::after { content: " / 99"; font-weight: 400; font-size: 15px; color: var(--text-secondary); }
  .dock { left: var(--gutter); right: var(--gutter); bottom: 20px; justify-content: space-between; }
  .views button { padding: 0 12px; font-size: 14px; }
  .card { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 82svh; border-radius: 22px 22px 0 0; padding: 26px 20px 20px; }
  .card-ar { font-size: calc(52px * var(--ar-scale)); }
  .learn-ar { font-size: calc(72px * var(--ar-scale)); margin: 28px 0 16px; }
  .list-body { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) and (min-width: 761px) { .list-body { grid-template-columns: 1fr 1fr; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .sap { opacity: .95; }
}
