/* ══════════════════════════════════════════════════════
   style.css  —  Mobile-first academic personal site
══════════════════════════════════════════════════════ */

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html       { scroll-behavior: smooth; }
img        { max-width: 100%; display: block; }
ul, ol     { list-style: none; }
a          { color: var(--accent); text-decoration: none; }
a:hover    { text-decoration: underline; }
button     { font: inherit; cursor: pointer; }

/* ── Design tokens ──────────────────────────────────── */
:root {
  --bg:       #ffffff;
  --tint:     #f8fafc;
  --border:   #e2e8f0;
  --text:     #0f172a;
  --muted:    #64748b;
  --accent:   #2563eb;
  --accent-d: #1d4ed8;
  --accent-l: #eff6ff;
  --radius:   10px;
  --font:     'Inter', system-ui, -apple-system, sans-serif;
  --max-w:    1100px;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout helpers ─────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.section      { padding: 4rem 0; }
.section-tint { background: var(--tint); }

/* Section heading with accent underline */
.sh {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 700;
  position: relative;
  padding-bottom: 0.65rem;
  margin-bottom: 1.5rem;
}
.sh::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 2.4rem; height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.section-lead {
  color: var(--muted);
  font-size: 1rem;
  max-width: 580px;
  margin-bottom: 2rem;
}

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1.15rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  border: 2px solid transparent;
  transition: 0.15s;
  text-decoration: none !important;
  white-space: nowrap;
  cursor: pointer;
}
.btn-sm { padding: 0.3rem 0.85rem; font-size: 0.82rem; }

.btn-primary       { background: var(--accent);   color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-d); border-color: var(--accent-d); }

.btn-ghost         { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-ghost:hover   { background: var(--accent-l); }

.btn:disabled      { opacity: 0.45; pointer-events: none; }

/* ── NAV ────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.2s;
}
.site-header.has-shadow { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07); }

.nav-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;        /* lets mobile menu row drop below */
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: 1.25rem;
  min-height: 64px;
}

.nav-logo {
  flex: 1;                /* pushes toggle button to the right */
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  padding-block: 1rem;
  text-decoration: none !important;
}
.nav-logo:hover { color: var(--accent); }

/* Hamburger button — hidden on desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
}
.nav-toggle span {
  display: block;
  width: 20px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: 0.25s;
}
/* Animate hamburger → X */
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg);  }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Desktop nav layout */
.nav-menu  { display: flex; align-items: center; gap: 0.5rem; }
.nav-links { display: flex; gap: 0.1rem; }

.nav-links a {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  transition: 0.15s;
  text-decoration: none !important;
}
.nav-links a:hover,
.nav-links a.active { color: var(--accent); background: var(--accent-l); }

/* ── HERO ───────────────────────────────────────────── */
.hero {
  background: linear-gradient(145deg, var(--bg) 55%, var(--accent-l) 100%);
  border-bottom: 1px solid var(--border);
  padding: 4.5rem 0 4rem;
}

.hero-inner {
  display: flex;
  align-items: center;
  gap: 3rem;
}

.hero-text { flex: 1; }

.hero-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.hero-text h1 {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.hero-tagline {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 460px;
  margin-bottom: 1.75rem;
}

.hero-ctas { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* Avatar circle — swap div for <img> to use a real photo */
.avatar {
  width: 250px; height: 250px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.8rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;       /* clips a real <img> into the circle */
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── ABOUT ──────────────────────────────────────────── */
.about-layout { display: grid; gap: 2rem; }

.about-bio p {
  color: var(--muted);
  font-size: 1.02rem;
  margin-bottom: 0.85rem;
}
.about-bio p:last-child { margin-bottom: 0; }

.about-side { display: flex; flex-direction: column; gap: 1rem; }

.info-box {
  background: var(--tint);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.4);
  padding: 1.2rem 1.4rem;
}
.info-box h3 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.7rem;
}
.info-box ul li {
  padding: 0.28rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}
.info-box ul li:last-child { border-bottom: none; }

.edu { display: flex; flex-direction: column; gap: 0.1rem; margin-bottom: 0.6rem; }
.edu:last-child  { margin-bottom: 0; }
.edu strong      { font-size: 0.9rem; }
.edu span        { font-size: 0.8rem; color: var(--muted); }

/* ── STRUCTURE VIEWERS ──────────────────────────────── */
.viewer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.viewer-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s;
}
.viewer-card:hover {
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.12);
  transform: translateY(-3px);
}

.mol-viewer {
  position: relative;
  height: 360px;
  width: 100%;
  background: #0f1021;
  cursor: grab;
}
.mol-viewer:active { cursor: grabbing; }
.mol-viewer-error {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.85rem;
  cursor: default;
}

.viewer-body {
  padding: 1.3rem 1.4rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.viewer-body h3 { font-size: 1.05rem; margin-bottom: 0.4rem; }
.viewer-body p  { color: var(--muted); font-size: 0.88rem; flex: 1; margin-bottom: 0.9rem; }

.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0; }
.tags li {
  background: var(--accent-l);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
}

/* ── PUBLICATIONS ───────────────────────────────────── */
.pub-list { display: flex; flex-direction: column; }

.pub {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}
.pub:first-child { padding-top: 0; }
.pub:last-child  { border-bottom: none; }

.pub-meta  { display: flex; align-items: center; gap: 0.5rem; }
.pub-year  { font-weight: 700; font-size: 0.88rem; color: var(--accent); }
.pub-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--tint);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 10px 10px;
  border-radius: 50px;
}

.pub-title a { font-weight: 600; color: var(--text); }
.pub-title a:hover { color: var(--accent); text-decoration: underline; }

.pub-authors { color: var(--muted); font-size: 0.87rem; margin: 0.15rem 0; }
.pub-venue   { color: var(--muted); font-size: 0.84rem; margin-bottom: 0.5rem; }
.pub-links   { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.pill {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-l);
  padding: 2px 10px;
  border-radius: 4px;
  text-decoration: none !important;
  transition: 0.15s;
}
.pill:hover { background: var(--accent); color: #fff; }

/* ── CV ─────────────────────────────────────────────── */
.cv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.cv-doc {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.4);
  overflow: hidden;
}

.cv-block {
  padding: 1.6rem 1.75rem;
  border-bottom: 1px solid var(--border);
}
.cv-last { border-bottom: none; }

.cv-cat {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.cv-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.cv-row:last-child { margin-bottom: 0; }

.cv-main         { display: flex; flex-direction: column; gap: 0.12rem; flex: 1; }
.cv-main strong  { font-size: 0.95rem; }
.cv-sub          { font-size: 0.84rem; color: var(--muted); }
.cv-note         { font-size: 0.8rem;  color: var(--muted); }
.cv-date         { font-size: 0.82rem; color: var(--muted); white-space: nowrap; padding-top: 2px; }
.cv-bullets {
  list-style: disc;
  padding-left: 1.25rem;
  margin-top: 0.35rem;
}

.skills {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.skills div { display: flex; flex-direction: column; gap: 0.15rem; }
.skills dt  { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.skills dd  { font-size: 0.86rem; color: var(--muted); }

/* ── CONTACT ────────────────────────────────────────── */
.contact-wrap             { text-align: center; }
.contact-wrap .section-lead { margin-inline: auto; margin-bottom: 2.5rem; }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
  text-align: left;
}
.contact-grid li {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--tint);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.4);
  padding: 1.2rem 1.25rem;
}
.c-icon { font-size: 1.4rem; flex-shrink: 0; line-height: 1; }
.contact-grid li div { display: flex; flex-direction: column; gap: 0.18rem; }
.contact-grid strong {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.contact-grid a,
.contact-grid span { font-size: 0.9rem; color: var(--text); }
.contact-grid a:hover { color: var(--accent); text-decoration: underline; }

/* ── FOOTER ─────────────────────────────────────────── */
.site-footer {
  background: var(--text);
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  padding: 2rem 0;
  font-size: 0.85rem;
}
.site-footer a { color: rgba(255, 255, 255, 0.75); text-decoration: underline; }
.site-footer a:hover { color: #fff; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════ */

/* Mobile only: < 768px */
@media (max-width: 767px) {

  /* Show hamburger */
  .nav-toggle { display: flex; }

  /* Mobile menu drops below the logo/toggle row */
  .nav-menu {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.75rem 0 1rem;
    border-top: 1px solid var(--border);
  }
  .nav-menu.open { display: flex; }

  .nav-links { flex-direction: column; }
  .nav-links a {
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
  }
  .nav-links li:last-child a { border-bottom: none; }
  .nav-menu .btn { align-self: flex-start; margin-top: 0.75rem; }

  /* Hero: photo stacks above text, centered */
  .hero-inner       { flex-direction: column-reverse; text-align: center; gap: 2rem; }
  .hero-tagline     { margin-inline: auto; }
  .hero-ctas        { justify-content: center; }
  .avatar           { width: 250px; height: 250px; font-size: 1.4rem; }

  /* CV: stack date below entry */
  .cv-row  { flex-direction: column; gap: 0.15rem; }
  .cv-date { align-self: flex-start; }
  .cv-block { padding: 1.25rem 1rem; }
}

/* Desktop: ≥ 900px */
@media (min-width: 900px) {
  .section      { padding: 5.5rem 0; }
  .container    { padding-inline: 2rem; }

  /* Two-column about section */
  .about-layout { grid-template-columns: 1fr 285px; }

  /* Publications: year column on left */
  .pub {
    grid-template-columns: 90px 1fr;
    gap: 1.25rem;
  }
  .pub-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding-top: 2px;
  }
}

/* Print: show CV section only */
@media print {
  .site-header, .hero, #about, #research,
  #publications, #contact, .site-footer,
  .cv-header .btn         { display: none !important; }

  #cv                     { padding: 0; background: white; }
  .cv-doc                 { border: none; }
  .cv-block               { padding: 1rem 0; break-inside: avoid; }
  *                       { color: black !important; background: white !important; box-shadow: none !important; }
}