/* ---------- Theme tokens ---------- */
:root {
  --bg: #ffffff;
  --surface: #fbf9f5;
  --text: #221f1b;
  --muted: #6e665b;
  --border: #e2dbcf;
  --accent: #7b2f2a;
  --accent-soft: #efe7dc;
  --ok: #6f8a6a;
  --radius: 2px;
  --max: 720px;
  --display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --font: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15130f;
    --surface: #1b1914;
    --text: #ebe4d6;
    --muted: #a39a8a;
    --border: #2f2b24;
    --accent: #cfae7c;
    --accent-soft: #252119;
    --ok: #93ad8c;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #15130f;
  --surface: #1b1914;
  --text: #ebe4d6;
  --muted: #a39a8a;
  --border: #2f2b24;
  --accent: #cfae7c;
  --accent-soft: #252119;
  --ok: #93ad8c;
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 19px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "onum";
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 4px;
  transition:
    text-decoration-color 0.2s ease,
    color 0.2s ease;
}
a:hover {
  text-decoration-color: var(--accent);
}

img {
  max-width: 100%;
  display: block;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 500;
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: -0.005em;
}
h1 {
  font-size: clamp(2.6rem, 7vw, 3.8rem);
  font-weight: 400;
  letter-spacing: -0.015em;
}
h2 {
  font-size: 1.9rem;
  font-weight: 400;
  font-style: italic;
  margin-top: 4rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 18px;
}
h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
h3 {
  font-size: 1.5rem;
}

p {
  margin: 0 0 1.1em;
}

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -999px;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
  background: var(--surface);
  padding: 8px 12px;
  font-family: var(--ui);
  font-size: 0.8rem;
  z-index: 10;
}

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

/* Small tracked caps, used for labels, nav, and buttons */
.nav-links a,
.button,
.meta,
.when,
.status,
.skills dt,
.site-footer,
.tags li {
  font-family: var(--ui);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  z-index: 5;
  border-bottom: 1px solid transparent;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 76px;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 500;
  font-style: italic;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}
.nav-links a:hover {
  color: var(--text);
}
.nav-links a[aria-current] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Main ---------- */
main.container {
  padding-top: 88px;
  padding-bottom: 104px;
}

main > h1:first-child {
  margin-bottom: 0.4em;
}

.hero {
  display: flex;
  gap: 36px;
  align-items: center;
  margin-bottom: 40px;
}
.avatar {
  width: 124px;
  height: 124px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--accent-soft);
  padding: 5px;
  border: 1px solid var(--border);
  background-clip: content-box;
}
.hero h1 {
  margin-bottom: 0.2em;
}
.tagline {
  color: var(--muted);
  font-size: 1.2rem;
  font-style: italic;
  margin: 0;
}

.lead {
  font-family: var(--display);
  font-size: 1.55rem;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 1.2em;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 40px 0 8px;
}

.button {
  display: inline-block;
  padding: 13px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-decoration: none;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}
.button:hover {
  border-color: var(--text);
}
.button.primary {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.button.primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.status {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
  margin-top: 14px;
}
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  margin-top: 0.55em;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent);
}

/* ---------- Tags ---------- */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.tags li {
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
}

.skills {
  display: grid;
  grid-template-columns: 190px 1fr;
  margin: 0;
  border-top: 1px solid var(--border);
}
.skills dt,
.skills dd {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin: 0;
}
.skills dt {
  color: var(--text);
}
.skills dd .tags li {
  color: var(--text);
  font-family: var(--font);
  font-size: 1.05rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
}

/* ---------- Project cards ---------- */
.projects {
  display: grid;
  gap: 0;
  margin-top: 48px;
  border-top: 1px solid var(--border);
}
.projects .card {
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  padding: 40px 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 40px;
}
.card h3 {
  margin-bottom: 6px;
  font-size: 1.8rem;
}
.card .meta {
  color: var(--muted);
  margin-bottom: 18px;
}
ul.highlights {
  padding-left: 0;
  margin: 0 0 22px;
  list-style: none;
}
ul.highlights li {
  margin-bottom: 6px;
  padding-left: 26px;
  position: relative;
}
ul.highlights li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.85em;
  width: 12px;
  height: 1px;
  background: var(--accent);
}
.card .links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 22px;
  font-style: italic;
}

.card-title { color: inherit; text-decoration: none; }
.card-title:hover { color: var(--accent); }

.card-image {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  width: 100%;
}

/* ---------- Project write-up ---------- */
.back-link { font-style: italic; margin-bottom: 2rem; }
.back-link a { text-decoration: none; }
.back-link.bottom { margin: 4rem 0 0; }

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 48px;
  margin: 32px 0 44px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.facts dt {
  font-family: var(--ui);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd { margin: 2px 0 0; }

.shot { margin: 40px 0; }
.shot img { border: 1px solid var(--border); border-radius: var(--radius); }
.shot figcaption { color: var(--muted); font-style: italic; font-size: 0.95rem; margin-top: 10px; }

.note { color: var(--muted); font-style: italic; margin-top: 16px; }

/* ---------- Timeline (experience) ---------- */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}
.timeline > li {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 28px;
  padding: 30px 0;
  border-top: 1px solid var(--border);
}
.timeline > li:first-child {
  border-top: none;
  padding-top: 8px;
}
.timeline .when {
  color: var(--muted);
  padding-top: 10px;
}
.timeline h3 {
  margin-bottom: 2px;
}
.timeline .org {
  color: var(--muted);
  font-style: italic;
  margin-bottom: 12px;
}
.timeline ul {
  padding-left: 0;
  margin: 0;
  list-style: none;
}
.timeline ul li {
  padding-left: 26px;
  position: relative;
  margin-bottom: 4px;
}
.timeline ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.85em;
  width: 12px;
  height: 1px;
  background: var(--accent);
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 0 0 48px;
  color: var(--muted);
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--border);
  padding-top: 32px;
}
.social {
  display: flex;
  gap: 26px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.social a {
  color: var(--muted);
  text-decoration: none;
}
.social a:hover {
  color: var(--accent);
}

/* ---------- Small screens ---------- */
@media (max-width: 600px) {
  body {
    font-size: 18px;
  }
  .container {
    padding: 0 16px;
  }
  main.container {
    padding-top: 48px;
    padding-bottom: 72px;
  }
  .nav {
    height: 64px;
  }
  .brand {
    font-size: 1.2rem;
  }
  .nav-links {
    gap: 12px;
  }
  .nav-links a {
    font-size: 0.6rem;
    letter-spacing: 0.1em;
  }
  .theme-toggle {
    width: 28px;
    height: 28px;
  }
  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 22px;
  }
  .avatar {
    width: 96px;
    height: 96px;
  }
  .lead {
    font-size: 1.3rem;
  }
  h2 {
    margin-top: 3rem;
  }
  .skills {
    grid-template-columns: 1fr;
  }
  .skills dt {
    border-bottom: none;
    padding-bottom: 4px;
  }
  .skills dd {
    padding-top: 0;
  }
  .timeline > li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .timeline .when {
    padding-top: 0;
  }
  .card {
    padding: 26px 22px;
  }
  .projects .card {
    padding: 32px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition: none !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .theme-toggle,
  .button-row {
    display: none;
  }
  body {
    background: #fff;
    color: #000;
  }
}
