/* ==========================================================================
   Max Yong — personal site
   Light theme = Classic Blue · Dark theme = Midnight
   Theme is set via <html data-theme="light|dark"> (see main.js);
   defaults to the visitor's system preference, toggleable in the nav.
   Design tokens live below — change colors here and the site follows.
   ========================================================================== */

:root {
  /* Blues, dark → light */
  --navy-950: #081527;
  --navy-900: #0c1f3a;
  --navy-800: #123057;
  --blue-700: #17497f;
  --blue-600: #1f5fb0;
  --blue-500: #2e7cd6;
  --blue-400: #5b9be0;
  --blue-100: #dbe9f9;
  --blue-50:  #eef4fb;

  /* Neutrals */
  --ink:      #13233b;
  --body:     #3b4a5f;
  --muted:    #6b7a8f;
  --faint:    #94a3b8;
  --line:     #e3eaf2;
  --bg:       #ffffff;
  --bg-soft:  #f6f9fc;
  --surface:  #ffffff;

  /* Badge tints (per writing category) */
  --badge-opinion-bg:  #dbe9f9; --badge-opinion-fg:  #17497f;
  --badge-article-bg:  #e4e2fb; --badge-article-fg:  #4338ab;
  --badge-media-bg:    #d9f2ee; --badge-media-fg:    #0f766e;
  --badge-citation-bg: #ece9e2; --badge-citation-fg: #6b6257;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(12, 31, 58, 0.06), 0 1px 6px rgba(12, 31, 58, 0.05);
  --shadow-md: 0 6px 24px rgba(12, 31, 58, 0.10), 0 2px 6px rgba(12, 31, 58, 0.06);
  --shadow-lg: 0 18px 50px rgba(12, 31, 58, 0.18);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --ink:   #eaf1fa;
  --body:  #c0cfe2;
  --muted: #8ea3bd;
  --faint: #64798f;
  --line:  #1c2f4d;
  --bg:    #0a1424;
  --bg-soft: #0e1b30;
  --surface: #101f38;
  --blue-700: #7db0e8;
  --blue-600: #5b9be0;
  --blue-500: #5b9be0;
  --blue-400: #86b8ec;
  --blue-100: #17325a;
  --blue-50:  #10233f;
  --badge-opinion-bg:  #17325a; --badge-opinion-fg:  #a9cdf2;
  --badge-article-bg:  #2b2a55; --badge-article-fg:  #b9b6f5;
  --badge-media-bg:    #123f3a; --badge-media-fg:    #7fd8cc;
  --badge-citation-bg: #38332b; --badge-citation-fg: #cfc5b6;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.65);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--body);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16.5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.25s ease, color 0.25s ease;
}

::selection { background: var(--blue-100); color: var(--ink); }

h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; }

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

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

.container { max-width: 1060px; margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 820px; }

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 10px;
}

.nav__brand {
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav__brand img { width: 30px; height: 30px; object-fit: contain; }

[data-theme="dark"] .nav__brand img { filter: brightness(2.1) saturate(0.85); }

.nav__right { display: flex; align-items: center; gap: 4px; }

.nav__links { display: flex; gap: 6px; list-style: none; }

.nav__links a {
  position: relative;
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--body);
  transition: color 0.18s ease, background 0.18s ease;
}

.nav__links a:hover { color: var(--blue-600); background: var(--blue-50); }

.nav__links a.is-active { color: var(--blue-700); font-weight: 600; }

.nav__links a.is-active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: var(--blue-500);
}

/* Light/dark switch */
.theme-toggle {
  position: relative;
  width: 50px;
  height: 27px;
  flex: none;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  cursor: pointer;
  padding: 0;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.theme-toggle:hover { border-color: var(--blue-400); }

.theme-toggle .knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  color: #d89a1e;
  box-shadow: 0 1px 3px rgba(12, 31, 58, 0.3);
  display: grid;
  place-items: center;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.25s ease, color 0.25s ease;
}

[data-theme="dark"] .theme-toggle { background: #17325a; border-color: #2a4a7a; }
[data-theme="dark"] .theme-toggle .knob { transform: translateX(23px); background: #0e1b30; color: #9db8e8; }

.theme-toggle svg { width: 13px; height: 13px; }

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

/* --------------------------------------------------------------------------
   Hero (home)
   -------------------------------------------------------------------------- */

.hero {
  padding: 84px 0 64px;
  background:
    radial-gradient(1200px 500px at 85% -10%, var(--blue-50) 0%, transparent 60%),
    var(--bg);
}

.hero__grid {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 56px;
  align-items: center;
}

.hero__kicker {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue-600);
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(40px, 6vw, 58px);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.hero h1 .accent { color: var(--blue-600); }

.hero__lede {
  font-size: 19px;
  max-width: 56ch;
  margin-bottom: 22px;
}

/* Small profile links row (LinkedIn, Scholar, …) */
.hero__links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 30px;
}

.hero__links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  padding: 4px 2px;
  border-bottom: 1.5px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.hero__links a:hover { color: var(--blue-600); border-bottom-color: var(--blue-400); }

.hero__links img { width: 16px; height: 16px; border-radius: 4px; object-fit: contain; }

.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn--primary { background: var(--blue-600); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--blue-700); transform: translateY(-2px); box-shadow: var(--shadow-md); }
[data-theme="dark"] .btn--primary { background: #2e7cd6; }
[data-theme="dark"] .btn--primary:hover { background: #4a90de; color: #fff; }

.btn--ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.btn--ghost:hover { border-color: var(--blue-400); color: var(--blue-600); transform: translateY(-2px); box-shadow: var(--shadow-sm); }

.hero__portrait { position: relative; }

.hero__portrait img,
.hero__portrait .portrait-fallback {
  width: 260px;
  height: 260px;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: var(--shadow-md);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.35s ease;
}

.hero__portrait:hover img,
.hero__portrait:hover .portrait-fallback { transform: translateY(-6px) rotate(-1deg); box-shadow: var(--shadow-lg); }

.portrait-fallback {
  background: linear-gradient(150deg, var(--blue-600) 0%, var(--navy-900) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 64px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.hero__portrait::before {
  content: "";
  position: absolute;
  inset: 14px -14px -14px 14px;
  border-radius: 24px;
  border: 2px solid var(--blue-100);
  z-index: -1;
  transition: transform 0.35s ease;
}

.hero__portrait:hover::before { transform: translate(4px, 4px); }

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section { padding: 72px 0; }
.section--soft { background: var(--bg-soft); }

.section__head { margin-bottom: 36px; }

.section__eyebrow {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue-500);
  margin-bottom: 8px;
}

.section__title { font-size: clamp(26px, 3.4vw, 34px); }

.section__sub { margin-top: 10px; color: var(--muted); max-width: 62ch; }

.section__more { margin-top: 28px; }

/* Currently / Previously roles */

.roles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }

.role-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  color: inherit;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.role-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--blue-100); }
[data-theme="dark"] .role-card:hover { border-color: #2a4a7a; }

.role-card__logo {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  object-fit: contain;
}

.role-card h3 { font-size: 16.5px; margin-bottom: 3px; }

.role-card h3 .ext {
  font-size: 12px;
  color: var(--faint);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.role-card:hover h3 .ext { opacity: 1; }

.role-card p { font-size: 14.5px; color: var(--muted); line-height: 1.5; }

.role-card p strong { color: var(--body); font-weight: 650; }

/* Featured-in logo strip */

.outlets {
  display: flex;
  flex-wrap: wrap;
  gap: 26px 40px;
  align-items: center;
  justify-content: center;
}

.outlets a {
  display: inline-flex;
  align-items: center;
  filter: grayscale(1) opacity(0.55);
  transition: filter 0.25s ease, transform 0.25s ease;
}

.outlets a:hover { filter: grayscale(0) opacity(1); transform: translateY(-2px); }

.outlets img { height: 26px; width: auto; max-width: 190px; object-fit: contain; }

.outlets .outlet-text {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.02em;
  color: var(--ink);
  line-height: 1;
}

[data-theme="dark"] .outlets a { filter: grayscale(1) invert(0.8) opacity(0.65); }
[data-theme="dark"] .outlets a:hover { filter: grayscale(0) invert(0) opacity(1); }
[data-theme="dark"] .outlets a.outlet-text-link { filter: none; opacity: 0.65; }
[data-theme="dark"] .outlets a.outlet-text-link:hover { opacity: 1; }

/* --------------------------------------------------------------------------
   Writing list
   -------------------------------------------------------------------------- */

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 34px; }

.filter-pill {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--body);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 18px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.filter-pill:hover { border-color: var(--blue-400); color: var(--blue-600); transform: translateY(-1px); }

.filter-pill.is-active { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
[data-theme="dark"] .filter-pill.is-active { background: #2e7cd6; border-color: #2e7cd6; }

.year-group { margin-bottom: 44px; }

.year-group__label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--faint);
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 6px;
}

.pub {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 24px;
  padding: 20px 18px 20px 22px;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.pub + .pub { border-top: 1px solid var(--line); }

.pub:hover {
  background: var(--blue-50);
  border-left-color: var(--blue-500);
  transform: translateX(2px);
}

.pub:hover + .pub { border-top-color: transparent; }

.pub__meta {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pub__meta .dot { color: var(--faint); }

.pub__outlet-logo {
  height: 15px;
  width: auto;
  max-width: 110px;
  margin-left: auto;
  object-fit: contain;
  filter: grayscale(1) opacity(0.42);
  transition: filter 0.25s ease;
}

.pub:hover .pub__outlet-logo { filter: grayscale(0) opacity(1); }

[data-theme="dark"] .pub__outlet-logo { filter: grayscale(1) invert(0.8) opacity(0.5); }
[data-theme="dark"] .pub:hover .pub__outlet-logo { filter: grayscale(0) invert(0) opacity(1); }

.pub__badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 5px;
  padding: 2px 8px;
  background: var(--blue-100);
  color: var(--blue-700);
}

.pub__badge--opinion  { background: var(--badge-opinion-bg);  color: var(--badge-opinion-fg); }
.pub__badge--article  { background: var(--badge-article-bg);  color: var(--badge-article-fg); }
.pub__badge--media    { background: var(--badge-media-bg);    color: var(--badge-media-fg); }
.pub__badge--citation { background: var(--badge-citation-bg); color: var(--badge-citation-fg); }

.pub__title {
  font-size: 17.5px;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.4;
}

.pub__title a { color: inherit; transition: color 0.15s ease; }
.pub__title a:hover { color: var(--blue-600); }

.pub__note { font-size: 14px; color: var(--muted); margin-top: 2px; }

.pub__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  align-self: center;
}

.pub__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--blue-600);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 6px 13px;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s ease;
}

.pub__link:hover {
  border-color: var(--blue-500);
  background: var(--blue-600);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .pub__link { border-color: #2a4a7a; }
[data-theme="dark"] .pub__link:hover { background: #2e7cd6; border-color: #2e7cd6; }

/* Primary artifact link (the paper itself, vs coverage) */
.pub__link--primary { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.pub__link--primary:hover { background: var(--blue-700); border-color: var(--blue-700); }
[data-theme="dark"] .pub__link--primary { background: #2e7cd6; border-color: #2e7cd6; color: #fff; }
[data-theme="dark"] .pub__link--primary:hover { background: #4a90de; border-color: #4a90de; }

/* Interactive tool link (a different category from papers/coverage) */
.pub__link--tool { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.pub__link--tool:hover { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
[data-theme="dark"] .pub__link--tool { background: #86b8ec; border-color: #86b8ec; color: #0c1f3a; }
[data-theme="dark"] .pub__link--tool:hover { background: #a9cdf2; border-color: #a9cdf2; color: #0c1f3a; }

/* Floating hover preview (PDF page or article share image) */

.preview-card {
  position: fixed;
  z-index: 90;
  width: 260px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.preview-card.is-visible { opacity: 1; transform: translateY(0) scale(1); }

.preview-card img { width: 100%; height: auto; background: #fff; }

.preview-card__label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}

/* Featured cards (home) */

.featured-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

.feature-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.feature-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: var(--blue-100); }
[data-theme="dark"] .feature-card:hover { border-color: #2a4a7a; }

.feature-card__thumb {
  height: 168px;
  overflow: hidden;
  background: linear-gradient(140deg, var(--blue-50), var(--blue-100));
  position: relative;
  display: grid;
  place-items: center;
}

.feature-card__thumb img.thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.feature-card__thumb img.logo-tile { width: 60%; height: auto; opacity: 0.85; }

.feature-card:hover .feature-card__thumb img.thumb { transform: scale(1.045); }

.feature-card__body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }

.feature-card__meta { font-size: 12.5px; font-weight: 600; color: var(--muted); }

.feature-card__title { font-size: 16.5px; font-weight: 650; color: var(--ink); line-height: 1.42; flex: 1; }

.feature-card__title a { color: inherit; }
.feature-card__title a:hover { color: var(--blue-600); }

.feature-card__cta {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--blue-600);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.feature-card__cta .arrow { transition: transform 0.2s ease; }
.feature-card:hover .feature-card__cta .arrow { transform: translateX(4px); }

/* Research teaser (home) — text + figure */

.research-split {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 48px;
  align-items: center;
}

.research-figure {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.research-figure:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.research-figure img { width: 100%; height: auto; }

.research-figure figcaption {
  font-size: 12.5px;
  color: var(--muted);
  padding-top: 12px;
  text-align: center;
}

/* Mirrored split (image left on desktop only; stacked mobile keeps text first) */
@media (min-width: 901px) {
  .research-split--flip { grid-template-columns: 440px 1fr; }
  .research-split--flip > :first-child { order: 2; }
  .research-split--flip > :last-child { order: 1; }
}

/* Click-to-enlarge figure */
figure.research-figure[data-lightbox] { cursor: zoom-in; }

.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
  background: rgba(8, 21, 39, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: zoom-out;
}

.img-lightbox.is-open { display: flex; animation: fadeIn 0.2s ease; }

.img-lightbox img {
  max-width: min(1200px, 92vw);
  max-height: 92vh;
  width: auto;
  height: auto;
  border-radius: 12px;
  background: #fff;
  padding: 16px;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

a.research-figure { display: block; }

a.research-figure img { transition: transform 0.3s ease; }

a.research-figure:hover img { transform: scale(1.015); }

[data-theme="dark"] .research-figure { border-color: #2a4a7a; }
[data-theme="dark"] .research-figure figcaption { color: #5c6b80; }

/* --------------------------------------------------------------------------
   Research page
   -------------------------------------------------------------------------- */

.research-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 32px;
  margin-bottom: 22px;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.research-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--blue-100); }
[data-theme="dark"] .research-card:hover { border-color: #2a4a7a; }

.research-card--forthcoming { opacity: 0.72; border-style: dashed; }
.research-card--forthcoming:hover { transform: none; box-shadow: none; border-color: var(--line); }

.research-card__meta {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.research-card h3 { font-size: 20px; margin-bottom: 10px; }

.research-card p { font-size: 15.5px; margin-bottom: 6px; }

.research-card__authors { font-size: 14px; color: var(--muted); font-style: italic; margin-bottom: 14px; }

.research-card__quote {
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
  border-left: 2px solid var(--blue-100);
  padding: 1px 0 1px 14px;
  margin: 10px 0 2px;
  line-height: 1.55;
}

.research-card__quote cite { font-style: normal; font-size: 12.5px; color: var(--faint); margin-left: 8px; white-space: nowrap; }

[data-theme="dark"] .research-card__quote { border-left-color: #2a4a7a; }

.research-card__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

/* --------------------------------------------------------------------------
   Contact
   -------------------------------------------------------------------------- */

.contact-card {
  background: linear-gradient(140deg, var(--navy-900), var(--navy-800) 55%, var(--blue-700));
  border-radius: 20px;
  padding: 56px 48px;
  color: #dbe9f9;
  text-align: center;
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .contact-card { background: linear-gradient(140deg, #10233f, #17325a 55%, #1e4f8f); }

.contact-card h2 { color: #fff; font-size: clamp(26px, 3.5vw, 34px); margin-bottom: 28px; }

.contact-card .btn--primary { background: #fff; color: var(--navy-800); }
.contact-card .btn--primary:hover { background: var(--blue-50); color: var(--navy-800); }

.contact-card .btn--ghost { background: transparent; border-color: rgba(255, 255, 255, 0.35); color: #fff; }
.contact-card .btn--ghost:hover { border-color: #fff; background: rgba(255, 255, 255, 0.08); color: #fff; }

.contact-card__actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }

/* Compact bottom-panel variant (home) */
.contact-card--compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
  padding: 26px 36px;
  text-align: left;
}

.contact-card--compact h2 { margin: 0; font-size: clamp(20px, 2.6vw, 26px); }

/* Contact page email rows */

.contact-rows {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 460px;
  margin: 0 auto 26px;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 13px;
  padding: 14px 20px;
  color: #fff;
  text-align: left;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.contact-row:hover { background: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.4); transform: translateY(-2px); }

.contact-row img { width: 30px; height: 30px; border-radius: 7px; background: #fff; padding: 3px; object-fit: contain; flex: none; }

.contact-row .label { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(219, 233, 249, 0.75); }

.contact-row .addr { font-size: 16px; font-weight: 600; color: #fff; text-decoration: underline; text-decoration-color: rgba(255,255,255,0.35); text-underline-offset: 3px; }

.contact-row:hover .addr { text-decoration-color: #fff; }

/* --------------------------------------------------------------------------
   PDF modal viewer
   -------------------------------------------------------------------------- */

.pdf-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
  background: rgba(8, 21, 39, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.pdf-modal.is-open { display: flex; animation: fadeIn 0.22s ease; }

.pdf-modal__box {
  width: min(900px, 100%);
  height: 100%;
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pdf-modal__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.pdf-modal__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-modal__bar-actions { display: flex; gap: 8px; flex: none; }

.pdf-modal iframe { flex: 1; border: 0; width: 100%; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------------------
   Reveal-on-scroll
   -------------------------------------------------------------------------- */

.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--line);
  padding: 34px 0;
  font-size: 14px;
  color: var(--muted);
}

.footer__inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }

.footer__left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.footer__loc {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--faint);
}

.footer__loc svg { width: 12px; height: 12px; flex: none; }

.footer a { color: var(--muted); font-weight: 500; transition: color 0.15s ease; }
.footer a:hover { color: var(--blue-600); }

.footer__links { display: flex; gap: 20px; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; gap: 36px; }
  .hero__portrait { order: -1; }
  .hero__portrait img, .hero__portrait .portrait-fallback { width: 180px; height: 180px; }
  .featured-grid { grid-template-columns: 1fr; }
  .roles { grid-template-columns: 1fr; }
  .research-split { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 700px) {
  body { overflow-x: clip; }
  .container { padding: 0 16px; }
  .hero { padding: 56px 0 44px; }
  .section { padding: 52px 0; }
  .pub { grid-template-columns: 1fr; }
  .pub__actions { justify-self: start; margin-top: 10px; }
  .nav__inner { gap: 6px; }
  .nav__right { min-width: 0; }
  .nav__right nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav__right nav::-webkit-scrollbar { display: none; }
  .nav__links { gap: 0; flex-wrap: nowrap; }
  .nav__links a { padding: 8px 6px; font-size: 13.5px; white-space: nowrap; }
  .nav__links a.is-active::after { left: 6px; right: 6px; }
  .nav__brand span.full, .sm-hide { display: none; }
  /* switch becomes a simple icon button on small screens */
  .theme-toggle { width: 34px; height: 34px; border-radius: 9px; background: var(--surface); }
  .theme-toggle .knob,
  [data-theme="dark"] .theme-toggle .knob {
    top: 50%; left: 50%;
    width: auto; height: auto;
    transform: translate(-50%, -50%);
    background: transparent;
    box-shadow: none;
    color: var(--muted);
  }
  .theme-toggle svg { width: 16px; height: 16px; }
  [data-theme="dark"] .theme-toggle { background: var(--surface); border-color: var(--line); }
  [data-theme="dark"] .theme-toggle .knob { color: #9db8e8; }
  .contact-card { padding: 40px 24px; }
  .preview-card { display: none; }
  .outlets { gap: 18px 26px; }
  .outlets img { height: 20px; max-width: 150px; }
}
