/* ==========================================================================
   Fouad Shami — Personal Academic & Research Website
   Stylesheet structure
   --------------------------------------------------------------------------
   01. Design tokens (edit these to restyle the whole site)
   02. Reset & base elements
   03. Typography helpers
   04. Layout primitives (container, section, section head)
   05. Buttons, links, pills, tags
   06. Media placeholders & portrait frames
   07. Header / navigation
   08. Hero
   09. About
   10. Research
   11. Contact
   12. Footer & back-to-top
   13. Motion / reveal animations
   14. Responsive adjustments
   15. Reduced motion, print, high-contrast
   16. Header tools & language selector
   17. Language-specific typography (ar / he)
   18. Right-to-left adjustments
   19. Article pages (full research write-ups)
   ========================================================================== */

/* ==========================================================================
   01. DESIGN TOKENS
   Change a value here and it updates everywhere.
   ========================================================================== */
:root {
  /* --- Colour: surfaces ------------------------------------------------- */
  --color-bg:           #faf9f7;  /* page background (warm paper white)      */
  --color-bg-alt:       #f3f1ec;  /* alternating section background          */
  --color-surface:      #ffffff;  /* cards, panels                          */
  --color-surface-2:    #fbfaf8;  /* nested panels                          */

  /* --- Colour: text ----------------------------------------------------- */
  --color-ink:          #16191c;  /* headings, primary text                 */
  --color-ink-soft:     #34393f;  /* body copy                              */
  --color-muted:        #5f666d;  /* meta, captions (AA on both surfaces)    */

  /* --- Colour: lines & accent ------------------------------------------ */
  --color-line:         #e4e0d9;  /* hairlines, borders                     */
  --color-line-strong:  #d3cec4;
  --color-accent:       #14625b;  /* the single refined accent (deep teal)  */
  --color-accent-hover: #0f4b46;
  --color-accent-tint:  rgba(20, 98, 91, 0.08);
  --color-accent-line:  rgba(20, 98, 91, 0.22);
  --color-focus:        #14625b;

  /* --- Typography ------------------------------------------------------- */
  --font-display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-sans:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Fluid type scale (min → max) */
  --fs-2xs:  0.6875rem;                             /* 11px  */
  --fs-xs:   0.75rem;                               /* 12px  */
  --fs-sm:   0.8125rem;                             /* 13px  */
  --fs-base: 1rem;                                  /* 16px  */
  --fs-md:   clamp(1.0625rem, 0.35vw + 0.98rem, 1.1875rem);
  --fs-lg:   clamp(1.1875rem, 0.5vw + 1.08rem, 1.375rem);
  --fs-xl:   clamp(1.375rem, 0.9vw + 1.18rem, 1.75rem);
  --fs-2xl:  clamp(1.75rem, 1.6vw + 1.4rem, 2.5rem);
  --fs-3xl:  clamp(2.25rem, 2.6vw + 1.65rem, 3.5rem);
  --fs-4xl:  clamp(2.75rem, 5.2vw + 1.3rem, 5.5rem);

  --lh-tight:  1.08;
  --lh-snug:   1.28;
  --lh-normal: 1.55;
  --lh-loose:  1.75;

  --tracking-tight:  -0.02em;
  --tracking-normal: 0;
  --tracking-wide:   0.06em;
  --tracking-widest: 0.16em;

  /* --- Spacing scale ---------------------------------------------------- */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.5rem;
  --space-6:  2rem;
  --space-7:  2.5rem;
  --space-8:  3rem;
  --space-9:  4rem;
  --space-10: 5rem;
  --space-11: 6.5rem;
  --space-12: 8rem;

  /* --- Layout ----------------------------------------------------------- */
  --container:        76rem;   /* 1216px */
  --container-narrow: 46rem;   /* reading width */
  --gutter:           clamp(1.25rem, 4vw, 3rem);
  --section-y:        clamp(3rem, 6vw, 6rem);
  --header-h:         5.25rem;
  --header-h-compact: 4.25rem;

  /* --- Radii, shadows, motion ------------------------------------------ */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(22, 25, 28, 0.04), 0 2px 8px rgba(22, 25, 28, 0.03);
  --shadow-md: 0 2px 6px rgba(22, 25, 28, 0.05), 0 12px 32px rgba(22, 25, 28, 0.06);
  --shadow-lg: 0 8px 20px rgba(22, 25, 28, 0.07), 0 28px 60px rgba(22, 25, 28, 0.08);

  --dur-fast: 160ms;
  --dur-base: 280ms;
  --dur-slow: 620ms;
  --ease:      cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   02. RESET & BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-ink-soft);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  font-weight: 400;
  letter-spacing: 0.001em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}


h1, h2, h3, h4 {
  margin: 0;
  color: var(--color-ink);
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-snug);
  text-wrap: balance;
}

p { margin: 0 0 var(--space-4); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0; padding: 0; list-style: none; }

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

a { color: var(--color-accent); text-decoration: none; }

button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }

em { font-style: italic; }

/* --- Focus visibility (keyboard accessibility) ------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--color-accent);
  color: #fff;
}

/* --- Skip link --------------------------------------------------------- */
.skip-link {
  position: fixed;
  top: var(--space-3);
  inset-inline-start: var(--space-3);
  z-index: 200;
  padding: var(--space-2) var(--space-4);
  background: var(--color-ink);
  color: #fff;
  font-size: var(--fs-sm);
  border-radius: var(--radius-pill);
  transform: translateY(-160%);
  transition: transform var(--dur-base) var(--ease);
}
.skip-link:focus-visible { transform: translateY(0); }

/* Screen-reader-only utility */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   03. TYPOGRAPHY HELPERS
   ========================================================================== */
.eyebrow {
  margin: 0 0 var(--space-5);
  color: var(--color-accent);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 2.25rem;
  height: 1px;
  margin-inline-end: var(--space-3);
  vertical-align: middle;
  background: var(--color-accent-line);
}

.lede {
  color: var(--color-ink-soft);
  font-size: var(--fs-lg);
  line-height: var(--lh-loose);
  font-weight: 300;
}

.minor-title {
  margin: 0 0 var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
}

/* Small meta row used on cards */
.card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0 0 var(--space-3);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
}
.card-meta__cat { color: var(--color-accent); }
.card-meta__dot {
  width: 3px; height: 3px;
  flex: none;
  border-radius: 50%;
  background: var(--color-line-strong);
}

/* ==========================================================================
   04. LAYOUT PRIMITIVES
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  padding-block: var(--section-y);
}
.section--alt {
  background: var(--color-bg-alt);
  border-block: 1px solid var(--color-line);
}

.section__head {
  max-width: var(--container-narrow);
  margin-bottom: clamp(2.5rem, 5vw, 4.5rem);
}
.section__index {
  margin: 0 0 var(--space-4);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  color: var(--color-muted);
}
.section__index::after {
  content: "";
  display: inline-block;
  width: 2rem; height: 1px;
  margin-inline-start: var(--space-3);
  vertical-align: middle;
  background: var(--color-line-strong);
}
.section__title {
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-4);
}
.section__intro {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--fs-md);
  line-height: var(--lh-loose);
  font-weight: 300;
  max-width: 46ch;
}

/* ==========================================================================
   05. BUTTONS, LINKS, PILLS
   ========================================================================== */
.btn {
  --btn-y: 0.9rem;
  --btn-x: 1.75rem;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--btn-y) var(--btn-x);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  transition: background-color var(--dur-base) var(--ease),
              color var(--dur-base) var(--ease),
              border-color var(--dur-base) var(--ease),
              transform var(--dur-base) var(--ease),
              box-shadow var(--dur-base) var(--ease);
}
.btn--primary {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(20, 98, 91, 0.2);
}
.btn--primary:hover {
  background: var(--color-accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(20, 98, 91, 0.18);
}
.btn--ghost {
  color: var(--color-ink);
  border-color: var(--color-line-strong);
  background: transparent;
}
.btn--ghost:hover {
  border-color: var(--color-ink);
  transform: translateY(-2px);
}
.btn:active { transform: translateY(0); }

/* Inline text link with animated underline */
.text-link {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  color: var(--color-accent);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  padding-bottom: 2px;
}
.text-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-base) var(--ease-out);
}
.text-link:hover::after { transform: scaleX(1); }
.text-link:hover { color: var(--color-accent-hover); }

/* Tiny external-link arrow */
.text-link__ext {
  display: inline-block;
  width: 0.55em; height: 0.55em;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(0.05em);
  transition: transform var(--dur-base) var(--ease);
}
.text-link:hover .text-link__ext { transform: rotate(45deg) translate(0.12em, -0.05em); }

/* "Read More" toggle button */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0;
  margin-top: var(--space-4);
  background: none;
  border: 0;
  color: var(--color-accent);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.link-btn__text { position: relative; padding-bottom: 3px; }
.link-btn__text::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-base) var(--ease-out);
}
.link-btn:hover .link-btn__text::after { transform: scaleX(1); }
.link-btn__icon {
  position: relative;
  width: 9px; height: 9px;
  transition: transform var(--dur-base) var(--ease);
}
.link-btn__icon::before,
.link-btn__icon::after {
  content: "";
  position: absolute;
  background: currentColor;
  transition: opacity var(--dur-base) var(--ease);
}
.link-btn__icon::before { top: 4px; left: 0; width: 9px; height: 1px; }
.link-btn__icon::after  { left: 4px; top: 0; width: 1px; height: 9px; }
.link-btn[aria-expanded="true"] .link-btn__icon::after { opacity: 0; }

/* Pills & tag lists */
.pill {
  display: inline-block;
  padding: 0.3em 0.85em;
  border: 1px solid var(--color-accent-line);
  border-radius: var(--radius-pill);
  background: var(--color-accent-tint);
  color: var(--color-accent);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  line-height: 1.6;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.tag-list li {
  padding: 0.4em 0.9em;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  color: var(--color-ink-soft);
  font-size: var(--fs-sm);
  transition: border-color var(--dur-base) var(--ease),
              transform var(--dur-base) var(--ease);
}
.tag-list li:hover {
  border-color: var(--color-accent-line);
  transform: translateY(-1px);
}

/* ==========================================================================
   06. MEDIA PLACEHOLDERS & PORTRAIT FRAMES
   Delete these blocks in the HTML once real images are added.
   ========================================================================== */
.media-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  height: 100%;
  padding: var(--space-5);
  text-align: center;
  background-color: var(--color-surface-2);
  background-image:
    linear-gradient(135deg, rgba(20, 98, 91, 0.045) 0%, rgba(20, 98, 91, 0) 55%),
    repeating-linear-gradient(45deg, rgba(22, 25, 28, 0.028) 0 1px, transparent 1px 9px);
  border: 1px solid var(--color-line);
  border-radius: inherit;
}
.media-placeholder__label {
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
}
.media-placeholder__hint {
  font-size: var(--fs-2xs);
  letter-spacing: 0.04em;
  color: var(--color-muted);
  opacity: 0.75;
}
.media-placeholder--portrait { aspect-ratio: 4 / 5; }
.media-placeholder--wide     { aspect-ratio: 16 / 10; }

.portrait-frame {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}
.portrait-frame > img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}
/* Thin accent rule that frames the portrait */
.portrait-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(22, 25, 28, 0.06);
  border-radius: inherit;
  pointer-events: none;
}
.portrait-frame--soft { box-shadow: var(--shadow-sm); }

/* ==========================================================================
   07. HEADER / NAVIGATION
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 249, 247, 0.72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur-base) var(--ease),
              border-color var(--dur-base) var(--ease),
              box-shadow var(--dur-base) var(--ease);
}
.site-header.is-scrolled {
  background: rgba(250, 249, 247, 0.88);
  border-bottom-color: var(--color-line);
  box-shadow: 0 1px 24px rgba(22, 25, 28, 0.04);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  height: var(--header-h);
  transition: height var(--dur-base) var(--ease);
}
.site-header.is-scrolled .site-header__inner { height: var(--header-h-compact); }

/* Reading-progress hairline */
.site-header__progress {
  position: absolute;
  left: 0; bottom: -1px;
  height: 1px;
  width: 100%;
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
  background: var(--color-accent);
  opacity: 0.75;
}

/* --- Brand ------------------------------------------------------------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-ink);
  min-width: 0;
}
.brand__mark {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 30%;
  transition: transform var(--dur-base) var(--ease);
}
.brand:hover .brand__mark {
  transform: scale(1.06);
}

/* --- Desktop navigation ------------------------------------------------ */
.nav__list {
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 1.4vw, 1.35rem);
}
.nav__link {
  position: relative;
  display: inline-block;
  padding: var(--space-2) 0;
  color: var(--color-ink-soft);
  font-size: var(--fs-sm);
  font-weight: 400;
  letter-spacing: 0.02em;
  transition: color var(--dur-base) var(--ease);
}
.nav__link::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-base) var(--ease-out);
}
.nav__link:hover { color: var(--color-ink); }
.nav__link:hover::after { transform: scaleX(1); }
.nav__link.is-active { color: var(--color-accent); }
.nav__link.is-active::after { transform: scaleX(1); }

.nav__link--cta {
  margin-inline-start: var(--space-3);
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-pill);
  color: var(--color-ink);
  transition: border-color var(--dur-base) var(--ease),
              background-color var(--dur-base) var(--ease),
              color var(--dur-base) var(--ease);
}
.nav__link--cta::after { display: none; }
.nav__link--cta:hover,
.nav__link--cta.is-active {
  background: var(--color-ink);
  border-color: var(--color-ink);
  color: #fff;
}

/* ==========================================================================
   08. HERO
   ========================================================================== */
.hero {
  position: relative;
  padding-block: clamp(3.5rem, 8vw, 7rem) clamp(4rem, 9vw, 8rem);
  overflow: hidden;
}
/* Very soft accent wash — keeps the top of the page from feeling flat */
.hero__glow {
  position: absolute;
  top: -22rem; inset-inline-end: -14rem;
  width: 46rem; height: 46rem;
  background: radial-gradient(circle at center, rgba(20, 98, 91, 0.09), rgba(20, 98, 91, 0) 62%);
  pointer-events: none;
}
/* Hairline that anchors the hero to the section below */
.hero::after {
  content: "";
  position: absolute;
  left: var(--gutter); right: var(--gutter);
  bottom: 0; height: 1px;
  background: linear-gradient(to right, transparent, var(--color-line) 18%, var(--color-line) 82%, transparent);
}

.hero__inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2.5rem, 6vw, 5.5rem);
  align-items: center;
}

.hero__title {
  font-size: var(--fs-4xl);
  line-height: var(--lh-tight);
  margin-bottom: var(--space-4);
    white-space: nowrap;

}
.hero__subtitle {
  margin-bottom: var(--space-6);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: var(--fs-xl);
  color: var(--color-accent);
  letter-spacing: 0;
}
.hero__statement {
  max-width: 52ch;
  margin-bottom: var(--space-7);
  padding-inline-start: var(--space-5);
  border-inline-start: 1px solid var(--color-line-strong);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.hero__portrait { margin: 0; }
.hero__portrait-caption {
  margin-top: var(--space-4);
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
  text-align: end;
}

/* ==========================================================================
   09. ABOUT
   ========================================================================== */
.about__grid {
  display: grid;
  align-items: start;
}

.about__body { max-width: 62ch; }
.about__body p { line-height: var(--lh-loose); }
.about__lede {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  line-height: 1.6;
  color: var(--color-ink);
  margin-bottom: var(--space-5);
}
.about__lists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-line);
}

/* ==========================================================================
   10. RESEARCH
   ========================================================================== */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 24rem));
  gap: clamp(1.5rem, 2.5vw, 2.25rem);
  /* Centers the row instead of pinning it to the left — matters most
     with only one or two cards, where auto-fit would otherwise leave
     all the leftover width stranded on the right. */
  justify-content: center;
}

.research-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  color: inherit;
  transition: transform var(--dur-base) var(--ease),
              box-shadow var(--dur-base) var(--ease),
              border-color var(--dur-base) var(--ease);
}
.research-card:hover,
.research-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--color-line-strong);
  box-shadow: var(--shadow-md);
}
.research-card__media {
  position: relative;
  border-radius: 0;
  overflow: hidden;
  background: var(--color-surface-2);
}
.research-card__media > img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: 65% center;
  transition: transform var(--dur-slow) var(--ease-out);
}
.research-card:hover .research-card__media > img,
.research-card:focus-visible .research-card__media > img { transform: scale(1.02); }
.research-card__media .media-placeholder { border: 0; border-bottom: 1px solid var(--color-line); border-radius: 0; }

.research-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: clamp(1.5rem, 2.2vw, 2rem);
}
.research-card__title {
  font-size: var(--fs-xl);
  margin-bottom: var(--space-3);
}
.research-card__desc {
  color: var(--color-ink-soft);
  font-size: var(--fs-base);
  line-height: var(--lh-loose);
  font-weight: 300;
  margin-bottom: 0;
}
.research-card .link-btn { margin-top: auto; padding-top: var(--space-5); align-self: flex-start; }
/* The whole card is the link now, so the "Read More" underline responds
   to hovering anywhere on the card, not just the label itself. */
.research-card:hover .link-btn__text::after,
.research-card:focus-visible .link-btn__text::after { transform: scaleX(1); }

/* --- Featured layout for a single entry ---------------------------------
   With only one research item, a narrow vertical card floats in a lot of
   empty space and feels disconnected from the left-aligned section header
   above it. :only-child makes it stretch to a wide, horizontal "featured"
   layout instead — image on one side, text on the other — matching the
   container width like the rest of the page.
   The moment a second <a class="research-card"> is added, :only-child no
   longer matches and this block stops applying automatically; the grid
   above reflows into the normal card layout with zero changes needed. */
.research-grid:has(> .research-card:only-child) {
  grid-template-columns: 1fr;
  justify-content: stretch;
}
.research-card:only-child {
  flex-direction: row;
  max-width: none;
}
.research-card:only-child .research-card__media {
  flex: 0 0 42%;
}
.research-card:only-child .research-card__media > img {
  height: 100%;
  aspect-ratio: auto;
}
.research-card:only-child .research-card__body {
  padding: clamp(2rem, 3vw, 3rem);
  justify-content: center;
}
.research-card:only-child .research-card__title {
  font-size: var(--fs-2xl);
}
.research-card:only-child .research-card__desc {
  max-width: 42ch;
}

@media (max-width: 48rem) {
  /* Not enough room for a side-by-side split on small screens — falls
     back to the normal stacked card. */
  .research-card:only-child {
    flex-direction: column;
  }
  .research-card:only-child .research-card__media {
    flex: none;
  }
  .research-card:only-child .research-card__media > img {
    height: auto;
    aspect-ratio: 16 / 10;
  }
}

/* ==========================================================================
   11. CONTACT
   Editorial two-column layout, consistent with About / Research: a
   left column with the section index + serif heading + short statement,
   and a right column with plain information rows separated by hairlines.
   No card, no filled button — kept deliberately understated.
   ========================================================================== */
.contact-section {
  background: var(--color-bg-alt);
  border-block: 1px solid var(--color-line);
}
.contact {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: start;
}

.contact__intro { max-width: 32ch; }
.contact__statement {
  margin: 0;
  color: var(--color-ink-soft);
  font-size: var(--fs-md);
  line-height: var(--lh-loose);
  font-weight: 300;
}

.contact__details {
  display: grid;
  gap: var(--space-7);
  padding-top: var(--space-2);
}
.contact__row {
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-line);
}

.contact__email {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  letter-spacing: 0;
}
.contact__email-icon {
  width: 1rem;
  height: 1rem;
  flex: none;
  color: var(--color-accent);
  transition: transform var(--dur-base) var(--ease);
}
/* Underline draws in on hover, matching .text-link elsewhere on the site */
.contact__email span:not(.contact__email-arrow) {
  position: relative;
  padding-bottom: 2px;
}
.contact__email span:not(.contact__email-arrow)::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-base) var(--ease-out);
}
.contact__email:hover span:not(.contact__email-arrow)::after { transform: scaleX(1); }
.contact__email:hover { color: var(--color-accent); }
.contact__email:hover .contact__email-icon { transform: translateY(-1px); }

/* Small arrow that appears on hover, echoing .text-link__ext */
.contact__email-arrow {
  display: inline-block;
  width: 0.55em; height: 0.55em;
  margin-inline-start: 0.15em;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  opacity: 0;
  transform: rotate(45deg) translate(-0.15em, 0.1em);
  transition: opacity var(--dur-base) var(--ease),
              transform var(--dur-base) var(--ease);
}
.contact__email:hover .contact__email-arrow {
  opacity: 1;
  transform: rotate(45deg) translate(0, 0);
}

.contact__enquiries {
  margin: 0;
  color: var(--color-ink-soft);
  font-size: var(--fs-base);
}

/* ==========================================================================
   12. FOOTER & BACK-TO-TOP
   ========================================================================== */
.site-footer {
  padding-block: var(--space-6);
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-line);
}
.site-footer__inner {
  display: flex;
  justify-content: center;
}
.site-footer__legal {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--color-muted);
}

.to-top {
  position: fixed;
  inset-inline-end: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 90;
  display: grid;
  place-items: center;
  width: 2.75rem; height: 2.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-line-strong);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity var(--dur-base) var(--ease),
              transform var(--dur-base) var(--ease),
              visibility var(--dur-base) var(--ease),
              border-color var(--dur-base) var(--ease);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { border-color: var(--color-accent-line); transform: translateY(-2px); }
.to-top span {
  width: 8px; height: 8px;
  border-top: 1.5px solid var(--color-accent);
  border-right: 1.5px solid var(--color-accent);
  transform: rotate(-45deg) translate(1px, 1px);
}

/* ==========================================================================
   13. MOTION / REVEAL
   Elements marked [data-reveal] fade and rise into view once.
   main.js adds .is-visible; if JS is unavailable the fallback below
   keeps everything visible.
   ========================================================================== */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
  will-change: opacity, transform;
}
html.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   14. RESPONSIVE
   ========================================================================== */
@media (max-width: 62rem) { /* ≤ 992px — tablet landscape */
  .hero__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(2.5rem, 6vw, 4rem);
  }
  .hero__portrait { max-width: 22rem; }
  .hero__portrait-caption { text-align: left; }

  /* Contact collapses to a single column: heading + statement first,
     then the email / enquiries information underneath. */
  .contact {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-8);
  }
  .contact__intro { max-width: none; }
  .contact__details { padding-top: 0; }
}

@media (max-width: 56rem) { /* ≤ 896px */
  /* No hamburger menu on phones and tablets by design. The header keeps just
     the logo and the language switcher; visitors scroll the single page, and
     the back-to-top control handles the return trip. */
  .nav { display: none; }
}

@media (max-width: 40rem) { /* ≤ 640px — phones */
  :root {
    --header-h: 4.5rem;
    --header-h-compact: 4rem;
  }

  .hero__statement { padding-left: var(--space-4); }
  .hero__actions .btn { flex: 1 1 100%; }

  /* Portrait shrinks to a small, centered supporting image on phones
     instead of a near-full-width block dominating the top of the page. */
  .hero__portrait {
    max-width: 11rem;
    margin-inline: auto;
  }
  .hero__portrait-caption { text-align: center; }

  .site-footer__inner { flex-direction: column; align-items: flex-start; }
}

/* ==========================================================================
   15. REDUCED MOTION, PRINT, FORCED COLOURS
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  html.js [data-reveal] { opacity: 1; transform: none; }
  .nav .nav__link { opacity: 1; transform: none; }
}

@media print {
  .site-header, .to-top, .hero__glow { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .section { padding-block: 1.5rem; border: 0; }
  .section--alt { background: #fff; }
  .research-card, .contact { box-shadow: none; break-inside: avoid; }
  a::after { content: " (" attr(href) ")"; font-size: 9pt; color: #444; }
}

@media (forced-colors: active) {
  .btn, .to-top { border: 1px solid ButtonBorder; }
  .text-link::after, .nav__link::after { background: LinkText; }
}

/* ==========================================================================
   16. HEADER TOOLS & LANGUAGE SELECTOR
   ========================================================================== */
.header-tools {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: none;
}

.lang { position: relative; }

.lang__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  background: transparent;
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-pill);
  color: var(--color-ink);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  transition: border-color var(--dur-base) var(--ease),
              background-color var(--dur-base) var(--ease),
              color var(--dur-base) var(--ease);
}
.lang__btn:hover { border-color: var(--color-ink); }
.lang.is-open .lang__btn {
  border-color: var(--color-accent-line);
  background: var(--color-accent-tint);
  color: var(--color-accent);
}

.lang__icon {
  width: 15px; height: 15px;
  flex: none;
  color: var(--color-muted);
  transition: color var(--dur-base) var(--ease);
}
.lang__btn:hover .lang__icon,
.lang.is-open .lang__icon { color: var(--color-accent); }

.lang__code { line-height: 1; }

.lang__chevron {
  width: 6px; height: 6px;
  border-right: 1.4px solid currentColor;
  border-bottom: 1.4px solid currentColor;
  transform: rotate(45deg) translate(-1px, -2px);
  opacity: 0.65;
  transition: transform var(--dur-base) var(--ease);
}
.lang.is-open .lang__chevron { transform: rotate(-135deg) translate(-1px, -1px); }

.lang__menu {
  position: absolute;
  top: calc(100% + 0.55rem);
  inset-inline-end: 0;
  z-index: 130;
  display: grid;
  gap: 2px;
  min-width: 11.5rem;
  padding: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.lang__menu[hidden] { display: none; }
.lang.is-open .lang__menu { animation: lang-in var(--dur-base) var(--ease-out) both; }
@keyframes lang-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

.lang__menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--color-ink-soft);
  font-size: var(--fs-sm);
  text-align: start;
  transition: background-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.lang__menu button:hover {
  background: var(--color-bg-alt);
  color: var(--color-ink);
}
.lang__menu button[aria-current="true"] {
  background: var(--color-accent-tint);
  color: var(--color-accent);
  font-weight: 500;
}
/* Small dot marking the active language */
.lang__menu button[aria-current="true"]::after {
  content: "";
  width: 5px; height: 5px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

/* ==========================================================================
   17. LANGUAGE-SPECIFIC TYPOGRAPHY (ar / he)
   Fonts are loaded on demand by main.js, so these stacks only apply
   once the visitor selects that language.
   ========================================================================== */
html[lang="ar"] {
  --font-display: "Readex Pro", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-sans:    "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  /* Arabic script needs no tracking and a little more leading */
  --tracking-tight: 0;
  --tracking-normal: 0;
  --tracking-wide: 0;
  --tracking-widest: 0;
  --lh-tight: 1.32;
  --lh-snug: 1.45;
  --lh-normal: 1.7;
  --lh-loose: 1.9;
}

html[lang="he"] {
  --font-display: "Rubik", "Inter", "Segoe UI", sans-serif;
  --font-sans:    "Rubik", "Inter", "Segoe UI", sans-serif;
  --tracking-tight: 0;
  --tracking-wide: 0.02em;
  --tracking-widest: 0.06em;
  --lh-tight: 1.2;
  --lh-snug: 1.35;
  --lh-loose: 1.8;
}
/* Rubik at regular weight reads a little light at heading sizes, so headings
   get a step up to semibold instead of the Newsreader/Frank-Ruhl weight 400. */
html[lang="he"] h1,
html[lang="he"] h2,
html[lang="he"] h3,
html[lang="he"] h4 {
  font-weight: 600;
}

/* Neither script has capital letters, so uppercase styling is dropped and
   letter-spacing is neutralised on the small label elements. */
html:is([lang="ar"], [lang="he"]) :is(
  .eyebrow, .section__index, .card-meta, .minor-title, .btn, .pill,
  .media-placeholder__label,
  .hero__portrait-caption, .link-btn, .lang__btn, .nav__link
) {
  text-transform: none;
}
html[lang="ar"] :is(
  .eyebrow, .section__index, .card-meta, .minor-title, .btn, .pill,
  .media-placeholder__label,
  .hero__portrait-caption, .link-btn, .lang__btn
) {
  letter-spacing: 0;
}

/* Arabic and Hebrew have no true italics */
html:is([lang="ar"], [lang="he"]) :is(.hero__subtitle, em, i) { font-style: normal; }

/* Latin fragments such as file paths stay readable inside RTL text.
   Plain numbers (years) need no help — the bidi algorithm handles them. */
html:is([lang="ar"], [lang="he"]) .media-placeholder__hint {
  direction: ltr;
  unicode-bidi: isolate;
}

/* ==========================================================================
   18. RIGHT-TO-LEFT ADJUSTMENTS
   Most of the layout uses logical properties and flips on its own.
   These are the few details that need mirroring by hand.
   ========================================================================== */
[dir="rtl"] :is(.text-link, .nav__link, .link-btn__text)::after {
  transform-origin: right;
}
[dir="rtl"] .site-header__progress { transform-origin: right; }

/* External-link arrow points the other way */
[dir="rtl"] .text-link__ext {
  transform: rotate(-135deg) translateY(0.05em);
}
[dir="rtl"] .text-link:hover .text-link__ext {
  transform: rotate(-135deg) translate(0.12em, 0.05em);
}

/* Contact email arrow mirrors the same way in RTL */
[dir="rtl"] .contact__email-arrow {
  transform: rotate(-135deg) translate(0.15em, 0.1em);
}
[dir="rtl"] .contact__email:hover .contact__email-arrow {
  transform: rotate(-135deg) translate(0, 0);
}

@media (max-width: 40rem) {
  /* Keep the header tidy on phones */
  .lang__btn { padding: 0.5rem 0.7rem; }
  .lang__chevron { display: none; }
}

/* ==========================================================================
   19. ARTICLE PAGES (full research write-ups)
   Used by research/research-N.html. The page chrome (header/footer) still
   follows the visitor's chosen language, but the article content itself
   carries its own lang/dir — a piece written in Arabic stays Arabic even
   if the visitor has the rest of the site set to English or Hebrew.
   ========================================================================== */
.article { padding-block: clamp(2.5rem, 6vw, 5rem) var(--section-y); }

.article__container {
  max-width: 42rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.article__crumb {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
  color: var(--color-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.article__crumb:hover { color: var(--color-accent); }
.article__crumb-arrow { transition: transform var(--dur-base) var(--ease); }
.article__crumb:hover .article__crumb-arrow { transform: translateX(-3px); }
[dir="rtl"] .article__crumb-arrow { transform: scaleX(-1); }
[dir="rtl"] .article__crumb:hover .article__crumb-arrow { transform: scaleX(-1) translateX(-3px); }

.article__head { margin-bottom: clamp(2rem, 4vw, 3rem); }
.article__title {
  margin: var(--space-4) 0 var(--space-4);
  font-size: var(--fs-3xl);
  line-height: var(--lh-tight);
}
.article__byline {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--fs-sm);
}

/* Bilingual notice shown while a piece exists in only one language.
   Static text, not run through data-i18n, since it describes the
   content's availability rather than the site's UI. */
.article__lang-note {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  padding: 0.5rem 1rem;
  background: var(--color-accent-tint);
  border: 1px solid var(--color-accent-line);
  border-radius: var(--radius-pill);
  color: var(--color-accent);
  font-size: var(--fs-xs);
}

.article__media {
  margin-bottom: clamp(2rem, 4vw, 3rem);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.article__media img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.article__media .media-placeholder { aspect-ratio: 16 / 10; }

/* Inline figures inside the article body (diagrams, charts). Unlike
   .article__media above, these are shown uncropped at their natural
   aspect ratio so nothing in a diagram gets cut off. */
/* The diagram PNGs have a transparent background, so they sit straight on the
   page with no panel, border or seam. */
.article__figure {
  margin: var(--space-7) 0;
}
.article__figure img {
  display: block;
  width: 100%;
  height: auto;
}
.article__figure figcaption {
  margin-top: var(--space-3);
  font-size: var(--fs-sm);
  color: var(--color-muted);
  text-align: center;
}

.article2__diagram2 {
    display: block;
    width: 100%;
    max-width: 550px;
    height: auto;
    margin: 0 auto;
}
/* Detailed diagrams get a little more room than the reading column,
   breaking out evenly on both sides where the viewport allows. */
@media (min-width: 60rem) {
  .article__figure--wide {
    width: calc(100% + 10rem);
    margin-inline: -5rem;
  }
}

/* Prose body — sized generously for long-form reading */
.article__body {
  font-size: var(--fs-md);
  line-height: var(--lh-loose);
  color: var(--color-ink-soft);
}
.article__body p { margin-bottom: var(--space-5); }
.article__body h2 {
  margin: var(--space-9) 0 var(--space-4);
  font-size: var(--fs-xl);
}
.article__body h3 {
  margin: var(--space-7) 0 var(--space-3);
  font-size: var(--fs-lg);
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--color-ink);
}
.article__body ul, .article__body ol {
  margin: 0 0 var(--space-5);
  padding-inline-start: 1.4em;
  list-style-position: outside;
}
.article__body ul { list-style-type: disc; }
.article__body ol { list-style-type: decimal; }
.article__body li { margin-bottom: var(--space-2); }
.article__body blockquote {
  margin: var(--space-6) 0;
  padding-inline-start: var(--space-5);
  border-inline-start: 2px solid var(--color-accent-line);
  color: var(--color-ink);
  font-family: var(--font-display);
  font-style: italic;
}

/* References block at the end of the article */
.article__refs {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-line);
}
.article__refs h2 { margin-top: 0; }
.article__refs ol {
  font-size: var(--fs-sm);
  color: var(--color-muted);
  line-height: var(--lh-normal);
}
.article__refs li { margin-bottom: var(--space-3); }

/* Content-level language: applied directly to the head/body/refs blocks so a
   piece keeps its own script, direction and font no matter what language the
   surrounding chrome is currently displaying. Font stacks mirror the tokens
   set on html[lang="ar"] / html[lang="he"] above, they can't be inherited
   from there directly because the block's lang can differ from the page's. */
.article__body[dir="rtl"],
.article__head[dir="rtl"],
.article__refs[dir="rtl"] {
  line-height: 1.9;
}

.article__body[lang="ar"],
.article__head[lang="ar"],
.article__refs[lang="ar"] {
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}
.article__body[lang="ar"] h2,
.article__body[lang="ar"] h3,
.article__head[lang="ar"] .article__title {
  font-family: "Readex Pro", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}

.article__body[lang="he"],
.article__head[lang="he"],
.article__refs[lang="he"] {
  font-family: "Rubik", "Inter", "Segoe UI", sans-serif;
}
.article__body[lang="he"] h2,
.article__body[lang="he"] h3,
.article__head[lang="he"] .article__title {
  font-family: "Rubik", "Inter", "Segoe UI", sans-serif;
  font-weight: 600;
}

@media (max-width: 40rem) {
  .article__title { font-size: var(--fs-2xl); }
}

/* --- Multi-language article bodies -------------------------------------
   Pages with more than one language version wrap each version in
   [data-lang-block="xx"]. main.js shows only the block matching the
   current site language and hides the rest — see initArticleLanguage(). */
[data-lang-block][hidden] { display: none; }
