@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-latin-opsz-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f7f5f0;
  --surface: #efece4;
  --fg: #1d1c1a;
  --muted: #625e56;
  --faint: #6e695f;
  --line: #dedad0;
  --accent: #1b5e7a;
  --accent-soft: #e0ebef;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121416;
    --surface: #1a1d20;
    --fg: #e9e7e2;
    --muted: #a8a49c;
    --faint: #8a867e;
    --line: #2a2e32;
    --accent: #82c3dc;
    --accent-soft: #1a2b33;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
    --bg: #121416;
    --surface: #1a1d20;
    --fg: #e9e7e2;
    --muted: #a8a49c;
    --faint: #8a867e;
    --line: #2a2e32;
    --accent: #82c3dc;
    --accent-soft: #1a2b33;
    color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

  .sun-moon *,
  .lang a,
  .theme-toggle {
    transition: none !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.65 var(--sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-color: var(--line);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}

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

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

.skip {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--fg);
  color: var(--bg);
  border-radius: 6px;
}

.skip:focus {
  left: 0.5rem;
}

/* ---------- layout ---------- */

.page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.aside {
  padding: 2.5rem 0 1rem;
}

@media (min-width: 64rem) {
  .page {
    display: grid;
    grid-template-columns: 24.5rem minmax(0, 1fr);
    gap: 4rem;
    padding: 0 3rem;
  }

  .aside {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 5.5rem 0 3rem;
  }

  main {
    padding: 5rem 0 3rem;
  }
}

/* ---------- identity column ---------- */

.lang {
  display: inline-flex;
  gap: 0.125rem;
  padding: 0.1875rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.lang a {
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  transition: color 120ms ease, background 120ms ease;
}

.lang a:hover {
  color: var(--fg);
  background: var(--accent-soft);
}

.lang a[aria-current] {
  color: var(--bg);
  background: var(--fg);
}

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

.photo {
  display: block;
  width: 6.5rem;
  height: 6.5rem;
  margin-bottom: 1.5rem;
  border-radius: 50%;
  object-fit: cover;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.5rem, 8vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.role {
  margin: 0.9rem 0 0;
  font-size: 1.0625rem;
  font-weight: 500;
}

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

.tagline {
  margin: 0.75rem 0 0;
  max-width: 22rem;
  color: var(--muted);
}

.nav {
  display: none;
}

@media (min-width: 64rem) {
  .nav {
    display: block;
    margin: 3rem 0 0;
    padding: 0;
    list-style: none;
  }

  .nav a {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.4rem 0;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--faint);
  }

  .nav a::before {
    content: "";
    width: 2rem;
    height: 1px;
    background: currentColor;
    transition: width 150ms ease;
  }

  .nav a:hover {
    color: var(--fg);
  }

  .nav a:hover::before {
    width: 4rem;
  }
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
  font-weight: 500;
}

@media (min-width: 64rem) {
  .contact {
    margin-top: auto;
  }
}

.contact a {
  text-decoration-color: var(--faint);
}

/* ---------- content ---------- */

section {
  padding: 2.5rem 0 1rem;
  scroll-margin-top: 1.5rem;
}

@media (min-width: 64rem) {
  section {
    padding: 0 0 4.5rem;
  }
}

h2 {
  margin: 0 0 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.about p {
  margin: 0 0 1.1rem;
  font-size: 1.0625rem;
  color: var(--muted);
}

.about strong {
  color: var(--fg);
  font-weight: 600;
}

/* entries: date column + body */

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

.entry {
  display: grid;
  gap: 0.25rem 1.5rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--line);
}

.entry:first-child {
  border-top: 0;
  padding-top: 0;
}

@media (min-width: 40rem) {
  .entry {
    grid-template-columns: 8.5rem minmax(0, 1fr);
  }
}

.when {
  padding-top: 0.15rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.entry h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
}

.entry .org {
  color: var(--muted);
  font-weight: 400;
}

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

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.6;
}

/* selected work cards */

.work {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.work > li {
  padding: 1.25rem 1.25rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.work h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.3;
}

.work p {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.plain {
  margin: 0;
  color: var(--muted);
}

.site-footer {
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.8125rem;
}

.site-footer p {
  margin: 0;
}

/* short desktop windows: stop pinning the identity column so nothing is cut off */
@media (min-width: 64rem) and (max-height: 42rem) {
  .aside {
    position: static;
    height: auto;
  }

  .contact {
    margin-top: 1.75rem;
  }
}

/* ---------- interactions (all progressive: the page is complete without JS) ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

/* Theme: one icon button. The icon shows the current theme, the label says what a click does. */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: currentColor;
  background: var(--accent-soft);
}

.sun-moon .sun,
.sun-moon .beams,
.sun-moon .moon {
  transform-origin: center;
  transform-box: fill-box;
}

.sun-moon .sun {
  transition: transform 500ms cubic-bezier(0.5, 1.25, 0.75, 1.25);
}

.sun-moon .beams {
  transform-origin: 12px 12px;
  transform-box: view-box;
  transition: transform 500ms cubic-bezier(0.5, 1.5, 0.75, 1.25), opacity 500ms ease;
}

.sun-moon .moon {
  transition: transform 250ms ease-out;
}

:root[data-theme="dark"] .sun-moon .sun {
  transform: scale(1.75);
  transition-duration: 250ms;
  transition-timing-function: ease;
}

:root[data-theme="dark"] .sun-moon .beams {
  opacity: 0;
  transform: rotate(-25deg);
  transition-duration: 150ms;
}

:root[data-theme="dark"] .sun-moon .moon {
  transform: translateX(-7px);
  transition: transform 500ms 250ms cubic-bezier(0, 0, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sun-moon .sun {
    transform: scale(1.75);
  }

  :root:not([data-theme="light"]) .sun-moon .beams {
    opacity: 0;
    transform: rotate(-25deg);
  }

  :root:not([data-theme="light"]) .sun-moon .moon {
    transform: translateX(-7px);
  }
}

/* The new theme spreads out from the button, where the browser supports it. */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

.theme-switching::view-transition-new(root) {
  animation: theme-reveal 550ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes theme-reveal {
  from {
    clip-path: circle(0 at var(--tx, 50%) var(--ty, 0));
  }
  to {
    clip-path: circle(var(--tr, 150vmax) at var(--tx, 50%) var(--ty, 0));
  }
}

.copy {
  font: inherit;
  font-size: 0.8125rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.copy:hover {
  color: var(--accent);
  border-color: currentColor;
}

.theme-toggle:focus-visible,
.copy:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.copy[data-state="done"] {
  color: var(--accent);
  border-color: currentColor;
  background: var(--accent-soft);
}

.contact .email {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* signal trace under the name: a time series with one rare event */

.signal {
  display: block;
  width: 100%;
  max-width: 18rem;
  height: 2.5rem;
  margin: 1rem 0 0.25rem;
  overflow: visible;
}

.signal .trace {
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.25;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.signal .event {
  fill: var(--accent);
}

.signal .halo {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .signal .trace {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: draw 2.2s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
  }

  .signal .event {
    opacity: 0;
    animation: appear 0.3s ease 1.9s forwards;
  }

  .signal .halo {
    transform-box: fill-box;
    transform-origin: center;
    animation: pulse 2.4s ease-out 2.1s infinite;
  }
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

@keyframes appear {
  to { opacity: 1; }
}

@keyframes pulse {
  0% { opacity: 0.8; transform: scale(1); }
  100% { opacity: 0; transform: scale(3.2); }
}

.page {
  position: relative;
  z-index: 1;
}

/* active section in the side nav */

@media (min-width: 64rem) {
  .nav a[aria-current="true"] {
    color: var(--fg);
  }

  .nav a[aria-current="true"]::before {
    width: 4rem;
    background: var(--accent);
  }
}

/* hovering one entry softens its siblings */

@media (hover: hover) and (min-width: 64rem) {
  .entries .entry,
  .work > li {
    transition: opacity 180ms ease, border-color 180ms ease, transform 180ms ease;
  }

  .entries:has(.entry:hover) .entry:not(:hover),
  .work:has(> li:hover) > li:not(:hover) {
    opacity: 0.55;
  }

  .work > li:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
  }
}

/* sections fade in once; only when the script opted in and motion is welcome */

@media (prefers-reduced-motion: no-preference) {
  .reveal section {
    transition: opacity 600ms ease, transform 600ms ease;
  }

  .reveal section:not(.seen) {
    opacity: 0;
    transform: translateY(14px);
  }
}

/* ---------- at a glance / now / principles ---------- */

.glance {
  padding-top: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

@media (min-width: 40rem) {
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stats li {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.1rem 1rem 1rem;
  background: var(--bg);
}

.stat {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--muted);
}

.stamp {
  margin-left: 0.5rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--faint);
}

.now {
  margin: 0;
  padding-left: 1rem;
  border-left: 2px solid var(--accent);
  font-size: 1.0625rem;
}

.principles {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: principle;
}

.principles li {
  position: relative;
  padding: 0 0 1.25rem 2.75rem;
  counter-increment: principle;
}

.principles li::before {
  content: counter(principle, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.1rem;
  font-family: var(--serif);
  font-size: 1.125rem;
  color: var(--accent);
}

.principles h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.3125rem;
  font-weight: 500;
  line-height: 1.3;
}

.principles p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

/* ---------- multi-page: tabs, titles, lead text, card links ---------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.tabs a {
  display: block;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--muted);
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.tabs a:hover {
  color: var(--fg);
  border-color: var(--faint);
}

.tabs a[aria-current="page"] {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}

.h1-like {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.5rem, 8vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.h1-like a {
  text-decoration: none;
}

.page-title {
  margin: 0 0 1.25rem;
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 2.5rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--fg);
}

.lead {
  margin: 0 0 1.25rem;
  font-size: 1.125rem;
  color: var(--muted);
}

.prose p {
  margin: 0 0 1.1rem;
  font-size: 1.0625rem;
  color: var(--muted);
}

.prose strong {
  color: var(--fg);
  font-weight: 600;
}

/* whole explore card is clickable through its heading link */
.work > li {
  position: relative;
}

.card-link {
  text-decoration: none;
}

.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.card-link::before {
  content: "→";
  float: right;
  margin-left: 0.5rem;
  color: var(--accent);
  transition: transform 150ms ease;
}

.work > li:hover .card-link::before {
  transform: translateX(3px);
}

.card-link:focus-visible {
  outline: none;
}

.work > li:has(.card-link:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (min-width: 40rem) {
  .explore .work {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* on phones, inner pages keep the header short so the content starts on screen */
@media (max-width: 63.99rem) {
  body:not(.page-home) .photo,
  body:not(.page-home) .signal,
  body:not(.page-home) .tagline {
    display: none;
  }

  body:not(.page-home) .h1-like {
    font-size: 1.75rem;
  }

  body:not(.page-home) .aside {
    padding-bottom: 0;
  }

  body:not(.page-home) .contact {
    margin-top: 1rem;
  }
}

/* long inner pages: the pinned identity column scrolls on its own instead of cutting off */
@media (min-width: 64rem) {
  .aside {
    overflow-y: auto;
    scrollbar-width: none;
  }

  .aside::-webkit-scrollbar {
    display: none;
  }
}



/* ---------- typographic polish ---------- */

h1,
h2,
h3,
.h1-like,
.page-title {
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

.when,
.stat,
time {
  font-variant-numeric: tabular-nums;
}

/* ---------- one company, several roles: a rail with a dot per role ---------- */

.group-note {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.roles {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.roles .entry {
  position: relative;
  display: block;
  padding: 0 0 1.25rem 1.5rem;
  border: 0;
}

.roles .entry::before {
  content: "";
  position: absolute;
  left: 0.3125rem;
  top: 0.5rem;
  bottom: -0.5rem;
  width: 1px;
  background: var(--line);
}

.roles .entry:last-child::before {
  display: none;
}

.roles .entry::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0.3rem;
  width: 0.625rem;
  height: 0.625rem;
  border: 2px solid var(--faint);
  border-radius: 50%;
  background: var(--bg);
  box-sizing: border-box;
}

.roles .entry:first-child::after {
  border-color: var(--accent);
  background: var(--accent);
}

.roles .when {
  display: block;
  padding: 0;
  margin-bottom: 0.1rem;
}

/* Hovering one entry quietly steps the others back, on devices with a real pointer. */
@media (hover: hover) and (min-width: 64rem) {
  .entries > .entry:not(.group),
  .work > li {
    transition: opacity 200ms ease;
  }

  .entries:has(> .entry:not(.group):hover) > .entry:not(.group):not(:hover),
  .work:has(> li:hover) > li:not(:hover) {
    opacity: 0.55;
  }
}
