:root {
  --bg: #F7F7F5; --bg-2: #EDEDEA; --ink: #0C0C0D; --ink-2: #3A3A3E; --muted: #6B6B70;
  --rule: rgba(12, 12, 13, .11); --accent: #2B2BD9; --accent-soft: rgba(43, 43, 217, .09); --on-accent: #fff;
  --sans: "Geist", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --serif: "Cormorant Garamond", Georgia, serif;
  --tfng: "Noto Sans Tifinagh", sans-serif;
  --ar: "IBM Plex Sans Arabic", "Geeza Pro", sans-serif;
  --ease: cubic-bezier(.2, .7, 0, 1);
  --intro: .15s;
  color-scheme: light;
  interpolate-size: allow-keywords;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09090A; --bg-2: #161618; --ink: #F2F2EF; --ink-2: #C8C8C5; --muted: #8E8E93;
    --rule: rgba(255, 255, 255, .1); --accent: #8C8CFF; --accent-soft: rgba(140, 140, 255, .13); --on-accent: #09090A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #09090A; --bg-2: #161618; --ink: #F2F2EF; --ink-2: #C8C8C5; --muted: #8E8E93;
  --rule: rgba(255, 255, 255, .1); --accent: #8C8CFF; --accent-soft: rgba(140, 140, 255, .13); --on-accent: #09090A;
  color-scheme: dark;
}
html.arriving { --intro: .75s; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 6rem; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans); letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color .5s var(--ease), color .5s var(--ease);
}
[dir="rtl"] body { font-family: var(--ar); line-height: 1.85; letter-spacing: 0; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule); text-decoration-thickness: 1px; text-underline-offset: .22em; transition: color .2s, text-decoration-color .2s; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
cite, em { font-style: italic; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ltr { direction: ltr; text-align: left; font-family: var(--sans); line-height: 1.6; letter-spacing: -0.006em; }
.lat { font-family: var(--sans); }
bdi { unicode-bidi: isolate; }
.wrap { max-width: 80rem; margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 3rem); }

/* Progress + curtain */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); z-index: 60; }
[dir="rtl"] .progress { transform-origin: 100% 50%; }
.curtain { position: fixed; inset: 0; z-index: 100; background: var(--ink); color: var(--bg); display: grid; place-items: center; pointer-events: none; transform: translateY(100%); }
.curtain span { font: 500 clamp(2.5rem, 8vw, 6rem)/1 var(--sans); letter-spacing: -0.04em; opacity: 0; transition: opacity .4s .2s; }
.curtain span:lang(ar) { font-family: var(--ar); letter-spacing: 0; }
.curtain.cover { transform: none; transition: transform .6s var(--ease); pointer-events: auto; }
.curtain.cover span { opacity: 1; }
html.arriving .curtain { transform: none; }
html.arriving .curtain.leave { transform: translateY(-100%); transition: transform .85s var(--ease); }

/* Header */
.site-head { position: fixed; top: 0; left: 0; right: 0; z-index: 40; transition: transform .5s var(--ease), background-color .4s, border-color .4s; border-bottom: 1px solid transparent; }
.site-head.scrolled { background: color-mix(in oklab, var(--bg) 78%, transparent); -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5); border-bottom-color: var(--rule); }
.site-head.hide { transform: translateY(-105%); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 4.5rem; }
.site-name { font-weight: 600; font-size: .98rem; letter-spacing: -0.02em; text-decoration: none; }
[dir="rtl"] .site-name { letter-spacing: 0; font-size: 1.05rem; }
.tools { display: flex; align-items: center; gap: .5rem; }
.lang, .theme-toggle {
  height: 2.5rem; border-radius: 999px; border: 1px solid var(--rule); color: var(--ink);
  background: color-mix(in oklab, var(--bg) 70%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer;
  transition: border-color .25s, background-color .25s, color .25s;
}
.lang { font-family: var(--ar); font-size: .92rem; padding: 0 1.05rem; }
[dir="rtl"] .lang { font-family: var(--sans); }
.theme-toggle { appearance: none; width: 2.5rem; padding: 0; }
.lang:hover, .theme-toggle:hover { border-color: var(--ink); color: var(--ink); }
.theme-toggle .ic-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ic-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .ic-moon { display: none; }

.site-nav {
  position: fixed; z-index: 45; top: .9rem; left: 50%; transform: translateX(-50%);
  display: flex; gap: .1rem; padding: .3rem; border-radius: 999px;
  background: color-mix(in oklab, var(--bg) 72%, transparent); -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid var(--rule); box-shadow: 0 10px 30px -14px rgba(0, 0, 0, .25);
}
.site-nav a { position: relative; z-index: 1; font-size: .86rem; color: var(--ink-2); text-decoration: none; padding: .5rem .95rem; border-radius: 999px; white-space: nowrap; transition: color .35s var(--ease); }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="true"] { color: var(--bg); }
.nav-ind { position: absolute; left: 0; top: .3rem; bottom: .3rem; width: 0; border-radius: 999px; background: var(--ink); opacity: 0; transition: transform .55s var(--ease), width .55s var(--ease), opacity .3s; }

/* Hero */
.hero { min-height: 100svh; display: flex; flex-direction: column; justify-content: space-between; gap: 3rem; padding: 7.5rem 0 clamp(2rem, 5vw, 3.5rem); }
.hero > .wrap { width: 100%; }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 2rem; }
.eyebrow { margin: 0; font-size: clamp(1.5rem, 3.2vw, 2.75rem); line-height: 1.2; letter-spacing: -0.03em; max-width: 36rem; text-wrap: balance; color: var(--muted); opacity: 0; animation: up 1s var(--ease) calc(var(--intro) + .4s) forwards; }
.eyebrow strong { display: block; font-weight: 500; color: var(--ink); margin-bottom: .35em; }
[dir="rtl"] .eyebrow { letter-spacing: 0; line-height: 1.5; }
.portrait { margin: 0; width: clamp(13rem, 22vw, 18rem); aspect-ratio: 4 / 5; border-radius: 1rem; overflow: hidden; position: relative; background: var(--bg-2); display: grid; place-items: center; opacity: 0; animation: fade 1.2s var(--ease) calc(var(--intro) + .5s) forwards; }
.portrait::before { content: "HS"; font-weight: 600; font-size: 2rem; color: var(--muted); }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.14); animation: settle 1.8s var(--ease) calc(var(--intro) + .5s) forwards; }
h1 { font-weight: 600; font-size: clamp(3.6rem, 14vw, 13rem); line-height: .86; letter-spacing: -0.058em; margin: 0 0 0 -.04em; }
h1 .line { display: block; overflow: hidden; padding-bottom: .07em; }
h1 .line > span { display: inline-block; transform: translateY(108%); animation: rise 1.2s var(--ease) var(--intro) forwards; }
h1 .line:nth-child(2) > span { animation-delay: calc(var(--intro) + .1s); }
[dir="rtl"] h1 { font-family: var(--ar); letter-spacing: 0; line-height: 1.08; margin: 0; font-size: clamp(3.4rem, 12vw, 11rem); }
[dir="rtl"] h1 .line { padding: .08em 0 .12em; }
.hero-foot { position: relative; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1.25rem 2rem; margin-top: 2.5rem; padding-top: 1.5rem; align-items: baseline; }
.hero-foot::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--rule); transform: scaleX(0); transform-origin: 0 50%; animation: draw 1.4s var(--ease) calc(var(--intro) + .3s) forwards; }
[dir="rtl"] .hero-foot::before { transform-origin: 100% 50%; }
.tfng { grid-column: 1 / 5; margin: 0; font-family: var(--tfng); font-size: 1.35rem; letter-spacing: .08em; color: var(--ink); }
.tfng span[aria-hidden] { display: inline-block; opacity: 0; filter: blur(8px); transform: translateY(6px); animation: glyph .9s var(--ease) calc(var(--intro) + .6s + var(--i) * 70ms) forwards; }
.role { grid-column: 5 / 13; margin: 0; font-size: clamp(1.15rem, 1.8vw, 1.5rem); line-height: 1.4; letter-spacing: -0.02em; max-width: 40rem; text-wrap: pretty; opacity: 0; animation: up 1s var(--ease) calc(var(--intro) + .75s) forwards; }
[dir="rtl"] .role { letter-spacing: 0; line-height: 1.7; }
.role span { color: var(--muted); }
@keyframes rise { to { transform: none; } }
@keyframes up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { to { opacity: 1; } }
@keyframes settle { to { transform: none; } }
@keyframes draw { to { transform: scaleX(1); } }
@keyframes glyph { to { opacity: 1; filter: none; transform: none; } }

/* Specimen */
.specimen { border-top: 1px solid var(--rule); padding: clamp(4.5rem, 9vw, 8rem) 0; }
.spec-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 3rem clamp(2rem, 6vw, 6rem); align-items: center; }
.kicker { font-family: var(--mono); font-size: .78rem; color: var(--accent); margin: 0 0 1.25rem; }
[dir="rtl"] .kicker { font-family: var(--ar); font-size: .95rem; }
.spec-text { margin: 0; font-size: 1.2rem; line-height: 1.5; letter-spacing: -0.015em; text-wrap: pretty; }
[dir="rtl"] .spec-text { letter-spacing: 0; line-height: 1.85; }
.legend { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2rem; }
.chip { appearance: none; font: inherit; font-size: .88rem; display: inline-flex; align-items: center; gap: .6rem; padding: .4rem 1rem .4rem .4rem; border-radius: 999px; border: 1px solid var(--rule); background: transparent; color: var(--ink-2); cursor: pointer; transition: border-color .3s, color .3s, background-color .3s; }
[dir="rtl"] .chip { padding: .4rem .4rem .4rem 1rem; }
.chip .m { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 1.15rem; line-height: 1; min-width: 2rem; height: 2rem; padding: 0 .45rem; display: grid; place-items: center; border-radius: 999px; background: var(--accent-soft); color: var(--accent); transition: background-color .3s, color .3s; }
.chip:hover { border-color: var(--ink-2); color: var(--ink); }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); }
.chip[aria-pressed="true"] .m { background: var(--accent); color: var(--on-accent); }
.explain { margin: 1.25rem 0 0; min-height: 3.3em; max-width: 28rem; color: var(--muted); font-size: .98rem; }
.paradigm { list-style: none; margin: 0; padding: 0; }
.paradigm li { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.2fr) 8.5rem; align-items: baseline; gap: 1.25rem; padding: 1.15rem 0; border-top: 1px solid var(--rule); transition: opacity .45s var(--ease); }
.paradigm li:last-child { border-bottom: 1px solid var(--rule); }
.sg, .pl { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: clamp(2.3rem, 5vw, 4.25rem); line-height: 1; }
.sg { color: var(--muted); }
.arrow { color: var(--muted); font-size: 1.2rem; }
.meta { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--muted); line-height: 1.35; }
.meta .type { font-family: var(--mono); font-size: .7rem; color: var(--ink-2); }
.meta [lang="ar"] { font-family: var(--ar); }
.x { color: var(--accent); border-radius: .14em; padding: 0 .04em; cursor: pointer; transition: background-color .35s var(--ease), color .35s var(--ease); }
.specimen[data-active="pre"] .x[data-m="pre"], .specimen[data-active="int"] .x[data-m="int"], .specimen[data-active="suf"] .x[data-m="suf"] { background: var(--accent); color: var(--on-accent); }
.specimen[data-active="pre"] .paradigm li:not(:has([data-m="pre"])),
.specimen[data-active="int"] .paradigm li:not(:has([data-m="int"])),
.specimen[data-active="suf"] .paradigm li:not(:has([data-m="suf"])) { opacity: .28; }

/* Sections */
section.block { border-top: 1px solid var(--rule); padding: clamp(4.5rem, 9vw, 8rem) 0; }
.block .wrap { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2rem; }
.block .head { grid-column: 1 / 5; }
.block .head h2 { position: sticky; top: 6.5rem; }
.block .body { grid-column: 5 / 13; max-width: 52rem; }
h2 { font-weight: 500; font-size: clamp(2.5rem, 5vw, 4.25rem); line-height: .96; letter-spacing: -0.048em; margin: 0; }
[dir="rtl"] h2 { font-weight: 600; letter-spacing: 0; line-height: 1.3; font-size: clamp(2.2rem, 4vw, 3.4rem); }
h3 { font-family: var(--mono); font-weight: 400; font-size: .78rem; color: var(--muted); margin: 4rem 0 .5rem; }
[dir="rtl"] h3 { font-family: var(--ar); font-size: .95rem; }
h3:first-child { margin-top: 0; }
.block p { margin: 0 0 1.1rem; color: var(--ink-2); text-wrap: pretty; }
.block p:last-child { margin-bottom: 0; }
.block p.lead { font-size: clamp(1.3rem, 2.1vw, 1.7rem); line-height: 1.38; letter-spacing: -0.022em; color: var(--ink); margin-bottom: 1.5rem; }
[dir="rtl"] .block p.lead { letter-spacing: 0; line-height: 1.75; }

.threads { margin: 3rem 0; border-bottom: 1px solid var(--rule); }
.thread { border-top: 1px solid var(--rule); }
.thread summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; padding: 1.5rem 0; cursor: pointer; font-size: clamp(1.2rem, 2vw, 1.55rem); font-weight: 500; letter-spacing: -0.025em; line-height: 1.2; transition: color .25s; }
[dir="rtl"] .thread summary { letter-spacing: 0; line-height: 1.5; }
.thread summary::-webkit-details-marker { display: none; }
.thread summary:hover { color: var(--accent); }
.t-icon { flex: none; position: relative; width: 2.25rem; height: 2.25rem; border-radius: 999px; border: 1px solid var(--rule); transition: transform .5s var(--ease), background-color .3s, border-color .3s; }
.t-icon::before, .t-icon::after { content: ""; position: absolute; left: 50%; top: 50%; width: .8rem; height: 1.5px; background: currentColor; transform: translate(-50%, -50%); transition: transform .5s var(--ease); }
.t-icon::after { transform: translate(-50%, -50%) rotate(90deg); }
.thread[open] .t-icon { transform: rotate(180deg); background: var(--ink); border-color: var(--ink); color: var(--bg); }
.thread[open] .t-icon::after { transform: translate(-50%, -50%) rotate(0deg); }
.thread::details-content { block-size: 0; overflow: hidden; transition: block-size .55s var(--ease), content-visibility .55s allow-discrete; }
.thread[open]::details-content { block-size: auto; }
.thread .t-body { padding: 0 3.5rem 1.75rem 0; color: var(--ink-2); max-width: 44rem; }
[dir="rtl"] .thread .t-body { padding: 0 0 1.75rem 3.5rem; }

.pubs { list-style: none; margin: 0; padding: 0; }
.pub { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 1.5rem; padding: 1.5rem 0; border-top: 1px solid var(--rule); }
.pubs .pub:last-child { border-bottom: 1px solid var(--rule); }
.pub .year { font-family: var(--mono); font-size: .8rem; color: var(--muted); padding-top: .25rem; }
.ref-text { color: var(--ink-2); }
.pub cite { color: var(--ink); }
.status { display: block; margin-top: .4rem; color: var(--muted); font-size: .93rem; }
.ref-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.ref-actions a, .ref-actions button, .copy-email { appearance: none; font: inherit; font-size: .8rem; font-weight: 500; line-height: 1; padding: .6rem 1rem; border-radius: 999px; border: 1px solid var(--rule); background: transparent; color: var(--ink); text-decoration: none; cursor: pointer; transition: background-color .25s, color .25s, border-color .25s; }
.ref-actions a:hover, .ref-actions button:hover, .copy-email:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ref-actions .done, .copy-email.done { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
[lang="ar"].copy-cite, [lang="ar"].copy-email, .copy-email:lang(ar) { font-family: var(--ar); }

.timeline { position: relative; --col: 4.5rem; --dot: 1.75rem; }
.timeline::before, .tl-fill { content: ""; position: absolute; top: .5rem; bottom: .5rem; left: calc(var(--col) + var(--dot) / 2); width: 1px; background: var(--rule); }
.tl-fill { background: var(--accent); transform-origin: top; transform: scaleY(var(--p, 0)); }
.tl-year, .tl-item { display: grid; grid-template-columns: var(--col) var(--dot) minmax(0, 1fr); column-gap: 1rem; }
.tl-year { padding: 0 0 .75rem; }
.tl-year:not(:first-child) { padding-top: 3rem; }
.tl-year span { grid-column: 3; font-size: clamp(2.5rem, 5vw, 3.75rem); font-weight: 300; letter-spacing: -0.05em; line-height: 1; color: var(--muted); }
.tl { list-style: none; margin: 0; padding: 0; }
.tl-item { padding: 1rem 0; align-items: start; }
.tl-item time { font-family: var(--mono); font-size: .75rem; color: var(--muted); text-align: right; padding-top: .3rem; text-transform: uppercase; }
.tl-item .dot { justify-self: center; margin-top: .5rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--muted); position: relative; z-index: 1; transition: background-color .4s, border-color .4s, transform .4s var(--ease); }
.tl-item.on .dot { background: var(--accent); border-color: var(--accent); transform: scale(1.15); }
.tl-title { margin: 0; font-size: 1.1rem; font-weight: 500; letter-spacing: -0.015em; color: var(--ink); line-height: 1.4; }
.venue { display: block; margin-top: .3rem; color: var(--muted); font-size: .95rem; font-weight: 400; letter-spacing: 0; }

.facts { margin: 0; }
.facts div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: .3rem 2.5rem; padding: 1.4rem 0; border-top: 1px solid var(--rule); }
.facts div:last-child { border-bottom: 1px solid var(--rule); }
.facts dt { font-weight: 500; color: var(--ink); }
.facts dd { margin: 0; color: var(--muted); }

.email-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-bottom: 3rem; }
.email { font-family: var(--sans); font-size: clamp(1.6rem, 4.2vw, 3.5rem); font-weight: 500; letter-spacing: -0.045em; line-height: 1.1; text-decoration: none; overflow-wrap: anywhere; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1.5px no-repeat; transition: background-size .6s var(--ease), color .25s; }
.email:hover { background-size: 100% 1.5px; }
.links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2.5rem; }
.links a { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.05rem 0; border-top: 1px solid var(--rule); color: var(--ink); text-decoration: none; transition: color .25s, padding .4s var(--ease); }
.links a::after { content: "\2197"; color: var(--muted); transition: transform .4s var(--ease), color .25s; }
.links a:hover { color: var(--accent); padding-inline-start: .4rem; }
.links a:hover::after { transform: translate(3px, -3px); color: var(--accent); }
[dir="rtl"] .links a::after { content: "\2196"; }
[dir="rtl"] .links a:hover::after { transform: translate(-3px, -3px); }

.site-foot { border-top: 1px solid var(--rule); padding: 2.5rem 0 3rem; color: var(--muted); font-size: .88rem; }
.site-foot .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.site-foot .tf { font-family: var(--tfng); letter-spacing: .06em; }
.site-foot a { text-decoration: none; }

/* Reveal */
[data-reveal] { transition: opacity 1s var(--ease), transform 1s var(--ease); }
html.js [data-reveal]:not(.in) { opacity: 0; transform: translateY(26px); }

@media (max-width: 900px) {
  .site-nav { top: auto; bottom: max(1rem, env(safe-area-inset-bottom)); max-width: calc(100vw - 2rem); overflow-x: auto; scrollbar-width: none; }
  .site-nav::-webkit-scrollbar { display: none; }
  body { padding-bottom: 4.5rem; }
}
@media (max-width: 760px) {
  .hero { min-height: 88svh; padding-top: 6rem; }
  .portrait { width: 11rem; border-radius: .8rem; }
  .tfng, .role { grid-column: 1 / -1; }
  .spec-grid { grid-template-columns: 1fr; }
  .paradigm li { grid-template-columns: auto auto minmax(0, 1fr); gap: .3rem 1rem; }
  .paradigm .meta { grid-column: 1 / -1; flex-direction: row; gap: 1rem; flex-wrap: wrap; }
  .block .head, .block .body { grid-column: 1 / -1; }
  .block .head h2 { position: static; }
  .thread .t-body, [dir="rtl"] .thread .t-body { padding-inline-end: 0; }
  .facts div { grid-template-columns: 1fr; }
  .pub { grid-template-columns: 1fr; gap: .4rem; }
  .timeline { --col: 3rem; --dot: 1.25rem; }
  .links { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .eyebrow, .portrait, .role, .tfng span[aria-hidden] { opacity: 1; filter: none; transform: none; }
  h1 .line > span, .portrait img, .hero-foot::before { transform: none; }
}
