/* ============================================================
   Personal Website — Shared Stylesheet
   ============================================================ */

/* --- Variables -------------------------------------------- */
:root {
  --color-bg:         #ffffff;
  --color-text:       #1a1a2e;
  --color-text-muted: #5a5a72;
  --color-accent:     #4a6fa5;
  --color-accent-hover: #3a5a8f;
  --color-border:     #e0e0e8;
  --color-card-bg:    #f7f7fb;
  --color-tag-bg:     #e8eef7;
  --color-tag-text:   #4a6fa5;

  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --container-width: 900px;
  --container-pad:   2rem;
  --nav-height:      60px;

  --radius:   6px;
  --shadow:   0 1px 4px rgba(0,0,0,0.08);
}

/* --- Reset ------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
}

img { display: block; max-width: 100%; height: auto; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.3; font-weight: 600; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: clamp(1.2rem, 3vw, 1.6rem); margin-bottom: 1rem; }
h3 { font-size: 1.1rem; }

p { margin-bottom: 1em; }
p:last-child { margin-bottom: 0; }

/* --- Container -------------------------------------------- */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

/* --- Navigation ------------------------------------------- */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  height: var(--nav-height);
}

.nav-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--container-pad);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-text);
  white-space: nowrap;
}
.nav-brand:hover { text-decoration: none; color: var(--color-accent); }

.nav-links {
  list-style: none;
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.nav-links a {
  display: block;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--color-accent);
  background: var(--color-tag-bg);
  text-decoration: none;
}

/* Hamburger button (mobile) */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: all 0.2s;
}

/* Mobile nav open state */
.nav-open .nav-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  position: absolute;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 0.5rem 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.nav-open .nav-links a {
  width: 100%;
  padding: 0.75rem var(--container-pad);
  border-radius: 0;
  font-size: 1rem;
}

/* --- Page header ------------------------------------------ */
.page-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2.5rem;
}
.page-header p {
  color: var(--color-text-muted);
  font-size: 1.05rem;
}

/* --- Section ---------------------------------------------- */
section { margin-bottom: 3rem; }

.section-title {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  background: var(--color-tag-bg);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

/* --- Card grid -------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, transform 0.15s;
}
.card:hover {
  box-shadow: 0 4px 16px rgba(74,111,165,0.12);
  transform: translateY(-2px);
}

.card-img {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
}

.card-body {
  padding: 1rem 1.1rem 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-title { font-size: 1rem; font-weight: 600; }
.card-desc  { font-size: 0.88rem; color: var(--color-text-muted); flex: 1; }

/* --- Tags ------------------------------------------------- */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.tag {
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

/* --- Link row (PDF, DOI, GitHub, etc.) -------------------- */
.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.link-row a {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  color: var(--color-accent);
  transition: background 0.15s, color 0.15s;
}
.link-row a:hover {
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
}

/* --- Publications list ------------------------------------ */
.pub-list { list-style: none; }
.pub-item {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--color-border);
}
.pub-item:last-child { border-bottom: none; }
.pub-authors { font-size: 0.88rem; color: var(--color-text-muted); }
.pub-title   { font-weight: 600; font-size: 1rem; margin: 0.15rem 0; }
.pub-venue   { font-size: 0.88rem; color: var(--color-text-muted); font-style: italic; }

/* --- Talks list ------------------------------------------- */
.talk-list { list-style: none; }
.talk-item {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--color-border);
}
.talk-item:last-child { border-bottom: none; }
.talk-title    { font-weight: 600; font-size: 1rem; }
.talk-authors  { font-size: 0.88rem; color: var(--color-text-muted); margin-top: 0.1rem; }
.talk-venue    { font-size: 0.88rem; color: var(--color-text-muted); font-style: italic; margin-top: 0.1rem; }
.talk-abstract { font-size: 0.9rem; color: var(--color-text-muted); margin-top: 0.35rem; }

/* --- Hero (landing page) ---------------------------------- */
.hero {
  padding: 4rem 0 3rem;
  display: flex;
  align-items: center;
  gap: 2.5rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 3rem;
}

.hero-photo {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius);
  flex-shrink: 0;
  border: 1px solid var(--color-border);
}

.hero-text h1 { margin-bottom: 0.3rem; }
.hero-tagline {
  font-size: 1.05rem;
  color: var(--color-accent);
  font-weight: 500;
  margin-bottom: 0.75rem;
}
.hero-bio { color: var(--color-text-muted); }

/* --- Wiki layout ------------------------------------------ */
.wiki-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 3rem;
  align-items: start;
  padding: 2.5rem 0 3rem;
}

.wiki-toc {
  position: sticky;
  top: calc(var(--nav-height) + 1.5rem);
  font-size: 0.85rem;
}
.wiki-toc h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 0.6rem;
}
.wiki-toc ol {
  padding-left: 1.1rem;
  color: var(--color-text-muted);
  line-height: 2;
}
.wiki-toc a { color: var(--color-text-muted); }
.wiki-toc a:hover { color: var(--color-accent); text-decoration: none; }

.wiki-content h2 { margin-top: 2rem; margin-bottom: 0.75rem; }
.wiki-content h3 { margin-top: 1.5rem; margin-bottom: 0.5rem; }
.wiki-content img { border-radius: var(--radius); margin: 1.5rem 0; border: 1px solid var(--color-border); }

.wiki-meta {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.88rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}
.back-link:hover { color: var(--color-accent); text-decoration: none; }

/* --- Overview link box ------------------------------------ */
.overview-link-box {
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

/* --- Status block (landing page) -------------------------- */
.status-block {
  background: #e8f5ee;
  border-left: 4px solid #4a9a6f;
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  margin-bottom: 0.5rem;
}
.status-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4a9a6f;
  margin-bottom: 0.35rem;
}
.status-text { margin: 0; }

/* --- Announcements (landing page) ------------------------- */
.announcement {
  border-left: 3px solid var(--color-accent);
  padding: 0.6rem 0 0.6rem 1.1rem;
  margin-bottom: 1.25rem;
}

.announcement-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}
.announcement-title { font-weight: 600; font-size: 1rem; }
.announcement-date  { font-size: 0.85rem; color: var(--color-text-muted); }

/* --- Updates (landing page) ------------------------------- */
.update-item {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--color-border);
}
.update-item:last-child { border-bottom: none; }

.update-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}
.update-title { font-weight: 600; font-size: 1rem; }
.update-date  { font-size: 0.85rem; color: var(--color-text-muted); }

/* --- Footer ----------------------------------------------- */
footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* --- Responsive ------------------------------------------- */
@media (max-width: 768px) {
  :root { --container-pad: 1.25rem; }

  /* Nav */
  .nav-toggle { display: flex; }
  .nav-links   { display: none; }
  nav { position: relative; }

  /* Hero */
  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 2.5rem 0 2rem;
  }
  .hero-photo { width: 120px; height: 120px; }

  /* Wiki */
  .wiki-layout {
    grid-template-columns: 1fr;
  }
  .wiki-toc { display: none; }

  /* Cards */
  .card-grid { grid-template-columns: 1fr; }
}
