:root {
  color-scheme: light;
  --accent: #4f7cff;
  --bg: #fbfaf8;
  --text: #1a1a1a;
  --text-muted: #5c5c55;
  --border: #e6e3dc;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: "Menlo", "SF Mono", "Consolas", "Liberation Mono", monospace;
}

.dark {
  color-scheme: dark;
  --accent: #7a9dff;
  --bg: #12130f;
  --text: #e8e6df;
  --text-muted: #a3a39b;
  --border: #2b2c26;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

/* ---------------------------------- */
/* Masthead                            */
/* ---------------------------------- */

.masthead {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.masthead-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.masthead-nav {
  display: flex;
  gap: 1.25rem;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.masthead-nav a {
  color: var(--text-muted);
}

.masthead-nav a:hover {
  color: var(--text);
  text-decoration: none;
}

.theme-toggle {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.theme-toggle-icon {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--accent);
}

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

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.hero {
  padding: 6.5rem 0 5rem;
}

h1 {
  font-size: clamp(3rem, 9vw, 5rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin-bottom: 1.75rem;
}

.hero-tagline {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 34rem;
  margin-bottom: 0.35rem;
}

.hero-focus {
  font-size: clamp(1.4rem, 3.5vw, 1.75rem);
  font-style: italic;
  line-height: 1.35;
  color: var(--accent);
  max-width: 34rem;
  margin-bottom: 2.5rem;
}

.hero-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
  font-family: var(--mono);
  font-size: 0.92rem;
}

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

.section {
  padding: 4.5rem 0;
  border-top: 1px solid var(--border);
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  font-size: clamp(1.5rem, 4vw, 1.9rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 2.25rem;
}

.section-index {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.prose {
  max-width: 40rem;
}

.prose p {
  margin-bottom: 1.25rem;
}

.prose p:last-child {
  margin-bottom: 0;
}

/* ---------------------------------- */
/* Projects (index list)               */
/* ---------------------------------- */

.projects {
  list-style: none;
}

.project {
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  column-gap: 1rem;
  border-top: 1px solid var(--border);
  padding: 1.9rem 0;
}

.project-index {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  padding-top: 0.5rem;
}

.project-title {
  font-size: clamp(1.35rem, 3vw, 1.6rem);
  font-weight: 400;
  line-height: 1.3;
}

.project-title a {
  color: var(--text);
}

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

.project-desc {
  color: var(--text-muted);
  max-width: 38rem;
  margin-top: 0.45rem;
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  margin-top: 0.9rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tags li + li::before {
  content: "·";
  margin: 0 0.55rem;
  color: var(--border);
}

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

.footer {
  max-width: 46rem;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 5.5rem;
  border-top: 1px solid var(--border);
}

.footer .section-title {
  margin-bottom: 2rem;
}

.footer-email {
  display: inline-block;
  font-size: clamp(1.5rem, 4.5vw, 2.1rem);
  color: var(--text);
  margin-bottom: 2.5rem;
}

.footer-email:hover {
  color: var(--accent);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
  font-family: var(--mono);
  font-size: 0.92rem;
}

.copyright {
  margin-top: 3.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---------------------------------- */
/* Links, focus, helpers               */
/* ---------------------------------- */

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.arrow {
  font-size: 0.85em;
  display: inline-block;
}

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

.skip-link:focus {
  left: 0;
}

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

@media (max-width: 560px) {
  .masthead {
    padding-top: 1.5rem;
  }

  .masthead-nav {
    display: none;
  }

  .hero {
    padding: 4.5rem 0 3.5rem;
  }

  .hero-links,
  .footer-links {
    gap: 1.1rem;
  }

  .project {
    grid-template-columns: 2.5rem 1fr;
    column-gap: 0.75rem;
  }

  .section {
    padding: 3.5rem 0;
  }
}

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

  body,
  a,
  button {
    transition: none !important;
  }
}
