/* ---------- Theme ---------- */
:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --text: #1d1c1a;
  --muted: #6b6760;
  --line: #e6e1d8;
  --accent: #c2410c;
  --accent-soft: #fdeee6;

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

  --max: 760px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151412;
    --surface: #1e1c1a;
    --text: #ece8e1;
    --muted: #9d978d;
    --line: #2f2c28;
    --accent: #fb923c;
    --accent-soft: #2c1d14;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151412;
  --surface: #1e1c1a;
  --text: #ece8e1;
  --muted: #9d978d;
  --line: #2f2c28;
  --accent: #fb923c;
  --accent-soft: #2c1d14;
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s, color .2s;
}

a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: .2em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--text); color: var(--bg); padding: .5rem 1rem; z-index: 100;
}
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: calc(var(--max) + 3rem); margin: 0 auto; padding: 1rem 1.5rem;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.site-header.scrolled { border-bottom: 1px solid var(--line); }
.logo { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; text-decoration: none; }
nav { display: flex; align-items: center; gap: 1.25rem; font-size: .95rem; }
nav a { text-decoration: none; color: var(--muted); }
nav a:hover, nav a.active { color: var(--text); }

.theme-toggle {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  width: 2.1rem; height: 2.1rem; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; font-size: .95rem;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: inline; }
}

/* ---------- Layout ---------- */
main { max-width: calc(var(--max) + 3rem); margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 4.5rem 0 1rem; }
.section h2 {
  font-size: 1.75rem; margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: .75rem;
}
.section h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-intro { color: var(--muted); margin: -.5rem 0 1.5rem; }

/* ---------- Hero ---------- */
.hero { padding: 6rem 0 2rem; }
.eyebrow { color: var(--accent); font-weight: 600; letter-spacing: .02em; margin: 0 0 .5rem; }
.hero h1 { font-size: clamp(2.75rem, 8vw, 4.5rem); letter-spacing: -.02em; }
.lede { font-size: 1.25rem; color: var(--muted); max-width: 34ch; margin: 1.25rem 0 2rem; }
.hero-links { display: flex; flex-wrap: wrap; gap: .75rem; }

.btn {
  display: inline-block; padding: .7rem 1.2rem; border-radius: 999px;
  background: var(--text); color: var(--bg); text-decoration: none; font-weight: 500; font-size: .95rem;
  border: 1px solid var(--text); transition: transform .15s, background-color .15s;
}
.btn:hover { color: var(--bg); background: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { color: var(--accent); background: transparent; border-color: var(--accent); }

/* ---------- About ---------- */
.prose p { margin: 0 0 1rem; max-width: 62ch; }
.facts {
  list-style: none; padding: 0; margin: 2rem 0 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem;
}
.facts li { border-top: 1px solid var(--line); padding-top: .75rem; }
.facts span { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.tags { list-style: none; padding: 0; margin: .9rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.tags li {
  font-size: .78rem; padding: .15rem .6rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}

/* ---------- Skills ---------- */
.subhead { font-size: 1.2rem; margin: 2.75rem 0 1rem; }
.skills { margin: 0; display: grid; gap: 1rem; }
.skills > div { display: grid; grid-template-columns: 9.5rem 1fr; gap: 1rem; align-items: baseline; }
.skills dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.skills dd { margin: 0; }
.skills .tags { margin: 0; }

/* ---------- Experience ---------- */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: .6rem; bottom: .6rem;
  width: 1px; background: var(--line);
}
.job { position: relative; padding: 0 0 2.5rem 2rem; }
.job:last-child { padding-bottom: 0; }
.job::before {
  content: ""; position: absolute; left: 0; top: .45rem;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--line);
}
.job:first-child::before { border-color: var(--accent); background: var(--accent); }
.job-head { display: flex; justify-content: space-between; align-items: baseline; gap: .25rem 1rem; flex-wrap: wrap; }
.job h3 { font-size: 1.3rem; }
.job-when { margin: 0; color: var(--muted); font-size: .9rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.job-where { margin: .15rem 0 .6rem; color: var(--accent); font-weight: 500; font-size: .95rem; }
.job-points { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.job-points li { margin-bottom: .35rem; max-width: 64ch; }
.job-points li::marker { color: var(--line); }

/* ---------- Contact ---------- */
.email {
  display: inline-block; font-family: var(--serif); font-size: clamp(1.5rem, 5vw, 2.25rem);
  text-decoration-thickness: 2px; margin-bottom: 1.25rem; word-break: break-all;
}
.socials { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 1.5rem; }
.socials a { color: var(--muted); }
.socials a:hover { color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer {
  max-width: calc(var(--max) + 3rem); margin: 5rem auto 0; padding: 2rem 1.5rem 3rem;
  display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem;
  border-top: 1px solid var(--line);
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); text-decoration: none; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  nav { gap: .9rem; font-size: .9rem; }
  .hero { padding-top: 3.5rem; }
  .skills > div { grid-template-columns: 1fr; gap: .4rem; }
  .job { padding-left: 1.6rem; }
}
