/* =====================================================================
   Dr. Mohammed Bouchangour — site stylesheet
   ===================================================================== */

/* ---------- Tokens ---------- */
:root {
  --teal-950: #031f1b;
  --teal-900: #05352e;
  --teal-800: #09584c;
  --teal-700: #0d6e5f;
  --teal-500: #4dad9d;
  --teal-200: #b3dbd4;
  --gold: #d6ac5c;
  --gold-2: #e9c987;

  --bg: #faf8f3;
  --bg-alt: #f2efe6;
  --surface: #ffffff;
  --text: #13201d;
  --muted: #5a6763;
  --border: #e4dfd2;
  --accent: var(--teal-800);
  --accent-soft: #e3f0ed;
  --on-accent: #ffffff;
  --gold-text: #9a7428;
  --shadow-sm: 0 1px 2px rgba(5, 53, 46, .06);
  --shadow: 0 2px 6px rgba(5, 53, 46, .05), 0 12px 32px -12px rgba(5, 53, 46, .18);
  --shadow-lg: 0 30px 60px -20px rgba(3, 31, 27, .35);


  --font-display: "Playfair Display", Georgia, serif;
  --font-script: "Great Vibes", cursive;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --radius: 18px;
  --radius-sm: 10px;
  --maxw: 1200px;
  --header-h: 76px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07110f; --bg-alt: #0b1a17; --surface: #0f211d; --text: #e6efec; --muted: #9db0aa;
    --border: #1d3631; --accent: #5cc2ae; --accent-soft: #10302a; --on-accent: #04201b; --gold-text: #e3bf78;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 2px 6px rgba(0,0,0,.3), 0 12px 32px -12px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #07110f; --bg-alt: #0b1a17; --surface: #0f211d; --text: #e6efec; --muted: #9db0aa;
  --border: #1d3631; --accent: #5cc2ae; --accent-soft: #10302a; --on-accent: #04201b; --gold-text: #e3bf78;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 2px 6px rgba(0,0,0,.3), 0 12px 32px -12px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 var(--font-body); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.18; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: clamp(2.2rem, 5.2vw, 4.1rem); }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
::selection { background: var(--gold); color: var(--teal-950); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .container { padding: 0 16px; } }
.muted { color: var(--muted); }
.script { font-family: var(--font-script); font-weight: 400; letter-spacing: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Scroll progress ---------- */
.progress { position: fixed; top: 0; left: 0; height: 3px; width: 100%; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--teal-500), var(--gold)); z-index: 120; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; height: var(--header-h); z-index: 100;
  transition: background .35s var(--ease), box-shadow .35s, height .35s, color .35s;
  color: var(--text);
}
.site-header.over-hero:not(.scrolled) { color: #fff; }
.site-header.scrolled {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: 0 1px 0 var(--border); height: 64px;
}
.site-header:not(.over-hero) { background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); box-shadow: 0 1px 0 var(--border); }
.site-header .container { display: flex; align-items: center; height: 100%; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; margin-right: auto; min-width: 0; }
.brand:hover { text-decoration: none; }
.monogram {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: .02em;
  background: linear-gradient(135deg, var(--teal-800), var(--teal-950)); color: var(--gold-2);
  box-shadow: inset 0 0 0 1.5px rgba(214,172,92,.65);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; white-space: nowrap; }
.brand-sub { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; opacity: .7; white-space: nowrap; }

.nav { display: flex; align-items: center; gap: 2px; }
.nav > .nav-item { position: relative; }
.nav-link {
  display: inline-flex; align-items: center; gap: 4px; padding: 9px 13px; border-radius: 999px;
  color: inherit; font-size: .93rem; font-weight: 500; background: none; border: 0; cursor: pointer; font-family: inherit;
  opacity: .88; transition: opacity .2s, background .2s;
}
.nav-link:hover { opacity: 1; text-decoration: none; background: color-mix(in srgb, currentColor 9%, transparent); }
.nav-link.active { opacity: 1; color: var(--gold-text); }
.over-hero:not(.scrolled) .nav-link.active { color: var(--gold-2); }
.nav-link svg.chev { transition: transform .25s; opacity: .7; }
.dropdown {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translate(-50%, 8px);
  min-width: 250px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 16px; padding: 8px; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transition: .25s var(--ease);
}
.dropdown::before { content: ""; position: absolute; inset: -12px 0 auto 0; height: 12px; }
.nav-item:hover .dropdown, .nav-item:focus-within .dropdown { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.nav-item:hover .chev { transform: rotate(180deg); }
.dropdown a { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; color: var(--text); }
.dropdown a:hover { background: var(--accent-soft); text-decoration: none; }
.dropdown .d-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.dropdown strong { display: block; font-size: .92rem; font-weight: 600; }
.dropdown small { color: var(--muted); font-size: .8rem; line-height: 1.35; display: block; }

.header-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  height: 40px; min-width: 40px; padding: 0 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  background: transparent; color: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 .8rem var(--font-body); transition: background .2s, border-color .2s;
}
.icon-btn:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.search-btn { padding: 0 14px; color: inherit; }
.search-btn kbd { white-space: nowrap; font: 500 .7rem var(--font-mono); opacity: .65; border: 1px solid color-mix(in srgb, currentColor 30%, transparent); border-radius: 5px; padding: 1px 5px; }
.menu-btn { display: none; }
/* keyboard hint only where the header has room */
@media (max-width: 1440px) { .search-btn kbd { display: none; } }
/* Dark / Light switch */
.theme-switch { display: inline-flex; align-items: center; gap: 2px; height: 40px; padding: 3px; border-radius: 999px; border: 1px solid color-mix(in srgb, currentColor 22%, transparent); }
.theme-switch button { height: 100%; padding: 0 11px; border: 0; border-radius: 999px; background: transparent; color: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font: 600 .78rem var(--font-body); opacity: .75; transition: background .2s, color .2s, opacity .2s; }
.theme-switch button:hover { opacity: 1; background: color-mix(in srgb, currentColor 10%, transparent); }
.theme-switch button.on { opacity: 1; background: var(--gold); color: #13201d; }
.drawer-themes button { display: inline-flex; align-items: center; gap: 8px; }
@media (max-width: 1080px) {
  .nav { display: none; }
  .menu-btn { display: inline-flex; }
  .search-btn span, .search-btn kbd { display: none; }
}
@media (max-width: 1240px) and (min-width: 1081px) { .brand-sub { display: none; } }
@media (max-width: 480px) { .brand-sub { display: none; } .brand-name { font-size: .98rem; } }

/* Mobile drawer */
.drawer { position: fixed; inset: 0; z-index: 140; pointer-events: none; }
.drawer::before { content: ""; position: absolute; inset: 0; background: rgba(3,31,27,.55); opacity: 0; transition: opacity .3s; }
.drawer-panel {
  position: absolute; top: 0; right: 0; height: 100%; width: min(360px, 88vw); background: var(--surface);
  transform: translateX(100%); transition: transform .4s var(--ease); padding: 20px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.drawer.open { pointer-events: auto; }
.drawer.open::before { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.drawer h4 { font-family: var(--font-body); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 16px 12px 6px; }
.drawer a { padding: 11px 12px; border-radius: 10px; color: var(--text); font-weight: 500; display: flex; gap: 12px; align-items: center; }
.drawer a:hover, .drawer a.active { background: var(--accent-soft); color: var(--accent); text-decoration: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 13px 24px; border-radius: 999px;
  font: 600 .95rem var(--font-body); border: 1px solid transparent; cursor: pointer; position: relative; overflow: hidden;
  transition: transform .25s var(--ease), box-shadow .25s, background .25s, color .25s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-gold { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: var(--teal-950); box-shadow: 0 10px 30px -10px rgba(214,172,92,.7); }
.btn-gold::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%); transform: translateX(-120%); transition: transform .8s; }
.btn-gold:hover::after { transform: translateX(120%); }
.btn-glass { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.3); backdrop-filter: blur(8px); }
.btn-glass:hover { background: rgba(255,255,255,.16); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { box-shadow: var(--shadow); }
.btn-outline { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font: 500 .8rem var(--font-body);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; cursor: pointer; transition: .2s;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- HERO ---------- */
.hero {
  position: relative; min-height: min(100svh, 980px); display: flex; align-items: center; color: #fff;
  background: var(--teal-950); overflow: hidden; isolation: isolate; padding: calc(var(--header-h) + 40px) 0 80px;
}
.hero-bg { position: absolute; inset: -6% -2%; background: url("../img/bg/hero.jpg") center/cover no-repeat; z-index: -3;
  animation: kenburns 28s ease-in-out infinite alternate; will-change: transform; }
@keyframes kenburns { from { transform: scale(1.04) translate3d(0,0,0); } to { transform: scale(1.14) translate3d(-1.5%, -1%, 0); } }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -2;
  background: radial-gradient(1000px 600px at 15% 40%, rgba(3,31,27,.85), transparent 70%),
              linear-gradient(180deg, rgba(3,31,27,.3), rgba(3,31,27,.35) calc(100% - 170px), var(--bg) 100%); }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero-grid { display: grid; grid-template-columns: 1.25fr .9fr; gap: 56px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-2); font-weight: 600; }
.eyebrow::before { content: ""; width: 34px; height: 1px; background: currentColor; }
.hero .script-line { font-family: var(--font-script); font-size: clamp(2.6rem, 6vw, 4.6rem); color: var(--gold-2); line-height: 1; margin: 18px 0 0; min-height: 1.1em; }
.hero .script-line .caret { display: inline-block; width: 2px; height: .8em; background: var(--gold-2); margin-left: 4px; animation: blink 1s steps(1) infinite; vertical-align: -.05em; }
@keyframes blink { 50% { opacity: 0; } }
.hero h1 { color: #fff; margin: 6px 0 18px; text-shadow: 0 2px 30px rgba(0,0,0,.3); }
.hero h1 .thin { font-weight: 400; font-style: italic; color: var(--teal-200); }
.hero .lead { font-size: 1.12rem; color: rgba(255,255,255,.82); max-width: 600px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 38px; color: rgba(255,255,255,.72); font-size: .9rem; }
.hero-meta span { display: inline-flex; align-items: center; gap: 8px; }
.hero-meta svg { color: var(--gold-2); }

.portrait-wrap { position: relative; justify-self: center; width: min(400px, 100%); aspect-ratio: 4/5; }
.portrait {
  position: absolute; inset: 0; border-radius: 220px 220px 28px 28px; overflow: hidden;
  box-shadow: 0 40px 80px -30px rgba(0,0,0,.7); transform-style: preserve-3d;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.02); }
.portrait::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(3,31,27,.55)); }
.portrait-ring { position: absolute; inset: -16px; border-radius: 236px 236px 40px 40px; border: 1px solid rgba(214,172,92,.55); }
.portrait-ring.r2 { inset: -32px; border-color: rgba(214,172,92,.22); animation: breathe 6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.02); opacity: .5; } }
.float-card {
  position: absolute; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px;
  background: rgba(3,31,27,.62); border: 1px solid rgba(214,172,92,.35); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  color: #fff; box-shadow: 0 20px 40px -20px rgba(0,0,0,.6); animation: floaty 7s ease-in-out infinite; z-index: 2;
}
.float-card .fc-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: var(--teal-950); }
.float-card strong { display: block; font-size: 1.05rem; line-height: 1.1; }
.float-card small { opacity: .75; font-size: .76rem; }
.float-card.fc1 { left: -48px; top: 18%; }
.float-card.fc2 { right: -40px; bottom: 14%; animation-delay: -3.5s; }
@keyframes floaty { 50% { transform: translateY(-12px); } }
.scroll-cue { position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.7); font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.scroll-cue i { width: 22px; height: 36px; border: 1.5px solid currentColor; border-radius: 12px; position: relative; }
.scroll-cue i::after { content: ""; position: absolute; left: 50%; top: 7px; width: 3px; height: 7px; border-radius: 2px; background: var(--gold-2); transform: translateX(-50%); animation: wheel 1.8s infinite; }
@keyframes wheel { 0% { opacity: 0; transform: translate(-50%, -3px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, 10px); } }
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 60px; }
  .portrait-wrap { width: min(300px, 78%); order: -1; }
  .float-card.fc1 { left: -30px; } .float-card.fc2 { right: -24px; }
  .scroll-cue { display: none; }
}

/* ---------- Page banner (inner pages) ---------- */
.banner {
  position: relative; color: #fff; padding: calc(var(--header-h) + 70px) 0 90px; overflow: hidden; isolation: isolate; background: var(--teal-950);
}
.banner-bg { position: absolute; inset: -10% 0; background-size: cover; background-position: center; z-index: -2; will-change: transform; }
.banner::after { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(100deg, rgba(3,31,27,.94) 15%, rgba(3,31,27,.6) 60%, rgba(3,31,27,.35)), linear-gradient(0deg, rgba(3,31,27,.5), transparent 40%); }
.banner .script { color: var(--gold-2); font-size: clamp(2rem, 4vw, 3rem); line-height: 1; display: block; margin-bottom: 4px; }
.banner h1 { color: #fff; font-size: clamp(2.2rem, 4.6vw, 3.6rem); margin-bottom: 14px; }
.banner p { color: rgba(255,255,255,.8); max-width: 680px; font-size: 1.08rem; margin: 0; }
.crumbs { display: flex; gap: 8px; align-items: center; font-size: .82rem; color: rgba(255,255,255,.65); margin-bottom: 20px; flex-wrap: wrap; }
.crumbs a { color: rgba(255,255,255,.85); }
.banner-wave { position: absolute; left: 0; right: 0; bottom: -1px; height: 60px; color: var(--bg); z-index: 1; }

/* ---------- Sections ---------- */
.section { padding: 110px 0; position: relative; }
.section.tight { padding: 70px 0; }
.section.alt { background: var(--bg-alt); }
.section.pattern::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%2309584c' stroke-width='0.5' stroke-opacity='0.13'%3E%3Cpath d='M30 0L60 30L30 60L0 30z'/%3E%3Cpath d='M30 10L50 30L30 50L10 30z'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%); mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.section > .container { position: relative; }
.section-dark { background: var(--teal-950); color: #e8f1ef; overflow: hidden; isolation: isolate; }
.section-dark h2, .section-dark h3 { color: #fff; }
.section-dark .muted { color: rgba(232,241,239,.7); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 48px; flex-wrap: wrap; }
.section-head .script { color: var(--gold-text); font-size: 2.2rem; line-height: 1; display: block; }
.section-dark .section-head .script { color: var(--gold-2); }
.section-head h2 { margin: 0; }
.section-head p { margin: 10px 0 0; max-width: 620px; color: var(--muted); }
.section-dark .section-head p { color: rgba(232,241,239,.72); }
.link-arrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .95rem; white-space: nowrap; }
.link-arrow svg { transition: transform .25s var(--ease); }
.link-arrow:hover { text-decoration: none; }
.link-arrow:hover svg { transform: translateX(4px); }
.section-dark .link-arrow { color: var(--gold-2); }

/* ---------- Stats ---------- */
.stats { position: relative; z-index: 3; margin-top: -70px; }
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.stat { padding: 30px 24px; text-align: center; position: relative; }
.stat + .stat::before { content: ""; position: absolute; left: 0; top: 24%; bottom: 24%; width: 1px; background: var(--border); }
.stat-n { font-family: var(--font-display); font-size: clamp(2.1rem, 4vw, 3rem); font-weight: 700; line-height: 1; color: var(--accent);
  background: linear-gradient(135deg, var(--accent), var(--gold)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-l { margin-top: 8px; color: var(--muted); font-size: .88rem; }
@media (max-width: 760px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3)::before { display: none; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
}

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 64px; align-items: start; }
@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; gap: 40px; } }
.about-text p { font-size: 1.06rem; }
.about-text p:first-of-type::first-letter { font-family: var(--font-display); float: left; font-size: 4.2rem; line-height: .85; padding: 6px 10px 0 0; color: var(--gold-text); }
.signature { font-family: var(--font-script); font-size: 2.6rem; color: var(--accent); margin-top: 10px; }
.quote-card {
  position: relative; border-radius: var(--radius); padding: 36px; color: #fff; overflow: hidden; isolation: isolate;
  background: linear-gradient(160deg, var(--teal-800), var(--teal-950));
  box-shadow: var(--shadow-lg);
}
.quote-card::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .25; background: url("../img/bg/research.jpg") center/cover; mix-blend-mode: screen; }
.quote-card .qm { font-family: var(--font-display); font-size: 5rem; line-height: .6; color: var(--gold); }
.quote-card blockquote { margin: 10px 0 18px; font-family: var(--font-display); font-size: 1.3rem; line-height: 1.45; font-style: italic; }
.quote-card cite { font-style: normal; font-size: .85rem; opacity: .75; }
.info-rows { margin-top: 22px; display: grid; gap: 12px; }
.info-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.info-row .ir-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.info-row small { display: block; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; }
.info-row span { font-weight: 500; font-size: .95rem; }

/* ---------- Cards (generic) ---------- */
.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
@media (max-width: 960px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 680px) { .grid-3, .grid-2, .grid-auto { grid-template-columns: 1fr; } }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px;
  box-shadow: var(--shadow-sm); transition: transform .4s var(--ease), box-shadow .4s, border-color .4s;
  --mx: 50%; --my: 50%;
}
.card.glow::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(400px circle at var(--mx) var(--my), rgba(214,172,92,.14), transparent 45%);
}
.card.glow:hover::after { opacity: 1; }
.card.lift:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }

/* Research theme cards */
.theme-card { overflow: hidden; display: flex; flex-direction: column; }
.theme-card .num { font-family: var(--font-display); font-size: 3.4rem; line-height: 1; font-weight: 700; color: transparent; -webkit-text-stroke: 1px var(--gold); margin-bottom: 18px; }
.theme-card h3 { font-size: 1.4rem; }
.theme-card p { color: var(--muted); font-size: .96rem; flex: 1; }
.theme-card .keys { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.section-dark .card { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.1); color: #e8f1ef; backdrop-filter: blur(6px); }
.section-dark .card p { color: rgba(232,241,239,.72); }
.section-dark .card.lift:hover { border-color: rgba(214,172,92,.45); }
.tag { display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 999px; font-size: .76rem; font-weight: 500; background: var(--accent-soft); color: var(--accent); }
.section-dark .tag { background: rgba(214,172,92,.12); color: var(--gold-2); }
.theme-card .go { margin-top: 18px; }

/* ---------- Marquee ---------- */
.marquee { overflow: hidden; border-block: 1px solid var(--border); padding: 26px 0; background: var(--surface);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee-track { display: flex; gap: 56px; width: max-content; animation: marquee 40s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-item { font-family: var(--font-display); font-size: 1.35rem; font-style: italic; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 56px; }
.marquee-item::after { content: "◆"; font-size: .7rem; color: var(--gold); font-style: normal; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Publications ---------- */
.pub-list { display: grid; gap: 16px; }
.pub {
  display: grid; grid-template-columns: 86px 1fr; gap: 24px; padding: 24px 28px; align-items: start;
}
.pub-year { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--gold-text); line-height: 1; padding-top: 4px; }
.pub-year small { display: block; font-family: var(--font-body); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-top: 6px; }
.pub-title { font-family: var(--font-display); font-size: 1.16rem; font-weight: 600; line-height: 1.38; margin-bottom: 8px; color: var(--text); }
.pub-title a { color: inherit; }
.pub-title a:hover { color: var(--accent); }
.authors { font-size: .93rem; color: var(--muted); }
.authors strong { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; text-decoration-thickness: 2px; }
.venue { font-size: .92rem; font-style: italic; color: var(--accent); margin-top: 2px; }
.pub-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.pub.flash { animation: flash 2.2s var(--ease); }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--gold); } 100% { box-shadow: var(--shadow-sm); } }
@media (max-width: 600px) { .pub { grid-template-columns: 1fr; gap: 6px; padding: 20px; } .pub-year { font-size: 1.2rem; } .pub-year small { display: inline; margin-left: 8px; } }
.year-sep { display: flex; align-items: center; gap: 16px; margin: 36px 0 16px; font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--text); }
.year-sep::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }
.year-sep span { font-family: var(--font-body); font-size: .8rem; font-weight: 500; color: var(--muted); }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 28px; }
.search-field {
  flex: 1 1 300px; display: flex; align-items: center; gap: 10px; padding: 0 18px; height: 50px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow-sm); transition: border-color .2s, box-shadow .2s;
}
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-field input { border: 0; outline: 0; background: none; font: inherit; color: var(--text); width: 100%; }
.search-field svg { color: var(--muted); flex-shrink: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: 500 .88rem var(--font-body); cursor: pointer; transition: .2s;
}
.chip:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip .n { font-size: .72rem; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, currentColor 14%, transparent); }
.result-count { color: var(--muted); font-size: .9rem; margin: -10px 0 18px; }

/* Year chart */
.chart-card { padding: 26px 28px 20px; }
.chart-card h3 { font-family: var(--font-body); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 18px; }
.bars { display: flex; align-items: flex-end; gap: 14px; height: 150px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar-fill { width: 100%; max-width: 48px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--gold), var(--accent)); height: 0; transition: height 1.2s var(--ease); position: relative; }
.bar-fill b { position: absolute; top: -24px; left: 50%; transform: translateX(-50%); font-size: .85rem; color: var(--text); }
.bar span { font-size: .8rem; color: var(--muted); font-weight: 500; }

/* ---------- Courses ---------- */
.course-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; color: var(--text); }
.course-card:hover { text-decoration: none; }
.course-top { position: relative; height: 128px; padding: 20px 24px; display: flex; align-items: flex-start; justify-content: space-between; color: #fff; overflow: hidden; isolation: isolate;
  background: linear-gradient(135deg, var(--c, var(--teal-800)), color-mix(in srgb, var(--c, var(--teal-800)) 45%, #021412)); }
.course-top::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .22; background: url("../img/bg/teaching.jpg") center/cover; transition: transform .8s var(--ease); }
.course-card:hover .course-top::before { transform: scale(1.12); }
.course-top .inst { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); padding: 5px 11px; border-radius: 999px; backdrop-filter: blur(6px); }
.course-top .sym { font-family: var(--font-display); font-size: 4.6rem; line-height: .8; opacity: .3; font-style: italic; position: absolute; right: 18px; bottom: -6px; }
.course-body { padding: 22px 24px 24px; display: flex; flex-direction: column; flex: 1; }
.course-body h3 { font-size: 1.22rem; margin-bottom: 6px; }
.course-body .prog { color: var(--muted); font-size: .88rem; margin-bottom: 14px; }
.course-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 16px; border-top: 1px dashed var(--border); font-size: .84rem; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--bg-alt); color: var(--muted); font-size: .78rem; font-weight: 500; }
.pill.gold { background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold-text); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }

/* Course page */
.course-layout { display: grid; grid-template-columns: 1fr 320px; gap: 40px; align-items: start; }
@media (max-width: 940px) { .course-layout { grid-template-columns: 1fr; } }
.aside-card { position: sticky; top: calc(var(--header-h) + 20px); }
.aside-card dl { margin: 0; display: grid; gap: 14px; }
.aside-card dt { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.aside-card dd { margin: 2px 0 0; font-weight: 500; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 26px; overflow-x: auto; scrollbar-width: none; }
.tab { background: none; border: 0; padding: 12px 16px; font: 600 .92rem var(--font-body); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.tab.active { color: var(--accent); border-bottom-color: var(--gold); }
.tab .n { font-size: .72rem; padding: 1px 7px; border-radius: 999px; background: var(--bg-alt); }
.mat-list { display: grid; gap: 12px; }
.mat-row { display: flex; align-items: center; gap: 16px; padding: 16px 18px; }
.mat-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.mat-ico.pdf { background: #fbe9e7; color: #b4322a; }
.mat-ico.link { background: var(--accent-soft); color: var(--accent); }
:root[data-theme="dark"] .mat-ico.pdf { background: #3a2422; color: #f08a80; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mat-ico.pdf { background: #3a2422; color: #f08a80; } }
.mat-info { flex: 1; min-width: 0; }
.mat-info strong { display: block; font-weight: 600; }
.mat-info small { color: var(--muted); }
.mat-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) { .mat-row { flex-wrap: wrap; } .mat-actions { width: 100%; justify-content: flex-start; padding-left: 62px; } }

.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.video-card { padding: 0; overflow: hidden; cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.thumb { position: relative; aspect-ratio: 16/9; background: var(--teal-900) url("../img/bg/hero.jpg") center/cover; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.video-card:hover .thumb img { transform: scale(1.07); }
.thumb .play { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.45)); }
.thumb .play span { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.92); color: var(--teal-900); box-shadow: 0 10px 30px rgba(0,0,0,.35); transition: transform .3s var(--ease); }
.video-card:hover .play span { transform: scale(1.12); }
.thumb .badge-pl { position: absolute; right: 10px; bottom: 10px; background: rgba(0,0,0,.72); color: #fff; font-size: .74rem; padding: 3px 8px; border-radius: 6px; display: flex; gap: 6px; align-items: center; }
.video-card .vc-body { padding: 16px 18px; }
.video-card .vc-body strong { display: block; font-weight: 600; line-height: 1.35; }
.video-card .vc-body small { color: var(--muted); }

/* Empty state */
.empty {
  text-align: center; padding: 60px 24px; border: 1.5px dashed var(--border); border-radius: var(--radius); background: var(--surface);
}
.empty .e-ico { width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 460px; margin: 0 auto; }

/* ---------- Timeline ---------- */
.timeline { position: relative; display: grid; gap: 22px; padding-left: 34px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(180deg, var(--gold), var(--accent), transparent); }
.tl-item { position: relative; }
.tl-item::before { content: ""; position: absolute; left: -31px; top: 22px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 3px solid var(--gold); box-shadow: 0 0 0 4px var(--bg); }
.tl-item .card { padding: 20px 24px; }
.tl-date { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-text); }
.tl-item h3 { font-size: 1.1rem; margin: 6px 0 6px; line-height: 1.4; }
.tl-item .where { color: var(--muted); font-size: .9rem; display: flex; gap: 8px; align-items: flex-start; }
.tl-item .where svg { flex-shrink: 0; margin-top: 3px; color: var(--accent); }

/* Talks: two-column alternating on wide screens */
.talks-tl { position: relative; display: grid; gap: 28px; }
.talks-tl::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; transform: translateX(-50%); background: linear-gradient(180deg, transparent, var(--gold) 6%, var(--accent) 94%, transparent); }
.talk { width: calc(50% - 40px); position: relative; }
.talk:nth-child(odd) { justify-self: start; }
.talk:nth-child(even) { justify-self: end; }
.talk::before { content: ""; position: absolute; top: 28px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 3px solid var(--gold); box-shadow: 0 0 0 5px var(--bg); }
.talk:nth-child(odd)::before { right: -49px; }
.talk:nth-child(even)::before { left: -49px; }
.talk .card { padding: 22px 24px; }
.talk-date { display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-text); }
.talk h3 { font-size: 1.08rem; margin: 8px 0; line-height: 1.42; }
.talk .ev { color: var(--accent); font-size: .9rem; font-weight: 500; }
.talk .pl { color: var(--muted); font-size: .86rem; display: flex; align-items: center; gap: 6px; margin-top: 4px; }
@media (max-width: 820px) {
  .talks-tl::before { left: 9px; }
  .talk { width: auto; justify-self: stretch !important; margin-left: 34px; }
  .talk::before { left: -32px !important; right: auto !important; }
}

/* ---------- CV ---------- */
.cv-layout { display: grid; grid-template-columns: 260px 1fr; gap: 48px; align-items: start; }
@media (max-width: 900px) { .cv-layout { grid-template-columns: 1fr; } .cv-nav { display: none; } }
.cv-nav { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 2px; }
.cv-nav a { padding: 9px 14px; border-radius: 10px; color: var(--muted); font-weight: 500; font-size: .92rem; border-left: 2px solid transparent; }
.cv-nav a:hover { color: var(--text); background: var(--bg-alt); text-decoration: none; }
.cv-nav a.active { color: var(--accent); border-left-color: var(--gold); background: var(--accent-soft); }
.cv-section { margin-bottom: 60px; }
.cv-section > h2 { font-size: 1.8rem; display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.cv-section > h2 .h-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.jury { width: 100%; border-collapse: collapse; font-size: .93rem; }
.jury td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.jury tr:last-child td { border-bottom: 0; }
.jury td:last-child { text-align: right; color: var(--gold-text); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.table-wrap { overflow-x: auto; }
.teach-inst { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.teach-inst .dot { width: 12px; height: 12px; border-radius: 4px; background: var(--c, var(--accent)); flex-shrink: 0; transform: rotate(45deg); }
.teach-inst strong { font-family: var(--font-display); font-size: 1.08rem; }
.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.check-list li { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.check-list svg { color: var(--gold-text); margin-top: 4px; flex-shrink: 0; }
.lang-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.lang-row:last-child { border-bottom: 0; }
.cert { display: flex; gap: 14px; align-items: center; padding: 14px 18px; }
.cert .c-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold-text); flex-shrink: 0; }
.cert strong { display: block; font-size: .95rem; line-height: 1.35; }
.cert small { color: var(--muted); }

/* ---------- Jensen figure ---------- */
.jensen { display: grid; grid-template-columns: 1.2fr .8fr; gap: 40px; align-items: center; }
@media (max-width: 900px) { .jensen { grid-template-columns: 1fr; } }
.jensen-fig { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius); padding: 14px; }
.jensen-fig svg { width: 100%; height: auto; display: block; touch-action: none; user-select: none; }
.jensen-fig .handle { cursor: grab; }
.jensen-fig .handle:active { cursor: grabbing; }
.slider { display: grid; gap: 6px; margin: 18px 0; }
.slider label { display: flex; justify-content: space-between; font-size: .88rem; color: rgba(232,241,239,.8); }
.slider label b { color: var(--gold-2); font-family: var(--font-mono); font-weight: 500; }
.slider input[type=range] { width: 100%; accent-color: var(--gold); }
.ineq { font-size: 1.15rem; padding: 18px; border-radius: 14px; background: rgba(214,172,92,.08); border: 1px solid rgba(214,172,92,.25); overflow-x: auto; }
.ineq-values { font-family: var(--font-mono); font-size: .85rem; color: rgba(232,241,239,.75); margin-top: 12px; display: grid; gap: 4px; }
.ineq-values b { color: var(--gold-2); font-weight: 500; }

/* Collaborators */
.collab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.collab { display: flex; gap: 14px; align-items: center; padding: 16px 18px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; color: #fff; flex-shrink: 0; background: linear-gradient(135deg, var(--teal-700), var(--teal-950)); box-shadow: inset 0 0 0 2px rgba(214,172,92,.5); }
.collab strong { display: block; font-size: .95rem; }
.collab small { color: var(--muted); font-size: .8rem; }

/* Tools */
.tool-card { display: flex; flex-direction: column; gap: 10px; }
.tool-head { display: flex; gap: 14px; align-items: center; }
.tool-logo { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; background: var(--c, var(--teal-800)); box-shadow: 0 10px 22px -10px var(--c, var(--teal-800)); }
.tool-card h3 { margin: 0; }
.tool-card small { color: var(--muted); }
.tool-card p { color: var(--muted); font-size: .94rem; margin: 0; flex: 1; }
.tool-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

/* CTA band */
.cta-band { position: relative; border-radius: 28px; overflow: hidden; padding: 64px 56px; color: #fff; isolation: isolate; background: var(--teal-950); }
.cta-band::before { content: ""; position: absolute; inset: 0; z-index: -2; background: url("../img/bg/hero.jpg") center/cover; opacity: .7; }
.cta-band::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(3,31,27,.95), rgba(3,31,27,.4)); }
.cta-band h2 { color: #fff; max-width: 620px; }
.cta-band p { color: rgba(255,255,255,.8); max-width: 560px; }
@media (max-width: 600px) { .cta-band { padding: 44px 26px; } }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 800px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-card { display: flex; gap: 18px; align-items: flex-start; }
.contact-card .cc-ico { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--teal-700), var(--teal-950)); color: var(--gold-2); flex-shrink: 0; }
.contact-card h3 { margin-bottom: 4px; font-size: 1.15rem; }
.contact-card p { color: var(--muted); margin: 0 0 10px; }
.profile-links { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 20px; background: rgba(2,16,14,.78); backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: .3s; }
.modal.open { opacity: 1; visibility: visible; }
.modal-box { width: min(980px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); color: var(--text); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(.98); transition: transform .35s var(--ease); }
.modal.open .modal-box { transform: none; }
.modal-box.dark { background: #000; color: #fff; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-box.dark .modal-head { border-color: #222; }
.modal-head strong { font-family: var(--font-display); font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-head .icon-btn { color: inherit; }
.modal-body { overflow: auto; }
.modal-body.pad { padding: 22px; }
.frame-16x9 { position: relative; aspect-ratio: 16/9; }
.frame-16x9 iframe, .frame-pdf iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.frame-pdf { position: relative; height: min(78vh, 900px); background: #525659; }
pre.code { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 12px; padding: 16px; font: .82rem/1.55 var(--font-mono); overflow-x: auto; margin: 0 0 12px; white-space: pre; }
.cite-tabs { display: flex; gap: 6px; margin-bottom: 12px; }

/* ---------- Command palette ---------- */
.palette { position: fixed; inset: 0; z-index: 160; background: rgba(2,16,14,.6); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px;
  opacity: 0; visibility: hidden; transition: .2s; }
.palette.open { opacity: 1; visibility: visible; }
.palette-box { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; transform: translateY(-10px); transition: transform .25s var(--ease); }
.palette.open .palette-box { transform: none; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--border); }
.palette-input input { flex: 1; border: 0; outline: 0; background: none; color: var(--text); font: 1.05rem var(--font-body); height: 60px; }
.palette-input kbd { font: .72rem var(--font-mono); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; }
.palette-results { max-height: 56vh; overflow-y: auto; padding: 8px; }
.p-group { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 12px 12px 6px; }
.p-item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--text); cursor: pointer; }
.p-item:hover { text-decoration: none; }
.p-item.sel { background: var(--accent-soft); }
.p-item .p-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--bg-alt); color: var(--accent); flex-shrink: 0; }
.p-item .p-text { min-width: 0; flex: 1; }
.p-item strong { display: block; font-weight: 500; font-size: .93rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-item small { color: var(--muted); font-size: .8rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-empty { padding: 30px; text-align: center; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { position: relative; background: var(--teal-950); color: rgba(232,241,239,.75); padding: 90px 0 30px; overflow: hidden; isolation: isolate; }
.site-footer::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .12; background: url("../img/bg/research.jpg") center/cover; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h4 { font-family: var(--font-body); font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-2); margin-bottom: 16px; }
.site-footer a { color: rgba(232,241,239,.8); display: block; padding: 4px 0; font-size: .93rem; }
.site-footer a:hover { color: #fff; }
.footer-brand .script { font-size: 2.4rem; color: var(--gold-2); line-height: 1; }
.footer-brand p { font-size: .92rem; max-width: 340px; margin-top: 12px; }
.footer-bottom { margin-top: 60px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.1); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: .84rem; }

/* Back to top */
.to-top { position: fixed; right: 22px; bottom: 22px; z-index: 90; width: 50px; height: 50px; border-radius: 50%; border: 0; cursor: pointer; background: var(--surface); color: var(--accent); box-shadow: var(--shadow);
  display: grid; place-items: center; opacity: 0; transform: translateY(20px); transition: .3s var(--ease); }
.to-top.show { opacity: 1; transform: none; }
.to-top svg.ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.to-top svg.ring circle { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-dasharray: 145; stroke-dashoffset: 145; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--teal-900); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: .9rem; z-index: 200; opacity: 0; transition: .3s; pointer-events: none; box-shadow: var(--shadow-lg); display: flex; gap: 8px; align-items: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Reveal animations ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: var(--d, 0s); }
.reveal.from-left { transform: translateX(-36px); }
.reveal.from-right { transform: translateX(36px); }
.reveal.zoom { transform: scale(.94); }
.reveal.in { opacity: 1; transform: none; }
.hero .stagger > * { opacity: 0; transform: translateY(24px); animation: rise 1s var(--ease) forwards; }
.hero .stagger > *:nth-child(2) { animation-delay: .12s; } .hero .stagger > *:nth-child(3) { animation-delay: .24s; }
.hero .stagger > *:nth-child(4) { animation-delay: .36s; } .hero .stagger > *:nth-child(5) { animation-delay: .48s; } .hero .stagger > *:nth-child(6) { animation-delay: .6s; }
@keyframes rise { to { opacity: 1; transform: none; } }
.portrait-wrap { animation: rise 1.2s .3s var(--ease) both; }

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

/* KaTeX tweaks */
.katex { font-size: 1.04em; }
.pub-title .katex, .talk h3 .katex { font-size: 1em; }

/* ---------- Print (CV) ---------- */
@media print {
  .site-header, .site-footer, .to-top, .progress, .banner, .cv-nav, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .section { padding: 20px 0; }
  .card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .cv-layout { grid-template-columns: 1fr; }
  .print-head { display: block !important; }
}
.print-head { display: none; }

/* ---------- Decorative layers ---------- */
.dark-bg { position: absolute; inset: 0; z-index: -1; background-size: cover; background-position: center; opacity: .16; }
.section-dark::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(700px 400px at 85% 0%, rgba(77,173,157,.18), transparent 70%), radial-gradient(600px 400px at 0% 100%, rgba(214,172,92,.12), transparent 70%); }
.float-maths { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.float-math { position: absolute; color: rgba(233,201,135,.5); font-size: 1.15rem; white-space: nowrap; animation: drift 22s ease-in-out infinite; opacity: .55; filter: blur(.2px); }
.float-math .katex { font-size: 1em; }
.fm0 { left: 56%; top: 14%; animation-delay: 0s; font-size: 1.5rem; }
.fm1 { left: 6%; top: 84%; animation-delay: -4s; }
.fm2 { left: 88%; top: 30%; animation-delay: -8s; font-size: 1.6rem; }
.fm3 { left: 60%; top: 86%; animation-delay: -12s; }
.fm4 { left: 44%; top: 34%; animation-delay: -6s; opacity: .35; }
.fm5 { left: 82%; top: 74%; animation-delay: -15s; opacity: .4; }
.fm6 { left: 3%; top: 10%; animation-delay: -10s; font-size: 1.4rem; opacity: .35; }
.fm7 { left: 46%; top: 70%; animation-delay: -18s; opacity: .3; }
@keyframes drift { 0%, 100% { transform: translate(0, 0) rotate(-2deg); } 50% { transform: translate(18px, -26px) rotate(2deg); } }
@media (max-width: 900px) { .fm0, .fm2, .fm4, .fm5, .fm7 { display: none; } }
.portrait { transition: transform .4s var(--ease); }

/* ---------- Mobile fixes ---------- */
html, body { overflow-x: clip; }
.brand { overflow: hidden; }
.brand-text { overflow: hidden; }
.brand-name, .brand-sub { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) {
  .brand-sub { display: none; }
  .brand-name { font-size: .95rem; }
  .header-actions { gap: 4px; }
  .icon-btn { min-width: 38px; height: 38px; padding: 0 8px; }
  .theme-switch { height: 38px; }
  .theme-switch span { display: none; }
  .theme-switch button { padding: 0 8px; }
  .monogram { width: 38px; height: 38px; font-size: .9rem; }
  .float-card { padding: 9px 12px; }
  .float-card.fc1 { left: -10px; } .float-card.fc2 { right: -10px; }
  .float-card strong { font-size: .92rem; }
  .eyebrow { font-size: .68rem; letter-spacing: .14em; }
  .hero { padding-bottom: 110px; }
  .reveal.from-left, .reveal.from-right { transform: translateY(28px); }
  .section { padding: 80px 0; }
}
.bn-short { display: none; }
@media (max-width: 480px) { .bn-full { display: none; } .bn-short { display: inline; } }
@media (max-width: 480px) { .site-header .container { gap: 8px; } .brand { gap: 9px; } .brand-name { font-size: .92rem; } }

/* ---------- Language menu ---------- */
.lang-menu { position: relative; }
.lang-menu .icon-btn span { font-size: .78rem; }
.lang-list { position: absolute; top: calc(100% + 10px); inset-inline-end: 0; min-width: 160px; display: none; gap: 2px; padding: 6px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 5; }
.lang-menu.open .lang-list { display: grid; }
.lang-list button { text-align: start; padding: 9px 12px; border-radius: 9px; border: 0; background: none; color: var(--text); cursor: pointer; font: 500 .92rem var(--font-body); }
.lang-list button:hover { background: var(--bg-alt); }
.lang-list button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.lang-list button[lang="ar"], .drawer-langs [lang="ar"] { font-family: "Cairo", sans-serif; }
.drawer-langs { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px; }
.drawer-langs button { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.drawer-langs button.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- Arabic (right-to-left) ---------- */
[dir="rtl"] { --font-display: "Amiri", "Playfair Display", serif; --font-body: "Cairo", "Inter", system-ui, sans-serif; --font-script: "Aref Ruqaa", "Amiri", serif; }
[dir="rtl"] body { line-height: 1.85; }
[dir="rtl"] *:not(code):not(kbd):not(pre) { letter-spacing: 0 !important; }
[dir="rtl"] .eyebrow, [dir="rtl"] .brand-sub, [dir="rtl"] .tl-date, [dir="rtl"] .talk-date, [dir="rtl"] .pub-year small,
[dir="rtl"] .course-top .inst, [dir="rtl"] .p-group, [dir="rtl"] .aside-card dt, [dir="rtl"] .chart-card h3, [dir="rtl"] .site-footer h4 { text-transform: none; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { line-height: 1.4; }
[dir="rtl"] .hero .script-line, [dir="rtl"] .banner .script, [dir="rtl"] .section-head .script, [dir="rtl"] .footer-brand .script { line-height: 1.4; }
[dir="rtl"] .hero .script-line { font-size: clamp(2.2rem, 5vw, 3.6rem); }
[dir="rtl"] .hero h1 .thin { font-style: normal; }
[dir="rtl"] .signature { font-family: "Great Vibes", cursive; }
[dir="rtl"] .brand-name, [dir="rtl"] .footer-brand .script { font-family: "Playfair Display", serif; }
[dir="rtl"] .footer-brand .script { font-family: "Great Vibes", cursive; }
/* mirror the decorative backgrounds so the dark side is behind the text */
[dir="rtl"] .hero-bg { scale: -1 1; }
[dir="rtl"] .hero::before { background: radial-gradient(1000px 600px at 85% 40%, rgba(3,31,27,.85), transparent 70%),
  linear-gradient(180deg, rgba(3,31,27,.3), rgba(3,31,27,.35) calc(100% - 170px), var(--bg) 100%); }
[dir="rtl"] .banner::after { background: linear-gradient(260deg, rgba(3,31,27,.94) 15%, rgba(3,31,27,.6) 60%, rgba(3,31,27,.35)), linear-gradient(0deg, rgba(3,31,27,.5), transparent 40%); }
[dir="rtl"] .cta-band::after { background: linear-gradient(270deg, rgba(3,31,27,.95), rgba(3,31,27,.4)); }
/* arrows point the other way */
[dir="rtl"] .link-arrow svg { transform: scaleX(-1); }
[dir="rtl"] .link-arrow:hover svg { transform: scaleX(-1) translateX(4px); }
/* layout mirrors */
[dir="rtl"] .drawer-panel { right: auto; left: 0; transform: translateX(-100%); }
[dir="rtl"] .drawer.open .drawer-panel { transform: none; }
[dir="rtl"] .about-text p:first-of-type::first-letter { float: none; font-size: inherit; padding: 0; color: inherit; font-family: inherit; }
[dir="rtl"] .timeline { padding-left: 0; padding-right: 34px; }
[dir="rtl"] .timeline::before { left: auto; right: 9px; }
[dir="rtl"] .tl-item::before { left: auto; right: -31px; }
[dir="rtl"] .talk:nth-child(odd)::before { right: auto; left: -49px; }
[dir="rtl"] .talk:nth-child(even)::before { left: auto; right: -49px; }
@media (max-width: 820px) {
  [dir="rtl"] .talks-tl::before { left: auto; right: 9px; }
  [dir="rtl"] .talk { margin-left: 0; margin-right: 34px; }
  [dir="rtl"] .talk::before { right: -32px !important; left: auto !important; }
}
[dir="rtl"] .cv-nav a { border-left: 0; border-right: 2px solid transparent; }
[dir="rtl"] .cv-nav a.active { border-right-color: var(--gold); }
[dir="rtl"] .jury td:last-child { text-align: left; }
[dir="rtl"] .hero .script-line .caret { margin-left: 0; margin-right: 4px; }
@media (max-width: 560px) { [dir="rtl"] .mat-actions { padding-left: 0; padding-right: 62px; } }
[dir="rtl"] .to-top { right: auto; left: 22px; }
/* original-language titles (publications, talks, training) and math stay left-to-right */
[dir="rtl"] .pub-title, [dir="rtl"] .authors, [dir="rtl"] .venue, [dir="rtl"] .talk h3, [dir="rtl"] .talk .ev,
[dir="rtl"] .cert strong, [dir="rtl"] .cert small, [dir="rtl"] .marquee-item, [dir="rtl"] .check-list a, [dir="rtl"] .collab strong,
[dir="rtl"] .ltr-auto { unicode-bidi: plaintext; text-align: start; }
[dir="rtl"] .katex { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .jensen-fig, [dir="rtl"] .slider input[type=range], [dir="rtl"] .ineq, [dir="rtl"] .ineq-values, [dir="rtl"] pre.code { direction: ltr; }
[dir="rtl"] .ineq-values { text-align: left; }
/* numbers, year ranges and Latin names keep their natural order in Arabic */
/* "plaintext": direction follows the first letter — digits-only ranges stay 2024 – 2026, Arabic text stays right-to-left */
[dir="rtl"] .num { direction: ltr; unicode-bidi: isolate; display: inline-block; }
[dir="rtl"] dd.num { display: block; text-align: right; }
[dir="rtl"] .hero h1, [dir="rtl"] .banner h1.latin, [dir="rtl"] .signature { font-family: "Playfair Display", Georgia, serif; }
[dir="rtl"] .hero h1 .thin { font-style: italic; }
/* Arabic name: Arabic fonts for the name, signature and footer */
[dir="rtl"] .hero h1, [dir="rtl"] .brand-name { font-family: var(--font-display); }
[dir="rtl"] .hero h1 .thin { font-style: normal; }
[dir="rtl"] .signature, [dir="rtl"] .footer-brand .script { font-family: var(--font-script); }
