:root {
  color-scheme: dark;
  --bg: #1a1e23;
  --text: #eef2f5;
  --muted: #a7b0b8;
  --soft: #eef2f5;
  --accent: #8eb4cc;
  --accent-strong: #8eb4cc;
  --line: rgba(168, 188, 204, 0.34);
  --button-text: #d5e4ee;
  --button-bg: transparent;
  --button-line: rgba(168, 188, 204, 0.4);
  --button-hover: #262c33;
  --contact-color: #d5e4ee;
  --contact-border: rgba(168, 188, 204, 0.4);
  --contact-bg: #262c33;
  --contact-hover-color: #eef2f5;
  --contact-hover-border: #8eb4cc;
  --contact-hover-bg: #2c333b;
  --portrait-border: rgba(168, 188, 204, 0.34);
  --portrait-bg: #2c333b;
  --portrait-text: #eef2f5;
  --portrait-muted: #a7b0b8;
  --track-line: rgba(168, 188, 204, 0.34);
  --footer: #a7b0b8;
  --location: #a7b0b8;
  --skill-code: #8eb6ff;
  --skill-cloud: #b79cf2;
  --skill-data: #3ec8c0;
  --skill-tools: #e6c15c;
  --max: 1040px;
  --rule: rgba(168, 188, 204, 0.23);
  /* Shared dark hairline. The sticky fade starts under this line and does not tint it. */
  --rule-seen: #262b31;
  --intro-bg: #262c33;
  --intro-line: rgba(168, 188, 204, 0.34);
  --divider: linear-gradient(var(--rule-seen), var(--rule-seen));
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f4;
  --text: #1e242b;
  --muted: #4c5864;
  --soft: #1e242b;
  --accent: #2f6280;
  --accent-strong: #2f6280;
  --line: #c5ced6;
  --button-text: #2f6280;
  --button-bg: #ffffff;
  --button-line: #c9d3db;
  --button-hover: #e3e8ed;
  --contact-color: #2f6280;
  --contact-border: #c9d3db;
  --contact-bg: #ffffff;
  --contact-hover-color: #1e242b;
  --contact-hover-border: #2f6280;
  --contact-hover-bg: #e3e8ed;
  --portrait-border: #c5ced6;
  --portrait-bg: #e3e8ed;
  --portrait-text: #1e242b;
  --portrait-muted: #4c5864;
  --track-line: #c5ced6;
  --footer: #4c5864;
  --location: #4c5864;
  --skill-code: #3d6ec4;
  --skill-cloud: #7a56c4;
  --skill-data: #148f88;
  --skill-tools: #b18416;
  --rule: #d3dae0;
  --rule-seen: #d3dae0;
  --intro-bg: #ffffff;
  --intro-line: #c5ced6;
  --divider: linear-gradient(var(--rule-seen), var(--rule-seen));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

img,
svg {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p,
ul,
figure {
  margin: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.container {
  width: min(100% - 3rem, var(--max));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--rule-seen);
  box-shadow: none;
}

html[data-theme="light"] .site-header {
  background: var(--bg);
  border-bottom-color: var(--rule-seen);
}

.site-header::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 0;
  right: 0;
  /* Stay in the gap under the hairline. Intro content starts at margin-top
     1.35rem; a taller fade was blurring the name and the portrait. Blur cannot
     stay inside this gap without sampling them, so this is a short gradient. */
  top: calc(100% + 1px);
  bottom: auto;
  height: calc(1.35rem - 8px);
  pointer-events: none;
  clip-path: none;
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--bg) 72%, transparent),
    transparent
  );
  backdrop-filter: none;
  mask-image: none;
}

.header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 1rem;
  row-gap: 0.35rem;
  min-height: 62px;
  padding: 0.75rem 0 2px;
}

.section-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  align-content: center;
  gap: 0.2rem 1.1rem;
  min-width: 0;
  padding-right: 0.1rem;
}

.section-nav a {
  position: relative;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}

.section-nav a + a::before {
  content: "";
  position: absolute;
  top: 50%;
  /* Center a 1px border on the gap. A transformed 1px fill lands on
     different subpixels per link, so some ticks paint solid and others wash out. */
  right: calc(100% + 0.55rem - 0.5px);
  width: 0;
  height: 1.15rem;
  margin-top: -0.575rem;
  box-sizing: content-box;
  border-left: 1px solid var(--rule-seen);
  pointer-events: none;
}

.section-nav a:hover {
  color: var(--text);
}

.settings {
  position: relative;
  flex-shrink: 0;
  justify-self: end;
}

.settings-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.settings-toggle:hover,
.settings-toggle[aria-expanded="true"] {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 7%, transparent);
}

.settings-toggle svg {
  width: 16px;
  height: 16px;
}

.settings-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: max-content;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 8px 20px rgba(16, 22, 28, 0.14);
}

html:not([data-theme="light"]) .settings-menu {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.38);
}

.settings-menu[hidden] {
  display: none;
}

.settings-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.theme-switch {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
}

.theme-option {
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.38rem 0.62rem;
  cursor: pointer;
}

.theme-option + .theme-option {
  border-left: 1px solid var(--rule);
}

.theme-option:hover {
  color: var(--text);
}

.theme-option[aria-pressed="true"] {
  background: color-mix(in srgb, var(--text) 10%, var(--bg));
  color: var(--text);
}

.downloads {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.5rem;
  width: max-content;
  max-width: 100%;
  min-width: 0;
}

.downloads a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  border: 1px solid var(--button-line);
  background: var(--button-bg);
  color: var(--button-text);
  border-radius: 10px;
  padding: 0.38rem 0.75rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.downloads a:hover {
  background: var(--button-hover);
  border-color: var(--accent);
  color: var(--button-text);
}

.downloads svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: inherit;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem 2.5rem;
  align-items: start;
  margin-top: 1.35rem;
  margin-bottom: 2rem;
  scroll-margin-top: 66px;
}

.intro-copy {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-width: 0;
  text-align: left;
}

@media (min-width: 761px) {
  .contact {
    margin-top: auto;
  }
}

.intro-aside {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-self: end;
  gap: 0.85rem;
  width: max-content;
  min-width: 0;
  max-width: 100%;
}

.role {
  margin-top: 0.35rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.98rem;
}

.location {
  margin-top: 0.45rem;
  color: #fff;
  font-size: 0.875rem;
}

html[data-theme="light"] .location {
  color: #000;
}

.location a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.location a:hover {
  color: var(--text);
}

.location svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 3.15rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
  font-weight: 800;
}

.summary {
  margin-top: 0.85rem;
  max-width: 40rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  list-style: none;
  padding: 1.15rem 0 0;
}

.contact li {
  display: flex;
}

.contact a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.75rem;
  border: 1px solid var(--contact-border);
  border-radius: 10px;
  background: var(--contact-bg);
  color: var(--contact-color);
  font-size: 0.92rem;
  font-weight: 500;
}

.contact a:hover {
  color: var(--contact-hover-color);
  border-color: var(--contact-hover-border);
  background: var(--contact-hover-bg);
}

.contact svg {
  width: 16px;
  height: 16px;
  color: inherit;
  flex-shrink: 0;
}

.linkedin-ink {
  fill: var(--bg);
}

.portrait {
  position: relative;
  width: 0;
  min-width: 100%;
  max-width: 100%;
  align-self: stretch;
  aspect-ratio: 1;
  box-sizing: border-box;
  margin-top: 0;
  border-radius: 18px;
  overflow: hidden;
  border: 5px solid var(--accent);
  background: var(--portrait-bg);
  display: grid;
  place-items: center;
  box-shadow: none;
}

html[data-theme="light"] .portrait {
  border-color: #fff;
}

.portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  border-radius: 0;
}

.portrait:has(img) .portrait-fallback {
  display: none;
}

.portrait-fallback {
  text-align: center;
  color: var(--portrait-text);
}

.portrait-fallback strong {
  display: block;
  font-size: 4.4rem;
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: -0.04em;
}

.portrait-fallback span {
  display: block;
  margin-top: 0.35rem;
  color: var(--portrait-muted);
  font-size: 0.82rem;
}

.skills,
.experience,
.internships,
.education,
.site-footer,
.job {
  position: relative;
}

.skills,
.experience,
.internships,
.education {
  border-top: 0;
  padding: 1.45rem 0 1.6rem;
  scroll-margin-top: 66px;
}

.skills::before,
.experience::before,
.internships::before,
.education::before,
.site-footer::before {
  content: none;
}

h2 {
  font-size: clamp(1.7rem, 3vw, 1.95rem);
  letter-spacing: -0.04em;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1.15rem;
}

.skills h2::after,
.experience h2::after,
.internships h2::after,
.education h2::after {
  content: "";
  display: block;
  height: var(--rule-size, 1px);
  margin-top: calc(6px + var(--rule-shift, 0px));
  background: var(--rule-seen);
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.35rem 3rem;
}

.skill {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 0.1rem 0.7rem;
  align-items: start;
}

.skill-icon {
  color: var(--accent-strong);
  padding-top: 0.1rem;
}

.skill-icon-code {
  color: var(--skill-code);
}

.skill-icon-cloud {
  color: var(--skill-cloud);
}

.skill-icon-data {
  color: var(--skill-data);
}

.skill-icon-tools {
  color: var(--skill-tools);
}

.skill-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.skill h3 {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.skill-chips li {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.34rem 0.68rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--intro-bg);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.35;
}

.jobs {
  display: grid;
}

.job {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
  padding: 0.95rem 0;
}

.job:not(:last-child) {
  border-bottom: 1px solid transparent;
  border-image-source: var(--divider);
  border-image-slice: 1;
}

.job:first-child {
  padding-top: 0.15rem;
}

.job:last-child {
  padding-bottom: 0.15rem;
}

.job-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px;
}

.job-logo-flush {
  padding: 0;
  background: transparent;
  border-color: transparent;
}

.job-head,
.tracks li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem 1.5rem;
}

.job-head {
  flex-wrap: wrap;
}

.job h3 {
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}

.job-when {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
  white-space: nowrap;
}

.job-when-strong {
  color: var(--text);
  font-weight: 700;
}

.job-title,
.job-meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.job-title {
  margin-top: 0.12rem;
}

.job-meta {
  margin-top: 0.08rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.tracks {
  list-style: none;
  margin: 0.55rem 0 0.75rem;
  padding: 0.15rem 0 0.15rem 0.85rem;
  border-left: 1px solid var(--track-line);
}

.tracks li {
  position: relative;
  padding: 0.22rem 0 0.22rem 0.85rem;
  color: var(--soft);
  font-size: 0.95rem;
}

.tracks li::before {
  content: "+";
  position: absolute;
  left: -0.95rem;
  top: 0.28rem;
  width: 0.9rem;
  color: var(--accent-strong);
  background: var(--bg);
  font-weight: 600;
  line-height: 1;
  text-align: center;
}

.job-copy {
  max-width: 52rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.highlights {
  display: grid;
  gap: 1.15rem;
  margin-top: 0.35rem;
}

.highlights h4 {
  margin: 0 0 0.45rem;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.highlights ul {
  margin: 0;
  padding: 0 0 0 1.15rem;
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.highlights li::marker {
  color: var(--accent-strong);
}

.site-footer {
  border-top: 1px solid var(--rule-seen);
  color: var(--footer);
  font-size: 0.82rem;
  padding: 1.2rem 0;
}

@media (max-width: 760px) {
  .site-header {
    position: static;
  }

  .site-header::before {
    display: none;
  }

  .header-inner {
    align-items: center;
  }

  .section-nav a + a::before {
    content: none;
  }

  .intro,
  .skill-grid {
    grid-template-columns: 1fr;
  }

  .intro {
    margin-top: 1.35rem;
  }

  .intro-copy {
    order: 2;
    align-items: flex-start;
    text-align: left;
  }

  .intro-aside {
    display: contents;
  }

  .portrait {
    order: 1;
    justify-self: center;
    align-self: center;
    width: min(100%, max(17rem, 72%));
    min-width: 0;
    max-width: 100%;
  }

  .contact {
    justify-content: flex-start;
  }

  .downloads {
    order: 3;
    justify-self: stretch;
    width: 100%;
    max-width: 100%;
    align-items: stretch;
    justify-content: flex-start;
  }

  .downloads a {
    width: 100%;
  }

  .job-head,
  .tracks li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
  }

  .job-when {
    text-align: left;
    white-space: normal;
  }
}

@media (max-width: 520px) {
  .container {
    width: min(100% - 1.5rem, var(--max));
  }

  .header-inner {
    align-items: center;
    column-gap: 0.7rem;
  }

  .section-nav {
    gap: 0.15rem 0.8rem;
  }

  .contact {
    gap: 0.5rem;
  }

  h1 {
    font-size: clamp(2.05rem, 11vw, 2.6rem);
  }
}

@media print {
  .downloads,
  .settings,
  .settings-menu {
    display: none !important;
  }

  .site-header {
    display: none !important;
  }

  .tracks li::before {
    position: static;
    background: #fff;
  }

  .site-header::before {
    display: none;
  }

  body {
    background: #fff;
    color: #172033;
  }

  .intro {
    margin: 0;
    padding: 0 0 1rem;
    background: transparent;
    border: 0;
    border-radius: 0;
  }

  .role,
  .contact svg,
  .tracks li::before {
    color: #1d4e89;
  }

  .skill-icon {
    print-color-adjust: exact;
  }

  .summary,
  .location,
  .job-when,
  .job-title,
  .job-meta,
  .job-copy,
  .highlights,
  .site-footer,
  .portrait-fallback span {
    color: #3d4d61;
  }

  .skill-chips li {
    color: #1d4e89;
    border-color: #c5d0dc;
    background: transparent;
  }

  .contact a {
    color: #1d4e89;
    border-color: #c5d0dc;
    background: transparent;
  }

  .portrait,
  .job-logo {
    border-color: #d5deea;
    print-color-adjust: exact;
  }

  .portrait {
    background: #eef3f8;
    color: #172033;
    box-shadow: none;
  }

  .skills h2::after,
  .experience h2::after,
  .internships h2::after,
  .education h2::after {
    height: 1px;
    margin-top: 6px;
    background: #9aabbc;
  }

  .site-footer {
    border-top: 1px solid #9aabbc;
  }

  .job:not(:last-child) {
    border-bottom: 1px solid #9aabbc;
    border-image: none;
  }

  .tracks {
    border-color: #d7e0ea;
  }

  a {
    text-decoration: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
