/* ==========================================================================
   ECRN-OWC website — shared stylesheet
   Design direction: soft, modern, light. Teal/indigo accents on off-white.
   ========================================================================== */

:root {
  /* Color tokens */
  --bg:            #f7f9fc;
  --bg-elev:       #ffffff;
  --bg-soft:       #eef3f9;
  --ink:           #0b1d3a;
  --ink-2:         #334155;
  --ink-3:         #64748b;
  --line:          #e2e8f0;
  --accent:        #0ea5b7;   /* soft teal */
  --accent-deep:   #0a7d8c;
  --accent-2:      #6366f1;   /* indigo */
  --accent-warm:   #f59e0b;
  --shadow-sm:     0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md:     0 4px 12px rgba(15, 23, 42, .06), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-lg:     0 20px 40px rgba(15, 23, 42, .08), 0 6px 12px rgba(15, 23, 42, .04);

  /* Radii — kept small for a formal, architectural feel */
  --r-sm: 2px;
  --r-md: 3px;
  --r-lg: 4px;
  --r-pill: 3px;

  /* Layout */
  --max:   1200px;
  --gutter: clamp(1rem, 4vw, 2rem);

  /* Typography — IBM Plex pair: Serif for display, Sans for UI/body.
     Conveys research/technical formality while staying readable. */
  --ff-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ff-display: "IBM Plex Serif", "Source Serif 4", Georgia, "Times New Roman", serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--ff-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-deep); text-decoration: none; }
a:hover { color: var(--accent); }
button { font: inherit; cursor: pointer; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--ff-display);
  color: var(--ink);
  letter-spacing: -0.005em;
  line-height: 1.18;
  margin: 0 0 .6em;
  font-weight: 600;
}
h1 { font-size: clamp(2rem, 4vw + 1rem, 3.2rem); font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.55rem, 1.8vw + 1rem, 2.2rem); }
h3 { font-size: 1.2rem; font-weight: 600; }
p  { margin: 0 0 1em; }
.lede { font-size: 1.1rem; color: var(--ink-2); max-width: 62ch; line-height: 1.6; }
.eyebrow {
  display: inline-block;
  font-family: var(--ff-sans);
  font-size: .76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--accent-deep);
  margin-bottom: 1rem;
}

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding: clamp(2.5rem, 8vw, 6rem) 0; }
.section-tight { padding: clamp(1.5rem, 5vw, 3.5rem) 0; }
.grid { display: grid; gap: 1.25rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .85rem 1.4rem;
  border-radius: var(--r-pill);
  font-family: var(--ff-sans);
  font-weight: 500;
  font-size: .95rem;
  letter-spacing: .01em;
  border: 1px solid transparent;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.btn-primary:hover { color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--bg-elev); border-color: transparent; box-shadow: var(--shadow-sm); }
.btn-arrow::after { content: "→"; font-size: 1rem; transition: transform .2s ease; }
.btn:hover .btn-arrow::after, .btn-arrow:hover::after { transform: translateX(3px); }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 249, 252, .82);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, background .25s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding-block: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  line-height: 0;
}
.brand:hover { color: var(--ink); }
.brand-logo {
  height: 46px;
  width: auto;
  display: block;
}
.brand-footer .brand-logo {
  height: 60px;
  padding: 0;
  border-radius: 0;
}
@media (max-width: 540px) {
  .brand-logo { height: 38px; }
}

.nav-links {
  display: none;
  list-style: none;
  margin: 0; padding: 0;
  gap: .25rem;
  align-items: center;
}
@media (min-width: 880px) { .nav-links { display: flex; } }
.nav-links a {
  color: var(--ink-2);
  font-weight: 500;
  font-size: .95rem;
  padding: .5rem .85rem;
  border-radius: var(--r-sm);
  transition: background .15s ease, color .15s ease;
}
.nav-links a:hover { background: var(--bg-soft); color: var(--ink); }
.nav-links a.is-current {
  color: var(--accent-deep);
  background: rgba(14, 165, 183, .08);
}
.nav-links .has-children { position: relative; }
.nav-links .has-children > a::after { content: "▾"; font-size: .65rem; margin-left: .3rem; opacity: .6; }
.dropdown {
  position: absolute;
  top: calc(100% + .25rem); left: 0;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: .5rem;
  min-width: 240px;
  list-style: none;
  margin: 0;
  opacity: 0; visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.has-children:hover .dropdown,
.has-children:focus-within .dropdown {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.dropdown a { display: block; padding: .55rem .8rem; border-radius: var(--r-sm); }

.nav-cta { display: none; }
@media (min-width: 880px) { .nav-cta { display: inline-flex; } }

.nav-toggle {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: var(--r-sm);
}
@media (min-width: 880px) { .nav-toggle { display: none; } }
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  content: ""; display: block;
  width: 18px; height: 2px;
  background: var(--ink); border-radius: 2px;
  transition: transform .2s ease, top .2s ease, opacity .15s ease;
}
.nav-toggle span { position: relative; }
.nav-toggle span::before { position: absolute; top: -6px; }
.nav-toggle span::after  { position: absolute; top:  6px; }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after  { top: 0; transform: rotate(-45deg); }

.mobile-menu {
  display: none;
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 1rem var(--gutter) calc(4rem + env(safe-area-inset-bottom, 0px));
  max-height: calc(100vh - 5rem);
  max-height: calc(100dvh - 5rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.mobile-menu.is-open { display: block; }
.mobile-menu ul { list-style: none; padding: 0; margin: 0; }
.mobile-menu > ul > li { border-bottom: 1px solid var(--line); }
.mobile-menu > ul > li:last-child { border-bottom: 0; }
.mobile-menu a { display: block; padding: .8rem 0; color: var(--ink); font-weight: 500; }
.mobile-menu .sub { padding-left: 1rem; padding-bottom: .5rem; }
.mobile-menu .sub a { padding: .4rem 0; color: var(--ink-2); font-weight: 400; font-size: .95rem; }

/* ---------- Hero (homepage, full-bleed image with overlay) ---------- */
.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-height: clamp(460px, 70vh, 640px);
  display: grid;
  align-items: end;
}
.hero-image, .hero-overlay { grid-area: 1 / 1; min-width: 0; }
.hero-image {
  position: relative;
  width: 100%;
  height: 100%;
}
.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  display: block;
}
.hero-overlay {
  position: relative;
  width: 100%;
  display: flex;
  align-items: flex-end;
  background:
    linear-gradient(180deg, rgba(11, 29, 58, 0.05) 0%, rgba(11, 29, 58, 0.35) 45%, rgba(11, 29, 58, 0.85) 100%);
  padding-block: clamp(4rem, 10vw, 7rem) clamp(2.5rem, 6vw, 4rem);
  color: #fff;
}
.hero-overlay .container { width: 100%; }
.hero-overlay .eyebrow { color: #a5e8f0; }
.hero-overlay h1 {
  color: #fff;
  max-width: 22ch;
  text-shadow: 0 2px 18px rgba(0,0,0,.35);
}
.hero-overlay .lede {
  color: rgba(255,255,255,.92);
  max-width: 56ch;
  font-size: 1.12rem;
  text-shadow: 0 1px 8px rgba(0,0,0,.35);
}
.hero-cta {
  display: flex; flex-wrap: wrap;
  gap: .8rem;
  margin-top: 1.8rem;
}
.hero-overlay .btn-ghost {
  background: rgba(255,255,255,.1);
  color: #fff;
  border-color: rgba(255,255,255,.35);
  backdrop-filter: blur(8px);
}
.hero-overlay .btn-ghost:hover { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.6); }

.hero-meta {
  display: flex; flex-wrap: wrap;
  gap: 1.5rem 3rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,.2);
  color: #fff;
}
.hero-meta dt { font-family: var(--ff-display); font-size: 1.7rem; font-weight: 600; color: #fff; letter-spacing: -0.01em; line-height: 1; }
.hero-meta dd { margin: .25rem 0 0; font-size: .82rem; color: rgba(255,255,255,.75); text-transform: uppercase; letter-spacing: .1em; }

/* ---------- Inner-page hero (small) ---------- */
.page-hero {
  background:
    linear-gradient(180deg, var(--bg-elev) 0%, var(--bg-soft) 100%);
  border-bottom: 1px solid var(--line);
  padding: clamp(3rem, 7vw, 5rem) 0 clamp(2.5rem, 5vw, 3.5rem);
  position: relative;
}
.page-hero::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .35;
}
.page-hero h1 { max-width: 22ch; margin-bottom: .4em; }
.page-hero .lede { font-size: 1.15rem; max-width: 64ch; }
.crumbs {
  font-family: var(--ff-sans);
  font-size: .82rem;
  color: var(--ink-3);
  margin-bottom: 1rem;
  letter-spacing: .04em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: .25rem;
}
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--accent-deep); }
.crumbs span[aria-hidden] { margin: 0 .5rem; opacity: .6; }
.crumbs > span[aria-current] { word-break: break-word; }

/* Photo grid (squared corners, no rounding) */
.photo-grid {
  display: grid;
  gap: 1.5rem;
}
@media (min-width: 760px) {
  .photo-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
}
.photo-tile {
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  transition: transform .25s ease, box-shadow .25s ease;
}
.photo-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.photo-tile img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0;
}
.photo-tile figcaption {
  padding: .85rem 1rem;
  font-family: var(--ff-sans);
  font-size: .85rem;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
}

/* ---------- Cards ---------- */
.cards { display: grid; gap: 1.5rem; }
@media (min-width: 640px) { .cards.cols-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 880px) { .cards.cols-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 880px) { .cards.cols-4 { grid-template-columns: repeat(4, 1fr); } }

.card {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.6rem;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  display: flex; flex-direction: column;
  gap: .6rem;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: transparent; }
.card h3 { margin: 0; }
.card p { color: var(--ink-2); margin: 0; font-size: .95rem; }
.card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(14, 165, 183, .15), rgba(99, 102, 241, .15));
  color: var(--accent-deep);
  margin-bottom: .4rem;
}
.card-icon svg { width: 22px; height: 22px; }
.card-link {
  display: inline-flex; align-items: center; gap: .35rem;
  margin-top: auto;
  padding-top: .8rem;
  font-weight: 600; font-size: .9rem;
  color: var(--accent-deep);
}
.card-link::after { content: "→"; transition: transform .2s ease; }
.card:hover .card-link::after { transform: translateX(3px); }

.card-tag {
  position: absolute; top: 1rem; right: 1rem;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .25rem .6rem;
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  color: var(--ink-3);
}
.card-tag.is-active { background: rgba(14, 165, 183, .12); color: var(--accent-deep); }

/* ---------- Section heads ---------- */
.section-head { max-width: 720px; margin-bottom: 2.5rem; }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head + * { margin-top: 0; }

/* ---------- About / mission strip ---------- */
.mission {
  background: linear-gradient(180deg, var(--bg-elev) 0%, var(--bg-soft) 100%);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.mission-grid {
  display: grid; gap: 2.5rem;
  align-items: center;
}
@media (min-width: 880px) { .mission-grid { grid-template-columns: 1fr 1.1fr; gap: 4rem; } }
.mission-stats {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(2, 1fr);
}
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.1rem 1.2rem;
}
.stat strong { display: block; font-size: 1.6rem; font-weight: 750; color: var(--ink); letter-spacing: -0.02em; }
.stat span { font-size: .85rem; color: var(--ink-3); }

/* ---------- CTA strip ---------- */
.cta-strip {
  background: linear-gradient(135deg, #0b1d3a 0%, #0a7d8c 100%);
  color: #fff;
  border-radius: 0;
  padding: clamp(2rem, 5vw, 3.5rem);
  display: grid; gap: 1.5rem;
  align-items: center;
}
@media (min-width: 760px) { .cta-strip { grid-template-columns: 1.5fr auto; } }
.cta-strip h2 { color: #fff; margin: 0; }
.cta-strip p { color: rgba(255,255,255,.8); margin: .4rem 0 0; }
.cta-strip .btn-ghost { color: #fff; border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.06); }
.cta-strip .btn-ghost:hover { background: rgba(255,255,255,.14); }

/* ---------- Footer ---------- */
.site-footer {
  background: #ffffff;
  color: var(--ink-2);
  padding: 4rem 0 2rem;
  margin-top: 4rem;
  border-top: 1px solid var(--line);
}
.site-footer h4 {
  color: var(--ink);
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 600;
  margin-bottom: 1rem;
}
.footer-grid {
  display: grid; gap: 2.5rem;
  grid-template-columns: 1.4fr repeat(3, 1fr);
}
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .5rem; }
.site-footer a { color: var(--ink-2); font-size: .92rem; }
.site-footer a:hover { color: var(--accent-deep); }
.site-footer .brand { color: var(--ink); }
.site-footer .brand-name span { color: var(--ink-3); }
.footer-meta {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 1rem;
  justify-content: space-between;
  font-size: .85rem;
  color: var(--ink-3);
}

/* ---------- Utilities ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.muted { color: var(--ink-3); }
.center { text-align: center; }

/* Reveal-on-scroll (set by main.js) */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Inner-page content components ---------- */

/* Article-style prose body */
.prose { max-width: 70ch; }
.prose p, .prose ul, .prose ol { font-size: 1.04rem; line-height: 1.7; color: var(--ink-2); }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 1.2em; }
.prose ul li, .prose ol li { margin-bottom: .4em; }
.prose h2 { margin-top: 2.2rem; }
.prose h3 { margin-top: 1.8rem; font-weight: 600; }
.prose blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.2rem;
  background: var(--bg-soft);
  border-left: 3px solid var(--accent);
  font-style: italic;
  color: var(--ink-2);
}

/* Two-column content layout: prose on left, sidebar on right */
.split-layout {
  display: grid;
  gap: 3rem;
}
@media (min-width: 880px) {
  .split-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 4rem; }
}
.sidebar {
  font-family: var(--ff-sans);
}
.sidebar-block {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.2rem;
  border-radius: var(--r-md);
}
.sidebar-block h4 {
  font-family: var(--ff-sans);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-3);
  margin-bottom: .8rem;
}
.sidebar-block p, .sidebar-block li { font-size: .92rem; color: var(--ink-2); margin: 0 0 .4em; }
.sidebar-block ul { list-style: none; padding: 0; margin: 0; }
.sidebar-block ul li + li { margin-top: .4rem; padding-top: .4rem; border-top: 1px dashed var(--line); }

/* Researcher / profile cards */
.profile-grid {
  display: grid; gap: 1.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) { .profile-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 920px) { .profile-grid { grid-template-columns: repeat(3, 1fr); } }
.profile {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 1.4rem 1.5rem;
  border-radius: var(--r-md);
  display: flex; flex-direction: column;
}
.profile-name { font-family: var(--ff-display); font-size: 1.15rem; font-weight: 600; color: var(--ink); margin-bottom: .15em; }
.profile-role { font-size: .9rem; color: var(--ink-3); margin-bottom: .6em; }
.profile-affil { font-size: .92rem; color: var(--ink-2); }
.profile-flag { font-size: .8rem; font-weight: 600; color: var(--accent-deep); letter-spacing: .04em; margin-bottom: .8em; text-transform: uppercase; }

/* Project / publication list rows */
.row-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.row-list > li {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: .25rem .8rem;
  grid-template-columns: 1fr;
}
@media (min-width: 700px) { .row-list > li { grid-template-columns: 7rem 1fr auto; align-items: baseline; } }
.row-list .row-meta { font-family: var(--ff-sans); font-size: .82rem; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; }
.row-list .row-title { font-weight: 500; color: var(--ink); }
.row-list .row-link { font-size: .88rem; color: var(--accent-deep); }
.row-list .row-link::after { content: "→"; margin-left: .35rem; }

/* Topic / lecture-notes outline */
.outline { list-style: none; padding: 0; margin: 2rem 0 0; counter-reset: o; }
.outline > li {
  counter-increment: o;
  padding: 1.1rem 1.4rem 1.1rem 4rem;
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: .8rem;
  background: var(--bg-elev);
}
.outline > li::before {
  content: counter(o, decimal-leading-zero);
  position: absolute; left: 1rem; top: 1rem;
  font-family: var(--ff-display);
  font-weight: 600; font-size: 1.1rem;
  color: var(--accent-deep);
  letter-spacing: -.02em;
}
.outline strong { font-weight: 600; color: var(--ink); display: block; margin-bottom: .15rem; }
.outline span { font-size: .92rem; color: var(--ink-3); }

/* Definition / data list */
.dl-grid { display: grid; gap: .85rem 2rem; grid-template-columns: 1fr; margin: 1.5rem 0; }
@media (min-width: 600px) { .dl-grid { grid-template-columns: 12rem 1fr; } }
.dl-grid dt { font-family: var(--ff-sans); font-size: .82rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; padding-top: .15rem; }
.dl-grid dd { margin: 0; color: var(--ink); }

/* Contact form */
.form { display: grid; gap: 1.2rem; max-width: 560px; }
.form label { font-family: var(--ff-sans); font-size: .85rem; font-weight: 500; color: var(--ink); display: grid; gap: .35rem; }
.form input, .form textarea, .form select {
  font: inherit;
  font-family: var(--ff-sans);
  padding: .8rem .9rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form input:focus, .form textarea:focus, .form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,165,183,.15);
}
.form textarea { min-height: 130px; resize: vertical; }

/* Force squared corners on every <img> as a safety net */
img { border-radius: 0; }

/* Link with arrow used inline in prose */
.arrow-link { display: inline-flex; align-items: center; gap: .35rem; font-weight: 500; }
.arrow-link::after { content: "→"; transition: transform .2s ease; }
.arrow-link:hover::after { transform: translateX(3px); }

/* Card adjustments for the more squared look */
.card { border-radius: var(--r-md); }
.card-icon { border-radius: 4px; }

/* ---------- Lab cards (research groups) ---------- */
.lab-grid {
  display: grid; gap: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px)  { .lab-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .lab-grid { grid-template-columns: repeat(3, 1fr); } }
.lab-card {
  position: relative;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  display: flex; flex-direction: column;
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.lab-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: opacity .25s ease;
  z-index: 2;
}
.lab-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}
.lab-card:hover::before { opacity: 1; }
.lab-card-logo {
  height: 200px;
  width: 100%;
  margin: 0;
  padding: 0;
  position: relative;
  overflow: hidden;
  background: var(--bg-soft);
}
.lab-card-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform .4s ease;
}
.lab-card:hover .lab-card-logo img { transform: scale(1.05); }
.lab-card-body { padding: 1.4rem 1.5rem 1.5rem; display: flex; flex-direction: column; flex: 1; }
.lab-card h3 {
  font-size: 1.15rem;
  margin: 0 0 .35em;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.lab-card .lab-affil {
  font-family: var(--ff-sans);
  font-size: .78rem;
  color: var(--ink-3);
  margin-bottom: 1em;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.5;
}
.lab-card .lab-affil strong {
  color: var(--accent-deep);
  font-weight: 700;
  letter-spacing: .06em;
}
.lab-card p {
  font-size: .92rem;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0 0 1.1em;
}
.lab-card .arrow-link { margin-top: auto; font-size: .88rem; }
.lab-card .lab-ctas { margin-top: auto; padding-top: .25rem; }
.lab-card .lab-ctas .btn-outline {
  font-size: .78rem;
  padding: .4rem .8rem;
  letter-spacing: .03em;
}

/* Profile photo at top of profile card */
.profile { padding: 0; overflow: hidden; }
.profile-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--bg-soft);
  display: block;
  border-radius: 0;
}
.profile-body { padding: 1rem 1.2rem 1.2rem; display: flex; flex-direction: column; flex: 1; }
.profile-body .profile-flag { margin-top: 0; }
.profile-body .profile-name { font-size: 1.05rem; margin-bottom: .2em; }
.profile-body .profile-affil { font-size: .88rem; line-height: 1.45; }

/* Tighter profile grid for 4-col / dense lists */
.profile-grid.cols-4 { grid-template-columns: 1fr; }
@media (min-width: 540px)  { .profile-grid.cols-4 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 880px)  { .profile-grid.cols-4 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .profile-grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }

/* Graduate list (year-grouped, no photos) */
.alumni-section { margin-top: 3rem; }
.alumni-year {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--ink);
  margin: 2rem 0 .8rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--line);
}
.alumni-list { list-style: none; padding: 0; margin: 0; }
.alumni-list li {
  padding: .55rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: .95rem;
  color: var(--ink-2);
}
.alumni-list li:last-child { border-bottom: 0; }
.alumni-list em { font-style: normal; color: var(--ink-3); font-size: .88rem; margin-left: .5rem; }

/* Senior-lead profile card: lab logo at top instead of a portrait */
.lead-card .lead-card-logo {
  height: 130px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: grid; place-items: center;
  padding: 1rem 1.4rem;
}
.lead-card .lead-card-logo img {
  max-height: 100%; max-width: 100%; width: auto; height: auto; object-fit: contain;
}
.lead-card .profile-body p:last-child { margin-bottom: 0; }
.lead-card .profile-affil strong { color: var(--accent-deep); display: block; font-weight: 600; margin-bottom: .15em; }

/* ---------- Country tiles (About → ECRN members) ---------- */
.country-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 540px)  { .country-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px)  { .country-grid { grid-template-columns: repeat(3, 1fr); } }
.country-tile {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 1.4rem 1.5rem 1.1rem;
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.country-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.country-tile::before {
  content: "";
  position: absolute; inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
  opacity: .85;
}
.country-tile .country-flag {
  font-size: 2rem;
  line-height: 1;
  display: inline-block;
  margin-bottom: .55rem;
}
.country-tile .country-name {
  font-family: var(--ff-display);
  font-weight: 600;
  color: var(--ink);
  font-size: 1.1rem;
  margin: 0 0 .8rem;
  letter-spacing: -0.005em;
}
.country-tile ul { list-style: none; padding: 0; margin: 0; }
.country-tile li {
  padding: .55rem 0;
  border-top: 1px dashed var(--line);
}
.country-tile li:first-child { border-top: 0; padding-top: .2rem; }
.country-tile .uni-name { display: block; color: var(--ink-2); font-weight: 500; font-size: .95rem; line-height: 1.35; word-break: break-word; hyphens: auto; }
.country-tile .uni-city { display: block; color: var(--ink-3); font-size: .82rem; margin-top: .15rem; letter-spacing: .02em; word-break: break-word; }
@media (max-width: 480px) {
  .country-tile { padding: 1.1rem 1.1rem .9rem; }
  .country-tile .country-name { font-size: 1rem; }
  .country-grid { gap: 1rem; }
}

/* Senior-lead card with real headshot photo (square at top of card) */
.lead-card-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 0;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}

/* Lecture-notes outline: PDF download badge on the right */
.outline > li.has-pdf { padding-right: 5.5rem; }
.outline-pdf {
  position: absolute;
  right: 1rem; top: 50%;
  transform: translateY(-50%);
  padding: .35rem .75rem;
  font-family: var(--ff-sans);
  font-size: .8rem; font-weight: 600;
  letter-spacing: .04em;
  color: var(--accent-deep);
  background: rgba(14,165,183,.08);
  border: 1px solid rgba(14,165,183,.25);
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.outline-pdf::before { content: "↓ "; margin-right: .15rem; }
.outline-pdf:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Dropdown label (non-clickable category divider — used for "Projects" in nav) */
.dropdown-label {
  padding: .55rem .8rem .25rem;
  font-family: var(--ff-sans);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-3);
  pointer-events: none;
  border-top: 1px solid var(--line);
  margin-top: .35rem;
}
.dropdown-label:first-child { border-top: 0; margin-top: 0; }

/* ---------- ECRN Countries Map ---------- */
.ecrn-map {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-elev);
}
.ecrn-map svg { display: block; width: 100%; height: auto; }
.ecrn-map .pin-circle { transition: r .2s ease, fill .2s ease, stroke-width .2s ease; cursor: default; }
.ecrn-map .pin:hover .pin-circle { fill: var(--accent); stroke-width: 3; }
.ecrn-map .pin:hover .pin-label   { font-weight: 700; }
.ecrn-map .pin-label  { font-family: "IBM Plex Sans", system-ui, sans-serif; font-size: 13px; font-weight: 600; fill: #0b1d3a; }
.ecrn-map .pin-sub    { font-family: "IBM Plex Sans", system-ui, sans-serif; font-size: 10px; fill: #64748b; letter-spacing: .02em; }
.ecrn-map figcaption {
  padding: .85rem 1.2rem;
  font-family: var(--ff-sans);
  font-size: .85rem;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
}

/* ---------- Ray Tracer widget ---------- */
.optical-sim {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-elev);
}
.optical-canvas-wrap {
  background: linear-gradient(180deg, #f7f9fc 0%, #ecf2f8 100%);
  border-bottom: 1px solid var(--line);
  position: relative;
}
.optical-canvas-wrap canvas { display: block; touch-action: none; cursor: grab; }
.optical-canvas-wrap canvas:active { cursor: grabbing; }
.optical-controls {
  display: grid;
  gap: 1rem 1.5rem;
  grid-template-columns: 1fr 1fr 1fr auto;
  padding: 1.2rem 1.4rem;
  align-items: end;
}
@media (max-width: 760px) {
  .optical-controls { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .optical-controls { grid-template-columns: 1fr; }
}
.optical-controls label {
  font-family: var(--ff-sans);
  font-size: .82rem;
  color: var(--ink-2);
  display: grid;
  gap: .35rem;
  font-weight: 500;
}
.optical-controls label span {
  color: var(--accent-deep);
  font-weight: 600;
  margin-left: .5rem;
}
.optical-controls input[type=range] { width: 100%; accent-color: var(--accent); }
.optical-controls .btn {
  padding: .6rem 1.1rem;
  font-size: .85rem;
  align-self: end;
}
.optical-hint {
  padding: 0 1.4rem 1rem;
  margin: 0;
  font-family: var(--ff-sans);
  font-size: .8rem;
  color: var(--ink-3);
  font-style: italic;
}

/* ---------- Iframed widgets (Ray Tracer) ---------- */
.ray-tracer-frame {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-elev);
}
.ray-tracer-frame iframe {
  display: block;
  width: 100%;
  height: clamp(560px, 65vw, 720px);
  border: 0;
  background: #0a0d18;
}

/* ---------- Inline PDF reader for lecture notes ---------- */
.pdf-viewer {
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-soft);
  box-shadow: var(--shadow-sm);
}
.pdf-viewer iframe {
  display: block;
  width: 100%;
  height: clamp(560px, 80vh, 880px);
  border: 0;
  background: #fff;
}
.pdf-viewer-fallback {
  margin: 0;
  padding: .75rem 1rem;
  border-top: 1px solid var(--line);
  font-family: var(--ff-sans);
  font-size: .82rem;
  color: var(--ink-3);
  background: var(--bg-elev);
}
.pdf-viewer-fallback a { color: var(--accent-deep); }
@media (max-width: 760px) {
  .pdf-viewer iframe { height: clamp(440px, 70vh, 640px); }
}

/* ---------- Inline Ray Tracer widget ---------- */
.ray-tracer {
  margin: 0;
  background: #05060a;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  color: #e8e6dc;
  font-family: var(--ff-sans);
  --rt-accent: #f4b942;
  --rt-line: rgba(232, 230, 220, 0.10);
  --rt-ink-dim: #8a8478;
}
.ray-tracer-header {
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--rt-line);
  background:
    radial-gradient(ellipse at 20% 50%, rgba(244, 185, 66, 0.08), transparent 60%),
    rgba(5, 6, 10, 0.6);
}
.ray-tracer-title {
  font-family: var(--ff-display);
  font-size: 1.35rem;
  font-weight: 500;
  margin: 0;
  color: #e8e6dc;
}
.ray-tracer-title em { color: var(--rt-accent); font-style: italic; }
.ray-tracer-subtitle {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .25em;
  color: var(--rt-ink-dim);
  margin: 4px 0 0;
}
.ray-tracer-canvas-wrap {
  position: relative;
  width: 100%;
  height: clamp(320px, 50vw, 540px);
  background: #0a0d18;
}
.ray-tracer-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}
.ray-tracer-legend {
  position: absolute; top: 12px; left: 12px;
  background: rgba(10, 13, 24, 0.78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--rt-line);
  padding: 8px 11px;
  font-size: 11px;
  color: var(--rt-ink-dim);
  line-height: 1.7;
  pointer-events: none;
  border-radius: 2px;
}
.ray-tracer-legend strong {
  display: block;
  color: #e8e6dc;
  text-transform: uppercase;
  letter-spacing: .25em;
  font-size: 9px;
  margin-bottom: 4px;
}
.ray-tracer-swatch {
  display: inline-block;
  width: 14px; height: 2px;
  margin-right: 6px;
  vertical-align: middle;
}
.ray-tracer-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 20px;
  border-top: 1px solid var(--rt-line);
  background: rgba(5, 6, 10, 0.6);
}
.rt-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--rt-ink-dim);
}
.rt-control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 90px; height: 2px;
  background: var(--rt-line);
  outline: none;
  border-radius: 1px;
}
.rt-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px;
  background: var(--rt-accent);
  border-radius: 50%; cursor: pointer; border: 0;
}
.rt-control input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px;
  background: var(--rt-accent);
  border: 0; border-radius: 50%; cursor: pointer;
}
.rt-control .rt-val {
  color: #e8e6dc;
  min-width: 30px;
  font-family: "Courier New", monospace;
  font-size: 11px;
}
.ray-tracer .rt-btn {
  background: transparent;
  border: 1px solid var(--rt-line);
  color: #e8e6dc;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: .25em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
  border-radius: 2px;
}
.ray-tracer .rt-btn:hover { border-color: var(--rt-accent); color: var(--rt-accent); }
.ray-tracer .rt-btn.is-active {
  background: var(--rt-accent);
  color: #05060a;
  border-color: var(--rt-accent);
}
.ray-tracer-hint {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: .15em;
  text-transform: uppercase;
  font-style: italic;
  color: var(--rt-ink-dim);
}

@media (max-width: 600px) {
  .ray-tracer-title { font-size: 1.15rem; }
  .ray-tracer-canvas-wrap { height: clamp(280px, 75vw, 380px); }
  .ray-tracer-controls { gap: 10px; padding: 12px 14px; }
  .rt-control input[type="range"] { width: 70px; }
  .ray-tracer-hint { display: none; }
}

/* ---------- Inline Countries Map widget ---------- */
.ecrn-map {
  margin: 0;
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1rem;
  overflow: hidden;
}
.ecrn-map-canvas {
  position: relative;
  width: 100%;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
  overflow: hidden;
  min-height: 300px;
}
.ecrn-map-canvas svg { display: block; width: 100%; height: auto; }
.ecrn-map-inset {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
.ecrn-map-inset::before {
  content: "Canary Islands";
  position: absolute;
  top: 4px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--ff-sans);
  font-size: .65rem;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255,255,255,.92);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}
.ecrn-map-inset svg { display: block; }

.ecrn-country {
  fill: #ffffff;
  stroke: var(--ink);
  stroke-width: 0.7;
  cursor: default;
  transition: opacity .15s;
}
.ecrn-country.is-member { fill: var(--ink); cursor: pointer; }
.ecrn-country.is-member:hover { opacity: .75; }
.ecrn-city {
  fill: #ffffff;
  stroke: var(--accent-deep, #2563eb);
  stroke-width: 2.5;
  cursor: pointer;
  transition: stroke-width .12s, transform .12s;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
}
.ecrn-city:hover { stroke-width: 4; }

.ecrn-map-legend {
  margin-top: .9rem;
  display: flex;
  flex-wrap: wrap;
  gap: .8rem 1.6rem;
  justify-content: center;
  font-family: var(--ff-sans);
  font-size: .85rem;
  color: var(--ink-2);
}
.ecrn-map-legend-item { display: flex; align-items: center; gap: .55rem; }
.ecrn-map-legend-dot {
  display: inline-block;
  width: 18px; height: 18px;
  border-radius: 4px;
  border: 1px solid var(--ink);
}

.ecrn-map-tooltip {
  position: fixed;
  pointer-events: none;
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  padding: .7rem .9rem;
  font-family: var(--ff-sans);
  font-size: .82rem;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  opacity: 0;
  transition: opacity .15s;
  max-width: min(260px, 80vw);
  z-index: 1000;
}
.ecrn-tt-title { font-weight: 700; color: var(--ink); margin-bottom: .25rem; }
.ecrn-tt-body  { color: var(--ink-2); }
.ecrn-map-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 360px;
  color: #b91c1c;
  font-family: var(--ff-sans);
}

@media (max-width: 540px) {
  .ecrn-map { padding: .6rem; }
  .ecrn-map-inset { bottom: 8px; left: 8px; }
  .ecrn-map-legend { font-size: .78rem; gap: .6rem 1rem; }
  .ecrn-map-legend-dot { width: 14px; height: 14px; }
}

/* ---------- About-us Universities section (mirrors original 60/40) ---------- */
.universities-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: start;
}
.universities-collage img {
  width: 100%;
  height: auto;
  display: block;
}
.universities-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
.universities-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
}
.uni-item {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  padding: .9rem 1.1rem;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .2s ease, border-left-color .18s ease;
}
.uni-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-left-color: var(--accent-deep);
}
.uni-item h3 {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 1.1rem;
  line-height: 1.3;
  margin: 0 0 .25rem;
  color: var(--ink);
}
.uni-item p {
  margin: 0;
  font-family: var(--ff-sans);
  font-size: .88rem;
  line-height: 1.4;
  color: var(--ink-3);
}
.uni-item p a { color: var(--accent-deep); }

@media (min-width: 760px) {
  .universities-grid {
    grid-template-columns: 60fr 40fr;
    gap: 3rem;
    align-items: stretch;
  }
  .universities-list {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-self: center;       /* vertically centre the right column */
    height: 100%;
    align-content: center;
  }
  .universities-col { gap: 1rem; }
}

/* ---------- About-us section spacing tweak for phones ---------- */
@media (max-width: 540px) {
  .container > section[style*="margin-top:3rem"] { margin-top: 2rem !important; }
  .page-hero { padding: clamp(1.8rem, 6vw, 3rem) 0 clamp(1.4rem, 4vw, 2.5rem); }
}

/* ---------- Homepage paragraph + photo rows ---------- */
.home-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
}
.home-row > p {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--ink);
  margin: 0;
}
.home-photo {
  margin: 0;
  border-radius: var(--r-md);
  overflow: hidden;
}
.home-photo img {
  display: block;
  width: 100%;
  height: auto;
}
@media (min-width: 760px) {
  .home-row { grid-template-columns: 1fr 1fr; gap: 3rem; }
  .home-row.home-row-flip { grid-template-columns: 1.7fr 1fr; }
  .home-row.home-row-flip .home-photo-wide { order: 0; }
  .home-row.home-row-flip > p { order: 1; }
}

@media (max-width: 760px) {
  .ray-tracer-frame iframe { height: 600px; }
}
@media (max-width: 540px) {
  .ray-tracer-frame iframe { height: 540px; }
}

/* ---------- Profile / lab outbound link rows ---------- */
.profile-links,
.lab-ctas {
  margin: .55rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  font-family: var(--ff-sans);
  font-size: .82rem;
}
.profile-link {
  display: inline-block;
  padding: .25rem .65rem;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--accent-deep);
  text-decoration: none;
  border: 1px solid var(--line);
  transition: background .15s, color .15s;
}
.profile-link:hover {
  background: var(--accent-deep);
  color: #fff;
  border-color: var(--accent-deep);
}
.lab-ctas .btn {
  font-size: .82rem;
  padding: .45rem .85rem;
}
.btn-outline {
  display: inline-block;
  padding: .5rem .9rem;
  border: 1px solid var(--accent-deep);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--accent-deep);
  text-decoration: none;
  font-family: var(--ff-sans);
  font-weight: 500;
  transition: background .15s, color .15s;
}
.btn-outline:hover {
  background: var(--accent-deep);
  color: #fff;
}

/* ---------- Lecture-notes hub layout (intro + 50/50 photo column) ---------- */
.lecture-hub-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: start;
}
.lecture-hub-photos {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 0;
}
.lecture-hub-photos figure {
  margin: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.lecture-hub-photos img {
  display: block;
  width: 100%;
  height: auto;
}
.lecture-hub-photos figure:first-child img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  height: auto;
}
.lecture-hub-quote {
  margin: 2.5rem 0 0;
  padding: 1rem 1.4rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  font-family: var(--ff-display);
  font-size: 1.05rem;
  font-style: italic;
  color: var(--ink-2);
}
.lecture-hub-quote p { margin: 0; }
@media (min-width: 880px) {
  .lecture-hub-grid {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }
}

/* ---------- Lecture-notes nested tree ---------- */
.lecture-tree {
  list-style: none;
  padding: 0;
  margin: 0;
}
.lecture-tree li {
  padding: .55rem 0;
  border-bottom: 1px dashed var(--line);
}
.lecture-tree li:last-child { border-bottom: 0; }
.lecture-tree ul {
  list-style: none;
  padding-left: 1.4rem;
  margin: .35rem 0 0;
  border-left: 2px solid var(--line);
}
.lecture-tree ul li:last-child { border-bottom: 0; }
.lecture-tree a {
  color: var(--ink);
  text-decoration: none;
  font-family: var(--ff-sans);
}
.lecture-tree a:hover { color: var(--accent-deep); text-decoration: underline; }

/* ---------- Research-area minimal list ---------- */
.research-areas {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: var(--ff-sans);
}
.research-areas li {
  padding: .8rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 1.05rem;
}
.research-areas li:last-child { border-bottom: 0; }
.research-areas a {
  color: var(--ink);
  text-decoration: none;
}
.research-areas a:hover { color: var(--accent-deep); text-decoration: underline; }

/* ---------- Previous-projects card list ---------- */
.projects-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
.project-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  padding: 1.5rem 1.7rem;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .2s ease, border-left-color .18s ease;
}
.project-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-left-color: var(--accent-deep);
}
.project-card-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .35rem 1rem;
  margin-bottom: .35rem;
}
.project-card-head h2 {
  font-family: var(--ff-display);
  font-size: 1.4rem;
  margin: 0;
  color: var(--ink);
}
.project-card-meta,
.project-card-meta-row {
  font-family: var(--ff-sans);
  font-size: .82rem;
  color: var(--ink-3);
  letter-spacing: .04em;
}
.project-card-meta-row strong { color: var(--ink-2); font-weight: 600; }
.project-card-tagline {
  font-family: var(--ff-display);
  font-style: italic;
  color: var(--accent-deep);
  margin: 0 0 .8rem;
  font-size: 1.02rem;
}
.project-card p { font-size: .96rem; line-height: 1.55; color: var(--ink-2); }

/* ---------- Research-page overview (transcribed from original slides) ---------- */
.research-overview {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(14,165,183,.04), rgba(99,102,241,.04)),
    var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.8rem 1.7rem 1.6rem;
  box-shadow: var(--shadow-sm);
}
.research-overview-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
}
@media (min-width: 880px) {
  .research-overview-split { grid-template-columns: 1fr 1fr; gap: 2.5rem; }
}

/* ---------- 3D research globe (Canvas) ---------- */
.research-globe-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 560px;
  margin: 0 auto;
}
#research-globe {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;            /* let the canvas claim touch drags so the
                                    page doesn't scroll while rotating */
  -webkit-user-select: none;
  user-select: none;
}
#research-globe:active { cursor: grabbing; }
#research-globe canvas {
  display: block;
  touch-action: none;
}
@media (max-width: 540px) {
  .research-globe-wrap { max-width: 360px; }
}
@media (max-width: 380px) {
  .research-globe-wrap { max-width: 100%; }
}
.research-overview-lede {
  font-family: var(--ff-display);
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--ink);
  margin: 0 0 1.6rem;
  max-width: 70ch;
}
.research-overview-lede strong {
  color: var(--accent-deep);
  font-weight: 600;
}
.research-overview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 1.6rem;
}
.research-overview-block h2 {
  font-family: var(--ff-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 .7rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--accent);
  color: var(--ink);
  letter-spacing: -0.005em;
}
.overview-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: var(--ff-sans);
}
.overview-list li {
  position: relative;
  padding: .35rem 0 .35rem 1.3rem;
  font-size: .92rem;
  color: var(--ink-2);
  line-height: 1.5;
}
.overview-list li::before {
  content: "";
  position: absolute;
  left: 0; top: .8rem;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.research-overview-cta {
  margin-top: 1.2rem;
  padding: 1rem 1.2rem;
  background: var(--bg-soft);
  border-left: 3px solid var(--accent-2);
  border-radius: var(--r-sm);
}
.research-overview-cta h3 {
  font-family: var(--ff-display);
  font-size: 1.02rem;
  font-weight: 600;
  margin: 0 0 .55rem;
  color: var(--ink);
}
.overview-cta-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .8rem;
}
.overview-cta-list li {
  font-family: var(--ff-sans);
  font-size: .85rem;
  color: var(--ink-2);
  padding: .25rem .7rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 999px;
}
@media (min-width: 760px) {
  .research-overview-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
}

/* ---------- Research themes (PhD-driven survey) ---------- */
.research-themes {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.4rem;
}
.research-theme {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  padding: 1.4rem 1.6rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .2s ease, border-left-color .18s ease;
}
.research-theme:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-left-color: var(--accent-deep);
}
.research-theme h2 {
  font-family: var(--ff-display);
  font-size: 1.18rem;
  font-weight: 600;
  margin: 0 0 .55rem;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.research-theme > p {
  margin: 0 0 .9rem;
  font-size: .96rem;
  line-height: 1.55;
  color: var(--ink-2);
}
.research-theme-examples {
  list-style: none;
  margin: 0;
  padding: .8rem 0 0;
  font-family: var(--ff-sans);
  border-top: 1px dashed var(--line);
}
.research-theme-examples li {
  padding: .35rem 0 .35rem 1.1rem;
  position: relative;
  font-size: .88rem;
  color: var(--ink-3);
  line-height: 1.4;
}
.research-theme-examples li::before {
  content: "›";
  position: absolute;
  left: 0;
  top: .3rem;
  color: var(--accent);
  font-weight: 700;
}
@media (min-width: 760px) {
  .research-themes { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
}
@media (min-width: 1100px) {
  .research-themes { grid-template-columns: 1fr 1fr 1fr; }
}

/* ─── Inline Publications widgets (network graph + Semantic Scholar table) ─── */
/* Stripped down from the original WP iframe widget; preserves the same DOM IDs. */

#ecrn-graph-wrap {
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-sizing: border-box;
  overflow-x: hidden;
}
#ecrn-graph-container {
  width: 100%;
  height: 600px;
  min-height: 400px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}
#ecrn-graph-container svg {
  display: block;
  width: 100%;
  height: 100%;
}
#ecrn-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 10px 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-top: 8px;
  align-items: center;
}
.ecrn-leg-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #4a5568;
}
.ecrn-leg-dot {
  border-radius: 50%;
  flex-shrink: 0;
}
.ecrn-leg-line {
  width: 24px;
  height: 2px;
  flex-shrink: 0;
  border-radius: 2px;
}
.ecrn-leg-sep { width: 1px; height: 18px; background: #e2e8f0; }
#ecrn-tooltip {
  position: absolute;
  pointer-events: none;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #2d3748;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  opacity: 0;
  transition: opacity 0.12s;
  max-width: 230px;
  z-index: 20;
}
.tt-name { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.tt-inst { color: #718096; font-size: 11px; margin-bottom: 4px; }
.tt-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}
#ecrn-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 10;
}
.ecrn-btn {
  width: 28px;
  height: 28px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #4a5568;
  user-select: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.ecrn-btn:hover { background: #edf2f7; }
#ecrn-hint {
  position: absolute;
  bottom: 8px;
  left: 12px;
  font-size: 11px;
  color: #cbd5e0;
  pointer-events: none;
}

#ecrn-pub-widget * { box-sizing: border-box; margin: 0; padding: 0; }
#ecrn-pub-widget {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: #2d3748;
  max-width: 960px;
  margin: 0 auto;
}
#ecrn-pub-widget .controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
}
#ecrn-pub-widget input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1.5px solid #cbd5e0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  color: #2d3748;
  background: #fff;
}
#ecrn-pub-widget input[type="text"]:focus { border-color: #4a5568; }
#ecrn-pub-widget select {
  padding: 10px 14px;
  border: 1.5px solid #cbd5e0;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: #2d3748;
  cursor: pointer;
}
#ecrn-pub-widget .status {
  font-size: 13px;
  color: #718096;
  margin-bottom: 16px;
  min-height: 20px;
}
#ecrn-pub-widget .pub-table { width: 100%; border-collapse: collapse; }
#ecrn-pub-widget .pub-table thead th {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #718096;
  padding: 10px 14px;
  border-bottom: 2px solid #e2e8f0;
  text-align: left;
  white-space: nowrap;
}
#ecrn-pub-widget .pub-table thead th.col-year { width: 60px; text-align: center; }
#ecrn-pub-widget .pub-table thead th.col-cit  { width: 75px; text-align: center; }
#ecrn-pub-widget .pub-table tbody tr { border-bottom: 1px solid #f0f4f8; }
#ecrn-pub-widget .pub-table tbody tr:hover { background: #f7fafc; }
#ecrn-pub-widget .pub-table td { padding: 12px 14px; vertical-align: top; font-size: 14px; }
#ecrn-pub-widget td.col-year { text-align: center; font-weight: 700; color: #4a5568; white-space: nowrap; }
#ecrn-pub-widget td.col-cit  { text-align: center; font-size: 13px; color: #718096; white-space: nowrap; }
#ecrn-pub-widget .pub-title-link { font-weight: 600; color: #2b6cb0; text-decoration: none; line-height: 1.4; display: block; }
#ecrn-pub-widget .pub-title-link:hover { text-decoration: underline; }
#ecrn-pub-widget .pub-sub { font-size: 12px; color: #718096; margin-top: 3px; line-height: 1.4; }
#ecrn-pub-widget .pub-author-tag {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px;
  background: #ebf4ff; color: #2b6cb0; margin-top: 5px;
}
#ecrn-pub-widget .no-results { text-align: center; padding: 48px 20px; color: #a0aec0; font-size: 14px; }
#ecrn-pub-widget .spinner {
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid #e2e8f0; border-top-color: #4a5568;
  border-radius: 50%; animation: ecrn-spin 0.7s linear infinite;
  vertical-align: middle; margin-right: 5px;
}
@keyframes ecrn-spin { to { transform: rotate(360deg); } }
#ecrn-pub-widget .show-more-wrap {
  text-align: center;
  margin-top: 24px;
  padding-bottom: 12px;
}
#ecrn-pub-widget .show-more-btn {
  display: inline-block;
  padding: 10px 32px;
  background: #2d3748;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
#ecrn-pub-widget .show-more-btn:hover { background: #1a202c; }
#ecrn-pub-widget .show-more-count {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: #718096;
}
#ecrn-pub-widget .refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: #fff;
  color: #2d3748;
  border: 1.5px solid #cbd5e0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
#ecrn-pub-widget .refresh-btn:hover { background: #f7fafc; border-color: #4a5568; }
#ecrn-pub-widget .refresh-btn.loading { opacity: 0.6; cursor: not-allowed; }
#ecrn-pub-widget .refresh-btn svg { transition: transform 0.4s; }
#ecrn-pub-widget .refresh-btn.loading svg { animation: ecrn-spin 0.7s linear infinite; }
@media (max-width: 600px) {
  #ecrn-pub-widget .pub-table thead th.col-cit,
  #ecrn-pub-widget .pub-table td.col-cit { display: none; }
}
