/* =========================================================
   DEWAN — 3D experience (/experience/)
   A fixed WebGL canvas behind tall scroll chapters. Each
   chapter's panel is sticky; experience.js sets its --o.
   ========================================================= */
@font-face { font-family: 'Inter'; src: url("fonts/web/inter-400.42f347537497.woff2") format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url("fonts/web/inter-600.54a07fde280f.woff2") format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Akhand'; src: url("fonts/web/akhand-700.6849dbe11c23.woff2") format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Akhand'; src: url("fonts/web/akhand-800.da943fa69fd0.woff2") format('woff2'); font-weight: 800 900; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url("fonts/web/plex-arabic-400.4fa3d81d41ab.woff2") format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'Noto Kufi Arabic'; src: url("fonts/web/kufi-arabic-700.bd18b7a9da0a.woff2") format('woff2'); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'Noto Kufi Arabic'; src: url("fonts/web/kufi-arabic-800.5c19e1ba7a44.woff2") format('woff2'); font-weight: 800 900; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC; }

:root {
    --ink: #050403;
    --gold: #DABE82;
    --gold-soft: #EBD5A6;
    --gold-pale: #F7ECD4;
    --gold-deep: #A8884E;
    --gold-line: rgba(218, 190, 130, 0.36);
    --ivory: #F4EFE6;
    --body: #C9C1B3;
    --muted: #9B9488;
    --font-display: 'Akhand', 'Arial Narrow', sans-serif;
    --font-body: 'Inter', -apple-system, 'Segoe UI', sans-serif;
    --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
    --gutter: clamp(16px, 5vw, 88px);
}
html[lang="ar"] {
    --font-display: 'Noto Kufi Arabic', 'IBM Plex Sans Arabic', sans-serif;
    --font-body: 'IBM Plex Sans Arabic', 'Inter', Tahoma, sans-serif;
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--ink); color-scheme: dark; }
body { background: var(--ink); color: var(--ivory); font-family: var(--font-body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
body.is-loading { overflow: hidden; }
a { color: inherit; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.xp-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a:focus-visible { outline: 1px solid var(--gold-pale); outline-offset: 4px; }

.xp-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
.xp-vignette { position: fixed; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55)); }

/* Loader: a gold ring fills while textures and the engine load. */
.xp-loader {
    position: fixed; inset: 0; z-index: 50;
    display: grid; place-items: center; place-content: center; gap: 22px;
    background: var(--ink);
    transition: opacity 1.1s var(--ease), visibility 1.1s;
}
.xp-loader-ring { position: absolute; width: 132px; height: 132px; top: 50%; left: 50%; translate: -50% calc(-50% - 22px); transform: rotate(-90deg); }
.xp-loader-ring circle { fill: none; stroke-width: 1.5; }
.xp-loader-ring .track { stroke: rgba(218, 190, 130, 0.14); }
.xp-loader-ring .bar { stroke: var(--gold); stroke-dasharray: 339.3; stroke-dashoffset: 339.3; stroke-linecap: round; transition: stroke-dashoffset 0.4s var(--ease); filter: drop-shadow(0 0 6px rgba(218, 190, 130, 0.8)); }
.xp-loader-logo { width: 64px; height: 64px; object-fit: contain; animation: xp-breathe 2.4s ease-in-out infinite; }
.xp-loader-text { margin-top: 52px; font: 600 10.5px/1 var(--font-body); letter-spacing: 0.32em; text-transform: uppercase; color: var(--muted); }
.xp-loader-text b { color: var(--gold); font-weight: 600; }
@keyframes xp-breathe { 50% { opacity: 0.55; transform: scale(0.94); } }
body:not(.is-loading) .xp-loader { opacity: 0; visibility: hidden; }

/* Arrival from the homepage: the door's light fills the screen, then fades into the scene. */
.xp-flash { position: fixed; inset: 0; z-index: 60; pointer-events: none; background: radial-gradient(circle, #FFF8E8 0%, #F2DBA6 45%, #C9A462 100%); opacity: 0; transition: opacity 2.2s var(--ease); }
html.xp-from-door .xp-flash { opacity: 1; transition: none; }
html.xp-from-door .xp-loader { z-index: 61; background: transparent; }
html.xp-from-door .xp-loader-ring .track { stroke: rgba(21, 17, 10, 0.15); }
html.xp-from-door .xp-loader-ring .bar { stroke: #15110A; filter: none; }
html.xp-from-door .xp-loader-text, html.xp-from-door .xp-loader-text b { color: #3A2D16; }

/* Top bar */
.xp-bar {
    position: fixed; z-index: 20; top: 0; left: 0; right: 0;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
    padding: 18px var(--gutter);
    pointer-events: none;
}
.xp-bar > * { pointer-events: auto; }
.xp-exit, .xp-cta-mini {
    display: inline-flex; align-items: center; gap: 10px; width: fit-content;
    min-height: 40px; padding: 0 18px;
    border: 1px solid rgba(236, 222, 196, 0.17); border-radius: 999px;
    background: rgba(10, 9, 8, 0.45); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    font: 600 10.5px/1 var(--font-body); letter-spacing: 0.2em; text-transform: uppercase; text-decoration: none; color: var(--body);
    transition: color 0.4s var(--ease), border-color 0.4s var(--ease), background-color 0.4s var(--ease);
}
.xp-exit:hover { color: var(--gold-pale); border-color: var(--gold-line); }
.xp-cta-mini { justify-self: end; background: var(--gold); border-color: var(--gold); color: #15110A; }
.xp-cta-mini:hover { background: var(--gold-pale); }
.xp-meter { display: flex; align-items: center; gap: 14px; font: 600 10px/1 var(--font-body); letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); }
.xp-meter-no { color: var(--gold); }
.xp-meter-line { position: relative; width: clamp(80px, 12vw, 180px); height: 1px; background: rgba(236, 222, 196, 0.17); overflow: hidden; }
.xp-meter-line span { position: absolute; inset: 0; background: linear-gradient(90deg, var(--gold-deep), var(--gold-pale)); transform-origin: left; transform: scaleX(0); }
html[dir="rtl"] .xp-meter-line span { transform-origin: right; }
.xp-meter-name { min-width: 110px; color: var(--ivory); }

/* Chapters: tall scroll tracks with a sticky, full-screen panel. */
.xp-scroll { position: relative; z-index: 2; }
.xp-ch { position: relative; height: var(--h, 200vh); }
.xp-panel {
    --o: 0;
    position: sticky; top: 0;
    height: 100vh; height: 100svh;
    display: flex; flex-direction: column; justify-content: center;
    padding: 96px var(--gutter) 64px;
    opacity: var(--o);
    transform: translateY(calc((1 - var(--o)) * 24px));
    pointer-events: none;
}
.xp-panel a { pointer-events: auto; }
.xp-ch:first-child .xp-panel { --o: 1; }
.xp-center { align-items: center; text-align: center; }
.xp-side { max-width: min(560px, 100%); }
.xp-bottom { justify-content: flex-end; padding-bottom: clamp(48px, 9vh, 96px); }

.xp-kicker {
    display: inline-flex; align-items: center; gap: 10px; width: fit-content; margin-bottom: 24px;
    padding: 7px 14px; border: 1px solid var(--gold-line); border-radius: 999px; background: rgba(10, 9, 8, 0.4); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    font: 600 10px/1.3 var(--font-body); letter-spacing: 0.28em; text-transform: uppercase; color: var(--gold);
}
.xp-kicker::before { content: ''; width: 5px; height: 5px; background: currentColor; transform: rotate(45deg); }
.xp-h1, .xp-h2, .xp-manifesto { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; line-height: 0.95; letter-spacing: 0.005em; text-wrap: balance; text-shadow: 0 6px 40px rgba(0, 0, 0, 0.6); }
.xp-h1 { font-size: clamp(54px, 9vw, 148px); }
.xp-h2 { margin-bottom: 26px; font-size: clamp(38px, 4.6vw, 72px); }
.xp-h1 em, .xp-h2 em, .gold-shimmer, .xp-new {
    font-style: normal;
    background: linear-gradient(100deg, var(--gold-pale) 0%, var(--gold) 55%, var(--gold-deep) 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.xp-lead { max-width: 520px; margin-top: 22px; color: var(--body); font-size: 16px; line-height: 1.75; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.8); }
.xp-center .xp-lead { margin-inline: auto; }
.xp-scrollhint { display: inline-flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 48px; font: 600 10px/1 var(--font-body); letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted); }
.xp-scrollhint i { position: relative; width: 1px; height: 46px; background: rgba(236, 222, 196, 0.17); overflow: hidden; }
.xp-scrollhint i::after { content: ''; position: absolute; left: 0; width: 1px; height: 16px; background: var(--gold-pale); animation: xp-drip 1.8s var(--ease) infinite; }
@keyframes xp-drip { from { top: -16px; } to { top: 46px; } }

.xp-manifesto { display: grid; gap: 0.1em; font-size: clamp(48px, 8.4vw, 136px); }
.xp-old s { position: relative; text-decoration: none; color: var(--muted); }
.xp-old s::after { content: ''; position: absolute; left: -2%; right: -2%; top: 52%; height: 0.07em; background: linear-gradient(90deg, var(--gold-deep), var(--gold-pale)); box-shadow: 0 0 18px rgba(218, 190, 130, 0.8); transform: scaleX(var(--strike, 1)); transform-origin: left; }
html[dir="rtl"] .xp-old s::after { transform-origin: right; }
.xp-new { opacity: var(--reveal, 1); }

.xp-steps { list-style: none; display: grid; gap: 4px; }
.xp-steps li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(236, 222, 196, 0.08); opacity: 0.38; transition: opacity 0.6s var(--ease); }
.xp-steps b { font: 700 13px/1.6 var(--font-display); letter-spacing: 0.1em; color: var(--gold); }
.xp-steps strong { display: block; font: 700 22px/1.1 var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; }
.xp-steps small { display: block; max-height: 0; overflow: hidden; color: var(--body); font-size: 14px; line-height: 1.6; transition: max-height 0.6s var(--ease), margin 0.6s var(--ease); }
.xp-steps li.is-on { opacity: 1; }
.xp-steps li.is-on small { max-height: 60px; margin-top: 6px; }

.xp-detail { display: flex; gap: 18px; margin-top: 30px; padding: 22px 24px; border: 1px solid var(--gold-line); border-radius: 18px; background: rgba(14, 12, 10, 0.55); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.xp-detail b { font: 800 42px/0.9 var(--font-display); color: var(--gold); }
.xp-detail strong { display: block; margin-bottom: 6px; font: 700 24px/1 var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; }
.xp-detail small { display: block; color: var(--body); font-size: 14px; line-height: 1.65; }
.xp-detail.is-swapping > * { animation: xp-swap 0.6s var(--ease); }
@keyframes xp-swap { from { opacity: 0; transform: translateY(8px); } }

.xp-link { margin-top: 26px; width: fit-content; font: 600 11px/1 var(--font-body); letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); text-decoration: none; border-bottom: 1px solid var(--gold-line); padding-bottom: 6px; }
.xp-center .xp-link { margin-inline: auto; }
.xp-final .xp-h1 { font-size: clamp(46px, 7.4vw, 120px); }
.xp-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 40px; }
.xp-btn {
    display: inline-flex; align-items: center; justify-content: center; min-height: 56px; padding: 0 30px;
    border: 1px solid var(--gold); border-radius: 999px; background: var(--gold); color: #15110A;
    font: 600 11.5px/1 var(--font-body); letter-spacing: 0.18em; text-transform: uppercase; text-decoration: none;
    box-shadow: 0 0 40px rgba(218, 190, 130, 0.35);
    transition: background-color 0.4s var(--ease), box-shadow 0.4s var(--ease), color 0.4s var(--ease);
}
.xp-btn:hover { background: var(--gold-pale); box-shadow: 0 0 60px rgba(218, 190, 130, 0.55); }
.xp-btn.ghost { background: rgba(10, 9, 8, 0.5); color: var(--ivory); border-color: rgba(236, 222, 196, 0.25); box-shadow: none; backdrop-filter: blur(8px); }
.xp-btn.ghost:hover { border-color: var(--gold); color: var(--gold-pale); }

/* Arabic: no letter-spacing (it breaks joining), no forced capitals, taller lines. */
html[lang="ar"] *, html[lang="ar"] *::before { letter-spacing: 0 !important; }
html[lang="ar"] .xp-h1, html[lang="ar"] .xp-h2, html[lang="ar"] .xp-manifesto, html[lang="ar"] .xp-steps strong, html[lang="ar"] .xp-detail strong { line-height: 1.4; text-transform: none; }
html[lang="ar"] .xp-h1 { font-size: clamp(40px, 6.6vw, 104px); }
html[lang="ar"] .xp-manifesto { font-size: clamp(38px, 6.4vw, 100px); }

/* Without WebGL the chapters read as a plain page. */
body.xp-nogl .xp-ch { height: auto; }
body.xp-nogl .xp-panel { --o: 1 !important; position: relative; height: auto; min-height: 80vh; }

@media (max-width: 760px) {
    .xp-bar { grid-template-columns: 1fr auto; padding: 12px 16px; }
    .xp-meter { display: none; }
    .xp-exit, .xp-cta-mini { min-height: 38px; padding: 0 14px; font-size: 9.5px; letter-spacing: 0.14em; }
    .xp-panel { padding: 80px 16px 40px; }
    /* On phones the 3D objects take the top of the screen and the copy sits at the bottom. */
    .xp-side { justify-content: flex-end; }
    .xp-h2 { font-size: clamp(32px, 9vw, 44px); margin-bottom: 18px; }
    .xp-steps li { padding: 6px 0; }
    .xp-steps strong { font-size: 18px; }
    .xp-steps li:not(.is-on) { display: none; }
    .xp-detail { padding: 16px 18px; }
    .xp-detail b { font-size: 34px; }
    .xp-lead { font-size: 14.5px; }
}
@media (prefers-reduced-motion: reduce) {
    .xp-scrollhint i::after, .xp-loader-logo { animation: none; }
}
