/* Shared by every page: the pixel font, page-to-page cross-fades, and the
   page margins, so the desk and the work page line up exactly. */

/* Geist Pixel (OFL, see fonts/GeistPixel-OFL.txt), subset to Latin. Its one
   axis, ELSH, picks the pixel shape: 0 regular, 1 square, 20 circle, 40 grid,
   60 triangle, 80 line. It draws on a 38/1000 em grid, so sizes that are
   multiples of 13.16px land each font pixel on whole screen pixels. */
@font-face {
  font-family: 'Geist Pixel';
  src: url('../fonts/GeistPixel.woff2') format('woff2');
  font-display: swap;
}

@view-transition {
  navigation: auto;
}

/* `hidden` must always hide, even on elements whose own CSS sets a display
   (e.g. the work page's board is display: flex). */
[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}

/* A case study's thumbnail zooming into its cover, and back (src/case-zoom.js). The
   two pictures have different shapes, so both fill the moving box. */
::view-transition-group(case-cover) {
  animation-duration: 520ms;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

::view-transition-old(case-cover),
::view-transition-new(case-cover) {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* the pictures swap early, so it reads as one image growing, not two crossing */
  animation-duration: 200ms;
  animation-timing-function: ease-out;
}

:root {
  /* One heading scale for the whole site. --h1: section headings (About,
     Experience, Work, the closing CTA, "Let's talk."). --h2: subheadings
     (intros, captions, company names and roles, the Play / Read words). */
  --h1: 48px;
  --h2: 26.32px;
  /* Pixel cursors to match the voxels: an arrow, and a pointing hand over
     anything you can click. Hotspots at the arrow tip and the fingertip;
     the plain system cursor is the fallback. */
  --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='19' height='30' viewBox='0 0 12 19' shape-rendering='crispEdges'%3E%3Crect x='0' y='0' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='1' width='2' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='2' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='2' width='1' height='1' fill='%23f7f5f0'/%3E%3Crect x='2' y='2' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='3' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='3' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='3' y='3' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='4' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='4' width='3' height='1' fill='%23f7f5f0'/%3E%3Crect x='4' y='4' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='5' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='5' width='4' height='1' fill='%23f7f5f0'/%3E%3Crect x='5' y='5' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='6' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='6' width='5' height='1' fill='%23f7f5f0'/%3E%3Crect x='6' y='6' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='7' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='7' width='6' height='1' fill='%23f7f5f0'/%3E%3Crect x='7' y='7' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='8' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='8' width='7' height='1' fill='%23f7f5f0'/%3E%3Crect x='8' y='8' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='9' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='9' width='8' height='1' fill='%23f7f5f0'/%3E%3Crect x='9' y='9' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='10' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='10' width='9' height='1' fill='%23f7f5f0'/%3E%3Crect x='10' y='10' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='11' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='11' width='6' height='1' fill='%23f7f5f0'/%3E%3Crect x='7' y='11' width='5' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='12' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='12' width='3' height='1' fill='%23f7f5f0'/%3E%3Crect x='4' y='12' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='12' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='7' y='12' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='13' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='13' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='3' y='13' width='2' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='13' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='7' y='13' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='14' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='14' width='1' height='1' fill='%23f7f5f0'/%3E%3Crect x='2' y='14' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='14' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='6' y='14' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='8' y='14' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='15' width='2' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='15' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='6' y='15' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='8' y='15' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='16' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='6' y='16' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='7' y='16' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='9' y='16' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='6' y='17' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='7' y='17' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='9' y='17' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='7' y='18' width='2' height='1' fill='%231d1c1a'/%3E%3C/svg%3E") 0 0, default;
  --hand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='27' viewBox='0 0 16 17' shape-rendering='crispEdges'%3E%3Crect x='5' y='0' width='2' height='1' fill='%231d1c1a'/%3E%3Crect x='4' y='1' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='1' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='7' y='1' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='4' y='2' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='2' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='7' y='2' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='4' y='3' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='3' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='7' y='3' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='4' y='4' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='4' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='7' y='4' width='3' height='1' fill='%231d1c1a'/%3E%3Crect x='4' y='5' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='5' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='7' y='5' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='8' y='5' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='10' y='5' width='3' height='1' fill='%231d1c1a'/%3E%3Crect x='4' y='6' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='6' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='7' y='6' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='8' y='6' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='10' y='6' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='11' y='6' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='13' y='6' width='2' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='7' width='2' height='1' fill='%231d1c1a'/%3E%3Crect x='4' y='7' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='7' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='7' y='7' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='8' y='7' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='10' y='7' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='11' y='7' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='13' y='7' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='14' y='7' width='1' height='1' fill='%23f7f5f0'/%3E%3Crect x='15' y='7' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='8' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='8' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='3' y='8' width='2' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='8' width='8' height='1' fill='%23f7f5f0'/%3E%3Crect x='13' y='8' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='14' y='8' width='1' height='1' fill='%23f7f5f0'/%3E%3Crect x='15' y='8' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='0' y='9' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='9' width='3' height='1' fill='%23f7f5f0'/%3E%3Crect x='4' y='9' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='9' width='10' height='1' fill='%23f7f5f0'/%3E%3Crect x='15' y='9' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='1' y='10' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='2' y='10' width='2' height='1' fill='%23f7f5f0'/%3E%3Crect x='4' y='10' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='10' width='10' height='1' fill='%23f7f5f0'/%3E%3Crect x='15' y='10' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='2' y='11' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='3' y='11' width='12' height='1' fill='%23f7f5f0'/%3E%3Crect x='15' y='11' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='2' y='12' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='3' y='12' width='11' height='1' fill='%23f7f5f0'/%3E%3Crect x='14' y='12' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='3' y='13' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='4' y='13' width='10' height='1' fill='%23f7f5f0'/%3E%3Crect x='14' y='13' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='4' y='14' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='14' width='8' height='1' fill='%23f7f5f0'/%3E%3Crect x='13' y='14' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='15' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='6' y='15' width='7' height='1' fill='%23f7f5f0'/%3E%3Crect x='13' y='15' width='1' height='1' fill='%231d1c1a'/%3E%3Crect x='5' y='16' width='9' height='1' fill='%231d1c1a'/%3E%3C/svg%3E") 9 1, pointer;
  /* Height of the site header once it settles into a bar on scroll. */
  --head-h: 64px;
  /* Side margin: about a tenth of the screen on each side (10.25vw, 148px
     at 1440), matching the Mellow case studies; 20px on phones (below). */
  --gutter: clamp(20px, 10.25vw, 320px);
  /* Space above the top line of text (name, back link, sound toggle). */
  --top: clamp(24px, 3.5vw, 48px);
  /* The distance from the screen edge to the content: the same share of the
     screen at every width, like the Mellow case studies. No content cap, so
     wide screens don't get extra margin on top. */
  --edge: var(--gutter);
}

/* --- Mode switch: word [lever] word ---------------------------------------
   Used on the work page (Work / Off the clock) and the home page's experience
   section (Play / Read). --mode-size sets the word size. */
.mode {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 28px);
}

/* The chosen word is drawn in solid square pixels; the other fades to the
   dotted grid style. The font's ELSH axis animates, so letters morph. Sizes are
   whole multiples of the font's pixel grid (38/1000 em) to stay crisp. */
.mode-word {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 400 var(--mode-size, var(--h1)) / 1 var(--pixel);
  font-variation-settings: 'ELSH' 40;
  font-synthesis: none;
  letter-spacing: -0.02em;
  white-space: nowrap;
  opacity: 0.55;
  cursor: var(--hand);
  transition: font-variation-settings 450ms var(--ease-out), color 300ms ease-out, opacity 300ms ease-out;
}

.mode-word.active {
  color: var(--ink);
  font-variation-settings: 'ELSH' 1;
  opacity: 1;
  cursor: var(--arrow);
}

@media (hover: hover) and (pointer: fine) {
  .mode-word:not(.active):hover {
    opacity: 0.85;
  }
}

/* A little joystick: grey slot, metal stick, red knob (the desk phone's red).
   It springs over from one side to the other. */
.lever {
  position: relative;
  flex: none;
  /* Wide enough that the tilted stick and knob stay inside the button. */
  width: 80px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: var(--hand);
}

.lever-slot {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 8px;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(#8d8f88, #a9aba3);
  box-shadow: inset 0 2px 3px rgb(0 0 0 / 0.35), 0 1px 0 rgb(255 255 255 / 0.7);
}

.lever-stick {
  position: absolute;
  left: 50%;
  bottom: 14px;
  width: 6px;
  height: 32px;
  margin-left: -3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #d2d4cd, #8d8f88);
  transform-origin: 50% 100%;
  rotate: -58deg;
  transition: rotate 520ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lever[aria-checked='true'] .lever-stick {
  rotate: 58deg;
}

.lever-knob {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 4px;
  background: linear-gradient(#e2584a 0 40%, #c0392b 40% 80%, #9c2c21 80%);
  box-shadow: 0 2px 3px rgb(0 0 0 / 0.25);
  transition: scale 120ms ease-out;
}

.lever:active .lever-knob {
  scale: 0.9;
}

@media (hover: hover) and (pointer: fine) {
  /* Lean a little toward the other side to show it can move. */
  .lever:hover .lever-stick {
    rotate: -48deg;
  }

  .lever[aria-checked='true']:hover .lever-stick {
    rotate: 48deg;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lever-stick,
  .mode-word {
    transition: none;
  }
}

html {
  cursor: var(--arrow);
}

a,
button,
summary,
label,
select {
  cursor: var(--hand);
}

/* Phones: one step down each, on the pixel font's sharp sizes. */
@media (max-width: 720px) {
  :root {
    --h1: 39.48px;
    --h2: 19.74px;
    --gutter: 20px;
  }
}
