/* Matthew Ferrer: portfolio
   Design: dark, straightforward, information first (inspired by consultancy sites such as valiotti.com).
   What is his alone: the live dashboard recording in the project cards, the browser tour of the
   client websites, his own photographs, and the hero network drawn as 26 tools in three clusters.
   Type: Instrument Serif (headlines), Satoshi (reading), IBM Plex Mono (labels).
   Instrument Serif and IBM Plex Mono: SIL Open Font License. Satoshi: ITF Free Font License. All self-hosted. */

@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/instrumentserif-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/instrumentserif-400-italic.woff2') format('woff2');
}

@font-face {
  font-family: 'Satoshi';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/satoshi-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Satoshi';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/satoshi-700.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/ibmplexmono-400.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/ibmplexmono-500.woff2') format('woff2');
}

/* Stand-ins sized to match the web fonts, so text does not jump when the real fonts arrive.
   Measured in Chrome: width and line metrics of Instrument Serif on Georgia, Satoshi on Arial. */
@font-face {
  font-family: 'Instrument Serif Fallback';
  font-style: normal;
  src: local('Georgia');
  size-adjust: 76.45%;
  ascent-override: 129.5%;
  descent-override: 40.55%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Instrument Serif Fallback';
  font-style: italic;
  src: local('Georgia Italic'), local('Georgia-Italic');
  size-adjust: 78.87%;
  ascent-override: 125.5%;
  descent-override: 39.3%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Satoshi Fallback';
  font-weight: 400;
  src: local('Arial'), local('ArialMT');
  size-adjust: 98.7%;
  ascent-override: 102.3%;
  descent-override: 24.3%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Satoshi Fallback';
  font-weight: 700;
  src: local('Arial Bold'), local('Arial-BoldMT');
  size-adjust: 97%;
  ascent-override: 104.1%;
  descent-override: 24.7%;
  line-gap-override: 0%;
}

:root {
  /* Shape: softly rounded controls */
  --radius: 10px;

  /* Colour: near-black, warm greys, one violet */
  --bg: #0d0d0c;
  --surface: #151513;
  --surface-2: #1c1b19;
  --line: #2a2926;
  --line-strong: #3a3936;
  --ink: #ecebe6;
  --muted: #a3a19a;
  --dim: #85837c;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-text: #c7a9ff;
  --accent-ink: #ffffff;
  --paper: #f4f4f2;

  /* Type */
  --serif: 'Instrument Serif', 'Instrument Serif Fallback', Georgia, 'Times New Roman', serif;
  --sans: 'Satoshi', 'Satoshi Fallback', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-lead: clamp(1.125rem, 1.05rem + 0.4vw, 1.375rem);
  --step-title: clamp(1.5rem, 1.2rem + 1.2vw, 2.25rem);
  --step-head: clamp(2.25rem, 1.4rem + 3vw, 4rem);
  --step-hero: clamp(2.75rem, 1.4rem + 4.6vw, 5.5rem);

  /* Space */
  --margin: clamp(16px, 4vw, 80px);
  --max: 1280px;
  --section: clamp(88px, 10vw, 152px);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* Reset */

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

html {
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--line-strong) var(--bg);
  accent-color: var(--accent);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main,
.site-footer {
  overflow-x: clip;
}

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

ul, ol {
  padding: 0;
}

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

a {
  color: inherit;
}

button, input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

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

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

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

input {
  caret-color: var(--accent-text);
}

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

a, button, summary, input {
  touch-action: manipulation;
}

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

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 12px 18px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.skip-link:focus {
  top: 12px;
}

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

/* Shared type */

.label {
  color: var(--accent-text);
  font-family: var(--mono);
  font-size: var(--step-small);
  font-weight: 500;
  letter-spacing: 0.18em;
  line-height: 1.4;
  text-transform: uppercase;
}

.label-center {
  text-align: center;
}

.title {
  margin-top: 18px;
  font-family: var(--serif);
  font-size: var(--step-head);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.05;
}

.title em,
.hero-title em {
  color: var(--accent-text);
  font-style: italic;
}

.title-center,
.intro-center {
  text-align: center;
}

.intro {
  max-width: 56ch;
  margin-top: 20px;
  color: var(--muted);
  font-size: var(--step-lead);
  line-height: 1.55;
}

.intro-center {
  margin-inline: auto;
}

/* Buttons */

.btn {
  display: inline-flex;
  border-radius: var(--radius);
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 24px;
  border: 1px solid transparent;
  font-size: var(--step-small);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  /* Press feedback uses translate, so it never fights GSAP's transforms. */
  transition: background-color .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease), translate .25s var(--ease), scale .25s var(--ease);
}

.btn:active {
  translate: 0 1px;
  scale: .96;
}

.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-outline {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.btn-outline:hover {
  border-color: var(--ink);
}

/* Rounded controls: every button and the pop-up share one corner size */
.nav-toggle,
.site-tab,
.slider-btn,
.video-toggle,
.copy-btn,
.lightbox-close {
  border-radius: var(--radius);
}

/* Navigation */

.site-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 13, 12, .94);
  transition: transform .45s var(--ease);
}

.site-nav.nav-hidden {
  transform: translateY(-100%);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  width: min(100% - 2 * var(--margin), var(--max));
  height: 72px;
  margin-inline: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
  font-family: var(--mono);
  font-size: var(--step-small);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand b {
  color: var(--accent-text);
  font-weight: 500;
}

.brand-mark {
  width: 32px;
  height: 32px;
}

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-links a {
  padding: 10px 0;
  color: var(--muted);
  font-size: var(--step-small);
  text-decoration: none;
  transition: color .25s var(--ease);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--ink);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-actions .btn {
  min-height: 42px;
  padding: 8px 18px;
}

.nav-toggle {
  display: none;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  background: transparent;
  font-size: var(--step-small);
  font-weight: 700;
}

/* Hero */

.hero {
  position: relative;
  padding: calc(72px + clamp(56px, 8vw, 112px)) 0 clamp(64px, 8vw, 104px);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.hero-net {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-net line {
  stroke: var(--accent-text);
  stroke-opacity: .16;
  stroke-width: 1;
}

.hero-net circle {
  fill: var(--accent-text);
  fill-opacity: .55;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
}

.hero-title {
  margin-top: 22px;
  font-family: var(--serif);
  font-size: var(--step-hero);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.02;
}

.hero-sub {
  max-width: 50ch;
  margin-top: 28px;
  color: var(--muted);
  font-size: var(--step-lead);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

.hero-stats {
  display: grid;
  /* min-content: a figure like 30–40% never breaks; its column takes the room it needs. */
  grid-template-columns: repeat(4, minmax(min-content, 1fr));
  gap: 24px;
  margin-top: 56px;
}

.hero-stats dt {
  font-size: var(--step-title);
  white-space: nowrap;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hero-stats dd {
  margin-top: 12px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: var(--step-small);
  letter-spacing: 0.12em;
  line-height: 1.5;
  text-transform: uppercase;
}

.hero-portrait {
  text-align: center;
}

.hero-portrait img {
  width: min(100%, 260px);
  height: auto;
  aspect-ratio: 1;
  margin-inline: auto;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 12%;
  background: var(--paper);
}

.hero-portrait figcaption {
  display: grid;
  gap: 4px;
  margin-top: 22px;
}

.hero-portrait strong {
  font-size: var(--step-lead);
}

.hero-portrait span {
  color: var(--muted);
  font-size: var(--step-small);
}

.hero-portrait .status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  color: var(--accent-text);
  font-family: var(--mono);
  font-size: var(--step-small);
  letter-spacing: 0.06em;
}

.hero-portrait .status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-text);
}

/* Trust band */

.trust {
  padding: 48px 0;
  border-bottom: 1px solid var(--line);
}

.trust-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 24px 56px;
  margin-top: 24px;
  list-style: none;
}

.trust-logos li {
  display: grid;
  place-items: center;
}

/* Brand colours, no frames: the same treatment as the employer logos below */
.trust-logos img {
  width: auto;
  height: 30px;
}

.trust-logos img[src$="meta-dark.svg"] {
  height: 24px;
}

/* The g's tail makes the file taller below the line, so centring lifts the word. Drop it back onto the shared baseline. */
.trust-logos img[src$="google-wordmark.svg"] {
  position: relative;
  top: 4px;
}

.trust-sub {
  margin-top: 36px;
}

/* Former employers, each in its own logo and lettering */
.worked-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 20px 56px;
  margin-top: 20px;
  list-style: none;
}

.worked-logos img {
  width: auto;
  height: 40px;
}

.worked-logos img[src$="citi.svg"] {
  height: 36px;
}

.worked-logos img[src$="be3.png"] {
  height: 44px;
}

.trust-worked {
  margin-top: 24px;
  color: var(--dim);
  font-size: var(--step-small);
  text-align: center;
}

.trust-worked span {
  color: var(--ink);
  font-weight: 700;
}

/* Sections */

.services,
.method,
.work,
.experience,
.skills,
.credentials,
.faq {
  padding: var(--section) 0;
  border-bottom: 1px solid var(--line);
}

/* Cards: thin outlines on a dark panel */

.cards {
  display: grid;
  gap: 16px;
  margin-top: 56px;
  list-style: none;
}

.cards-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cards-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 40px;
}

.card-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(24px, 2.4vw, 36px);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  transition: border-color .3s var(--ease), background-color .3s var(--ease);
}

.card-box:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.card-num {
  color: var(--accent-text);
  font-family: var(--mono);
  font-size: var(--step-small);
  letter-spacing: 0.12em;
}

.card-box h3 {
  color: var(--ink);
  font-size: var(--step-lead);
  font-weight: 700;
  line-height: 1.3;
}

.card-problem {
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--step-title);
  font-style: italic;
  line-height: 1.15;
}

.card-proof,
.card-link {
  margin-top: auto;
  padding-top: 10px;
  color: var(--accent-text);
  font-size: var(--step-small);
  font-weight: 700;
  text-decoration: none;
}

.card-proof strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: var(--step-title);
  line-height: 1;
}

.card-proof:hover,
.card-link:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

/* How I work */

.method-grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
}

.method-photo {
  position: sticky;
  top: 104px;
}

.method-photo img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  background: var(--paper);
}

/* Work: featured projects in a grid of cards; more work in a card slider */

.deck {
  display: grid;
  gap: 48px;
  margin-top: 56px;
  counter-reset: project;
}

.card {
  display: grid;
  border: 1px solid var(--line);
  background: var(--surface);
}

/* Featured projects, after Brittany Chiang's alternating feature rows (v4.brittanychiang.com):
   a large picture beside the words, swapping sides each row; picture on top on smaller screens. */

.deck .card {
  display: flex;
  flex-direction: column;
  counter-increment: project;
}

/* Same-shaped picture area on every card; a caption or thumbnails take room from the picture, not the card. */
.deck .card .project-media {
  aspect-ratio: 16 / 10;
  justify-content: flex-start;
  padding: 0;
}

.deck .card .project-media > img,
.deck .card .project-video {
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0;
}

/* The n-gram chart has its axis labels at the edges, so it is shown whole. */
#p-ngram .project-media > img {
  object-fit: contain;
}

.deck .project-thumbs {
  margin: 0;
  padding: 8px;
}

.deck .card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.deck .project-field {
  order: -1;
  margin: 0 0 12px;
  color: var(--accent-text);
}

.deck .project-field::before {
  content: counter(project, decimal-leading-zero) " / ";
  color: var(--ink);
}

.deck .project-result {
  color: var(--ink);
}

.deck .project-links {
  margin-top: auto;
  padding-top: 20px;
}

@media (min-width: 960px) {
  .deck {
    gap: clamp(64px, 8vw, 112px);
  }

  .deck .card {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }

  .deck .card:nth-child(even) {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }

  .deck .card:nth-child(even) .project-media {
    order: 2;
  }

  /* The picture fills its side at the height of the words beside it. */
  .deck .card .project-media {
    aspect-ratio: auto;
    min-height: 420px;
  }

  .deck .card-body {
    padding: clamp(32px, 3.4vw, 48px);
  }
}

.card .project-media {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  padding: clamp(16px, 2vw, 28px);
  background: var(--paper);
}

.card .project-media img,
.card .project-video {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
}

.card-body {
  min-width: 0;
  padding: clamp(24px, 3vw, 40px);
  color: var(--muted);
}

.card-body h3 {
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--step-title);
  font-weight: 400;
  line-height: 1.1;
}

.project-field {
  margin-top: 10px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: var(--step-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-result {
  margin-top: 14px;
  color: var(--accent-text);
  font-size: var(--step-lead);
  font-weight: 700;
  line-height: 1.3;
}

.project-desc {
  margin-top: 14px;
}

.project-tools {
  margin-top: 12px;
  color: var(--dim);
  font-size: var(--step-small);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.project-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: var(--step-small);
  font-weight: 700;
  text-decoration: none;
  transition: border-color .25s var(--ease), background-color .25s var(--ease);
}

.project-links a:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.project-more,
.job-more {
  margin-top: 16px;
}

.project-more summary,
.job-more summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  font-size: var(--step-small);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.project-more summary::-webkit-details-marker,
.job-more summary::-webkit-details-marker {
  display: none;
}

.project-more summary::after,
.job-more summary::after {
  content: '+';
  color: var(--accent-text);
  font-size: var(--step-lead);
  line-height: 1;
  transition: transform .3s var(--ease);
}

.project-more[open] summary::after,
.job-more[open] summary::after {
  transform: rotate(45deg);
}

.project-more ul,
.job-more ul {
  display: grid;
  gap: 10px;
  margin-top: 6px;
  padding-left: 20px;
  line-height: 1.55;
}

.has-video {
  position: relative;
}

.project-video {
  display: block;
  background: var(--paper);
}

.video-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink);
  font-size: var(--step-small);
  font-weight: 700;
}

.video-toggle:hover {
  border-color: var(--accent);
}

.media-note {
  padding: 10px 14px;
  background: var(--paper);
  color: #4a4944;
  font-size: var(--step-small);
  line-height: 1.45;
}

.project-cover {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  padding: 32px;
}

.project-cover figcaption {
  margin-top: 12px;
  color: #4a4944;
  font-size: var(--step-small);
}

.cover-illustration {
  width: 70%;
  fill: none;
  stroke: #1c1b19;
  stroke-width: 2;
  stroke-linecap: square;
}

.project-thumbs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.project-thumbs .photo-open {
  aspect-ratio: 16 / 10;
}

.card .project-thumbs .photo-open img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: 0 0;
}

.photo-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--surface-2);
  cursor: zoom-in;
}

.photo-open img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .8s var(--ease);
}

.photo-open:hover img {
  transform: scale(1.05);
}

.more-work {
  margin-top: var(--section);
}

.more-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.more-title {
  font-family: var(--serif);
  font-size: var(--step-title);
  font-weight: 400;
  line-height: 1.1;
}

.slider-controls {
  display: flex;
  gap: 8px;
}

.slider-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-size: var(--step-lead);
  line-height: 1;
  transition: background-color .25s var(--ease), border-color .25s var(--ease), opacity .25s var(--ease), scale .2s var(--ease);
}

.slider-btn:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.slider-btn:disabled {
  opacity: .35;
  cursor: default;
}

.slider-btn:disabled:hover {
  border-color: var(--line-strong);
  background: transparent;
}

.slider {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 2 * 16px) / 3);
  gap: 16px;
  margin-top: 32px;
  padding-bottom: 20px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-color: var(--line-strong) var(--bg);
  grid-template-rows: auto 1fr;
}

/* Each card spans a picture row and a text row shared with its neighbours, so titles line up. */
.mini {
  grid-row: span 2;
  grid-template-rows: auto 1fr;
  grid-template-rows: subgrid;
  row-gap: 0;
  scroll-snap-align: start;
}

/* Wide screens have room for all seven cards: a grid, no arrows. */
@media (min-width: 1200px) {
  .slider {
    grid-auto-flow: row;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: none;
    grid-auto-rows: auto 1fr;
    row-gap: 16px;
    padding-bottom: 0;
    overflow: visible;
    scroll-snap-type: none;
  }

  .slider-controls {
    display: none;
  }
}

.mini .project-media {
  align-self: stretch;
  justify-content: flex-start;
  padding: 0;
}

.mini .project-media img,
.mini .project-cover svg {
  aspect-ratio: 16 / 10;
  height: auto;
  object-fit: cover;
  object-position: 0 0;
}

.mini .card-body {
  padding: 24px;
}

.mini .card-body h3 {
  font-size: var(--step-lead);
  font-family: var(--sans);
  font-weight: 700;
  line-height: 1.3;
}

.mini .project-desc {
  font-size: var(--step-small);
  line-height: 1.55;
}

/* Websites I run */

.clients {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px);
  width: min(100% - 2 * var(--margin), var(--max));
  margin-inline: auto;
  padding: var(--section) 0;
  border-bottom: 1px solid var(--line);
}

.clients-plate {
  align-self: start;
  border: 1px solid var(--line);
  background: var(--surface);
}

.browser-bar {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: var(--step-small);
}

.browser-url[hidden] {
  display: none;
}

.browser-view {
  height: min(64svh, 600px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  scrollbar-color: var(--line-strong) var(--paper);
}

.site-shot {
  display: none;
  width: 100%;
  height: auto;
}

.site-shot.is-on {
  display: block;
}

.clients-copy {
  display: flex;
  flex-direction: column;
}

.site-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 32px;
}

.site-tab {
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: var(--step-small);
  font-weight: 700;
  transition: color .25s var(--ease), border-color .25s var(--ease), scale .2s var(--ease);
}

.site-tab:hover {
  color: var(--ink);
}

.site-tab[aria-selected="true"] {
  border-color: var(--accent);
  color: var(--ink);
}

.site-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding-top: 40px;
}

.js .site-panel[hidden] {
  display: none;
}

.site-panel h3 {
  font-family: var(--serif);
  font-size: var(--step-title);
  font-weight: 400;
  line-height: 1.1;
}

.site-panel p {
  max-width: 44ch;
  margin-top: 16px;
  color: var(--muted);
}

.site-panel .site-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-width: none;
  margin-top: auto;
  padding-top: 40px;
}

.cell {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-size: var(--step-small);
  font-weight: 700;
  text-decoration: none;
  transition: background-color .25s var(--ease), border-color .25s var(--ease), scale .2s var(--ease);
}

.cell-ink {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.cell-ink:hover {
  background: var(--accent-hover);
}

.cell-tone:hover {
  border-color: var(--ink);
}

/* Experience: a timeline beside the Citi photograph */

.exp-grid {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
}

.exp-panel {
  position: sticky;
  top: 104px;
}

.exp-frame {
  position: relative;
  aspect-ratio: 1;
  max-height: calc(100svh - 220px);
  margin-inline: auto;
  overflow: hidden;
}

/* Each employer's logo, centred at a width that gives them equal weight (set per logo in the page).
   The next logo sharpens into place as the last one softens away. */
.exp-shot {
  position: absolute;
  inset: 0;
  width: var(--w, 60%);
  height: auto;
  max-height: 72%;
  margin: auto;
  object-fit: contain;
  opacity: 0;
  scale: .92;
  filter: blur(6px);
  transition: opacity .6s var(--ease), scale .9s var(--ease), filter .6s var(--ease);
}

.exp-shot.is-on {
  opacity: 1;
  scale: 1;
  filter: none;
}

.exp-notes {
  display: grid;
  margin-top: 16px;
}

.exp-note {
  grid-area: 1 / 1;
  color: var(--muted);
  font-size: var(--step-small);
  opacity: 0;
  transition: opacity .4s var(--ease);
}

.exp-note.is-on {
  opacity: 1;
}

.exp-note span {
  display: block;
  margin-bottom: 4px;
  color: var(--dim);
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.jobs {
  display: grid;
  margin-top: 48px;
  list-style: none;
  border-top: 1px solid var(--line);
}

.job {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  column-gap: 32px;
  align-items: start;
  padding: 36px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.job-dates {
  color: var(--accent-text);
  font-family: var(--mono);
  font-size: var(--step-small);
  letter-spacing: 0.06em;
  line-height: 1.5;
}

.job-role {
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--step-title);
  font-weight: 400;
  line-height: 1.1;
}

.job-org {
  margin-top: 8px;
  color: var(--dim);
  font-size: var(--step-small);
}

.job-summary {
  margin-top: 16px;
}

.job-wins {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding-left: 20px;
  color: var(--ink);
  line-height: 1.5;
}

.job-wins li::marker {
  color: var(--accent-text);
}

.job-stack {
  margin-top: 14px;
  color: var(--dim);
  font-size: var(--step-small);
}

/* Tools: a grid of tiles, one group per role */

.tool-group {
  margin-top: 56px;
}

.tool-group h3 {
  color: var(--accent-text);
  font-family: var(--mono);
  font-size: var(--step-small);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 168px), 1fr));
  gap: 10px;
  margin-top: 18px;
  list-style: none;
}

.tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color .3s var(--ease), background-color .3s var(--ease);
}

.tile:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.tile .skill-logo {
  grid-row: 1 / 3;
}

.skill-logo {
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
}

.logo-light {
  filter: brightness(0) invert(1);
  opacity: .9;
}

/* Notion draws its letter on a white shape: flip it so the letter shows on dark */
.logo-invert {
  filter: invert(1);
}

.skill-logo img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

/* SAP is a wide mark: let it take its width instead of shrinking into a square */
.skill-logo img[src$="sap.svg"] {
  width: 40px;
  height: 20px;
}

.gep-mark,
.zephyr-mark {
  font-family: var(--sans);
  font-size: var(--step-small);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.gep-mark {
  color: #5cc28a;
}

.zephyr-mark {
  color: #9aa6e0;
}

.tile-name {
  color: var(--ink);
  font-size: var(--step-small);
  font-weight: 700;
  line-height: 1.3;
}

.tile-level {
  color: var(--dim);
  font-size: var(--step-small);
  line-height: 1.35;
}

/* Credentials */

.cred-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
}

.certs {
  display: grid;
  margin-top: 48px;
  list-style: none;
  border-top: 1px solid var(--line);
}

.cert {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 24px;
  align-items: baseline;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.cert-name {
  font-weight: 700;
  line-height: 1.4;
}

.cert-date {
  color: var(--dim);
  font-family: var(--mono);
  font-size: var(--step-small);
  text-align: right;
}

.cert-date a {
  display: inline-block;
  padding: 6px 0;
  color: var(--accent-text);
  font-weight: 500;
}

.education {
  padding: 32px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.edu-title {
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--step-title);
  font-weight: 400;
  line-height: 1.1;
}

.edu-school {
  margin: 8px 0 14px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: var(--step-small);
}

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

.edu-photos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 24px;
}

.edu-photos .photo-open {
  aspect-ratio: 3 / 4;
}

/* FAQ: an accordion divided by lines */

.faq-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
}

.faq-list {
  border-top: 1px solid var(--line);
}

.faq-list details {
  border-bottom: 1px solid var(--line);
}

.faq-list summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 18px 0;
  font-size: var(--step-lead);
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  list-style: none;
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list summary::after {
  content: '+';
  flex: none;
  color: var(--accent-text);
  font-size: var(--step-title);
  font-weight: 400;
  line-height: 1;
  transition: transform .3s var(--ease);
}

.faq-list details[open] summary::after {
  transform: rotate(45deg);
}

.faq-list details p {
  max-width: 60ch;
  padding-bottom: 24px;
  color: var(--muted);
}

.faq-list a {
  color: var(--accent-text);
}

/* Contact: one centred close */

.contact {
  padding: var(--section) 0;
  border-bottom: 1px solid var(--line);
}

.contact-inner {
  max-width: 44rem;
}

.contact-cta {
  display: flex;
  justify-content: center;
  margin-top: 36px;
}

.contact-cta .btn {
  min-height: 56px;
  padding-inline: 32px;
  font-size: var(--step-body);
}

.contact-cta .btn span {
  transition: translate .25s var(--ease);
}

.contact-cta .btn:hover span {
  translate: 4px 0;
}

.promise {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 28px;
  margin-top: 28px;
  list-style: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: var(--step-small);
  letter-spacing: 0.06em;
}

.promise li::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 10px;
  vertical-align: middle;
  background: var(--accent-text);
}

.contact-list {
  display: grid;
  gap: 0;
  margin-top: 56px;
  border-top: 1px solid var(--line);
  font-size: var(--step-small);
}

.contact-list > div {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.contact-list dt {
  color: var(--dim);
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contact-list a {
  font-weight: 700;
}

.copy-btn {
  min-height: 32px;
  margin-left: 10px;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  background: transparent;
  font-size: var(--step-small);
  font-weight: 700;
}

.copy-btn:hover {
  border-color: var(--ink);
}

.copy-status {
  min-height: 1.6em;
  margin-top: 12px;
  color: var(--accent-text);
  font-size: var(--step-small);
  text-align: center;
}

/* Footer */

.site-footer {
  padding: 72px 0 32px;
}

.foot-grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) repeat(3, minmax(0, 2fr));
  gap: 40px;
}

.foot-brand p {
  max-width: 40ch;
  margin-top: 18px;
  color: var(--muted);
  font-size: var(--step-small);
}

.foot-built strong {
  color: var(--ink);
}

.foot-col {
  display: grid;
  align-content: start;
  gap: 6px;
}

.foot-col .label {
  margin-bottom: 8px;
}

.foot-col a {
  justify-self: start;
  padding: 6px 0;
  color: var(--muted);
  font-size: var(--step-small);
  text-decoration: none;
  transition: color .25s var(--ease);
}

.foot-col a:hover {
  color: var(--ink);
}

.foot-legal {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: var(--step-small);
}

.foot-legal a {
  align-self: start;
  color: var(--muted);
  text-decoration: none;
  transition: color .25s var(--ease);
}

.foot-legal a:hover {
  color: var(--ink);
}

/* Photo viewer */

.lightbox {
  max-width: 94vw;
  max-height: 94dvh;
  padding: 56px 16px 16px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, .9);
}

.lightbox img {
  max-width: 88vw;
  max-height: calc(94dvh - 80px);
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  background: transparent;
  font-size: var(--step-small);
  font-weight: 700;
}

/* Message pop-up */

.mail-dialog {
  width: min(38rem, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .04);
  overscroll-behavior: contain;
}

.mail-dialog[open] {
  animation: mail-in .45s var(--ease);
}

.mail-dialog::backdrop {
  background: rgba(8, 8, 7, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.mail-dialog[open]::backdrop {
  animation: mail-fade .45s var(--ease);
}

@keyframes mail-in {
  from { opacity: 0; translate: 0 16px; scale: .97; }
}

@keyframes mail-fade {
  from { opacity: 0; }
}

.mail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(13, 13, 12, .6);
  transition: border-color .25s var(--ease), rotate .35s var(--ease), scale .2s var(--ease);
}

.mail-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.mail-close:hover {
  border-color: var(--ink);
  rotate: 90deg;
}

.mail-form {
  display: grid;
  gap: 18px;
  padding: clamp(28px, 5vw, 44px);
}

.mail-head {
  padding-right: 40px;
}

.mail-eyebrow {
  color: var(--accent-text);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.mail-title {
  margin-top: 10px;
  font-family: var(--serif);
  font-size: clamp(2.25rem, 1.8rem + 2vw, 3rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1;
}

.mail-title em {
  color: var(--accent-text);
  font-style: italic;
}

.mail-sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: var(--step-small);
}

.mail-row {
  display: grid;
  gap: 18px;
}

@media (min-width: 560px) {
  .mail-row {
    grid-template-columns: 1fr 1fr;
  }
}

.mail-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.mail-label {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mail-form input,
.mail-form textarea {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(13, 13, 12, .55);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  transition: border-color .2s var(--ease), background-color .2s var(--ease), box-shadow .2s var(--ease);
}

.mail-form input::placeholder,
.mail-form textarea::placeholder {
  color: var(--dim);
  opacity: .7;
}

.mail-form input:hover,
.mail-form textarea:hover {
  border-color: #4a4945;
}

.mail-form input:focus,
.mail-form textarea:focus {
  border-color: var(--accent-text);
  background: var(--bg);
  outline: none;
  box-shadow: 0 0 0 3px rgba(199, 169, 255, .18);
}

.mail-form textarea {
  min-height: 132px;
  resize: vertical;
}

.mail-send {
  width: 100%;
  min-height: 52px;
  margin-top: 4px;
}

.mail-arrow {
  transition: translate .25s var(--ease);
}

.mail-send:hover .mail-arrow {
  translate: 4px 0;
}

.mail-send.is-sending .mail-arrow {
  display: none;
}

.mail-send:disabled {
  opacity: .7;
  cursor: progress;
}

.mail-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: mail-spin .7s linear infinite;
}

.mail-send.is-sending .mail-spinner {
  display: inline-block;
}

@keyframes mail-spin {
  to { rotate: 360deg; }
}

.mail-done {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: clamp(40px, 7vw, 64px) clamp(24px, 5vw, 44px);
  text-align: center;
}

.mail-form[hidden],
.mail-done[hidden] {
  display: none;
}

.mail-done p {
  color: var(--muted);
}

.mail-done .btn {
  margin-top: 12px;
}

.mail-check {
  width: 64px;
  height: 64px;
  fill: none;
  stroke: var(--accent-text);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mail-check circle {
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: mail-draw .6s var(--ease) forwards;
}

.mail-check path {
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
  animation: mail-draw .35s var(--ease) .5s forwards;
}

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

@media (prefers-reduced-motion: reduce) {
  .mail-check circle,
  .mail-check path {
    animation: none;
    stroke-dashoffset: 0;
  }

  .mail-dialog[open],
  .mail-dialog[open]::backdrop {
    animation: none;
  }

  .mail-close:hover {
    rotate: none;
  }
}

.mail-status {
  color: var(--muted);
  font-size: var(--step-small);
  text-align: center;
}

.mail-status:empty {
  display: none;
}

.mail-honey {
  position: absolute;
  left: -9999px;
}

body:has(dialog[open]) {
  overflow: hidden;
}

/* Lenis does the smoothing; CSS smooth scroll would stop ScrollTrigger measuring correctly mid-page. */
html.lenis,
html.lenis body {
  height: auto;
}

html.lenis,
.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.has-gsap .photo-open img {
  transition: none;
}

/* Narrower desktops */

@media (max-width: 1199px) and (min-width: 960px) {
  .cards-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .job {
    grid-template-columns: 7.5rem minmax(0, 1fr);
    column-gap: 20px;
  }
}

/* Tablet and phone */

@media (max-width: 959px) {
  .nav-inner {
    height: 64px;
    gap: 12px;
  }

  .nav-links {
    position: fixed;
    inset: 64px 0 auto 0;
    display: grid;
    gap: 0;
    padding: 8px var(--margin) 24px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
  }

  .nav-links.open {
    transform: none;
    opacity: 1;
    visibility: visible;
  }

  .nav-links a {
    padding: 14px 0;
    color: var(--ink);
    font-size: var(--step-lead);
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
  }

  .hero-grid,
  .method-grid,
  .exp-grid,
  .cred-grid,
  .faq-grid,
  .clients {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Footer on smaller screens: the brand across the top, the link lists two by two */
  .foot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px 24px;
  }

  .foot-brand {
    grid-column: 1 / -1;
  }

  .hero-portrait {
    order: -1;
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    text-align: left;
  }

  .hero-portrait img {
    width: 96px;
  }

  .hero-portrait figcaption {
    margin-top: 0;
  }

  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 20px;
  }

  .cards-3,
  .cards-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .method-photo {
    position: static;
    max-width: 22rem;
  }

  .exp-panel {
    display: none;
  }

  .mini {
    grid-template-columns: minmax(0, 1fr);
  }

  .slider {
    grid-auto-columns: calc((100% - 16px) / 2);
  }

  .job {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 8px;
  }

  .foot-legal {
    flex-direction: column;
  }
}

@media (max-width: 599px) {
  .slider {
    grid-auto-columns: 100%;
  }

  .brand span {
    display: none;
  }

  .cert {
    grid-template-columns: minmax(0, 1fr);
  }

  .cert-date {
    text-align: left;
  }

  .contact-list > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .site-panel .site-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* In-page links: press, travel, arrive.
   1. A violet line draws under the link (and stays under the section being read). */

.nav-links a,
.foot-col a {
  background: linear-gradient(var(--accent-text), var(--accent-text)) no-repeat 0 calc(100% - 6px) / 0 1px;
  transition: color .25s var(--ease), background-size .45s var(--ease);
}

.foot-col a {
  background-position: 0 calc(100% - 2px);
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a.active,
.foot-col a:hover,
.foot-col a:focus-visible {
  background-size: 100% 1px;
}

/* 2. A thin bar fills across the top while the page travels to the link's target. */

.travel {
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;
  height: 2px;
  background: var(--accent-text);
  transform: scaleX(0);
  transform-origin: 0 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s var(--ease);
}

/* It shows at once (most of the trip happens early) and fades out when the trip ends. */
.travel.is-on {
  opacity: 1;
  transition-duration: 0s;
}

/* 3. On arrival the section's label is underlined in violet, then lets go; its heading settles. */

.label.is-arriving {
  position: relative;
}

.label.is-arriving::after {
  content: "";
  position: absolute;
  left: var(--arrive-x, 0);
  bottom: -8px;
  width: var(--arrive-w, 100%);
  height: 1px;
  background: currentColor;
  transform-origin: 0 50%;
  animation: arrive-line 1.8s var(--ease) both;
}

.title.is-arriving {
  animation: arrive-settle .9s var(--ease) both;
}

/* A featured card gets a violet edge that fades. */
.card.is-arriving {
  animation: arrive-edge 1.8s var(--ease) both;
}

/* The target is focused for keyboard users; the page already shows where it landed. */
.is-target:focus {
  outline: none;
}

@keyframes arrive-line {
  0% { transform: scaleX(0); opacity: 1; }
  40% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

@keyframes arrive-settle {
  from { translate: 0 10px; }
  to { translate: 0 0; }
}

@keyframes arrive-edge {
  0%, 45% { outline: 1px solid var(--accent-text); outline-offset: -1px; }
  100% { outline: 1px solid transparent; outline-offset: -1px; }
}

@keyframes arrive-fade {
  0%, 50% { opacity: 1; }
  100% { opacity: 0; }
}

/* Press: every control gives a little under the finger and springs back on release.
   `scale` composes with GSAP's transforms. !important because GSAP leaves an inline
   `scale: none` on the elements it brought in (tabs, photos). */
.nav-toggle,
.copy-btn,
.video-toggle,
.lightbox-close,
.photo-open {
  transition: scale .2s var(--ease);
}

:is(.nav-toggle, .copy-btn, .video-toggle, .lightbox-close, .mail-close, .photo-open, .site-tab, .slider-btn, .cell):active:not(:disabled) {
  scale: .96 !important;
}

/* Click: a violet ring spreads from the point pressed, like a signal on the hero network.
   Made by motion.js, so it never appears with reduced motion. */
.ping {
  --ping: 44px;
  position: fixed;
  z-index: 70;
  width: 0;
  height: 0;
  pointer-events: none;
}

dialog .ping {
  position: absolute;
}

.ping.is-control {
  --ping: 76px;
}

.ping::before,
.ping::after {
  content: "";
  position: absolute;
  inset: calc(var(--ping) / -2);
  border: 1px solid var(--accent-text);
  border-radius: 50%;
  /* A darker halo keeps the ring visible over white screenshots. */
  box-shadow: 0 0 0 1px rgba(124, 58, 237, .45);
}

/* A sharp ring, then a fainter echo that travels further. */
.ping::before {
  animation: ping .55s var(--ease) both;
}

.ping::after {
  opacity: 0;
  animation: ping-echo .8s var(--ease) .08s both;
}

@keyframes ping {
  from { transform: scale(.15); opacity: 1; }
  to { transform: scale(1); opacity: 0; }
}

@keyframes ping-echo {
  from { transform: scale(.3); opacity: .7; }
  to { transform: scale(1.45); opacity: 0; }
}

/* Apple-style hover: cards lift gently. Uses `translate`, so it never fights GSAP's transforms. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .card-box,
  .cert,
  .tile {
    transition: border-color .3s var(--ease), background-color .3s var(--ease), translate .5s var(--ease), box-shadow .5s var(--ease);
  }

  .card-box:hover,
  .cert:hover,
  .tile:hover {
    translate: 0 -4px;
    box-shadow: 0 18px 40px -24px rgba(0, 0, 0, .6);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }

  /* With reduced motion the arrival cue still shows, as a fade without movement. */
  .label.is-arriving::after {
    animation: arrive-fade 1.8s linear both !important;
  }

  .card.is-arriving {
    animation: arrive-edge 1.8s linear both !important;
  }

  .title.is-arriving {
    animation: none !important;
  }
}

/* Opening screen: a small robot waves hello, then the page lifts into view like a curtain.
   Shown once per visit by the script in the page head; hidden with reduced motion. */

.opening {
  display: none;
}

.is-opening .opening {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg);
  clip-path: inset(0 0 0 0);
  transition: clip-path .8s cubic-bezier(.76, 0, .24, 1) .1s;
}

.is-opened .opening {
  clip-path: inset(0 0 100% 0);
  pointer-events: none;
}

.opening-inner {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding-inline: 16px;
  text-align: center;
  transition: opacity .35s var(--ease), transform .5s var(--ease), filter .35s var(--ease);
}

.is-opened .opening-inner {
  opacity: 0;
  transform: translateY(-28px);
  filter: blur(6px);
}

.opening-line {
  margin-top: 6px;
  font-family: var(--serif);
  font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
  line-height: 1.05;
  animation: opening-rise .8s var(--ease) .25s both;
}

.opening-line em {
  color: var(--accent-text);
}

.opening-status {
  color: var(--dim);
  font-family: var(--mono);
  font-size: .8125rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  animation: opening-rise .8s var(--ease) .4s both;
}

.opening-bar {
  position: relative;
  width: 140px;
  height: 1px;
  overflow: hidden;
  background: var(--line-strong);
}

.opening-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent-text);
  transform-origin: 0 50%;
  animation: opening-fill 2s cubic-bezier(.45, 0, .2, 1) .1s both;
}

/* The robot, drawn in the site's colours */
.bot {
  width: clamp(124px, 20vw, 168px);
  height: auto;
  overflow: visible;
  animation: bot-in .8s var(--ease) both;
}

.bot-shell { fill: var(--ink); }
.bot-trim { fill: var(--muted); }
.bot-visor { fill: var(--surface); }
.bot-eyes,
.bot-tip { fill: var(--accent-text); }
.bot-core { fill: var(--accent); }
.bot-shadow { fill: rgba(124, 58, 237, .25); }

.bot-stem,
.bot-smile,
.bot-signal path,
.bot-ring {
  fill: none;
  stroke-linecap: round;
}

.bot-stem { stroke: var(--ink); stroke-width: 3; }
.bot-smile { stroke: var(--accent-text); stroke-width: 3; }
.bot-signal path { stroke: var(--accent-text); stroke-width: 2; }
.bot-ring { stroke: var(--accent-text); stroke-width: 1.5; }

.bot-bubble rect,
.bot-bubble path { fill: var(--accent); }

.bot-bubble text {
  fill: var(--accent-ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-anchor: middle;
}

/* Gentle hover, with its shadow breathing underneath */
.bot-float {
  animation: bot-float 2.4s ease-in-out .8s infinite;
}

.bot-shadow {
  transform-box: fill-box;
  transform-origin: center;
  animation: bot-shadow 2.4s ease-in-out .8s infinite;
}

/* The wave: three swings from the shoulder */
.bot-arm {
  transform-box: view-box;
  transform-origin: 128px 124px;
  animation: bot-wave .5s ease-in-out .5s 3 both;
}

.bot-bubble {
  transform-box: fill-box;
  transform-origin: 0 100%;
  animation: bot-bubble .5s var(--ease) .6s both;
}

.bot-eyes rect {
  transform-box: fill-box;
  transform-origin: center;
  animation: bot-blink 1.3s .3s 2;
}

/* Agent signal: rings rise from the antenna, the core light breathes */
.bot-signal path {
  transform-box: view-box;
  transform-origin: 100px 17px;
  animation: bot-signal 1.3s var(--ease) infinite both;
}

.bot-signal path + path {
  animation-delay: .3s;
}

.bot-tip {
  animation: bot-pulse 1.3s ease-in-out infinite;
}

.bot-ring {
  transform-box: fill-box;
  transform-origin: center;
  animation: bot-ring 1.6s var(--ease) .4s infinite both;
}

@keyframes bot-in {
  from { opacity: 0; transform: translateY(20px) scale(.86); }
  to { opacity: 1; transform: none; }
}

@keyframes bot-float {
  50% { transform: translateY(-6px); }
}

@keyframes bot-shadow {
  50% { transform: scaleX(.8); opacity: .55; }
}

@keyframes bot-wave {
  0%, 100% { transform: rotate(26deg); }
  50% { transform: rotate(50deg); }
}

@keyframes bot-bubble {
  from { opacity: 0; transform: scale(.4); }
  to { opacity: 1; transform: none; }
}

@keyframes bot-blink {
  0%, 52%, 60%, 100% { transform: scaleY(1); }
  56% { transform: scaleY(.1); }
}

@keyframes bot-signal {
  0% { opacity: 0; transform: scale(.6); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.15); }
}

@keyframes bot-pulse {
  50% { opacity: .5; }
}

@keyframes bot-ring {
  from { opacity: .7; transform: scale(1); }
  to { opacity: 0; transform: scale(1.5); }
}

@keyframes opening-rise {
  from { opacity: 0; transform: translateY(12px); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}

@keyframes opening-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  .opening {
    display: none !important;
  }
}
