/* ---------------------------------------------------------------------------
   Leonard Traeger — personal site
   Dependency-free stylesheet: light/dark themes, single 820px column.
   --------------------------------------------------------------------------- */

:root {
  --fg: #1f2933;
  --fg-muted: #55606e;
  --fg-subtle: #667085;
  --bg: #ffffff;
  --bg-card: #fafafa;
  --border: #eef0f3;
  --border-strong: #d4d8de;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --max-w: 820px;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fg: #e5e7eb;
    --fg-muted: #b6bec9;
    --fg-subtle: #9ca3af;
    --bg: #0f1115;
    --bg-card: #161a21;
    --border: #2a2f3a;
    --border-strong: #3a4150;
    --accent: #a5b4fc;
    --accent-hover: #c7d2fe;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --fg: #e5e7eb;
  --fg-muted: #b6bec9;
  --fg-subtle: #9ca3af;
  --bg: #0f1115;
  --bg-card: #161a21;
  --border: #2a2f3a;
  --border-strong: #3a4150;
  --accent: #a5b4fc;
  --accent-hover: #c7d2fe;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --fg: #1f2933;
  --fg-muted: #55606e;
  --fg-subtle: #667085;
  --bg: #ffffff;
  --bg-card: #fafafa;
  --border: #eef0f3;
  --border-strong: #d4d8de;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  color-scheme: light;
}

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

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  text-decoration: none;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

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

/* Inline links inside running text stay distinguishable without color vision. */
.lede a,
.bio a,
.news-item a,
footer.site a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: currentColor;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}

.lede a:hover,
.bio a:hover,
.news-item a:hover,
footer.site a:hover {
  text-decoration-color: currentColor;
}

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

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
}

/* Header ------------------------------------------------------------------ */

header.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  padding-bottom: 2rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--border);
}

header.site .brand {
  font-weight: 600;
  letter-spacing: -0.015em;
  font-size: 1.2rem;
  color: var(--fg);
  text-decoration: none;
}

header.site nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

header.site nav a {
  color: var(--fg-muted);
  font-size: 0.95rem;
}

header.site nav a:hover,
header.site nav a[aria-current="page"] {
  color: var(--fg);
}

header.site nav .nav-disabled {
  color: var(--fg-subtle);
  font-size: 0.95rem;
  cursor: default;
  user-select: none;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-left: 0.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--fg);
  border-color: var(--border-strong);
}

.theme-icon {
  display: none;
}

.theme-icon--moon {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon--moon {
    display: none;
  }
  :root:not([data-theme="light"]) .theme-icon--sun {
    display: block;
  }
}

:root[data-theme="dark"] .theme-icon--moon {
  display: none;
}

:root[data-theme="dark"] .theme-icon--sun {
  display: block;
}

:root[data-theme="light"] .theme-icon--moon {
  display: block;
}

:root[data-theme="light"] .theme-icon--sun {
  display: none;
}

/* Typography -------------------------------------------------------------- */

h1 {
  font-size: 2.25rem;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 0 0 0.5rem;
  line-height: 1.15;
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 4rem 0 1.5rem;
  color: var(--fg-subtle);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  color: var(--fg);
}

h3.era-label {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-subtle);
  margin: 1.5rem 0 1rem;
}

p {
  margin: 0 0 1.1rem;
}

.page-header {
  margin-bottom: 1rem;
}

.page-header h1 {
  font-size: 1.9rem;
}

.page-header + section > h2,
.page-header + section > .pub-year:first-child > h3 {
  margin-top: 2.5rem;
}

.lede {
  color: var(--fg-muted);
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  max-width: 36em;
}

.bio {
  color: var(--fg-muted);
  font-size: 0.97rem;
  margin-top: 1rem;
  max-width: 50em;
}

.muted {
  color: var(--fg-muted);
}

/* Hero -------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 2.5rem;
  align-items: start;
  margin-bottom: 1rem;
}

.hero-text {
  min-width: 0;
}

.hero-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hero-photo {
  width: 200px;
  height: 200px;
  object-fit: cover;
  object-position: center top;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  background: var(--bg-card);
}

.hero-contact {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

.hero-contact p {
  margin: 0;
}

.contact-email a {
  word-break: break-all;
}

@media (max-width: 600px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .hero-sidebar {
    flex-direction: row;
    align-items: flex-start;
    gap: 1.25rem;
  }

  .hero-photo {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
  }

  h1 {
    font-size: 1.75rem;
  }
}

.id-strip {
  list-style: none;
  padding: 0;
  margin: 0 0 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
}

.id-strip a {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  font-size: 0.85rem;
  color: var(--fg-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.id-strip a:hover {
  color: var(--fg);
  border-color: var(--border-strong);
  border-bottom-color: var(--border-strong);
  background: var(--bg);
}

.hero-sidebar .id-strip {
  gap: 0.3rem 0.4rem;
  margin-top: 0.15rem;
  justify-content: center;
}

.hero-sidebar .id-strip a {
  font-size: 0.78rem;
  padding: 0.15rem 0.55rem;
}

/* Project cards ----------------------------------------------------------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
}

.project-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.25rem 1rem;
  background: var(--bg-card);
  transition: border-color 0.15s;
}

.project-card:hover {
  border-color: var(--border-strong);
}

.project-card h3 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fg);
}

.project-venues {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  color: var(--fg-subtle);
  letter-spacing: 0.01em;
}

.project-card p {
  margin: 0;
  font-size: 0.93rem;
  color: var(--fg-muted);
  line-height: 1.55;
}

.project-links {
  list-style: none;
  padding: 0;
  margin: 0.85rem 0 0;
  margin-top: auto;
  padding-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  font-size: 0.85rem;
}

.project-links a {
  font-weight: 500;
}

/* News / awards ----------------------------------------------------------- */

.news-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1.25rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}

.news-item:first-of-type {
  border-top: none;
  padding-top: 0;
}

.news-item time {
  color: var(--fg-subtle);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
}

@media (max-width: 560px) {
  .news-item {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

.award-title {
  font-weight: 600;
  color: var(--fg);
  display: block;
}

.entry-type {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  margin-bottom: 0.15rem;
}

.award-note {
  color: var(--fg-muted);
  font-size: 0.93rem;
  display: block;
  margin-top: 0.1rem;
}

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

.pub-year h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--fg);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.pub-item {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 1.5rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--border);
}

.pub-item:first-of-type {
  border-top: none;
}

.pub-item .meta {
  color: var(--fg-subtle);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
}

.pub-item .title {
  font-weight: 500;
  color: var(--fg);
  display: block;
  margin-bottom: 0.25rem;
  line-height: 1.4;
}

a.title:hover {
  color: var(--accent);
  border-bottom-color: currentColor;
}

.pub-item .authors {
  color: var(--fg-muted);
  font-size: 0.93rem;
  display: block;
  margin-bottom: 0.2rem;
}

.pub-item .authors strong {
  color: var(--fg);
  font-weight: 600;
}

.pub-item .venue {
  font-size: 0.87rem;
  color: var(--fg-subtle);
}

.pub-note {
  color: var(--accent);
  font-style: normal;
  font-weight: 500;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.85rem;
  margin-top: 0.4rem;
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .pub-item {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

/* Footer ------------------------------------------------------------------ */

footer.site {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--fg-subtle);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

footer.site a {
  color: var(--fg-muted);
}
