/* ============================================================
   Design tokens — change colours and fonts here
   ============================================================ */
:root {
  /* Light theme (default) */
  --bg: #fbf8f3;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --border: #ebe4d8;
  --text: #1f1b2e;
  --text-muted: #6b6480;
  --accent: #6d4aff;
  --accent-hover: #5a38e6;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(109, 74, 255, 0.10);
  --accent-2: #ff6b7a;
  --success: #0f9d84;
  --warning: #d98b10;
  --error: #d2496a;
  --glow-1: rgba(109, 74, 255, 0.16);
  --glow-2: rgba(255, 107, 122, 0.14);
  --header-bg: rgba(251, 248, 243, 0.84);
  --shadow: 0 1px 2px rgba(31, 27, 46, 0.04), 0 12px 32px -16px rgba(31, 27, 46, 0.16);
  --gradient: linear-gradient(120deg, var(--accent), var(--accent-2));

  --font-body: "Inter", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --radius: 14px;
  --container: 1100px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Dark theme — toggled with the button in the nav */
[data-theme="dark"] {
  --bg: #0f0d17;
  --bg-elev: #16131f;
  --surface: #1b1826;
  --border: #2a2638;
  --text: #ede9f7;
  --text-muted: #9d97b3;
  --accent: #a48cff;
  --accent-hover: #b8a6ff;
  --accent-contrast: #0f0d17;
  --accent-soft: rgba(164, 140, 255, 0.14);
  --accent-2: #ff8a96;
  --success: #5fd4c0;
  --warning: #f2b84b;
  --error: #f28fad;
  --glow-1: rgba(164, 140, 255, 0.20);
  --glow-2: rgba(255, 138, 150, 0.12);
  --header-bg: rgba(15, 13, 23, 0.74);
  --shadow: none;
  --gradient: linear-gradient(120deg, var(--accent), var(--accent-2));
}


/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  transition: background 0.3s, color 0.3s;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); }
h2 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 0.85rem; font-family: var(--font-body); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { padding: 0; margin: 0; list-style: none; }
em { font-style: italic; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mono { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.02em; }
.muted { color: var(--text-muted); }
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.center { text-align: center; }

/* Soft gradient glow behind the hero */
.bg-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 50% at 20% 0%, var(--glow-1), transparent 70%),
    radial-gradient(40% 40% at 85% 10%, var(--glow-2), transparent 70%);
}

/* ============================================================
   Header / nav
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 12px; height: 12px; border-radius: 3px;
  background: var(--gradient);
}
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a { color: var(--text-muted); font-weight: 500; font-size: 0.95rem; transition: color 0.2s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); text-decoration: none; }
/* Theme toggle */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; transition: border-color 0.2s, transform 0.2s;
}
.theme-toggle:hover { border-color: var(--text-muted); transform: rotate(15deg); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
.nav-right { display: flex; align-items: center; gap: 12px; }

.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; transition: transform 0.3s; }

/* ============================================================
   Buttons, pills, tags
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-weight: 500; font-size: 0.95rem;
  transition: transform 0.25s var(--ease), background 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--text-muted); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-small { padding: 8px 16px; font-size: 0.875rem; }
.btn-block { width: 100%; margin-bottom: 10px; }
.pill {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 4px 10px; border-radius: 999px;
  color: var(--accent); background: var(--accent-soft);
}
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  font-size: 0.78rem; padding: 4px 11px; border-radius: 999px;
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text-muted);
}

/* ============================================================
   Hero
   ============================================================ */
.hero { padding: 96px 24px 64px; }
.eyebrow { color: var(--accent); margin-bottom: 18px; display: inline-block; }
.eyebrow::before { content: "// "; opacity: 0.6; }
.lead { font-size: 1.2rem; color: var(--text-muted); max-width: 580px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 32px 0 56px; }
.stats { display: flex; gap: 48px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 28px; }
.stats li { display: flex; flex-direction: column; }
.stats strong { font-family: var(--font-display); font-size: 2rem; font-weight: 500; line-height: 1; }
.stats span { color: var(--text-muted); font-size: 0.85rem; margin-top: 6px; }

/* ============================================================
   Sections
   ============================================================ */
.section { padding: 72px 24px; }
.section-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 36px; }
.section-head h2 { margin: 0; }
.section-num { color: var(--accent); }
.section-link { margin-left: auto; color: var(--text-muted); font-size: 0.9rem; }
.page-head { padding-top: 80px; padding-bottom: 24px; }
.page-head .tags { margin-top: 18px; }

/* About */
.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 56px; }
.about-text { font-size: 1.1rem; color: var(--text); }
.skills { display: grid; gap: 22px; }
.skill-group h4 { margin-bottom: 10px; }

/* Cards */
.card {
  position: relative; display: block;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; color: var(--text); box-shadow: var(--shadow);
  transition: transform 0.35s var(--ease), border-color 0.25s, box-shadow 0.35s;
}
.card:hover { text-decoration: none; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

.project-card { --accent: var(--accent); overflow: hidden; }
.project-card::before {
  content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: 0.85; transition: opacity 0.25s;
}
.project-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: 0 24px 40px -24px var(--accent); }
.project-card:hover::before { opacity: 1; }
.project-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.project-card h3 { margin-bottom: 8px; }
.project-card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 18px; }
.project-year { color: var(--text-muted); }
.card-arrow {
  position: absolute; right: 22px; bottom: 20px; color: var(--accent);
  opacity: 0; transform: translateX(-6px); transition: all 0.3s var(--ease);
}
.project-card:hover .card-arrow { opacity: 1; transform: translateX(0); }

/* Filter bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  padding: 7px 14px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 0.85rem;
  transition: all 0.2s;
}
.filter-btn:hover, .filter-btn.active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.project-card.hidden { display: none; }

/* Timeline */
.timeline { display: grid; gap: 0; border-left: 1px solid var(--border); margin-left: 6px; }
.timeline li { display: grid; grid-template-columns: 170px 1fr; gap: 24px; padding: 0 0 36px 32px; position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 10px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--bg);
}
.timeline-period { color: var(--text-muted); padding-top: 4px; }
.timeline h3 { margin-bottom: 2px; font-size: 1.15rem; }
.timeline-org { color: var(--accent); font-size: 0.9rem; margin-bottom: 6px; }
.timeline p:last-child { color: var(--text-muted); margin: 0; }

/* Articles / publications */
.articles { display: grid; gap: 16px; }
.article {
  display: grid; grid-template-columns: 150px 1fr; gap: 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 26px; box-shadow: var(--shadow);
  transition: transform 0.3s var(--ease), border-color 0.25s;
}
.article:hover { transform: translateY(-3px); border-color: var(--accent); }
.article.hidden { display: none; }
.article-meta { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; color: var(--text-muted); }
.article h3 { font-size: 1.15rem; margin-bottom: 6px; }
.article h3 a { color: var(--text); }
.article h3 a:hover { color: var(--accent); text-decoration: none; }
.article-authors { font-size: 0.9rem; color: var(--text); margin-bottom: 2px; }
.article-type { color: var(--text-muted); }
.article-venue { font-size: 0.9rem; color: var(--accent); margin-bottom: 10px; }
.article-abstract { font-size: 0.95rem; color: var(--text-muted); margin: 0; }
.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 4px 10px; border-radius: 999px; border: 1px solid currentColor;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-published, .status-accepted, .status-presented { color: var(--success); }
.status-submitted, .status-under-review { color: var(--warning); }
.status-in-progress { color: var(--accent); }

/* Education */
.edu-card { display: flex; flex-direction: column; gap: 6px; }
.edu-period { color: var(--accent); }
.edu-card h3 { font-size: 1.15rem; margin: 4px 0 0; }
.edu-inst { color: var(--text); font-size: 0.95rem; margin: 0; }
.edu-loc { color: var(--text-muted); margin: 0; }
.edu-desc { color: var(--text-muted); font-size: 0.9rem; margin: 8px 0 0; }

/* Admin page */
.section-link.btn-primary { color: var(--accent-contrast); }
.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.admin-table th, .admin-table td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 0.95rem; }
.admin-table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); background: var(--bg-elev); }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-actions { white-space: nowrap; }
.admin-actions > * { display: inline-block; vertical-align: middle; margin-right: 6px; }
.admin-actions form { display: inline; }
.btn-danger { color: var(--error); border-color: var(--error); background: transparent; }
.btn-danger:hover { background: var(--error); color: #fff; }
.admin-form { max-width: 760px; }
.admin-form select { width: 100%; padding: 12px 14px; border-radius: 10px; background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); font: inherit; }
.admin-form input[type="color"] { height: 46px; padding: 4px; }
.form-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-row label.check { display: flex; align-items: center; gap: 10px; align-self: end; padding-bottom: 14px; }
.form-row label.check input { width: auto; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* CTA */
.cta {
  position: relative; overflow: hidden;
  text-align: center; padding: 64px 32px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.cta::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(50% 80% at 50% 0%, var(--glow-1), transparent 70%);
}
.cta > * { position: relative; z-index: 1; }
.cta p { color: var(--text-muted); margin-bottom: 24px; }

/* Project detail */
.project-detail .page-head { padding-top: 24px; }
.back-link { color: var(--text-muted); display: inline-block; margin-top: 40px; }
.project-body { display: grid; grid-template-columns: 1fr 280px; gap: 48px; margin-top: 32px; }
.project-main h2 { font-size: 1.4rem; margin-top: 28px; }
.project-main h2:first-child { margin-top: 0; }
.highlights li { position: relative; padding-left: 22px; margin-bottom: 8px; color: var(--text-muted); }
.highlights li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 600; }
.project-side { align-self: start; position: sticky; top: 88px; }
.project-side h4 { margin-bottom: 14px; }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 48px; padding-top: 24px; }
.contact-form label { display: block; margin-bottom: 18px; }
.contact-form label span { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 6px; }
.contact-form input, .contact-form textarea {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text);
  font: inherit; transition: border-color 0.2s, box-shadow 0.2s;
}
.contact-form input:focus, .contact-form textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.contact-list li { display: grid; grid-template-columns: 80px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.contact-list .mono { color: var(--text-muted); }

/* Flash messages */
.flash { padding: 14px 18px; border-radius: 10px; margin-top: 24px; border: 1px solid; font-size: 0.95rem; }
.flash-success { color: var(--success); border-color: currentColor; background: var(--surface); }
.flash-error { color: var(--error); border-color: currentColor; background: var(--surface); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 32px 0; margin-top: 40px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--text-muted); font-size: 0.9rem; }
.footer-inner p { margin: 0; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--text-muted); }

/* Scroll reveal (JS adds .visible) */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .about-grid, .project-body, .contact-grid { grid-template-columns: 1fr; gap: 32px; }
  .article { grid-template-columns: 1fr; gap: 12px; }
  .article-meta { flex-direction: row; align-items: center; }
  .project-side { position: static; }
}
@media (max-width: 640px) {
  .grid-3 { grid-template-columns: 1fr; }
  .hero { padding-top: 64px; }
  .section { padding: 48px 24px; }
  .stats { gap: 28px; }
  .timeline li { grid-template-columns: 1fr; gap: 4px; }
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--bg-elev); border-bottom: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; padding: 16px 24px; border-radius: 0; border: 0; background: none; }
}
