/*
 * gvoth.dev: one stylesheet for every page.
 *
 * One structural idea runs through the site: a narrow left gutter that
 * holds time (CV years) beside a content column. On narrow screens the
 * gutter stacks above its content. On wide screens the CV adds a side
 * card for contact, skills, languages, and personal interests.
 *
 * Sections: fonts, tokens, base, layout primitives, top bar and footer,
 * CV hero, CV columns and entries, projects, certifications, side card,
 * timeline, 404, print.
 */

/* --- Fonts --------------------------------------------------------------- */

/* Schibsted Grotesk (variable, SIL OFL 1.1, see fonts/OFL.txt), self-hosted.
   Two subsets; the browser fetches latin-ext only for characters in its
   range. */
@font-face {
  font-family: 'Schibsted Grotesk Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url('/fonts/schibsted-grotesk-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Schibsted Grotesk Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url('/fonts/schibsted-grotesk-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Tokens -------------------------------------------------------------- */

:root {
  --bg: #f4f7f7;
  --ink: #112022;
  --muted: #4a666a;
  --accent: #1d5c60;
  --surface: #ffffff; /* cards and chips, one step up from --bg */
  --line: #d5e0e1; /* hairlines between entries, card borders */
  --control: #6e8b8f; /* outlines that mark a control: 3:1 against --bg */
  --tint: color-mix(in srgb, var(--accent) 15%, var(--bg)); /* past timeline bars */

  --font: 'Schibsted Grotesk Variable', ui-sans-serif, system-ui, sans-serif;

  --gutter: 7.5rem; /* width of the time column */
  --measure: 38rem; /* width of the content column, ~70 characters */
  --gap: 1.5rem;
  --page: 70rem; /* full page width: main column plus the CV side card */

  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #0f1a1c;
  --ink: #e4eeee;
  --muted: #8fb0b4;
  --accent: #6ec2c6;
  --surface: #162629;
  --line: #253d41;
  --control: #53767b;
  --tint: color-mix(in srgb, var(--accent) 22%, var(--bg));
  color-scheme: dark;
}

/* --- Base ---------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  accent-color: var(--accent);
  caret-color: var(--accent);
}

::selection {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--ink);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a,
button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: color-mix(in srgb, var(--accent) 16%, transparent);
}

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

a:hover {
  text-decoration-thickness: 2px;
}

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

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0;
}

h2 {
  font-size: 1.3rem;
  font-weight: 650;
}

h3 {
  font-size: 1.0625rem;
  font-weight: 650;
}

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

p {
  margin: 0;
}

/* --- Layout primitives --------------------------------------------------- */

/* Page frame, with a 16px side margin on small screens. */
.frame {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 48rem) {
  .frame {
    padding: 0 2rem;
  }
}

/* Section label: small spaced capitals, used for every CV section heading. */
.label {
  font-size: 0.8125rem;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Years: tabular figures so the gutter lines up. */
.when {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* A row whose first child sits in the time gutter. */
.row {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  column-gap: var(--gap);
  align-items: baseline;
}

/* Content that skips the gutter but aligns with the content column. */
.col {
  margin-left: calc(var(--gutter) + var(--gap));
}

@media (max-width: 40rem) {
  .row {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.15rem;
  }

  .col {
    margin-left: 0;
  }
}

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

.muted {
  color: var(--muted);
}

/* Present to screen readers, hidden visually. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Top bar and footer -------------------------------------------------- */

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 1rem;
  z-index: 20;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--control);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 140ms ease;
}

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

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

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.wordmark {
  color: var(--ink);
  font-size: 1.0625rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.wordmark:hover {
  color: var(--accent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}

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

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

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

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

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-top: 6rem;
  padding-top: 1.75rem;
  padding-bottom: 2.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
}

/* --- CV: hero ------------------------------------------------------------ */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.75rem;
  padding-top: clamp(2rem, 7vw, 5.5rem);
}

@media (min-width: 44rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr) clamp(13rem, 25vw, 17.5rem);
    column-gap: clamp(2rem, 4vw, 4rem);
    align-items: center;
  }
}

.hero h1 {
  font-size: clamp(3.25rem, 7.6vw, 5.75rem);
  font-weight: 760;
  line-height: 0.94;
  letter-spacing: -0.035em;
  /* Optical alignment: pull the large J's stem onto the frame edge. */
  margin-left: -0.04em;
}

.portrait {
  display: block;
  width: 100%;
  max-width: 17.5rem;
  height: auto;
  aspect-ratio: 5 / 4;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
}

/* Small stylized QR thumbnail next to the top wordmark; expands into a centered modal. */
.qr-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.qr-trigger {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.16rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  transition: transform 160ms cubic-bezier(0.2, 0.7, 0.2, 1), border-color 150ms ease, box-shadow 160ms ease;
}

.qr-trigger:hover {
  transform: scale(1.07);
  border-color: var(--control);
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--ink) 18%, transparent);
}

.qr-trigger:active {
  transform: scale(0.98);
}

.qr-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.qr-bars {
  fill: var(--ink);
}

.qr-dots {
  fill: var(--accent);
}

.qr-eyes {
  color: var(--accent);
}

.qr-center-halo {
  fill: var(--bg);
}

.qr-center-bg {
  fill: var(--accent);
}

.qr-center-glyph {
  fill: var(--bg);
  font-family: var(--font);
}

/* Centered QR overlay modal */
.qr-modal {
  --qr-size: max(12rem, min(calc(92vw - 4.4rem), calc(92vh - 12rem)));
  --qr-size: max(12rem, min(calc(92vw - 4.4rem), calc(92dvh - 12rem)));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  color: var(--ink);
  width: fit-content;
  max-width: 92vw;
  max-height: 94vh;
  max-height: 94dvh;
  overflow: visible;
}

.qr-modal[open] {
  animation: qr-modal-in 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.qr-modal::backdrop {
  background: color-mix(in srgb, #071012 62%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: qr-backdrop-in 180ms ease both;
}

.qr-modal-card {
  display: grid;
  gap: 1.1rem;
  padding: 1.35rem;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.32);
}

.qr-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.qr-modal-title {
  font-size: 1.35rem;
  font-weight: 720;
  letter-spacing: -0.02em;
  margin-top: 0.1rem;
}

.qr-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}

.qr-close:hover {
  color: var(--ink);
  border-color: var(--control);
}

.qr-stage {
  padding: 0.85rem;
  border-radius: 18px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.qr-svg-large {
  width: var(--qr-size);
  height: var(--qr-size);
  max-width: 100%;
  aspect-ratio: 1;
  margin: 0 auto;
}

.qr-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.qr-self-link {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}

.qr-self-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.qr-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

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

.qr-copy[data-copied='true'] {
  border-color: var(--accent);
  color: var(--accent);
}

.qr-trigger:focus-visible {
  border-radius: 14px;
}

.qr-close:focus-visible,
.qr-copy:focus-visible {
  border-radius: 999px;
}

@keyframes qr-modal-in {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes qr-backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.headline {
  margin-top: 1.25rem;
  font-size: clamp(1.3rem, 2.4vw, 1.75rem);
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.75rem 0 0;
  padding: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.9375rem;
  line-height: 1.35;
}

/* The current role's marker: accent dot with a soft halo. */
.dot {
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

.print-masthead {
  display: none;
}

.summary {
  margin-top: 1.4rem;
  max-width: 40rem;
  font-size: clamp(1.05rem, 1.45vw, 1.175rem);
  line-height: 1.55;
  color: var(--muted);
}

.timeline-wrap {
  margin-top: clamp(3rem, 7vw, 5rem);
}

/* Filled by js/cv.js; without JavaScript the page simply has no timeline. */
.timeline-wrap:empty {
  display: none;
}

/* --- CV: columns and entries --------------------------------------------- */

.cv {
  margin-top: clamp(3rem, 7vw, 5rem);
}

@media (min-width: 64rem) {
  .cv {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 17.5rem;
    column-gap: 4rem;
    align-items: start;
  }

  /* The side card follows the reader down a long CV when the viewport fits it. */
  @media (min-height: 68rem) {
    .side {
      position: sticky;
      top: 2rem;
    }
  }
}

.block + .block {
  margin-top: 3.5rem;
}

.block > h2 {
  margin-bottom: 0.75rem;
}

/* Entries are hairline-separated rows rather than spaced blocks. */
.block .list {
  gap: 0;
}

.entry {
  padding: 1.6rem 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 2rem;
}

/* Year range in ink, tenure quieter beneath it. */
.entry .when {
  color: var(--ink);
  font-weight: 600;
}

.entry h3 {
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* Time in role, under the year range; inline after it on narrow screens. */
.tenure {
  display: block;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--muted);
}

@media (max-width: 40rem) {
  .tenure {
    display: inline;
    margin-left: 0.6em;
  }
}

/* Arriving from a timeline bar or WebMCP focus: mark the entry or section it points to. */
.entry:target h3,
.entry:target .when,
.entry[data-agent-focus='true'] h3,
.entry[data-agent-focus='true'] .when,
section[data-agent-focus='true'] > h2,
.timeline-wrap[data-agent-focus='true'] .label,
.side [data-agent-focus='true'] dt,
.side [data-agent-focus='true'] .out {
  color: var(--accent);
}

.org {
  margin-top: 0.15rem;
}

.entry-summary {
  margin-top: 0.6rem;
}

.highlights {
  margin: 0.6rem 0 0;
  padding-left: 1.1em;
}

.highlights li + li {
  margin-top: 0.3rem;
}

/* Progressive disclosure for archived / earlier entries */
.more-toggle {
  align-items: center;
  padding: 1.15rem 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.more-toggle::-webkit-details-marker {
  display: none;
}

.more-toggle .when {
  font-weight: 600;
}

@media (max-width: 40rem) {
  .more-toggle {
    row-gap: 0.45rem;
  }
}

.more-control {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  justify-self: start;
  min-height: 2.25rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--line);
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color 150ms ease, color 150ms ease;
}

.more-toggle:hover .more-control {
  border-color: var(--control);
  color: var(--ink);
}

.more-toggle:focus-visible {
  outline: none;
}

.more-toggle:focus-visible .more-control {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.more-open {
  display: none;
}

.more-entries[open] .more-closed {
  display: none;
}

.more-entries[open] .more-open {
  display: inline;
}

.more-control svg {
  flex-shrink: 0;
  transition: transform 180ms ease;
}

.more-entries[open] .more-control svg {
  transform: rotate(180deg);
}

/* --- CV: projects -------------------------------------------------------- */

.section-intro {
  padding-top: 1.15rem;
  margin-bottom: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
  line-height: 1.5;
  max-width: 58ch;
}

.projects-grid {
  list-style: none;
  margin: 0;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.section-intro + .projects-grid {
  padding-top: 0;
  border-top: 0;
}

@media (max-width: 38rem) {
  .projects-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (min-width: 38.0625rem) {
  .projects-grid > .featured {
    grid-column: 1 / -1;
  }
}

.project-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.55rem;
  height: 100%;
  padding: 1.05rem 1.2rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.project-card:hover,
.project-card[data-agent-focus='true'] {
  border-color: var(--control);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--ink) 16%, transparent);
}

.project-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.project-tag {
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
}

.project-host {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.project-title {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.project-title svg {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 150ms ease, color 150ms ease;
}

.project-card:hover .project-title,
.project-card:hover .project-title svg,
.project-card[data-agent-focus='true'] .project-title,
.project-card[data-agent-focus='true'] .project-title svg {
  color: var(--accent);
}

.project-card:hover .project-title svg {
  transform: translate(2px, -2px);
}

.project-desc {
  font-size: 0.925rem;
  line-height: 1.48;
  color: var(--muted);
}

/* --- CV: certifications -------------------------------------------------- */

/* Badge beside name, issuer, validity and Verify link. */
.cert {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.badge {
  flex-shrink: 0;
  align-self: flex-start;
  width: 4rem;
  height: 4rem;
}

/* Only the text joins baseline alignment, so the row's gutter year lines
   up with the certification name rather than the bottom of the badge. */
.cert > div {
  align-self: baseline;
}

.validity {
  margin-top: 0.35rem;
  font-size: 0.9rem;
}

.verify {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.9rem;
}

/* --- CV: side card ------------------------------------------------------- */

.side {
  display: grid;
  gap: 1.75rem;
  margin-top: 3.5rem;
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}

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

.side h2 {
  margin-bottom: 0.5rem;
}

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

/* Outbound link: label and arrow, a 44px target, its address beneath. */
.out {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  font-weight: 600;
}

.address {
  display: block;
  margin-top: -0.4rem;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.side dl {
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.side dt {
  font-size: 0.9375rem;
  font-weight: 650;
  line-height: 1.35;
}

.side dd {
  margin: 0.14rem 0 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--muted);
}

.side dl.languages {
  gap: 0.45rem;
}

.side dl.languages > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.side dl.languages dd {
  margin: 0;
}

/* --- Timeline (built by js/cv.js) ---------------------------------------- */

/*
 * Every role and degree is a bar on a shared year axis, packed into lanes
 * (work first, then study; bars share a lane when they do not overlap).
 * Each bar is a link to its entry and a size container: the role, then the
 * organization, drop out when the bar is too narrow to hold them.
 */

.timeline {
  margin: 0;
}

.timeline .head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 1rem;
  margin-bottom: 0.9rem;
}

.timeline .legend {
  display: flex;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.timeline .key {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Swatches repeat the bar styles: filled for work, solid-bordered surface
   for community, dashed for study, so all three differ in structure and not
   only in colour. */
.timeline .key::before {
  content: '';
  width: 0.9rem;
  height: 0.6rem;
  border-radius: 3px;
}

.timeline .key.work::before {
  background: var(--tint);
}

.timeline .key.community::before {
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  border: 1.5px solid var(--accent);
}

.timeline .key.study::before {
  border: 1px dashed var(--control);
}

.timeline .plot {
  position: relative;
}

/* Faint year gridlines behind the bars, stopping above the axis labels. */
.timeline .grid {
  position: absolute;
  inset: 0 0 2.25rem 0;
  pointer-events: none;
}

.timeline .gridline,
.timeline .nowline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
}

.timeline .gridline {
  left: var(--x);
  background: color-mix(in srgb, var(--muted) 14%, transparent);
}

.timeline .nowline {
  right: 0;
  background: color-mix(in srgb, var(--accent) 55%, transparent);
}

/* One grid row per lane; every entry is placed in its lane's row, and its
   bar is positioned along it by the axis percentages in --from and --to.
   Entries sharing a lane overlap as boxes, so only the bars take clicks. */
.timeline .rows {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 0 0.25rem;
  display: grid;
  grid-template-rows: repeat(var(--lanes), 3.5rem);
  row-gap: 0.5rem;
}

.timeline .rows li {
  grid-row: var(--lane);
  grid-column: 1;
  position: relative;
  pointer-events: none;
}

.timeline .rows a {
  pointer-events: auto;
  position: absolute;
  top: 0;
  bottom: 0;
  /* A 2px seam between bars that meet end to end. */
  left: calc(var(--from) + 1px);
  width: calc(var(--to) - var(--from) - 2px);
  min-width: 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
  padding: 0 0.625rem;
  overflow: hidden;
  white-space: nowrap;
  border-radius: 10px;
  background: var(--tint);
  color: var(--ink);
  text-decoration: none;
  container-type: inline-size;
  animation: reveal 800ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i) * 120ms + 150ms);
}

/* The current primary work role is the one solid bar, running flush into "now". */
.timeline .ongoing a {
  background: var(--accent);
  color: var(--bg);
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

/* Community leadership sits on its own track with a crisp outline, keeping
   the solid fill strictly for the primary ongoing enterprise role. */
.timeline .community a {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1.5px solid var(--control);
  color: var(--ink);
}

.timeline .community.ongoing a {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border: 1.5px solid var(--accent);
  color: var(--ink);
}

/* Degrees read as the lighter, formative layer under the work. */
.timeline .study a {
  background: transparent;
  border: 1px dashed var(--control);
}

.timeline .rows a:hover {
  background: color-mix(in srgb, var(--accent) 26%, var(--bg));
}

.timeline .ongoing a:hover {
  background: var(--ink);
}

.timeline .community a:hover,
.timeline .community.ongoing a:hover {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
  border-color: var(--accent);
  color: var(--ink);
}

.timeline .study a:hover {
  background: color-mix(in srgb, var(--muted) 12%, var(--bg));
}

.timeline .rows a:focus-visible {
  outline-offset: 3px;
}

.bar-org,
.bar-role {
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-org {
  font-size: 0.9375rem;
  font-weight: 650;
  line-height: 1.25;
}

.bar-role {
  font-size: 0.78rem;
  line-height: 1.35;
}

.timeline .rows a:hover .bar-org,
.timeline .rows a:focus-visible .bar-org {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

/* Too narrow for the title: hide the role and let a two-word or camelCase
   organization wrap onto two lines inside the bar. */
@container (max-width: 4rem) {
  .bar-role {
    display: none;
  }

  .bar-org {
    white-space: normal;
    line-height: 1.15;
  }
}

@container (max-width: 2.35rem) {
  .bar-org {
    font-size: 0.68rem;
    letter-spacing: -0.025em;
    white-space: nowrap;
  }
}

@container (max-width: 1.62rem) {
  .bar-org {
    display: none;
  }
}

.timeline .axis {
  position: relative;
  height: 2rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.timeline .tick,
.timeline .now {
  position: absolute;
  top: 0.45rem;
}

.timeline .tick {
  left: var(--x);
  transform: translateX(-50%);
}

.timeline .tick.first {
  transform: none;
}

.timeline .now {
  right: 0;
  color: var(--accent);
  font-weight: 600;
}

/* Clip rather than scale, so labels inside bars are revealed, not squashed. */
@keyframes reveal {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@media (max-width: 40rem) {
  .timeline .rows {
    grid-template-rows: repeat(var(--lanes), 2.75rem);
  }

  .timeline .rows a {
    padding: 0 0.25rem;
    border-radius: 8px;
  }

  .bar-org {
    font-size: 0.8125rem;
  }

  .timeline .tick.wide {
    display: none;
  }
}

/* --- 404 ----------------------------------------------------------------- */

.notfound h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

/* --- Motion -------------------------------------------------------------- */

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

  .timeline .rows a,
  .qr-modal[open],
  .qr-modal::backdrop {
    animation: none;
  }

  .qr-trigger,
  .project-card,
  .project-title svg,
  .more-control,
  .more-control svg {
    transition: none;
  }
}

@media (forced-colors: active) {
  .timeline .rows a {
    border: 1px solid CanvasText;
  }

  .timeline .ongoing a {
    border: 2px solid Highlight;
  }
}

/* --- Print / Save as PDF ------------------------------------------------- */

@media print {
  :root {
    --bg: #fff;
    --ink: #000;
    --muted: #4a4a4a;
    --accent: #184e52;
    --surface: #fff;
    --line: #d0d4da;
    --control: #8a8a8a;
    font-size: 9.5pt;
  }

  body {
    font-size: 1rem;
    line-height: 1.5;
  }

  .skip-link,
  .topbar,
  .site-footer,
  .qr-modal {
    display: none;
  }

  .print-masthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.6rem;
    margin-bottom: 0.9rem;
    border-bottom: 1px solid var(--line);
  }

  .print-brand {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
  }

  .print-wordmark {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-decoration: none;
  }

  .print-url {
    font-size: 0.85rem;
    color: var(--muted);
  }

  .print-qr {
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) 7rem;
    column-gap: 1.5rem;
    align-items: center;
    padding-top: 0;
  }

  .portrait {
    max-width: 7rem;
    border-radius: 10px;
  }

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

  .chips {
    margin-top: 0.75rem;
  }

  .summary {
    margin-top: 0.75rem;
    font-size: 0.96rem;
  }

  .dot {
    box-shadow: none;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .timeline-wrap {
    margin-top: 1.25rem;
    break-inside: avoid;
  }

  .timeline .rows {
    grid-template-rows: repeat(var(--lanes), 3.1rem);
    row-gap: 0.35rem;
  }

  .timeline .rows a {
    animation: none;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  /* Dark ink + solid border so ongoing bars remain legible even when a
     browser or printer strips background graphics. */
  .timeline .ongoing a {
    background: #dcebed;
    color: #000;
    border: 1.5px solid var(--accent);
  }

  .timeline .community a,
  .timeline .community.ongoing a {
    background: #f2f7f7;
    color: #000;
    border: 1px solid var(--control);
  }

  /* On paper everything is one column. */
  .cv {
    display: block;
  }

  .cv,
  .side {
    margin-top: 1.4rem;
  }

  .block + .block {
    margin-top: 1.55rem;
  }

  .block > h2 {
    margin-bottom: 0.5rem;
    break-after: avoid;
  }

  .entry {
    padding: 0.72rem 0;
    break-inside: avoid;
  }

  .more-toggle {
    padding: 0.72rem 0;
    break-inside: avoid;
  }

  .more-entries[open] > .more-toggle {
    display: none;
  }

  .more-control {
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1rem;
    font-weight: 400;
  }

  .more-control svg {
    display: none;
  }

  .more-closed::after {
    content: attr(data-print-note);
  }

  .section-intro {
    padding-top: 0.55rem;
    margin-bottom: 0.55rem;
    font-size: 0.88rem;
    break-after: avoid;
  }

  .projects-grid {
    padding-top: 0.65rem;
    gap: 0.45rem;
  }

  .section-intro + .projects-grid {
    padding-top: 0;
  }

  .project-card {
    padding: 0.55rem 0.75rem;
    gap: 0.3rem;
    border-radius: 8px;
    break-inside: avoid;
    box-shadow: none;
    transform: none;
  }

  .project-title svg {
    display: none;
  }

  /* On paper the side card flows cleanly across two columns below the main sections. */
  .side {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem 2.25rem;
    padding: 0.9rem 0 0;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    break-inside: avoid;
  }

  .side > section:nth-child(2) {
    grid-row: span 3;
  }

  .out {
    min-height: 0;
    padding: 0.15rem 0;
  }

  .address {
    margin-top: 0;
  }

  /* Paper has no hover: spell out where Verify goes. Contact links
     already print their address beneath. */
  .verify::after {
    content: ' (' attr(href) ')';
    color: var(--muted);
  }

  .verify {
    overflow-wrap: anywhere;
  }

  .out svg {
    display: none;
  }

  .badge {
    width: 3rem;
    height: 3rem;
  }
}
