:root {
  --paper: #ffffff;
  --paper-deep: #ffffff;
  --ink: #1a1a1a;
  --muted: #696969;
  --accent: #1a1a1a;
  --accent-hover: #666666;
  --line: #e4e4e4;
  --line-strong: #c8c8c8;
  --ink-soft: #3f3f3f;
  --underline: rgba(0, 0, 0, 0.35);
  --serif: "IBM Plex Sans", Arial, sans-serif;
  --sans: "IBM Plex Sans", Arial, sans-serif;
  --shell: 680px;
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration-color: var(--underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

p,
ul {
  margin-top: 0;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.55rem 0.8rem;
  transform: translateY(-160%);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 0.75rem;
  text-decoration: none;
}

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

.site-shell {
  width: min(calc(100% - 3.5rem), var(--shell));
  margin-inline: auto;
}

.site-header {
  border: 0;
}

.header-inner {
  padding-block: 2rem 1.5rem;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 28px;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-nav a {
  position: relative;
  min-inline-size: 24px;
  padding: 0 0 0.2rem;
  color: var(--muted);
  text-decoration: none;
}

.site-nav a::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  transform: scaleX(0);
  transform-origin: left;
  background: var(--accent);
  content: "";
  transition: transform 160ms ease;
}

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

.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

main {
  padding-block: 0.9rem 4rem;
}

.hero {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  column-gap: 2.25rem;
  row-gap: 1.4rem;
  align-items: start;
  padding-bottom: 0;
}

/* portrait sits in the second row, so its top starts level with the text */
.portrait {
  grid-column: 1;
  grid-row: 2;
  width: 168px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 40%;
  filter: grayscale(100%) contrast(1.02);
}

.hero h1 {
  grid-column: 1 / -1;
  grid-row: 1;
}

.hero-body {
  grid-column: 2;
  grid-row: 2;
}

.hero h1,
.page-heading h1 {
  margin: 0;
  text-align: center;
  font-size: 2.1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.hero .lede {
  margin: 0;
  color: var(--ink-soft);
  font-size: inherit;
  line-height: 1.6;
}

.hero .lede + .lede {
  margin-top: 0.55rem;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin-top: 1.25rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 500;
}

.profile-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink);
  text-decoration: none;
}

.profile-links .link-icon {
  width: 0.95em;
  height: 0.95em;
  fill: currentColor;
  flex-shrink: 0;
}

.profile-links a + a {
  padding-left: 0;
}

.content-section {
  padding-top: 2rem;
}

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

.content-section h2,
.section-heading h2 {
  margin: 0 0 1rem;
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: -0.028em;
  line-height: 1.18;
}

.content-section p:last-child,
.project-card p:last-child,
.cv-entry p:last-child {
  margin-bottom: 0;
}

.interest-list,
.focus-list,
.simple-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.interest-list li,
.focus-list li,
.simple-list li {
  position: relative;
  padding: 0.35rem 0 0.35rem 1.25rem;
}

.interest-list li::before,
.focus-list li::before,
.simple-list li::before {
  position: absolute;
  top: 1.02rem;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.page-heading {
  padding-bottom: 0;
}

.page-heading .intro {
  max-width: 620px;
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: inherit;
  line-height: 1.6;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.section-heading h2 {
  margin-bottom: 0;
}

.project-card {
  padding: 0;
}

.project-card + .project-card {
  margin-top: 1.35rem;
}

.project-card h3 {
  margin: 0 0 0.2rem;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.28;
}

.cv-meta {
  margin: 0;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.055em;
  line-height: 1.5;
  text-transform: uppercase;
}

.project-card p {
  color: var(--ink-soft);
  line-height: 1.58;
}

.cv-entry {
  display: grid;
  grid-template-columns: minmax(155px, 0.75fr) minmax(0, 1.25fr);
  gap: 1.1rem;
  padding: 0;
}

.cv-entry + .cv-entry {
  margin-top: 0.9rem;
}

.cv-entry h3 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.32;
}

.cv-entry p {
  margin: 0;
  color: var(--muted);
}

.cv-entry > div:last-child {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1rem;
}

.cv-meta {
  white-space: nowrap;
}

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  .site-shell {
    width: min(calc(100% - 2rem), var(--shell));
  }

  .header-inner {
    padding-block: 1.5rem 1.15rem;
  }

  .site-nav {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
  }

  main {
    padding-block: 0.5rem 3.5rem;
  }

  .hero {
    grid-template-columns: 132px minmax(0, 1fr);
    column-gap: 1.45rem;
  }

  .portrait {
    width: 132px;
  }

  .cv-entry {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

@media (max-width: 520px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .portrait {
    width: 132px;
  }

  .content-section {
    padding-top: 1.75rem;
  }

  .content-section + .content-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
  }

}

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

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

/* Dark theme: follows the OS, unless the visitor picked one explicitly */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #000000;
    --paper-deep: #0a0a0a;
    --ink: #f0f0f0;
    --ink-soft: #c9c9c9;
    --muted: #9a9a9a;
    --accent: #f0f0f0;
    --accent-hover: #b4b4b4;
    --line: #262626;
    --line-strong: #3a3a3a;
    --underline: rgba(255, 255, 255, 0.35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #000000;
  --paper-deep: #0a0a0a;
  --ink: #f0f0f0;
  --ink-soft: #c9c9c9;
  --muted: #9a9a9a;
  --accent: #f0f0f0;
  --accent-hover: #b4b4b4;
  --line: #262626;
  --line-strong: #3a3a3a;
  --underline: rgba(255, 255, 255, 0.35);
  color-scheme: dark;
}

@media print {
  :root,
  :root[data-theme="dark"] {
    --paper: #ffffff;
    --ink-soft: #333333;
    --underline: rgba(0, 0, 0, 0.35);
    --ink: #000000;
    --muted: #333333;
    --accent: #000000;
    --line: #b9b9b9;
  }

  body {
    font-size: 11pt;
  }

  .site-header,
  .skip-link {
    display: none;
  }

  .site-shell {
    width: 100%;
    max-width: none;
  }

  main {
    padding: 0;
  }

  .page-heading {
    padding-bottom: 1.25rem;
  }

  .content-section {
    padding-top: 1.5rem;
  }

  .content-section + .content-section {
    margin-top: 1.5rem;
  }

  .cv-entry,
  .project-card {
    break-inside: avoid;
  }
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
  transition: color 160ms ease;
}

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

.theme-toggle svg {
  width: 1.05em;
  height: 1.05em;
  fill: currentColor;
}

.theme-toggle .icon-moon {
  display: none;
}

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

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

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: none;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: inline;
  }
}
