/* ============================================
   abhe.net v2 — Minimalist Academic Site (Tabs)
   ============================================ */

/* --- Custom Properties --- */
:root {
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-text: #1a1a2e;
  --color-text-secondary: #555;
  --color-text-muted: #888;
  --color-accent: #2563eb;
  --color-accent-hover: #1d4ed8;
  --color-accent-light: #dbeafe;
  --color-border: #e5e7eb;

  --font-body: 'Open Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'Consolas', 'Menlo', 'Monaco', monospace;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;

  --max-width: 72rem;
  --content-width: 54rem;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-enter: 0.6s;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

ul, ol {
  list-style: none;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  line-height: 1.3;
  font-weight: 600;
}

h2.section-title {
  font-family: var(--font-body);
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-accent-light);
  display: inline-block;
}

/* --- Layout --- */
.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

section {
  padding: var(--space-md) 0;
}

/* --- Site Header (sticky nav with tabs) --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 250, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.site-header .header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header .logo {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
}

.site-header .logo:hover {
  text-decoration: none;
  color: var(--color-accent);
}

.site-header nav ul {
  display: flex;
  gap: 0;
  align-items: center;
}

.site-header nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s;
  cursor: pointer;
}

.site-header nav a:hover {
  color: var(--color-text);
  background: var(--color-accent-light);
  text-decoration: none;
}

.site-header nav a.active {
  color: var(--color-accent);
  background: var(--color-accent-light);
  font-weight: 600;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  margin: 5px 0;
  transition: transform 0.3s, opacity 0.3s;
}

/* --- Tab Panels --- */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* --- Home Section Grid --- */
.home-section {
  padding-top: var(--space-md);
  padding-bottom: var(--space-lg);
}

.home-grid {
  max-width: var(--max-width);
}

/* Name */
.home-name h1 {
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
}

/* Profile block: Headshot + Tagline + Links + Appointments */
.home-profile {
  text-align: center;
}

.home-headshot {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-md);
}

.home-headshot img {
  width: 250px;
  height: 250px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.profile-tagline {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  font-style: italic;
  white-space: nowrap;
  margin-top: var(--space-sm);
}

.home-appointments {
  margin-bottom: var(--space-md);
}

.news-section {
  margin-top: 0;
}

.home-appointments .appointment {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* Small heading — used for News, Education, Current Appointments */
.small-heading {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}

/* News */
.news-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.news-list li {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.news-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  justify-content: center;
  margin-top: 0;
}

.hero-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  transition: all 0.2s;
}

.hero-links a:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  text-decoration: none;
  background: var(--color-accent-light);
}

.hero-links a i,
.hero-links a .ai {
  font-size: 1.1rem;
}

/* --- Two-Column Layout --- */
.two-col-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

/* --- Research Summary (Home tab) --- */
.summary {
  padding-top: 0;
}

.summary-content {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2vw, 1.1rem);
  line-height: 1.8;
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

/* --- Impact Highlights --- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
  text-align: center;
}

.metric {
  padding: var(--space-lg) var(--space-md);
}

.metric-number {
  font-family: var(--font-body);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.metric-label {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-top: var(--space-xs);
}

/* --- Research Vision --- */
.vision-content {
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 2vw, 1.15rem);
  line-height: 1.8;
  color: var(--color-text);
  max-width: 42rem;
}

.vision-content p {
  margin-bottom: var(--space-md);
}

.research-pubs {
  margin-top: var(--space-lg);
}

/* --- Research Areas --- */
.areas-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.area-card {
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  transition: border-color 0.2s;
}

.area-card:hover {
  border-color: var(--color-accent);
}

.area-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--color-text);
}

.area-card p {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* --- Publications --- */
.pub-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.pub-item {
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.pub-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.pub-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: var(--space-xs);
}

.pub-title a {
  color: var(--color-text);
}

.pub-title a:hover {
  color: var(--color-accent);
}

.pub-authors {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xs);
}

.pub-authors .me {
  color: var(--color-accent);
  font-weight: 600;
}

.pub-venue {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.pub-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  font-style: normal;
}

.scholar-link {
  margin-top: var(--space-lg);
  font-size: 0.95rem;
}

.tab-link-inline {
  cursor: pointer;
}

/* --- Education --- */
.education-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.education-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.education-item img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  margin-top: 2px;
}

.education-degree {
  font-weight: 600;
  font-size: 0.9rem;
}

.education-school {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.education-detail {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

/* --- CV Rendered from Markdown --- */
.cv-download {
  margin-bottom: var(--space-lg);
}

.cv-download a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  transition: all 0.2s;
}

.cv-download a:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  text-decoration: none;
  background: var(--color-accent-light);
}

.cv-loading {
  color: var(--color-text-muted);
  font-style: italic;
}

.cv-rendered {
  font-size: 0.95rem;
  line-height: 1.7;
}

.cv-rendered h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--color-accent-light);
  color: var(--color-text);
}

.cv-rendered h2:first-child {
  margin-top: 0;
}

.cv-rendered h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
  color: var(--color-text);
}

.cv-rendered h4 {
  font-size: 1rem;
  font-weight: 400;
  font-style: normal;
  margin-top: 0;
  margin-bottom: var(--space-md);
}

.cv-rendered h4 strong {
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--color-text-secondary);
}

.cv-rendered p {
  margin-bottom: var(--space-sm);
}

.cv-rendered ul,
.cv-rendered ol {
  padding-left: 1.5rem;
  margin-bottom: var(--space-sm);
}

.cv-rendered li {
  list-style: disc;
  margin-bottom: var(--space-xs);
}

.cv-rendered ol li {
  list-style: decimal;
}

.cv-rendered a {
  color: var(--color-accent);
}

.cv-rendered .cv-date {
  display: block;
  float: right;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-left: var(--space-md);
}

.cv-rendered sup {
  font-size: 0.7em;
}

/* --- Footer --- */
.site-footer {
  padding: var(--space-xl) 0 var(--space-lg);
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
}

.footer-links a {
  color: var(--color-text-muted);
  font-size: 1.3rem;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--color-accent);
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* --- Scroll Animations --- */
.animate-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-enter) var(--ease-out),
              transform var(--duration-enter) var(--ease-out);
}

.animate-in.visible {
  opacity: 1;
  transform: none;
}

/* Stagger children */
.stagger > .animate-in:nth-child(1) { transition-delay: 0s; }
.stagger > .animate-in:nth-child(2) { transition-delay: 0.08s; }
.stagger > .animate-in:nth-child(3) { transition-delay: 0.08s; }
.stagger > .animate-in:nth-child(4) { transition-delay: 0.16s; }
.stagger > .animate-in:nth-child(5) { transition-delay: 0.24s; }
.stagger > .animate-in:nth-child(6) { transition-delay: 0.32s; }
.stagger > .animate-in:nth-child(7) { transition-delay: 0.4s; }
.stagger > .animate-in:nth-child(8) { transition-delay: 0.48s; }

/* --- Responsive: Tablet (640px+) --- */
@media (min-width: 640px) {
  .metrics-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* --- Responsive: Desktop (1024px+) --- */
@media (min-width: 1024px) {
  section {
    padding: var(--space-xl) 0;
  }

  .home-section {
    padding-top: var(--space-lg);
  }

  .home-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    grid-template-rows: auto auto auto auto;
    column-gap: var(--space-xl);
    row-gap: 0;
    align-items: start;
  }

  /* [0,0] Name + Tagline — top-aligned with headshot */
  .home-name {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    padding-top: var(--space-md);
  }

  /* [0:1,1] Profile: Headshot + Appointments — spans rows so it doesn't bloat row 0 */
  .home-profile {
    grid-column: 2;
    grid-row: 1 / 3;
    justify-self: center;
  }

  .home-profile .home-headshot {
    margin-bottom: var(--space-md);
  }

  /* [1,0] Summary + Links — immediately below name/tagline */
  .home-summary {
    grid-column: 1;
    grid-row: 2;
    padding-top: var(--space-md);
  }

  /* [2,0] News — tops line up with Education */
  .home-news {
    grid-column: 1;
    grid-row: 3;
    padding-top: var(--space-lg);
  }

  /* [2,1] Education — tops line up with News */
  .home-education {
    grid-column: 2;
    grid-row: 3;
    padding-top: var(--space-lg);
  }

  /* [3, 0:1] Metrics — full width */
  .home-metrics {
    grid-column: 1 / 3;
    grid-row: 4;
    padding-top: var(--space-xl);
  }

  .two-col-layout {
    grid-template-columns: 3fr 2fr;
    gap: var(--space-2xl);
    max-width: var(--max-width);
  }
}

/* --- Responsive: Below desktop (< 1024px) — single column --- */
@media (max-width: 1023px) {
  .home-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
  }

  .home-name       { order: 1; }
  .home-profile    { order: 2; }
  .home-summary    { order: 3; }
  .home-news       { order: 4; }
  .home-education  { order: 5; }
  .home-metrics    { order: 6; }

  .home-name h1 {
    white-space: normal;
  }

  .profile-tagline {
    white-space: normal;
  }

  .home-profile {
    text-align: center;
  }

  .hero-links {
    justify-content: center;
  }

  .home-education {
    padding-top: var(--space-md);
  }

  .home-news {
    padding-top: var(--space-md);
  }
}

/* --- Responsive: Mobile (< 640px) --- */
@media (max-width: 639px) {
  .site-header .header-inner {
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
  }

  .site-header .logo {
    font-size: 1rem;
  }

  .site-header nav ul {
    gap: 0;
  }

  .site-header nav a {
    font-size: 0.8rem;
    padding: 0.35rem 0.6rem;
  }

  .nav-toggle {
    display: none;
  }

  .home-grid {
    gap: var(--space-sm);
  }

  .home-name {
    text-align: center;
  }

  .home-metrics {
    text-align: center;
  }

  .home-headshot img {
    width: 160px;
    height: 160px;
  }

  .metrics-grid {
    text-align: center;
  }

  .container {
    padding: 0 var(--space-md);
  }
}

/* --- Print --- */
@media print {
  .site-header,
  .nav-toggle {
    display: none;
  }

  .tab-panel {
    display: block !important;
  }

  .animate-in {
    opacity: 1;
    transform: none;
  }

  section {
    padding: 1rem 0;
    break-inside: avoid;
  }

  body {
    font-size: 11pt;
    line-height: 1.5;
  }
}
