/* =====================================================================
   Academic theme — index.html and blog.html
   (admin.html keeps using style.css)
   ===================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #fbfaf6;
  --bg-soft: #f3f1ea;
  --surface: #ffffff;
  --surface-2: #f7f5ef;
  --text: #1a1f29;
  --text-2: #444c5c;
  --muted: #6b7384;
  --border: #e5e1d6;
  --border-strong: #d3cdbd;
  --accent: #1d3d6e;          /* deep navy */
  --accent-hover: #142c52;
  --accent-soft: rgba(29, 61, 110, 0.07);
  --accent-ring: rgba(29, 61, 110, 0.22);
  --gold: #a87a1c;            /* brand continuity, used sparingly */
  --gold-soft: rgba(168, 122, 28, 0.12);
  --success: #1f7a4d;
  --success-soft: rgba(31, 122, 77, 0.1);
  --warn: #9a5b00;
  --warn-soft: rgba(154, 91, 0, 0.1);
  --shadow-sm: 0 1px 2px rgba(20, 24, 33, 0.05);
  --shadow-md: 0 6px 24px rgba(20, 24, 33, 0.07);
  --shadow-lg: 0 16px 48px rgba(20, 24, 33, 0.10);
  --nav-bg: rgba(251, 250, 246, 0.82);
  --blob-1: rgba(70, 120, 205, 0.13);
  --blob-2: rgba(205, 155, 60, 0.12);

  --serif: 'Source Serif 4', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218;
    --bg-soft: #141821;
    --surface: #161b24;
    --surface-2: #1b212c;
    --text: #e8eaef;
    --text-2: #b6bdca;
    --muted: #8b94a5;
    --border: #262d3a;
    --border-strong: #343d4e;
    --accent: #8fb4ff;
    --accent-hover: #b3ccff;
    --accent-soft: rgba(143, 180, 255, 0.09);
    --accent-ring: rgba(143, 180, 255, 0.28);
    --gold: #e0b45a;
    --gold-soft: rgba(224, 180, 90, 0.13);
    --success: #5fd39b;
    --success-soft: rgba(95, 211, 155, 0.12);
    --warn: #f0b35a;
    --warn-soft: rgba(240, 179, 90, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
    --nav-bg: rgba(15, 18, 24, 0.8);
    --blob-1: rgba(143, 180, 255, 0.10);
    --blob-2: rgba(224, 180, 90, 0.07);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1218;
  --bg-soft: #141821;
  --surface: #161b24;
  --surface-2: #1b212c;
  --text: #e8eaef;
  --text-2: #b6bdca;
  --muted: #8b94a5;
  --border: #262d3a;
  --border-strong: #343d4e;
  --accent: #8fb4ff;
  --accent-hover: #b3ccff;
  --accent-soft: rgba(143, 180, 255, 0.09);
  --accent-ring: rgba(143, 180, 255, 0.28);
  --gold: #e0b45a;
  --gold-soft: rgba(224, 180, 90, 0.13);
  --success: #5fd39b;
  --success-soft: rgba(95, 211, 155, 0.12);
  --warn: #f0b35a;
  --warn-soft: rgba(240, 179, 90, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
  --nav-bg: rgba(15, 18, 24, 0.8);
  --blob-1: rgba(143, 180, 255, 0.10);
  --blob-2: rgba(224, 180, 90, 0.07);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
html.theme-anim body, html.theme-anim body * {
  transition: background-color .45s var(--ease), border-color .45s var(--ease), color .3s var(--ease) !important;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent-ring); }
h1, h2, h3, h4 { font-family: var(--serif); color: var(--text); line-height: 1.25; font-weight: 600; }
p { color: var(--text-2); text-wrap: pretty; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.skip-link { position: absolute; left: 16px; top: -48px; background: var(--accent); color: var(--bg); padding: 8px 14px; border-radius: 6px; z-index: 300; }
.skip-link:focus { top: 12px; color: var(--bg); }

/* ---------- Reading progress ---------- */
.progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 100%;
  transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), var(--gold));
  z-index: 200; pointer-events: none;
}

/* ---------- Navbar ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.nav.scrolled { border-bottom-color: var(--border); box-shadow: var(--shadow-sm); }
.nav-inner {
  max-width: 1200px; height: 100%; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--text); white-space: nowrap; }
.brand:hover { color: var(--accent); text-decoration: none; }
.brand span { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 2px; list-style: none; }
.nav-links a {
  position: relative; display: block; padding: 8px 11px;
  font-size: 0.875rem; font-weight: 500; color: var(--text-2); border-radius: 8px;
}
.nav-links a:hover { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.nav-links a::after {
  content: ''; position: absolute; left: 11px; right: 11px; bottom: 3px; height: 2px;
  background: var(--accent); border-radius: 2px;
  transform: scaleX(0); transition: transform .35s var(--ease);
}
.nav-links a.active { color: var(--accent); }
.nav-links a.active::after { transform: scaleX(1); }
.nav-tools { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text-2); cursor: pointer; transition: border-color .2s, color .2s, transform .2s var(--ease);
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent-ring); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
.nav-toggle { display: none; }
.nav-toggle span { display: block; width: 16px; height: 2px; background: currentColor; border-radius: 2px; transition: transform .3s var(--ease), opacity .2s; }
.nav-toggle span + span { margin-top: 3px; }
.nav-toggle .bars { display: block; }
.nav-toggle.open span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* ---------- Page layout ---------- */
.page {
  position: relative;
  max-width: 1200px; margin: 0 auto; padding: 48px 24px 80px;
  display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 64px;
}
.backdrop { position: absolute; top: 0; left: 0; right: 0; height: 760px; overflow: hidden; pointer-events: none; z-index: 0;
  -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 1; }
.blob-1 { width: 520px; height: 520px; background: var(--blob-1); top: -120px; right: 4%; animation: drift1 22s ease-in-out infinite alternate; }
.blob-2 { width: 420px; height: 420px; background: var(--blob-2); top: 160px; left: 2%; animation: drift2 26s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(-90px, 70px) scale(1.12); } }
@keyframes drift2 { to { transform: translate(110px, -40px) scale(0.92); } }
.page, .blog-page, .footer { position: relative; z-index: 1; }

/* ---------- Sidebar (profile) ---------- */
.profile { position: sticky; top: calc(var(--nav-h) + 32px); align-self: start; }
.avatar-wrap { position: relative; width: 196px; height: 196px; margin-bottom: 24px; }
.avatar-wrap::before {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), var(--gold), var(--accent-ring), var(--accent));
  animation: spin 14s linear infinite;
}
.avatar-wrap::after { content: ''; position: absolute; inset: -2px; border-radius: 50%; background: var(--bg); }
@keyframes spin { to { transform: rotate(1turn); } }
.avatar {
  position: relative; z-index: 1; width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  animation: avatarIn 1s var(--ease) both;
}
@keyframes avatarIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
.profile h1 { font-size: 1.75rem; letter-spacing: -0.01em; margin-bottom: 6px; }
.profile .role { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.profile .affil { font-size: 0.9rem; color: var(--text-2); line-height: 1.55; margin-top: 2px; }
.profile .loc { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); margin-top: 10px; }
.profile .loc svg { width: 14px; height: 14px; }
.profile-links { list-style: none; margin: 20px 0 0; display: grid; gap: 2px; }
.profile-links a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin: 0 -10px;
  font-size: 0.9rem; color: var(--text-2); border-radius: 8px;
  transition: background .2s, color .2s, transform .25s var(--ease);
}
.profile-links a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; transform: translateX(3px); }
.profile-links svg { width: 17px; height: 17px; flex: none; color: var(--muted); transition: color .2s; }
.profile-links a:hover svg { color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.stat { text-align: left; }
.stat-num { font-family: var(--serif); font-size: 1.6rem; font-weight: 600; color: var(--accent); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; margin-top: 4px; line-height: 1.3; }

/* ---------- Main column ---------- */
.main { min-width: 0; }
.intro { padding: 8px 0 8px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold);
}
.eyebrow::before { content: ''; width: 22px; height: 2px; background: currentColor; border-radius: 2px; }
.lead {
  font-family: var(--serif); font-size: clamp(1.6rem, 3.2vw, 2.35rem); line-height: 1.3; font-weight: 500;
  color: var(--text); margin-top: 14px; letter-spacing: -0.01em;
}
.rotator { display: inline-grid; vertical-align: bottom; color: var(--accent); font-style: italic; }
.rotator > span { grid-area: 1 / 1; white-space: nowrap; transition: opacity .55s var(--ease), transform .55s var(--ease); }
.rotator > span:not(.on) { opacity: 0; transform: translateY(0.4em); }
.rotator > span.out { opacity: 0; transform: translateY(-0.4em); }

.section { padding-top: 64px; }
.section-title {
  display: flex; align-items: baseline; gap: 14px;
  font-size: 1.6rem; margin-bottom: 24px; letter-spacing: -0.01em;
}
.section-title .num { font-family: var(--mono); font-size: 0.8rem; font-weight: 500; color: var(--gold); }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); align-self: center; transform-origin: left; transform: scaleX(var(--rule, 1)); transition: transform 1.1s var(--ease) .15s; }
.reveal.section-title::after { --rule: 0; }
.reveal.in.section-title::after { --rule: 1; }

.about p { font-size: 1.04rem; margin-bottom: 14px; }
.about p:last-child { margin-bottom: 0; }

/* Interests */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chip {
  font-size: 0.83rem; font-weight: 500; color: var(--accent);
  background: var(--accent-soft); border: 1px solid var(--accent-ring);
  padding: 5px 12px; border-radius: 999px;
  transition: transform .25s var(--ease), background .2s;
}
.chip:hover { transform: translateY(-2px); background: var(--surface); }

/* Featured publication */
.featured {
  position: relative; margin-top: 36px; padding: 1px; border-radius: calc(var(--radius) + 2px);
  background: linear-gradient(120deg, var(--accent-ring), var(--gold-soft), var(--accent-ring));
  background-size: 220% 220%; animation: sheen 9s ease-in-out infinite alternate;
}
@keyframes sheen { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
.featured-inner { background: var(--surface); border-radius: var(--radius); padding: 24px 26px; box-shadow: var(--shadow-md); }
.featured-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--success);
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 var(--success); animation: pulse 2.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--success-soft); } 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.featured h3 { font-size: 1.28rem; margin: 10px 0 8px; }
.featured h3 a { color: var(--text); }
.featured h3 a:hover { color: var(--accent); }
.featured .summary { font-size: 0.95rem; margin-top: 10px; }

/* News */
.news { list-style: none; position: relative; }
.news li { display: grid; grid-template-columns: 92px 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.news li:last-child { border-bottom: none; }
.news-date { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); padding-top: 3px; white-space: nowrap; }
.news-text { color: var(--text-2); font-size: 0.97rem; }
.news li.is-highlight .news-date { color: var(--accent); font-weight: 500; }
.news-more { margin-top: 10px; background: none; border: none; color: var(--accent); font: inherit; font-size: 0.9rem; cursor: pointer; padding: 4px 0; }
.news-more:hover { text-decoration: underline; }
.news li.hidden-item { display: none; }

/* Publications */
.pub-year { font-family: var(--serif); font-size: 1.05rem; color: var(--muted); font-weight: 600; margin: 28px 0 8px; display: flex; align-items: center; gap: 12px; }
.pub-year:first-of-type { margin-top: 0; }
.pub-year::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.pubs { list-style: none; }
.pub {
  display: grid; grid-template-columns: 40px 1fr; gap: 10px;
  padding: 16px 16px 16px 10px; margin: 0 -16px 0 -10px; border-radius: var(--radius);
  transition: background .25s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease);
}
.pub:hover { background: var(--surface); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.pub-num { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); padding-top: 3px; text-align: right; }
.pub-title { font-family: var(--serif); font-size: 1.08rem; font-weight: 600; color: var(--text); line-height: 1.4; }
.pub-title a { color: inherit; }
.pub-title a:hover { color: var(--accent); }
.pub-authors { font-size: 0.92rem; color: var(--text-2); margin-top: 4px; }
.pub-authors .me { color: var(--text); font-weight: 700; }
.pub-authors .me sup { color: var(--gold); font-weight: 700; }
.pub-venue { font-size: 0.92rem; color: var(--muted); font-style: italic; margin-top: 2px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.badge {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border-strong); color: var(--text-2);
}
.badge.journal { color: var(--accent); border-color: var(--accent-ring); background: var(--accent-soft); }
.badge.oa { color: var(--success); border-color: transparent; background: var(--success-soft); }
.badge.ca { color: var(--gold); border-color: transparent; background: var(--gold-soft); }
.badge.wip { color: var(--warn); border-color: transparent; background: var(--warn-soft); }
.pub-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8rem; font-weight: 600; font-family: var(--sans);
  padding: 5px 11px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-2); cursor: pointer;
  transition: color .2s, border-color .2s, background .2s, transform .2s var(--ease);
}
.pill:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.pill svg { width: 14px; height: 14px; }
.pill[aria-expanded="true"] { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.bibtex { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .4s var(--ease); }
.bibtex.open { grid-template-rows: 1fr; }
.bibtex > div { overflow: hidden; }
.bibtex pre {
  position: relative; margin-top: 10px; padding: 14px 52px 14px 16px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 0.78rem; line-height: 1.6; color: var(--text-2);
  white-space: pre-wrap; word-break: break-word;
}
.copy-btn { position: absolute; top: 8px; right: 8px; }
.footnote { font-size: 0.82rem; color: var(--muted); margin-top: 18px; }
.footnote sup { color: var(--gold); font-weight: 700; }
.subhead { font-family: var(--sans); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 32px 0 6px; }

/* Timeline (experience, research, education) */
.timeline { position: relative; list-style: none; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(var(--accent-ring), var(--border));
  transform-origin: top; transform: scaleY(var(--line, 1)); transition: transform 1.4s var(--ease);
}
.timeline.reveal { --line: 0; opacity: 1; transform: none; }
.timeline.reveal.in { --line: 1; }
.tl-item { position: relative; padding-bottom: 28px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: -27px; top: 8px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent); transition: transform .3s var(--ease), background .3s;
}
.tl-item:hover::before { transform: scale(1.25); background: var(--accent); }
.tl-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; }
.tl-item h3 { font-size: 1.12rem; }
.tl-date { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.tl-org { font-size: 0.95rem; color: var(--text-2); font-weight: 500; margin-top: 2px; }
.tl-detail { font-size: 0.94rem; margin-top: 8px; }
.tl-list { margin: 8px 0 0 18px; color: var(--text-2); font-size: 0.94rem; }
.tl-list li { margin-bottom: 4px; }
.tl-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tl-tags span { font-size: 0.75rem; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.kv { list-style: none; margin-top: 6px; font-size: 0.94rem; }
.kv li { color: var(--text-2); }
.kv b { color: var(--text); font-weight: 600; }

/* Projects */
.projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.project {
  display: flex; flex-direction: column; padding: 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
}
.project:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent-ring); }
.project h3 { font-size: 1.08rem; margin-bottom: 8px; }
.project p { font-size: 0.92rem; flex: 1; }
.project .project-link { margin-top: 14px; font-size: 0.88rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.project .project-link span { transition: transform .25s var(--ease); }
.project .project-link:hover span { transform: translateX(4px); }
.project-images { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 6px; margin: -6px -6px 14px; }
.project-images img { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; }

/* Awards */
.awards { list-style: none; }
.award { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.award:last-child { border-bottom: none; }
.award-year { font-family: var(--mono); font-size: 0.82rem; color: var(--gold); padding-top: 2px; }
.award-name { font-weight: 600; color: var(--text); font-size: 0.97rem; }
.award-detail { font-size: 0.88rem; color: var(--muted); }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.skill { padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.skill h3 { font-family: var(--sans); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.skill ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }
.skill li { font-size: 0.85rem; padding: 3px 10px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

/* Contact */
.contact-card {
  padding: 28px; border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--surface);
}
.contact-card p { margin-bottom: 16px; }
.contact-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 0.92rem;
  border: 1px solid var(--accent); transition: transform .2s var(--ease), background .2s, color .2s, box-shadow .2s;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--surface); }
.btn-primary:hover { background: var(--accent-hover); color: var(--surface); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 28px 24px; text-align: center; font-size: 0.85rem; color: var(--muted); }
.footer p { color: var(--muted); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 0.88rem;
  transition: opacity .3s, transform .3s var(--ease); pointer-events: none; z-index: 300;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Blog ---------- */
.blog-page { max-width: 880px; margin: 0 auto; padding: 56px 24px 80px; position: relative; }
.blog-head h1 { font-size: clamp(2rem, 4vw, 2.6rem); margin-top: 12px; }
.blog-head p { margin-top: 8px; font-size: 1.05rem; }
.blog-grid { display: grid; gap: 16px; margin-top: 36px; }
.blog-card {
  padding: 24px 26px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
}
.blog-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent-ring); }
.blog-card-header { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.blog-card-date { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.blog-card-category { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); background: var(--gold-soft); padding: 2px 8px; border-radius: 6px; }
.blog-card h2 { font-size: 1.3rem; margin-bottom: 6px; }
.blog-excerpt { font-size: 0.95rem; }
.read-more { display: inline-flex; gap: 6px; margin-top: 12px; font-size: 0.88rem; font-weight: 600; color: var(--accent); transition: gap .25s var(--ease); }
.blog-card:hover .read-more { gap: 10px; }
.blog-empty { text-align: center; padding: 48px 0; }
.modal-overlay {
  position: fixed; inset: 0; z-index: 250; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(10, 12, 18, 0.55); backdrop-filter: blur(4px);
  animation: fadeIn .25s ease;
}
.modal-content {
  position: relative; width: 100%; max-width: 720px; max-height: 86vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 36px;
  box-shadow: var(--shadow-lg); animation: rise .4s var(--ease);
}
.modal-close { position: absolute; top: 14px; right: 14px; }
.modal-date { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.modal-content h2 { font-size: 1.7rem; margin: 6px 0 16px; padding-right: 36px; }
.modal-body { color: var(--text-2); line-height: 1.8; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(0.98); } }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .nav-links a { padding: 8px 8px; font-size: 0.84rem; }
  .nav-links a::after { left: 8px; right: 8px; }
}
@media (max-width: 960px) {
  .nav-toggle { display: inline-grid; }
  .nav-links {
    position: absolute; top: var(--nav-h); left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md);
    padding: 8px 16px 14px; transform-origin: top; transform: scaleY(0.96); opacity: 0; pointer-events: none;
    transition: opacity .25s var(--ease), transform .25s var(--ease);
  }
  .nav-links.open { opacity: 1; transform: none; pointer-events: auto; }
  .nav-links a { padding: 11px 8px; font-size: 0.95rem; }
  .nav-links a::after { display: none; }
  .nav-links a.active { background: var(--accent-soft); }
  .page { grid-template-columns: 1fr; gap: 8px; padding-top: 32px; }
  .profile { position: static; display: grid; grid-template-columns: auto 1fr; gap: 0 24px; align-items: center; }
  .avatar-wrap { width: 128px; height: 128px; margin-bottom: 0; grid-row: span 4; }
  .profile-links { grid-column: 1 / -1; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 20px; }
  .profile-links a { margin: 0; }
  .stats { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .nav-inner { padding: 0 16px; }
  .page { padding: 24px 16px 56px; }
  .blog-page { padding: 36px 16px 56px; }
  .profile { grid-template-columns: 1fr; }
  .avatar-wrap { width: 120px; height: 120px; grid-row: auto; margin-bottom: 18px; }
  .profile h1 { font-size: 1.55rem; }
  .profile-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section { padding-top: 48px; }
  .section-title { font-size: 1.4rem; }
  .news li { grid-template-columns: 1fr; gap: 2px; }
  .pub { grid-template-columns: 1fr; gap: 2px; margin: 0 -8px; padding: 14px 8px; }
  .pub-num { text-align: left; }
  .projects, .skills { grid-template-columns: 1fr; }
  .featured-inner { padding: 20px; }
  .modal-content { padding: 26px 20px; }
  .award { grid-template-columns: 48px 1fr; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .reveal { opacity: 1; transform: none; }
  .blob { display: none; }
}

/* ---------- Print (CV-friendly) ---------- */
@media print {
  .nav, .progress, .backdrop, .pub-actions, .theme-toggle, .news-more, .contact-row { display: none !important; }
  .page { display: block; padding: 0; }
  .profile { position: static; }
  .reveal { opacity: 1 !important; transform: none !important; }
  body { background: #fff; color: #000; }
}
