/* ==========================================================================
   1. CORE TYPOGRAPHY & CRISP OFF-WHITE PALETTE
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Lora:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root {
  --font-serif: "Lora", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  
  /* Crisp Off-White Light Mode Palette */
  --bg-color: #f8f9fa;
  --card-bg: #ffffff;
  --text-color: #2d3748;
  --heading-color: #1a202c;
  --link-color: #9b2c2c;
  --rule-color: #cbd5e0;
  --border-color: #e2e8f0;
}

/* Dark Mode Palette Overrides */
[data-theme="dark"] {
  --bg-color: #121212 !important;
  --card-bg: #1e1e1e !important;
  --text-color: #e2e8f0 !important;
  --heading-color: #ffffff !important;
  --link-color: #63b3ed !important;
  --rule-color: #4a5568 !important;
  --border-color: #2d3748 !important;
}

* {
  box-sizing: border-box;
}

html, body {
  background-color: var(--bg-color) !important;
  color: var(--text-color) !important;
  font-family: var(--font-serif) !important;
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Force Dark Mode on All LaTeX.css Elements */
[data-theme="dark"] body,
[data-theme="dark"] main,
[data-theme="dark"] header,
[data-theme="dark"] footer,
[data-theme="dark"] section,
[data-theme="dark"] article,
[data-theme="dark"] div,
[data-theme="dark"] p,
[data-theme="dark"] li,
[data-theme="dark"] span {
  background-color: transparent !important;
  color: var(--text-color) !important;
}

[data-theme="dark"] h1, 
[data-theme="dark"] h2, 
[data-theme="dark"] h3, 
[data-theme="dark"] h4 {
  color: var(--heading-color) !important;
}

[data-theme="dark"] a {
  color: var(--link-color) !important;
}

/* Layout Canvas */
body {
  max-width: 860px !important;
  margin: 0 auto !important;
  padding: 3rem 2rem !important;
}

@media screen and (max-width: 768px) {
  body {
    padding: 1.5rem 1rem !important;
  }
}

h1, h2, h3, h4 {
  color: var(--heading-color) !important;
  font-family: var(--font-serif) !important;
  font-weight: 500;
  line-height: 1.3;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.5rem; margin-top: 2rem; }
h3 { font-size: 1.2rem; }

p, li {
  font-size: 1.05rem;
}

a {
  color: var(--link-color) !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ==========================================================================
   2. TOP NAVIGATION & BUTTONS
   ========================================================================== */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.nav-controls {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.btn-soft {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text-color) !important;
  text-decoration: none !important;
  background-color: var(--card-bg) !important;
  transition: all 0.2s ease;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.btn-soft:hover {
  border-color: var(--rule-color);
  transform: translateY(-1px);
}

/* ==========================================================================
   3. PROJECT CARDS
   ========================================================================== */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.project-card {
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: 8px;
  background: var(--card-bg) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.project-card:hover {
  transform: translateY(-2px);
  border-color: var(--rule-color);
}

.project-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

.project-card p {
  font-size: 0.98rem;
  line-height: 1.55;
  margin-bottom: 1rem;
}

.project-tags {
  font-size: 0.8rem;
  font-family: var(--font-sans);
  font-weight: 500;
  color: #718096;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

[data-theme="dark"] .project-tags {
  color: #a0aec0 !important;
}
