/* =========================================================
   Matchbox portfolio — Zeyad Sabri
   Inks sampled from the 2026 portfolio PDF.
   ========================================================= */
@property --p { syntax: '<number>'; inherits: true; initial-value: 0; }

:root {
  --red: #E21422;
  --yellow: #F9D53E;
  --cream: #FCE1B6;
  --ink: #230707;
  --maroon: #681A22;
  --striker: #3B0000;
  --tray: #BA9B95;
  --tray-deep: #8f716b;
  --tan: #DDB57B;
  --stage: #1A0505;
  --burnt: #5A3121;
  --burnt-deep: #2E1710;

  --font: 'Jost', 'Futura', 'Century Gothic', system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
  --nav-h: 66px;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --ease-pop: cubic-bezier(.34, 1.4, .64, 1);

  /* paper grain, used under every printed surface */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .24 0 0 0 0 .1 0 0 0 0 .06 0 0 0 .1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--striker); }
html.is-locked { overflow: hidden; }
body {
  margin: 0;
  background: transparent;
  color: var(--maroon);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }
a { color: inherit; }
/* focus: ink on paper, yellow on the dark and red surfaces */
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.hero :focus-visible, .about :focus-visible, .viewer__stage :focus-visible,
.nav:not(.is-solid) :focus-visible { outline-color: var(--yellow); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; left: 12px; top: -80px; z-index: 100;
  background: var(--yellow); color: var(--ink); padding: 10px 14px; font-weight: 800; text-decoration: none;
}
.skip:focus { top: 12px; }

/* =========================================================
   BACKGROUND — striker, red, paper; cross-faded by scroll
   ========================================================= */
/* reaches past the screen edges so phone toolbars that slide away never uncover a gap */
.bgfx { position: fixed; inset: -120px 0 -240px; z-index: -1; pointer-events: none; --red-o: 0; --paper-o: 0; }
.bgfx__layer { position: absolute; inset: 0; }
.bgfx__striker, .striker {
  background-color: var(--striker);
  background-image:
    radial-gradient(rgba(255, 170, 150, .14) 1px, transparent 1.6px),
    radial-gradient(rgba(0, 0, 0, .42) 1px, transparent 1.6px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .14 0 0 0 0 .12 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 7px 7px, 11px 11px, 260px 260px;
  background-position: 0 0, 3px 5px, 0 0;
}
.bgfx__red { background: var(--grain), var(--red); opacity: var(--red-o); }
.bgfx__paper { background: var(--grain), var(--cream); opacity: var(--paper-o); }

/* ---------- seal: burst + face ---------- */
.seal { position: relative; display: inline-grid; place-items: center; flex: none; }
.seal__burst { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--yellow); }
.seal__face { position: relative; width: 58%; height: auto; translate: 1% 3%; }

/* =========================================================
   NAV — one band across the top; turns into a printed label strip on scroll
   ========================================================= */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 80;
  height: var(--nav-h);
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 0 var(--gutter);
  color: var(--cream);
  background: transparent;
  transition: color .25s ease;
}
.nav::before { /* the label strip */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--grain), var(--cream);
  box-shadow: 0 3px 0 var(--red), 0 6px 0 var(--yellow);
  opacity: 0; transition: opacity .25s ease;
}
.nav.is-solid { color: var(--ink); }
.nav.is-solid::before { opacity: 1; }
.nav__brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.seal--nav { width: 44px; height: 44px; transition: rotate .4s var(--ease-pop); }
.nav__name { font: 900 16px/1 var(--font); letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
.nav.is-solid .nav__name { color: var(--red); }
.nav__links { display: flex; gap: 6px; }
.nav__links a {
  position: relative;
  font: 800 14px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; text-decoration: none;
  padding: 12px 12px 14px;
}
.nav__links a::after { /* a little match under the current section */
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 5px;
  background:
    radial-gradient(circle at calc(100% - 4px) 50%, var(--red) 0 4px, transparent 4.5px),
    linear-gradient(currentColor, currentColor) 0 50% / calc(100% - 6px) 2px no-repeat;
  scale: 0 1; transform-origin: 0 50%;
  transition: scale .25s var(--ease-out);
}
.nav__links a.is-current::after { scale: 1 1; }

/* =========================================================
   HERO — the matchbox
   ========================================================= */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center;
  padding: calc(var(--nav-h) + 26px) var(--gutter) 70px;
  overflow: hidden;
}
.hero__table { --p: 0; display: grid; justify-items: center; gap: clamp(18px, 3.2vh, 34px); }

.mbox {
  --w: min(58vw, 880px, calc((100svh - 240px) / .505));
  position: relative;
  width: var(--w); height: calc(var(--w) * .505);
  translate: calc(var(--p) * -31%) 0;
}

.drawer {
  position: absolute; z-index: 1;
  left: .6%; right: .6%; top: 3.2%; bottom: 3.2%;
  translate: calc(var(--p) * 62%) 0;
  will-change: translate;
  background: var(--grain), var(--tray);
  border-radius: 3px;
  box-shadow:
    inset 0 0 0 2px var(--tray-deep),
    0 calc(var(--w) * .02) calc(var(--w) * .035) calc(var(--w) * -.012) rgba(0, 0, 0, .7);
  cursor: grab; touch-action: pan-y;
  user-select: none; -webkit-user-select: none;
}
.is-dragging .drawer { cursor: grabbing; }
.drawer__floor {
  position: absolute; left: 1.2%; right: 3.4%; top: 5.6%; bottom: 5.6%;
  background: var(--grain), var(--cream);
  border-radius: calc(var(--w) * .012);
  box-shadow: inset 0 0 0 2px var(--ink), inset 0 calc(var(--w) * .014) calc(var(--w) * .02) rgba(35, 7, 7, .3);
}
.drawer__matches {
  list-style: none; margin: 0; height: 100%;
  padding: 3.6% 2.6% 3.6% 1.6%;
  display: flex; flex-direction: column; justify-content: space-evenly;
}
.drawer__matches li { display: flex; }

.sleeve {
  position: absolute; inset: 0; z-index: 2;
  display: block; padding: 0; border: 0; cursor: pointer;
  background: var(--grain), var(--cream);
  border-radius: 3px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .35),
    inset 0 -3px 0 rgba(104, 26, 34, .12),
    0 calc(var(--w) * .028) calc(var(--w) * .05) calc(var(--w) * -.012) rgba(0, 0, 0, .75);
  transition: translate .2s var(--ease-out), scale .16s var(--ease-out);
}
.sleeve:active { scale: .985; }
.sleeve:focus-visible { outline-offset: 6px; }
.sleeve::after {
  content: ""; position: absolute; pointer-events: none;
  left: 100%; top: 3.2%; bottom: 3.2%; width: calc(var(--w) * .07);
  background: linear-gradient(90deg, rgba(20, 0, 0, .5), rgba(20, 0, 0, 0));
  opacity: min(1, calc(var(--p) * 3));
}
.sleeve__label { position: absolute; inset: 0; display: block; }
.star { position: absolute; width: calc(var(--w) * .1); height: calc(var(--w) * .096); }
.star--tl { left: .6%; top: 1%; }
.star--tr { right: .6%; top: 1%; }
.star--bl { left: .6%; bottom: 10.5%; }
.star--br { right: .6%; bottom: 10.5%; }
.plate {
  --n: calc(var(--w) * .1);
  position: absolute; left: 2.9%; right: 2.9%; top: 6%; bottom: 13.2%;
  background: var(--red);
  -webkit-mask:
    radial-gradient(circle at 0 0, #0000 var(--n), #000 calc(var(--n) + .5px)) 0 0 / 51% 51% no-repeat,
    radial-gradient(circle at 100% 0, #0000 var(--n), #000 calc(var(--n) + .5px)) 100% 0 / 51% 51% no-repeat,
    radial-gradient(circle at 0 100%, #0000 var(--n), #000 calc(var(--n) + .5px)) 0 100% / 51% 51% no-repeat,
    radial-gradient(circle at 100% 100%, #0000 var(--n), #000 calc(var(--n) + .5px)) 100% 100% / 51% 51% no-repeat;
          mask:
    radial-gradient(circle at 0 0, #0000 var(--n), #000 calc(var(--n) + .5px)) 0 0 / 51% 51% no-repeat,
    radial-gradient(circle at 100% 0, #0000 var(--n), #000 calc(var(--n) + .5px)) 100% 0 / 51% 51% no-repeat,
    radial-gradient(circle at 0 100%, #0000 var(--n), #000 calc(var(--n) + .5px)) 0 100% / 51% 51% no-repeat,
    radial-gradient(circle at 100% 100%, #0000 var(--n), #000 calc(var(--n) + .5px)) 100% 100% / 51% 51% no-repeat;
}
.plate__title {
  position: absolute; left: 5%; top: 50%; translate: 0 -50%;
  display: grid; justify-items: end;
  color: var(--yellow);
  font: 900 calc(var(--w) * .07) / .9 var(--font); letter-spacing: -.005em; text-transform: uppercase;
}
.plate__art { position: absolute; right: 8.5%; top: 50%; translate: 0 -50%; width: calc(var(--w) * .372); aspect-ratio: 1; }
.plate__burst { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--yellow); }
.plate__face { position: absolute; left: 50%; top: 50%; width: 57%; height: auto; translate: -49% -46%; }
.sleeve__roles {
  position: absolute; left: 0; right: 0; bottom: 3.6%;
  color: var(--ink); text-align: center;
  font: 800 calc(var(--w) * .0195) / 1 var(--font); letter-spacing: .012em; text-transform: uppercase;
}

.hero__hint {
  margin: 0; color: var(--cream);
  font: 500 15px/1.3 var(--font); letter-spacing: .03em;
  opacity: clamp(0, calc((var(--p) - .55) * 2.5), 1);
}
.hero__scroll {
  position: absolute; left: 50%; bottom: 16px; translate: -50% 0;
  display: grid; justify-items: center; gap: 8px;
  color: rgba(252, 225, 182, .72); text-decoration: none;
  font: 700 11px/1 var(--font); letter-spacing: .22em; text-transform: uppercase;
}
.hero__scroll::after { content: ""; width: 2px; height: 26px; background: linear-gradient(var(--cream), transparent); }
@media (max-height: 640px) { .hero__scroll { display: none; } }

/* =========================================================
   MATCH (drawer, rail) — stick, head, a flame that grows out from
   behind the head, then burns out to brown with a wisp of smoke
   ========================================================= */
.match {
  --h: calc(var(--w) * .064);
  position: relative; display: flex; align-items: center;
  width: 100%; height: var(--h);
  padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--cream); text-decoration: none;
  transition: translate .22s var(--ease-out), scale .14s var(--ease-out);
}
.match:active { scale: .97; }
.match__body {
  position: relative; z-index: 1;
  flex: 1; min-width: 0; height: 100%;
  display: flex; align-items: center;
  filter: drop-shadow(calc(var(--h) * .07) calc(var(--h) * .11) 0 var(--tan));
}
.match__stick {
  flex: 1; min-width: 0; height: 70%;
  display: flex; align-items: center; justify-content: flex-end;
  padding: 0 calc(var(--h) * .55) 0 calc(var(--h) * .4);
  background: var(--ink);
  clip-path: polygon(0 12%, 28% 6%, 29% 0, 100% 5%, 100% 95%, 62% 100%, 61% 91%, 0 89%);
  transition: background .8s;
}
.match__label {
  font: 800 max(10px, calc(var(--h) * .37)) / 1 var(--font); letter-spacing: .05em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-top: .08em;
}
.match__head {
  position: relative;
  flex: none; width: calc(var(--h) * 1.25); height: calc(var(--h) * .96);
  margin-left: calc(var(--h) * -.2);
  background: var(--red);
  border-radius: 36% 64% 64% 36% / 50%;
  transition: background .6s, scale .6s var(--ease-out), box-shadow .6s;
}
.match__flame {
  position: absolute; z-index: 0; pointer-events: none;
  right: calc(var(--h) * -.3); bottom: calc(var(--h) * -.16);
  width: calc(var(--h) * 1.85); height: calc(var(--h) * 2.84);
  transform-origin: 50% 82%;
  opacity: 0; scale: .45;
  transition: opacity .18s ease-out, scale .38s var(--ease-pop);
}
.match__flame svg { display: block; width: 100%; height: 100%; overflow: visible; }
.match__flame .fl { transform-box: fill-box; transform-origin: 50% 100%; }
.match__smoke {
  position: absolute; pointer-events: none;
  right: calc(var(--h) * .28); bottom: 55%;
  width: calc(var(--h) * .7); height: calc(var(--h) * 1.9);
  opacity: 0;
}
.match__smoke svg { width: 100%; height: 100%; overflow: visible; }

/* lit */
.match.is-lit .match__flame { opacity: 1; scale: 1; }
.match.is-lit .fl--outer { animation: fl-outer .9s ease-in-out infinite alternate; }
.match.is-lit .fl--mid { animation: fl-mid .62s ease-in-out infinite alternate; }
.match.is-lit .fl--core { animation: fl-core .45s ease-in-out infinite alternate; }
/* the head in flat inks, like the label: a cream core inside yellow inside the red */
.match.is-lit .match__head {
  background: radial-gradient(ellipse 78% 92% at 54% 8%, #FFF3CF 0 30%, var(--yellow) 31% 62%, #F2701C 63% 82%, var(--red) 83%);
}
@keyframes fl-outer {
  0% { transform: scale(1, 1) skewX(0deg); }
  50% { transform: scale(.95, 1.07) skewX(-4deg); }
  100% { transform: scale(1.04, .96) skewX(3deg); }
}
@keyframes fl-mid {
  0% { transform: scale(1, .96) skewX(2deg); }
  100% { transform: scale(.94, 1.08) skewX(-3deg); }
}
@keyframes fl-core {
  0% { transform: scale(.96, 1) translateY(0); }
  100% { transform: scale(1.04, 1.1) translateY(-4%); }
}

/* burnt: charred brown head, scorched tip, a puff of smoke as it goes out */
.match.is-burnt .match__head {
  background: radial-gradient(ellipse 55% 50% at 38% 38%, #8A5236 0 30%, var(--burnt) 31% 78%, var(--burnt-deep) 79%);
  scale: .88;
}
.match.is-burnt .match__stick {
  background: linear-gradient(90deg, var(--ink) 0 calc(100% - var(--h) * .75), #4A2418 calc(100% - var(--h) * .75));
}
.match.is-smoking .match__smoke { animation: smoke 1.8s ease-out forwards; }
@keyframes smoke {
  0% { opacity: 0; transform: translateY(20%) scaleX(.6); }
  20% { opacity: .7; }
  100% { opacity: 0; transform: translateY(-55%) scaleX(1.3); }
}

.match.is-striking { animation: strike .28s cubic-bezier(.3, .7, .4, 1); }
@keyframes strike {
  35% { transform: translateX(calc(var(--h) * -.55)) rotate(-1.2deg); }
  100% { transform: none; }
}
.drawer .match:focus-visible { translate: calc(var(--h) * .22) 0; }
.match:focus-visible { outline-offset: 2px; }

/* =========================================================
   ABOUT — on the red
   ========================================================= */
.about { padding: clamp(110px, 18vh, 200px) var(--gutter) clamp(120px, 22vh, 240px); }
.about__inner {
  max-width: 1380px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  grid-template-areas: "me exp" "skills skills";
  gap: clamp(40px, 5vw, 96px);
}
.about__me { grid-area: me; }
.about__exp { grid-area: exp; align-self: end; }
.about__skills { grid-area: skills; }
.about__title {
  margin: 0 0 .32em; color: var(--yellow);
  font: 900 clamp(3rem, 8.2vw, 7.4rem) / .86 var(--font); letter-spacing: -.016em; text-transform: uppercase;
}
.about__text {
  margin: 0; max-width: 50ch; color: var(--yellow);
  font: 700 clamp(1rem, 1.42vw, 1.3rem) / 1.5 var(--font); letter-spacing: .02em; text-transform: uppercase;
  text-wrap: pretty;
}
.about__sub {
  margin: 0 0 18px; color: var(--cream);
  font: 900 clamp(1.5rem, 2.5vw, 2.2rem) / 1 var(--font); letter-spacing: .005em; text-transform: uppercase;
}
.exp { list-style: none; margin: 0; padding: 0; }
.exp li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 18px;
  padding: 15px 0 16px; border-top: 2px solid rgba(252, 225, 182, .3);
}
.exp li:last-child { border-bottom: 2px solid rgba(252, 225, 182, .3); }
.exp h3 { grid-column: 1; margin: 0; color: var(--cream); font: 900 clamp(1.1rem, 1.6vw, 1.42rem) / 1.05 var(--font); text-transform: uppercase; }
.exp p { grid-column: 1; margin: 6px 0 0; color: var(--cream); font: 500 1rem/1.45 var(--font); opacity: .9; }
.exp__years {
  grid-column: 2; grid-row: 1 / span 2; align-self: start;
  background: var(--yellow); color: var(--ink);
  font: 800 .74rem/1 var(--font); letter-spacing: .05em; text-transform: uppercase;
  padding: 6px 8px 5px; white-space: nowrap;
}
.exp__more { margin: 16px 0 0; color: var(--yellow); font: 900 1.05rem/1 var(--font); letter-spacing: .02em; text-transform: uppercase; }

.about__skills {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: end;
  gap: 24px clamp(40px, 5vw, 96px);
  padding-top: clamp(28px, 4vw, 52px); border-top: 2px solid rgba(252, 225, 182, .3);
}
.about__skills .about__sub { margin: 0 0 34px; }

/* matchbooks: drawn like the skills page, logos lifted from it */
.books { list-style: none; margin: 0; padding: 0; display: flex; justify-content: space-between; gap: 12px; }
.book { width: clamp(64px, 6.4vw, 96px); text-align: center; }
.book svg { display: block; width: 100%; height: auto; overflow: visible; }
.book__name { display: block; margin-top: 10px; color: var(--cream); font: 700 .74rem/1.2 var(--font); letter-spacing: .06em; text-transform: uppercase; }
.bk-m { transition: translate .28s var(--ease-out); transition-delay: calc(var(--d, 0) * 1ms); }
.bk-f {
  opacity: 0; scale: .45; transform-box: fill-box; transform-origin: 50% 90%;
  transition: opacity .15s ease-out, scale .32s var(--ease-pop);
  transition-delay: calc(var(--d, 0) * 1ms + 70ms);
}
/* the matches lift in a ragged order, not a metronome */
.bk-m:nth-child(2) { --d: 0; } .bk-m:nth-child(3) { --d: 45; } .bk-m:nth-child(4) { --d: 20; }
.bk-m:nth-child(5) { --d: 70; } .bk-m:nth-child(6) { --d: 35; }

/* =========================================================
   WORK
   ========================================================= */
.work { padding: clamp(100px, 14vh, 160px) var(--gutter) clamp(70px, 10vh, 120px); }
.work__layout {
  max-width: 1380px; margin: 0 auto;
  display: grid; grid-template-columns: 218px minmax(0, 1fr); gap: clamp(36px, 4.4vw, 72px);
}
.rail { position: sticky; top: calc(var(--nav-h) + 44px); align-self: start; }
.rail__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.rail .match { --h: 34px; }
.rail .match__label { font-size: 11.5px; letter-spacing: .06em; }
.rail .match.is-active { translate: 12px 0; }

.cat { scroll-margin-top: calc(var(--nav-h) + 30px); }
.cat + .cat { margin-top: clamp(84px, 12vh, 150px); }
.cat__head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  margin-bottom: clamp(22px, 3vw, 34px); padding-bottom: 16px;
  border-bottom: 3px solid var(--red);
}
.cat__title {
  margin: 0; color: var(--red);
  font: 900 clamp(2.1rem, 5vw, 4.5rem) / .9 var(--font); letter-spacing: -.012em; text-transform: uppercase;
  text-shadow: .045em .045em 0 var(--yellow);
}
.cat__meta { display: flex; align-items: flex-end; gap: 16px; flex: none; padding-bottom: 4px; }
.tally { display: flex; gap: 7px; align-items: flex-end; height: 40px; }
.tally i { position: relative; width: 5px; height: 32px; background: var(--ink); }
.tally i::before {
  content: ""; position: absolute; left: -3px; top: -8px; width: 11px; height: 12px;
  border-radius: 50% 50% 45% 45%; background: var(--red);
}
.cat__count { color: var(--maroon); font: 700 .82rem/1 var(--font); letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }

.cat__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(18px, 2.2vw, 30px); }

/* project card: a matchbox label, the same anatomy on every card */
.proj {
  position: relative; display: flex; flex-direction: column;
  background: var(--grain), var(--cream);
  border: 3px solid var(--red);
  transition: translate .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.proj--feature { grid-column: 1 / -1; }
.proj:has(.proj__hit:focus-visible) {
  translate: -5px -5px;
  box-shadow: 5px 5px 0 var(--red), 10px 10px 0 var(--yellow);
}
/* pressing the label stamps it back down onto the page */
.proj:has(.proj__hit:active) {
  translate: -1px -1px;
  box-shadow: 1px 1px 0 var(--red), 2px 2px 0 var(--yellow);
  transition-duration: .1s;
}
.proj:has(.proj__hit:focus-visible) { outline: 3px solid var(--ink); outline-offset: 4px; }
.proj__bar {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  background: var(--red); color: var(--cream);
  padding: 12px 16px 10px;
}
.proj__bar h4 { margin: 0; font: 900 clamp(1.15rem, 1.9vw, 1.55rem) / 1 var(--font); letter-spacing: .01em; text-transform: uppercase; }
.proj__bar p { margin: 0; color: var(--yellow); text-align: right; font: 700 .76rem/1.15 var(--font); letter-spacing: .07em; text-transform: uppercase; }
.proj__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--ink); }
.proj--feature .proj__media { aspect-ratio: var(--ratio, 2); }
.proj__media img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .4s ease-out, scale .45s var(--ease-out);
}
.proj__media img.is-loaded { opacity: 1; }
.proj__caption { margin: 0; padding: 18px 20px 0; max-width: 78ch; color: var(--maroon); font-size: 1rem; line-height: 1.62; }
.proj__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: auto; padding: 12px 16px 13px;
  border-top: 3px solid var(--red);
}
.proj--feature .proj__foot { margin-top: 16px; }
.proj__count {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--red); font: 800 .72rem/1 var(--font); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.proj__count::before { /* a tiny stack of frames */
  content: ""; width: 14px; height: 11px; border: 2px solid currentColor; box-shadow: 3px -3px 0 -1px var(--cream), 3px -3px 0 1px currentColor;
}
.proj__hit { position: absolute; inset: -3px; z-index: 2; border: 0; padding: 0; background: none; cursor: pointer; }
.proj__hit:focus-visible { outline: none; }

.minis { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.minis svg { width: 28px; height: auto; display: block; overflow: visible; }

/* =========================================================
   CONTACT
   ========================================================= */
.contact { padding: clamp(40px, 8vh, 90px) var(--gutter) 28px; }
.label {
  --side: minmax(370px, 34%);
  max-width: 1380px; margin: 0 auto;
  display: grid; grid-template-columns: var(--side) minmax(0, 1fr);
  grid-template-areas: "head head" "links warn" "seal code";
  border: 4px solid var(--red);
  background: var(--grain), var(--cream);
}
.label__head { grid-area: head; display: grid; grid-template-columns: subgrid; align-items: center; background: var(--red); color: var(--cream); }
.label__head h2, .label__head p {
  margin: 0; padding: .28em 22px .22em;
  font: 900 clamp(2.2rem, 6vw, 5.4rem) / 1 var(--font); letter-spacing: -.005em; text-transform: uppercase;
}
.label__head p { text-align: center; }
.label__links {
  grid-area: links; list-style: none; margin: 0; padding: clamp(18px, 2.4vw, 30px) clamp(14px, 1.6vw, 22px);
  display: grid; align-content: center; gap: 10px;
  border-right: 4px solid var(--red); border-bottom: 4px solid var(--red);
}
.clink {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 11px 12px 10px; border: 2px solid var(--red);
  color: var(--red); text-decoration: none;
  transition: background-color .15s ease, color .15s ease, translate .2s var(--ease-out), box-shadow .2s var(--ease-out), scale .14s var(--ease-out);
}
.clink:active { scale: .98; }
.clink__icon { width: 22px; height: 22px; }
.clink__text { font: 800 clamp(.8rem, .98vw, .98rem) / 1.2 var(--font); letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clink__act {
  font: 800 .66rem/1 var(--font); letter-spacing: .1em; text-transform: uppercase;
  padding: 6px 7px 5px; background: var(--red); color: var(--cream);
}
.clink:focus-visible {
  background: var(--red); color: var(--cream);
  translate: -3px -3px; box-shadow: 3px 3px 0 var(--yellow);
}
.clink:focus-visible .clink__act { background: var(--yellow); color: var(--ink); }
.label__warnings {
  grid-area: warn; list-style: none; margin: 0; padding: clamp(20px, 3vw, 40px) clamp(16px, 3vw, 40px);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(12px, 3vw, 40px);
  border-bottom: 4px solid var(--red);
}
/* pictures line up along the top; every caption gets a two-line slot, one-liners sit in its middle */
.label__warnings li { display: grid; grid-template-rows: auto auto; gap: 12px; justify-items: center; align-content: start; }
.label__warnings img { width: 100%; border: 3px solid var(--red); }
.label__warnings span { display: grid; place-items: center; min-height: 2.3em; color: var(--red); text-align: center; font: 800 clamp(.74rem, 1.1vw, 1.02rem) / 1.15 var(--font); letter-spacing: .02em; text-transform: uppercase; }
.label__seal { grid-area: seal; display: grid; place-items: center; padding: 28px; border-right: 4px solid var(--red); overflow: hidden; }

/* the stamp: two inks, as on the Warnings page — a red burst, the face cut out of it in cream */
.stamp { position: relative; width: min(230px, 72%); aspect-ratio: 1; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.stamp__spin { position: absolute; inset: 0; display: block; animation: stamp-spin 60s linear infinite; }
@keyframes stamp-spin { to { rotate: 1turn; } }
.stamp__burst { display: block; width: 100%; height: 100%; overflow: visible; color: var(--red); }
.stamp__face-wrap { position: absolute; left: 50%; top: 50%; width: 56%; translate: -49% -47%; pointer-events: none; }
.stamp__face {
  display: block; width: 100%; aspect-ratio: 1000 / 1068;
  background: var(--cream);
  -webkit-mask: url(assets/ui/face.webp) center / contain no-repeat;
          mask: url(assets/ui/face.webp) center / contain no-repeat;
  transform-origin: 50% 85%;
}
.stamp__sparks { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.spark { position: absolute; left: 0; top: 0; display: block; background: var(--red); }
.spark--chip { width: 12px; height: 12px; margin: -6px 0 0 -6px; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.spark--shard { width: 8px; height: 22px; margin: -11px 0 0 -4px; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.spark--burst { width: 22px; height: 22px; margin: -11px 0 0 -11px; background: none; color: var(--red); }
.spark--burst svg { width: 100%; height: 100%; display: block; }
.label__code { grid-area: code; display: flex; align-items: stretch; padding: clamp(20px, 3vw, 40px); min-height: 180px; }
.label__code i { display: block; background: var(--red); }
.footer { max-width: 1380px; margin: 22px auto 0; color: var(--maroon); font: 500 14px/1.4 var(--font); }

/* =========================================================
   VIEWER
   ========================================================= */
.viewer {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: transparent; overflow: hidden;
}
.viewer::backdrop { background: rgba(26, 5, 5, .88); }
.viewer[open] { display: block; }
.viewer__frame {
  position: absolute; inset: clamp(0px, 2.2vw, 30px);
  display: grid; grid-template-columns: minmax(290px, 25%) minmax(0, 1fr);
  grid-template-areas: "info stage";
  background: var(--grain), var(--cream);
  border: 4px solid var(--red);
  box-shadow: 8px 8px 0 var(--yellow);
}
.viewer__info { grid-area: info; display: flex; flex-direction: column; gap: 20px; min-height: 0; overflow: auto; border-right: 4px solid var(--red); padding-bottom: 20px; }
.viewer__head { background: var(--red); color: var(--cream); padding: 20px 22px 18px; }
.viewer__head h2 { margin: 0; font: 900 clamp(1.6rem, 2.6vw, 2.5rem) / .95 var(--font); letter-spacing: -.005em; text-transform: uppercase; }
.viewer__head p { margin: 8px 0 0; color: var(--yellow); font: 700 .8rem/1.2 var(--font); letter-spacing: .07em; text-transform: uppercase; }
.viewer__text { margin: 0; padding: 0 22px; color: var(--maroon); font-size: 1rem; line-height: 1.66; }
.viewer__tools { list-style: none; margin: 0; padding: 0 22px; display: flex; gap: 8px; }
.viewer__tools svg { width: 34px; height: auto; display: block; overflow: visible; }
.viewer__tools[hidden] { display: none; }
.viewer__copy {
  align-self: flex-start; margin: 0 22px;
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; padding: 4px 0; background: none; cursor: pointer;
  color: var(--red); font: 800 .74rem/1 var(--font); letter-spacing: .1em; text-transform: uppercase;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px;
  transition: color .15s ease, scale .14s var(--ease-out);
}
.viewer__copy::before { /* a little chain link */
  content: ""; width: 16px; height: 9px; border: 2px solid currentColor; border-radius: 6px;
  box-shadow: 7px 0 0 -2px var(--cream), 7px 0 0 0 currentColor;
  margin-right: 6px;
}
.viewer__copy:active { scale: .97; }
.viewer__projnav { margin-top: auto; padding: 0 22px; display: grid; gap: 10px; }
.viewer__projnav button {
  display: grid; gap: 4px; text-align: left; cursor: pointer;
  border: 2px solid var(--red); background: none; color: var(--red); padding: 10px 12px 9px;
  transition: background-color .15s ease, color .15s ease, scale .14s var(--ease-out);
}
.viewer__projnav button small { font: 700 .66rem/1 var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--maroon); transition: color .15s ease; }
.viewer__projnav button span { font: 900 1rem/1.1 var(--font); text-transform: uppercase; }
.viewer__projnav button:active, .viewer__close:active { scale: .97; }

.viewer__stage { grid-area: stage; position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; background: var(--stage); }
.viewer__top { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 4px 18px; }
.viewer__count { color: rgba(252, 225, 182, .75); font: 700 .8rem/1 var(--font); letter-spacing: .14em; }
.viewer__close {
  border: 2px solid var(--cream); background: none; color: var(--cream); cursor: pointer;
  font: 800 .8rem/1 var(--font); letter-spacing: .1em; text-transform: uppercase; padding: 9px 12px 8px;
}
.viewer__close { transition: background-color .15s ease, color .15s ease, scale .14s var(--ease-out); }
/* the image always fits inside the canvas, whatever its shape */
.viewer__canvas { --zone: clamp(48px, 5vw, 76px); position: relative; min-height: 0; overflow: hidden; touch-action: pan-y; }
.viewer__canvas img {
  position: absolute; top: 10px; bottom: 10px; left: var(--zone); right: var(--zone);
  width: calc(100% - 2 * var(--zone)); height: calc(100% - 20px); max-width: none;
  object-fit: contain;
  filter: drop-shadow(0 18px 36px rgba(0, 0, 0, .5));
  transition: opacity .25s var(--ease-out);
}
/* While the sharp art downloads, a blurred thumbnail sits underneath and the real image
   fades in on top. Only opacity ever changes: iPhones don't always repaint when a blur is
   switched off, which used to leave the art stuck blurry on first open. */
.viewer__canvas img.is-loading { opacity: 0; }
.viewer__canvas .viewer__ghost { filter: blur(8px); transition: none; }
.viewer__canvas .viewer__ghost[hidden] { display: none; }
.viewer__zone {
  position: absolute; top: 0; bottom: 0; z-index: 1; width: var(--zone);
  display: grid; place-items: center; border: 0; padding: 0; background: none; cursor: pointer;
  color: var(--cream); opacity: .7; transition: opacity .15s ease, background-color .15s ease;
}
.viewer__zone:active svg { scale: .9; }
.viewer__zone svg { width: 34px; height: 34px; }
.viewer__zone--prev { left: 0; }
.viewer__zone--prev svg { rotate: 180deg; }
.viewer__zone--next { right: 0; }
.viewer__zone[hidden] { display: none; }
.viewer__thumbs { list-style: none; margin: 0; padding: 10px 14px 14px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: thin; }
.viewer__thumbs[hidden] { display: none; }
.viewer__thumbs button { display: block; padding: 0; border: 2px solid transparent; background: none; cursor: pointer; opacity: .5; transition: opacity .15s ease; }
.viewer__thumbs button[aria-current="true"] { border-color: var(--yellow); opacity: 1; }
.viewer__thumbs img { height: 56px; width: auto; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1099px) {
  .work__layout { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
}
@media (max-width: 900px) {
  .about__inner { grid-template-columns: minmax(0, 1fr); grid-template-areas: "me" "exp" "skills"; }
  .about__exp { align-self: start; }
  .about__skills { grid-template-columns: minmax(0, 1fr); }
  .about__skills .about__sub { margin-bottom: 8px; }
  .viewer__frame { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "stage" "info"; inset: 0; border-width: 0; box-shadow: none; }
  .viewer__info { border-right: 0; border-top: 4px solid var(--red); max-height: 42dvh; gap: 14px; padding-bottom: 16px; }
  .viewer__head { padding: 14px 18px 12px; }
  .viewer__text, .viewer__tools, .viewer__projnav { padding-left: 18px; padding-right: 18px; }
  .viewer__projnav { grid-template-columns: 1fr 1fr; }
  .viewer__canvas { --zone: 40px; }
}
@media (max-width: 700px) {
  body { font-size: 17px; }
  .cat__grid { grid-template-columns: minmax(0, 1fr); }
  .proj__caption { padding: 16px 16px 0; font-size: .96rem; }
  .cat__head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .label { --side: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "links" "warn" "seal" "code"; }
  .label__head { grid-template-columns: minmax(0, 1fr); }
  .label__head p { display: none; }
  .label__links, .label__seal { border-right: 0; }
  .label__seal { border-bottom: 4px solid var(--red); }
  .label__warnings { gap: 10px; padding: 20px 14px; }
  .label__warnings img { border-width: 2px; }
  .label__code { min-height: 120px; }
  .stamp { width: min(200px, 60%); }
  .clink { gap: 10px; padding: 11px 10px 10px; }
  .clink__text { white-space: normal; overflow-wrap: anywhere; letter-spacing: 0; font-size: .8rem; }
  .books { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 12px; }
  .book { width: auto; display: grid; justify-items: center; }
  .book svg { width: 72px; }
}
@media (max-width: 520px) {
  :root { --nav-h: 58px; }
  .nav__name { display: none; }
  .nav__links { gap: 0; }
  .nav__links a { padding: 12px 9px 14px; font-size: 13px; }
  .nav__links a::after { left: 9px; right: 9px; }
}

/* portrait screens: the box stands up and the drawer slides down */
@media (max-aspect-ratio: 4/5), (max-width: 620px) {
  .hero { padding-bottom: 64px; }
  .mbox {
    --w: min(84vw, 400px, calc((100svh - 156px) / 2.2));
    height: calc(var(--w) * 1.36);
    translate: 0 calc(var(--p) * -31%);
  }
  .hero__hint { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 22px; text-align: center; }  .hero__scroll { display: none; }
  .drawer { left: 3.4%; right: 3.4%; top: .6%; bottom: .6%; translate: 0 calc(var(--p) * 62%); touch-action: auto; }
  .drawer__floor { left: 5%; right: 5%; top: 1.6%; bottom: 3.4%; }
  .drawer__matches { justify-content: flex-end; gap: calc(var(--w) * .026); padding: 0 3.5% 5%; }
  .drawer .match { --h: calc(var(--w) * .108); }
  .drawer .match__label { font-size: max(10px, calc(var(--h) * .42)); letter-spacing: .03em; }
  .drawer .match__stick { padding-left: calc(var(--h) * .25); }
  .sleeve::after { left: 3.4%; right: 3.4%; top: 100%; bottom: auto; width: auto; height: calc(var(--w) * .09); background: linear-gradient(180deg, rgba(20, 0, 0, .5), rgba(20, 0, 0, 0)); }
  .plate { --n: calc(var(--w) * .13); left: 4%; right: 4%; top: 4.4%; bottom: 14.2%; }
  .plate__art { right: auto; left: 50%; top: 6%; translate: -50% 0; width: calc(var(--w) * .68); }
  .plate__title { left: 0; right: 0; top: auto; bottom: 6.5%; translate: none; justify-items: center; font-size: calc(var(--w) * .15); }
  .star { width: calc(var(--w) * .13); height: calc(var(--w) * .125); }
  .star--bl, .star--br { bottom: 11%; }
  .sleeve__roles { bottom: 2.6%; padding: 0 10%; font-size: calc(var(--w) * .035); line-height: 1.18; }
}

/* =========================================================
   HOVER — only where a real pointer hovers, so taps on phones never
   leave things lifted or slid out
   ========================================================= */
@media (hover: hover) and (pointer: fine) {
  .nav__brand:hover .seal--nav { rotate: -14deg; }
  .nav__links a:hover::after { scale: 1 1; }
  .nav__links a:hover { color: var(--yellow); }
  .nav.is-solid .nav__links a:hover { color: var(--red); }
  .sleeve:hover { translate: 0 -3px; }
  .hero__scroll:hover { color: var(--yellow); }
  .drawer .match:hover { translate: calc(var(--h) * .22) 0; }
  .rail .match:not(.is-active):hover { translate: 5px 0; }
  .book:hover .bk-m { translate: 0 -6px; }
  .book:hover .bk-f { opacity: 1; scale: 1; }
  .proj:hover { translate: -5px -5px; box-shadow: 5px 5px 0 var(--red), 10px 10px 0 var(--yellow); }
  .proj:hover .proj__media img { scale: 1.03; }
  .clink:hover { background: var(--red); color: var(--cream); translate: -3px -3px; box-shadow: 3px 3px 0 var(--yellow); }
  .clink:hover .clink__act { background: var(--yellow); color: var(--ink); }
  .viewer__projnav button:hover { background: var(--red); color: var(--cream); }
  .viewer__projnav button:hover small { color: var(--yellow); }
  .viewer__close:hover { background: var(--cream); color: var(--stage); }
  .viewer__zone:hover { opacity: 1; background: rgba(252, 225, 182, .06); }
  .viewer__thumbs button:hover { opacity: .85; }
}

/* the viewer's backdrop fades in rather than snapping */
.viewer[open]::backdrop { animation: backdrop-in .25s ease-out; }
@keyframes backdrop-in { from { opacity: 0; } }

/* reduced motion: no movement, but keep the fades that explain what changed */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition-property: opacity, color, background-color, border-color !important;
    transition-duration: .15s !important;
  }
  .match__flame { scale: 1; }
}
