:root {
  color-scheme: dark;
  --background: #111212;
  --text: #e6e6e3;
  --muted: #9a9d99;
  --faint: #6e716e;
  --line: #2a2c2b;
  --link: #d4d7d3;
  --accent: #a9d5b7;
  --header: rgba(17, 18, 18, 0.94);
  --code: #171918;
}

[data-theme="light"] {
  color-scheme: light;
  --background: #f6f6f3;
  --text: #202220;
  --muted: #626762;
  --faint: #898d89;
  --line: #d9dbd7;
  --link: #272b28;
  --accent: #27643b;
  --header: rgba(246, 246, 243, 0.94);
  --code: #edeee9;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

a {
  color: var(--link);
  text-underline-offset: 4px;
}

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

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

.wrap {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 20;
  padding: 6px 10px;
  background: var(--text);
  color: var(--background);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: var(--header);
  backdrop-filter: blur(8px);
}

.nav {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.name {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links a,
#theme-toggle {
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  text-decoration: none;
}

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

#theme-toggle {
  padding: 2px 0 2px 14px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}

#theme-toggle:hover {
  color: var(--text);
}

.home {
  min-height: calc(100vh - 64px);
  padding-block: 110px 90px;
}

.intro {
  max-width: 670px;
}

.label,
.page-kicker,
.project-number,
.meta-label {
  margin-bottom: 12px;
  color: var(--accent);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}

h1,
h2,
h3 {
  line-height: 1.25;
}

h1 {
  margin: 0 0 22px;
  font-size: clamp(2.5rem, 7vw, 4.25rem);
  letter-spacing: -0.04em;
}

h2 {
  margin: 0 0 16px;
  font-size: 1.45rem;
  letter-spacing: -0.015em;
}

h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

p {
  margin-top: 0;
}

.intro-copy,
.page-intro {
  color: var(--muted);
  font-size: 1.08rem;
}

.availability {
  margin: 22px 0 0;
  color: var(--text);
  font-size: 0.92rem;
}

.intro-links {
  display: flex;
  margin-top: 34px;
  gap: 24px;
  flex-wrap: wrap;
}

.intro-links a {
  font-size: 0.92rem;
}

.terminal-note {
  margin-top: 90px;
  padding: 4px 0 4px 22px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.82rem;
}

.terminal-note p {
  margin-bottom: 5px;
}

.terminal-note span {
  color: var(--accent);
}

.terminal-output {
  padding-left: 18px;
}

.home-about {
  display: grid;
  max-width: 1000px;
  margin-top: 100px;
  padding-top: 45px;
  border-top: 1px solid var(--line);
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 70px;
}

.home-about-copy p,
.home-about-details dd {
  color: var(--muted);
}

.home-about-copy p:not(.label) {
  max-width: 620px;
}

.home-about-details {
  margin: 0;
}

.home-about-details div {
  padding-block: 16px;
  border-top: 1px solid var(--line);
}

.home-about-details div:first-child {
  padding-top: 0;
  border-top: 0;
}

.home-about-details dt {
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 600;
}

.home-about-details dd {
  margin: 0;
  font-size: 0.9rem;
}

.home-profile-links {
  display: flex;
  gap: 18px;
}

.home-note {
  max-width: 670px;
  margin-top: 90px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.home-note p,
.prose p,
.project-summary,
.project-section p,
.project-section li,
.skills-list li,
.education-row p {
  color: var(--muted);
}

.page {
  padding-block: 64px 88px;
}

.page-header {
  max-width: 700px;
  margin-bottom: 85px;
}

.page-header h1 {
  font-size: clamp(2.3rem, 6vw, 3.5rem);
}

.project {
  padding-block: 64px;
  border-top: 1px solid var(--line);
}

.project:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.project-title {
  margin-bottom: 16px;
  font-size: clamp(1.7rem, 4vw, 2.35rem);
}

.project-summary {
  max-width: 720px;
  margin-bottom: 34px;
  font-size: 1.03rem;
}

.project-header {
  max-width: 860px;
  margin-bottom: 42px;
}

.project-facts {
  display: grid;
  margin: 0 0 56px;
  padding-block: 20px;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  border-block: 1px solid var(--line);
}

.project-facts div {
  min-width: 0;
}

.project-facts dt {
  margin-bottom: 4px;
  color: var(--faint);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.project-facts dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.case-study {
  min-width: 0;
  max-width: 920px;
}

.case-study > section {
  padding-block: 38px;
  scroll-margin-top: 88px;
  border-top: 1px solid var(--line);
}

.case-study > section:first-child {
  padding-top: 0;
  border-top: 0;
}

.case-study h2 {
  margin-bottom: 22px;
}

.case-study p,
.case-study li,
.project-figure figcaption {
  color: var(--muted);
}

.case-study p {
  max-width: 850px;
}

.project-figure {
  margin: 10px 0 38px;
}

.project-figure img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

.project-figure figcaption {
  margin-top: 12px;
  font-size: 0.78rem;
}

.project-figure.narrow-figure {
  max-width: 620px;
}

.table-scroll {
  max-width: 100%;
  margin-top: 26px;
  overflow-x: auto;
}

.plain-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  line-height: 1.45;
}

.plain-table th,
.plain-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.plain-table th {
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 600;
}

.plain-table td {
  color: var(--muted);
}

.plain-table a {
  white-space: nowrap;
}

.compact-table td:first-child,
.compact-table td:last-child {
  white-space: nowrap;
}

.finding-table th:nth-child(1) {
  width: 17%;
}

.finding-table th:nth-child(2) {
  width: 16%;
}

.finding-table th:nth-child(3),
.finding-table th:nth-child(4) {
  width: 33.5%;
}

.detail-note {
  margin-top: 20px;
  font-size: 0.86rem;
}

.section-kicker {
  margin-bottom: 8px;
  color: var(--accent) !important;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.system-role {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.command-inline {
  color: var(--text);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.92em;
}

.hash-value {
  overflow-wrap: anywhere;
  font-family: "Courier New", Courier, monospace;
}

.work-list,
.method-list {
  max-width: 850px;
  margin: 26px 0 0;
  padding-left: 22px;
}

.work-list li + li,
.method-list li + li {
  margin-top: 12px;
}

.method-list li {
  padding-left: 5px;
}

.method-list strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
}

.skill-tags {
  display: flex;
  margin: 24px 0 0;
  padding: 0;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.skill-tags li {
  padding: 6px 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.72rem;
}

.project-layout {
  display: grid;
  grid-template-columns: 165px minmax(0, 1fr);
  gap: 44px;
  align-items: start;
}

.project-toc {
  position: sticky;
  top: 92px;
  padding-top: 3px;
}

.project-toc > p {
  margin-bottom: 15px;
  color: var(--faint);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.project-toc nav {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.project-toc a {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
  text-decoration: none;
}

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

.project-index-header {
  margin-bottom: 52px;
}

.project-list {
  border-bottom: 1px solid var(--line);
}

.project-preview {
  display: grid;
  padding-block: 38px 44px;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 45px;
  border-top: 1px solid var(--line);
}

.project-preview-label p {
  margin-bottom: 5px;
  color: var(--accent);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.75rem;
}

.project-preview-label span {
  display: block;
  color: var(--faint);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.7rem;
}

.project-preview-label .project-date {
  margin-top: 8px;
  color: var(--muted);
}

.project-preview-content {
  max-width: 720px;
}

.project-preview-content h2 {
  margin-bottom: 14px;
  font-size: 1.75rem;
}

.project-preview-content > p {
  color: var(--muted);
}

.project-preview-meta {
  display: flex;
  margin: 22px 0 25px;
  padding: 0;
  flex-wrap: wrap;
  gap: 7px 18px;
  list-style: none;
}

.project-preview-meta li {
  color: var(--faint);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.7rem;
}

.project-link {
  font-size: 0.88rem;
}

.project-pagination {
  display: flex;
  margin-top: 48px;
  padding-top: 28px;
  justify-content: space-between;
  border-top: 1px solid var(--line);
}

.project-pagination:empty {
  display: none;
}

.project-pagination a {
  font-size: 0.85rem;
}

.project-pagination .next {
  margin-left: auto;
  text-align: right;
}

.project-meta {
  display: grid;
  margin-bottom: 42px;
  padding-block: 18px;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  border-block: 1px solid var(--line);
}

.project-meta p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.project-meta .meta-label {
  display: block;
  margin-bottom: 3px;
  color: var(--faint);
}

.project-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px 55px;
}

.project-section ol,
.project-section ul,
.skills-list {
  margin: 0;
  padding-left: 20px;
}

.project-section li + li,
.skills-list li + li {
  margin-top: 7px;
}

.project-section code {
  padding: 2px 5px;
  background: var(--code);
  color: var(--text);
  font-size: 0.85em;
}

.placeholder-note {
  margin-bottom: 45px;
  padding: 14px 16px;
  border-left: 2px solid var(--accent);
  background: var(--code);
  color: var(--muted);
  font-size: 0.88rem;
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(220px, 0.7fr);
  gap: 70px;
}

.prose section + section {
  margin-top: 52px;
  padding-top: 44px;
  border-top: 1px solid var(--line);
}

.sidebar-section + .sidebar-section {
  margin-top: 45px;
}

.skills-list {
  font-size: 0.92rem;
}

.education-row {
  padding-block: 18px;
  border-top: 1px solid var(--line);
}

.education-row strong,
.education-row p {
  display: block;
}

.education-row p {
  margin: 3px 0 0;
  font-size: 0.9rem;
}

@media (max-width: 700px) {
  .wrap {
    width: min(100% - 30px, 900px);
  }

  .nav {
    min-height: 82px;
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
  }

  .nav-links {
    width: 100%;
    gap: 15px;
    overflow-x: auto;
    white-space: nowrap;
  }

  .nav-links a,
  #theme-toggle {
    font-size: 0.8rem;
  }

  .home {
    padding-block: 72px;
  }

  .terminal-note,
  .home-note {
    margin-top: 65px;
  }

  .page {
    padding-block: 64px 85px;
  }

  .page-header {
    margin-bottom: 60px;
  }

  .project {
    padding-block: 52px;
  }

  .project-meta,
  .project-body,
  .about-grid,
  .home-about,
  .project-facts {
    grid-template-columns: 1fr;
  }

  .project-meta {
    gap: 15px;
  }

  .project-body,
  .about-grid {
    gap: 35px;
  }

  .project-facts {
    margin-bottom: 60px;
    gap: 16px;
  }

  .project-figure {
    margin-inline: -15px;
  }

  .project-figure figcaption {
    padding-inline: 15px;
  }

  .project-layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .project-toc {
    position: static;
    padding: 0 0 24px;
    border-bottom: 1px solid var(--line);
  }

  .project-toc nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 18px;
  }

  .project-preview {
    grid-template-columns: 1fr;
    gap: 20px;
  }

}

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