/* Portfolio: electric blue (or dark), a big intro, real project screenshots floating in glass
   cases, a glass "now shipping" player, and a pull cord that switches the theme.
   Inter only. Mobile-first. Breakpoints are Tailwind's: sm 640, md 768, lg 1024. */

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root,
[data-theme="blue"] {
  color-scheme: dark;
  --bg: #1129e2;
  --bg-2: #0e23cc;
  --ink: #ffffff;
  --ink-80: rgba(255, 255, 255, 0.88);
  --ink-60: rgba(255, 255, 255, 0.76);
  --line: rgba(255, 255, 255, 0.24);
  --glass: rgba(255, 255, 255, 0.1);
  --glass-line: rgba(255, 255, 255, 0.32);
  --shade: rgba(3, 10, 80, 0.7);
  --red: #ff6b6b;
  --glow: none;
}

[data-theme="dark"] {
  --bg: #07080d;
  --bg-2: #10131f;
  --ink: #f5f6ff;
  --ink-80: rgba(245, 246, 255, 0.86);
  --ink-60: rgba(245, 246, 255, 0.7);
  --line: rgba(255, 255, 255, 0.14);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-line: rgba(255, 255, 255, 0.18);
  --shade: rgba(0, 0, 0, 0.75);
  --red: #ff5a5f;
  --glow: radial-gradient(45% 60% at 72% 45%, rgba(17, 41, 226, 0.45), rgba(17, 41, 226, 0) 70%);
}

:root {
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  /* Strong ease-out for anything that enters or responds to a press. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  /* One unit of the 1440 × 900 hero, scaled to the hero's real size. The hero never gets
     shorter than 600px, so at high browser zoom it scrolls instead of squashing. */
  --u: min(calc(100vw / 1440), calc(max(100vh, 600px) / 900));
  --u: min(calc(100vw / 1440), calc(max(100svh, 600px) / 900));
}

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.4s ease, color 0.4s ease;
}

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

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

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

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

a {
  color: inherit;
}

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

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 60;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus-visible {
  top: 1rem;
}

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

.shell {
  width: min(100% - 2.5rem, 72rem);
  margin-inline: auto;
}

.eyebrow {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-60);
}

/* ---------- Glass: the frosted surface used everywhere ---------- */

.player,
.obj__plate,
.card__plate,
.mode {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  backdrop-filter: blur(10px) saturate(130%);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0 1.15rem;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: transform 160ms var(--ease-out), background-color 150ms ease, color 150ms ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn--solid {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    background: var(--ink);
    color: var(--bg);
  }

  .btn--solid:hover {
    background: transparent;
    color: var(--ink);
  }
}

/* Computers with a mouse: smaller buttons. Touch screens keep 44px targets. */
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
  .btn {
    min-height: 38px;
    padding: 0 0.95rem;
    font-size: 0.9rem;
  }
}

/* ---------- Nav ---------- */

.nav {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  width: min(100% - 2.5rem, 72rem);
  margin-inline: auto;
  padding: 1rem 0 0.5rem;
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  margin-right: auto;
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: -0.05em;
  text-decoration: none;
}

.nav__brand img {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 9px;
  box-shadow: 0 0 0 1.5px var(--ink);
}

/* Phones: logo and theme switch on top, links on their own row. */
.nav__links {
  order: 3;
  width: 100%;
}

.nav__links ul {
  display: flex;
  gap: 0 0.25rem;
  margin-left: -0.6rem;
}

.nav__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.6rem;
  font-weight: 500;
  font-size: 1.0625rem;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--ink-80);
  transition: color 0.2s ease;
}

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

.nav__links a[aria-current] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.mode {
  position: relative;
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
}

.mode[hidden] {
  display: none;
}

.mode button {
  position: relative;
  z-index: 1;
  min-width: 4rem;
  min-height: 44px;
  padding: 0 1rem;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--ink);
  transition: color 0.3s ease;
}

.mode button[aria-pressed="true"] {
  color: var(--bg);
}

.mode__thumb {
  position: absolute;
  left: 2px;
  top: 2px;
  bottom: 2px;
  width: calc(50% - 2px);
  border-radius: 999px;
  background: var(--ink);
  transition: transform 0.45s var(--spring), background 0.4s ease;
}

[data-theme="dark"] .mode__thumb {
  transform: translateX(100%);
}

@media (min-width: 768px) {
  .nav {
    flex-wrap: nowrap;
    padding-top: 1.5rem;
  }

  .nav__links {
    order: 0;
    width: auto;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .nav__links ul {
    margin: 0;
  }
}

/* ---------- Home hero ---------- */

.stage {
  position: relative;
  overflow: hidden;
  background: var(--glow);
}

.stage__scene {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5rem 1.5rem;
  width: min(100% - 2.5rem, 40rem);
  margin-inline: auto;
  padding: 1.5rem 0 3rem;
}

.stage__scene > .player,
.stage__scene > .stage__intro,
.stage__scene > .stage__down {
  grid-column: 1 / -1;
}

.stage__intro { order: 0; }
.obj--1 { order: 2; }
.obj--2 { order: 3; margin-top: 2rem; }
.player { order: 4; }
.obj--3 { order: 5; }
.obj--4 { order: 6; margin-top: 2rem; }
.stage__down { order: 7; }

/* A project in a glass case: the screenshot floats, the lower half sits behind frosted glass. */
.obj {
  position: relative;
  display: block;
  color: var(--ink);
  text-decoration: none;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  rotate: var(--r, 0deg);
  transition: rotate 0.6s var(--spring);
  cursor: grab;
}

.obj.is-held {
  cursor: grabbing;
  z-index: 6;
  transition: none;
}

.obj--1 { --r: -9deg; }
.obj--2 { --r: 11deg; }
.obj--3 { --r: -8deg; }
.obj--4 { --r: 4deg; }

.obj:hover,
.obj:focus-visible {
  rotate: calc(var(--r) * 0.4);
}

.obj__float {
  position: relative;
  display: block;
  animation: float 6s ease-in-out infinite;
}

.obj--2 .obj__float { animation-duration: 7s; animation-delay: -2s; }
.obj--3 .obj__float { animation-duration: 6.5s; animation-delay: -4s; }
.obj--4 .obj__float { animation-duration: 8s; animation-delay: -1s; }

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

.obj img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35), 0 28px 40px -18px var(--shade);
  transition: transform 0.5s var(--ease);
  pointer-events: none;
}

.obj:hover img {
  transform: scale(1.04);
}

.obj__plate {
  position: absolute;
  z-index: 1;
  left: -7%;
  right: -7%;
  top: 56%;
  bottom: -10%;
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 18px 30px -16px var(--shade);
}

/* Phones: the project name always shows under its case. */
.obj__tag {
  position: relative;
  z-index: 2;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 1.4rem auto 0;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.3;
  text-align: center;
  rotate: calc(var(--r) * -1);
}

.stage__intro {
  display: grid;
  justify-items: start;
  gap: 0.75rem;
}

.stage__title {
  font-weight: 500;
  font-size: clamp(2.75rem, 12vw, 4.5rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.stage__hi {
  color: var(--ink-60);
}

.stage__tag {
  max-width: 34rem;
  font-size: 1.125rem;
  line-height: 1.45;
  letter-spacing: -0.02em;
  color: var(--ink-80);
  text-wrap: pretty;
}

.stage__ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.stage__down {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  justify-self: start;
  min-height: 44px;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--ink-80);
  text-decoration: none;
}

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

.stage__down svg {
  height: 2.25rem;
  width: auto;
  animation: nudge 2.4s ease-in-out infinite;
}

@keyframes nudge {
  50% {
    transform: translateY(6px);
  }
}

/* Pull cord (stage.js). Only on wide screens, where it hangs in the gap between the intro and the projects. */
.cord {
  display: none;
}

/* ---------- Glass player ---------- */
.player {
  width: 100%;
  max-width: 22rem;
  padding: 0.85rem 0.9rem 0.7rem;
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 20px 40px -24px var(--shade);
}

.player__top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.player__art {
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  border-radius: 8px;
  object-fit: cover;
  object-position: top left;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.player__text {
  min-width: 0;
  flex: 1;
}

.player__title {
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.2;
}

.player__sub {
  font-size: 0.78rem;
  line-height: 1.3;
  color: var(--ink-60);
}

.player__year {
  align-self: flex-start;
  font-size: 0.72rem;
  color: var(--ink-60);
}

.player.is-changing .player__top {
  animation: swap 0.45s var(--ease);
}

@keyframes swap {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.player__bar {
  height: 3px;
  margin: 0.8rem 0 0.4rem;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.player__bar span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.3), #fff, rgba(255, 255, 255, 0.3)) 0 0 / 200% 100%;
  animation: flow 2.4s linear infinite;
}

@keyframes flow {
  to {
    background-position: -200% 0;
  }
}

.player__meta {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-80);
}

.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.35rem;
  border-radius: 50%;
  background: #ff5a5a;
  vertical-align: 1px;
  animation: blink 1.6s ease-in-out infinite;
}

@keyframes blink {
  50% {
    opacity: 0.35;
  }
}

.player__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 0.45rem;
}

.player__btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--ink);
  transition: background 0.2s ease;
}

.player__btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.player__btn[hidden] {
  display: none;
}

.player__play {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  transition: transform 0.3s var(--spring);
}

.player__play:hover {
  transform: scale(1.08);
}

.player__play svg {
  margin-left: 2px;
}


/* Wide screens (any shape, at any zoom): one screen laid out on a 1440 × 900 plan.
   Places are percentages of the hero, so the plan stretches to 4:3, 16:9 and 21:9 alike.
   Sizes follow --u, and text never drops below a readable size. */
@media (min-width: 768px) and (orientation: landscape) {
  .page-home .nav {
    position: absolute;
    inset: 0 auto auto 0;
    width: auto;
    left: 7.5%;
    right: 6.4%;
    padding-top: max(1rem, calc(26 * var(--u)));
  }

  .stage {
    height: max(100vh, 600px);
    height: max(100svh, 600px);
  }

  .stage__scene {
    position: absolute;
    inset: 0;
    display: block;
    width: auto;
    padding: 0;
  }

  .stage__scene > * {
    position: absolute;
  }

  /* Right half: four cases and the player, in two loose columns. */
  .obj--1 { left: 54%; top: 15%; width: calc(250 * var(--u)); margin: 0; }
  .obj--2 { right: 6%; top: 22%; width: calc(270 * var(--u)); margin: 0; }
  .obj--3 { left: 57%; top: 75%; width: calc(230 * var(--u)); margin: 0; }
  .obj--4 { right: 5%; top: 57%; width: calc(235 * var(--u)); margin: 0; }

  /* The project name sits on the glass, so every case says what it is. */
  .obj__tag {
    position: absolute;
    left: 50%;
    bottom: -4%;
    max-width: none;
    margin: 0;
    translate: -50% 0;
    white-space: nowrap;
    font-size: max(12px, calc(13 * var(--u)));
  }

  .player {
    left: 51%;
    top: 43%;
    width: max(216px, calc(260 * var(--u)));
    max-width: none;
    padding: max(10px, calc(12 * var(--u))) max(11px, calc(13 * var(--u))) max(8px, calc(9 * var(--u)));
  }

  .player__art { width: max(32px, calc(38 * var(--u))); height: max(32px, calc(38 * var(--u))); }
  .player__title { font-size: max(14px, calc(15 * var(--u))); }
  .player__sub { font-size: max(12px, calc(12.5 * var(--u))); }
  .player__year,
  .player__meta { font-size: max(11px, calc(11 * var(--u))); }
  .player__bar { margin: max(8px, calc(11 * var(--u))) 0 max(5px, calc(6 * var(--u))); }
  .player__controls { margin-top: max(2px, calc(4 * var(--u))); }

  /* Left half: the intro, big, centred top to bottom. */
  .stage__intro {
    left: 7.5%;
    top: 50%;
    translate: 0 -46%;
    width: max(330px, calc(600 * var(--u)));
    gap: max(8px, calc(14 * var(--u)));
  }

  .stage__intro .eyebrow {
    font-size: max(11px, calc(13 * var(--u)));
  }

  .stage__title {
    font-size: max(38px, calc(84 * var(--u)));
  }

  .stage__tag {
    max-width: max(320px, calc(500 * var(--u)));
    font-size: max(16px, calc(21 * var(--u)));
  }

  .stage__ctas {
    margin-top: max(4px, calc(8 * var(--u)));
  }

  .stage__ctas .btn {
    font-size: max(14px, calc(15 * var(--u)));
  }

  .stage__down {
    left: 7.5%;
    bottom: 4%;
    font-size: max(13px, calc(14 * var(--u)));
  }

  .stage__down svg {
    height: max(24px, calc(32 * var(--u)));
  }

}

@media (min-width: 768px) and (orientation: landscape) {
  .cord:not([hidden]) {
    display: block;
    position: absolute;
    z-index: 25;
    /* Midway between the right edge of the intro and the first project case (.obj--1 at 54%). */
    left: calc((7.5% + max(330px, calc(600 * var(--u))) + 54%) / 2);
    /* Hangs from just under the nav, so it never crosses the links. */
    top: calc(max(1rem, calc(26 * var(--u))) + 3.25rem);
    width: 0;
    height: 0;
  }

  .cord__line {
    position: absolute;
    left: -60px;
    top: 0;
    width: 120px;
    /* The global svg rule caps width at the parent's, and .cord is 0px wide. */
    max-width: none;
    height: 300px;
    overflow: visible;
    pointer-events: none;
  }

  .cord__line path {
    fill: none;
    stroke: var(--ink);
    stroke-width: 1.5;
    stroke-linecap: round;
    opacity: 0.85;
  }

  /* The knob is a 44px button; the bead inside is what you see. */
  .cord__knob {
    position: absolute;
    left: 0;
    top: 132px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-top: -8px;
    border-radius: 50%;
    transform: translate(-50%, 0);
    touch-action: none;
    cursor: grab;
  }

  .cord.is-held .cord__knob {
    cursor: grabbing;
  }

  .cord__bead {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--ink);
    box-shadow: 0 0 0 4px var(--glass-line), 0 6px 14px -4px var(--shade);
    transition: transform 160ms var(--ease-out), box-shadow 200ms ease;
  }

  .cord.is-held .cord__bead {
    transform: scale(0.9);
  }

  /* Pulled far enough: the ring grows to say "let go now". */
  .cord.is-armed .cord__bead {
    transform: scale(1.15);
    box-shadow: 0 0 0 8px var(--glass-line), 0 6px 14px -4px var(--shade);
  }

  /* The hint sits on the empty side, away from the project cases. */
  .cord__tip {
    position: absolute;
    right: 38px;
    top: 50%;
    translate: 0 -50%;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-80);
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 200ms ease;
  }

  .cord.is-held .cord__tip {
    opacity: 0;
  }
}

/* ---------- Sections ---------- */

.block {
  padding: 3.5rem 0;
  border-top: 1px solid var(--line);
}

.section-title {
  margin: 0.5rem 0 1.75rem;
  font-weight: 500;
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.02;
  letter-spacing: -0.05em;
  text-wrap: balance;
}

.section-title--sm {
  margin-top: 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.prose {
  display: grid;
  align-content: start;
  gap: 1rem;
  max-width: 40rem;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink-80);
}

.prose a,
.entry__name a {
  color: var(--ink);
  text-decoration-color: var(--glass-line);
  text-underline-offset: 4px;
}

.prose a:hover,
.entry__name a:hover {
  text-decoration-color: var(--ink);
}

/* About: heading on the left, a short text on the right; the first line reads as the lead. */
.about {
  display: grid;
  gap: 0.25rem;
}

.prose--lead {
  max-width: 40rem;
}

.prose--lead p:first-child {
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  line-height: 1.45;
  letter-spacing: -0.02em;
  color: var(--ink);
}

@media (min-width: 1024px) {
  .about {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 4rem;
    align-items: start;
  }

  .about .section-title {
    margin-bottom: 0;
  }

  /* Line the text up with the heading, not the small label above it. */
  .about .prose--lead {
    padding-top: 1.85rem;
  }
}

/* Experience and awards: one row each, the date on the left on wider screens. */
.entries {
  display: grid;
}

.entry {
  display: grid;
  gap: 0.35rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
}

.entry__name {
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

/* Taller tap area for links, without moving the layout. */
.entry__name a {
  display: inline-block;
  padding-block: 0.7rem;
  margin-block: -0.7rem;
}

.entry__side {
  font-size: 0.9375rem;
  color: var(--ink-60);
  font-variant-numeric: tabular-nums;
}

.entry__org {
  margin-top: 0.15rem;
  font-size: 0.975rem;
  color: var(--ink-60);
}

.entry__text {
  max-width: 44rem;
  margin-top: 0.5rem;
  color: var(--ink-80);
}

@media (min-width: 768px) {
  .entry {
    grid-template-columns: 11rem minmax(0, 1fr);
    gap: 2rem;
    padding: 1.5rem 0;
  }

  .entry__side {
    padding-top: 0.15rem;
  }

  .entry__media {
    grid-column: 2;
  }
}

/* The real badge or certificate. On touch screens it sits in the row as a small picture. */
.entry__media {
  height: auto;
  margin-top: 0.5rem;
  border-radius: 8px;
}

.entry__media--badge {
  width: 4.5rem;
}

.entry__media--certificate {
  width: 11rem;
  box-shadow: 0 0 0 1px var(--glass-line);
}

/* With a mouse it is hidden, and rises in beside the row on hover or keyboard focus.
   Enter is a little slower than exit, so it never lingers. */
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
  .entry--media {
    position: relative;
  }

  .entry__media {
    position: absolute;
    z-index: 3;
    right: 1rem;
    top: 50%;
    margin: 0;
    opacity: 0;
    transform: translateY(-50%) translateY(10px) rotate(-6deg) scale(0.94);
    transform-origin: 30% 80%;
    transition: opacity 150ms ease-out, transform 150ms ease-out;
    pointer-events: none;
    filter: drop-shadow(0 18px 24px var(--shade));
  }

  .entry__media--badge {
    width: 8.5rem;
  }

  .entry__media--certificate {
    width: 15rem;
  }

  .entry--media:hover .entry__media,
  .entry--media:focus-within .entry__media {
    opacity: 1;
    transform: translateY(-50%) rotate(-3deg) scale(1);
    transition: opacity 200ms var(--ease-out), transform 260ms var(--ease-out);
  }

  .entry--media:hover .entry__name a {
    text-decoration-color: var(--ink);
  }
}

/* Contact: big type, no box. A huge line, the email as one big link, then plain text links. */
.contact {
  padding: 4rem 0 4.5rem;
  border-top: 1px solid var(--line);
}

.contact__title {
  margin-top: 0.75rem;
  font-weight: 500;
  font-size: clamp(4rem, 17vw, 13rem);
  line-height: 0.88;
  letter-spacing: -0.065em;
}

.contact__email {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3em;
  min-height: 44px;
  margin-top: clamp(1.5rem, 4vw, 2.5rem);
  padding-bottom: 0.2em;
  font-weight: 500;
  font-size: clamp(1.5rem, 5vw, 3.25rem);
  letter-spacing: -0.045em;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
  /* A 2px line under the address that fills in from the left on hover. */
  background: linear-gradient(var(--ink), var(--ink)) 0 100% / 100% 2px no-repeat,
    linear-gradient(var(--line), var(--line)) 0 100% / 100% 2px no-repeat;
  transition: background-size 250ms var(--ease-out);
}

.contact__arrow {
  font-size: 0.7em;
  transition: transform 200ms var(--ease-out);
}

.contact__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.75rem;
  margin-top: 1.75rem;
}

.contact__links a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 44px;
  font-weight: 500;
  font-size: 1.0625rem;
  color: var(--ink-80);
  text-decoration: none;
  transition: color 150ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .contact__email {
    background-size: 0 2px, 100% 2px;
  }

  .contact__email:hover,
  .contact__email:focus-visible {
    background-size: 100% 2px, 100% 2px;
  }

  .contact__email:hover .contact__arrow {
    transform: translate(3px, -3px);
  }

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

/* The contact links sit right above the footer on the home page, so the footer keeps only the copyright there. */
.page-home .foot ul {
  display: none;
}

.link-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* ---------- Work page ---------- */

.page-head {
  padding: 2rem 0 1.75rem;
}

.page-head__title {
  margin-top: 0.75rem;
  font-weight: 500;
  font-size: clamp(2.4rem, 7vw, 4.25rem);
  line-height: 1;
  letter-spacing: -0.06em;
  text-wrap: balance;
}

.page-head__lede {
  max-width: 38rem;
  margin-top: 1rem;
  font-size: 1.125rem;
  color: var(--ink-80);
  text-wrap: pretty;
}

.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* The selected tab looks like the solid button. */
.jump [aria-selected="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.jump [aria-selected="true"] .jump__n {
  background: color-mix(in srgb, var(--bg) 14%, transparent);
}

/* With tabs on, the panel sits right under them, so it needs no divider line. */
.js-tabs [data-panel] {
  border-top: 0;
  padding-top: 0.75rem;
}

.jump__n {
  min-width: 1.6em;
  padding: 0 0.4em;
  border-radius: 999px;
  background: var(--glass);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.page-work .block {
  padding: 2.25rem 0;
}

.page-work .section-title--sm {
  margin-bottom: 1.25rem;
}

.cards {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 200ms ease, transform 200ms var(--ease-out);
}

.card:active {
  transform: scale(0.985);
}

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

/* The screenshot in a small glass case, like the hero. */
.card__case {
  position: relative;
  display: block;
  padding: 9% 12% 0;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-2);
}

.card__case img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3), 0 24px 36px -20px var(--shade);
  rotate: -3deg;
  transition: rotate 0.6s var(--spring), scale 0.6s var(--spring);
}

.cards li:nth-child(even) .card__case img {
  rotate: 3deg;
}

.card:hover .card__case img {
  rotate: 0deg;
  scale: 1.04;
}

.card__plate {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 62%;
  bottom: -12%;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.1rem 1.1rem;
}

.card__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.card__title {
  font-weight: 600;
  font-size: 1.1875rem;
  letter-spacing: -0.03em;
}

.card__year {
  font-size: 0.875rem;
  color: var(--ink-60);
  font-variant-numeric: tabular-nums;
}

.card__sub {
  font-size: 0.9375rem;
  color: var(--ink-60);
}

.card__text {
  margin-top: 0.35rem;
  font-size: 0.975rem;
  line-height: 1.55;
  color: var(--ink-80);
}

.card__more {
  margin-top: auto;
  padding-top: 0.7rem;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--ink-80);
  transition: color 0.2s ease, translate 0.3s var(--ease);
}

.card:hover .card__more {
  color: var(--ink);
  translate: 4px 0;
}

.posts {
  display: grid;
}

.post {
  display: grid;
  gap: 0.35rem;
  margin-inline: -1rem;
  padding: 1.1rem 1rem;
  transition: background 0.2s ease;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.post__meta {
  font-size: 0.875rem;
  color: var(--ink-60);
}

.post__title {
  font-weight: 600;
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  line-height: 1.25;
  letter-spacing: -0.03em;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 5px;
  transition: text-decoration-color 0.2s ease;
}

.post:hover {
  background: var(--glass);
}

.post:hover .post__title {
  text-decoration-color: var(--ink);
}

.post__text {
  max-width: 42rem;
  color: var(--ink-80);
}

/* ---------- Project and 404 pages ---------- */

.page {
  max-width: 48rem;
  padding-bottom: 3rem;
}

.back {
  padding-top: 1rem;
}

.back a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  font-weight: 500;
  color: var(--ink-80);
  text-decoration: none;
}

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

/* The screenshot sits in a glass frame. */
.frame {
  margin: 0 0 2rem;
  padding: clamp(0.5rem, 1.6vw, 0.9rem);
  border: 1px solid var(--glass-line);
  border-radius: 22px;
  background: var(--glass);
}

.shot {
  width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 30px 50px -30px var(--shade);
}

.page-head .link-pills {
  margin-top: 1.25rem;
}

.next {
  display: grid;
  gap: 0.3rem;
  margin-top: 2.5rem;
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.next:hover {
  border-color: var(--glass-line);
  background: var(--glass);
}

.next__title {
  font-weight: 600;
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  letter-spacing: -0.04em;
}

.next__sub {
  color: var(--ink-60);
}

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

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  width: min(100% - 2.5rem, 72rem);
  margin: 0 auto;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--ink-60);
}

.foot ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.25rem;
  margin-left: -0.4rem;
}

.foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.4rem;
  color: var(--ink-80);
  text-decoration: none;
}

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

/* ---------- Scroll animations (reveal.js) ---------- */

/* Rise in: up a little, out of a soft blur. Items in a list follow each other 70ms apart (--i).
   Only the way in animates; hiding at load is instant. */
.js-reveal [data-reveal].is-in {
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out), filter 700ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}

.js-reveal [data-reveal]:not(.is-in) {
  opacity: 0;
  transform: translateY(22px);
  filter: blur(6px);
}

/* Screenshots open from the top down as they arrive. */
.js-reveal .cards .is-in .card__case img,
.js-reveal .frame.is-in .shot {
  transition: clip-path 900ms cubic-bezier(0.77, 0, 0.175, 1) calc(var(--i, 0) * 70ms + 120ms), rotate 0.6s var(--spring), scale 0.6s var(--spring);
}

.js-reveal .cards [data-reveal]:not(.is-in) .card__case img,
.js-reveal .frame[data-reveal]:not(.is-in) .shot {
  clip-path: inset(0 0 100% 0 round 10px);
}

/* Words slide up from behind their own line. The heading itself does not fade. */
.js-reveal [data-words] {
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
}

.word {
  display: inline-block;
  overflow: hidden;
  /* Room for descenders, so letters are not clipped at rest. */
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
  vertical-align: top;
}

.word > span {
  display: inline-block;
}

.is-in .word > span {
  transition: transform 900ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 90ms);
}

[data-words]:not(.is-in) .word > span {
  transform: translateY(105%);
}

/* Hero entrance on load: the intro lines rise in one after another, then the cases settle in. */
.js-stage .stage__intro > * {
  animation: rise 800ms var(--ease-out) both;
}

.js-stage .stage__intro > :nth-child(2) { animation-delay: 80ms; }
.js-stage .stage__intro > :nth-child(3) { animation-delay: 160ms; }
.js-stage .stage__intro > :nth-child(4) { animation-delay: 240ms; }

.js-stage .obj,
.js-stage .player {
  animation: settle 900ms var(--ease-out) both;
}

.js-stage .obj--1 { animation-delay: 250ms; }
.js-stage .obj--2 { animation-delay: 330ms; }
.js-stage .player { animation-delay: 410ms; }
.js-stage .obj--4 { animation-delay: 490ms; }
.js-stage .obj--3 { animation-delay: 570ms; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(6px);
  }
}

@keyframes settle {
  from {
    opacity: 0;
    scale: 0.94;
    filter: blur(8px);
  }
}

/* ---------- Reduced motion: still, nothing hidden ---------- */

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
