/* Tokens */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --panel: #f5f5f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --line: #d2d2d7;
  --link: #0066cc;
  --action: #0071e3;
  --action-hover: #0062c3;
  --on-action: #ffffff;
  --bar: rgba(255, 255, 255, 0.72);
  --select: rgba(0, 113, 227, 0.2);

  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
  --gutter: clamp(20px, 5vw, 44px);
  --page: 1024px;
  --section: clamp(72px, 11vw, 136px);
  --radius: 28px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --panel: #1d1d1f;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --line: #424245;
    --link: #2997ff;
    --bar: rgba(0, 0, 0, 0.72);
    --select: rgba(41, 151, 255, 0.35);
  }
}

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

html {
  scroll-padding-top: 72px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.47;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--select);
}

h1,
h2,
h3,
p,
ul,
dl,
dd,
figure {
  margin: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
  font-weight: 600;
}

p,
li,
dd {
  text-wrap: pretty;
}

ul {
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--link);
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 3px;
  border-radius: 6px;
}

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--action);
  color: var(--on-action);
}

.skip:focus {
  top: 8px;
}

.icon {
  width: 0.62em;
  height: 0.62em;
  margin-left: 0.3em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Bar */
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.bar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 48px;
}

.bar a {
  color: var(--text);
}

.bar-name {
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
}

.bar-links {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 30px);
  font-size: 0.8125rem;
}

.bar-links a {
  padding-block: 14px;
  opacity: 0.82;
}

.bar-links a:hover {
  opacity: 1;
  text-decoration: none;
}

.langs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-left: clamp(12px, 2vw, 20px);
  border-left: 1px solid var(--line);
  font-weight: 600;
}

.langs [aria-current] {
  color: var(--text);
}

.langs abbr {
  text-decoration: none;
}

.bar .langs a {
  color: var(--text-2);
  opacity: 1;
}

.bar .langs a:hover {
  color: var(--text);
}

@media (max-width: 620px) {
  .bar-links a.wide {
    display: none;
  }
}

@media (max-width: 460px) {
  .bar-links a.mid {
    display: none;
  }
}

/* Hero */
.hero {
  padding-top: clamp(40px, 6vw, 64px);
  text-align: center;
}

.hero h1 {
  font-size: clamp(2.75rem, 10.5vw, 6rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.hero .role {
  margin-top: 0.35em;
  color: var(--text-2);
  font-size: clamp(1.375rem, 3.6vw, 2rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.hero .summary {
  max-width: 43rem;
  margin: clamp(22px, 3vw, 32px) auto 0;
  font-size: clamp(1.0625rem, 2vw, 1.3125rem);
  line-height: 1.45;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 28px;
  margin-top: clamp(26px, 3.4vw, 36px);
  font-size: 1.0625rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--action);
  color: var(--on-action);
  transition: background-color 0.2s var(--ease);
}

.pill:hover {
  background: var(--action-hover);
  text-decoration: none;
}

.actions a:not(.pill) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.hero .where {
  margin-top: 18px;
  color: var(--text-2);
  font-size: 0.875rem;
}

.portrait {
  margin-top: clamp(32px, 4vw, 44px);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.portrait img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: 50% 40%;
}

@media (min-width: 861px) {
  .portrait img {
    aspect-ratio: 2 / 1;
    object-position: 50% 30%;
  }
}

@media (min-width: 861px) and (max-height: 760px) {
  .hero {
    padding-top: 32px;
  }

  .hero h1 {
    font-size: 4.5rem;
  }

  .hero .summary {
    max-width: 46rem;
    margin-top: 20px;
    font-size: 1.1875rem;
  }

  .hero .actions {
    margin-top: 24px;
  }

  .portrait {
    margin-top: 28px;
  }
}

@media (max-width: 640px) {
  .portrait img {
    aspect-ratio: 4 / 5;
  }

  .hero {
    text-align: start;
  }

  .hero .actions {
    justify-content: flex-start;
  }

  .hero .summary {
    margin-inline: 0;
  }
}

.nw {
  white-space: nowrap;
}

/* Measurements */
.figures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px clamp(16px, 2.4vw, 28px);
  margin-top: clamp(40px, 6vw, 72px);
}

.figures div {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.figures dt {
  font-size: clamp(1.75rem, 4.4vw, 3rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.figures dd {
  margin-top: 8px;
  color: var(--text-2);
  font-size: 0.875rem;
  line-height: 1.4;
}

@media (max-width: 560px) {
  .figures {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 20px;
  }
}

/* Sections */
section {
  padding-top: var(--section);
}

section > h2 {
  font-size: clamp(2rem, 5.4vw, 3.5rem);
  line-height: 1.07;
  letter-spacing: -0.03em;
  margin-bottom: clamp(28px, 4vw, 48px);
}

/* Project panels */
.panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  padding: clamp(28px, 5vw, 56px);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel + .panel {
  margin-top: clamp(16px, 2vw, 24px);
}

.panel h3 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.kind {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 1.0625rem;
}

.panel .about {
  margin-top: 20px;
  max-width: 34rem;
}

.tech {
  margin-top: 16px;
  color: var(--text-2);
  font-size: 0.875rem;
}

.visit {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 12px;
}

.measures {
  align-self: center;
}

.measures div {
  padding-block: 14px;
  border-top: 1px solid var(--line);
}

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

.measures dt {
  color: var(--text-2);
  font-size: 0.875rem;
}

.measures dd {
  margin-top: 4px;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.measures .was {
  color: var(--text-2);
  font-weight: 400;
}

.measures .to {
  width: 0.8em;
  height: 0.8em;
  margin-inline: 0.35em;
  vertical-align: -0.02em;
  fill: none;
  stroke: var(--text-2);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 820px) {
  .panel {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Open-source rows */
.rows {
  margin-top: clamp(28px, 4vw, 44px);
  border-top: 1px solid var(--line);
}

.rows li {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.6fr) 11rem;
  align-items: baseline;
  gap: 6px 28px;
  padding-block: 22px;
  border-bottom: 1px solid var(--line);
}

.rows li > a {
  justify-self: end;
}

.rows h3 {
  font-size: 1.3125rem;
  letter-spacing: -0.02em;
}

.rows .kind {
  margin-top: 2px;
  font-size: 0.9375rem;
}

.rows .tech {
  margin-top: 4px;
}

@media (max-width: 720px) {
  .rows li {
    grid-template-columns: minmax(0, 1fr);
  }

  .rows li > a {
    justify-self: start;
  }
}

/* Experience */
.role-block {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 12px clamp(24px, 5vw, 64px);
  padding-block: clamp(28px, 4vw, 44px);
  border-top: 1px solid var(--line);
}

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

.when {
  color: var(--text-2);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.when strong {
  display: block;
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 600;
}

.role-block h3 {
  font-size: clamp(1.3125rem, 2.6vw, 1.5rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.context {
  margin-top: 4px;
  color: var(--text-2);
}

.points {
  margin-top: 18px;
  max-width: 41rem;
}

.points li {
  position: relative;
  padding-left: 1.15em;
}

.points li + li {
  margin-top: 10px;
}

.points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.66em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-2);
}

@media (max-width: 720px) {
  .role-block {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Definition tables: stack, education */
.table div {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 4px clamp(24px, 5vw, 64px);
  padding-block: 18px;
  border-top: 1px solid var(--line);
}

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

.table dt {
  font-weight: 600;
}

.table dt small {
  display: block;
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 400;
}

.table dd {
  max-width: 41rem;
}

.table .quiet dd {
  color: var(--text-2);
}

@media (max-width: 720px) {
  .table div {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* How I work */
.ways {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(24px, 3.4vw, 40px) clamp(28px, 6vw, 72px);
}

.ways h3 {
  font-size: 1.3125rem;
  letter-spacing: -0.02em;
}

.ways p {
  margin-top: 6px;
  color: var(--text-2);
  max-width: 28rem;
}

@media (max-width: 640px) {
  .ways {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Contact */
.contact {
  padding-bottom: var(--section);
  text-align: center;
}

.contact h2 {
  margin-bottom: 18px;
}

.contact .lede {
  max-width: 36rem;
  margin-inline: auto;
  color: var(--text-2);
  font-size: clamp(1.0625rem, 2vw, 1.3125rem);
}

.mail {
  display: inline-block;
  margin-top: clamp(24px, 3.4vw, 36px);
  font-size: clamp(1.25rem, 4.6vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.contact .actions {
  margin-top: 14px;
}

footer {
  border-top: 1px solid var(--line);
  padding-block: 22px 34px;
  color: var(--text-2);
  font-size: 0.8125rem;
}

footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
}

footer a {
  color: inherit;
}

/* Motion: one load sequence on the hero, nothing on scroll */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .hero > * {
    animation: settle 0.9s var(--ease) backwards;
  }

  .hero > :nth-child(2) {
    animation-delay: 0.07s;
  }

  .hero > :nth-child(3) {
    animation-delay: 0.14s;
  }

  .hero > :nth-child(4) {
    animation-delay: 0.21s;
  }

  .hero > :nth-child(5) {
    animation-delay: 0.26s;
  }

  .hero > .portrait {
    animation-name: unveil;
    animation-duration: 1.2s;
    animation-delay: 0.3s;
  }

  .hero > .figures {
    animation-delay: 0.42s;
  }
}

@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(6px);
  }
}

@keyframes unveil {
  from {
    opacity: 0;
    transform: scale(0.975);
    clip-path: inset(6% round var(--radius));
  }
  to {
    clip-path: inset(0 round var(--radius));
  }
}

@media print {
  .bar,
  .skip {
    display: none;
  }
}

@media (max-width: 360px) {
  .bar .wrap {
    gap: 10px;
  }

  .bar-links {
    gap: 10px;
  }

  .langs {
    padding-left: 10px;
  }
}
