/* ================= THEME TOKENS ================= */
/* Navy + gold to match the IV logo */
:root {
  --bg: #0a1020;
  --bg-alt: #0d1427;
  --card: #111a30;
  --card-hover: #142038;
  --border: #1f2b45;
  --border-strong: #2c3b5c;
  --text: #e8edf5;
  --muted: #9aa7bd;
  --accent: #e0b354;
  --accent-2: #6b9bff;
  --on-accent: #1a1405;
  --glow-1: rgba(224, 179, 84, 0.10);
  --glow-2: rgba(107, 155, 255, 0.10);
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.55);
  --radius: 16px;
  --nav-h: 68px;
  --font-head: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

body.light {
  --bg: #f7f8fb;
  --bg-alt: #eef1f6;
  --card: #ffffff;
  --card-hover: #ffffff;
  --border: #dde3ec;
  --border-strong: #c5cfdd;
  --text: #0f1a2e;
  --muted: #4b5870;
  --accent: #86600f;
  --accent-2: #1f4fbf;
  --on-accent: #ffffff;
  --glow-1: rgba(134, 96, 15, 0.08);
  --glow-2: rgba(31, 79, 191, 0.07);
  --shadow: 0 18px 40px -20px rgba(15, 26, 46, 0.18);
}

/* ================= BASE ================= */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
h1, h2, h3 { font-family: var(--font-head); letter-spacing: -0.02em; line-height: 1.2; text-wrap: balance; }

.container { width: min(1140px, 100% - 32px); margin-inline: auto; }
.mono { font-family: var(--font-mono); }
.muted-small { color: var(--muted); font-size: 0.85rem; }
.accent { color: var(--accent); }
.nowrap { white-space: nowrap; }
.keep-case { text-transform: none; }

/* Small uppercase label above headings */
.kicker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

/* ================= ACCESSIBILITY HELPERS ================= */
.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;
}
.skip-link {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 300;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  transform: translateY(-150%);
  transition: transform 0.2s;
}
.skip-link:focus { transform: none; }

/* Thin reading-progress bar along the top edge */
.scroll-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 150;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
main:focus { outline: none; }

/* ================= BUTTONS ================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { box-shadow: 0 8px 22px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-primary i { transition: transform 0.2s; }
.btn-primary:hover i { transform: translateX(3px); }
.btn-ghost { background: var(--card); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ================= NAVBAR ================= */
.navbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  z-index: 100;
  transition: background 0.3s, box-shadow 0.3s;
}
.navbar.scrolled {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--border);
}
.nav-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; font-size: 1.2rem; }
.logo img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.logo-accent { color: var(--accent); }

.nav-links { display: flex; gap: 6px; }
.nav-links a {
  display: block;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); background: var(--card); box-shadow: inset 0 0 0 1px var(--border); }

.nav-actions { display: flex; gap: 8px; }
.theme-toggle,
.menu-toggle {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}
.theme-toggle:hover,
.menu-toggle:hover { border-color: var(--accent); }
.menu-toggle { display: none; }

/* ================= HERO ================= */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  padding: calc(var(--nav-h) + 24px) 0 88px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 50% at 10% 10%, var(--glow-1), transparent 70%),
    radial-gradient(ellipse 50% 50% at 90% 40%, var(--glow-2), transparent 70%);
}
.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 64px;
  align-items: center;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  padding: 6px 14px 6px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-bottom: 26px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); line-height: 1.02; letter-spacing: -0.035em; margin-bottom: 14px; }
.hero-lead {
  font-family: var(--font-head);
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 22px;
  text-wrap: balance;
}
/* Reserve space so the typing animation never shifts the content below */
.hero-lead { min-height: 1.3em; white-space: nowrap; }
.focus-label { color: var(--muted); }
.cursor { color: var(--accent); font-weight: 400; margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-desc { color: var(--muted); font-size: 1.05rem; max-width: 600px; margin-bottom: 32px; }
.hero-desc strong { color: var(--text); font-weight: 600; }
.hero-buttons { display: flex; flex-wrap: wrap; gap: 12px; }
/* Static focus tags: hidden by default, shown instead of the typing line for reduced motion */
.hero-tags { display: none; flex-wrap: wrap; gap: 8px; margin: -8px 0 28px; }
.hero-tags li {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 4px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}

.hero-visual { display: flex; flex-direction: column; gap: 14px; }
.profile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px;
  box-shadow: var(--shadow);
}
.profile-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 14px;
}
.profile-card figcaption { padding: 16px 8px 6px; }
.focus-title {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.focus-list { display: grid; gap: 8px; }
.focus-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-alt);
  font-size: 0.9rem;
  font-weight: 500;
}
.focus-list i { width: 16px; text-align: center; color: var(--accent); font-size: 0.85rem; }

.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hero-stats div {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 12px;
}
.hero-stats dt { font-family: var(--font-head); font-size: 1.35rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.hero-stats dd { color: var(--muted); font-size: 0.76rem; line-height: 1.4; margin-top: 4px; }

/* Scroll cue: fades in after load, then the arrow bobs gently */
.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  opacity: 0;
  animation: cue-in 0.8s ease 1.2s forwards;
  transition: color 0.2s;
}
.scroll-cue:hover { color: var(--accent); }
.scroll-cue-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.scroll-cue-arrow { font-size: 0.85rem; animation: cue-bob 2s ease-in-out infinite; }
@keyframes cue-in { to { opacity: 1; } }
@keyframes cue-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }

/* ================= CV PREVIEW PAGE ================= */
.cv-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.cv-bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.cv-actions { display: flex; gap: 10px; }
.cv-main { padding: 40px 0 72px; }
.cv-title { font-size: clamp(1.8rem, 4vw, 2.4rem); margin-bottom: 28px; }
.cv-viewer { display: flex; flex-direction: column; align-items: center; gap: 20px; max-width: 900px; margin-inline: auto; }
.cv-page-canvas {
  width: 100%;
  height: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.cv-object { width: 100%; height: 80vh; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.cv-status { color: var(--muted); padding: 48px 0; text-align: center; }

/* ================= SECTIONS ================= */
.section { padding: 104px 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--border); }
.section-head { margin-bottom: 48px; max-width: 720px; }
.section-head h2 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); }

/* ================= ABOUT ================= */
.about-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 48px; align-items: start; }
.about-text p { color: var(--muted); font-size: 1.02rem; margin-bottom: 18px; }
.about-text strong { color: var(--text); font-weight: 600; }
.facts {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 24px;
}
/* Label and value side by side keeps the eight rows compact next to the text */
.facts div {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.facts div:last-child { border-bottom: none; }
.facts dt {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd { font-size: 0.9rem; font-weight: 500; line-height: 1.5; min-width: 0; overflow-wrap: anywhere; }

/* ================= SKILLS ================= */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.skill-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: border-color 0.25s, background 0.25s;
}
.skill-card:hover { border-color: var(--border-strong); background: var(--card-hover); }
.skill-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  color: var(--accent);
  font-size: 1.1rem;
  margin-bottom: 18px;
}
.skill-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.skill-card { display: flex; flex-direction: column; }
.skill-card p { color: var(--muted); font-size: 0.9rem; margin-bottom: 18px; }
/* "Used in" line pinned to the bottom of each card */
.skill-card .used-in {
  margin: auto 0 0;
  padding-top: 16px;
  font-size: 0.8rem;
  line-height: 1.5;
  border-top: 1px solid var(--border);
}
.skill-card .chips { margin-bottom: 18px; }
.used-in span { font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span {
  font-size: 0.78rem;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
}

/* ================= PROJECTS ================= */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.filter-btn {
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover { color: var(--text); border-color: var(--text); }
.filter-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.projects-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s, box-shadow 0.25s, opacity 0.6s, transform 0.6s;
}
.project-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.project-card.hide { display: none; }

/* Flagship project: full-width, side-by-side layout */
.project-card.featured { grid-column: 1 / -1; flex-direction: row; }
.project-card.featured .card-img { flex: 1.15; aspect-ratio: auto; min-height: 360px; }
/* The photo fills the space beside the text instead of setting the card height */
.project-card.featured .card-img-btn { position: absolute; inset: 0; }
.project-card.featured .card-body { flex: 1; padding: 36px; justify-content: center; }
.project-card.featured h3 { font-size: 1.6rem; }
.project-card.featured .card-body > p:not(.card-kicker):not(.card-outcome) { flex: 0; }

.card-img { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #fff; border-bottom: 1px solid var(--border); }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.project-card:hover .card-img img { transform: scale(1.03); }
/* The card photo itself opens the photo gallery */
.card-img-btn {
  display: block;
  width: 100%; height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.card-img-btn:focus-visible { outline-offset: -3px; }
.card-badge { pointer-events: none; }
/* Whole (uncropped) photo, with a blurred copy of it filling the sides */
/* No photo (or it failed to load): a plain image icon instead of a stock picture */
.card-img-none { display: grid; place-items: center; background: var(--bg-alt); }
.card-img-none::after { content: "\f03e"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 2rem; color: var(--border-strong); }
.card-img-contain { background: #000; }
.card-img-contain::before {
  content: "";
  position: absolute;
  inset: -20px;
  background: var(--card-bg) center / cover no-repeat;
  filter: blur(18px) brightness(0.55);
}
.card-img-contain .card-img-btn { position: relative; }
.card-img-contain img { object-fit: contain; }
.card-badge {
  position: absolute;
  top: 14px; left: 14px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(10, 16, 32, 0.85);
  color: #fff;
  backdrop-filter: blur(6px);
  max-width: calc(100% - 28px);
}
/* "N photos" chip on the card image, opens the gallery */
.card-photos {
  position: absolute;
  right: 14px; bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 12px;
  border: none;
  border-radius: 999px;
  background: rgba(10, 16, 32, 0.85);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.card-photos:hover { background: rgba(10, 16, 32, 0.95); color: #e0b354; }
/* Headline numbers on a card */
.card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.card-stats div {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-alt);
  min-width: 0;
}
.card-stats dt { font-family: var(--font-head); font-size: 1.05rem; font-weight: 700; color: var(--accent); line-height: 1.25; }
.card-stats dd { font-size: 0.75rem; color: var(--muted); line-height: 1.35; margin-top: 2px; }.card-body { padding: 22px 24px 24px; display: flex; flex-direction: column; flex: 1; }
.card-kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 8px;
}
.card-body h3 { font-size: 1.12rem; margin-bottom: 8px; line-height: 1.35; }
.card-body > p:not(.card-kicker):not(.card-outcome) { color: var(--muted); font-size: 0.9rem; margin-bottom: 14px; flex: 1; }
/* Result-focused line on each project, highlighted with an accent rule */
.card-outcome,
.modal-outcome {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
  padding: 10px 14px;
  margin-bottom: 16px;
  border-left: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-radius: 0 8px 8px 0;
}
.card-outcome strong,
.modal-outcome strong { color: var(--accent); font-weight: 600; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.card-tags span {
  font-size: 0.76rem;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.card-links { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; padding-top: 14px; border-top: 1px solid var(--border); }
.card-links button,
.card-links a,
.modal-links a {
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}
.card-links i,
.modal-links i { color: var(--muted); font-size: 0.85rem; transition: color 0.2s; }
.card-links button:hover,
.card-links a:hover,
.modal-links a:hover,
.card-links button:hover i,
.card-links a:hover i,
.modal-links a:hover i { color: var(--accent); }
.noscript-list { columns: 2; color: var(--muted); }
.noscript-list li { margin-bottom: 8px; }

/* ================= EXPERIENCE ================= */
.section-intro { color: var(--muted); margin-top: 14px; font-size: 0.98rem; }
.timeline.timeline-wide { max-width: none; }
/* Two roles inside the MAS card */
.tl-role { padding: 10px 0 10px 14px; border-left: 2px solid var(--border); margin-bottom: 10px; }
.tl-role-title { font-weight: 600; font-size: 0.95rem; }
.tl-role-meta { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin: 2px 0 6px; }
.tl-role p:last-child { color: var(--muted); font-size: 0.92rem; }
.tl-note { color: var(--muted); font-size: 0.85rem; margin-top: 6px; }

/* ================= TIMELINE ================= */
.timeline { position: relative; max-width: 860px; padding-left: 32px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 6px; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--border-strong);
}
.tl-item { position: relative; margin-bottom: 22px; }
.tl-item:last-child { margin-bottom: 0; }
.tl-dot {
  position: absolute;
  left: -31px; top: 28px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg-alt);
}
.tl-content,
.edu-card,
.cred-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
}
.tl-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.tl-content h3,
.edu-card h3 { font-size: 1.12rem; margin-top: 6px; line-height: 1.4; }
.tl-content h4,
.edu-card h4 { color: var(--muted); font-weight: 500; font-size: 0.93rem; margin-bottom: 10px; }
.tl-content li,
.check-list li,
.modal-body li { color: var(--muted); font-size: 0.92rem; padding-left: 20px; position: relative; margin-bottom: 6px; }
.tl-content li::before,
.modal-body li::before {
  content: "";
  position: absolute;
  left: 2px; top: 0.7em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
}
.edu-card p { color: var(--muted); font-size: 0.92rem; margin-bottom: 6px; }

/* ================= EDUCATION (two columns on desktop) ================= */
.edu-grid { display: grid; grid-template-columns: 11fr 9fr; gap: 24px; align-items: start; }
.edu-col { display: grid; gap: 18px; }
.edu-card h3 { margin-top: 0; }
.edu-stats { grid-template-columns: repeat(2, 1fr); margin: 14px 0 12px; max-width: 420px; }
.edu-research { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.edu-label { color: var(--text); font-weight: 600; }
.inline-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.inline-link:hover { text-decoration-thickness: 2px; }
/* About facts that jump to their section */
.fact-link { color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; transition: color 0.2s, text-decoration-color 0.2s; }
.fact-link:hover { color: var(--accent); text-decoration-color: currentColor; }

/* ================= LEADERSHIP (small section) ================= */
.section.section-compact { padding-top: 64px; }

/* ================= PUBLICATION, CERTIFICATIONS & LEADERSHIP CARDS ================= */
/* Leadership list flows down two columns */
.lead-list { columns: 2; column-gap: 36px; }
.lead-list li {
  break-inside: avoid;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  padding: 0 0 10px 14px;
  border-left: 2px solid var(--border);
  margin-bottom: 10px;
}
.lead-list li strong { color: var(--text); font-weight: 600; }
.lead-date { display: block; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-top: 2px; }
.lead-note { display: block; margin-top: 4px; font-size: 0.88rem; }
.recognition { display: flex; gap: 10px; align-items: baseline; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.92rem; }
.recognition i { color: var(--accent); }
.recognition strong { color: var(--text); }
.cred-card h3 { font-size: 1.05rem; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.cred-card h3 i { color: var(--accent); font-size: 0.95rem; }
.pub-title { font-weight: 600; margin-bottom: 8px; line-height: 1.5; }
.text-link { display: inline-flex; gap: 6px; align-items: center; margin-top: 12px; color: var(--accent); font-size: 0.85rem; word-break: break-all; }
.text-link:hover { text-decoration: underline; }
.check-list li::before { content: "\f00c"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 0.7rem; position: absolute; left: 0; top: 3px; color: var(--accent); }

/* ================= CONTACT ================= */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.contact-intro p { color: var(--muted); margin-bottom: 26px; font-size: 1.05rem; line-height: 1.7; }
.contact-intro .email-note { margin: 14px 0 0; font-size: 0.88rem; line-height: 1.5; color: var(--muted); }
.contact-intro .email-note:empty { display: none; }
.info-item { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; word-break: break-word; transition: color 0.2s; }
a.info-item:hover { color: var(--accent); }
.info-item i {
  flex-shrink: 0;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--accent);
}

/* ================= FOOTER ================= */
.footer { border-top: 1px solid var(--border); padding: 30px 0; text-align: center; color: var(--muted); font-size: 0.85rem; }
.footer .credit { font-size: 0.78rem; margin-top: 4px; }
.footer a { color: var(--accent); }

/* ================= MODAL ================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(2, 6, 17, 0.72);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0s 0.25s;
}
/* Become visible instantly on open so focus can move into the dialog */
.modal.open { opacity: 1; visibility: visible; transition: opacity 0.25s, visibility 0s; }
.modal-box {
  position: relative;
  width: min(780px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  transform: translateY(16px);
  transition: transform 0.25s;
}
.modal.open .modal-box { transform: none; }
/* One view at a time: details (text only), photos (gallery only) or video (player only) */
.modal-box[data-view="details"] :is(.modal-video, .modal-media, .modal-caption, .modal-thumbs),
.modal-box[data-view="photos"] :is(.modal-video, .modal-body),
.modal-box[data-view="video"] :is(.modal-media, .modal-caption, .modal-thumbs, .modal-body) { display: none; }
.modal-box[data-view="details"] .modal-body { padding-top: 28px; }
.modal-box[data-view="details"] :is(.modal-cat, .modal-body h3) { display: block; padding-right: 44px; }
.modal-box[data-view="photos"] { padding-bottom: 20px; }
/* Video view: 16:9 player; a tall, phone-shaped one for vertical Shorts */
.modal-box[data-view="video"] { overflow: hidden; background: #000; }
.modal-box[data-view="video"].video-vertical { width: auto; }
.modal-box[data-view="video"].video-vertical .modal-video { aspect-ratio: 9 / 16; width: min(calc(100vw - 34px), calc(80vh * 9 / 16), 428px); }
.modal-box[data-view="video"].video-vertical .video-facade img { object-fit: cover; }
/* Responsive 16:9 video slot at the top of the modal */
.modal-video { position: relative; aspect-ratio: 16 / 9; background: #000; }
.modal-video[hidden] { display: none; }
.modal-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-facade {
  position: absolute;
  inset: 0;
  width: 100%;
  padding: 0;
  border: 0;
  background: #000;
  cursor: pointer;
}
/* YouTube's hqdefault thumbnail is 4:3 with letterbox bars; cover crops them in the 16:9 player */
.video-facade img { width: 100%; height: 100%; object-fit: cover; }
.video-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 68px; height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(220, 38, 38, 0.92);
  color: #fff;
  font-size: 1.2rem;
  transition: transform 0.2s, background 0.2s;
}
.video-facade:hover .video-play { transform: translate(-50%, -50%) scale(1.08); background: #dc2626; }
.modal-media { position: relative; }
#modalImg { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #fff; }
/* Result tiles at the top of a project's Details popup */
.modal-stats { margin: 4px 0 22px; }
.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(10, 16, 32, 0.8);
  color: #fff;
  cursor: pointer;
}
.modal-nav:hover { background: rgba(10, 16, 32, 0.95); }
.modal-nav[hidden] { display: none; }
.modal-prev { left: 12px; }
.modal-next { right: 12px; }
.modal-caption { padding: 10px 30px 0; font-size: 0.85rem; color: var(--muted); min-height: 1em; }
.modal-caption:empty { display: none; }
.modal-thumbs { display: flex; gap: 8px; padding: 12px 30px 0; flex-wrap: wrap; }
.modal-thumbs:empty { display: none; }
.modal-thumbs button {
  width: 72px; height: 48px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
}
.modal-thumbs button.active { border-color: var(--accent); }
.modal-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(10, 16, 32, 0.85);
  color: #fff;
  cursor: pointer;
  font-size: 1.05rem;
  z-index: 1;
}
.modal-body { padding: 24px 30px 30px; }
.modal-cat {
  font-family: var(--font-mono);
  color: var(--accent-2);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.modal-body h3 { font-size: 1.45rem; margin: 6px 0 12px; line-height: 1.3; }
.modal-body p { color: var(--muted); margin-bottom: 18px; }
.modal-body h4 { margin-bottom: 8px; font-size: 0.95rem; }
.modal-body ul { margin-bottom: 20px; }
.modal-links { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 6px; }
.modal-body h4:not(:first-child) { margin-top: 22px; }
.modal-context { margin-bottom: 4px; }
.modal-context div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.modal-context div:last-child { border-bottom: none; }
.modal-context dt { color: var(--muted); }
.modal-context dd { min-width: 0; }
.results-wrap { overflow-x: auto; margin-bottom: 18px; }
.results-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.results-table th,
.results-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.results-table thead th { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.results-table tbody th { font-weight: 500; color: var(--muted); }
.results-table td { font-weight: 600; }

/* ================= BACK TO TOP ================= */
.back-to-top {
  position: fixed;
  right: 22px; bottom: 22px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all 0.3s;
  z-index: 90;
}
.back-to-top:hover { border-color: var(--accent); color: var(--accent); }
.back-to-top.show { opacity: 1; visibility: visible; transform: none; }

/* ================= REVEAL ANIMATION ================= */
/* Only hide content when JS is running, so it stays visible if scripts fail */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.visible { opacity: 1; transform: none; }

/* ================= RESPONSIVE ================= */
/* Education stacks below 900px: degree and A/L first, then publication and certifications */
@media (max-width: 899px) {
  .edu-grid { grid-template-columns: 1fr; gap: 18px; }
}

@media (max-width: 960px) {
  .hero-inner,
  .about-grid,
  .contact-grid { grid-template-columns: 1fr; }
  /* Stacked hero: the scroll cue sits under the content instead of over it */
  .hero { flex-direction: column; }
  .scroll-cue { position: static; transform: none; margin-top: 48px; }
  .hero-inner { gap: 48px; }
  .hero-visual { max-width: 440px; }
  .skills-grid,
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .project-card.featured { flex-direction: column; }
  .project-card.featured .card-img { min-height: 0; aspect-ratio: 16 / 9; }
  .project-card.featured .card-body { padding: 24px; }
}

@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .nav-links {
    position: fixed;
    top: var(--nav-h); right: 0;
    width: 100%;
    flex-direction: column;
    gap: 0;
    padding: 8px 16px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    transform: translateY(-130%);
    transition: transform 0.3s;
    z-index: -1;
  }
  .nav-links.open { transform: none; }
  .nav-links a { padding: 12px 16px; border-radius: 10px; }
  /* Touch targets at least 44px tall on small screens */
  .nav-links a { display: flex; align-items: center; min-height: 44px; }
  .filter-btn { min-height: 44px; }
  .card-links button,
  .card-links a { min-height: 44px; }
  .section { padding: 76px 0; }
  .hero { min-height: 0; padding-top: calc(var(--nav-h) + 32px); }
  /* CV bar: icon-only secondary buttons so everything fits on one row */
  .cv-back span, .cv-open span { display: none; }
  .cv-back, .cv-open { padding: 11px 14px; }
}

@media (max-width: 600px) {
  .skills-grid,
  .projects-grid { grid-template-columns: 1fr; }
  .hero-stats dt { font-size: 1.15rem; }
  .lead-list { columns: 1; }
  .modal-body { padding: 20px; }
  .modal-thumbs { padding: 10px 20px 0; }
  .modal-caption { padding: 10px 20px 0; }
  .modal-thumbs button { width: 56px; height: 40px; }
  .modal-context div { grid-template-columns: 1fr; gap: 0; }
  .card-stats { gap: 6px; }
  .card-stats div { padding: 8px 9px; }
  .card-stats dt { font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; }
  .cursor { display: none; }
  .hero-tags { display: flex; }
  .scroll-cue { opacity: 1; }
}

/* ================= PRINT ================= */
@media print {
  :root, body.light {
    --bg: #fff; --bg-alt: #fff; --card: #fff; --border: #ccc; --border-strong: #bbb;
    --text: #000; --muted: #333; --accent: #6b4c0c; --accent-2: #1f4fbf;
  }
  .navbar, .back-to-top, .theme-toggle, .filters,
  .card-links, .modal, .skip-link, .hero-buttons, .scroll-progress, .scroll-cue { display: none !important; }
  .hero { min-height: 0; padding: 0 0 20px; background: none; }
  .section { padding: 24px 0; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
  .project-card, .skill-card, .tl-content, .edu-card, .cred-card { break-inside: avoid; box-shadow: none; }
  .projects-grid, .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .project-card.featured { flex-direction: column; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.75rem; word-break: break-all; }
}
