:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #eef1ec;
  --text: #18201e;
  --text-muted: #5c6864;
  --line: #cfd7d2;
  --line-strong: #9eaaa5;
  --accent: #0d765f;
  --accent-strong: #075a49;
  --accent-soft: #d9eee7;
  --focus: #b45f06;
  --header-bg: rgba(246, 247, 244, 0.9);
  --shadow: 0 18px 55px rgba(32, 52, 46, 0.08);
  --content-width: 1180px;
  --header-height: 76px;
  --radius: 4px;
  --font-sans: Inter, Aptos, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-serif: Iowan Old Style, Palatino Linotype, "Book Antiqua", Palatino, Georgia, serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

:root[data-theme="dark"] {
  --bg: #101615;
  --surface: #151d1b;
  --surface-soft: #1c2724;
  --text: #edf3f0;
  --text-muted: #a5b3ae;
  --line: #34413d;
  --line-strong: #596862;
  --accent: #65c9ae;
  --accent-strong: #8ee0ca;
  --accent-soft: #173c33;
  --focus: #f0b45f;
  --header-bg: rgba(16, 22, 21, 0.9);
  --shadow: 0 22px 65px rgba(0, 0, 0, 0.25);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--line) 24%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--line) 16%, transparent) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, black, transparent 38%);
  content: "";
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

svg {
  display: block;
}

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

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  transform: translateY(-160%);
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
}

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

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

.nav-shell {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(calc(100% - 40px), var(--content-width));
  min-height: var(--header-height);
  margin: 0 auto;
}

.brand {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--text);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}

.brand:hover {
  background: var(--text);
  color: var(--bg);
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 38px);
}

.primary-nav a,
.header-link,
.mobile-menu a {
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-decoration: none;
}

.primary-nav a::after,
.header-link::after {
  position: absolute;
  right: 0;
  bottom: -5px;
  left: 0;
  height: 1px;
  transform: scaleX(0);
  transform-origin: right;
  background: var(--accent);
  content: "";
  transition: transform 180ms ease;
}

.primary-nav a:hover::after,
.primary-nav a.is-active::after,
.header-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.theme-icon,
.menu-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.theme-icon--moon,
:root[data-theme="dark"] .theme-icon--sun {
  display: none;
}

:root[data-theme="dark"] .theme-icon--moon {
  display: block;
}

.external-mark {
  margin-left: 4px;
  color: var(--accent);
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

:root[data-theme="dark"] .button {
  color: #07120f;
}

.button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.button--small {
  min-height: 40px;
  padding: 0 16px;
  font-size: 0.75rem;
}

.button.is-current {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--accent);
}

.menu-toggle,
.mobile-menu {
  display: none;
}

.section-shell,
.site-footer {
  width: min(calc(100% - 40px), var(--content-width));
  margin-inline: auto;
}

.hero {
  display: flex;
  min-height: min(760px, calc(100vh - var(--header-height)));
  align-items: center;
  padding-block: clamp(88px, 12vw, 160px);
}

.hero-copy {
  max-width: 980px;
}

.eyebrow,
.hero-label {
  margin: 0 0 20px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 980px;
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(4.4rem, 10vw, 9rem);
  font-weight: 720;
  letter-spacing: -0.075em;
  line-height: 0.92;
}

.contact-hero h1,
.error-page h1 {
  max-width: 830px;
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(3.2rem, 7.2vw, 6.7rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.97;
}

.hero-details {
  display: grid;
  max-width: 920px;
  grid-template-columns: minmax(320px, 1.1fr) minmax(320px, 0.9fr);
  gap: clamp(42px, 8vw, 100px);
  margin-top: clamp(46px, 7vw, 76px);
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.hero-label {
  margin-bottom: 10px;
  font-size: 0.68rem;
}

.hero-detail {
  margin: 0;
  font-size: clamp(1.08rem, 1.8vw, 1.32rem);
  font-weight: 650;
  line-height: 1.5;
}

.hero-subdetail {
  max-width: 600px;
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  margin-top: 34px;
}

.text-link,
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.text-link span,
.back-link span {
  color: var(--accent);
  transition: transform 160ms ease;
}

.text-link:hover span {
  transform: translateX(4px);
}

.back-link:hover span {
  transform: translateX(-4px);
}

.profile-ledger {
  border-top: 2px solid var(--text);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  box-shadow: var(--shadow);
}

.ledger-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.ledger-heading p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
}

.status span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.profile-ledger dl {
  margin: 0;
}

.profile-ledger dl > div {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) 1.3fr;
  gap: 16px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}

.profile-ledger dl > div:last-child {
  border-bottom: 0;
}

.profile-ledger dt {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.profile-ledger dd {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.45;
  text-align: right;
}

.content-section {
  padding-block: clamp(96px, 12vw, 152px);
  scroll-margin-top: calc(var(--header-height) + 12px);
}

#projects {
  padding-top: clamp(72px, 8vw, 108px);
}

.content-section + .content-section {
  border-top: 1px solid var(--line);
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 0.75fr);
  gap: 50px;
  align-items: end;
  margin-bottom: clamp(48px, 7vw, 84px);
}

.section-heading .eyebrow {
  margin-bottom: 12px;
}

.section-heading h2,
.closing-section h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(2.8rem, 5.5vw, 5.2rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 1;
}

.section-heading > p {
  max-width: 540px;
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 1.03rem;
}

.section-heading--simple {
  grid-template-columns: 1fr;
}

.project {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 22px;
  padding-block: clamp(38px, 5vw, 60px);
  border-top: 1px solid var(--line);
}

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

.project-number,
.skill-index {
  margin: 5px 0 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.project-intro {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.15fr);
  gap: clamp(36px, 7vw, 96px);
}

.project-kicker,
.experience-role {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  line-height: 1.5;
  text-transform: uppercase;
}

.project h3,
.experience-card h3,
.skill-card h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.55rem, 2.6vw, 2.35rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.project-intro > p {
  margin: 0;
  color: var(--text-muted);
}

.project-details {
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(280px, 0.85fr);
  gap: clamp(36px, 7vw, 96px);
  margin-top: 30px;
}

.project-details ul,
.experience-content ul {
  margin: 0;
  padding-left: 1.2rem;
}

.project-details li,
.experience-content li {
  padding-left: 0.35rem;
}

.project-details li + li,
.experience-content li + li {
  margin-top: 10px;
}

.project-details li::marker,
.experience-content li::marker {
  color: var(--accent);
}

.tag-group {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
}

.tag-group span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.25;
}

.experience-card {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(400px, 1.3fr);
  gap: clamp(48px, 10vw, 130px);
  padding: clamp(34px, 5vw, 60px);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.experience-meta > p:last-child {
  margin-top: 18px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.experience-content > p {
  margin: 0 0 26px;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  line-height: 1.5;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 36px;
  border: 1px solid var(--line);
  background: var(--line);
}

.metric-row > div {
  display: flex;
  min-height: 116px;
  flex-direction: column;
  justify-content: center;
  padding: 18px;
  background: var(--surface-soft);
}

.metric-row strong {
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1;
}

.metric-row span {
  margin-top: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  line-height: 1.4;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.skill-card {
  min-height: 320px;
  padding: clamp(28px, 5vw, 52px);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.skill-card .skill-index {
  margin-bottom: 30px;
}

.skill-card h3 {
  margin-bottom: 28px;
}

.plain-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plain-list li {
  position: relative;
  padding-left: 15px;
  color: var(--text-muted);
}

.plain-list li::before {
  position: absolute;
  top: 0.77em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.closing-section {
  display: grid;
  grid-template-columns: minmax(320px, 1.2fr) minmax(300px, 0.8fr);
  gap: clamp(50px, 10vw, 130px);
  align-items: end;
  padding-block: clamp(96px, 13vw, 164px);
  border-top: 1px solid var(--line);
}

.closing-section h2 {
  max-width: 760px;
  font-size: clamp(2.5rem, 5vw, 4.7rem);
}

.closing-section > div:last-child p {
  margin: 0 0 28px;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.site-footer {
  padding-block: 38px 26px;
  border-top: 1px solid var(--line);
}

.footer-inner,
.footer-rule {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
}

.footer-brand {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 600;
  text-decoration: none;
}

.footer-inner p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

.footer-inner nav {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
}

.footer-inner nav a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.footer-rule {
  margin-top: 34px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.contact-hero {
  max-width: 960px;
  padding-top: clamp(72px, 9vw, 118px);
  padding-bottom: clamp(44px, 6vw, 70px);
}

.contact-hero h1 {
  max-width: 780px;
  font-size: clamp(3.8rem, 8vw, 7.2rem);
}

.contact-options {
  max-width: 960px;
  padding-bottom: clamp(80px, 10vw, 120px);
}

.contact-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 28px 8px;
  border-top: 1px solid var(--line);
  text-decoration: none;
  transition: padding 180ms ease, background-color 180ms ease;
}

.contact-card:last-child {
  border-bottom: 1px solid var(--line);
}

.contact-card:hover {
  padding-inline: 18px;
  background: var(--surface-soft);
}

.contact-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.contact-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.contact-card > span:nth-child(2) {
  display: grid;
}

.contact-label {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contact-card strong {
  overflow-wrap: anywhere;
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 600;
  line-height: 1.25;
}

.contact-card small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.contact-arrow {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 1.4rem;
}

.copy-feedback {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  margin: 0;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--text);
  box-shadow: var(--shadow);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.copy-feedback[hidden] {
  display: none;
}

.error-page {
  display: flex;
  min-height: calc(100vh - var(--header-height));
  flex-direction: column;
  justify-content: center;
  padding-block: 90px;
}

.error-page h1 {
  font-size: clamp(3.5rem, 8vw, 7.4rem);
}

.error-page > p:not(.eyebrow) {
  margin: 28px 0;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.error-page .button {
  align-self: flex-start;
}

@media (max-width: 960px) {
  .hero-details {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .project-intro,
  .project-details,
  .experience-card {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .experience-card {
    gap: 40px;
  }

  .closing-section {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .closing-section > div:last-child {
    max-width: 600px;
  }
}

@media (max-width: 780px) {
  :root {
    --header-height: 68px;
  }

  .nav-shell {
    display: flex;
    width: min(calc(100% - 28px), var(--content-width));
    justify-content: space-between;
  }

  .primary-nav,
  .desktop-action {
    display: none;
  }

  .menu-toggle {
    display: inline-grid;
  }

  .mobile-menu {
    position: absolute;
    top: calc(100% + 1px);
    right: 0;
    left: 0;
    z-index: 49;
    padding: 12px 20px 22px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    box-shadow: var(--shadow);
  }

  .mobile-menu:not([hidden]) {
    display: grid;
  }

  .mobile-menu a {
    padding: 14px 2px;
    border-bottom: 1px solid var(--line);
  }

  .mobile-menu a:last-child {
    border-bottom: 0;
  }

  .menu-toggle.is-open .menu-line--top {
    transform: translateY(4px) rotate(45deg);
    transform-origin: center;
  }

  .menu-toggle.is-open .menu-line--bottom {
    transform: translateY(-4px) rotate(-45deg);
    transform-origin: center;
  }

  .menu-line {
    transition: transform 160ms ease;
  }

  .section-heading {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .section-heading > p {
    margin: 0;
  }

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

  .skill-card {
    min-height: auto;
  }
}

@media (max-width: 600px) {
  .section-shell,
  .site-footer {
    width: min(calc(100% - 28px), var(--content-width));
  }

  .hero {
    min-height: auto;
    padding-block: 72px 64px;
  }

  #projects {
    padding-top: 72px;
  }

  .hero h1 {
    font-size: clamp(3.35rem, 18vw, 5.1rem);
    letter-spacing: -0.065em;
  }

  .hero-details {
    margin-top: 42px;
    padding-top: 24px;
  }

  .hero-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-ledger dl > div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .profile-ledger dd {
    text-align: left;
  }

  .ledger-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .project {
    grid-template-columns: 38px 1fr;
    gap: 10px;
  }

  .project-intro,
  .project-details {
    gap: 24px;
  }

  .metric-row {
    grid-template-columns: 1fr;
  }

  .metric-row > div {
    min-height: 94px;
  }

  .experience-card {
    padding: 28px 22px;
  }

  .closing-section {
    gap: 36px;
  }

  .footer-inner,
  .footer-rule {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-rule {
    gap: 4px;
  }

  .contact-hero h1 {
    font-size: clamp(3.25rem, 17vw, 5rem);
  }

  .contact-card {
    grid-template-columns: 40px 1fr;
    gap: 16px;
  }

  .contact-icon {
    width: 38px;
    height: 38px;
  }

  .contact-arrow {
    display: none;
  }

  .contact-card small {
    font-size: 0.7rem;
  }

  .copy-feedback {
    right: 14px;
    bottom: 14px;
    left: 14px;
    text-align: center;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
