:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --text: #1c1b19;
  --muted: #6b665e;
  --line: #e4dfd6;
  --accent: #b4410e;
  --accent-contrast: #ffffff;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121316;
    --surface: #1a1c20;
    --text: #ecebe7;
    --muted: #a09c94;
    --line: #2c2f35;
    --accent: #f59e5b;
    --accent-contrast: #1a1205;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121316;
  --surface: #1a1c20;
  --text: #ecebe7;
  --muted: #a09c94;
  --line: #2c2f35;
  --accent: #f59e5b;
  --accent-contrast: #1a1205;
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  -webkit-text-size-adjust: 100%;
}

@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;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.2em;
}

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

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

.wrap {
  width: 100%;
  max-width: 68rem;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.muted {
  color: var(--muted);
  font-weight: 400;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: var(--accent-contrast);
  z-index: 20;
}

.skip-link:focus {
  left: 0.5rem;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.75rem;
}

.brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav a {
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  padding-block: 0.25rem;
  border-bottom: 2px solid transparent;
}

.nav a:hover,
.nav a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.theme-toggle {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

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

/* Hero */

.hero,
.project-page {
  padding-block: clamp(3.5rem, 10vw, 7rem) clamp(2.5rem, 6vw, 4rem);
}

.eyebrow,
.card-meta,
.section-label {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 8vw, 5rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-top: 0.75rem;
  text-wrap: balance;
}

.tagline {
  max-width: 38rem;
  margin-top: 1.25rem;
  font-size: clamp(1.15rem, 2.4vw, 1.4rem);
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.button {
  display: inline-block;
  padding: 0.65rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: var(--surface);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}

.button:hover {
  border-color: var(--accent);
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.button.primary:hover {
  filter: brightness(1.08);
  color: var(--accent-contrast);
}

/* Sections */

.section {
  display: grid;
  gap: 1.5rem;
  padding-block: clamp(2.5rem, 6vw, 4rem);
  border-top: 1px solid var(--line);
}

.section.wrap {
  /* keep the divider inset with the content */
  background: linear-gradient(var(--line), var(--line)) top / calc(100% - 2.5rem) 1px no-repeat;
  border-top: 0;
}

@media (min-width: 52rem) {
  .section {
    grid-template-columns: 11rem minmax(0, 1fr);
    gap: 2rem;
  }

  .section-label {
    position: sticky;
    top: 5rem;
    align-self: start;
  }
}

.section-label {
  font-weight: 500;
  color: var(--accent);
}

.prose {
  display: grid;
  gap: 1rem;
  max-width: 42rem;
}

.about-intro {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.about-photo {
  flex: none;
  width: min(100%, 16rem);
  height: auto;
  border-radius: 0.6rem;
  border: 1px solid var(--line);
}

@media (min-width: 44rem) {
  .about-intro {
    flex-direction: row-reverse;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 2.5rem;
  }

  .about-photo {
    width: 14rem;
  }
}

.skills {
  display: grid;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  max-width: 42rem;
}

.skills div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1rem;
}

.skills dt {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-top: 0.2rem;
}

/* Projects */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 1rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--surface);
  transition: border-color 0.15s, transform 0.15s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }

  .card:hover {
    transform: none;
  }
}

.card h3 {
  font-family: var(--serif);
  font-size: 1.3rem;
  line-height: 1.25;
}

.card h3 a {
  text-decoration: none;
}

/* Make the whole card clickable */
.card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card-summary {
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.55;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.75rem;
}

.tags li {
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

/* Timeline */

.timeline {
  display: grid;
  gap: 2rem;
  max-width: 42rem;
}

.timeline h3 {
  font-size: 1.1rem;
  margin-top: 0.2rem;
}

.points {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.6rem;
  padding-left: 1.1rem;
  list-style: disc;
  color: var(--muted);
}

.points li::marker {
  color: var(--accent);
}

.subhead {
  margin: 3rem 0 1.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  max-width: 42rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Contact */

.contact-lead {
  color: var(--muted);
}

.contact-email {
  display: inline-block;
  margin-top: 0.25rem;
  font-family: var(--serif);
  font-size: clamp(1.4rem, 5vw, 2.2rem);
  overflow-wrap: anywhere;
}

.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

/* Project page */

.project-page h1 {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
}

.project-page .tags {
  margin-top: 1.5rem;
  padding-top: 0;
}

.project-page .prose {
  margin-top: 2.5rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
}

.project-image {
  display: block;
  width: 100%;
  max-width: 42rem;
  height: auto;
  margin-top: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
}

.project-files {
  margin-top: 1.5rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
}

.demo {
  margin-top: 3.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--line);
}

.demo h2 {
  font-family: var(--serif);
  font-size: 1.8rem;
  line-height: 1.2;
}

.demo-note {
  max-width: 42rem;
  margin-top: 0.75rem;
  color: var(--muted);
}

.demo-steps {
  display: grid;
  gap: 0.4rem;
  max-width: 42rem;
  margin-top: 1.25rem;
  padding-left: 1.4rem;
  list-style: decimal;
}

.demo-steps li::marker {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.85em;
}

.demo .actions {
  margin-top: 1.5rem;
}

.demo .button {
  font-family: inherit;
  color: inherit;
  cursor: pointer;
}

.demo-frame {
  display: block;
  width: 100%;
  height: min(46rem, 85vh);
  margin-top: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: #fff;
}

/* Footer */

.site-footer {
  margin-top: 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.5rem;
}

@media (max-width: 30rem) {
  .nav {
    gap: 0.9rem;
  }

  .skills div {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media print {
  .site-header,
  .site-footer,
  .actions,
  .skip-link {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }
}
