/* Import elegant fonts */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400&family=Manrope:wght@400;500;600&display=swap');

/* CSS Custom Properties */
:root {
  /* Light Mode - Warmer palette */
  --bg: #f2f1ec;
  --bg-alt: #eae9e1;
  --bg-card: #f2f1ec;
  --text: #171717;
  --text-secondary: #3d3d3d;
  --text-muted: #6E6E6E;
  --accent: #BF8A54;
  --accent-hover: #A67542;
  --border: #171717;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Typography */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-sm: 0.875rem;
  --font-size-base: 1.125rem;
  --font-size-lg: 1.25rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 1.875rem;
  --font-size-3xl: 2.5rem;
  --line-height: 1.7;

  /* Layout */
  --max-width: 860px;
  --max-width-wide: 1000px;
  --border-radius: 6px;
}

/* Dark Mode */
[data-theme="dark"] {
  --bg: #161616;
  --bg-alt: #1C1C1C;
  --bg-card: #222222;
  --text: #EBEBEB;
  --text-secondary: #B8B8B8;
  --text-muted: #888888;
  --accent: #D4A574;
  --accent-hover: #E5BA8F;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Text Selection */
::selection {
  background: rgba(191, 138, 84, 0.3);
  color: var(--text);
}

::-moz-selection {
  background: rgba(191, 138, 84, 0.3);
  color: var(--text);
}

[data-theme="dark"] ::selection {
  background: rgba(212, 165, 116, 0.35);
}

[data-theme="dark"] ::-moz-selection {
  background: rgba(212, 165, 116, 0.35);
}

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

/* Base Styles */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-serif);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  color: var(--text);
  background-color: var(--bg);
  transition: background-color 0.2s ease, color 0.2s ease;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
  z-index: 1000;
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-lg);
}

h2 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-md);
}

h3 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-sm);
}

p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

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

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

/* Elegant underline for inline links */
p a, .about-content a {
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: currentColor;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-style 0.15s ease;
}

p a:hover, .about-content a:hover {
  text-decoration-style: solid;
}

/* Page Title */
.page-title {
  font-family: var(--font-serif);
  font-size: var(--font-size-2xl);
  font-weight: 400;
  font-style: italic;
  margin-bottom: var(--space-2xl);
}

/* Section Title */
.section-title {
  font-family: var(--font-serif);
  font-size: var(--font-size-xl);
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0;
  color: var(--text);
  margin-bottom: var(--space-lg);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-xl);
}

.section-header .section-title {
  margin-bottom: 0;
}

.section-link {
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* About Section */
.about-section {
  display: flex;
  gap: var(--space-2xl);
  align-items: flex-start;
  margin-bottom: var(--space-4xl);
}

.about-content {
  flex: 1;
}

.about-content p {
  line-height: 1.75;
  margin-bottom: var(--space-md);
}

.about-content p:last-of-type {
  margin-bottom: 0;
}

.about-image {
  flex-shrink: 0;
}

.profile-image {
  width: 180px;
  height: 220px;
  border-radius: 4px;
  object-fit: cover;
  filter: saturate(0.7);
  transition: filter 0.3s ease;
}

.profile-image:hover {
  filter: saturate(0.85);
}

.about-links {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
  flex-wrap: wrap;
}

.about-link {
  font-family: var(--font-sans);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.about-link:hover {
  color: var(--text);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.about-link {
  text-decoration: none !important;
}

@media (max-width: 600px) {
  .about-section {
    flex-direction: column-reverse;
    align-items: center;
    gap: var(--space-lg);
  }

  .profile-image {
    width: 140px;
    height: 170px;
  }

  .about-links {
    justify-content: center;
    gap: 0.5rem;
  }

  .about-link {
    flex-direction: column;
    justify-content: center;
    width: 60px;
    height: 60px;
    padding: 8px 4px 6px;
    gap: 4px;
    font-size: 0.75rem;
  }
}

/* Publication List */
.publications-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.publication-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: var(--space-xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px dashed var(--border);
}

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

.publication-thumbnail {
  width: 140px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--border-radius);
  background: var(--bg-alt);
  filter: saturate(0.7) sepia(0.1);
  transition: filter 0.3s ease;
}

.publication-thumbnail:hover {
  filter: saturate(0.85) sepia(0.05);
}

.publication-content h3 {
  font-family: var(--font-serif);
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: 2px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.publication-content h3 a {
  color: var(--text);
}

.publication-content h3 a:hover {
  color: var(--accent);
}

.publication-authors {
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: 2px;
}

.publication-authors .highlight {
  color: var(--text-secondary);
  font-weight: 500;
}

.publication-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: var(--space-xs);
}

.publication-venue {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 3px 10px;
  background: rgba(191, 138, 84, 0.15);
  border-radius: 3px;
}

[data-theme="dark"] .publication-venue {
  background: rgba(212, 165, 116, 0.2);
}

.meta-separator {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.publication-link {
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--accent);
}

.publication-link:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .publication-item {
    grid-template-columns: 100px 1fr;
    gap: var(--space-md);
  }

  .publication-thumbnail {
    width: 100px;
    height: 75px;
  }

  .publication-content h3 {
    font-size: var(--font-size-base);
  }
}

/* Project Card */
.projects-list {
  display: flex;
  flex-direction: column;
}

.project-item {
  padding: var(--space-lg) 0;
  border-bottom: 1px dashed var(--border);
}

.project-item:first-child {
  padding-top: 0;
}

.project-item:last-child {
  border-bottom: none;
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-xs);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.project-title {
  font-family: var(--font-serif);
  font-size: var(--font-size-lg);
  font-weight: 500;
  margin: 0;
  line-height: 1.4;
}

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

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

.project-meta {
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  white-space: nowrap;
}

.project-institution {
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.project-description {
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  font-size: var(--font-size-base);
}

.project-tags {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.project-tag {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 3px 8px;
  background: var(--bg-alt);
  border-radius: 4px;
  color: var(--text-muted);
}

/* Footer spacer */
.footer-spacer {
  height: 6rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) 0;
  color: var(--text-muted);
  font-style: italic;
}

/* Utility Classes */
.text-muted {
  color: var(--text-muted);
}

.mt-4 {
  margin-top: var(--space-4xl);
}

.mb-0 {
  margin-bottom: 0;
}
