/* ==========================================================================
   Dylan Hutson — academic homepage
   ========================================================================== */

:root {
  --bg: #fbfbf9;
  --surface: #ffffff;
  --text: #1f2328;
  --text-muted: #5b636e;
  --border: #e4e6e9;
  --accent: #b5121b;          /* UC red */
  --accent-hover: #8a0e14;
  --accent-soft: #fbeeee;
  --chip-bg: #f1f2f4;

  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius: 8px;
  --max-width: 52rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1c1f23;
    --text: #e6e8eb;
    --text-muted: #9aa3ad;
    --border: #2d3238;
    --accent: #f0707a;
    --accent-hover: #f7a0a6;
    --accent-soft: #2a1d1f;
    --chip-bg: #262a2f;
  }
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

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

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

strong {
  font-weight: 600;
}

/* ---------- Layout ---------- */

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4.5rem 1.5rem 5rem;
}

/* ---------- Intro ---------- */

.intro {
  padding-bottom: 2.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.intro h1 {
  margin: 0 0 1rem;
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 5vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.intro-text p {
  margin: 0 0 1.5rem;
  max-width: 40rem;
  font-size: 1.075rem;
  color: var(--text);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.links a {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.links a:hover,
.links a:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* ---------- Sections ---------- */

.section {
  padding: 2rem 0 0.5rem;
}

.section h2 {
  margin: 0 0 1.25rem;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.section ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.section li {
  position: relative;
  padding-left: 1.1rem;
  margin-bottom: 0.6rem;
}

.section li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Publications ---------- */

.publication {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 1.25rem;
  padding: 1.25rem 1.25rem 1.25rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.publication:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.publication.highlighted {
  border-left: 4px solid var(--accent);
  background: linear-gradient(to right, var(--accent-soft), var(--surface) 40%);
}

.pub-year {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.1rem;
}

.pub-body h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
}

.pub-body p {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.pub-body p strong {
  color: var(--text);
}

.pub-body em {
  color: var(--accent);
  font-style: normal;
  font-weight: 600;
  font-size: 0.875rem;
}

.pub-body .keywords {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pub-body .keywords::before {
  content: "Keywords:";
  font-weight: 600;
  margin-right: 0.35rem;
  color: var(--text);
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem !important;
}

.pub-links a {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 4px;
  background: var(--chip-bg);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.pub-links a:hover,
.pub-links a:focus-visible {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 600px) {
  .page {
    padding: 2.5rem 1rem 3rem;
  }

  .publication {
    grid-template-columns: 1fr;
    gap: 0.25rem;
    padding: 1rem;
  }

  .pub-year {
    font-size: 0.95rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}

/* ---------- Print ---------- */

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .page {
    padding: 0;
  }

  .publication {
    break-inside: avoid;
    box-shadow: none;
    border-color: #ccc;
  }

  .links a,
  .pub-links a {
    border: none;
    padding: 0;
    background: none;
  }
}
