/* ---------- tokens ---------- */
/* Navy & gold: institutional, confident; gold marks metrics */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f6fb;
  --text: #0b1f3a;
  --muted: #44546a;
  --faint: #7a889c;
  --line: #e1e7f0;
  --accent: #0b3d91;
  --accent-2: #1d5fd1;
  --accent-soft: #eaf1fc;
  --accent-ink: #ffffff;
  --warm: #b8860b;
  --grid: transparent;
  --shadow: 0 1px 2px rgba(11, 31, 58, .05), 0 10px 28px -14px rgba(11, 31, 58, .25);
  --radius: 14px;
  --serif: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1424; --surface: #0f1d33; --surface-2: #13233d; --text: #e6edf7; --muted: #a3b1c6;
    --faint: #6f809a; --line: #1f3150; --accent: #7fb0ff; --accent-2: #a9c8ff; --accent-soft: #14284a;
    --accent-ink: #071222; --warm: #e0b44c; --grid: transparent;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -12px rgba(0,0,0,.6); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1424; --surface: #0f1d33; --surface-2: #13233d; --text: #e6edf7; --muted: #a3b1c6;
  --faint: #6f809a; --line: #1f3150; --accent: #7fb0ff; --accent-2: #a9c8ff; --accent-soft: #14284a;
  --accent-ink: #071222; --warm: #e0b44c; --grid: transparent;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -12px rgba(0,0,0,.6); color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  position: relative; margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}

a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
svg.fill { fill: currentColor; stroke: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
[hidden] { display: none !important; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { font: 600 19px var(--serif); color: var(--text); }
.brand b { font-weight: 700; color: var(--accent); }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  color: var(--muted); font-size: 14.5px; font-weight: 500; padding: 6px 12px; border-radius: 999px;
  transition: color .15s, background .15s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.topbar-actions { display: flex; gap: 6px; }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.menu-btn { display: none; }
@media (max-width: 860px) {
  .menu-btn { display: grid; }
  .nav {
    position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 16px;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 10px 12px; border-radius: 8px; }
  .topbar-actions { margin-left: auto; }
}

/* ---------- about: side card + intro ---------- */
.about {
  display: grid; grid-template-columns: 390px 1fr; gap: 36px; align-items: start;
  padding: 40px 0 8px;
}
.sidecard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 28px; box-shadow: var(--shadow);
}
.id { display: flex; flex-direction: column; gap: 16px; align-items: center; text-align: center; }
.id img { width: 184px; height: 184px; border-radius: 50%; object-fit: cover; border: 4px solid var(--surface); flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--accent), 0 12px 28px -10px rgba(55, 48, 163, .45); }
.id h1 { white-space: nowrap; font: 700 30px/1.1 var(--serif); letter-spacing: -.01em; }
.position { margin: 8px 0 0; font-size: 15px; line-height: 1.45; color: var(--muted); }
.email {
  display: block; margin: 20px 0 12px; padding-top: 16px; border-top: 1px solid var(--line);
  font: 500 15px var(--mono); word-break: break-all;
}
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-size: 14.5px; font-weight: 500;
}
.tag-btn:hover { text-decoration: none; filter: brightness(1.08); }
.tag-btn svg { width: 15px; height: 15px; }
.socials { list-style: none; display: flex; gap: 2px; margin: 10px 0 0 -8px; padding: 0; }
.socials a {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px;
  color: var(--muted); transition: color .15s, background .15s;
}
.socials a:hover { color: var(--accent); background: var(--accent-soft); }
.socials svg { width: 22px; height: 22px; }
.mini-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 12px;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.mini-stats div { display: flex; flex-direction: column; align-items: center; padding: 12px 4px; }
.mini-stats div + div { border-left: 1px solid var(--line); }
.mini-stats b { font: 700 24px/1.2 var(--serif); color: var(--accent); }
.mini-stats span { font-size: 13px; color: var(--faint); }

.side-title {
  font: 500 13px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--warm);
  margin: 26px 0 12px;
}
.exp { list-style: none; margin: 0; padding: 0; }
.exp > li { border-left: 3px solid var(--accent); padding: 3px 0 3px 14px; margin-bottom: 16px; }
.exp summary { list-style: none; cursor: pointer; }
.exp summary::-webkit-details-marker { display: none; }
.exp-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; color: var(--muted); }
.exp-row + .exp-row { margin-top: 3px; }
.exp-org { font-size: 17px; font-weight: 600; color: var(--text); }
.exp-where, .exp-date { color: var(--faint); white-space: nowrap; font-size: 13.5px; }
.exp summary:hover .exp-row:last-child > span:first-child { color: var(--accent); }
.exp summary .exp-row:last-child > span:first-child::after { content: ' ▸'; font-size: 10px; color: var(--faint); }
.exp details[open] summary .exp-row:last-child > span:first-child::after { content: ' ▾'; }
.exp details ul { margin: 8px 0 2px; padding-left: 18px; font-size: 14.5px; color: var(--muted); }
.exp details li { margin: 3px 0; }

.intro .lead { font-size: 19.5px; line-height: 1.6; margin: 0 0 14px; }
.lead strong { color: var(--accent); font-weight: 600; }
.bio { color: var(--muted); margin: 0 0 16px; }
.focus-list { margin: 0 0 22px; padding-left: 20px; }
.focus-list li { margin: 7px 0; font-size: 15px; }
.focus-list b { font-weight: 600; }
.venue-tag { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.callout {
  padding: 16px 20px; border-radius: 14px; text-align: center; font-size: 15px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 8%, transparent);
}
.news-block { margin-top: 32px; }
.block-title { font: 700 24px var(--serif); margin-bottom: 8px; display: flex; align-items: baseline; gap: 8px; }
.block-title .link-btn { margin: 0; font-size: 14px; }
.news li { font-size: 14.5px; }

@media (max-width: 900px) {
  .about { grid-template-columns: 1fr; gap: 28px; padding-top: 24px; }
}
@media (max-width: 400px) {
  .id img { width: 160px; height: 160px; }
  .id h1 { font-size: 26px; }
}

/* ---------- sections ---------- */
.section { padding: 64px 0 8px; opacity: 0; transform: translateY(14px); transition: opacity .6s, transform .6s; }
.section.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .section { opacity: 1; transform: none; transition: none; } }
.section-title {
  display: flex; align-items: baseline; gap: 14px; font: 700 30px var(--serif);
  letter-spacing: -.01em; margin-bottom: 28px;
}
.section-title span { font: 500 13px var(--mono); color: var(--warm); }
.sub-title { font: 700 20px var(--serif); margin: 40px 0 16px; }
.note { color: var(--faint); font-size: 14px; }
.link-btn {
  background: none; border: 0; padding: 0; margin-top: 12px; color: var(--accent);
  font: 500 14px var(--sans); cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* news */
.news { list-style: none; margin: 0; padding: 0; }
.news li {
  display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}
.news li:last-child { border-bottom: 0; }
.news time { font: 500 13px/1.9 var(--mono); color: var(--faint); }
@media (max-width: 520px) { .news li { grid-template-columns: 1fr; gap: 2px; } }

/* background */
.tl-meta { color: var(--faint); font-size: 14px; margin: 2px 0 8px; }
.beyond { margin-top: 20px; padding: 20px 22px; border: 1px dashed var(--line); border-radius: var(--radius); }
.beyond h3 { font-size: 16.5px; font-weight: 600; }
.beyond p:last-child { margin: 0; color: var(--muted); font-size: 15px; }
.edu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.edu { padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.edu h4 { font-size: 15.5px; font-weight: 600; margin-bottom: 6px; }
.edu p { margin: 0; font-size: 14px; color: var(--muted); }
@media (max-width: 760px) { .edu-grid { grid-template-columns: 1fr; } }

/* publications */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  padding: 6px 14px; border-radius: 999px; font: 500 13.5px var(--sans); cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pubs { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.pub {
  display: grid; grid-template-columns: 112px 1fr; gap: 20px; padding: 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.pub-badge {
  align-self: start; text-align: center; padding: 12px 8px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent); font: 500 11.5px/1.4 var(--mono);
  word-break: break-word;
}
.pub-badge b { font: 700 20px var(--serif); }
.pub h3 { font: 600 17.5px/1.4 var(--sans); margin-bottom: 6px; }
.authors { margin: 0; font-size: 14.5px; color: var(--muted); }
.authors b { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.venue { margin: 2px 0 12px; font-size: 14px; font-style: italic; color: var(--faint); }
.cites { font-style: normal; color: var(--warm); font-weight: 500; }
.pub-links { display: flex; flex-wrap: wrap; gap: 8px; }
.pub-links a, .abs-toggle {
  font: 500 12.5px var(--mono); padding: 4px 12px; border-radius: 6px;
  border: 1px solid var(--line); color: var(--text); background: transparent; cursor: pointer;
}
.pub-links a:hover, .abs-toggle:hover, .abs-toggle.on { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.abstract {
  margin: 14px 0 0; padding: 14px 16px; background: var(--surface-2); border-radius: 10px;
  font-size: 14.5px; color: var(--muted);
}
@media (max-width: 600px) {
  .pub { grid-template-columns: 1fr; gap: 12px; padding: 18px; }
  .pub-badge { justify-self: start; padding: 6px 12px; }
  .pub-badge br { display: none; }
  .pub-badge b { font-size: 14px; margin-left: 4px; }
}

/* cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 10px; padding: 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.card h3 { font-size: 17px; font-weight: 600; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.card .collab { margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13.5px; }
.tag { align-self: flex-start; font: 500 11.5px var(--mono); color: var(--warm); text-transform: uppercase; letter-spacing: .05em; }
@media (max-width: 900px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .cards { grid-template-columns: 1fr; } }

.repo { color: var(--text); }
.repo:hover { text-decoration: none; }
.repo p { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.repo h3 { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 15px; overflow-wrap: anywhere; }
.repo h3 svg { color: var(--muted); }
.repo-meta { margin-top: auto; display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--faint); }
.repo-meta span { display: inline-flex; align-items: center; gap: 5px; }
.repo-meta svg { width: 13px; height: 13px; }
.lang-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; }

/* skills */
.skills { margin: 0; display: grid; gap: 14px; }
.skills > div { display: grid; grid-template-columns: 170px 1fr; gap: 16px; align-items: baseline; }
.skills dt { font-weight: 600; font-size: 15px; }
.skills dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  font-size: 13px; padding: 3px 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
@media (max-width: 600px) { .skills > div { grid-template-columns: 1fr; gap: 6px; } }
.certs { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 10px; }
.certs li {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
.certs a { font-weight: 500; }
.certs span { font: 500 12.5px var(--mono); color: var(--faint); }

/* contact */
.contact {
  margin: 72px 0 24px; padding: 48px 32px; text-align: center; border-radius: 20px;
  background: var(--accent-soft); border: 1px solid var(--line);
}
.contact h2 { font: 700 32px var(--serif); margin-bottom: 10px; }
.contact p { color: var(--muted); max-width: 560px; margin: 0 auto 24px; }
.contact .btn { word-break: break-all; }

/* footer */
.footer { border-top: 1px solid var(--line); padding: 24px 0; color: var(--faint); font-size: 13.5px; }
.footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- academic theme accents ---------- */
.lead strong, .section-title span {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.section-title span { font-weight: 700; }
.section-title { letter-spacing: -.025em; }
.id h1, .contact h2, .block-title { letter-spacing: -.025em; }
.mini-stats b, .stat .num { color: var(--warm); }
.cites { color: var(--warm); }
.tag, .side-title { color: var(--accent-2); }
.sidecard { border-top: 3px solid var(--accent); }
.pub { border-left: 3px solid var(--accent); }
.pub-badge { background: var(--accent); color: var(--accent-ink); }
.pub-badge b { color: var(--accent-ink); }
.callout { text-align: left; border-left: 4px solid var(--accent); }
.contact {
  background: linear-gradient(135deg, #0b1f3a, #0b3d91); border: 0; color: #fff;
}
.contact p { color: rgba(255,255,255,.85); }
.contact .btn.primary { background: #fff; border-color: #fff; color: #0b3d91; }
:root[data-theme="dark"] .contact { background: linear-gradient(135deg, #0f2a55, #1d4ed8); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .contact { background: linear-gradient(135deg, #0f2a55, #1d4ed8); } }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 15px; transition: transform .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 8px 20px -8px rgba(0,0,0,.35); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.sidecard .link-btn { font-size: 15px; }
.location { display: flex; align-items: center; justify-content: center; gap: 5px; margin: 4px 0 0; font-size: 14px; color: var(--faint); }
.location svg { width: 15px; height: 15px; }
/* centre the contact block under the stacked portrait */
.sidecard .email { text-align: center; }
.sidecard .quick-links { justify-content: center; }
.sidecard .socials { justify-content: center; margin: 10px 0 0; }
/* marine-engineering roles: anchor marker + muted rail to set them apart from CS/AI work */
.exp > li.marine { border-left-color: var(--faint); }
.exp > li.marine .exp-org { color: var(--text); }
.exp > li.marine .exp-org::before { content: '⚓ '; }

/* Justify the intro paragraphs on wide screens (as on roydipta.com); phones stay left-aligned */
@media (min-width: 901px) {
  .intro .lead, .intro .bio { text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
}

/* certifications collapsed to one quiet line */
.certs li.cert-line { display: block; padding: 0; background: none; border: 0; font-size: 14.5px; color: var(--muted); }
.certs li.cert-line > span { font: 500 12.5px var(--mono); color: var(--faint); margin-right: 10px; }
.certs { margin-top: 20px; }
