/* Micah Villarreal — site styles */

:root {
  --bg: #fdfcfa;
  --bg-elevated: #ffffff;
  --text: #1f1d1b;
  --text-muted: #5f5955;
  --accent: #8b2f39;
  --accent-hover: #6d232c;
  --accent-soft: #f6e8e9;
  --border: #e6e0dc;
  --nav-bg: rgba(253, 252, 250, 0.9);
  --shadow: 0 1px 2px rgba(31, 29, 27, 0.06), 0 6px 20px rgba(31, 29, 27, 0.06);
  --font-serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 68ch;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514;
    --bg-elevated: #1f1d1c;
    --text: #ece7e2;
    --text-muted: #a89f98;
    --accent: #e08a94;
    --accent-hover: #f0a7af;
    --accent-soft: #33232a;
    --border: #322e2b;
    --nav-bg: rgba(22, 21, 20, 0.9);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.3);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-padding-top: 4.5rem;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.1rem, 5vw, 2.9rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2rem); margin-top: 0; }
h3 { font-size: 1.25rem; margin-top: 2rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--font-sans); font-weight: 600; font-size: 0.8rem; }
h4 { font-size: 1.25rem; margin: 0 0 0.35rem; }

p { margin: 0 0 1rem; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { padding-left: 1.25rem; }
li { margin-bottom: 0.4rem; }
cite { display: block; font-style: normal; color: var(--text-muted); font-size: 0.9rem; margin-top: 0.4rem; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #fff; padding: 0.5rem 1rem; z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* Navigation */
.site-nav {
  position: sticky; top: 0; z-index: 10;
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 52rem;
  margin: 0 auto;
  padding: 0.6rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.nav-name {
  display: none;
  font-family: var(--font-serif); font-weight: 600; font-size: 1.05rem;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
@media (min-width: 640px) {
  .nav-name { display: block; }
}
.nav-links {
  list-style: none; margin: 0; padding: 0;
  display: flex; gap: 0.25rem; flex: 1; justify-content: space-between;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
@media (min-width: 640px) {
  .nav-links { flex: 0 1 auto; justify-content: flex-end; }
}
.nav-links li { margin: 0; }
.nav-links a {
  display: block; padding: 0.35rem 0.6rem; border-radius: 6px;
  font-size: 0.95rem; color: var(--text-muted); text-decoration: none; white-space: nowrap;
}
.nav-links a:hover { color: var(--accent); background: var(--accent-soft); }

/* Page container */
main {
  max-width: 52rem;
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 3rem;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.75rem;
  align-items: center;
  padding-bottom: 2.5rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}
@media (min-width: 640px) {
  .hero { grid-template-columns: 200px minmax(0, 1fr); gap: 2.5rem; }
  .headshot { max-width: 100%; }
}
.headshot {
  width: 200px; max-width: 60%;
  aspect-ratio: 2 / 3; object-fit: cover;
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent);
}
.hero h1 { margin-bottom: 0.4rem; }
.role { font-size: 1.15rem; margin: 0 0 0.15rem; font-family: var(--font-serif); }
.affiliation { color: var(--text-muted); margin: 0 0 1.1rem; }
.affiliation a { color: inherit; text-decoration: none; }
.affiliation a:hover { color: var(--accent); }
.hero-links {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.hero-links li { margin: 0; }
.hero-links a {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text); text-decoration: none; font-size: 0.9rem;
}
.hero-links a:hover { border-color: var(--accent); color: var(--accent); }
.hero-links svg { width: 1.05em; height: 1.05em; fill: currentColor; }

/* Sections */
.section {
  max-width: var(--measure);
  margin-bottom: 3rem;
  scroll-margin-top: 4.5rem;
}
.section h2 {
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  margin-bottom: 1.25rem;
}

/* Paper cards */
.paper {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.4rem 0.9rem;
  margin: 0 0 1.25rem;
  box-shadow: var(--shadow);
}
.paper h4 { font-size: 1.3rem; }
.paper-tag {
  display: inline-block;
  margin-bottom: 0.6rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
}
.paper-links { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 0.75rem; }
.paper-note { color: var(--text-muted); font-size: 0.9rem; font-style: italic; }

.btn {
  display: inline-block;
  padding: 0.4rem 0.95rem;
  border: 1px solid var(--accent); border-radius: 8px;
  color: var(--accent); background: transparent;
  font-size: 0.9rem; font-weight: 600; text-decoration: none;
}
.btn:hover { background: var(--accent-soft); color: var(--accent-hover); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

details { border-top: 1px solid var(--border); padding-top: 0.6rem; }
summary {
  cursor: pointer; font-weight: 600; font-size: 0.95rem;
  color: var(--text-muted); list-style: none; display: flex; align-items: center; gap: 0.4rem;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: ""; width: 0.45em; height: 0.45em;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.15s ease;
}
details[open] summary::before { transform: rotate(45deg); }
summary:hover { color: var(--accent); }
details p { margin-top: 0.75rem; font-size: 0.97rem; color: var(--text); }

/* Teaching */
blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 10px 10px 0;
}
blockquote p { margin: 0; }

/* Talks */
.talks { margin: 0; display: grid; grid-template-columns: max-content 1fr; column-gap: 1.25rem; row-gap: 0.75rem; }
.talks dt { font-family: var(--font-serif); font-weight: 600; color: var(--accent); }
.talks dd { margin: 0; }

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