/* ==========================================================================
   CV website styles
   Colours and fonts are defined once below; change them here to restyle.
   ========================================================================== */
:root {
  --ink: #0B1A2B;          /* deep navy (dark sections) */
  --ink-2: #12263D;
  --paper: #F7F5F0;        /* warm off-white (light sections) */
  --paper-2: #EEF3F4;
  --text: #16232F;
  --muted: #5B6875;
  --muted-dark: #9FB1C2;
  --teal: #1C8A9A;
  --teal-bright: #38C3CF;
  --coral: #F08A7E;
  --line: rgba(11, 26, 43, .12);
  --line-dark: rgba(255, 255, 255, .12);
  --radius: 18px;
  --shadow: 0 20px 50px -20px rgba(11, 26, 43, .35);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--text);
  font: 400 17px/1.65 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.12; margin: 0; letter-spacing: -.01em; }
em { font-style: italic; }
h1 em, h2 em, .statement em, .footer-line em { color: var(--teal); font-weight: 400; }
.section-dark h2 em, .hero h1 em, .contact-title em { color: var(--teal-bright); }
strong { font-weight: 600; }
.container { width: min(1160px, 100% - 32px); margin-inline: auto; }
:focus-visible { outline: 2px solid var(--teal-bright); outline-offset: 3px; border-radius: 6px; }

/* ---------- Buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem; padding: .85rem 1.5rem; border-radius: 999px;
  background: var(--teal-bright); color: var(--ink); font-weight: 600; text-decoration: none;
  border: 1px solid transparent; transition: transform .3s var(--ease), background .3s, box-shadow .3s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -10px rgba(56, 195, 207, .6); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .3); }
.btn-ghost:hover { background: rgba(255, 255, 255, .08); box-shadow: none; }
.btn-small { padding: .55rem 1.1rem; font-size: .9rem; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  font-size: .8rem; padding: .3rem .75rem; border-radius: 999px; background: rgba(28, 138, 154, .1);
  color: var(--ink-2); border: 1px solid rgba(28, 138, 154, .18);
}

/* ---------- Loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 100; background: var(--ink); color: #fff;
  display: grid; place-content: center; justify-items: center; gap: .9rem;
  transition: opacity .6s var(--ease), visibility .6s;
}
body:not(.is-loading) .loader { opacity: 0; visibility: hidden; }
.loader-mark { font: italic 500 3.2rem var(--serif); color: var(--teal-bright); animation: pulse 1.4s ease-in-out infinite; }
.loader-text { font-size: .75rem; letter-spacing: .3em; text-transform: uppercase; color: var(--muted-dark); }
.loader-bar { width: 140px; height: 2px; background: var(--line-dark); overflow: hidden; border-radius: 2px; }
.loader-bar span { display: block; height: 100%; width: 40%; background: var(--teal-bright); animation: slide 1.1s var(--ease) infinite; }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
/* Safety net: the loader always fades out, even if JavaScript fails. */
.loader { animation: loaderOut .6s 2.5s forwards; }
@keyframes loaderOut { to { opacity: 0; visibility: hidden; } }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50; display: flex; align-items: center; gap: 2rem;
  padding: 1.1rem max(16px, calc((100% - 1160px) / 2)); color: #fff;
  transition: background .4s, padding .4s var(--ease), box-shadow .4s, transform .4s var(--ease);
}
.nav.scrolled {
  background: rgba(11, 26, 43, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding-block: .7rem; box-shadow: 0 1px 0 var(--line-dark);
}
.nav.hidden { transform: translateY(-100%); }
.nav-logo { font: italic 600 1.5rem var(--serif); color: var(--teal-bright); text-decoration: none; }
.nav-links { display: flex; gap: 1.8rem; margin-left: auto; }
.nav-links a { text-decoration: none; font-size: .93rem; color: #D6E0EA; position: relative; padding: .2rem 0; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 2px; width: 100%; background: var(--teal-bright);
  transform: scaleX(0); transform-origin: right; transition: transform .35s var(--ease);
}
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); transform-origin: left; }
.nav-links a.active { color: #fff; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; width: 40px; height: 40px; cursor: pointer; position: relative; }
.nav-toggle span { position: absolute; left: 9px; right: 9px; height: 2px; background: #fff; transition: transform .35s var(--ease), top .35s var(--ease); }
.nav-toggle span:first-child { top: 15px; }
.nav-toggle span:last-child { top: 23px; }
.menu-open .nav-toggle span:first-child { top: 19px; transform: rotate(45deg); }
.menu-open .nav-toggle span:last-child { top: 19px; transform: rotate(-45deg); }
.mobile-menu {
  position: fixed; inset: 0; z-index: 40; background: var(--ink); display: flex; flex-direction: column;
  justify-content: center; padding: 0 24px; gap: .4rem; opacity: 0; visibility: hidden; transition: opacity .4s, visibility .4s;
}
.mobile-menu a { font: 500 2.2rem var(--serif); color: #fff; text-decoration: none; padding: .3rem 0; }
.menu-open .mobile-menu { opacity: 1; visibility: visible; }
.menu-open { overflow: hidden; }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: min(100vh, 1000px); min-height: min(100svh, 1000px); background: var(--ink); color: #fff;
  display: flex; align-items: center; padding: 120px 0 90px; overflow: hidden;
}
.hero-glow {
  position: absolute; inset: -20% -10% auto auto; width: 70vw; height: 70vw; pointer-events: none;
  background: radial-gradient(circle at center, rgba(56, 195, 207, .18), transparent 60%);
  animation: drift 14s ease-in-out infinite alternate;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image: radial-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px); background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, #000, transparent 85%); -webkit-mask-image: linear-gradient(to bottom, #000, transparent 85%);
}
@keyframes drift { to { transform: translate(-12%, 10%) scale(1.1); } }
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr .85fr; gap: 4rem; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: .6rem; font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-dark); margin: 0 0 1.2rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #4ADE80; box-shadow: 0 0 0 0 rgba(74, 222, 128, .6); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }
.hero-name { font-size: clamp(2.8rem, 7vw, 5.6rem); }
.hero-role { font-size: clamp(1.15rem, 2.2vw, 1.5rem); color: var(--teal-bright); margin: 1rem 0 0; min-height: 1.6em; font-weight: 500; }
.caret { display: inline-block; width: 2px; height: 1.1em; background: var(--teal-bright); margin-left: 3px; vertical-align: -3px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-intro { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: #C9D5E1; max-width: 34ch; margin: 1.2rem 0 2.2rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; }

.hero-visual { display: flex; justify-content: center; }
.portrait-wrap { position: relative; width: min(420px, 100%); aspect-ratio: 4 / 5; transform-style: preserve-3d; transition: transform .6s var(--ease); }
.portrait {
  width: 100%; height: 100%; object-fit: cover; object-position: 45% 30%; border-radius: 28px;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .7); position: relative; z-index: 1;
}
.portrait-ring {
  position: absolute; inset: -14px; border-radius: 36px; z-index: 0;
  background: conic-gradient(from 180deg, var(--teal-bright), var(--coral), var(--teal), var(--teal-bright));
  opacity: .55; filter: blur(22px); animation: spin 12s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.float-card {
  position: absolute; z-index: 2; background: rgba(11, 26, 43, .78); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line-dark); border-radius: 16px; padding: .85rem 1rem; font-size: .82rem; color: #D6E0EA;
  box-shadow: var(--shadow); animation: bob 6s ease-in-out infinite;
}
.float-card strong { color: #fff; font-weight: 600; }
.float-top { top: 8%; right: -12%; display: grid; gap: .1rem; max-width: 210px; }
.float-bottom { bottom: -6%; left: -14%; display: grid; gap: .55rem; width: 255px; animation-delay: -3s; }
.float-label { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--teal-bright); }
.float-sub { color: var(--muted-dark); }
.mini-row { display: grid; grid-template-columns: 44px 1fr; gap: .5rem; line-height: 1.35; }
.mini-when { color: var(--coral); font-weight: 600; font-size: .75rem; padding-top: .1rem; }
.mini-what { font-size: .78rem; color: var(--muted-dark); }
@keyframes bob { 50% { transform: translateY(-10px); } }

.scroll-cue {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 1;
  display: grid; justify-items: center; gap: .4rem; text-decoration: none; color: var(--muted-dark); font-size: .7rem; letter-spacing: .25em; text-transform: uppercase;
}
.scroll-cue i { width: 1px; height: 38px; background: linear-gradient(var(--teal-bright), transparent); animation: drop 2s var(--ease) infinite; transform-origin: top; }
@keyframes drop { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- Ticker ---------- */
.ticker { background: var(--teal); color: #fff; overflow: hidden; padding: .95rem 0; white-space: nowrap; }
.ticker-track { display: inline-flex; gap: 2rem; animation: marquee 38s linear infinite; padding-left: 2rem; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker span { font: italic 500 1.15rem var(--serif); }
.ticker .ticker-sep { font-style: normal; color: rgba(255, 255, 255, .6); font-size: .9rem; align-self: center; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { padding: clamp(80px, 11vw, 140px) 0; position: relative; }
.section-dark { background: var(--ink); color: #fff; }
.section-tint { background: var(--paper-2); }
.section-label { font-size: .78rem; letter-spacing: .22em; text-transform: uppercase; color: var(--teal); font-weight: 600; margin: 0 0 1rem; display: flex; align-items: center; gap: .7rem; }
.section-label::before { content: ""; width: 28px; height: 1px; background: currentColor; }
.section-dark .section-label { color: var(--teal-bright); }
.section-title { font-size: clamp(2.2rem, 5vw, 3.8rem); margin-bottom: 1rem; }
.section-intro { color: var(--muted); max-width: 56ch; margin: 0 0 3rem; font-size: 1.08rem; }
.section-dark .section-intro { color: var(--muted-dark); }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 5rem; align-items: start; }
.about-grid > div:first-child { position: sticky; top: 110px; }
.statement { font-size: clamp(2rem, 4.2vw, 3.3rem); margin-bottom: 2.5rem; }
.facts { margin: 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.facts div { display: grid; grid-template-columns: 110px 1fr; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.facts dt { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding-top: .15rem; }
.facts dd { margin: 0; font-weight: 500; }
.about-text > p { font-size: 1.12rem; margin: 0 0 1.4rem; color: #2A3744; }
.about-text strong { color: var(--ink); background: linear-gradient(transparent 62%, rgba(56, 195, 207, .25) 62%); }
.skill-cloud { margin-top: 2.6rem; display: grid; gap: 1.4rem; }
.skill-group h3 { font: 600 .8rem var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: .6rem; }

/* ---------- Impact ---------- */
.impact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line-dark); border: 1px solid var(--line-dark); border-radius: var(--radius); overflow: hidden; }
.impact-card { background: var(--ink); padding: 2.2rem 2rem; position: relative; transition: background .4s; }
.impact-card:hover { background: var(--ink-2); }
.impact-card::before { content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 0; background: linear-gradient(90deg, var(--teal-bright), var(--coral)); transition: width .6s var(--ease); }
.impact-card:hover::before { width: 100%; }
.impact-value { font: 500 clamp(2.6rem, 4.6vw, 3.6rem)/1 var(--serif); color: #fff; margin-bottom: 1rem; font-variant-numeric: tabular-nums; }
.impact-card p { color: var(--muted-dark); margin: 0 0 1.2rem; font-size: .95rem; }
.impact-org { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--coral); font-weight: 600; }

/* ---------- Career ---------- */
.career { display: grid; grid-template-columns: 340px 1fr; gap: 3rem; margin-top: 3rem; align-items: start; }
.career-list { display: grid; border-left: 2px solid var(--line); position: sticky; top: 110px; }
.career-tab {
  text-align: left; background: none; border: 0; cursor: pointer; padding: 1rem 1.2rem; margin-left: -2px;
  border-left: 2px solid transparent; display: grid; gap: .15rem; font: inherit; color: var(--muted);
  transition: border-color .3s, background .3s, color .3s;
}
.career-tab:hover { background: rgba(28, 138, 154, .06); color: var(--text); }
.career-tab.active { border-left-color: var(--teal); background: rgba(28, 138, 154, .08); color: var(--text); }
.career-dates { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--teal); font-weight: 600; }
.career-role { font-weight: 600; font-size: .98rem; line-height: 1.35; }
.career-co { font-size: .88rem; display: flex; align-items: center; gap: .45rem; }
.live { width: 7px; height: 7px; border-radius: 50%; background: #22C55E; display: inline-block; animation: ping 2s infinite; }
.career-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.5rem, 3vw, 2.5rem); box-shadow: 0 30px 60px -40px rgba(11, 26, 43, .4); }
.career-panel.active { animation: panelIn .55s var(--ease); }
@keyframes panelIn { from { opacity: 0; transform: translateY(14px); } }
.career-panel h3 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.panel-meta { color: var(--teal); font-weight: 600; font-size: .9rem; margin: .5rem 0 .8rem; }
.panel-summary { color: var(--muted); margin: 0 0 1.5rem; }
.panel-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1.6rem; }
.panel-stat { background: var(--paper); border-radius: 12px; padding: .9rem 1rem; display: grid; gap: .25rem; }
.panel-stat strong { font: 500 1.45rem/1.1 var(--serif); color: var(--ink); }
.panel-stat span { font-size: .8rem; color: var(--muted); line-height: 1.4; }
.panel-points { padding: 0; margin: 0 0 1.6rem; list-style: none; display: grid; gap: .8rem; }
.panel-points li { padding-left: 1.6rem; position: relative; color: #2A3744; font-size: .98rem; }
.panel-points li::before { content: ""; position: absolute; left: 0; top: .62em; width: 9px; height: 9px; border-radius: 3px; background: var(--teal); transform: rotate(45deg); }

/* ---------- Education & research ---------- */
.edu-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 3rem 0 4rem; }
.edu-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; transition: transform .4s var(--ease), box-shadow .4s; }
.edu-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.edu-card h3 { font-size: 1.2rem; margin: .6rem 0 .4rem; }
.edu-card p { margin: 0; color: var(--muted); font-size: .92rem; }
.edu-card .edu-note { margin-top: .6rem; color: var(--teal); font-weight: 500; }
.edu-period { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--coral); font-weight: 700; }
.edu-affil {
  background: var(--ink); color: #fff; border-color: transparent; font: inherit; text-align: left;
  cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; width: 100%;
}
.edu-affil h3 { color: #fff; }
.edu-affil:hover { box-shadow: 0 20px 50px -18px rgba(28, 138, 154, .7); }
.affil-badge {
  display: inline-block; font: 700 .72rem var(--sans); letter-spacing: .14em; color: var(--ink);
  background: var(--teal-bright); padding: .28rem .65rem; border-radius: 999px; margin: .7rem 0 0;
}
.affil-more { margin-top: auto; padding-top: 1.1rem; font-size: .88rem; color: var(--teal-bright); font-weight: 600; }
.affil-more span { display: inline-block; transition: transform .35s var(--ease); }
.edu-affil:hover .affil-more span { transform: translateX(5px); }

/* ---------- Affiliation dialog (board exams) ---------- */
html:has(dialog[open]) { overflow: hidden; }
.affil-dialog {
  width: min(640px, 100% - 32px); max-height: min(86vh, 860px); padding: 0; border: 0; border-radius: 24px;
  background: #fff; color: var(--text); box-shadow: 0 50px 100px -30px rgba(0, 0, 0, .55); overflow: auto;
}
.affil-dialog::backdrop { background: rgba(11, 26, 43, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.affil-dialog[open] { animation: dlgIn .45s var(--ease); }
.affil-dialog[open]::backdrop { animation: fadeIn .35s ease; }
@keyframes dlgIn { from { opacity: 0; transform: translateY(24px) scale(.97); } }
@keyframes fadeIn { from { opacity: 0; } }
.dlg-inner { padding: clamp(1.5rem, 4vw, 2.5rem); position: relative; }
.dlg-inner h3 { font-size: clamp(1.5rem, 3.5vw, 2rem); margin: .5rem 2.5rem .6rem 0; }
.dlg-close {
  position: absolute; top: 1rem; right: 1rem; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); transition: background .3s, transform .3s var(--ease);
}
.dlg-close:hover { background: var(--paper-2); transform: rotate(90deg); }
.dlg-designation { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; color: var(--muted); margin: 0 0 1.6rem; }
.dlg-designation .affil-badge { margin: 0; }
.dlg-summary { display: flex; align-items: center; gap: 1rem; background: var(--ink); color: #fff; border-radius: 16px; padding: 1rem 1.3rem; margin-bottom: 1.6rem; }
.dlg-summary strong { font: 500 2.6rem/1 var(--serif); color: var(--teal-bright); }
.dlg-summary span { font-size: .92rem; color: var(--muted-dark); line-height: 1.45; }
.exam-stage { border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1.2rem; margin-bottom: .9rem; }
.affil-dialog[open] .exam-stage { animation: panelIn .55s var(--ease) both; animation-delay: calc(120ms + var(--i) * 90ms); }
.exam-stage header { display: flex; align-items: center; gap: .8rem; margin-bottom: .7rem; }
.stage-code { font: 700 .8rem var(--sans); color: #fff; background: var(--teal); border-radius: 8px; padding: .3rem .55rem; }
.exam-stage h4 { font-size: 1.15rem; color: var(--ink); flex: 1; }
.stage-count { font-size: .78rem; font-weight: 700; color: var(--teal); background: rgba(28, 138, 154, .1); border-radius: 999px; padding: .2rem .6rem; }
.exam-stage ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.exam-stage li { display: grid; grid-template-columns: 22px 54px 1fr; align-items: baseline; gap: .4rem; padding: .45rem 0; border-top: 1px dashed var(--line); font-size: .95rem; }
.exam-stage li:first-child { border-top: 0; }
.tick { color: #16A34A; font-weight: 700; }
.exam-code { font-weight: 700; color: var(--teal); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .affil-dialog { width: 100%; max-width: 100%; max-height: 90vh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
  @keyframes dlgIn { from { opacity: 0; transform: translateY(60px); } }
}

.research { background: #fff; border-radius: 26px; padding: clamp(1.5rem, 4vw, 3.2rem); box-shadow: 0 40px 80px -50px rgba(11, 26, 43, .45); border: 1px solid var(--line); }
.badge { display: inline-block; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--teal); background: rgba(28, 138, 154, .1); padding: .35rem .8rem; border-radius: 999px; }
.research-head h3 { font-size: clamp(1.6rem, 3.2vw, 2.5rem); margin: 1rem 0 .6rem; max-width: 26ch; }
.research-sup { color: var(--muted); margin: 0; }
.research-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 2.2rem 0; }
.research-stats div { border-top: 2px solid var(--teal); padding-top: .9rem; display: grid; gap: .3rem; align-content: start; }
.research-stats strong { font: 500 2rem/1 var(--serif); color: var(--ink); }
.research-stats span { font-size: .84rem; color: var(--muted); line-height: 1.45; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 1.8rem; }
.tab { background: none; border: 0; padding: .8rem 1.1rem; font: 600 .95rem var(--sans); color: var(--muted); cursor: pointer; position: relative; }
.tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--teal); transform: scaleX(0); transition: transform .35s var(--ease); }
.tab.active { color: var(--ink); }
.tab.active::after { transform: scaleX(1); }
.tab-panel.active { animation: panelIn .5s var(--ease); }
.tab-panel > p { font-size: 1.05rem; color: #2A3744; max-width: 75ch; }
.callout { background: var(--paper-2); border-left: 3px solid var(--teal); border-radius: 10px; padding: 1rem 1.2rem; color: var(--ink); }
.steps { margin: 0; padding-left: 1.3rem; display: grid; gap: .9rem; color: #2A3744; max-width: 80ch; }
.steps li::marker { color: var(--teal); font-weight: 700; }
.findings { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.4rem; }
.finding { border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem 1.3rem; transition: border-color .3s, transform .3s var(--ease); }
.finding:hover { border-color: var(--teal); transform: translateY(-3px); }
.finding h4 { font-size: 1.15rem; margin-bottom: .45rem; color: var(--ink); }
.finding p { margin: 0; font-size: .94rem; color: var(--muted); }
.research-keys { margin-top: 2rem; }

/* ---------- Projects ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.2rem; }
.project-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.8rem; display: flex; flex-direction: column; gap: .2rem; transition: transform .4s var(--ease), box-shadow .4s; }
.project-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.project-card h3 { font-size: 1.45rem; margin: 1rem 0 .3rem; }
.project-card > p { color: #2A3744; margin: .4rem 0 1rem; font-size: .96rem; }
.project-client { color: var(--teal) !important; font-weight: 600; font-size: .88rem !important; margin: 0 !important; }
.project-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.project-period { font-size: .8rem; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: .45rem; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .3rem .75rem; border-radius: 999px; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-live { color: #B45309; background: #FEF3C7; }
.status-live i { animation: blink 1.4s ease-in-out infinite; }
.status-done { color: #1D4ED8; background: #DBEAFE; }
.project-link { margin-top: auto; padding-top: 1rem; color: var(--teal); font-weight: 600; text-decoration: none; }
.project-soon { border-style: dashed; background: transparent; align-items: center; justify-content: center; text-align: center; color: var(--muted); min-height: 260px; }
.project-soon h3 { color: var(--muted); margin-top: .8rem; }
.project-soon p { color: var(--muted) !important; }
.soon-icon { width: 54px; height: 54px; border-radius: 50%; border: 1px dashed var(--muted); display: grid; place-items: center; font-size: 1.6rem; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; }
.contact-title { font-size: clamp(3rem, 9vw, 7rem); margin-bottom: 1.2rem; }
.contact-links { display: grid; border-top: 1px solid var(--line-dark); }
.contact-row {
  display: grid; grid-template-columns: 90px 1fr auto; gap: 1rem; align-items: center; padding: 1.25rem .4rem;
  border: 0; border-bottom: 1px solid var(--line-dark); background: none; color: #fff; text-decoration: none;
  font: inherit; text-align: left; cursor: pointer; transition: padding .35s var(--ease), background .35s;
}
.contact-row:hover { padding-left: 1rem; background: rgba(255, 255, 255, .04); }
.contact-k { font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-dark); }
.contact-v { font-size: 1.08rem; overflow-wrap: anywhere; }
.arrow { color: var(--teal-bright); font-size: 1.2rem; transition: transform .35s var(--ease); }
.contact-row:hover .arrow { transform: translate(3px, -3px); }

/* ---------- Footer ---------- */
.footer { background: var(--ink); color: var(--muted-dark); border-top: 1px solid var(--line-dark); padding: 3rem 0; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }
.footer-inner p { margin: 0; font-size: .88rem; }
.footer-line { font: 500 1.4rem var(--serif) !important; color: #fff; }
.footer-line em { color: var(--teal-bright); }
.back-top { color: var(--teal-bright); text-decoration: none; font-size: .9rem; }

/* ---------- Scroll reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: var(--d, 0ms); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: 3.5rem; }
  .hero-visual { order: -1; }
  .portrait-wrap { width: min(340px, 78vw); }
  .float-top { right: -8%; }
  .float-bottom { left: -8%; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .about-grid > div:first-child { position: static; }
  .impact-grid { grid-template-columns: repeat(2, 1fr); }
  .edu-grid, .research-stats { grid-template-columns: repeat(2, 1fr); }
  .career { grid-template-columns: 1fr; }
  .career-list { position: static; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); overflow-x: auto; border-left: 0; border-bottom: 2px solid var(--line); scroll-snap-type: x mandatory; }
  .career-tab { margin: 0 0 -2px; border-left: 0; border-bottom: 2px solid transparent; scroll-snap-align: start; }
  .career-tab.active { border-bottom-color: var(--teal); }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav-links, .nav-cta { display: none; }
  .nav-toggle { display: block; }
  .hero { padding-top: 100px; }
  .float-card { font-size: .74rem; padding: .65rem .8rem; }
  .float-top { display: none; }
  .float-bottom { bottom: -8%; left: -4%; width: 215px; }
  .float-bottom .mini-row:nth-child(3) { display: none; }
  .findings, .edu-grid { grid-template-columns: 1fr; }
  .impact-card { padding: 1.4rem 1.1rem; }
  .impact-value { font-size: 1.9rem; margin-bottom: .6rem; }
  .impact-card p { font-size: .84rem; }
  .impact-org { font-size: .65rem; }
  .research-stats { grid-template-columns: 1fr 1fr; }
  .facts div { grid-template-columns: 90px 1fr; }
  .contact-row { grid-template-columns: 70px 1fr auto; }
  .scroll-cue { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ==========================================================================
   Project pages: Credit Risk ML Platform (/projects/credit-risk/...)
   ========================================================================== */
.project-hero { position: relative; overflow: hidden; background: var(--ink); color: #fff; padding: 132px 0 64px; }
.project-hero .container { position: relative; }
.crumb { color: var(--muted-dark); text-decoration: none; font-size: .9rem; transition: color .3s; }
.crumb:hover { color: var(--teal-bright); }
.project-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 1.6rem 0 1.1rem; }
.tag-label { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .3rem .75rem;
  border-radius: 999px; color: var(--teal-bright); background: rgba(56, 195, 207, .12); border: 1px solid rgba(56, 195, 207, .3); }
.tag-period { font-size: .85rem; color: var(--muted-dark); }
.project-hero h1 { font-size: clamp(2.5rem, 6.5vw, 4.6rem); margin-bottom: 1.1rem; }
.project-hero .lead { color: var(--muted-dark); max-width: 62ch; font-size: 1.12rem; margin: 0 0 2.2rem; }
.dash-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 0 0 2.2rem;
  background: var(--line-dark); border: 1px solid var(--line-dark); border-radius: var(--radius); overflow: hidden; max-width: 880px; }
.dash-stats div { background: var(--ink-2); padding: 1.1rem 1.3rem; }
.dash-stats dt { font-size: .78rem; color: var(--muted-dark); }
.dash-stats dd { margin: .2rem 0 0; font: 500 clamp(1.6rem, 3vw, 2.2rem)/1.1 var(--serif); color: var(--teal-bright); }
.dash-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: 1.6rem; }
.chips-dark .chip { background: rgba(255, 255, 255, .06); color: #D6E0EA; border-color: var(--line-dark); }

.dash-body { padding: 44px 0 96px; }
.dash-tabs { position: relative; display: flex; gap: .4rem; padding: .4rem; margin-bottom: 2rem; overflow-x: auto; scrollbar-width: none;
  background: #fff; border: 1px solid var(--line); border-radius: 999px; width: fit-content; max-width: 100%; }
.dash-tabs::-webkit-scrollbar { display: none; }
.dash-tabs a { flex: none; padding: .55rem 1.1rem; border-radius: 999px; font-size: .92rem; font-weight: 500;
  color: var(--muted); text-decoration: none; white-space: nowrap; transition: background .3s, color .3s; }
.dash-tabs a:hover { color: var(--teal); background: rgba(28, 138, 154, .08); }
.dash-tabs a[aria-current="page"] { background: var(--ink); color: #fff; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; margin-bottom: 1.2rem; }
.dash-head h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
.dash-head p { color: var(--muted); margin: .4rem 0 0; max-width: 70ch; }
.dash-head .project-link { margin: 0; padding: 0; white-space: nowrap; }
.dash-frame { height: max(720px, calc(100vh - 110px)); background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.dash-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.dash-note { color: var(--muted); font-size: .86rem; margin: 1rem 0 0; max-width: 90ch; }
.dash-pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.dash-pager a { text-decoration: none; color: var(--ink); font: 500 1.2rem var(--serif); transition: color .3s; }
.dash-pager a:hover { color: var(--teal); }
.dash-pager a span { display: block; font: 600 .72rem var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-bottom: .2rem; }
.dash-pager .next { text-align: right; }

@media (max-width: 760px) {
  .project-hero { padding: 104px 0 48px; }
  .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-head { flex-direction: column; align-items: flex-start; }
  .dash-frame { height: max(600px, 80vh); }
}

/* Project pages: page description and guide tables */
.dash-about { max-width: 80ch; margin: 0 0 1.6rem; }
.dash-about p { margin: 0 0 .8rem; color: #2A3744; }
.dash-about .dash-about-label { font-size: .75rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--teal); margin-bottom: .5rem; }
.dash-guide { margin-top: 3rem; }
.dash-guide h3 { font-size: clamp(1.4rem, 2.6vw, 1.8rem); margin: 2.4rem 0 1rem; }
.dash-guide h3:first-child { margin-top: 0; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.guide-table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: .92rem; line-height: 1.55; }
.guide-table thead th { text-align: left; font: 600 .72rem var(--sans); letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); background: var(--paper-2); padding: .85rem 1.1rem; }
.guide-table td, .guide-table tbody th { padding: .95rem 1.1rem; vertical-align: top; border-top: 1px solid var(--line); text-align: left; }
.guide-table tbody th { width: 22%; font-weight: 600; color: var(--ink); }
.guide-table td { color: #2A3744; }
.guide-table td:nth-child(2) { width: 33%; }
.guide-table tbody tr:hover { background: rgba(28, 138, 154, .04); }
.guide-empty { color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin: 0; }
@media (max-width: 760px) {
  /* Guide tables become one card per row, so no column is hidden off-screen. */
  .table-wrap { overflow: visible; background: transparent; border: 0; }
  .guide-table { min-width: 0; }
  .guide-table thead { display: none; }
  .guide-table, .guide-table tbody, .guide-table tr, .guide-table tbody th, .guide-table td { display: block; width: auto !important; }
  .guide-table tr { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: .4rem 0; margin-bottom: .8rem; }
  .guide-table tbody th, .guide-table td { border-top: 0; padding: .45rem 1rem; }
  .guide-table tbody th { font-size: 1rem; }
  .guide-table td::before { content: attr(data-label); display: block; font: 600 .68rem var(--sans); letter-spacing: .14em;
    text-transform: uppercase; color: var(--teal); margin-bottom: .15rem; }
}

/* Project pages: extra sections (Overview: synthetic data, real-data results) */
.dash-section { margin-top: 3rem; max-width: 100%; }
.dash-section h3 { font-size: clamp(1.4rem, 2.6vw, 1.8rem); margin: 0 0 .8rem; }
.dash-section > p { color: #2A3744; max-width: 80ch; margin: 0 0 .8rem; }
.dash-section .table-wrap { margin-top: 1rem; }
.dash-caption { color: var(--muted) !important; font-size: .88rem; margin-top: .8rem !important; }
.table-numbers td { font-variant-numeric: tabular-nums; width: auto !important; }
.table-numbers tbody th { width: 28%; }
