/*
 * Pearls of Quran — base: reset, typography, layout helpers, focus rings, reveal/split-text system,
 * ocean decor (rays, light pools, geometric pattern), pearl / shell / strand / logo styles, page transitions.
 * Animations use transform + opacity only.
 */

/* ───────────────────────────── reset ───────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 90px; -webkit-tap-highlight-color: transparent; }
html.reduce-motion { scroll-behavior: auto; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: var(--fs-md); line-height: 1.6; font-weight: 400; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; overflow-x: hidden; overflow-x: clip; }
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
img, svg, video, canvas { display: block; max-width: 100%; }
img, video { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--link); text-decoration: none; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }
::selection { background: var(--gold-300); color: #1B1303; }

/* Focus: brand-colour ring, keyboard only. No stray blue outlines anywhere. */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
a:focus-visible, button:focus-visible, [role="button"]:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* ───────────────────────────── typography ───────────────────────────── */
h1, h2, h3, h4, .display { font-family: var(--font-display); font-weight: 700; line-height: 1.04; letter-spacing: -.025em; text-wrap: balance; font-variation-settings: 'opsz' 96; }
h1, .h1 { font-size: var(--fs-h1); }
h2, .h2 { font-size: var(--fs-h2); }
h3, .h3 { font-size: var(--fs-h3); line-height: 1.12; }
h4, .h4 { font-size: var(--fs-h4); line-height: 1.2; letter-spacing: -.015em; }
p { text-wrap: pretty; }
strong, b { font-weight: 650; }
small { font-size: var(--fs-sm); }
.lead { font-size: var(--fs-xl); line-height: 1.55; color: var(--text-soft); }
.muted { color: var(--text-soft); }
.mute { color: var(--text-mute); }
.gold { color: var(--accent); }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.eyebrow { display: inline-flex; align-items: center; gap: .6em; font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 650; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.eyebrow::before { content: ''; width: 1.8em; height: 1px; background: currentColor; opacity: .7; }
.eyebrow--bare::before { display: none; }
.quote { font-family: var(--font-quote); font-style: italic; font-weight: 400; line-height: 1.22; letter-spacing: -.005em; }
.text-grad { background: linear-gradient(100deg, #FFF3CC 0%, var(--gold-300) 38%, var(--gold-500) 70%, #F7DFA0 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-theme="pearl"] .text-grad { background-image: linear-gradient(100deg, var(--gold-800), var(--gold-500) 55%, var(--gold-600)); }
/* Arabic: a proper Quran face, right-to-left, generous line height so the marks never clip. */
.ar, [lang="ar"] { font-family: var(--font-arabic); direction: rtl; unicode-bidi: isolate; line-height: 2.1; font-weight: 400; letter-spacing: 0; font-feature-settings: normal; }
kbd { font-family: var(--font-body); font-size: .75em; font-weight: 600; padding: .15em .5em; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--glass); color: var(--text-soft); }

/* ───────────────────────────── layout helpers ───────────────────────────── */
.container { width: min(100% - var(--gutter) * 2, var(--container)); margin-inline: auto; }
.container--narrow { --container: 820px; }
.container--wide { --container: 1360px; }
.section { position: relative; padding-block: var(--section-y); }
.section--tight { padding-block: calc(var(--section-y) * .6); }
.stack { display: flex; flex-direction: column; gap: var(--gap, var(--s-4)); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--s-3)); }
.center { text-align: center; }
.center .eyebrow { justify-content: center; }
.section-head { display: grid; gap: var(--s-4); max-width: 760px; margin-bottom: clamp(2rem, 5vw, 4rem); }
.section-head.center { margin-inline: auto; justify-items: center; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 12px; top: -80px; z-index: 999; padding: .7rem 1.1rem; border-radius: var(--r-pill); background: var(--gold-300); color: #1B1303; font-weight: 650; transition: top var(--t-med) var(--ease-out); }
.skip-link:focus { top: 12px; }
html.is-locked { overflow: hidden; }
html.is-locked body { padding-right: var(--sb, 0px); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ───────────────────────────── icons ───────────────────────────── */
.i { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.22em; }
i[data-icon] { display: inline-block; width: 1.25em; height: 1.25em; }

/* ───────────────────────────── reveal on scroll ─────────────────────────────
   Only hides content when JavaScript is running (html.js) so the page is never blank without it. */
.js [data-reveal] { opacity: 0; transform: translate3d(0, 28px, 0); transition: opacity .8s var(--ease-out) var(--d, 0ms), transform .9s var(--ease-out) var(--d, 0ms); will-change: transform, opacity; }
.js [data-reveal="left"] { transform: translate3d(-36px, 0, 0); }
.js [data-reveal="right"] { transform: translate3d(36px, 0, 0); }
/* phones: side-slides would push past the screen edge before they reveal — slide up instead */
@media (max-width: 720px) { .js [data-reveal="left"]:not(.is-in), .js [data-reveal="right"]:not(.is-in) { transform: translate3d(0, 28px, 0); } }
.js [data-reveal="scale"] { transform: scale(.92); }
.js [data-reveal="fade"] { transform: none; }
.js [data-reveal="rise"] { transform: translate3d(0, 60px, 0) scale(.97); }
.js [data-reveal].is-in { opacity: 1; transform: none; will-change: auto; }
/* First screen (hero): its entrance is pure CSS, so the text is painted with the first frame instead of waiting for the scripts
   (fast Largest Contentful Paint). Under the home-page intro it simply sits ready; the intro's lift reveals it. */
.js .hero [data-reveal], .js .page-hero [data-reveal] { opacity: 1; transform: none; transition: none; will-change: auto; animation: hero-in .9s var(--ease-out) var(--d, 0ms) both; }
.js .hero [data-reveal="rise"], .js .page-hero [data-reveal="rise"] { animation-name: hero-rise; }
.js .page-hero [data-reveal="scale"] { animation-name: hero-scale; }
html.intro-on .hero [data-reveal] { animation: none; }
@keyframes hero-in { from { opacity: .01; transform: translate3d(0, 22px, 0); } to { opacity: 1; transform: none; } }
@keyframes hero-scale { from { opacity: .01; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes hero-rise { from { opacity: .01; transform: translate3d(0, 48px, 0) scale(.97); } to { opacity: 1; transform: none; } }
/* split-text headlines: words rise out of a mask */
.sw { display: inline-block; overflow: hidden; vertical-align: top; padding-block: .08em .16em; margin-block: -.08em -.16em; }
.sw__i { display: inline-block; }
.js [data-split] .sw__i { transform: translate3d(0, 110%, 0); transition: transform 1s var(--ease-out) calc(var(--wi) * 55ms + var(--d, 0ms)); }
.js [data-split].is-in .sw__i { transform: none; }

/* ───────────────────────────── page transitions ───────────────────────────── */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .26s var(--ease-in-out) both; }
::view-transition-new(root) { animation: vt-in .42s var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }
.view-enter { animation: vt-in .42s var(--ease-out) both; }

/* ───────────────────────────── ocean decor ───────────────────────────── */
/* A block of sea: set --sea-top / --sea-bottom to place it on the depth scale. */
.ocean { position: relative; isolation: isolate; background: linear-gradient(180deg, var(--sea-top, #12607A) 0%, var(--sea-mid, var(--deep-700)) 45%, var(--sea-bottom, var(--deep-900)) 100%); overflow: hidden; overflow: clip; }
.ocean > * { position: relative; z-index: 1; }
.decor { position: absolute; inset: 0; z-index: 0 !important; pointer-events: none; overflow: hidden; }
.decor canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* light rays falling through the water */
.rays { position: absolute; inset: -12% -30% 0; background: repeating-linear-gradient(98deg, transparent 0 5.5%, rgba(255, 255, 255, .055) 7% 9.5%, transparent 12% 19%, rgba(255, 255, 255, .035) 21% 22.5%, transparent 25% 31%); -webkit-mask-image: linear-gradient(to bottom, #000 0, rgba(0, 0, 0, .55) 45%, transparent 88%); mask-image: linear-gradient(to bottom, #000 0, rgba(0, 0, 0, .55) 45%, transparent 88%); transform-origin: 50% 0; animation: rays-sway 18s var(--ease-in-out) infinite alternate; }
.rays--gold { background: repeating-linear-gradient(98deg, transparent 0 5.5%, rgba(229, 197, 104, .07) 7% 9.5%, transparent 12% 19%, rgba(229, 197, 104, .04) 21% 22.5%, transparent 25% 31%); }
@keyframes rays-sway { from { transform: translate3d(-4%, 0, 0) skewX(-5deg); opacity: .75; } to { transform: translate3d(4%, 0, 0) skewX(4deg); opacity: 1; } }
/* soft pools of light (caustics) drifting */
.pool { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; background: radial-gradient(closest-side, rgba(79, 209, 217, .16), transparent 70%); animation: pool-drift 26s ease-in-out infinite alternate; }
.pool--gold { background: radial-gradient(closest-side, rgba(204, 153, 51, .16), transparent 70%); animation-duration: 32s; }
@keyframes pool-drift { from { transform: translate3d(-6%, -4%, 0) scale(1); } to { transform: translate3d(8%, 6%, 0) scale(1.15); } }
/* Islamic geometric pattern (eight-point star lattice) */
.geo { position: absolute; inset: 0; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23E5C568' stroke-width='1'%3E%3Cpath d='M48 10 59.1 36.9 86 48 59.1 59.1 48 86 36.9 59.1 10 48 36.9 36.9Z'/%3E%3Crect x='21.1' y='21.1' width='53.8' height='53.8'/%3E%3Crect x='21.1' y='21.1' width='53.8' height='53.8' transform='rotate(45 48 48)'/%3E%3Cpath d='M0 0l21.1 21.1M96 0 74.9 21.1M0 96l21.1-21.1M96 96 74.9 74.9M48 0v10M48 86v10M0 48h10M86 48h10'/%3E%3C/g%3E%3C/svg%3E"); background-size: 96px 96px; opacity: .07; }
[data-theme="pearl"] .geo { opacity: .16; }
.geo--fade { -webkit-mask-image: radial-gradient(ellipse at center, #000 0, transparent 72%); mask-image: radial-gradient(ellipse at center, #000 0, transparent 72%); }
/* wave divider between sections: <svg class="wave"> with a path, fill = next section colour */
.wave { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: clamp(40px, 7vw, 110px); z-index: 2; pointer-events: none; }
.wave--top { bottom: auto; top: -1px; transform: scaleY(-1); }
/* anything looping pauses while its section is off screen */
.is-offscreen *, .is-offscreen *::before, .is-offscreen *::after { animation-play-state: paused !important; }

/* ───────────────────────────── pearl / shell / strand ───────────────────────────── */
.pearl { display: block; overflow: visible; }
.pearl .pl-halo, .shell .sh-glow, .shell .sh-pearl { transform-box: fill-box; transform-origin: 50% 50%; }
.pearl--glow .pl-halo { animation: pearl-breathe 3.6s ease-in-out infinite; }
@keyframes pearl-breathe { 0%, 100% { transform: scale(.86); opacity: .18; } 50% { transform: scale(1.06); opacity: .4; } }
.pearl--float { animation: pearl-float 5s ease-in-out infinite; }
@keyframes pearl-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.shell { display: block; overflow: visible; transform-origin: 50% 70%; }
.shell .sh-front { transform-box: view-box; transform-origin: 100px 118px; }
.shell.is-open .sh-front { transform: scaleY(-.46); }
.shell.is-closed .sh-in, .shell.is-open .sh-out { opacity: 0; }
.shell.is-closed .sh-glow, .shell.is-closed .sh-pearl { opacity: 0; }
.shell.is-open .sh-pearl { transform: translateY(-6px); }
.shell.is-open .sh-glow { opacity: .75; }
.shell.is-open.shell--live .sh-glow { animation: shell-glow 3.4s ease-in-out infinite; }
.shell.is-closed.shell--live { animation: shell-idle 4.5s ease-in-out infinite; }
@keyframes shell-glow { 0%, 100% { opacity: .5; transform: scale(.92); } 50% { opacity: .9; transform: scale(1.06); } }
@keyframes shell-idle { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-5px) rotate(-1.2deg); } }
.strand { display: block; width: 100%; height: auto; overflow: visible; }
.strand .st-bead { transform-box: fill-box; transform-origin: 50% 50%; }
.strand .st-pulse { transform-box: fill-box; transform-origin: 50% 50%; animation: st-pulse 2.2s ease-out infinite; }
@keyframes st-pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(2.1); opacity: 0; } }

/* ───────────────────────────── logo ───────────────────────────── */
.brand-logo, .brand-mark, .brand-word { display: block; height: 100%; width: auto; overflow: visible; }
.bl-square, .bl-letter, .bl-book, .bl-callig path { fill: var(--logo-gold); }
.bl-circle { fill: var(--logo-disc); }
.bl-ink path { fill: var(--logo-ink); }
.bl-callig path { stroke: var(--logo-gold); stroke-width: 0; stroke-linecap: round; stroke-linejoin: round; }
.bl-square, .bl-circle, .bl-letter, .bl-book, .bl-ink path { transform-box: fill-box; transform-origin: 50% 50%; }
/* on the deep sea the wordmark is drawn in the lighter gold so it stays readable */
.logo--light .bl-letter, .logo--light .bl-book { fill: var(--gold-300); }

/* ───────────────────────────── tap ripple + celebration canvas ───────────────────────────── */
.ripple { position: absolute; border-radius: 50%; pointer-events: none; background: radial-gradient(closest-side, transparent 55%, currentColor 60%, transparent 72%); opacity: .35; transform: scale(0); animation: ripple .7s var(--ease-out) forwards; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
.fx-overlay { position: fixed; inset: 0; width: 100%; height: 100%; z-index: var(--z-toast); pointer-events: none; }

/* ───────────────────────────── reduced motion ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .js [data-reveal], .js [data-split] .sw__i { opacity: 1 !important; transform: none !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
/* "Calmer animations" switch in the learner profile */
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
html.reduce-motion.js [data-reveal], html.reduce-motion.js [data-split] .sw__i { opacity: 1 !important; transform: none !important; }

@media print { .no-print { display: none !important; } }
