/* ==========================================================================
   Stephan van Dijk — Portfolio
   Fonts — self-hosted Inter Display (the family Figma actually specifies
   throughout, not plain Inter), just the 3 weights the site uses.
   ========================================================================== */

@font-face {
  font-family: "Inter Display";
  src: url("../fonts/InterDisplay-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter Display";
  src: url("../fonts/InterDisplay-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter Display";
  src: url("../fonts/InterDisplay-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   Design tokens
   ========================================================================== */

:root {
  /* Colors — dark is the default. The light values are overridden in the
     :root[data-theme="light"] block below; the theme is set on <html> by the
     inline script in each page's <head>, before first paint. */
  --color-bg-start: #101010;
  --color-bg-end: #1a1a1a;
  --color-heading: #ffffff;
  --color-text: #ffffff;
  --color-text-secondary: #d0d0d0;
  --color-text-muted: #999999;
  --color-surface: #1c1c1c;
  --color-surface-hover: #292929;
  --color-border: #2c2c2c;
  /* the close-up frame in the project cards: a step lighter than the card
     (#2c2c2a on the card, as in the reference), and still on hover */
  --card-frag-bg: rgba(255, 255, 250, 0.07);
  --color-nav-panel: #141414;

  --accent-start: #ff9966;
  --accent-end: #ff6699;
  --accent-start-hover: #ffcbb3;
  --accent-end-hover: #ffb3cb;
  --accent-gradient: linear-gradient(96deg, var(--accent-start) 0.6%, var(--accent-end) 99.4%);
  --accent-gradient-hover: linear-gradient(96deg, var(--accent-start-hover) 0.6%, var(--accent-end-hover) 99.4%);

  /* Figma drop shadow: 0 8 16 (blur radius 16), black at 20% / 8% */
  --shadow-card: 0 8px 16px rgba(0, 0, 0, 0.2);
  --shadow-card-hover: 0 8px 16px rgba(0, 0, 0, 0.32);
  --card-spot-fill: rgba(255, 153, 102, 0.18);
  --card-spot-ring: rgba(255, 153, 102, 0.6);
  --header-fill-rgb: 16, 16, 16;
  --glow-opacity-200: 1;
  --glow-opacity-400: 1;
  --glow-case-opacity-200: 1;
  --glow-case-opacity-400: 1;

  /* Typography */
  --font-sans: "Inter Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;

  /* Layout */
  --content-width: 1200px;
  --home-section-gap: 240px;   /* room between the big sections of the homepage */
  --prose-width: 896px;
  --page-padding: clamp(20px, 6vw, 40px);
  --header-height: 60px;
  --radius-sm: 6px;

  color-scheme: dark;
}

/* Light mode — values from the "V3 light mode" frames in Figma. */
:root[data-theme="light"] {
  --color-bg-start: #fefdfb;
  --color-bg-end: #fbf7f1;
  --color-heading: #000000;
  --color-text: #2e2e2e;
  --color-text-secondary: #2e2e2e;
  --color-text-muted: #666666;
  --color-surface: #ffffff;
  --color-surface-hover: #ffffff;
  --color-border: #dcdcdc;
  --card-frag-bg: #f3efe9;
  --color-nav-panel: #fbf7f1;

  --accent-start: #ff884c;
  --accent-end: #ff0055;
  --accent-start-hover: #ff6a2b;
  --accent-end-hover: #d6004a;

  --shadow-card: 0 8px 16px rgba(0, 0, 0, 0.08);
  --shadow-card-hover: 0 8px 16px rgba(0, 0, 0, 0.14);
  --card-spot-fill: rgba(255, 136, 76, 0.12);
  --card-spot-ring: rgba(255, 136, 76, 0.55);
  --header-fill-rgb: 254, 253, 251;
  --glow-opacity-200: 0.2;
  --glow-opacity-400: 0.5;
  /* Figma's light project pages use stronger glows than its light homepage. */
  --glow-case-opacity-200: 0.5;
  --glow-case-opacity-400: 1;

  color-scheme: light;
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* A solid colour under the body's gradient. Safari on iPhone uses it for the
     bar behind the status bar / Dynamic Island and for the rubber-band area;
     with only a gradient it could not pick a colour and fell back to the
     phone's dark appearance, even with the site in light mode. It is the same
     colour as the header fill, so the bar and the header read as one. */
  background-color: rgb(var(--header-fill-rgb));
}

body {
  margin: 0;
}

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

ul,
ol {
  padding: 0;
  margin: 0;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Base
   ========================================================================== */

body {
  min-height: 100vh;
  background: linear-gradient(to right, var(--color-bg-start), var(--color-bg-end));
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  /* clip, not hidden: overflow-x:hidden with overflow-y left unset forces
     the UA to compute overflow-y as auto too, turning body itself into a
     scroll container instead of the viewport/html — which breaks the
     footer's `position: sticky; top: 100vh` reveal (it needs the viewport
     as its nearest scrolling ancestor). clip doesn't have that side effect. */
  overflow-x: clip;
}

main {
  display: block;
  position: relative;
  padding: 0 var(--page-padding) 80px;
  /* Only clip sideways (the glows hang off the edges). Clipping vertically
     cut the glow off at main's top edge, right under the header, which left a
     visible strip above it on small screens where the glow sits near the top. */
  overflow-x: clip;
}

.gradient-text {
  background: var(--accent-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.visually-hidden {
  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;
  left: var(--page-padding);
  top: -60px;
  z-index: 2000;
  background: var(--color-text);
  color: var(--color-bg-start);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: var(--fw-semibold);
  transition: top 0.15s ease;
}

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

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

/* Decorative background glow — Figma's own technique, ported literally: two
   identically sized and positioned solid #ff9966 ellipses (206x96, i.e.
   this 412x192 box at 50% radius), stacked exactly on top of each other,
   blurred by 200px and 400px respectively (per Figma's own Layer Blur
   panel). A multi-stop radial-gradient was tried here first, but with
   several color stops over a near-black background it produced visible
   banding (rings) instead of a smooth fade — an 8-bit color-precision issue
   gradients are prone to. A blur filter has no such stops to band between:
   it's a real per-pixel average, so it stays smooth at any size. A negative
   z-index keeps it behind every sibling in this stacking context regardless
   of DOM order, which a plain z-index:0 can't guarantee. */
.bg-glow {
  position: absolute;
  z-index: -1;
  width: 412px;
  height: 192px;
  pointer-events: none;
}

.bg-glow::before,
.bg-glow::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #ff9966;
}

/* Layer opacities are themed: Figma has 200px @ 50% / 400px @ 100% in dark and
   200px @ 20% / 400px @ 50% in light. */
.bg-glow::before {
  filter: blur(200px);
  opacity: var(--glow-opacity-200);
}

.bg-glow::after {
  filter: blur(400px);
  opacity: var(--glow-opacity-400);
}

/* Case-study pages: Figma puts the glow at x=1160 (so 120px of it shows) and
   at a different height per page; the offset and height are inline styles. */
.bg-glow--case::before {
  opacity: var(--glow-case-opacity-200);
}

.bg-glow--case::after {
  opacity: var(--glow-case-opacity-400);
}

.bg-glow--left {
  left: -480px;
  bottom: 88px;
}

.bg-glow--right {
  right: -480px;
  bottom: 120px;
}

/* In Figma this glow sits in the gap between Resume and the closer text,
   mostly above the closer section's own top edge — not down by the photo. */
.closer .bg-glow--right {
  top: -180px;
  bottom: auto;
}

/* Phones and tablets: the same two glows as pre-rendered images instead of a
   live blur. A 400px blur makes a layer of roughly 2800x2600 css px, which at
   3x pixel density is more than iOS Safari can rasterise, so parts of the
   page went missing. The images are the blurred ellipses themselves (padding
   of 3 sigma, alpha scaled to the full range) and are shown at the peak value
   of the blur times the themed layer opacity, so the result matches the live
   blur. Measured against it: blur(200px) is a true sigma of 200, blur(400px)
   renders with a sigma of about 255, which is what glow-400.webp contains. */
@media (hover: none) and (pointer: coarse) {
  .bg-glow::before {
    inset: -600px;
    border-radius: 0;
    background: url("../images/general/glow-200.webp") center / 100% 100% no-repeat;
    filter: none;
    opacity: calc(0.212 * var(--glow-opacity-200));
  }

  .bg-glow::after {
    inset: -765px;
    border-radius: 0;
    background: url("../images/general/glow-400.webp") center / 100% 100% no-repeat;
    filter: none;
    opacity: calc(0.1381 * var(--glow-opacity-400));
  }

  .bg-glow--case::before {
    opacity: calc(0.212 * var(--glow-case-opacity-200));
  }

  .bg-glow--case::after {
    opacity: calc(0.1381 * var(--glow-case-opacity-400));
  }
}

/* ==========================================================================
   Header / primary navigation
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--page-padding);
}

/* Header background, built like the Figma node: progressive blur underneath,
   fill on top (Figma: Background blur "Progressive", 24 at the top fading to 0
   at 90% of the height = blur(12px) in CSS; fill is a vertical gradient at 100%
   layer opacity, "Updated Header nav 2" in Figma).

   CSS has no progressive blur, so .site-header__bg stacks six backdrop-filter
   layers. Layer j adds blur on top of the layers below it (blurs compound as the
   square root of the summed squares), so the sigmas 2, 3.5, 4.5, 5.3, 6 and 6.6
   give a total of 2, 4, 6, 8, 10 and 12px as more layers are active, and each
   layer's mask drops it out 9px further down the header. That follows Figma's
   linear 12px -> 0 over the top 54px.

   The fill is ::after, the last child, so it paints over the blur. It cannot be
   a background on .site-header: the blur layers don't pick that up as backdrop
   and would paint over it.

   The blur sits on child elements and not on .site-header itself: a
   backdrop-filter on the header would make it the containing block for the
   fixed-position mobile nav panel, trapping it inside the 60px header. */
.site-header__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.site-header__bg span,
.site-header__bg::after {
  position: absolute;
  inset: 0;
}

/* On an iPhone, Safari lets the page scroll under the status bar / Dynamic
   Island while this sticky header stops just below it, so the content showed
   through the gap above the header. This carries the header's top edge upward
   as one flat bar: at the top the fill is fully opaque (and the blur at its
   strongest), so it is simply that colour. The gradient is not stretched, it
   starts where the header does. Anywhere else it sits above the screen and
   cannot be seen. */
.site-header__bg::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 200px;
  background: rgb(var(--header-fill-rgb));
}

.site-header__bg::after {
  content: "";
  background: linear-gradient(to bottom, rgba(var(--header-fill-rgb), 1) 0%, rgba(var(--header-fill-rgb), 0.25) 63%, rgba(var(--header-fill-rgb), 0) 100%);
}

.site-header__bg span:nth-child(1) {
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  -webkit-mask-image: linear-gradient(to bottom, #000 45px, transparent 54px);
  mask-image: linear-gradient(to bottom, #000 45px, transparent 54px);
}

.site-header__bg span:nth-child(2) {
  -webkit-backdrop-filter: blur(3.5px);
  backdrop-filter: blur(3.5px);
  -webkit-mask-image: linear-gradient(to bottom, #000 36px, transparent 45px);
  mask-image: linear-gradient(to bottom, #000 36px, transparent 45px);
}

.site-header__bg span:nth-child(3) {
  -webkit-backdrop-filter: blur(4.5px);
  backdrop-filter: blur(4.5px);
  -webkit-mask-image: linear-gradient(to bottom, #000 27px, transparent 36px);
  mask-image: linear-gradient(to bottom, #000 27px, transparent 36px);
}

.site-header__bg span:nth-child(4) {
  -webkit-backdrop-filter: blur(5.3px);
  backdrop-filter: blur(5.3px);
  -webkit-mask-image: linear-gradient(to bottom, #000 18px, transparent 27px);
  mask-image: linear-gradient(to bottom, #000 18px, transparent 27px);
}

.site-header__bg span:nth-child(5) {
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(to bottom, #000 9px, transparent 18px);
  mask-image: linear-gradient(to bottom, #000 9px, transparent 18px);
}

.site-header__bg span:nth-child(6) {
  -webkit-backdrop-filter: blur(6.6px);
  backdrop-filter: blur(6.6px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0, transparent 9px);
  mask-image: linear-gradient(to bottom, #000 0, transparent 9px);
}

.site-header__logo {
  color: var(--color-heading);
  font-size: 14px;
  font-weight: var(--fw-medium);
  letter-spacing: -0.1px;
  white-space: nowrap;
}

/* Right-hand side of the header: the nav links, then the theme toggle
   (Figma "Menu nav": links and icon sit in one row, 32px apart), plus the
   hamburger on small screens. */
.site-header__menu {
  display: flex;
  align-items: center;
  gap: 32px;
}

/* Theme toggle, modelled on the one in linear.app's footer: a small rounded
   box with the moon on the left and the sun on the right, and a rounded square
   that slides behind the active icon (dark = left, light = right). The icons
   are the light_mode / dark_mode components from Figma at 14px; the active one
   is solid, the other one is dimmed. Visible size is 54x28px; the ::after
   makes the clickable area larger so it is still easy to hit on a phone. */
.theme-toggle {
  --toggle-w: 24px;
  --toggle-h: 22px;
  --toggle-pad: 2px;
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
  width: calc(var(--toggle-w) * 2 + var(--toggle-pad) * 2 + 2px);
  height: calc(var(--toggle-h) + var(--toggle-pad) * 2 + 2px);
  margin: 0;
  padding: var(--toggle-pad);
  border: 1px solid color-mix(in srgb, var(--color-heading) 11%, transparent);
  border-radius: 9px;
  color: var(--color-heading);
  transition: border-color 0.15s ease;
}

.theme-toggle::after {
  content: "";
  position: absolute;
  inset: -8px -6px;
}

@media (hover: hover) {
  .theme-toggle:hover {
    border-color: color-mix(in srgb, var(--color-heading) 22%, transparent);
  }
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--color-heading);
  outline-offset: 2px;
}

.theme-toggle__thumb {
  position: absolute;
  top: var(--toggle-pad);
  left: var(--toggle-pad);
  width: var(--toggle-w);
  height: var(--toggle-h);
  border-radius: 6px;
  background: color-mix(in srgb, var(--color-heading) 11%, transparent);
  transform: translateX(0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.15, 1);
}

:root[data-theme="light"] .theme-toggle__thumb {
  transform: translateX(var(--toggle-w));
}

.theme-toggle__icon {
  position: relative;
  flex: none;
  width: 14px;
  height: 14px;
  margin: calc((var(--toggle-h) - 14px) / 2) calc((var(--toggle-w) - 14px) / 2);
  opacity: 0.28;
  transition: opacity 0.2s ease;
}

.theme-toggle__icon--moon,
:root[data-theme="light"] .theme-toggle__icon--sun {
  opacity: 1;
}

:root[data-theme="light"] .theme-toggle__icon--moon {
  opacity: 0.28;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 32px;
  color: var(--color-heading);
  font-size: 14px;
  font-weight: var(--fw-medium);
  letter-spacing: -0.1px;
}

.site-nav a {
  white-space: nowrap;
}

.site-nav a:not(.link-accent):hover,
.site-nav a:not(.link-accent):focus-visible {
  opacity: 0.75;
}

.link-accent {
  background-image: var(--accent-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  transition: background-image 0.15s ease;
}

.link-accent:hover,
.link-accent:focus-visible {
  background-image: var(--accent-gradient-hover);
  opacity: 1;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -8px;
}

.nav-toggle__bar,
.nav-toggle__bar::before,
.nav-toggle__bar::after {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-heading);
  border-radius: 1px;
}

.nav-toggle__bar {
  position: relative;
  /* Same resting opacity as the sun/moon icon; see the shared rule below. */
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

/* The hamburger rests at 50% and goes to 100% on hover, keyboard focus, and
   while pressed. Hover only counts on devices that really hover: on a touch
   screen it would stay "stuck" after a tap and leave the icon dark, whereas
   :active only lasts for the moment of the press. */
.nav-toggle:focus-visible .nav-toggle__bar,
.nav-toggle:active .nav-toggle__bar {
  opacity: 1;
}

@media (hover: hover) {
  .nav-toggle:hover .nav-toggle__bar {
    opacity: 1;
  }
}

.nav-toggle__bar::before,
.nav-toggle__bar::after {
  content: "";
  position: absolute;
  left: 0;
  transition: transform 0.2s ease;
}

.nav-toggle__bar::before {
  top: -6px;
}

.nav-toggle__bar::after {
  top: 6px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar::before {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar::after {
  transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 767px) {
  .site-header__menu {
    gap: 20px;
  }

  .nav-toggle {
    display: inline-flex;
  }

  /* The open menu fills the whole screen, including the area behind the header,
     so there is no seam between the header and the panel. The logo and the two
     buttons are lifted above it so they stay visible and clickable. */
  .site-header__logo,
  .theme-toggle,
  .nav-toggle {
    position: relative;
    z-index: 1000;
  }

  .site-nav {
    position: fixed;
    inset: 0;
    z-index: 999;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    /* No side padding: the rows and their divider lines run edge to edge. The
       links carry the page padding themselves. */
    padding: var(--header-height) 0 40px;
    /* Short screens (a phone in landscape): let the panel scroll instead of
       cutting off the last links, and don't pass the scroll on to the page. */
    overflow-y: auto;
    overscroll-behavior: contain;
    background: linear-gradient(180deg, var(--color-nav-panel), var(--color-bg-end));
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  }

  .site-nav[data-open="true"] {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
  }

  /* Header-height strip that sticks to the top of the scrolling panel, so links
     that are scrolled up disappear behind the logo and buttons instead of
     running through them. The negative margin pulls it up over the panel's top
     padding, so the first row starts right under the header. */
  .site-nav::before {
    content: "";
    position: sticky;
    /* sticky offsets start inside the panel's padding, so pull the stuck position
       back up to the very top of the screen */
    top: calc(-1 * var(--header-height));
    z-index: 1;
    flex: none;
    height: var(--header-height);
    margin: calc(-1 * var(--header-height)) 0 0;
    background: var(--color-nav-panel);
  }

  /* Full-width rows, 64px tall including the hairline divider under each one
     (and one above the first), so the list sits cleanly under the header. The
     text is centred in the row. */
  .site-nav a {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 64px;
    padding: 0 var(--page-padding);
    font-size: 16px;
    font-weight: var(--fw-regular);
    line-height: 20px;
    border-bottom: 1px solid var(--color-border);
  }

  .site-nav a:first-child {
    border-top: 1px solid var(--color-border);
  }

  .site-nav a:active {
    background: color-mix(in srgb, var(--color-heading) 6%, transparent);
  }

  /* The row is full width, so a plain gradient would stretch across the whole
     row and show only its first colour behind the short word. Size it to the
     word and start it where the text starts. */
  .site-nav a.link-accent {
    background-size: 4em 100%;
    background-repeat: no-repeat;
    background-position: var(--page-padding) 0;
  }
}

/* ==========================================================================
   Theme switching
   ========================================================================== */

/* Light mode drops the per-project gradient titles for a flat #141414 (Figma). */
:root[data-theme="light"] .project-card__title {
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  color: #141414;
}


/* Cross-fade for the switch. Browsers with the View Transitions API snapshot
   the page before and after the swap and fade between the two, which also
   fades the gradients (page background, header fill, gradient text, glows)
   that plain CSS transitions can't animate. 350ms, ease-in-out. */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* While the swap happens, hover/focus transitions on individual elements are
   switched off so they don't play out under the cross-fade. */
.theme-switching,
.theme-switching *,
.theme-switching *::before,
.theme-switching *::after {
  transition: none !important;
}

/* On iPhone the switch is done by a reload (see main.js): the toggle slides to
   the new side first, driven by data-switch since the page's own theme has not
   changed yet. */
.theme-toggle[data-switch="light"] .theme-toggle__thumb {
  transform: translateX(var(--toggle-w));
}

.theme-toggle[data-switch="dark"] .theme-toggle__thumb {
  transform: translateX(0);
}

.theme-toggle[data-switch="light"] .theme-toggle__icon--sun,
.theme-toggle[data-switch="dark"] .theme-toggle__icon--moon {
  opacity: 1;
}

.theme-toggle[data-switch="light"] .theme-toggle__icon--moon,
.theme-toggle[data-switch="dark"] .theme-toggle__icon--sun {
  opacity: 0.28;
}

/* After that reload the page fades in from the page colour. */
.theme-fade-in body {
  animation: theme-fade-in 0.2s ease-out;
}

@keyframes theme-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-fade-in body {
    animation: none;
  }
}

/* ...except the slide of the toggle, which has to play while the page cross-fades. */
.theme-switching .theme-toggle__thumb {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.15, 1) !important;
}

.theme-switching .theme-toggle__icon {
  transition: opacity 0.2s ease !important;
}

/* The toggle gets its own layer in the view transition and is shown live, so
   the slide isn't swallowed by the page-wide cross-fade. */
.theme-toggle {
  view-transition-name: theme-toggle;
}

::view-transition-group(theme-toggle) {
  animation: none;
}

::view-transition-old(theme-toggle) {
  display: none;
}

::view-transition-new(theme-toggle) {
  animation: none;
}

/* ==========================================================================
   Shared prose block (used for the About text inside the homepage)
   ========================================================================== */

.prose-block {
  position: relative;
  z-index: 1;
  max-width: 440px;
}

.prose-block p + p {
  margin-top: 16px;
}


.prose-block__body {
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0;
  color: var(--color-text-secondary);
}

.prose-block__body p + p {
  margin-top: 16px;
}

/* ==========================================================================
   Homepage sections
   ========================================================================== */

.home-section {
  /* A jump to #projects, #about or #resume lands with the heading 108px from
     the top, where the hero text sits on page load, instead of at the top of
     the empty gap above it (which left 240px of the previous section in view). */
  scroll-margin-top: calc(108px - var(--home-section-gap));
  position: relative;
  z-index: 1;
  max-width: var(--content-width);
  margin: 0 auto;
  padding-top: var(--home-section-gap);
}

.home-section__heading {
  color: var(--color-heading);
  font-size: 20px;
  line-height: 24px;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.2px;
  margin-bottom: 24px;
}

/* ==========================================================================
   Hero (homepage)
   ========================================================================== */

.hero {
  position: relative;
  z-index: 1;
  max-width: var(--content-width);
  margin: 0 auto;
  min-height: calc(100vh - var(--header-height));
  padding: 48px 0 40px;
}

.hero__text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 620px;
  font-size: 16px;
  line-height: 1.1;
  letter-spacing: 0;
}

.hero__text h1,
.hero__text p {
  color: var(--color-text);
  font: inherit;
  margin: 0;
}

/* Keeps a hyphenated word ("hands-on") on one line. */
.hero__text .nobreak {
  white-space: nowrap;
}

/* The opening line as a large display heading (like /hospitable/), the
   line under it as a lead. The heading has 3 fixed lines; the size keeps
   the longest one on one line on small phones too. */
.hero__text h1 {
  color: var(--color-heading);
  font-size: clamp(24px, 8vw, 48px);
  font-weight: var(--fw-semibold);
  line-height: 1.06;
  letter-spacing: -0.045em;
}

.hero__text p {
  margin-top: 12px;
  font-size: 16px;
  line-height: 1.55;
}

.hero__photo {
  position: absolute;
  right: 0;
  bottom: 40px;
  width: 240px;
  height: 240px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.hero__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 900px) {
  .hero {
    min-height: 0;
    padding-bottom: 0;
  }

  .hero__photo {
    position: static;
    margin-top: 32px;
    width: 160px;
    height: 160px;
  }
}

/* ==========================================================================
   Closer (homepage "that's the work" section) + reveal footer bar
   ========================================================================== */

.closer {
  position: relative;
  z-index: 1;
  max-width: var(--content-width);
  margin: 0 auto;
  padding-top: 240px;
}

.closer__content {
  max-width: 440px;
}

.closer__eyebrow {
  color: var(--color-heading);
  font-size: 20px;
  line-height: 24px;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.2px;
  margin-bottom: 16px;
}

.closer__body {
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}

.closer__cta {
  color: var(--color-heading);
  font-size: 16px;
  font-weight: var(--fw-medium);
  letter-spacing: 0;
  line-height: 24px;
}

.closer__ps {
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0;
  color: var(--color-text-secondary);
  margin-top: 24px;
}

.closer__photo {
  width: 240px;
  height: 240px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 200px 0 0 auto;
}

.closer__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 25%;
}

@media (max-width: 900px) {
  .closer__photo {
    margin: 80px 0 0;
    width: 160px;
    height: 160px;
  }
}

/* ==========================================================================
   The 3D pup (js/dog.js): a fixed box in empty space next to a photo of
   Gringo, so it never covers text and never moves the layout. The canvas
   inside ignores the mouse. The pup's paws stand at about 23% of the box
   height, so the boxes hang that far below the photo's bottom edge.
   The intro box runs on under the photo, which lies on top of it: the pup
   starts out hidden behind the photo and walks out to sit next to it.
   ========================================================================== */

.dog-intro,
.dog-cta {
  position: absolute;
  z-index: 0;
  width: 360px;
  height: 270px;
  pointer-events: none;
}

.hero__photo {
  z-index: 1;
}

.dog-intro {
  right: 0;
  width: 616px;
  bottom: calc(40px - 0.23 * 270px);
}

/* Right next to the text with "Let's talk", paws level with the last line. */
.closer__content {
  position: relative;
}

.dog-cta {
  left: calc(100% + 8px);
  bottom: calc(-0.23 * 270px);
}

/* Narrow screens: the text is full width, so both pups sit next to the
   (smaller) photo instead. */
@media (max-width: 900px) {
  .closer__content {
    position: static;
  }

  .hero__photo {
    position: relative;
    bottom: auto;
  }

  .dog-intro,
  .dog-cta {
    left: 172px;
    right: auto;
    width: min(220px, 100% - 172px);
    height: 165px;
    bottom: calc(-0.23 * 165px);
  }

  .dog-intro {
    left: 0;
    width: min(392px, 100%);
  }
}

@media (max-width: 767px) {
  .dog-cta {
    display: none;
  }
}

/* Reveal footer bar: sticky with an offset of exactly one viewport height,
   so it only comes into view once the visitor scrolls past everything
   above it — a pure-CSS "slide up from underneath" effect, no JS needed.
   No background of its own, matching Figma's Footer nav exactly: it's
   transparent, so it just blends into the page's own gradient. */
.site-footer-bar {
  position: sticky;
  top: 100vh;
  z-index: 1;
  /* Three columns with the credit line in the middle one: the two outer
     columns always share the rest equally, so the credit sits exactly in the
     middle whatever the width of the links next to it. */
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  min-height: var(--header-height);
  padding: 8px var(--page-padding);
  font-size: 14px;
  font-weight: var(--fw-medium);
  letter-spacing: -0.1px;
  /* The layout follows the footer's own width (narrower next to the app
     sidebar), not the window's. */
  container-type: inline-size;
}

.site-footer-bar__left {
  display: flex;
  align-items: center;
  gap: 32px;
  color: var(--color-text);
}

.site-footer-bar__left a:hover,
.site-footer-bar__left a:focus-visible {
  opacity: 0.75;
}

.site-footer-bar__right {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 32px;
}

.site-footer-bar__right a:not(.link-accent):hover,
.site-footer-bar__right a:not(.link-accent):focus-visible {
  opacity: 0.75;
}

/* Credit line: plain muted text, regular weight. */
.site-footer-bar__credit {
  grid-column: 2;
  color: var(--color-text-muted);
  font-weight: var(--fw-regular);
  text-align: center;
  text-wrap: balance;
}

/* Phone, mail and LinkedIn as the sidebar's icons, for narrower footers.
   Each icon has a 40px tap area; the first one is pulled back so the icon
   itself lines up with the page edge. */
.site-footer-bar__icons {
  display: none;
  grid-column: 1;
  justify-self: start;
  align-items: center;
  gap: 4px;
  margin-left: -11px;
  color: var(--color-text);
}

.site-footer-bar__icons a {
  display: block;
  padding: 11px;
}

.site-footer-bar__icons svg {
  display: block;
  width: 18px;
  height: 18px;
}

.site-footer-bar__icons a:hover,
.site-footer-bar__icons a:focus-visible {
  opacity: 0.75;
}

/* Below about 1040px the written-out links and the centred credit no longer
   fit side by side: the links become icons on the left, the credit stays
   in the middle. */
@container (max-width: 1039px) {
  .site-footer-bar__left,
  .site-footer-bar__right {
    display: none;
  }

  .site-footer-bar__icons {
    display: flex;
  }
}

/* Phones: icons on the left, the credit on the right. */
@container (max-width: 699px) {
  .site-footer-bar__credit {
    grid-column: 2 / 4;
    justify-self: end;
    text-align: right;
  }
}

/* ==========================================================================
   Projects grid (homepage #projects section)
   ========================================================================== */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  list-style: none;
}

.projects-grid > li {
  display: flex;
}

.project-card {
  --accent-a: var(--accent-start);
  --accent-b: var(--accent-end);
  --glow-x: 50%;
  --glow-y: 50%;
  position: relative;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  min-height: 313px;
  padding: 24px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  transition: background-color 0.2s ease, box-shadow 0.4s ease;
}

/* Hover spotlight: a soft fill (::before) plus a matching border highlight
   (::after), both following the cursor via --glow-x/--glow-y (set from
   main.js on mousemove). The border is a radial gradient masked down to a
   1px ring, same technique used everywhere else in this file for a
   gradient border, since a plain border-color can only be one flat color. */
.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(300px circle at var(--glow-x) var(--glow-y), var(--card-spot-fill), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 1;
  pointer-events: none;
}

.project-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(250px circle at var(--glow-x) var(--glow-y), var(--card-spot-ring), transparent 50%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 2;
  pointer-events: none;
}

.project-card:hover,
.project-card:focus-visible {
  background: var(--color-surface-hover);
  box-shadow: var(--shadow-card-hover);
}

.project-card:hover::before,
.project-card:focus-visible::before,
.project-card:hover::after,
.project-card:focus-visible::after {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .project-card::before,
  .project-card::after {
    transition: none !important;
  }
}

/* A close-up of the project at the top of the card, framed as a cut-out of a
   bigger screen: 40px of room on the left and top, the image running off the
   right and bottom edge, only its top-left corner rounded with a hairline. */
.project-card__frag {
  --card-frag-offset: 40px;
  position: relative;
  z-index: 3;
  overflow: hidden;
  padding: var(--card-frag-offset) 0 0 var(--card-frag-offset);
  border-radius: 8px;
  background: var(--card-frag-bg);
}

.project-card__frag img {
  display: block;
  width: 100%;
  height: auto;
  border-top-left-radius: 8px;
  border-top: 1px solid var(--color-border);
  border-left: 1px solid var(--color-border);
}

.project-card__text {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Homepage cards with a close-up: the frame sits 8px from the card edge, so
   the corners nest (frame 8px + 8px gap = card 16px); the text keeps the
   card's 24px from the edge. */
.projects-grid .project-card,
.more-work__row .project-card {
  padding: 8px 8px 24px;
  border-radius: 16px;
}

.projects-grid .project-card__text,
.more-work__row .project-card__text {
  padding: 0 16px;
}

.project-card__title {
  /* Flex items in a column container stretch to the container's full cross-
     axis width by default. Without shrinking this to the text's own width,
     the gradient background spans the whole card instead of just the word,
     so a short title like "WAIR" only ever shows the first sliver of it —
     reading as a near-solid color instead of a visible transition. */
  align-self: flex-start;
  font-size: 16px;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.16px;
  line-height: 1.2;
  background-image: linear-gradient(90deg, var(--accent-a) 0%, var(--accent-mid, var(--accent-a)) 50%, var(--accent-b) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.project-card__desc {
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--color-text);
  opacity: 0.8;
}

/* Role · domain · result under the description. White on dark, #2e2e2e on
   light, both at 50% (Figma). */
.project-card__meta {
  font-size: 12px;
  line-height: 16px;
  letter-spacing: -0.1px;
  color: var(--color-text);
  opacity: 0.5;
  text-wrap: balance;
}

/* Three columns only while each card is wide enough to keep the longest meta
   line on one line (~330px of text). Measured on the section itself, so the
   narrower column next to the app sidebar is covered too. */
#projects {
  container-type: inline-size;
}

@container (max-width: 1167px) {
  .projects-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

/* ==========================================================================
   More work: the other cases at the bottom of a case page, as one row that
   scrolls sideways (trackpad, swipe, mouse drag in js/main.js, keyboard).
   The cards are the homepage cards (.claude/sync-more-work.py), at the width
   they have on the homepage at this window width.
   ========================================================================== */

.more-work {
  container-type: inline-size;
  position: relative;
  z-index: 1;
  /* 80px above (from Back) and below the cards (to the footer): half of the
     160px that was there before. The case above and main below already give
     those 80px; the row keeps 20px under the cards for their shadow, which
     the bottom margin takes back. */
  margin: 0 0 -20px;
}

.more-work__title {
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}

.more-work__scroller {
  /* Where the page content starts: the first card lines up with it, and the
     row runs on to the edge of the window so the next card peeks in. */
  --mw-start: calc(var(--page-padding) + max(0px, (100cqw - var(--content-width)) / 2));
  margin: -8px calc(-1 * var(--page-padding)) 0;
  padding: 8px var(--mw-start) 20px;   /* room for the card shadow */
  scroll-padding-inline: var(--mw-start);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  /* no scrollbar: the next card peeking in on the right shows there is more */
  scrollbar-width: none;
  border-radius: var(--radius-sm);
}

.more-work__scroller::-webkit-scrollbar {
  display: none;
}

.more-work__scroller:focus-visible {
  outline: 2px solid var(--color-text-muted);
  outline-offset: -2px;
}

/* While the mouse drags the row: no snapping, no text selection. */
.more-work__scroller.is-dragging {
  scroll-snap-type: none;
  cursor: grabbing;
  user-select: none;
}

.more-work__scroller.is-dragging .project-card {
  pointer-events: none;
}

.more-work__row {
  /* homepage widths: 3 columns, 2 from 1167px down, 1 on a phone (here a bit
     narrower than the screen, so the next card shows) */
  --mw-card: calc((min(100cqw, var(--content-width)) - 32px) / 3);
  display: flex;
  gap: 16px;
  width: max-content;
  list-style: none;
}

.more-work__row > li {
  display: flex;
  flex: 0 0 var(--mw-card);
  scroll-snap-align: start;
}

@container (max-width: 1167px) {
  .more-work__row { --mw-card: calc((100cqw - 16px) / 2); }
}

@media (max-width: 600px) {
  .more-work__row { --mw-card: calc(100cqw - 48px); }
}

/* ==========================================================================
   Case study (project detail) pages
   ========================================================================== */

.case-study {
  position: relative;
  z-index: 1;
  max-width: var(--content-width);
  margin: 0 auto;
  padding-top: 40px;
  padding-bottom: 80px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 40px;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--color-heading);
}

.back-link--bottom {
  margin-top: 40px;
  margin-bottom: 0;
}

.case-study__heading {
  max-width: var(--prose-width);
  margin-bottom: 16px;
}

.case-study__title {
  color: var(--color-heading);
  font-size: 32px;
  line-height: 36px;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.64px;
  margin-bottom: 8px;
}

.case-study__meta {
  font-size: 14px;
  color: var(--color-text-muted);
}

/* "Visit <company>" link after the years. Muted like the meta line at rest,
   accent gradient on hover/focus (same treatment as the Contact link). */
.case-study__visit-wrap {
  white-space: nowrap;
}

.case-study__visit {
  color: var(--color-text-muted);
  transition: color 0.15s ease;
}

.case-study__visit:hover,
.case-study__visit:focus-visible {
  background-image: var(--accent-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.case-study__body {
  max-width: var(--prose-width);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Every new section (one that opens with a heading) gets 40px above it, the
   same as between the key numbers and the TL;DR. Images stay 24px from the
   text they belong to. */
.case-study__body:not(.case-study__body--spaced) > .case-study__section:has(> h2):not(:first-child) {
  margin-top: 16px;
}

.case-study__section h2 {
  color: var(--color-heading);
  font-size: 18px;
  line-height: 24px;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.18px;
  margin-bottom: 8px;
}

.case-study__section p {
  font-size: 15px;
  line-height: 24px;
  letter-spacing: 0;
  color: var(--color-text-secondary);
}

.case-study__section p + p {
  margin-top: 16px;
}

.case-study__section ul {
  list-style: disc;
  padding-left: 24px;
  font-size: 15px;
  line-height: 24px;
  letter-spacing: 0;
  color: var(--color-text-secondary);
}

.case-study__section ul li + li {
  margin-top: 4px;
}

.case-study__section--company p {
  color: var(--color-text-secondary);
}

/* TL;DR at the top of a case: label + value rows, then the three impact
   lines as a list, all in the same secondary text colour. */
.tldr__list {
  margin: 0;
  font-size: 15px;
  line-height: 24px;
  letter-spacing: 0;
  color: var(--color-text-secondary);
}

.tldr__list dt {
  display: inline;
  font-weight: var(--fw-medium);
}

.tldr__list dd {
  display: inline;
  margin: 0;
}

.case-study__section .tldr__impact ul {
  margin-top: 0;
}

.case-study__section .tldr__impact li + li {
  margin-top: 0;
}

.tldr__impact dd {
  display: block;
}

/* ==========================================================================
   Extra page parts, built from the case study parts above: subheadings
   that look like the section headings, a plain list with buttons under each
   item, cards like the homepage projects, a video, a contact line and the
   pup with the kiwi.
   ========================================================================== */

/* More room between the parts than on a case: half the homepage's 240px,
   so the page doesn't read as one long block of text. */
.case-study__body--spaced {
  gap: 120px;
  max-width: none;
}

.case-study__body--spaced > .case-study__section {
  max-width: var(--prose-width);
}

.case-study__section h3 {
  color: var(--color-heading);
  font-size: 16px;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.16px;
  margin-bottom: 4px;
}

.case-study__section p + h3,
.case-study__section .todo + h3 {
  margin-top: 16px;
}

.case-study__section strong {
  font-weight: var(--fw-semibold);
}

/* WAIR: the link from the TL;DR down to the prototype, the prototype as a
   jump target that lands just under the sticky header, and the three points
   under it. */
.tldr__try {
  margin-top: 16px;
}

#prototype {
  scroll-margin-top: calc(var(--header-height) + 24px);
}

#prototype:focus {
  outline: none;   /* it only takes focus as a jump target, it is not a control */
}

.why-it-works {
  margin: -8px 0 32px;   /* 24px under the caption, like the space above the figure */
}

/* The heading over all the evidence: a step bigger than the others. */
.case-study__section .proof-title {
  font-size: 20px;
  letter-spacing: -0.2px;
  margin-bottom: 16px;
}

.proof-list {
  list-style: none;
}

.proof-list li + li {
  margin-top: 24px;
}

.proof-list__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.case-study__section .proof-list__links .button {
  margin-top: 0;
}

/* Version 2 of the evidence, to compare: the homepage project cards, same
   size and grid (3 columns, 2 when narrow, 1 on phones), a little wider than
   the text. Hover only (the card itself isn't a link); the cases are
   gradient links like "Let's talk!" in the header. A last card on its own
   sits in the middle of its row. */
.case-study__body--spaced > .proof-cards-section {
  max-width: none;
  container-type: inline-size;
}

.case-study__section .proof-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-left: 0;
  list-style: none;
}

.case-study__section .proof-cards > li {
  display: flex;
  margin: 0;
}

.proof-cards > li:last-child:nth-child(3n + 1) {
  grid-column: 2;
}

@container (max-width: 1167px) {
  .case-study__section .proof-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .proof-cards > li:last-child:nth-child(3n + 1) {
    grid-column: auto;
  }

  .proof-cards > li:last-child:nth-child(2n + 1) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - 8px);
  }
}

@media (max-width: 600px) {
  .case-study__section .proof-cards {
    grid-template-columns: 1fr;
  }

  .proof-cards > li:last-child:nth-child(n) {
    grid-column: auto;
    justify-self: stretch;
    width: auto;
  }
}

/* The title sits where the homepage cards have their icon; the text and
   the case links stay at the bottom. */
.case-study__section .proof-card .project-card__title {
  position: relative;
  z-index: 3;
  margin: 0;
  background: none;
  color: var(--color-heading);
}

.case-study__section .proof-card .project-card__desc {
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--color-text);
}

.proof-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: var(--fw-medium);
  letter-spacing: -0.1px;
}

.video-embed {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

/* [TODO] spots that still need content: clearly unfinished on purpose. */
.case-study__section .todo {
  padding: 8px 12px;
  border: 1px dashed var(--color-text-muted);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--color-text-muted);
}

.case-study__section .video-embed.todo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.case-study__section li .todo {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 14px;
  line-height: 20px;
}

.case-study__section .button {
  margin-top: 8px;
}

.case-study__section figure + p {
  margin-top: 24px;
}

/* Same look as the caption above it. */
.case-study__section .closing-note {
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.resume-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  margin-top: 16px;
  font-size: 14px;
  font-weight: var(--fw-medium);
  letter-spacing: -0.1px;
  color: var(--color-text);
}

.resume-contact a:hover,
.resume-contact a:focus-visible {
  opacity: 0.75;
}

/* The pup and the kiwi (js/dog.js). As elsewhere the paws stand at about
   23% of the box height. js/dog.js sets --dog-bleed: the distance to the
   left edge of the page, which the box reaches out to. */
.dog-kiwi {
  position: relative;
  width: calc(min(440px, 100%) + var(--dog-bleed, 0px));
  height: 220px;
  margin-left: calc(-1 * var(--dog-bleed, 0px));
  pointer-events: none;
}

/* Mockup / image grids inside a case study: one image per row, as wide as
   the text, so the screens on each board can be read without opening them.
   The random page (--auto, ten pictures) keeps two columns. */

.mockup-grid {
  max-width: var(--content-width);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  padding: 8px 0;
}

.mockup-grid--auto {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.mockup-figure {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mockup-figure img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.mockup-figure figcaption {
  font-size: 14px;
  color: var(--color-text-muted);
}


.mockup-figure a {
  display: block;
  border-radius: var(--radius-sm);
  cursor: zoom-in;
}

.mockup-figure a:focus-visible {
  outline-offset: 4px;
}

.mockup-figure a:hover img {
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.mockup-grid--auto img {
  aspect-ratio: auto;
}

/* Single screens split out of an earlier bundle: shown at their own 5:4
   ratio (2580x2056 exports), not cropped to 4:3. */
.mockup-grid--split img,
.mockup-figure--split img {
  aspect-ratio: auto;
}

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

/* ==========================================================================
   Resume
   ========================================================================== */

.resume-list {
  max-width: 592px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.resume-item {
  display: flex;
  gap: 16px;
}

.resume-item__date {
  flex: 0 0 136px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.resume-item__role {
  color: var(--color-heading);
  font-size: 16px;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.16px;
  margin-bottom: 8px;
}

.resume-item__title {
  font-size: 16px;
  letter-spacing: -0.16px;
  color: var(--color-text-secondary);
}

@media (max-width: 560px) {
  .resume-item {
    flex-direction: column;
    gap: 4px;
  }

  .resume-item__date {
    flex-basis: auto;
  }
}


/* ==========================================================================
   404 page (Figma "404 page", node 455:27329): Gringo is the 0 in 404.
   Everything in the 404 graphic is sized in --nf-u, which is 1px on a wide
   screen and shrinks on a narrow one, so the 498px-wide graphic always fits.
   ========================================================================== */

.not-found {
  --nf-u: min(1px, calc((100vw - 2 * var(--page-padding)) / 498));
  --nf-ink: color-mix(in srgb, var(--color-heading) 70%, transparent);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Centered in the window, not in the space under the header. dvh is the
     part of the window you actually see, so on a phone the page is exactly
     one screen high whether or not the browser bars are showing. */
  min-height: calc(100vh - var(--header-height));
  min-height: calc(100dvh - var(--header-height));
  padding-bottom: var(--header-height);
  text-align: center;
  /* Own stacking layer, so the glow (z-index -1) stays above the page background. */
  isolation: isolate;
  /* On phones the glow is a large image that reaches far below the page;
     clip it here so it can't make the page scroll. */
  overflow: clip;
}

/* The body is at least one window high everywhere; here it should be the
   visible height on a phone, not the tallest one. */
.page-404 {
  min-height: 100dvh;
}

/* Light mode (not in Figma): the digits and ring at 35% instead of 70%, so the
   404 stays readable and the dark dog still stands out against the ring. */
:root[data-theme="light"] .not-found {
  --nf-ink: color-mix(in srgb, var(--color-heading) 35%, transparent);
}

:root[data-theme="light"] .not-found__sub {
  color: color-mix(in srgb, var(--color-heading) 55%, transparent);
}

/* Page background and glow on a fixed layer the size of the screen, so the
   glow is not cut off by the page edge and never makes the page scroll. */
.not-found__backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: -1;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(to right, var(--color-bg-start), var(--color-bg-end));
}

/* Safari on iPhone fills the strip under its floating bottom bar with the
   plain page colour (the html background: #101010 or #fefdfb), with a hard
   line where the page ends. On phones and tablets the bottom of the page
   fades into exactly that colour, so the page runs on into the strip. */
@media (hover: none) and (pointer: coarse) {
  .not-found::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    height: 180px;
    pointer-events: none;
    background: linear-gradient(
      to bottom,
      rgba(var(--header-fill-rgb), 0) 0%,
      rgba(var(--header-fill-rgb), 0.6) 55%,
      rgb(var(--header-fill-rgb)) 100%
    );
  }
}

.not-found__code {
  display: flex;
  align-items: center;
  gap: calc(40 * var(--nf-u));
  color: var(--nf-ink);
}

.not-found__digit {
  display: block;
  flex: none;
  width: calc(149 * var(--nf-u));
  height: calc(161 * var(--nf-u));
}

/* The photo is the 0; the ring is drawn outside it, as in Figma. */
.not-found__ring {
  display: block;
  flex: none;
  width: calc(120 * var(--nf-u));
  height: calc(120 * var(--nf-u));
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 calc(20 * var(--nf-u)) var(--nf-ink);
}

.not-found__dog {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: 50% 60%;
  /* Every few seconds Gringo tilts his head like a curious dog: one smooth
     move to 14 degrees clockwise, a short hold, and back. A 5s loop: tilt
     0.6s, hold 1.2s, back 0.6s, rest 2.6s; it starts 1s after the page loads. */
  animation: gringo-tilt 5s 1s infinite;
}

@keyframes gringo-tilt {
  0% {
    transform: rotate(0deg);
    animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1);
  }

  12%,
  36% {
    transform: rotate(14deg);
    animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1);
  }

  48%,
  100% {
    transform: rotate(0deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .not-found__dog {
    animation: none;
  }
}

/* The 3D pup (js/dog.js) searching the strip under the button. As on the
   homepage its paws stand at 23% of the box height, so the box hangs that
   far below the bottom edge (clipped by .not-found) and the paws are 20px
   above it. The content is centred, so the free space under the button is
   about half the window minus 155px; the box gets smaller on a low window
   and is left out when there is no real room. */
.dog-roam {
  --dog-h: min(200px, 40vw, calc((50dvh - 200px) * 1.9));
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(20px - 0.23 * var(--dog-h));
  height: var(--dog-h);
  pointer-events: none;
}

@media (max-height: 540px) {
  .dog-roam {
    display: none;
  }
}

.not-found__text {
  margin-top: 40px;
  color: var(--color-heading);
  line-height: 1.1;
}

/* Figma uses Inter Display Bold here; the site loads up to SemiBold. */
.not-found__title {
  font-size: 20px;
  font-weight: var(--fw-semibold);
}

.not-found__sub {
  margin-top: 8px;
  /* A little quieter than the title: 70% in dark, 55% in light. */
  color: color-mix(in srgb, var(--color-heading) 70%, transparent);
  font-size: 16px;
  font-weight: var(--fw-medium);
  letter-spacing: -0.16px;
}

/* Button (Figma "Button lightmode/darkmode - default/hover"): dark grey in
   dark mode, black in light mode, white text in both. On hover a lighter
   radial glow rises from the top edge. The glow's inner colour is a
   registered property, so it fades in instead of switching; browsers
   without @property simply switch. */
@property --button-glow {
  syntax: "<color>";
  inherits: false;
  initial-value: transparent;
}

.button {
  --button-bg: #292929;
  --button-glow: var(--button-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  margin-top: 24px;
  padding: 0 13px;
  border: 1px solid #474747;
  border-radius: 10px;
  background-color: var(--button-bg);
  background-image: radial-gradient(49.6% 107% at 50% -7%, var(--button-glow) 0%, var(--button-bg) 100%);
  color: #fff;
  font-size: 14px;
  font-weight: var(--fw-semibold);
  line-height: 20px;
  letter-spacing: -0.14px;
  white-space: nowrap;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.12),
    0 2px 4px rgba(0, 0, 0, 0.1),
    0 1px 1px rgba(0, 0, 0, 0.08);
  transition: --button-glow 0.2s ease;
}

:root[data-theme="light"] .button {
  --button-bg: #000;
}

.button:focus-visible {
  --button-glow: #474747;
}

@media (hover: hover) {
  .button:hover {
    --button-glow: #474747;
  }
}

/* The compact button with an optional leading icon: 36px high, medium weight.
   Used for the resume download (hospitable) and the WAIR prototype link. */
.button.pill {
  gap: 8px;
  height: 36px;
  margin-top: 0;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: var(--fw-medium);
}

.button.pill svg {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   How I lead (homepage) and key numbers (case pages)
   ========================================================================== */

.lead-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 24px;   /* no row gap: the rows are inside the items (subgrid) */
  list-style: none;
}

/* Title, line and proof share rows across the columns (subgrid), so the
   proof lines start at the same height even when a line above wraps. */
.lead-item {
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  align-content: start;
}

.lead-item__proof {
  margin-top: 4px;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: -0.16px;
  color: var(--color-text-secondary);
}

.lead-item__title {
  color: var(--color-heading);
  font-size: 16px;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.16px;
  margin-bottom: 8px;
}

.lead-item__text {
  font-size: 16px;
  line-height: 24px;
  letter-spacing: -0.16px;
  color: var(--color-text-secondary);
}

/* stacked items: room above every item that starts a new row */
@media (max-width: 900px) {
  .lead-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lead-item:nth-child(n + 3) .lead-item__title { margin-top: 32px; }
}

@media (max-width: 560px) {
  .lead-list { grid-template-columns: 1fr; }
  .lead-item:nth-child(n + 2) .lead-item__title { margin-top: 32px; }
}

/* A row of key numbers under the case heading: label and number only, the
   TL;DR below gives the context. Numbers count up once (js/main.js). */
.case-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  max-width: 720px;
  margin: 40px 0;   /* same space above (to the meta line) as below (to the TL;DR) */
}

.case-stat {
  /* label on top, number at the bottom: a label that wraps to two lines on
     a small screen never pushes its number out of line with the others */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.case-stat__label {
  font-size: 14px;
  line-height: 20px;
  color: var(--color-text-muted);
}

.case-stat__value {
  margin-top: 6px;
  font-family: "Inter Display", var(--font-sans);
  font-size: 32px;
  line-height: 1;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.02em;
  color: var(--color-heading);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .case-stats { gap: 16px; }
  .case-stat__value { font-size: 26px; }
  .case-study__title { font-size: 28px; line-height: 32px; letter-spacing: -0.56px; }
  .case-stat__label { font-size: 13px; line-height: 18px; }
}

/* ==========================================================================
   Load and scroll animation (js/main.js), modelled on katehanrahan.design
   with the same values. Intro on load: pure CSS. Sections below the fold:
   classes set by the script, so without it nothing is hidden.
   ========================================================================== */

@keyframes sr-ease-up {
  0% { opacity: 0; transform: translateY(18px); filter: blur(6px); }
  100% { opacity: 1; transform: none; filter: none; }
}

@media (prefers-reduced-motion: no-preference) {
  /* Everything below only applies with html.sr-anim, which a small script in
     each page's <head> sets on a visible, fresh load. Without it (no
     JavaScript, a page opened in a background tab, back/forward, reduced
     motion) nothing is hidden and the content simply shows. */
  /* page intro: title first and slowest, then the rest */
  /* the homepage photo is left out on purpose: it shows at once, so the 3D
     pup that stands next to it (js/dog.js) always lines up with it */
  .sr-anim .hero__text > *,
  .sr-anim .case-study > .back-link:first-child,
  .sr-anim .case-study__heading > *,
  .sr-anim .case-stats,
  .sr-anim .h2-hero .wrap > * {
    animation: sr-ease-up 1.1s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  }
  .sr-anim .hero__text > h1,
  .sr-anim .case-study__heading > h1,
  .sr-anim .h2-hero .wrap > h1 {
    animation-delay: 0.1s;
    animation-duration: 1.4s;
  }
  .sr-anim .hero__text > p,
  .sr-anim .case-study__heading > p,
  .sr-anim .h2-hero .wrap > :nth-child(2) { animation-delay: 0.45s; }
  .sr-anim .case-stats,
  .sr-anim .h2-hero .wrap > :nth-child(3) { animation-delay: 0.65s; }
  .sr-anim .case-study > .back-link:first-child,
  .sr-anim .h2-hero .wrap > :nth-child(n + 4) { animation-delay: 0.9s; }

  /* sections on screen at load: right after the intro */
  .sr-anim .sr-intro { animation: sr-ease-up 1.1s cubic-bezier(0.22, 0.61, 0.36, 1) 1s both; }

  /* sections below the fold, and the lists and cards inside them */
  .sr-anim .sr-reveal,
  .sr-anim .sr-reveal .sr-item {
    transition: opacity 0.9s, transform 1s cubic-bezier(0.22, 0.61, 0.36, 1), filter 0.9s;
  }
  .sr-anim .sr-reveal .sr-item { transition-delay: calc(var(--i, 0) * 110ms + 200ms); }
  .sr-anim .sr-reveal.sr-pending { opacity: 0; transform: translateY(36px); filter: blur(4px); }
  .sr-anim .sr-reveal.sr-pending .sr-item { opacity: 0; transform: translateY(18px); }
}
