/* Formal Academic Design System — Elevated Sidebar Homepage, Symmetrical Inner Pages, Smooth Loading */
:root {
  --bg: #FAF9F6;
  --surface: #FFFFFF;
  --surface-muted: #F3F4F6;
  --ink: #141923;
  --ink-secondary: #374151;
  --muted: #5B6472;
  --border: #E2E6EC;
  --border-strong: #CBD2DC;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(20, 25, 35, 0.04);
  --shadow-md: 0 10px 26px rgba(20, 25, 35, 0.07);
  --max-width: 1020px;
}

@view-transition { navigation: auto; }

@keyframes fadeUpIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a {
  color: var(--accent); text-decoration: none; text-underline-offset: 3px;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}
a:hover { text-decoration: underline; color: var(--accent-dark); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 999;
  background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 4px; font-size: 14px;
}
.skip-link:focus { left: 12px; }

.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
.container-wide { max-width: 1160px; }

/* Navigation */
.site-header {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 68px; gap: 16px;
}
.brand {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--accent); }

.nav-list {
  display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0;
}
.nav-item { position: relative; }
.nav-link, .nav-drop-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 12px; border-radius: 5px; border: 0; background: transparent;
  font-family: var(--font-body); font-size: 14.5px; font-weight: 500;
  color: var(--ink-secondary); cursor: pointer; line-height: 1.2;
  transition: color 0.16s ease, background-color 0.16s ease;
}
.nav-link:hover, .nav-drop-btn:hover, .nav-link.is-active, .nav-drop-btn.is-active {
  color: var(--accent); background: var(--accent-soft); text-decoration: none;
}
.caret { font-size: 11px; opacity: 0.75; transition: transform 0.16s ease; }
.nav-drop-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }

.dropdown-menu {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  min-width: 224px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 6px; list-style: none; margin: 0; display: none; z-index: 200;
}
.dropdown-menu.is-open { display: block; }
.dropdown-link {
  display: block; padding: 8px 12px; border-radius: 5px;
  font-size: 14px; font-weight: 500; color: var(--ink-secondary);
}
.dropdown-link:hover, .dropdown-link.is-active {
  background: var(--accent-soft); color: var(--accent); text-decoration: none;
}

.mobile-toggle {
  display: none; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 5px; padding: 7px 12px; font-size: 14px; font-weight: 600;
  color: var(--ink); cursor: pointer;
}

.main-content {
  min-height: calc(100vh - 150px);
  animation: fadeUpIn 0.22s ease-out both;
}

/* TWO-COLUMN HOMEPAGE WITH STICKY ACADEMIC SIDEBAR */
.home-layout {
  display: grid;
  grid-template-columns: 316px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
  padding: 36px 0 54px;
}
.profile-sidebar {
  position: sticky;
  top: 88px;
}
.sidebar-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 28px 22px 22px;
}
.sidebar-hero { text-align: center; }
.sidebar-avatar {
  width: 156px; height: 156px; border-radius: 50%;
  object-fit: cover; margin: 0 auto 18px;
  border: 4px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-md);
  background: var(--surface-muted);
}
.sidebar-name {
  font-family: var(--font-display);
  font-size: 27px; font-weight: 700; line-height: 1.18;
  margin: 0 0 6px; color: var(--ink);
}
.sidebar-role { font-size: 15.5px; font-weight: 600; color: var(--accent); margin: 0 0 2px; }
.sidebar-inst { font-size: 14.5px; font-weight: 500; color: var(--muted); margin: 0 0 12px; }
.sidebar-tagline {
  font-size: 14px; line-height: 1.58; color: var(--ink-secondary);
  margin: 0 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}

.sidebar-meta {
  margin: 0; padding: 0 0 16px; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px; text-align: left;
}
.sidebar-meta-row {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px;
  align-items: start; font-size: 13px; line-height: 1.45;
}
.sidebar-meta-row dt {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); padding-top: 2px;
}
.sidebar-meta-row dt svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--accent); }
.sidebar-meta-row dd { margin: 0; color: var(--ink-secondary); word-break: break-word; }
.sidebar-email { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; }

.sidebar-social { padding-top: 16px; }
.sidebar-social-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
}
.social-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--ink-secondary);
  font-size: 12.5px; font-weight: 600;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}
.social-pill:hover {
  transform: translateY(-1px);
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-soft); text-decoration: none;
}
.social-pill svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Right Main Academic Column */
.home-main {
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-width: 0;
}
.home-section { display: flex; flex-direction: column; gap: 16px; }
.home-section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.home-section-title {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; margin: 0; color: var(--ink);
  letter-spacing: -0.01em;
}
.home-section-link { font-size: 13.5px; font-weight: 600; white-space: nowrap; }

.bio-card-editorial {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: var(--radius);
  padding: 22px 26px; box-shadow: var(--shadow-sm);
}
.bio-text-editorial {
  margin: 0; font-size: 16px; line-height: 1.78; color: var(--ink-secondary);
}

.interest-list-editorial {
  display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0;
}
.interest-tag {
  padding: 7px 15px; background: var(--surface);
  border: 1px solid var(--border); border-top: 2px solid var(--accent);
  border-radius: 6px; font-size: 13.5px; font-weight: 700; color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.pub-featured-stack { display: flex; flex-direction: column; gap: 14px; }
.pub-card-featured { border-left: 3px solid var(--accent); }

.collab-strip-editorial { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.teaser-box-editorial {
  background: var(--surface); border: 1px solid var(--border);
  border-top: 3px solid var(--accent); border-radius: var(--radius);
  padding: 20px 24px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-sm);
}
.email-box-editorial {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 24px; display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px; box-shadow: var(--shadow-sm);
}

/* Inner Page Symmetrical Section Cadence */
.section { padding: 40px 0; border-bottom: 1px solid var(--border); }
.section:last-of-type { border-bottom: 0; }
.section-header { text-align: center; margin: 0 auto 24px; }
.section-eyebrow {
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0;
}
.section-eyebrow::after {
  content: ""; display: block; width: 36px; height: 2px;
  background: var(--accent); margin: 10px auto 0; border-radius: 2px;
}
.section-footer-link { margin: 20px 0 0; text-align: center; font-size: 14.5px; font-weight: 600; }

/* Balanced Symmetrical Grids & Cards */
.card-grid-dynamic {
  display: grid; gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.card-grid-dynamic[data-count="1"] { max-width: 460px; grid-template-columns: 1fr; }
.card-grid-dynamic[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.card-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 9px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.card-title {
  font-family: var(--font-display); font-size: 18px; font-weight: 600;
  line-height: 1.34; margin: 0; color: var(--ink);
}
.meta-mono { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.card-desc { margin: 0; font-size: 14.5px; color: var(--ink-secondary); line-height: 1.62; }
.card-actions {
  margin-top: auto; padding-top: 10px; display: flex; flex-wrap: wrap; gap: 8px 14px;
  align-items: center; font-size: 13.5px; font-weight: 600;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 5px; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  cursor: pointer; font-family: var(--font-body); text-decoration: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-border);
}
.badge-neutral { background: var(--surface-muted); color: var(--ink-secondary); border-color: var(--border); }
.badge-timed { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.badge-appt { background: #F1F5F9; color: #334155; border-color: #CBD5E1; }
.badge-holiday { background: #FEF3C7; color: #92400E; border-color: #FDE68A; }

/* Abstract & BibTeX Drawers */
.abstract-panel {
  margin-top: 8px; padding: 12px 14px; background: var(--bg);
  border-left: 2px solid var(--accent); border-radius: 0 5px 5px 0;
  font-size: 14px; color: var(--ink-secondary); line-height: 1.62;
}
.abstract-panel[hidden] { display: none; }

.bibtex-panel {
  margin-top: 10px; border: 1px solid var(--border); border-radius: 6px;
  background: #F8FAFC; padding: 12px 14px;
}
.bibtex-panel[hidden] { display: none; }
.bibtex-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 8px;
}
.bibtex-code {
  margin: 0; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5;
  overflow-x: auto; white-space: pre-wrap; color: var(--ink);
}

.collab-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 15px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13.5px; font-weight: 600; color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.collab-chip-logo { height: 24px; width: auto; max-width: 84px; object-fit: contain; }

.teaser-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.teaser-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin: 0; }
.email-address {
  font-family: var(--font-mono); font-size: 15.5px; font-weight: 500;
  color: var(--accent); word-break: break-word;
}

/* Inner Page Centered Headers */
.page-header { padding: 42px 0 28px; border-bottom: 1px solid var(--border); text-align: center; }
.page-title {
  font-family: var(--font-display); font-size: clamp(27px, 3.4vw, 36px);
  font-weight: 700; margin: 0 0 10px; line-height: 1.2;
}
.page-title::after {
  content: ""; display: block; width: 42px; height: 2px;
  background: var(--accent); margin: 12px auto 0; border-radius: 2px;
}
.page-lead { margin: 12px auto 0; color: var(--ink-secondary); max-width: 68ch; font-size: 16px; }

/* Filter Bar */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center;
  padding: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin: 26px auto 22px; max-width: 900px;
  box-shadow: var(--shadow-sm);
}
.filter-input, .filter-select {
  padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 5px;
  font-family: var(--font-body); font-size: 14px; background: var(--surface); color: var(--ink);
}
.filter-input { flex: 1 1 220px; }

.pub-list { display: flex; flex-direction: column; gap: 16px; max-width: 900px; margin: 0 auto; }
.pub-row {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-sm);
}
.pub-row[hidden] { display: none; }
.pub-authors { margin: 6px 0 4px; font-size: 14.5px; color: var(--ink-secondary); }
.pub-venue { font-size: 14px; color: var(--muted); font-style: italic; margin: 0; }

.proj-thumb {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover;
  border-radius: 5px; border: 1px solid var(--border); background: var(--surface-muted);
}
.proj-placeholder {
  width: 100%; aspect-ratio: 16 / 10; border-radius: 5px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--accent-soft) 0%, #F1F3F6 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--accent);
  padding: 14px; text-align: center;
}
.tech-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tech-tag {
  font-family: var(--font-mono); font-size: 11.5px; padding: 2px 8px;
  border-radius: 4px; background: var(--surface-muted); color: var(--ink-secondary);
  border: 1px solid var(--border);
}

/* Tables & Consultation Google Sheet Card */
.sheet-card { max-width: 880px; margin: 0 auto; }
.week-banner {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 14px 20px; background: var(--surface); border: 1px solid var(--border);
  border-top: 3px solid var(--accent); border-radius: var(--radius);
  margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.sheet-footnotes {
  margin: 14px 0 0; padding: 12px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13.5px; color: var(--muted); text-align: center;
}
.sheet-embed-wrap {
  max-width: 920px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.sheet-embed-frame { width: 100%; min-height: 540px; border: 0; display: block; }

.formal-table-wrap {
  overflow-x: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 900px; margin: 0 auto; box-shadow: var(--shadow-sm);
}
.formal-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14.5px; }
.formal-table th, .formal-table td {
  padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
.formal-table th {
  font-family: var(--font-mono); font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); background: var(--surface-muted);
}
.formal-table tr:last-child td { border-bottom: 0; }
.formal-table tr.is-holiday td { background: #FCFBFA; color: var(--muted); }

.prose { max-width: 70ch; margin: 0 auto; font-size: 16.5px; line-height: 1.78; color: var(--ink-secondary); }
.prose h2, .prose h3, .prose h4 {
  font-family: var(--font-display); color: var(--ink); margin: 1.6em 0 0.5em; line-height: 1.3;
}
.prose pre {
  background: #141923; color: #F3F4F6; padding: 14px 16px; border-radius: 6px;
  overflow-x: auto; font-family: var(--font-mono); font-size: 13.5px;
}
.prose code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-muted); padding: 2px 5px; border-radius: 3px; }
.prose pre code { background: transparent; padding: 0; }
.prose blockquote {
  margin: 1.2em 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--accent); color: var(--muted);
}

.form-stack { display: flex; flex-direction: column; gap: 14px; }
.field-label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 5px; color: var(--ink); }
.field-input, .field-textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: 5px; font-family: var(--font-body); font-size: 15px;
  background: var(--surface); color: var(--ink);
}
.field-textarea { min-height: 130px; resize: vertical; }
.alert {
  padding: 12px 16px; border-radius: 5px; font-size: 14.5px; margin-bottom: 18px;
  border: 1px solid var(--border);
}
.alert-success { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.alert-error { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.site-footer {
  margin-top: 28px; padding: 26px 0; border-top: 1px solid var(--border);
  background: var(--surface); font-size: 13.5px; color: var(--muted); text-align: center;
}

/* Responsive Breakpoints */
@media (max-width: 980px) {
  .home-layout {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 24px 0 42px;
  }
  .profile-sidebar { position: static; max-width: 680px; width: 100%; margin: 0 auto; }
  .sidebar-meta { max-width: 460px; margin: 0 auto; }
  .sidebar-social-grid {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  }
  .home-main { max-width: 780px; width: 100%; margin: 0 auto; }
  .card-grid-dynamic, .card-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .container { padding: 0 18px; }
  .mobile-toggle { display: inline-flex; align-items: center; gap: 6px; }
  .nav-list {
    display: none; position: absolute; top: 68px; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 14px 20px 20px; flex-direction: column; align-items: stretch; gap: 4px;
    box-shadow: var(--shadow-md);
  }
  .nav-list.is-open { display: flex; }
  .nav-link, .nav-drop-btn { justify-content: space-between; width: 100%; }
  .dropdown-menu {
    position: static; transform: none; box-shadow: none; border: 0;
    border-left: 2px solid var(--accent-border); margin: 4px 0 6px 12px; padding: 2px 0 2px 10px;
  }
  .sidebar-avatar { width: 132px; height: 132px; }
  .card-grid-dynamic, .card-grid-dynamic[data-count="2"], .card-grid-3, .card-grid-2 {
    grid-template-columns: 1fr;
  }
  .email-box-editorial { justify-content: center; text-align: center; }
  .week-banner { justify-content: center; text-align: center; }
}
@media (max-width: 640px) {
  .responsive-cards-table thead { display: none; }
  .responsive-cards-table, .responsive-cards-table tbody,
  .responsive-cards-table tr, .responsive-cards-table td { display: block; width: 100%; }
  .responsive-cards-table tr { padding: 12px 16px; border-bottom: 1px solid var(--border); text-align: center; }
  .responsive-cards-table td { padding: 4px 0; border: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .main-content { animation: none; }
  .card:hover, .social-pill:hover { transform: none; }
}
@media print {
  .site-header, .filter-bar, .mobile-toggle { display: none !important; }
  .home-layout { grid-template-columns: 1fr; }
  .profile-sidebar { position: static; }
  body { background: #fff; color: #000; }
}
