@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;450;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --paper: #fbf8f2;
  --ink: #172b2a;
  --muted: #465b56;
  --accent: #006052;
  --rule: #c8d4ca;
  --surface: #edf3ed;
  --action-text: #fff;
  --action-hover: #004b40;
  --selection: #cce8dd;
  --page-width: 1600px;
  --gutter: clamp(20px, 4vw, 72px);
  --body: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --display: Manrope, "DM Sans", "Segoe UI", system-ui, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #101c1a;
  --ink: #ecf3ec;
  --muted: #b6c7bf;
  --accent: #8edcc8;
  --rule: #374f48;
  --surface: #1a2d28;
  --action-text: #102421;
  --action-hover: #b0eddd;
  --selection: #30594e;
}

@media (prefers-reduced-motion: no-preference) {
  :root :where(body, body *, body *::before, body *::after) {
    transition:
      background-color 240ms ease-in-out,
      border-color 240ms ease-in-out,
      outline-color 240ms ease-in-out,
      text-decoration-color 240ms ease-in-out;
  }

  /* Inherited text follows its parent's animated color without starting another transition. */
  :root :where(
    body, a, .brand, .nav nav a, .theme-picker button,
    .overview-byline, .overview-location, .overview-summary,
    .highlight-list span, .project-back, .project-copy p,
    .timeline p, .about-copy p, .tags, summary, .state-path strong,
    .state-path li + li::before, .dates, .timeline .company, .skills-grid p, .skills-grid b,
    .training-item h4 span, .contact-links button, footer
  ) {
    transition:
      color 240ms ease-in-out,
      background-color 240ms ease-in-out,
      border-color 240ms ease-in-out,
      outline-color 240ms ease-in-out,
      text-decoration-color 240ms ease-in-out;
  }
}

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

html { scroll-padding-top: 24px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--body);
}

a { color: var(--accent); text-underline-offset: .22em; }
a:hover { text-decoration-thickness: 2px; }

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

::selection { background: var(--selection); color: var(--ink); }

h1, h2, h3, h4, p, figure { margin: 0; }
h1, h2, h3, h4 { line-height: 1.2; }

h1, .section > h2, .section-heading > h2 {
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -.045em;
}

.brand, .highlight-list strong, .project-copy h3, .timeline h3 {
  font-family: var(--display);
}

.section > h2, .section-heading > h2 { font-size: clamp(33px, 4vw, 44px); }

.nav, main, footer {
  width: min(var(--page-width), calc(100% - var(--gutter) * 2));
  margin-inline: auto;
}

.nav {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  border-bottom: 1px solid var(--rule);
}

.mobile-navigation { display: none; }

.brand {
  color: var(--ink);
  font-weight: 700;
  font-size: 19px;
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: -.035em;
  line-height: 1.2;
}

.nav nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px clamp(14px, 2.8vw, 32px);
}

.nav nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--muted);
  font-size: 14px;
  padding-block: 0;
  line-height: 1.2;
  text-decoration: none;
}

.nav a:hover { color: var(--accent); text-decoration: underline; }

.nav nav a[aria-current="location"] {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: .35em;
}

.theme-picker:not([hidden]) {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  justify-self: end;
  flex-shrink: 0;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--rule);
  border-radius: 4px;
}

.theme-picker button {
  border: 0;
  border-radius: 2px;
  padding: 5px 9px;
  background: transparent;
  color: var(--muted);
  font: 600 13px/1.25 var(--body);
  cursor: pointer;
}

.theme-picker button:hover { color: var(--ink); }

.theme-picker button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
}

.overview { padding-block: clamp(38px, 5vw, 64px); }

.overview-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(28px, 5vw, 84px);
}

.overview-byline {
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  margin-bottom: 13px;
  text-transform: uppercase;
}

.overview-location { color: var(--muted); white-space: nowrap; }

h1 {
  font-size: clamp(48px, 7vw, 83px);
  line-height: .99;
  max-width: 10ch;
  margin-bottom: 22px;
}

.overview-summary {
  max-width: 51ch;
  color: var(--muted);
  font-size: clamp(16px, 1.8vw, 19px);
}

.overview-actions, .contact-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 23px;
}

.overview-actions {
  margin-top: 26px;
  font-size: 14px;
  font-weight: 600;
}

.overview-actions span, .text-link span { margin-left: 4px; }

.primary-action {
  display: inline-block;
  padding: 9px 14px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--accent);
  color: var(--action-text);
  text-decoration: none;
}

.primary-action:hover { background: var(--action-hover); }

.contribution-snapshot {
  border-top: 2px solid var(--ink);
  padding-top: 12px;
}

.contribution-snapshot h2 {
  font-size: 18px;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}

.highlight-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.highlight-list a {
  position: relative;
  display: block;
  padding: 11px 28px 11px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}

.highlight-list a::after {
  content: "";
  position: absolute;
  top: 20px;
  right: 6px;
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 1px 1px 0 0;
  transform: rotate(45deg);
}

.highlight-list a:hover strong { text-decoration: underline; }
.highlight-list strong { display: block; font-size: 16px; }
.highlight-list span {
  display: block;
  max-width: 62ch;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
  margin-top: 2px;
}

.section { border-top: 1px solid var(--rule); padding-block: 34px 44px; }
.work { --project-divider-gap: 30px; }
.work > h2 { margin-bottom: 8px; }

.project-back:not([hidden]) {
  display: block;
  width: fit-content;
  margin-top: 16px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: 600 14px/1.4 var(--body);
  text-align: left;
  text-decoration: underline;
  text-underline-offset: .22em;
  cursor: pointer;
}

.project {
  padding-block: 25px var(--project-divider-gap);
}

.project + .project { border-top: 1px solid var(--rule); }
.project:last-of-type { padding-bottom: 0; }

.project[data-highlighted] .project-copy {
  background-color: color-mix(in srgb, var(--accent) 8%, var(--paper));
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 8%, var(--paper)), 0 0 0 8px var(--accent);
}

.project:focus-visible { outline: none; }
.project:focus-visible > .project-copy {
  outline: 2px solid var(--accent);
  outline-offset: 7px;
}

@media (prefers-reduced-motion: no-preference) {
  .project-copy { transition: background-color 220ms ease-out, box-shadow 220ms ease-out; }
}

.project-copy h3 {
  font-size: clamp(23px, 3vw, 30px);
  font-weight: 600;
  letter-spacing: -.035em;
}

.project-context {
  display: block;
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0 12px;
}

.project-copy p, .timeline p, .about-copy p { color: var(--muted); }
.project-copy p, .timeline p { max-width: 72ch; }
.project-copy p + p, .timeline p + p { margin-top: 9px; }

.tags {
  display: flex;
  flex-wrap: wrap;
  column-gap: 8px;
  margin: 13px 0;
  color: var(--muted);
  font-size: 13px;
}

.tags span + span::before { content: "·"; margin-right: 8px; }

details { margin-top: 13px; }

summary {
  width: fit-content;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  padding-block: 5px;
  cursor: pointer;
}

summary:hover { text-decoration: underline; text-underline-offset: .22em; }

.detail {
  margin-top: 10px;
  padding-left: 16px;
  border-left: 1px solid var(--rule);
}

.detail h4 { margin: 16px 0 5px; font-size: 15px; }

.project details[data-typing] .detail {
  block-size: var(--project-typed-height, 0px);
  overflow: clip;
  transition: block-size 75ms ease-out;
}

.project details[data-collapsing] .detail {
  overflow: clip;
  transition: none;
}

@media not all and (min-width: 1100px) and (orientation: landscape) {
  .section.work { padding-block-end: var(--project-divider-gap); }

  .project .detail {
    display: flow-root;
    margin-block-start: 16px;
  }

  .project .detail > h4:first-child { margin-block-start: 0; }

  .project details:not([open]) .detail { margin-block-start: 0; }

  .project details[data-typing]:not([data-collapsing]) .detail {
    margin-block-start: min(var(--project-typed-height, 0px), 16px);
    transition: block-size 75ms ease-out, margin-block-start 75ms ease-out;
  }
}

::highlight(project-untyped) {
  color: transparent;
  text-shadow: none;
}

.state-comparison {
  container-type: inline-size;
  max-width: 44rem;
  margin-top: 12px;
  padding: 12px 14px;
  border-left: 2px solid var(--accent);
  background: var(--surface);
  font-size: 14px;
}

.state-comparison figcaption {
  margin-bottom: 8px;
  font-weight: 700;
}

.state-path { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); gap: 6px; }
.state-path + .state-path { margin-top: 6px; }
.state-path strong { color: var(--accent); }

.state-path ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.state-path li + li::before {
  content: "→" / "";
  margin-right: 8px;
  color: var(--accent);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 17px;
}

.text-link { font-size: 14px; }

.timeline article {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(0, 3.5fr);
  gap: 6px 24px;
  padding-block: 20px;
  border-bottom: 1px solid var(--rule);
}

.timeline article:last-child { border: 0; padding-bottom: 0; }

.dates {
  padding-top: 3px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .025em;
  font-variant-numeric: tabular-nums;
}

.timeline h3 { font-size: 20px; letter-spacing: -.02em; }
.timeline .company { margin-top: 4px; color: var(--ink); font-size: 14px; }

.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px 25px;
  margin-top: 24px;
}

.skills-grid h3 { font-size: 15px; margin-bottom: 7px; }
.skills-grid p { color: var(--muted); font-size: 14px; }
.skills-grid b { color: var(--ink); font-weight: 500; }
.skills-grid .training-label { margin-top: 4px; font-size: 13px; }

.about, .contact {
  display: grid;
  grid-template-columns: minmax(155px, 1fr) minmax(0, 3.5fr);
  gap: 14px 24px;
}

.about-copy { max-width: 68ch; }
.education { margin-top: 24px; }
.education h3 { font-size: 19px; margin-bottom: 12px; }

.training-item + .training-item {
  border-top: 1px solid var(--rule);
  margin-top: 13px;
  padding-top: 13px;
}

.training-item h4 { font-size: 15px; margin-bottom: 4px; }
.training-item h4 span { color: var(--muted); font-weight: 400; margin-left: 5px; }
.training-item p { font-size: 14px; }

.contact-email {
  width: fit-content;
  font-size: clamp(17px, 3vw, 26px);
  overflow-wrap: anywhere;
}

.contact-links {
  margin-top: 9px;
  font-size: 14px;
}

.contact-links button {
  border: 0;
  background: none;
  padding: 5px 0;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: .22em;
  cursor: pointer;
}

.contact-links button:hover { text-decoration-thickness: 2px; }

footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  border-top: 1px solid var(--rule);
  padding-block: 16px 28px;
  color: var(--muted);
  font-size: 13px;
}

.skip {
  position: absolute;
  top: 8px;
  left: var(--gutter);
  transform: translateY(calc(-100% - 12px));
  background: var(--paper);
  padding: 8px 12px;
  z-index: 1;
}

.skip:focus { transform: none; }

@media (min-width: 1100px) and (orientation: landscape) {
  .work {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    column-gap: clamp(24px, 3vw, 48px);
    row-gap: 20px;
  }

  .work > h2 {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }

  .work > .project {
    border-top: 1px solid var(--rule);
    padding-block: 18px 0;
  }

  .work[data-focus] > .project:not(:has(details[open])) { display: none; }

  .work[data-focus] > .project:has(details[open]) {
    grid-column: 1 / -1;
    width: min(100%, 50rem);
    margin-inline: auto;
  }
}

@media (min-width: 1100px) and (orientation: landscape) and (prefers-reduced-motion: no-preference) {
  .work[data-focus], .work.project-layout-moving {
    position: relative;
    overflow-x: clip;
  }

  .work[data-focus] > .project:not(:has(details[open])) {
    --exit-direction: 1;
    display: block;
    position: absolute;
    grid-column: var(--original-column) / span 1;
    grid-row: 2 / 3;
    inset: 0 0 auto;
    pointer-events: none;
    animation: project-exit 420ms cubic-bezier(.24, .52, .28, 1) both;
  }

  .work[data-focus] > .project:nth-of-type(1) { --original-column: 1; }
  .work[data-focus] > .project:nth-of-type(2) { --original-column: 2; }
  .work[data-focus] > .project:nth-of-type(3) { --original-column: 3; }

  .work[data-focus] > .project:has(~ .project details[open]) { --exit-direction: -1; }

  .work[data-focus] > .project:has(details[open]), .work > .project-motion {
    position: relative;
    z-index: 1;
    background: var(--paper);
  }

  @keyframes project-exit {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(calc(var(--exit-direction) * 125%)); visibility: hidden; }
  }
}

@media (min-width: 1100px) and (orientation: landscape) and (prefers-reduced-motion: no-preference) {
  @supports (interpolate-size: allow-keywords) and selector(details::details-content) {
    .project details { interpolate-size: allow-keywords; }

    .project details::details-content {
      block-size: 0;
      overflow: clip;
      opacity: 0;
      transition:
        block-size 330ms cubic-bezier(.24, .52, .28, 1),
        opacity 135ms ease-out,
        content-visibility 330ms allow-discrete;
    }

    .project details[open]::details-content {
      block-size: auto;
      opacity: 1;
      transition-delay: 75ms, 130ms, 0s;
      transition-duration: 345ms, 230ms, 420ms;
    }

    .project details[data-typing][open]::details-content {
      transition: opacity 115ms ease-out;
    }
  }
}

@container (max-width: 34rem) {
  .state-path { grid-template-columns: 1fr; }
  .state-path ol { flex-direction: column; }
  .state-path li + li::before { content: "↳" / ""; }
}

@media (max-width: 850px) {
  .skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 641px) {
  html { scroll-padding-top: 80px; }

  header.nav {
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100%;
    min-height: 56px;
    padding: 6px max(var(--gutter), calc((100% - var(--page-width)) / 2));
    gap: 8px 16px;
    background-color: var(--paper);
  }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  html {
    scroll-padding-top: 24px;
    scroll-padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  }

  .nav {
    width: 100%;
    min-height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    padding-block: 8px;
    padding-inline: var(--gutter);
    background-color: var(--paper);
    border-top: 1px solid transparent;
  }

  header.nav { padding-top: calc(8px + env(safe-area-inset-top, 0px)); }

  .mobile-navigation:not([hidden]) {
    position: fixed;
    inset: auto 0 0;
    z-index: 10;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid transparent;
    padding-block: 8px calc(8px + env(safe-area-inset-bottom, 0px));
    row-gap: 6px;
  }

  .mobile-navigation[hidden] { display: none; }

  @media (prefers-reduced-motion: no-preference) {
    .mobile-navigation:not([hidden]) {
      animation: mobile-navigation-enter 240ms ease-out both;
    }
  }

  footer { margin-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }

  .nav nav {
    grid-column: 1 / -1;
    justify-content: space-between;
    column-gap: 8px;
    width: 100%;
  }
  .theme-picker { grid-area: 1 / 2; }

  .nav .brand { align-self: center; }

  .overview-intro, .timeline article, .about, .contact {
    grid-template-columns: 1fr;
  }

  .overview { padding-block: 24px 16px; }
  .overview-intro { gap: 29px; }
  .contribution-snapshot { border-top: 1px solid var(--rule); }
  .highlight-list li:last-child a {
    padding-block-end: 0;
    border-bottom: 0;
  }
  h1 { max-width: 12ch; }
  .section { padding-block: 27px 33px; }

  .training-item h4 span {
    display: block;
    margin: 4px 0 0;
  }
}

@keyframes mobile-navigation-enter {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 560px) and (max-width: 640px) {
  .nav {
    display: flex;
    gap: 12px;
  }

  .nav nav {
    flex: 1;
    width: auto;
    flex-wrap: nowrap;
    justify-content: center;
    column-gap: 12px;
  }

  .nav nav a { font-size: 13px; }
}

@media (max-width: 360px) {
  .nav nav { column-gap: 11px; }
  .nav nav a { font-size: 13px; }
  .skills-grid { grid-template-columns: 1fr; }
}
