/* ==========================================================================
   Hamza Farahat — portfolio
   "Paper & Screens": warm paper, ink type, small dark screens that run,
   and one signal colour (yellow) for what is live and what to press.

   1. Fonts            6. Hero            11. Project page
   2. Tokens           7. Work            12. Work index, 404
   3. Base             8. About           13. Scenes
   4. Layout           9. Skills          14. Utilities
   5. Components      10. Contact         15. Motion and reduced motion
      (+ header, footer)
   ========================================================================== */


/* 1. Fonts ----------------------------------------------------------------
   Self-hosted variable fonts. The ?v= matches the preload link in base.html;
   bump both if a font file is ever replaced. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque-latin.woff2?v=1") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque-latin-ext.woff2?v=1") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin.woff2?v=1") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-ext.woff2?v=1") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Common Latin is a smaller slice of the same variable fonts. The complete
   Latin and extended faces above supply every other supported character. */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque-latin-common.woff2?v=1") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0, U+00A9, U+00B7, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-common.woff2?v=1") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0, U+00A9, U+00B7, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026;
}

/* Fallbacks resized to the web fonts' metrics, so text does not jump when they arrive. */
@font-face {
  font-family: "Bricolage Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Liberation Sans");
  size-adjust: 93.6%;
  ascent-override: 99.3%;
  descent-override: 28.8%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "JetBrains Fallback";
  src: local("Courier New"), local("Liberation Mono");
  ascent-override: 102%;
  descent-override: 30%;
  line-gap-override: 0%;
}


/* 2. Tokens --------------------------------------------------------------- */

:root {
  color-scheme: light;

  /* Paper and ink */
  --paper: #F4F1EA;
  --paper-2: #ECE8DE;
  --card: #FBF9F4;
  --ink: #15171C;
  --ink-2: #4A4F58;
  --ink-3: #5F646C;
  --line: rgba(21, 23, 28, .12);
  --line-strong: rgba(21, 23, 28, .24);
  --ok-ink: #0F7A55;
  --live: #17A672;
  --focus: #15171C;

  /* Signal yellow. It is a fill, a marker or a light, never small text on paper. */
  --accent: #FFC533;
  --accent-ink: #15171C;
  --accent-ink-2: #43391A;
  --accent-line: rgba(21, 23, 28, .2);
  --accent-edge: #9A7410;
  --on-ink: #F4F1EA;

  /* Keys (buttons): border and the solid edge underneath */
  --key-line: #15171C;
  --key-edge: #15171C;
  --key-primary-line: #15171C;
  --key-primary-edge: #15171C;

  /* Screens: the dark surfaces that host scenes. Same in both themes. */
  --screen: #111419;
  --screen-2: #191D25;
  --screen-3: #232834;
  --screen-line: rgba(255, 255, 255, .09);
  --screen-edge: transparent;
  --screen-bar: rgba(255, 255, 255, .13);
  --screen-bar-dim: rgba(255, 255, 255, .07);
  --screen-bar-strong: rgba(255, 255, 255, .22);
  --screen-text: #E8EBF0;
  --screen-muted: #99A2B2;
  --ok: #46D39A;
  --info: #7FB2FF;

  /* Type */
  --font-sans: "Bricolage Grotesque", "Bricolage Fallback", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "JetBrains Fallback", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --fs-hero: clamp(2.75rem, 1.5rem + 5.8vw, 6rem);
  --fs-page: clamp(2.5rem, 1.5rem + 4.4vw, 4.75rem);
  --fs-title: clamp(2rem, 1.4rem + 2.6vw, 3.5rem);
  --fs-lead: clamp(1.125rem, 1.02rem + .5vw, 1.375rem);
  --fs-body: 1.0625rem;
  --fs-small: .9375rem;
  --fs-label: .8125rem;

  /* Space */
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;
  --section-y: clamp(4.5rem, 3rem + 6vw, 9rem);
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --container: 75rem;
  --header-h: 4rem;

  /* Shape */
  --r-chip: 8px;
  --r-key: 12px;
  --r-card: 18px;
  --r-screen: 24px;
  --r-panel: clamp(24px, 4vw, 32px);

  /* Depth: hairlines do most of the work, shadows are soft and rare */
  --shadow-card: 0 1px 0 rgba(21, 23, 28, .04), 0 14px 34px -18px rgba(21, 23, 28, .2);
  --shadow-card-hover: 0 1px 0 rgba(21, 23, 28, .05), 0 30px 50px -22px rgba(21, 23, 28, .36);
  --shadow-screen: 0 1px 0 rgba(21, 23, 28, .25), 0 12px 22px -14px rgba(21, 23, 28, .45), 0 36px 64px -30px rgba(21, 23, 28, .55);
  --shadow-menu: 0 30px 40px -30px rgba(21, 23, 28, .35);

  /* Motion */
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --dur-press: 140ms;
  --dur-hover: 200ms;
  --dur-reveal: 520ms;

  /* Which icon the theme toggle shows (the theme you would switch to) */
  --theme-moon: block;
  --theme-sun: none;
}

/* Dark theme: token overrides only. The same block appears twice on purpose —
   once for visitors whose system is dark, once for the header toggle. Keep them in sync. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0D0F13;
    --paper-2: #12151A;
    --card: #1B2029;
    --ink: #ECEEF2;
    --ink-2: #B6BCC8;
    --ink-3: #8D95A3;
    --line: rgba(255, 255, 255, .1);
    --line-strong: rgba(255, 255, 255, .2);
    --ok-ink: #46D39A;
    --live: #46D39A;
    --focus: #FFC533;
    --key-line: #3E4553;
    --key-edge: #3E4553;
    --key-primary-line: #FFC533;
    --key-primary-edge: #9A7410;
    --screen: #151920;
    --screen-edge: rgba(255, 255, 255, .1);
    --shadow-card: 0 1px 0 rgba(0, 0, 0, .3);
    --shadow-card-hover: 0 28px 48px -22px rgba(0, 0, 0, .85);
    --shadow-screen: 0 36px 64px -30px rgba(0, 0, 0, .9);
    --shadow-menu: 0 30px 40px -30px rgba(0, 0, 0, .8);
    --theme-moon: none;
    --theme-sun: block;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0D0F13;
  --paper-2: #12151A;
  --card: #1B2029;
  --ink: #ECEEF2;
  --ink-2: #B6BCC8;
  --ink-3: #8D95A3;
  --line: rgba(255, 255, 255, .1);
  --line-strong: rgba(255, 255, 255, .2);
  --ok-ink: #46D39A;
  --live: #46D39A;
  --focus: #FFC533;
  --key-line: #3E4553;
  --key-edge: #3E4553;
  --key-primary-line: #FFC533;
  --key-primary-edge: #9A7410;
  --screen: #151920;
  --screen-edge: rgba(255, 255, 255, .1);
  --shadow-card: 0 1px 0 rgba(0, 0, 0, .3);
  --shadow-card-hover: 0 28px 48px -22px rgba(0, 0, 0, .85);
  --shadow-screen: 0 36px 64px -30px rgba(0, 0, 0, .9);
  --shadow-menu: 0 30px 40px -30px rgba(0, 0, 0, .8);
  --theme-moon: none;
  --theme-sun: block;
}


/* 3. Base ----------------------------------------------------------------- */

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

html {
  background: var(--paper);
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  flex: 1;
}

main:focus {
  outline: none;
}

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

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

p {
  text-wrap: pretty;
}

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

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

img {
  height: auto;
}

a {
  border-radius: 4px; /* rounds the focus ring of plain links */
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

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

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


/* 4. Layout --------------------------------------------------------------- */

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

.section {
  padding-block: var(--section-y);
}

.section--band {
  background: var(--paper-2);
}

/* Label + title on the left, a short lead on the right. */
.section-head {
  display: grid;
  gap: var(--space-4) var(--space-7);
  margin-bottom: clamp(2rem, 1.25rem + 3vw, 3.5rem);
}

.section-head .lead {
  max-width: 30rem;
  color: var(--ink-2);
}

@media (min-width: 54rem) {
  .section-head {
    grid-template-columns: minmax(0, 1fr) minmax(0, 25rem);
    align-items: end;
  }
}

.section-title {
  margin-top: var(--space-4);
  font-size: var(--fs-title);
  font-weight: 750;
  line-height: 1.02;
  letter-spacing: -.012em;
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.5;
  letter-spacing: -.005em;
}


/* 5. Components ----------------------------------------------------------- */

/* Icons: one stroke set (see templates/partials/icons.html) */
.icon {
  flex: none;
  width: 1.25em;
  height: 1.25em;
}

/* Labels, indices, badges: the mono voice */
.label {
  display: flex;
  align-items: center;
  gap: .625rem;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.label::before {
  content: "";
  flex: none;
  width: 1.25rem;
  height: 1.5px;
  background: currentColor;
}

.index {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}

.index__sep {
  opacity: .6;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .5rem .3rem .375rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-chip);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: .6875rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge .icon {
  width: .875rem;
  height: .875rem;
}

/* Tags: tools and skills */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
}

.tag {
  padding: .3125rem .5rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-chip);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* Keys: every button is a key you press. The solid edge underneath is swallowed on :active. */
.key {
  --key-bg: var(--card);
  --key-fg: var(--ink);
  --key-border: var(--key-line);
  --key-shadow: var(--key-edge);
  --key-depth: 3px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .625rem;
  min-height: 3.25rem;
  padding: 0 1.375rem;
  border: 1.5px solid var(--key-border);
  border-radius: var(--r-key);
  background: var(--key-bg);
  box-shadow: 0 var(--key-depth) 0 var(--key-shadow);
  color: var(--key-fg);
  font-size: var(--fs-body);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-press) var(--ease-out), box-shadow var(--dur-press) var(--ease-out);
}

.key--primary {
  --key-bg: var(--accent);
  --key-fg: var(--accent-ink);
  --key-border: var(--key-primary-line);
  --key-shadow: var(--key-primary-edge);
}

/* The primary action where the surface itself is yellow. */
.key--ink {
  --key-bg: var(--accent-ink);
  --key-fg: var(--on-ink);
  --key-border: var(--accent-ink);
  --key-shadow: var(--accent-edge);
}

.key--compact {
  --key-depth: 2px;
  min-height: 2.75rem;
  padding: 0 .9375rem;
  border-radius: 10px;
  font-size: var(--fs-small);
}

@media (hover: hover) and (pointer: fine) {
  .key:hover {
    transform: translateY(-1px);
    box-shadow: 0 calc(var(--key-depth) + 1px) 0 var(--key-shadow);
  }
}

.key:active {
  transform: translateY(var(--key-depth));
  box-shadow: 0 0 0 var(--key-shadow);
}

/* Links with an icon beside the text */
.icon-link {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: .22em;
  transition: text-decoration-color var(--dur-hover) ease;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 2.75rem;
  font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
  .icon-link:hover {
    text-decoration-thickness: 2.5px;
    text-decoration-color: var(--accent);
  }
}

/* Arrow icons lean the way they point when their link is hovered. */
.nudge {
  transition: transform var(--dur-hover) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  a:hover .nudge--right { transform: translateX(3px); }
  a:hover .nudge--left { transform: translateX(-3px); }
  a:hover .nudge--down { transform: translateY(3px); }
}

/* Square icon buttons (theme, menu) */
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-hover) ease, transform var(--dur-press) var(--ease-out);
}

.icon-button .icon {
  width: 1.375rem;
  height: 1.375rem;
}

@media (hover: hover) and (pointer: fine) {
  .icon-button:hover {
    background: var(--line);
  }
}

.icon-button:active {
  transform: scale(.94);
}

.theme-icon__moon { display: var(--theme-moon); }
.theme-icon__sun { display: var(--theme-sun); }

.menu-icon {
  display: grid;
}

.menu-icon > * {
  grid-area: 1 / 1;
  transition: opacity var(--dur-press) ease, transform var(--dur-press) var(--ease-out);
}

.menu-icon__close,
[aria-expanded="true"] > .menu-icon > .menu-icon__open {
  opacity: 0;
  transform: scale(.8);
}

[aria-expanded="true"] > .menu-icon > .menu-icon__close {
  opacity: 1;
  transform: none;
}

/* Status: "Open to new projects" */
.status {
  display: inline-flex;
  align-items: center;
  gap: .625rem;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.status__dot {
  position: relative;
  flex: none;
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--live);
}

.status__dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  opacity: 0;
}

/* The yellow marker block behind a word. Ink on yellow in both themes. */
.marker {
  display: inline-block;
  margin-top: .1em;
  padding: .02em .14em .09em;
  border-radius: .13em;
  background: var(--accent);
  color: var(--accent-ink);
}

/* The yellow panel. Everything inside reads as ink on yellow, whatever the theme. */
.panel {
  --ink: var(--accent-ink);
  --ink-2: var(--accent-ink-2);
  --ink-3: var(--accent-ink-2);
  --line: var(--accent-line);
  --line-strong: var(--accent-ink);
  --focus: var(--accent-ink);
  --card: var(--accent);
  --key-line: var(--accent-ink);
  --key-edge: var(--accent-ink);

  border-radius: var(--r-panel);
  background: var(--accent);
  color: var(--ink);
}

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

/* "Copy address": the label swaps to "Copied" in place, so the key keeps its width. */
.copy {
  display: inline-grid;
  place-items: center;
}

.copy > span {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  gap: .625rem;
  transition: opacity 160ms ease, transform 160ms var(--ease-out), filter 160ms ease;
}

.copy__done,
.copy[data-copied] > .copy__idle {
  opacity: 0;
  filter: blur(2px);
}

.copy__done { transform: translateY(6px); }
.copy[data-copied] > .copy__idle { transform: translateY(-6px); }

.copy[data-copied] > .copy__done {
  opacity: 1;
  filter: none;
  transform: none;
}


/* Header ------------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
}

/* The bar's surface fades in once the page has scrolled (site.js adds .is-scrolled). */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity var(--dur-hover) ease;
}

.site-header.is-scrolled::before,
.site-header.is-menu-open::before,
html:not(.js) .site-header::before {
  opacity: 1;
}

.site-header__bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--header-h);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: .625rem;
  min-height: 2.75rem;
  margin-right: auto;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -.015em;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark__mark {
  flex: none;
  width: .875rem;
  height: .875rem;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 0 1.5px var(--key-primary-line);
}

.wordmark__short { display: none; }
.site-header .wordmark { margin-right: 0; }

.site-header__portfolios {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-right: auto;
  padding-inline: .65rem;
  border-radius: var(--r-chip);
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: .3em;
}

.site-header__portfolios:is(:hover, [aria-current]) {
  background: var(--paper-2);
  text-decoration-color: currentColor;
}

.site-nav__list {
  display: flex;
  align-items: center;
}

.site-nav__link {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding-inline: .875rem;
  border-radius: 10px;
  color: var(--ink-2);
  font-size: var(--fs-small);
  font-weight: 550;
  text-decoration: none;
  transition: color var(--dur-hover) ease;
}

.site-nav__link:focus-visible {
  outline-offset: -2px;
}

.site-nav__link[aria-current] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: .4em;
}

@media (hover: hover) and (pointer: fine) {
  .site-nav__link:hover {
    color: var(--ink);
  }
}

.site-nav__theme {
  display: none;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: var(--space-2);
}

.site-header__menu {
  display: none;
}

/* Small screens: wordmark, contact action and a menu button. */
@media (width < 54rem) {
  .site-header__theme {
    display: none;
  }

  .site-header__menu {
    display: inline-grid;
    margin-right: -.5rem;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    padding: var(--space-2) var(--gutter) var(--space-5);
    border-bottom: 1px solid var(--line);
    background: var(--paper);
    box-shadow: var(--shadow-menu);
  }

  .js .site-nav {
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity var(--dur-press) ease, transform var(--dur-press) var(--ease-out), visibility 0s var(--dur-press);
  }

  .js .site-nav.is-open {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity var(--dur-hover) ease, transform var(--dur-hover) var(--ease-out), visibility 0s;
  }

  .site-nav__list {
    display: block;
  }

  .site-nav__link {
    min-height: 3.5rem;
    padding-inline: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    color: var(--ink);
    font-size: 1.5rem;
    font-weight: 650;
    letter-spacing: -.02em;
  }

  .site-nav__theme {
    display: flex;
    align-items: center;
    gap: .625rem;
    min-height: 3rem;
    margin-top: var(--space-3);
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink-2);
    font-size: var(--fs-small);
    font-weight: 550;
    cursor: pointer;
  }

  /* Without JavaScript there is no menu button: the links sit in a row under the bar,
     and the taller header scrolls away with the page. */
  html:not(.js) .site-header {
    position: relative;
  }

  html:not(.js) .site-header__bar {
    flex-wrap: wrap;
    padding-top: var(--space-2);
  }

  html:not(.js) .site-nav {
    position: static;
    order: 3;
    width: 100%;
    padding: 0 0 var(--space-2);
    border: 0;
    background: none;
    box-shadow: none;
  }

  html:not(.js) .site-nav__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--space-4);
  }

  html:not(.js) .site-nav__link {
    min-height: 2.75rem;
    border: 0;
    font-size: var(--fs-body);
  }
}


/* Keep the portfolio link and both primary actions visible on a phone. */
@media (max-width: 30rem) {
  .site-header .wordmark__full { display: none; }
  .site-header .wordmark__short { display: inline; }
}

@media (max-width: 24.5rem) {
  .site-header .wordmark__mark { display: none; }

  .wordmark {
    gap: .5rem;
    font-size: 1rem;
  }

  .site-header__actions {
    gap: var(--space-1);
    margin-left: 0;
  }

  .site-header__actions .key--compact {
    padding-inline: .5rem;
  }

  .site-header__bar { gap: var(--space-1); }
  .site-header__portfolios { padding-inline: .375rem; }
}


/* Footer ------------------------------------------------------------------ */

.site-footer {
  padding-block: var(--space-6) var(--space-7);
  border-top: 1px solid var(--line);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-6);
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-5);
  color: var(--ink-2);
  font-size: var(--fs-small);
  font-weight: 500;
}

.site-footer__links a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 2.75rem;
  text-decoration: none;
  transition: color var(--dur-hover) ease;
}

@media (hover: hover) and (pointer: fine) {
  .site-footer__links a:hover {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: .3em;
  }
}

.site-footer__legal {
  width: 100%;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

@media (min-width: 54rem) {
  .site-footer__legal {
    width: auto;
    margin-left: var(--space-5);
  }
}


/* 6. Hero ----------------------------------------------------------------- */

.hero {
  padding-block: clamp(2rem, 1rem + 4vw, 4.5rem) clamp(2.5rem, 1.5rem + 4vw, 5rem);
}

/* Small screens: text, screen, then the quick links. Wide: the links sit under the text. */
.hero__grid {
  display: grid;
  gap: clamp(2.25rem, 1.5rem + 3vw, 3rem);
}

@media (min-width: 62.5rem) {
  .hero__grid {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
    gap: 0 clamp(3rem, 5vw, 4.5rem);
  }

  .hero__text {
    grid-area: 1 / 1;
    align-self: end;
  }

  .hero__kinds {
    grid-area: 2 / 1;
    align-self: start;
    margin-top: var(--space-6);
  }

  .hero__demo {
    grid-area: 1 / 2 / 3 / 3;
    align-self: center;
  }
}

.hero__title {
  margin-top: var(--space-5);
  font-size: var(--fs-hero);
  font-weight: 800;
  line-height: .95;
  letter-spacing: -.005em;
  text-wrap: wrap;
  overflow-wrap: anywhere;
}

/* Short laptop screens: keep the lead and the buttons above the fold. */
@media (min-width: 62.5rem) and (max-height: 48rem) {
  .hero__title {
    font-size: min(var(--fs-hero), 5rem);
  }
}

/* The marked word always takes its own line; it hangs left so the letters align. */
.hero__title .marker {
  display: block;
  width: fit-content;
  margin-left: -.14em;
}

.hero__lead {
  max-width: 35rem;
  margin-top: clamp(1.5rem, 1rem + 1.5vw, 2rem);
  color: var(--ink-2);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-6);
  margin-top: clamp(1.75rem, 1rem + 2vw, 2.5rem);
}

/* The quiet row of common requests. Inline, so the lines can balance when it wraps. */
.hero__kinds {
  padding-top: var(--space-2);
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: var(--fs-small);
  text-wrap: balance;
}

.hero__kinds li {
  display: inline;
}

.hero__kinds a {
  display: inline-block;
  margin-right: 1.125rem;
  padding-block: .625rem;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: .3em;
  transition: color var(--dur-hover) ease, text-decoration-color var(--dur-hover) ease;
}

@media (hover: hover) and (pointer: fine) {
  .hero__kinds a {
    padding-block: .3125rem;
  }

  .hero__kinds a:hover {
    color: var(--ink);
    text-decoration-color: currentColor;
  }
}

/* Three plain-word captions under the hero screen */
.steps {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-5);
  color: var(--ink-2);
  font-size: var(--fs-small);
  line-height: 1.35;
}

.steps li {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.steps__n {
  display: grid;
  flex: none;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 500;
  line-height: 1;
}

@media (min-width: 34rem) {
  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-5);
  }

  .steps li {
    align-items: flex-start;
  }

  .steps__n {
    margin-top: -.125rem;
  }
}


/* 7. Work ----------------------------------------------------------------- */

.work {
  padding-top: clamp(3rem, 2rem + 4vw, 6rem);
}

.work-grid {
  display: grid;
  gap: clamp(1rem, .5rem + 1.5vw, 1.5rem);
}

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

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

/* The whole card is one link: a screen on top, the details underneath. */
.work-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-hover) var(--ease-out), border-color var(--dur-hover) ease;
}

/* The deeper hover shadow fades in on its own layer, so only opacity animates. */
.work-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: var(--shadow-card-hover);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-hover) ease;
}

.work-card__screen {
  border-radius: calc(var(--r-card) - 6px);
}

.work-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: var(--space-4) .875rem .875rem;
}

.work-card__meta {
  display: flex;
  align-items: center;
  gap: .625rem;
  min-height: 2rem;
}

.work-card__go {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin-left: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-chip);
  color: var(--ink-2);
  transition: background-color var(--dur-hover) ease, border-color var(--dur-hover) ease, color var(--dur-hover) ease;
}

.work-card__go .icon {
  width: 1.125rem;
  height: 1.125rem;
  transition: transform var(--dur-hover) var(--ease-out);
}

.work-card__title {
  margin-top: var(--space-3);
  font-size: 1.4375rem;
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: -.02em;
}

.work-card__tagline {
  margin-top: .375rem;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.45;
}

.work-card__tags {
  margin-top: auto;
  padding-top: var(--space-5);
}

@media (hover: hover) and (pointer: fine) {
  .work-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-3px);
  }

  .work-card:hover::after {
    opacity: 1;
  }

  .work-card:hover .work-card__go {
    border-color: var(--key-primary-line);
    background: var(--accent);
    color: var(--accent-ink);
  }

  .work-card:hover .work-card__go .icon {
    transform: translate(1.5px, -1.5px);
  }
}

.work-card:focus-visible .work-card__go {
  border-color: var(--key-primary-line);
  background: var(--accent);
  color: var(--accent-ink);
}

.work-card:active {
  transform: scale(.985);
}

/* Compact card (previous / next): the screen sits beside the title. */
.work-card--compact {
  flex-direction: row;
  align-items: center;
}

.work-card--compact .work-card__screen {
  flex: none;
  width: clamp(7rem, 38%, 13rem);
}

.work-card--compact .work-card__body {
  padding-block: var(--space-2);
}

.work-card--compact .work-card__title {
  font-size: clamp(1.1875rem, 1rem + .7vw, 1.4375rem);
}

/* The last cell of the grid */
.ask-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  height: 100%;
  padding: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-card);
}

.ask-card__icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1.5px solid var(--key-primary-line);
  border-radius: var(--r-key);
  background: var(--accent);
  color: var(--accent-ink);
}

.ask-card__icon .icon {
  width: 1.375rem;
  height: 1.375rem;
}

.ask-card__title {
  margin-top: auto;
  padding-top: var(--space-7);
  font-size: clamp(1.625rem, 1.4rem + .9vw, 2rem);
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -.012em;
}

.ask-card__text {
  margin-top: var(--space-3);
  color: var(--ink-2);
}

.ask-card .key {
  margin-top: var(--space-5);
}


/* 8. About ---------------------------------------------------------------- */

.about__grid {
  display: grid;
  align-items: center;
  gap: clamp(2.75rem, 1.5rem + 5vw, 5.5rem);
}

@media (min-width: 54rem) {
  .about__grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }
}

/* The photo sits on an offset yellow block, like a key on its edge. */
.portrait {
  position: relative;
  width: min(100% - 1rem, 26.25rem);
  margin-bottom: 1rem; /* room for the offset block */
}

.portrait::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--key-primary-line);
  border-radius: var(--r-screen);
  background: var(--accent);
  transform: translate(1rem, 1rem);
}

.portrait img {
  position: relative;
  width: 100%;
  border: 1.5px solid var(--key-primary-line);
  border-radius: var(--r-screen);
  background: var(--paper-2);
}

.about__text .lead {
  max-width: 34rem;
  margin-top: var(--space-5);
}

.about__text .lead + p {
  max-width: 34rem;
  margin-top: var(--space-4);
  color: var(--ink-2);
}

.about__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-6);
  margin-top: var(--space-5);
}


/* 9. Skills --------------------------------------------------------------- */

.skills__grid {
  display: grid;
  gap: clamp(2.5rem, 1.5rem + 3vw, 4rem) clamp(2rem, 1rem + 4vw, 4.5rem);
}

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

.skill-group__head {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding-bottom: var(--space-4);
  border-bottom: 1.5px solid var(--ink);
}

.skill-group__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--card);
}

.skill-group__icon .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.skill-group__title {
  font-size: 1.375rem;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -.02em;
}

.skill-group__head .index {
  margin-left: auto;
}

.skill-row {
  display: grid;
  gap: var(--space-2) var(--space-4);
  padding-block: .8125rem;
  border-bottom: 1px solid var(--line);
}

.skill-row dt {
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: .08em;
  text-transform: uppercase;
}

@media (min-width: 30rem) {
  .skill-row {
    grid-template-columns: 9.75rem minmax(0, 1fr);
    align-items: baseline;
  }
}


/* 10. Contact ------------------------------------------------------------- */

.contact {
  padding-top: 0;
}

.section--band + .contact {
  padding-top: var(--section-y);
}

.contact__panel {
  display: grid;
  gap: clamp(2rem, 1rem + 4vw, 4rem);
  padding: clamp(1.75rem, .75rem + 5vw, 4.5rem);
}

@media (min-width: 60rem) {
  .contact__panel {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    align-items: end;
  }
}

.contact__title {
  margin-top: var(--space-5);
  font-size: clamp(2.25rem, 1.3rem + 4vw, 4.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.005em;
}

.contact__text {
  max-width: 30rem;
  margin-top: var(--space-5);
  color: var(--ink-2);
  font-size: var(--fs-lead);
  line-height: 1.45;
}

.contact__direct { flex: 1 1 100%; }

.contact__email {
  font-weight: 650;
  text-underline-offset: .2em;
  overflow-wrap: anywhere;
}

@media (hover: hover) and (pointer: fine) {
  .contact__email:hover { text-decoration-thickness: 2px; }
}

.contact__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-3);
  margin-block: var(--space-5) var(--space-4);
}

/* The compact version on project pages */
.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5) var(--space-6);
  padding: clamp(1.5rem, 1rem + 2.5vw, 2.75rem) clamp(1.5rem, 1rem + 3vw, 3.25rem);
}

.cta__title {
  font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.01em;
}

.cta__text {
  margin-top: var(--space-2);
  color: var(--ink-2);
  font-size: var(--fs-lead);
}

.directory__inquiry { margin-top: var(--space-7); }
.journal__inquiry { margin-top: var(--space-6); }
.story__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
}

/* Project inquiry and confirmation */
.inquiry, .inquiry-result {
  padding-block: var(--space-5) var(--section-y);
}

.inquiry__layout {
  display: grid;
  gap: var(--space-6);
  align-items: start;
  margin-top: var(--space-5);
}

.inquiry__intro .page-title { max-width: 12ch; }
.inquiry__intro .lead, .inquiry-result .lead {
  max-width: 44ch;
  margin-top: var(--space-5);
  color: var(--ink-2);
}

.inquiry__next {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  max-width: 42ch;
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line-strong);
}

.inquiry__next > .icon { flex: none; margin-top: .3rem; }
.inquiry__next h2 { font-size: var(--fs-body); }
.inquiry__next p, .inquiry-hint, .inquiry-fallback, .inquiry-result__hint {
  color: var(--ink-2);
  font-size: var(--fs-small);
}
.inquiry__next p { margin-top: var(--space-1); }

.inquiry-form, .inquiry-result__card {
  min-width: 0;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
}
.inquiry-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
}
.inquiry-field { min-width: 0; }
.inquiry-field label, .inquiry-form__label { display: block; font-weight: 700; }
.inquiry-field label span { font-weight: 450; color: var(--ink-2); }
.inquiry-context p, .inquiry-hint { margin-top: var(--space-1); }
.inquiry-context {
  padding-left: var(--space-4);
  border-left: 4px solid var(--accent);
}

.inquiry-field :is(textarea, input, select) {
  display: block;
  width: 100%;
  min-height: 3rem;
  margin-top: var(--space-2);
  padding: .65rem .8rem;
  border: 1px solid var(--ink-3);
  border-radius: var(--r-chip);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}
.inquiry-field textarea { resize: vertical; min-height: 7rem; }
.inquiry-field [aria-invalid="true"] { border-width: 2px; }
.inquiry-form__row { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
.inquiry-form__send .key, .inquiry-result .key {
  max-width: 100%;
  padding: .65rem 1rem;
  white-space: normal;
}
.inquiry-error { margin-top: var(--space-2); font-weight: 650; }
.inquiry-notice {
  padding: var(--space-3) var(--space-4);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--r-chip) var(--r-chip) 0;
  background: var(--paper-2);
  overflow-wrap: anywhere;
}
.inquiry-form button:disabled {
  background: var(--paper-2);
  color: var(--ink-2);
  border-color: var(--line-strong);
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}
.inquiry-fallback a, .inquiry-result a { overflow-wrap: anywhere; }
.inquiry-fallback { padding-top: var(--space-4); border-top: 1px solid var(--line); }
.inquiry-result { max-width: 50rem; padding-top: clamp(2rem, 7vw, 6rem); }
.inquiry-result__card { padding: clamp(1.5rem, 5vw, 4rem); }
.inquiry-result__hint, .inquiry-result .inquiry-notice { margin-top: var(--space-4); }
.inquiry-result form, .inquiry-result .key { margin-top: var(--space-5); }
.inquiry-result form .key { margin-top: 0; }
.inquiry-result__back { display: flex; width: fit-content; margin-top: var(--space-5); }

@media (min-width: 40rem) {
  .inquiry-form__row { grid-template-columns: 1.2fr 1fr; gap: var(--space-4); }
}
@media (min-width: 58rem) {
  .inquiry__layout {
    grid-template-columns: minmax(0, .83fr) minmax(0, 1.17fr);
    gap: clamp(2.5rem, 6vw, 5.5rem);
  }
  .inquiry__next { margin-top: var(--space-7); }
}


/* 11. Project page -------------------------------------------------------- */

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-4);
}

.project-hero {
  display: grid;
  align-items: center;
  gap: clamp(2.25rem, 1.5rem + 4vw, 4.5rem);
  padding-block: clamp(1.5rem, 1rem + 2vw, 3rem) clamp(3.5rem, 2rem + 6vw, 6.5rem);
}

@media (min-width: 60rem) {
  .project-hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.project-hero__title {
  margin-top: var(--space-5);
  font-size: var(--fs-page);
  font-weight: 800;
  line-height: .96;
  letter-spacing: -.005em;
  overflow-wrap: break-word;
}

.project-hero__lead {
  max-width: 32rem;
  margin-top: var(--space-5);
  color: var(--ink-2);
}

.project-hero .tags {
  margin-top: var(--space-5);
}

.project-hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-6);
  margin-top: var(--space-6);
}

.walkthrough { min-width: 0; }

.walkthrough__screen {
  position: relative;
}

.walkthrough video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--screen-edge);
  border-radius: var(--r-screen);
  background: var(--screen);
  box-shadow: var(--shadow-screen);
}

.walkthrough__play {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  white-space: nowrap;
}

.walkthrough__play[hidden] { display: none; }

.walkthrough__steps {
  margin-top: var(--space-2);
  color: var(--ink-2);
  font-size: var(--fs-small);
}

.walkthrough__steps summary {
  width: fit-content;
  min-height: 2.75rem;
  padding-block: .6rem;
  font-weight: 600;
  cursor: pointer;
}

.walkthrough__steps ol {
  display: grid;
  gap: var(--space-2);
  padding-inline-start: 1.5rem;
  list-style: decimal;
}

/* Content blocks: a mono heading in the left rail, the content beside it. */
.project-block {
  display: grid;
  gap: var(--space-5) var(--space-7);
  padding-block: clamp(2.5rem, 1.5rem + 4vw, 4.5rem);
  border-top: 1px solid var(--line);
}

@media (min-width: 54rem) {
  .project-block {
    grid-template-columns: 13rem minmax(0, 1fr);
  }

  .project-block > .label {
    align-self: start;
    padding-top: .625rem;
  }
}

.project-overview {
  max-width: 24em;
  font-size: clamp(1.5rem, 1.1rem + 1.9vw, 2.625rem);
  font-weight: 550;
  line-height: 1.12;
  letter-spacing: -.012em;
  text-wrap: balance;
}

.checklist {
  display: grid;
  column-gap: var(--space-7);
  max-width: 50rem;
}

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

.checklist li {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding-block: .9375rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.3;
}

.checklist .icon {
  color: var(--ok-ink);
}

.prose {
  max-width: 42rem;
}

.prose > * + * {
  margin-top: var(--space-4);
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
  list-style: revert;
}

.prose a {
  text-decoration-thickness: 1.5px;
  text-underline-offset: .22em;
}

.project-recipe .prose {
  min-width: 0;
}

.project-recipe li + li {
  margin-top: var(--space-2);
}

.project-recipe figcaption {
  font-family: var(--font-mono);
  font-size: .875rem;
}

.project-recipe pre {
  overflow-x: auto;
  margin-top: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--line);
  background: var(--paper-2);
  font: .875rem/1.55 var(--font-mono);
}

/* Demo video: our own poster first, YouTube only after the click. */
.video {
  --key-primary-line: var(--accent);
  --key-primary-edge: var(--accent-edge);

  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--screen-edge);
  border-radius: var(--r-screen);
  background: var(--screen);
  box-shadow: var(--shadow-screen);
}

.video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video__facade {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: .375rem;
  padding: var(--space-5);
  color: var(--screen-text);
  text-align: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.video__facade:focus-visible {
  border-radius: calc(var(--r-screen) - 6px);
  outline-color: var(--accent);
  outline-offset: -8px;
}

.video__key {
  --key-depth: 4px;
  width: clamp(4.5rem, 3rem + 6vw, 6.5rem);
  min-height: clamp(3.5rem, 2.5rem + 4vw, 4.75rem);
  margin-bottom: clamp(.75rem, 2vw, 1.5rem);
  padding: 0;
  border-radius: 16px;
}

.video__key .icon {
  width: 1.75rem;
  height: 1.75rem;
}

.video__title {
  font-size: clamp(1.125rem, .9rem + 1.2vw, 1.75rem);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -.02em;
}

.video__note {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  color: var(--screen-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: .04em;
}

.video__note .icon {
  width: 1rem;
  height: 1rem;
}

/* A stand-in player timeline along the bottom edge of the poster */
.video__facade::after {
  content: "";
  position: absolute;
  right: clamp(1rem, 4%, 2rem);
  bottom: clamp(1rem, 6%, 2rem);
  left: clamp(1rem, 4%, 2rem);
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) 0 2.5rem, var(--screen-bar) 2.5rem);
}

@media (max-width: 34.99rem) {
  .video__facade::after {
    display: none;
  }
}

@media (hover: hover) and (pointer: fine) {
  .video__facade:hover .video__key {
    transform: translateY(-1px);
    box-shadow: 0 calc(var(--key-depth) + 1px) 0 var(--key-shadow);
  }
}

.video__facade:active .video__key {
  transform: translateY(var(--key-depth));
  box-shadow: 0 0 0 var(--key-shadow);
}

/* Previous / next */
.more-work {
  padding-block: clamp(3rem, 2rem + 4vw, 5rem) var(--section-y);
}

.more-work__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-5);
  margin-bottom: var(--space-5);
}

.more-work__title {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -.012em;
}

.more-work__grid {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 48rem) {
  .more-work__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* 12. Work index, 404 ----------------------------------------------------- */

.page-head {
  padding-block: clamp(2.5rem, 1.5rem + 5vw, 5.5rem) clamp(2rem, 1.25rem + 3vw, 3.5rem);
}

.page-head__grid {
  display: grid;
  gap: var(--space-5) var(--space-7);
}

.page-head .lead {
  max-width: 30rem;
  color: var(--ink-2);
}

@media (min-width: 54rem) {
  .page-head__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 25rem);
    align-items: end;
  }
}

.page-title {
  margin-top: var(--space-5);
  font-size: var(--fs-page);
  font-weight: 800;
  line-height: .96;
  letter-spacing: -.005em;
}

.work-index {
  padding-bottom: var(--section-y);
}

.directory {
  padding-block: clamp(2.25rem, 1.5rem + 3vw, 4rem) var(--section-y);
}

.directory__head {
  margin-bottom: clamp(1.75rem, 1rem + 3vw, 3rem);
}

.directory__head .page-title { margin-top: 0; }
.directory__head .lead { margin-top: var(--space-5); color: var(--ink-2); }

.directory__grid {
  display: grid;
  gap: clamp(1rem, .5rem + 1.5vw, 1.5rem);
}

.directory-card__body {
  align-self: center;
  width: 100%;
  padding: var(--space-4);
}

.directory-card__head {
  display: flex;
  align-items: flex-start;
  gap: .625rem;
}

.directory-card__title {
  font-size: clamp(1.375rem, 1.2rem + .65vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -.012em;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.directory-card .work-card__go { flex: none; }

/* Editorial pages share the portfolio's paper, ink and type scale. */
.journal { padding-block: var(--space-7) var(--section-y); }
.journal__mast { max-width: 58rem; margin-bottom: clamp(2.5rem, 6vw, 5rem); }
.journal__mast .page-title { margin-top: var(--space-4); overflow-wrap: anywhere; }
.journal__shelf { padding-block: var(--space-6); border-top: 1px solid var(--line-strong); }
.journal__section-name { font-size: clamp(1.45rem, 2.5vw, 2rem); line-height: 1.15; }
.journal__entries { padding: 0; list-style: none; }
.journal__entries > li + li { border-top: 1px solid var(--line); }
.journal-entry {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-5);
  padding-block: var(--space-5); color: var(--ink); text-decoration: none;
}
.journal-entry h3 { font-size: clamp(1.35rem, 2.4vw, 2rem); line-height: 1.16; }
.journal-entry p:not(.label) { margin-top: var(--space-2); max-width: 62ch; color: var(--ink-2); }
.journal-entry .label { margin-bottom: var(--space-2); }
.journal-entry > .icon { flex: none; }
.journal-entry:is(:hover, :focus-visible) h3 { text-decoration: underline; text-underline-offset: .15em; }
.story__mast .label { margin-top: var(--space-6); }
.story__mast .lead { max-width: 65ch; margin-top: var(--space-5); color: var(--ink-2); }
.story__layout { display: grid; gap: var(--space-6); border-top: 1px solid var(--line-strong); padding-top: var(--space-6); }
.story__contents ul { list-style: none; margin-top: var(--space-3); padding: 0; }
.story__contents a { display: flex; align-items: center; min-height: 2.75rem; padding-block: .4em; color: var(--ink-2); }
.story__body { max-width: 64ch; min-width: 0; font-size: clamp(1.08rem, 1.6vw, 1.22rem); }
.story__body section { margin-bottom: var(--space-7); }
.story__body h2 { font-size: clamp(1.5rem, 2.5vw, 2.15rem); line-height: 1.15; }
.story__body p { margin-top: var(--space-4); line-height: 1.65; }
.story__sources { padding-block: var(--space-5); border-block: 1px solid var(--line); }
.story__sources ul { margin-top: var(--space-3); padding-left: 1.25em; list-style: disc; }
.story__sources li + li { margin-top: var(--space-2); }
.story__sources a { overflow-wrap: anywhere; }
@media (min-width: 54rem) {
  .journal__shelf, .story__layout { display: grid; grid-template-columns: minmax(12rem, 1fr) minmax(0, 3fr); gap: var(--space-7); }
  .journal__shelf .journal-entry:first-child { padding-top: 0; }
  .journal__entries > li + li .journal-entry:first-child { padding-top: var(--space-5); }
  .story__contents { position: sticky; top: calc(var(--header-h) + 1.5rem); align-self: start; }
}

.directory-card .scene[data-scene] {
  aspect-ratio: 2 / 1;
}

@media (min-width: 35rem) {
  .directory-card {
    display: grid;
    grid-template-columns: minmax(0, .68fr) minmax(0, 1fr);
  }

  .directory-card .scene[data-scene] {
    height: 100%;
    min-height: 9.5rem;
    aspect-ratio: auto;
  }
}

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

.notfound {
  display: grid;
  align-content: center;
  min-height: min(70vh, 44rem);
  padding-block: var(--section-y);
}

.notfound__title {
  margin-top: var(--space-5);
  font-size: var(--fs-hero);
  font-weight: 800;
  line-height: .95;
  letter-spacing: -.005em;
}

.notfound__text {
  margin-top: var(--space-5);
  color: var(--ink-2);
}

.notfound__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-3);
  margin-top: var(--space-6);
}


/* 13. Scenes --------------------------------------------------------------
   A scene is an inline SVG on a dark screen (templates/scenes/*.svg, 400×300; hero 560×440).
   The .scene wrapper is the screen: surface, border, radius and aspect ratio.

   States: without .is-live a scene shows its finished picture. site.js adds .is-live while a
   scene is on screen (never under reduced motion); only then do the animation classes below
   run, each from its "before" state to the finished one. For .scene--loop, site.js fades the
   picture out, restarts the same animations and fades it back every --scene-cycle.

   Timing lives on the element:  style="--at: 1.2s"  (start)  and  "--dur: .6s"  (length). */

.scene {
  --scene-cycle: 9s;

  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--screen-edge);
  border-radius: var(--r-key);
  background: var(--screen);
}

.scene[data-scene="hero"] {
  --scene-cycle: 12s;
  aspect-ratio: 14 / 11;
  background-image: radial-gradient(var(--screen-line) 1px, transparent 1px);
  background-size: 15px 15px;
}

.scene--large {
  border-radius: var(--r-screen);
  box-shadow: var(--shadow-screen);
}

.scene > svg {
  width: 100%;
  height: 100%;
  font-family: var(--font-mono);
  transition: opacity 240ms ease;
}

.scene.is-resetting > svg {
  opacity: 0;
}

.scene-player {
  position: relative;
  min-width: 0;
}

.scene-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 4px 0 0 auto;
  border: 0;
  border-radius: 50%;
  color: var(--ink-2);
  background: transparent;
  cursor: pointer;
}

.scene-player--hero .scene-toggle {
  position: absolute;
  top: 4px;
  right: 7px;
  margin: 0;
  color: var(--screen-muted);
}

.scene-toggle .icon { width: 16px; height: 16px; }
.scene-toggle[hidden],
.scene-toggle__play,
.scene-toggle[data-paused] .scene-toggle__pause { display: none; }
.scene-toggle[data-paused] .scene-toggle__play { display: block; }

/* Shared shapes */
.s-panel { fill: var(--screen-2); stroke: var(--screen-line); }
.s-chip { fill: var(--screen-3); }
.s-rule { fill: none; stroke: var(--screen-line); }
.s-bar { fill: var(--screen-bar); }
.s-bar--dim { fill: var(--screen-bar-dim); }
.s-bar--strong { fill: var(--screen-bar-strong); }
.s-accent { fill: var(--accent); }
.s-accent-edge { fill: var(--accent-edge); }
.s-accent-tint { fill: var(--accent); fill-opacity: .13; }
.s-ok { fill: var(--ok); }
.s-ok-tint { fill: var(--ok); fill-opacity: .13; }
.s-info { fill: var(--info); }
.s-muted { fill: var(--screen-muted); }
.s-text-fill { fill: var(--screen-text); }
.s-surface { fill: var(--screen); }

.s-stroke {
  fill: none;
  stroke: var(--screen-muted);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.s-stroke--text { stroke: var(--screen-text); }
.s-stroke--accent { stroke: var(--accent); }
.s-stroke--ok { stroke: var(--ok); }
.s-stroke--info { stroke: var(--info); }
.s-stroke--dark { stroke: var(--screen); }
.s-stroke--dashed { stroke-dasharray: 4 4; }

/* The pointer: the bot's hand. Light, with a dark outline so it reads on any fill. */
.s-cursor {
  fill: var(--screen-text);
  stroke: var(--screen);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.s-text {
  fill: var(--screen-text);
  font-size: 12px;
  font-weight: 500;
}

.s-text--sm { font-size: 11px; }
.s-text--lg { font-size: 13px; }
.s-text--bold { font-weight: 700; }
.s-text--muted { fill: var(--screen-muted); }
.s-text--accent { fill: var(--accent); }
.s-text--ok { fill: var(--ok); }
.s-text--info { fill: var(--info); }
.s-text--dark { fill: var(--screen); }
.s-hero-title {
  font: 700 18px var(--font-mono);
  fill: var(--screen-text);
}

/* Parts that belong to the story but not to the finished picture: a focus ring, a packet in
   transit, a cover that hides text until it is typed, a state that gets replaced. */
.s-while,
.s-cover,
.s-out {
  opacity: 0;
}

/* Shared entrances. They only exist while the scene is live and motion is welcome.
     .s-in     fades in and rises 6px          .s-grow   draws from the left
     .s-fade   fades in                        .s-cover  uncovers what is under it, left to right
     .s-pop    fades in and settles            .s-while  is visible from --at for --dur
     .s-press  a key going down and up         .s-out    is visible until --at, then fades */
@media (prefers-reduced-motion: no-preference) {
  .scene.is-live :is(.s-in, .s-fade, .s-pop, .s-grow, .s-cover, .s-while, .s-out, .s-press) {
    transform-box: fill-box;
    animation: var(--dur, 420ms) var(--ease-out) var(--at, 0s) both;
  }

  .scene.is-live .s-in { animation-name: s-in; }
  .scene.is-live .s-fade { animation-name: s-fade; }

  .scene.is-live .s-pop {
    transform-origin: center;
    animation-name: s-pop;
  }

  .scene.is-live .s-grow {
    transform-origin: left center;
    animation-name: s-grow;
    animation-timing-function: var(--ease-in-out);
  }

  .scene.is-live .s-cover {
    transform-origin: right center;
    animation-name: s-cover;
    animation-timing-function: steps(var(--steps, 12), end);
  }

  .scene.is-live .s-cover--smooth { animation-timing-function: linear; }

  .scene.is-live .s-while {
    animation-name: s-while;
    animation-timing-function: linear;
  }

  .scene.is-live .s-out {
    animation-name: s-out;
    animation-duration: var(--dur, 200ms);
    animation-timing-function: ease;
  }

  .scene.is-live .s-press {
    animation-name: s-press;
    animation-duration: var(--dur, 320ms);
  }
}

@keyframes s-in {
  from { opacity: 0; transform: translateY(6px); }
}

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

@keyframes s-pop {
  from { opacity: 0; transform: scale(.8); }
}

@keyframes s-grow {
  from { transform: scaleX(0); }
}

@keyframes s-cover {
  from { opacity: 1; transform: scaleX(1); }
  to { opacity: 1; transform: scaleX(0); }
}

@keyframes s-while {
  0%, 100% { opacity: 0; }
  12%, 88% { opacity: 1; }
}

@keyframes s-out {
  from { opacity: 1; }
}

@keyframes s-press {
  35% { transform: translateY(3px); animation-timing-function: var(--ease-out); }
}

/* Per-kind choreography. Each scene is one play-once timeline that lands on the finished
   picture; the positions below are offsets from where things rest. */
@media (prefers-reduced-motion: no-preference) {
  /* browser: the pointer visits both fields, then presses the key */
  .scene.is-live .b-cursor { animation: b-cursor 2.6s var(--ease-out) both; }

  /* scraper: the band steps down the page, one item and one row at a time */
  .scene.is-live .sc-band { animation: sc-band 2.6s var(--ease-out) .1s both; }
}

@keyframes b-cursor {
  0% { opacity: 0; transform: translate(26px, -72px); }
  8% { opacity: 1; transform: translate(14px, -84px); }
  38% { transform: translate(14px, -84px); animation-timing-function: var(--ease-in-out); }
  47% { transform: translate(14px, -44px); }
  65% { transform: translate(14px, -44px); animation-timing-function: var(--ease-in-out); }
  82% { transform: translate(0, 0); }
  88% { transform: translate(0, 3px); }
}

@keyframes sc-band {
  0% { opacity: 0; transform: translateY(-160px); }
  5% { opacity: 1; transform: translateY(-160px); }
  17% { transform: translateY(-160px); animation-timing-function: var(--ease-in-out); }
  25% { transform: translateY(-120px); }
  37% { transform: translateY(-120px); animation-timing-function: var(--ease-in-out); }
  45% { transform: translateY(-80px); }
  57% { transform: translateY(-80px); animation-timing-function: var(--ease-in-out); }
  65% { transform: translateY(-40px); }
  77% { transform: translateY(-40px); animation-timing-function: var(--ease-in-out); }
  85% { transform: translateY(0); }
}


/* Public privacy controls */
.analytics-choices { padding-block: .25rem 1.5rem; }
.analytics-choices[hidden], .analytics-choices__panel[hidden],
.analytics-choices__actions[hidden] { display: none; }
.analytics-choices__toggle {
  min-height: 44px; padding: 0; color: var(--ink-2); font: 500 .82rem var(--font-mono);
  text-decoration: underline; text-underline-offset: 4px;
}
.analytics-choices__panel {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem;
  margin-block: .5rem; padding: 1.15rem clamp(1rem, 2vw, 2rem); border: 1px solid var(--line-strong);
  background: var(--card); color: var(--ink); border-radius: .75rem;
}
.analytics-choices__panel--first {
  width: min(100% - 2 * var(--gutter), var(--container)); margin: 1rem auto;
}
.analytics-choices__panel h2 { font-size: 1.05rem; line-height: 1.25; margin: 0 0 .3rem; letter-spacing: -.02em; }
.analytics-choices__panel p {
  margin: 0; max-width: 82ch; color: var(--ink-2); font-size: .875rem; line-height: 1.5;
}
.analytics-choices__actions { display: flex; flex-shrink: 0; flex-wrap: wrap; gap: .5rem; }
.analytics-choices__actions button {
  padding: .55rem .9rem; min-height: 44px; border: 1px solid var(--line-strong);
  border-radius: .45rem; color: var(--ink); background: var(--card); font: 600 .875rem var(--font-sans);
}
.analytics-choices__actions button:hover { border-color: var(--ink); }
.analytics-choices__status { color: var(--ink-2); font-size: .85rem; }
.analytics-choices__status:empty { display: none; }
@media (max-width: 56rem) {
  .analytics-choices__panel { flex-direction: column; align-items: flex-start; gap: .75rem; }
}
@media (max-width: 25rem) {
  .analytics-choices__actions { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-choices__actions button { padding-inline: .4rem; }
}

/* Floating assistant launcher; the dialog assets load on intent. */
.portfolio-assistant {
  --assistant-gap: clamp(.75rem, 2vw, 1.5rem);
  --assistant-right: max(var(--assistant-gap), env(safe-area-inset-right));
  --assistant-bottom: max(var(--assistant-gap), env(safe-area-inset-bottom));
  --assistant-top: max(var(--assistant-gap), env(safe-area-inset-top));
}

.portfolio-assistant[hidden], .portfolio-assistant [hidden] { display: none; }

.portfolio-assistant__launcher {
  position: fixed;
  right: var(--assistant-right);
  bottom: var(--assistant-bottom);
  z-index: 42;
  min-height: 3.125rem;
  padding-inline: 1rem;
  border-radius: 3rem;
  gap: .6rem;
  font-size: .94rem;
  box-shadow: 0 3px 0 var(--key-shadow), var(--shadow-card-hover);
}

.portfolio-assistant__launcher[aria-expanded="true"] { visibility: hidden; }

@media (max-width: 40rem) {
  .portfolio-assistant__launcher { width: 3.25rem; height: 3.25rem; padding: 0; }
  .portfolio-assistant__launcher span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  body:has([data-portfolio-assistant]:not([hidden])) { padding-bottom: calc(3.25rem + env(safe-area-inset-bottom)); }
}

/* 14. Utilities ----------------------------------------------------------- */

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

/* Controls that only work with JavaScript */
html:not(.js) .js-only {
  display: none;
}

.skip-link {
  position: absolute;
  top: .625rem;
  left: var(--gutter);
  z-index: 100;
  padding: .75rem 1rem;
  border: 1.5px solid var(--key-line);
  border-radius: var(--r-key);
  background: var(--card);
  font-weight: 650;
  text-decoration: none;
  transform: translateY(-250%);
}

.skip-link:focus {
  transform: none;
}


/* 15. Motion and reduced motion ------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  /* Scroll reveals: content is only held back once the script is running (html.js). */
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity var(--dur-reveal) var(--ease-out), transform var(--dur-reveal) var(--ease-out);
  }

  .js [data-reveal].is-in {
    opacity: 1;
    transform: none;
  }

  /* The hero settles in on load with CSS alone, so it can never stay hidden. */
  .hero__text > *,
  .hero__demo,
  .hero__kinds {
    animation: settle 640ms var(--ease-out) both;
  }

  .hero__text > :nth-child(2) { animation-delay: 60ms; }
  .hero__text > :nth-child(3) { animation-delay: 120ms; }
  .hero__text > :nth-child(4) { animation-delay: 180ms; }
  .hero__demo { animation-delay: 160ms; }
  .hero__kinds { animation-delay: 240ms; }

  .status__dot::after {
    animation: ping 2.4s var(--ease-out) 1s infinite;
  }

  @view-transition {
    navigation: auto;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 180ms;
  }
}

@keyframes settle {
  from { opacity: 0; transform: translateY(12px); }
}

@keyframes ping {
  from { opacity: .5; transform: scale(1); }
  70%, to { opacity: 0; transform: scale(3.2); }
}

/* Reduced motion: nothing moves. Colour and opacity changes stay. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .key:hover,
  .work-card:hover,
  .work-card:active,
  .icon-button:active,
  .video__facade:hover .video__key,
  a:hover .nudge,
  .work-card:hover .work-card__go .icon,
  .js .site-nav,
  .menu-icon > *,
  .copy > span {
    transform: none;
  }

  .copy > span {
    filter: none;
  }

  .key,
  .work-card {
    transition-property: box-shadow, border-color;
  }
}
