/* ==========================================================================
   style.css — design tokens, base styles and components (mobile first).
   Wider-screen layouts live in responsive.css.

   Contents
    1. Design tokens            10. Inner page hero
    2. Reset and base           11. Academic profile page
    3. Typography helpers       12. Publications
    4. Layout helpers           13. Books
    5. Buttons and links        14. Achievements and certificates
    6. Header and navigation    15. Lightbox
    7. Footer                   16. Contact
    8. Homepage hero            17. Language entry page (root index.html)
    9. Homepage sections        18. Tags and notices
                                19. Motion
   ========================================================================== */


/* 1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Colours */
  --color-navy: #172a3a;
  --color-navy-deep: #0f1f2c;
  --color-navy-soft: #2a4054;
  --color-ivory: #f8f6f1;
  --color-white: #ffffff;
  --color-sand: #efebe3;
  --color-gray: #73777b;          /* decorative only: too light for small text on ivory */
  --color-text: #1f2b36;
  --color-text-muted: #5b6066;    /* 5.9:1 on ivory */
  --color-gold: #b49a68;          /* rules, frames, accents on navy */
  --color-gold-text: #7a6440;     /* gold tone that passes contrast as text on light backgrounds */
  --color-border: #e5e1d9;
  --color-border-strong: #d3ccbf;
  --color-on-navy: #f8f6f1;
  --color-on-navy-muted: #b9c2ca;
  --color-surface-navy: #172a3a;      /* navy as a background: stays dark in both themes */
  --color-surface-navy-hover: #2a4054;
  --color-selection: #e6dbc5;

  /* Font families */
  --font-latin-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-latin-display: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
  --font-arabic-sans: "IBM Plex Sans Arabic", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-arabic-display: "Noto Naskh Arabic", "Amiri", "Traditional Arabic", "Times New Roman", serif;

  /* Language-dependent values (overridden for Arabic below) */
  --font-body: var(--font-latin-sans);
  --font-display: var(--font-latin-display);
  --leading-body: 1.7;
  --leading-heading: 1.1;
  --tracking-eyebrow: 0.16em;
  --weight-display: 500;

  /* Fluid type scale: grows smoothly between mobile and desktop */
  --step--1: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-0: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  --step-1: clamp(1.125rem, 1.07rem + 0.25vw, 1.25rem);
  --step-2: clamp(1.375rem, 1.27rem + 0.5vw, 1.625rem);
  --step-3: clamp(1.75rem, 1.53rem + 1vw, 2.375rem);
  --step-4: clamp(2.125rem, 1.75rem + 1.8vw, 3.25rem);
  --step-5: clamp(2.625rem, 1.9rem + 3.4vw, 4.75rem);

  /* Spacing */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-s: 0.75rem;
  --space-m: 1rem;
  --space-l: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4.5rem;
  --section-space: clamp(4.5rem, 3rem + 6vw, 8.5rem);

  /* Layout */
  --container: 76rem;
  --gutter: clamp(1.25rem, 0.75rem + 2.5vw, 3rem);
  --header-height: 4.25rem;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 0.25s;
  --duration: 0.5s;
  --duration-slow: 0.9s;
}

/* Arabic needs taller line heights, no letter-spacing and its own fonts */
html[lang="ar"] {
  --font-body: var(--font-arabic-sans);
  --font-display: var(--font-arabic-display);
  --leading-body: 1.95;
  --leading-heading: 1.5;
  --tracking-eyebrow: 0;
  --weight-display: 600;
}

/* Dark theme: set on <html> by js/theme.js. Components only use the tokens above.
   --color-navy and --color-navy-soft are text colours here, so they turn light. */
html[data-theme="dark"] {
  color-scheme: dark;
  --color-navy: #eef0f0;
  --color-navy-deep: #0a1117;
  --color-navy-soft: #c5ced5;
  --color-ivory: #10181f;
  --color-white: #162129;
  --color-sand: #1e2a33;
  --color-gray: #8a9299;
  --color-text: #dde2e6;
  --color-text-muted: #a3acb3;
  --color-gold: #c2a873;
  --color-gold-text: #cdb37f;
  --color-border: #27343e;
  --color-border-strong: #3b4a55;
  --color-surface-navy: #1c3042;
  --color-surface-navy-hover: #2a4054;
  --color-selection: #4a4230;
}


/* 2. Reset and base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: light;
  /* Keeps anchored headings clear of the sticky header */
  scroll-padding-top: calc(var(--header-height) + 1.5rem);
}

body {
  margin: 0;
  background-color: var(--color-ivory);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Lock page scroll while the mobile menu is open */
body.nav-open {
  overflow: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--color-navy);
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  line-height: var(--leading-heading);
  text-wrap: balance;
}

p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

p {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

button,
input {
  font: inherit;
  color: inherit;
}

/* Visible keyboard focus everywhere */
:focus-visible {
  outline: 2px solid var(--color-navy);
  outline-offset: 3px;
}

::selection {
  background-color: var(--color-selection);
  color: var(--color-navy);
}

/* Words in the other language inside a page (e.g. the language switcher) */
[lang="ar"]:not(html) {
  font-family: var(--font-arabic-sans);
}

[lang="en"]:not(html) {
  font-family: var(--font-latin-sans);
}


/* 3. Typography helpers
   -------------------------------------------------------------------------- */
.eyebrow {
  color: var(--color-gold-text);
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: var(--tracking-eyebrow);
  line-height: 1.5;
  text-transform: uppercase;
}

html[lang="ar"] .eyebrow {
  font-size: 0.9375rem;
  text-transform: none;
}

.prose {
  max-width: 64ch;
}

.prose > * + * {
  margin-top: 1.15em;
}

.lead {
  color: var(--color-text-muted);
  font-size: var(--step-1);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}


/* 4. Layout helpers
   -------------------------------------------------------------------------- */
.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

.section {
  padding-block: var(--section-space);
}

.section--white {
  background-color: var(--color-white);
}

.section--navy {
  background-color: var(--color-surface-navy);
  color: var(--color-on-navy);
}

.section--navy :focus-visible {
  outline-color: var(--color-gold);
}

/* Section heading block: "01 — Label" + title + optional link */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-l) var(--space-2xl);
  margin-bottom: var(--space-2xl);
}

.section-head-text {
  max-width: 44rem;
}

.section-index {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: var(--space-m);
}

.section-index::after {
  content: "";
  flex: 0 0 2.5rem;
  height: 1px;
  background-color: var(--color-gold);
}

.section-index-number {
  font-family: var(--font-latin-display);
  font-size: 1.125rem;
  font-style: italic;
  letter-spacing: 0;
}

.section-title {
  font-size: var(--step-4);
}

.skip-link {
  position: absolute;
  inset-inline-start: var(--space-m);
  top: -4rem;
  z-index: 100;
  padding: var(--space-s) var(--space-m);
  background-color: var(--color-surface-navy);
  color: var(--color-on-navy);
  text-decoration: none;
  transition: top var(--duration-fast) ease;
}

.skip-link:focus {
  top: var(--space-m);
}


/* 5. Buttons and links
   -------------------------------------------------------------------------- */

/* Arrow icons point the reading direction: flipped for Arabic */
.icon-arrow {
  --arrow-flip: 1;
  --arrow-shift: 0px;
  flex-shrink: 0;
  transform: scaleX(var(--arrow-flip)) translateX(var(--arrow-shift));
  transition: transform var(--duration-fast) var(--ease-out);
}

[dir="rtl"] .icon-arrow {
  --arrow-flip: -1;
}

a:hover .icon-arrow,
a:focus-visible .icon-arrow {
  --arrow-shift: 4px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 3rem;
  padding: 0.8rem 1.6rem;
  border: 1px solid var(--color-navy);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color var(--duration-fast) ease, color var(--duration-fast) ease, border-color var(--duration-fast) ease;
}

html[lang="ar"] .button {
  letter-spacing: 0;
}

.button-primary {
  border-color: var(--color-surface-navy);
  background-color: var(--color-surface-navy);
  color: var(--color-on-navy);
}

.button-primary:hover {
  background-color: var(--color-surface-navy-hover);
  border-color: var(--color-surface-navy-hover);
}

.button-light {
  border-color: rgba(248, 246, 241, 0.45);
  color: var(--color-on-navy);
}

.button-light:hover {
  background-color: var(--color-on-navy);
  border-color: var(--color-on-navy);
  color: var(--color-surface-navy);
}

/* Text link with an underline that grows on hover */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding-block: 0.4rem;
  color: var(--color-navy);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 2rem 1px;
  transition: background-size var(--duration) var(--ease-out);
}

[dir="rtl"] .link-arrow {
  background-position: 100% 100%;
}

.link-arrow:hover,
.link-arrow:focus-visible {
  background-size: 100% 1px;
}

/* Underlined inline links inside headings and lists */
.link-underline {
  text-decoration: none;
  background-image: linear-gradient(var(--color-gold), var(--color-gold));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0 1px;
  transition: background-size var(--duration) var(--ease-out), color var(--duration-fast) ease;
}

[dir="rtl"] .link-underline {
  background-position: 100% 100%;
}

.link-underline:hover,
.link-underline:focus-visible {
  background-size: 100% 1px;
  color: var(--color-navy-soft);
}


/* 6. Header and navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--color-ivory);
  border-bottom: 1px solid transparent;
  transition: border-color var(--duration) ease;
}

.site-header.is-scrolled,
body.nav-open .site-header {
  border-bottom-color: var(--color-border);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s) var(--space-l);
  min-height: var(--header-height);
}

.brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 70%;
  color: var(--color-navy);
  line-height: 1.25;
  text-decoration: none;
}

.brand-name {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 1.1875rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The full name must fit on the narrowest phones */
@media (max-width: 23.5rem) {
  .brand-name {
    font-size: 1.0625rem;
  }
}

@media (max-width: 21.5rem) {
  .brand-name {
    font-size: 0.9375rem;
  }
}

.brand-title {
  color: var(--color-text-muted);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

html[lang="ar"] .brand-title {
  font-size: 0.8125rem;
  letter-spacing: 0;
}

.nav-list {
  padding: 0;
  list-style: none;
}

.nav-list a {
  text-decoration: none;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.35rem 1rem;
  border: 1px solid var(--color-border-strong);
  color: var(--color-navy);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color var(--duration-fast) ease, background-color var(--duration-fast) ease;
}

.lang-switch:hover {
  border-color: var(--color-navy);
  background-color: var(--color-white);
}

/* Theme toggle: a button that needs JavaScript, so it is hidden without it */
.theme-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--color-border-strong);
  background: none;
  color: var(--color-navy);
  cursor: pointer;
  transition: border-color var(--duration-fast) ease, background-color var(--duration-fast) ease;
}

.theme-toggle:hover {
  border-color: var(--color-navy);
  background-color: var(--color-white);
}

html:not(.js) .theme-toggle {
  display: none;
}

/* Shows the theme you would switch to */
.theme-icon-sun,
html[data-theme="dark"] .theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-icon-sun {
  display: block;
}

.site-nav {
  margin-inline-start: auto;
}

/* Narrow phones: keep the brand, menu and theme buttons on one line.
   The "Menu" word stays available to screen readers. */
@media (max-width: 30rem) {
  .js .header-inner {
    flex-wrap: nowrap;
    gap: var(--space-s);
  }

  .js .nav-toggle-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* Without JavaScript the menu simply stays visible as a list */
.nav-toggle {
  display: none;
}

/* --- Mobile menu (enhanced by JavaScript; html.js is set in <head>) --- */
.js .nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.25rem;
  background: none;
  border: 0;
  color: var(--color-navy);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

html[lang="ar"].js .nav-toggle {
  font-size: 0.9375rem;
  letter-spacing: 0;
}

.nav-toggle-icon {
  position: relative;
  width: 1.375rem;
  height: 0.625rem;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  height: 1.5px;
  background-color: currentColor;
  transition: transform var(--duration-fast) var(--ease-out);
}

.nav-toggle-icon::before {
  top: 0;
}

.nav-toggle-icon::after {
  bottom: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before {
  transform: translateY(0.25rem) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after {
  transform: translateY(-0.25rem) rotate(-45deg);
}

.js .nav-panel {
  position: fixed;
  inset: var(--header-height) 0 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
  padding: var(--space-xl) var(--gutter) var(--space-2xl);
  overflow-y: auto;
  background-color: var(--color-ivory);
  /* Hidden menus must not be reachable with the keyboard: visibility does that */
  visibility: hidden;
  opacity: 0;
  transform: translateY(-0.5rem);
  transition: opacity var(--duration-fast) ease, transform var(--duration) var(--ease-out), visibility 0s linear var(--duration);
}

body.nav-open .nav-panel {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition-delay: 0s;
}

.js .nav-list a {
  display: flex;
  align-items: center;
  gap: var(--space-m);
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-navy);
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1.3;
}

/* Current page: a short gold rule plus a weight change (not colour alone) */
.js .nav-list a[aria-current="page"]::before {
  content: "";
  width: 1.25rem;
  height: 1px;
  background-color: var(--color-gold);
}

.js .nav-list a[aria-current="page"] {
  font-weight: 600;
}

.js .nav-panel .lang-switch {
  align-self: flex-start;
}

/* No-JS fallback: inline list under the brand */
html:not(.js) .nav-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-m);
  padding-bottom: var(--space-m);
}

html:not(.js) .nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-l);
}

html:not(.js) .site-nav {
  width: 100%;
}


/* 7. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  padding-block: var(--space-3xl) var(--space-xl);
  background-color: var(--color-navy-deep);
  color: var(--color-on-navy-muted);
  font-size: 0.9375rem;
}

.site-footer :focus-visible {
  outline-color: var(--color-gold);
}

.footer-grid {
  display: grid;
  gap: var(--space-2xl);
}

.footer-name {
  margin-bottom: var(--space-xs);
  color: var(--color-on-navy);
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: var(--weight-display);
  line-height: 1.3;
}

.footer-heading {
  margin-bottom: var(--space-m);
  color: var(--color-gold);
}

.footer-nav ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-xs) var(--space-l);
  padding: 0;
  list-style: none;
}

.footer-nav a {
  display: inline-block;
  padding-block: 0.25rem;
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}

.footer-nav a:hover,
.footer-nav a[aria-current="page"] {
  color: var(--color-on-navy);
}

.footer-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--color-gold);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m) var(--space-xl);
  margin-top: var(--space-2xl);
  padding-top: var(--space-l);
  border-top: 1px solid rgba(248, 246, 241, 0.12);
  font-size: 0.875rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-l);
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--color-on-navy);
  text-decoration-color: rgba(180, 154, 104, 0.6);
}

.site-footer .lang-switch {
  border-color: rgba(248, 246, 241, 0.3);
  color: var(--color-on-navy);
  text-decoration: none;
}

.site-footer .lang-switch:hover {
  background-color: rgba(248, 246, 241, 0.08);
  border-color: var(--color-on-navy);
}


/* 8. Homepage hero
   -------------------------------------------------------------------------- */
.hero {
  padding-block: clamp(2.5rem, 1rem + 5vw, 5.5rem) var(--section-space);
}

.hero-grid {
  display: grid;
  gap: var(--space-3xl);
  align-items: center;
}

.hero-title {
  margin-block: var(--space-m) var(--space-l);
  font-size: var(--step-5);
  letter-spacing: -0.012em;
}

html[lang="ar"] .hero-title {
  letter-spacing: 0;
}

.hero-affiliation {
  color: var(--color-text-muted);
  font-size: var(--step-1);
}

.hero-lead {
  max-width: 36rem;
  margin-top: var(--space-l);
  font-size: var(--step-1);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-m) var(--space-xl);
  margin-top: var(--space-2xl);
}

.hero-portrait {
  position: relative;
  width: min(100% - 1.25rem, 26rem);
}

/* Thin gold frame offset behind the portrait */
.hero-portrait::before {
  content: "";
  position: absolute;
  inset-block: 1.25rem -1.25rem;
  inset-inline: 1.25rem -1.25rem;
  border: 1px solid var(--color-gold);
}

.hero-portrait img {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background-color: var(--color-sand);
}

.hero-facts {
  display: grid;
  gap: var(--space-l);
  margin-top: var(--space-3xl);
  padding-top: var(--space-l);
  border-top: 1px solid var(--color-border-strong);
}

.hero-facts dt {
  margin-bottom: var(--space-2xs);
}

.hero-facts dd {
  color: var(--color-navy);
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: var(--weight-display);
  line-height: 1.4;
}


/* 9. Homepage sections
   -------------------------------------------------------------------------- */
.intro-grid {
  display: grid;
  gap: var(--space-xl);
}

.intro-statement {
  color: var(--color-navy);
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: var(--weight-display);
  line-height: 1.3;
}

/* Career highlights: numbered columns separated by hairlines */
.highlights {
  display: grid;
  padding: 0;
  list-style: none;
}

.highlight {
  display: grid;
  align-content: start;
  gap: var(--space-xs);
  padding-block: var(--space-l) var(--space-xl);
  border-top: 1px solid var(--color-border-strong);
}

.highlight-number {
  color: var(--color-gold-text);
  font-family: var(--font-latin-display);
  font-size: 1.125rem;
  font-style: italic;
}

.highlight-title {
  font-size: var(--step-2);
}

.highlight-meta {
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.section-foot {
  margin-top: var(--space-xl);
}

/* Contact call to action */
.cta {
  display: grid;
  gap: var(--space-xl);
  align-items: end;
}

.cta .section-index {
  color: var(--color-gold);
}

.cta-title {
  max-width: 38rem;
  color: var(--color-on-navy);
  font-size: var(--step-4);
}


/* 10. Inner page hero
   -------------------------------------------------------------------------- */
.page-hero {
  padding-block: clamp(3rem, 2rem + 5vw, 6.5rem) clamp(2.5rem, 2rem + 3vw, 4.5rem);
  border-bottom: 1px solid var(--color-border);
}

.page-title {
  margin-top: var(--space-m);
  font-size: var(--step-5);
  letter-spacing: -0.012em;
}

html[lang="ar"] .page-title {
  letter-spacing: 0;
}

.page-lead {
  max-width: 42rem;
  margin-top: var(--space-l);
}


/* 11. Academic profile page
   -------------------------------------------------------------------------- */
.profile-layout {
  display: grid;
  gap: var(--space-2xl);
}

.toc {
  display: none;
}

.toc-list {
  padding: 0;
  list-style: none;
  border-inline-start: 1px solid var(--color-border-strong);
}

.toc-list a {
  display: block;
  margin-inline-start: -1px;
  padding: 0.45rem 1.1rem;
  border-inline-start: 2px solid transparent;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
  text-decoration: none;
  transition: color var(--duration-fast) ease, border-color var(--duration-fast) ease;
}

.toc-list a:hover {
  color: var(--color-navy);
}

.toc-list a.is-active {
  border-inline-start-color: var(--color-gold);
  color: var(--color-navy);
  font-weight: 500;
}

.profile-section + .profile-section {
  margin-top: var(--space-3xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--color-border);
}

.profile-section-title {
  margin-bottom: var(--space-l);
  font-size: var(--step-3);
}

.bio-grid {
  display: grid;
  gap: var(--space-xl);
}

.bio-portrait {
  max-width: 15rem;
}

.bio-portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

/* Entries with a date column (qualifications, appointments...) */
.entry-list {
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--color-border);
}

.entry {
  display: grid;
  gap: var(--space-2xs) var(--space-xl);
  padding-block: var(--space-l);
  border-top: 1px solid var(--color-border);
}

.entry-date {
  color: var(--color-gold-text);
  font-family: var(--font-latin-display);
  font-size: 1.125rem;
  font-style: italic;
}

html[lang="ar"] .entry-date {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-style: normal;
}

.entry-title {
  font-size: var(--step-1);
}

.entry-place {
  color: var(--color-text-muted);
}

.interest-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: var(--space-s) var(--space-xl);
  padding: 0;
  list-style: none;
}

.interest-list li {
  position: relative;
  padding-inline-start: 1.75rem;
}

.interest-list li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.85em;
  width: 0.875rem;
  height: 1px;
  background-color: var(--color-gold);
}

/* Older entries of a long list, folded under a "more" control */
.profile-more {
  margin-top: var(--space-xs);
}

.profile-more summary {
  margin-bottom: var(--space-xs);
}

.profile-more:not([open]) summary {
  margin-bottom: 0;
}


/* 12. Publications
   -------------------------------------------------------------------------- */
.pub-list {
  border-bottom: 1px solid var(--color-border);
}

.pub {
  display: grid;
  gap: var(--space-2xs) var(--space-xl);
  padding-block: var(--space-xl);
  border-top: 1px solid var(--color-border);
}

.pub-year {
  color: var(--color-gold-text);
  font-family: var(--font-latin-display);
  font-size: 1.25rem;
  font-style: italic;
  line-height: 1.4;
}

html[lang="ar"] .pub-year {
  font-family: var(--font-body);
  font-size: 1rem;
  font-style: normal;
}

.pub-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-s);
  margin-bottom: var(--space-xs);
}

.pub-category {
  font-size: 0.75rem;
}

html[lang="ar"] .pub-category {
  font-size: 0.875rem;
}

.pub-title {
  font-size: var(--step-2);
  line-height: 1.3;
}

html[lang="ar"] .pub-title {
  line-height: 1.6;
}

.pub-title a {
  color: inherit;
}

.pub-title-alt {
  margin-top: var(--space-2xs);
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.pub-meta {
  margin-top: var(--space-xs);
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.pub-meta-sep {
  margin-inline: 0.5em;
  color: var(--color-gold-text);
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-l);
  margin-top: var(--space-s);
  padding: 0;
  list-style: none;
}

.pub-links .link-arrow {
  font-size: 0.875rem;
}

.pub-abstract {
  margin-top: var(--space-s);
}

.pub-abstract summary,
.profile-more summary {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  color: var(--color-navy);
  font-size: 0.875rem;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}

.pub-abstract summary::-webkit-details-marker,
.profile-more summary::-webkit-details-marker {
  display: none;
}

/* Plus sign that turns into a minus when open */
.pub-abstract summary::before,
.profile-more summary::before {
  content: "";
  width: 0.75rem;
  height: 0.75rem;
  background:
    linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1px 100% no-repeat;
  transition: background-size var(--duration-fast) ease;
}

.pub-abstract[open] summary::before,
.profile-more[open] summary::before {
  background-size: 100% 1px, 1px 0;
}

.pub-abstract p {
  max-width: 68ch;
  padding-block: var(--space-xs) var(--space-s);
  padding-inline-start: 1.35rem;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

/* Research page: search and filters */
.research-tools {
  display: grid;
  gap: var(--space-l);
  padding-block: var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.search-field label,
.filter-label {
  display: block;
  margin-bottom: var(--space-xs);
}

.search-input {
  width: 100%;
  padding: 0.65rem 0;
  border: 0;
  border-bottom: 1px solid var(--color-navy);
  border-radius: 0;
  background: transparent;
  color: var(--color-navy);
  font-size: var(--step-1);
  -webkit-appearance: none;
  appearance: none;
}

.search-input::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.chip {
  min-height: 2.5rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--color-border-strong);
  background: transparent;
  font-size: 0.875rem;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color var(--duration-fast) ease, border-color var(--duration-fast) ease, color var(--duration-fast) ease;
}

.chip:hover {
  border-color: var(--color-navy);
}

.chip[aria-pressed="true"] {
  border-color: var(--color-surface-navy);
  background-color: var(--color-surface-navy);
  color: var(--color-on-navy);
}

.tools-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
}

.results-count {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.clear-filters {
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-navy);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--color-gold);
  text-underline-offset: 0.25em;
  cursor: pointer;
}

.pub-group {
  display: grid;
  gap: var(--space-s);
  padding-top: var(--space-2xl);
}

.pub-group-year {
  color: var(--color-navy);
  font-family: var(--font-latin-display);
  font-size: var(--step-4);
  font-weight: 500;
  line-height: 1.1;
}

/* Inside a year group the year column would be repeated, so hide it */
.pub-group .pub-year {
  display: none;
}

.empty-state {
  padding-block: var(--space-2xl);
  color: var(--color-text-muted);
}


/* 13. Books
   -------------------------------------------------------------------------- */
.book-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2xl) var(--space-l);
}

.book-cover {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  aspect-ratio: 2 / 3;
  margin-bottom: var(--space-l);
}

.book-cover img {
  width: auto;
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 1px 2px rgba(15, 31, 44, 0.08), 0 18px 32px -20px rgba(15, 31, 44, 0.4);
  transition: transform var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
}

a.book-cover:hover img,
a.book-cover:focus-visible img {
  transform: translateY(-6px);
  box-shadow: 0 1px 2px rgba(15, 31, 44, 0.08), 0 26px 40px -22px rgba(15, 31, 44, 0.45);
}

.book-meta {
  color: var(--color-gold-text);
  font-size: 0.875rem;
}

.book-title {
  margin-top: var(--space-2xs);
  font-size: var(--step-2);
  line-height: 1.3;
}

html[lang="ar"] .book-title {
  line-height: 1.6;
}

.book-publisher,
.book-language {
  margin-top: var(--space-2xs);
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.book-desc {
  margin-top: var(--space-s);
  font-size: 0.9375rem;
}

.book-info .tag,
.book-info .link-arrow {
  margin-top: var(--space-s);
}

/* Homepage: compact rows on mobile (cover beside text) */
.book-grid--featured {
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

.book-grid--featured .book {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: var(--space-l);
  align-items: center;
}

.book-grid--featured .book-cover {
  margin-bottom: 0;
}


/* 14. Achievements and certificates
   -------------------------------------------------------------------------- */
.achievement-list {
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--color-border);
}

.achievement {
  display: grid;
  gap: var(--space-2xs) var(--space-xl);
  padding-block: var(--space-l);
  border-top: 1px solid var(--color-border);
}

.achievement-year {
  color: var(--color-gold-text);
  font-family: var(--font-latin-display);
  font-size: 1.125rem;
  font-style: italic;
}

html[lang="ar"] .achievement-year {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-style: normal;
}

.achievement-title {
  font-size: var(--step-2);
  line-height: 1.3;
}

html[lang="ar"] .achievement-title {
  line-height: 1.6;
}

.achievement-issuer {
  margin-top: var(--space-2xs);
  color: var(--color-text-muted);
}

.achievement-desc {
  max-width: 64ch;
  margin-top: var(--space-xs);
  font-size: 0.9375rem;
}

.subsection + .subsection {
  margin-top: var(--section-space);
}

.subsection-title {
  margin-bottom: var(--space-xl);
  font-size: var(--step-3);
}

.certificate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: var(--space-2xl) var(--space-xl);
  padding: 0;
  list-style: none;
}

.certificate-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  padding: var(--space-m);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background-color: var(--color-white);
  cursor: zoom-in;
}

.certificate-link img {
  width: auto;
  max-height: 100%;
  object-fit: contain;
  transition: transform var(--duration-slow) var(--ease-out);
}

.certificate-link:hover img,
.certificate-link:focus-visible img {
  transform: scale(1.03);
}

.certificate-zoom {
  position: absolute;
  inset-block-end: 0.75rem;
  inset-inline-end: 0.75rem;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  background-color: var(--color-surface-navy);
  color: var(--color-on-navy);
  opacity: 0;
  transition: opacity var(--duration-fast) ease;
}

.certificate-link:hover .certificate-zoom,
.certificate-link:focus-visible .certificate-zoom {
  opacity: 1;
}

/* Touch screens have no hover: always show the enlarge hint */
@media (hover: none) {
  .certificate-zoom {
    opacity: 1;
  }
}

.certificate-title {
  margin-top: var(--space-m);
  font-size: var(--step-1);
  line-height: 1.4;
}

.certificate-meta {
  margin-top: var(--space-2xs);
  color: var(--color-text-muted);
  font-size: 0.875rem;
}


/* 15. Lightbox (native <dialog>)
   -------------------------------------------------------------------------- */
.lightbox {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 4.5rem var(--gutter) 2rem;
  border: 0;
  background: transparent;
  color: var(--color-on-navy);
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox::backdrop {
  background-color: rgba(15, 31, 44, 0.93);
}

.lightbox-figure {
  display: grid;
  justify-items: center;
  gap: var(--space-m);
  max-width: 72rem;
}

.lightbox-image {
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - 10rem);
  max-height: calc(100dvh - 10rem);
  background-color: var(--color-white);
}

.lightbox-caption {
  max-width: 48rem;
  color: var(--color-on-navy);
  text-align: center;
}

.lightbox-close {
  position: fixed;
  top: var(--space-m);
  inset-inline-end: var(--space-m);
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 1px solid rgba(248, 246, 241, 0.45);
  background: transparent;
  color: var(--color-on-navy);
  cursor: pointer;
  transition: background-color var(--duration-fast) ease;
}

.lightbox-close:hover {
  background-color: rgba(248, 246, 241, 0.1);
}

.lightbox :focus-visible {
  outline-color: var(--color-gold);
}


/* 16. Contact
   -------------------------------------------------------------------------- */
.contact-grid {
  display: grid;
  gap: var(--space-3xl);
}

.contact-block-title {
  margin-bottom: var(--space-l);
}

.contact-email {
  display: inline-block;
  color: var(--color-navy);
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: var(--weight-display);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* Keeps the whole email address on one line at every width */
@media (max-width: 80em) {
  .contact-email {
    font-size: var(--step-2);
  }
}

@media (max-width: 30rem) {
  .contact-email {
    font-size: 1.1875rem;
  }
}

.contact-details {
  display: grid;
  gap: var(--space-2xl);
  align-content: start;
}

/* The display font's old-style figures are hard to read in a phone number */
.contact-phone {
  font-variant-numeric: lining-nums;
}

.contact-title-icon {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.contact-note {
  max-width: 34rem;
  margin-top: var(--space-l);
  color: var(--color-text-muted);
}

.profile-label:has(.profile-icon) {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.profile-list {
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--color-border);
}

.profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m);
  padding-block: var(--space-l);
  border-top: 1px solid var(--color-border);
  color: var(--color-navy);
  text-decoration: none;
}

a.profile-row:hover .profile-label {
  color: var(--color-navy-soft);
}

.profile-label {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: var(--weight-display);
  line-height: 1.3;
  transition: color var(--duration-fast) ease;
}

.profile-value {
  display: block;
  margin-top: var(--space-2xs);
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 0.875rem;
}


/* 17. Language entry page (root index.html)
   -------------------------------------------------------------------------- */
.entry-page {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  min-height: 100dvh;
}

.entry-page .theme-toggle {
  position: absolute;
  top: var(--space-m);
  inset-inline-end: var(--gutter);
}

.entry-header {
  padding-block: var(--space-3xl) var(--space-2xl);
  text-align: center;
}

.entry-name {
  margin-top: var(--space-m);
  font-size: var(--step-4);
}

.entry-name[lang="ar"] {
  margin-top: var(--space-2xs);
  font-family: var(--font-arabic-display);
  font-weight: 600;
  line-height: 1.5;
}

.entry-choices {
  display: grid;
  border-top: 1px solid var(--color-border);
}

.entry-choice {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-s);
  padding: var(--space-2xl) var(--gutter);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-navy);
  text-decoration: none;
  transition: background-color var(--duration) ease;
}

.entry-choice:hover {
  background-color: var(--color-white);
}

.entry-choice-lang {
  font-family: var(--font-latin-display);
  font-size: var(--step-4);
  font-weight: 500;
  line-height: 1.2;
}

.entry-choice[lang="ar"] .entry-choice-lang {
  font-family: var(--font-arabic-display);
  font-weight: 600;
  line-height: 1.6;
}

.entry-choice-action {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--color-text-muted);
}

.entry-footer {
  padding-block: var(--space-xl);
  color: var(--color-text-muted);
  font-size: 0.875rem;
  text-align: center;
}


/* 18. Tags and notices
   -------------------------------------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border: 1px solid currentColor;
  color: var(--color-gold-text);
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.6;
  text-transform: uppercase;
  vertical-align: middle;
}

html[lang="ar"] .tag {
  font-size: 0.75rem;
  letter-spacing: 0;
  text-transform: none;
}

/* Dashed border distinguishes "translation needed" from "sample" without relying on colour */
.tag-translation {
  border-style: dashed;
  color: var(--color-text-muted);
}

.noscript-note {
  padding: var(--space-l);
  border: 1px dashed var(--color-border-strong);
  color: var(--color-text-muted);
}


/* 19. Motion
   -------------------------------------------------------------------------- */

/* Hero entrance: runs in pure CSS, so content shows even if JavaScript fails */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(1.25rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes unveil {
  from {
    clip-path: inset(0 0 100% 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.anim-rise {
  animation: rise var(--duration-slow) var(--ease-out) both;
}

.anim-delay-1 { animation-delay: 0.08s; }
.anim-delay-2 { animation-delay: 0.16s; }
.anim-delay-3 { animation-delay: 0.24s; }
.anim-delay-4 { animation-delay: 0.32s; }
.anim-delay-5 { animation-delay: 0.4s; }

.hero-portrait img {
  animation: unveil 1.2s var(--ease-in-out) 0.2s both;
}

.hero-portrait::before {
  animation: fade-in 1.2s ease 0.9s both;
}

/* Scroll reveals: only hidden once main.js has confirmed it can reveal them */
.reveal-ready .reveal {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}

.reveal-ready .reveal.is-visible {
  opacity: 1;
  transform: none;
}

.lightbox[open] .lightbox-figure {
  animation: rise 0.45s var(--ease-out) both;
}

/* Smooth scrolling and cross-page fades only for people who want motion */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  @view-transition {
    navigation: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }

  .reveal-ready .reveal {
    opacity: 1;
    transform: none;
  }
}
