@import url("https://fonts.googleapis.com/css2?family=Comic+Neue:ital,wght@0,400;0,700;1,400;1,700&display=swap");

/* ══════════════════════════════════════════════════════════════════
   /portfolio — a faithful, interactive recreation of
   assets/documents/portfolio_latest.pdf (595 × 3988 pt, 1 page).

   Geometry is expressed in the PDF's own coordinate system: every
   --x / --y / --w / --ih / --s custom property below is a PDF point,
   multiplied by --u (one PDF point, in CSS pixels) at paint time.
   ══════════════════════════════════════════════════════════════════ */

/* ── Fraunces 72pt (variable: opsz, wght, SOFT, WONK) ───────────── */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../assets/fonts/fraunces/Fraunces-latin.woff2") format("woff2");
  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: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../assets/fonts/fraunces/Fraunces-latin-ext.woff2") format("woff2");
  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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("../assets/fonts/fraunces/Fraunces-Italic-latin.woff2") format("woff2");
  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: "Fraunces";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("../assets/fonts/fraunces/Fraunces-Italic-latin-ext.woff2") format("woff2");
  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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ── Tokens ─────────────────────────────────────────────────────── */
:root {
  --sheet-max: 1120px;
  /* One PDF point, in px. JS refines this from clientWidth (no scrollbar). */
  --u: calc(min(100vw, var(--sheet-max)) / 595);
  --vw: 100vw;

  --ink: #24143d;
  --paper: #fff8ec;
  --link: #64359a;          /* the PDF's hyperlink teal            */
  --accent: #ffc387;        /* the PDF's award-line apricot        */
  --frame: #000;            /* default screenshot frame stroke     */
  --crypto-frame: #156082;

  /* Fraunces "72pt SuperSoft" == opsz 72, SOFT 100, WONK 0 */
  --soft: "opsz" 72, "SOFT" 100, "WONK" 1;
  --hard: "opsz" 72, "SOFT" 0, "WONK" 1;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Reset / page ───────────────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: "Comic Sans MS", "Comic Neue", "Chalkboard SE", "Fraunces", "Literata", Georgia, "Times New Roman", serif
  font-variation-settings: var(--soft);
  font-optical-sizing: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--link);
  /* The rule is painted as two stacked backgrounds instead of a
     text-decoration so the accent sweep can be animated in from the
     left without ever changing the text's metrics. */
  text-decoration: none;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  background-image: linear-gradient(90deg, var(--accent), var(--link)),
    linear-gradient(currentColor, currentColor);
  background-size: 0% 0.1em, 100% 0.055em;
  background-position: 0 calc(100% - 0.06em), 0 calc(100% - 0.06em);
  background-repeat: no-repeat;
  transition: color 0.25s ease, background-size 0.45s var(--ease-out);
}
a:hover,
a:focus-visible {
  color: #1f5464;
  background-size: 100% 0.1em, 100% 0.055em;
}

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

/* ── Scroll progress + floating nav ─────────────────────────────── */
.scroll-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 60;
  background: rgba(0, 0, 0, 0.06);
  pointer-events: none;
}
.scroll-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--link), var(--accent));
  transform-origin: 0 50%;
}

.floating-nav {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 61;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(-8px);
  animation: nav-in 0.8s var(--ease-out) 0.9s forwards;
}
.floating-nav .pill {
  font-size: 12.5px;
  font-weight: 600;
  font-variation-settings: var(--hard);
  letter-spacing: 0.01em;
  color: #fff;
  text-decoration: none;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(16, 17, 21, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(9px) saturate(1.4);
  backdrop-filter: blur(9px) saturate(1.4);
  transition: background 0.28s ease, transform 0.28s var(--ease-out),
    color 0.28s ease, border-color 0.28s ease;
}
.floating-nav .pill:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.12);
  color: #14161a;
  transform: translateY(-2px);
}
/* Past the hero band the pills sit on white paper — flip them dark. */
body.past-hero .floating-nav .pill {
  color: #22252b;
  text-shadow: none;
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(0, 0, 0, 0.14);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.07);
}
body.past-hero .floating-nav .pill:hover { background: #fff; }

@keyframes nav-in { to { opacity: 1; transform: none; } }

/* The CV pill needs to read as unmissable — bigger, brighter, and pulsing. */
.floating-nav .pill--cv {
  font-size: 14px;
  font-weight: 800;
  padding: 9px 18px;
  color: #14161a;
  background: linear-gradient(90deg, var(--accent), #ffe0b5);
  border: 1px solid rgba(0, 0, 0, 0.15);
  text-shadow: none;
  box-shadow: 0 0 0 rgba(242, 170, 131, 0.6);
  animation: nav-in 0.8s var(--ease-out) 0.9s forwards, cv-pulse 2.2s ease-in-out 1.7s infinite;
}
.floating-nav .pill--cv:hover {
  background: linear-gradient(90deg, #ffe0b5, var(--accent));
  color: #14161a;
  transform: translateY(-2px) scale(1.04);
}
body.past-hero .floating-nav .pill--cv {
  color: #14161a;
  background: linear-gradient(90deg, var(--accent), #ffe0b5);
  border-color: rgba(0, 0, 0, 0.15);
}
@keyframes cv-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 170, 131, 0.55), 0 0 10px 2px rgba(242, 170, 131, 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(242, 170, 131, 0), 0 0 22px 6px rgba(242, 170, 131, 0.75); }
}
@media (prefers-reduced-motion: reduce) {
  .floating-nav .pill--cv { animation: none; }
}

/* ══════════════════════════════════════════════════════════════════
   THE SHEET — absolute reproduction of the PDF page
   ══════════════════════════════════════════════════════════════════ */
.sheet {
  position: relative;
  width: 100%;
  max-width: var(--sheet-max);
  margin: 0 auto;
  overflow: visible;
}

.chapter {
  position: relative;
  height: calc(var(--h) * var(--u));
}

/* ── Layers ─────────────────────────────────────────────────────── */

/* Faded engravings. Baked onto white in the PDF's own alpha, then
   multiplied back so ink still darkens whatever sits beneath it. */
.art {
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u));
  height: calc(var(--ih) * var(--u));
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: multiply;
  transform: translate3d(var(--px, 0px), var(--py, 0px), 0)
    rotate(var(--rz, 0deg)) skewY(var(--skew, 0deg));
}
.art img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  /* Kept off `transform` shorthand so the reveal and the idle breathing
     animation can each own one part of the stack without clobbering. */
  transform: translate3d(0, var(--arty, 0px), 0) scale(var(--arts, 1));
}

/* One engraving (a decorative engraving) is painted last in the
   PDF, on top of the screenshot and the copy. */
.art--over { z-index: 4; }

/* The engravings are JPEGs on a near-but-not-quite-white ground. Squared
   up that reads as nothing under `multiply`, but once a plate is rotated
   its edge stops agreeing with the page and the box shows. Feathering the
   four sides hides the boundary at any angle. */
.art:not(.art--hero) img {
  --feather:
    linear-gradient(to right, transparent 0, #000 4%, #000 96%, transparent 100%),
    linear-gradient(to bottom, transparent 0, #000 4%, #000 96%, transparent 100%);
  -webkit-mask-image: var(--feather);
  mask-image: var(--feather);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.art--hero {
  left: 50%;
  top: 0;
  width: var(--vw);
  height: calc(200.69 * var(--u));
  margin-left: calc(var(--vw) / -2);
  z-index: 1;
  mix-blend-mode: normal;
  overflow: hidden;
}
.art-hero-in {
  display: block;
  width: 100%;
  height: 100%;
  transform: translate3d(0, var(--py, 0px), 0);
  will-change: transform;
}
.art--hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Cover budget: the drift below travels +/-0.16 of the band height, so
     the image is oversized by 0.19 either side and can never leave a gap. */
  transform: scale(1.38);
  transform-origin: 50% 50%;
}

/* Screenshots — outer element carries parallax, inner carries the
   frame + reveal + hover so the two transforms never fight. */
.shot {
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u));
  height: calc(var(--ih) * var(--u));
  margin: 0;
  z-index: 2;
  transform: translate3d(var(--px, 0px), var(--py, 0px), 0) rotate(var(--rz, 0deg));
}

.shot-in {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border: max(1px, calc(0.75 * var(--u))) solid var(--border, var(--frame));
  border-radius: calc(var(--r) * var(--u));
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transform-origin: 50% 60%;
  transform: translate3d(0, calc(var(--revy, 0px) + var(--lift, 0px)), 0)
    perspective(900px)
    rotateX(var(--tiltx, 0deg))
    rotateY(var(--tilty, 0deg))
    skewY(var(--skew, 0deg))
    scale(var(--revs, 1));
  transition: box-shadow 0.55s var(--ease-out),
    --lift 0.55s var(--ease-out),
    --tiltx 0.3s ease-out,
    --tilty 0.3s ease-out;
  will-change: transform;
}
/* "Develops" as the shot travels to the middle of the viewport: a paper
   wash that lifts off. Opacity-only, so it never re-rasters the image. */
.shot-in::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(165deg, rgba(255, 247, 238, 0.62), rgba(70, 119, 133, 0.26));
  opacity: calc((1 - var(--dev, 1)) * 0.6);
}
.shot-in img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  /* Runs against the frame's own parallax, so you appear to look
     *through* the frame rather than at a sticker on the page. */
  transform: translate3d(0, var(--ipy, 0px), 0)
    scale(calc(var(--izoom, 1) * var(--ihov, 1)));
  transition: --ihov 0.7s var(--ease-out), filter 0.55s ease;
}

/* Cursor-tracked specular highlight */
.glare {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: var(--gla, 0);
  mix-blend-mode: soft-light;
  background: radial-gradient(
    circle at var(--glx, 50%) var(--gly, 50%),
    rgba(255, 255, 255, 0.55),
    rgba(255, 255, 255, 0.14) 34%,
    transparent 64%
  );
  transition: opacity 0.4s ease;
}

/* Sheen sweep on hover */
.sheen {
  position: absolute;
  inset: -20% -60%;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgba(255, 255, 255, 0.62) 48%,
    rgba(255, 255, 255, 0.9) 52%,
    transparent 62%
  );
  transform: translateX(-58%);
}

.shot:hover,
.shot:focus-within {
  --lift: calc(-0.5 * var(--u) - 4px);
  --ihov: 1.035;
  --gla: 1;
}
.shot:hover .shot-in,
.shot:focus-within .shot-in {
  box-shadow: 0 calc(2.4 * var(--u)) calc(6.2 * var(--u)) rgba(20, 24, 34, 0.2),
    0 calc(0.4 * var(--u)) calc(1.2 * var(--u)) rgba(20, 24, 34, 0.09);
}
.shot:hover .shot-in img { filter: saturate(1.09) contrast(1.03); }
.shot:hover .sheen { animation: sheen 0.95s var(--ease-out); }

@keyframes sheen {
  0%   { opacity: 0;    transform: translateX(-58%); }
  18%  { opacity: 0.95; }
  100% { opacity: 0;    transform: translateX(58%); }
}

/* Laurel wreaths that sit beside three of the headings */
.laurel {
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(31.68 * var(--u));
  height: calc(31.68 * var(--u));
  z-index: 3;
  transform-origin: 50% 85%;
}

/* ── Type ───────────────────────────────────────────────────────── */
.title,
.prose,
.hero-name,
.hero-loc,
.hero-motto,
.hero-meta,
.the-end {
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  margin: 0;
  z-index: 3;
}

.title {
  /* Absolutely positioned + nowrap == shrink-to-fit at the PDF's width. */
  width: auto;
  white-space: nowrap;
  font-size: calc(20 * var(--u));
  font-weight: 700;
  line-height: 1.233;
  letter-spacing: 0;
  font-variation-settings: var(--soft);
}

.prose {
  width: calc(374.4 * var(--u));
  font-size: calc(11 * var(--u));
  font-weight: 400;
  line-height: 1.178;
  /* The PDF sets every 11pt run about -0.02em tight; matching it keeps
     the line breaks (and therefore the whole page) where they belong. */
  letter-spacing: -0.018em;
  text-align: justify;
  text-justify: inter-word;
  hyphens: none;
  -webkit-hyphens: none;
}
.prose p { margin: 0 0 calc(12 * var(--u)); }
.prose p:last-child { margin-bottom: 0; }
.prose b { font-weight: 700; }
.prose i { font-style: italic; }

.accent {
  color: var(--accent);
  font-weight: 600;
  font-style: normal;
  font-variation-settings: var(--hard);
}

/* ── Hero copy ──────────────────────────────────────────────────── */
.chapter--hero { z-index: 5; }
.chapter--hero .hero-name,
.chapter--hero .hero-loc,
.chapter--hero .hero-motto,
.chapter--hero .hero-meta { color: #fff; z-index: 3; }

.hero-name {
  font-size: calc(var(--s) * var(--u));
  font-weight: 700;
  line-height: 1.233;
  text-shadow: 0 calc(0.5 * var(--u)) calc(2.4 * var(--u)) rgba(0, 0, 0, 0.28);
}
.hero-loc {
  font-size: calc(var(--s) * var(--u));
  font-weight: 400;
  line-height: 1.233;
  text-shadow: 0 calc(0.3 * var(--u)) calc(1.6 * var(--u)) rgba(0, 0, 0, 0.3);
}
.hero-motto {
  font-size: calc(var(--s) * var(--u));
  font-style: italic;
  line-height: 1.233;
  text-shadow: 0 calc(0.3 * var(--u)) calc(1.6 * var(--u)) rgba(0, 0, 0, 0.3);
}
.hero-motto .u {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 0.05em no-repeat;
  transition: background-size 0.45s var(--ease-out);
}
.hero-motto:hover .u { background-size: 100% 0.12em; }

.hero-meta {
  width: calc(430 * var(--u));
  font-size: calc(var(--s) * var(--u));
  line-height: 1.178;
  letter-spacing: -0.018em;
  text-shadow: 0 calc(0.3 * var(--u)) calc(1.6 * var(--u)) rgba(0, 0, 0, 0.32);
}
.hero-meta p { margin: 0; }
.hero-meta .i { font-style: italic; }
.hero-meta .b { font-weight: 700; }
.hero-meta a { color: #fff; text-decoration-color: rgba(255, 255, 255, 0.55); }
.hero-meta a:hover { color: #fff; text-decoration-color: #fff; }

.the-end {
  font-size: calc(var(--s) * var(--u));
  font-style: italic;
  line-height: 1.233;
}

/* ══════════════════════════════════════════════════════════════════
   ENTRANCE / SCROLL ANIMATION
   ══════════════════════════════════════════════════════════════════ */
/* Pre-animation state (only applied once JS confirms it can drive it) */
.js .shot-in {
  opacity: 0;
  --revy: calc(3.4 * var(--u) + 14px);
  --revs: 0.972;
}
/* The frame arrives first, then the picture wipes up inside it. */
.js .shot-in img { clip-path: inset(0 0 100% 0); }
.js .art img {
  opacity: 0;
  --arty: calc(2.2 * var(--u));
  --arts: 1.035;
  clip-path: inset(0 0 100% 0);
}
.js .laurel  { opacity: 0; transform: scale(0.45) rotate(-22deg); }
.js .title   { opacity: 0; transform: translateY(calc(1.5 * var(--u) + 8px)); }
.js .prose   { opacity: 0; transform: translateY(calc(1.1 * var(--u) + 6px)); }
.js .the-end { opacity: 0; transform: translateY(calc(1.5 * var(--u) + 10px)); }
.js .reveal  { opacity: 0; transform: translateY(calc(1.6 * var(--u) + 10px)); }

.js .title,
.js .prose,
.js .the-end,
.js .reveal {
  transition: opacity 0.85s var(--ease-out), transform 0.85s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.js .art img {
  transition: opacity 1.15s var(--ease-out) var(--d, 0ms),
    clip-path 1.3s var(--ease-out) var(--d, 0ms),
    --arty 1.15s var(--ease-out) var(--d, 0ms),
    --arts 1.15s var(--ease-out) var(--d, 0ms);
}
.js .shot-in {
  transition: opacity 0.9s var(--ease-out) var(--d, 0ms),
    --revy 0.9s var(--ease-out) var(--d, 0ms),
    --revs 0.9s var(--ease-out) var(--d, 0ms),
    box-shadow 0.55s var(--ease-out),
    --lift 0.55s var(--ease-out),
    --tiltx 0.3s ease-out,
    --tilty 0.3s ease-out;
}
.js .shot-in img {
  transition: clip-path 1.05s var(--ease-out) calc(var(--d, 0ms) + 120ms),
    --ihov 0.7s var(--ease-out),
    filter 0.55s ease;
}
.js .laurel {
  transition: opacity 0.7s var(--ease-out), transform 0.85s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition-delay: var(--d, 0ms);
}

.js .shot.is-in .shot-in { opacity: 1; --revy: 0px; --revs: 1; }
.js .shot.is-in .shot-in img { clip-path: inset(0 0 0 0); }
.js .art.is-in img {
  opacity: 1;
  --arty: 0px;
  --arts: 1;
  clip-path: inset(0 0 0 0);
}
/* Once settled, engravings breathe — starts after the reveal has run. */
.js .art.is-in:not(.art--hero) img {
  animation: art-breathe var(--bd, 15s) ease-in-out infinite;
  animation-delay: calc(var(--d, 0ms) + 1500ms);
}
@keyframes art-breathe {
  0%,
  100% { --arts: 1; }
  50%  { --arts: 1.028; }
}
.js .laurel.is-in        { opacity: 1; transform: none; }
.js .title.is-in,
.js .prose.is-in,
.js .the-end.is-in,
.js .reveal.is-in        { opacity: 1; transform: none; }

/* The hero swirl gets its own slow settle on load */
.js .art--hero img {
  opacity: 0;
  transform: scale(1.48);
  transition: opacity 1.4s ease, transform 2.4s var(--ease-out);
}
.js .art--hero.is-in img {
  opacity: 1;
  transform: scale(1.38);
  animation: ken-burns 30s ease-in-out 2.8s infinite alternate;
}
@keyframes ken-burns {
  0%   { transform: scale(1.38) translate3d(0, 0, 0); }
  100% { transform: scale(1.48) translate3d(-1.6%, 1.4%, 0); }
}

/* ══════════════════════════════════════════════════════════════════
   SPARKLES (spawned by portfolio.js on hover)
   ══════════════════════════════════════════════════════════════════ */
.spark {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--sz, 14px);
  height: var(--sz, 14px);
  margin: calc(var(--sz, 14px) / -2) 0 0 calc(var(--sz, 14px) / -2);
  z-index: 9;
  pointer-events: none;
  color: var(--sc, #ffc387);
  opacity: 0;
  will-change: transform, opacity;
  animation: spark-pop var(--dur, 900ms) cubic-bezier(0.22, 0.8, 0.3, 1) forwards;
}
.spark svg { width: 100%; height: 100%; display: block; }

@keyframes spark-pop {
  0% {
    opacity: 0;
    transform: translate3d(var(--tx0), var(--ty0), 0) scale(0.1) rotate(var(--rot0));
  }
  22% { opacity: 1; }
  55% {
    transform: translate3d(var(--tx1), var(--ty1), 0) scale(1) rotate(var(--rot1));
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--tx2), var(--ty2), 0) scale(0.16) rotate(var(--rot2));
  }
}

/* ══════════════════════════════════════════════════════════════════
   MOTION PRIMITIVES
   Every moving part gets its own registered custom property, so a
   single `transform` can be composed from parallax + tilt + hover +
   reveal without any two of them overwriting each other — and each
   part can be transitioned on its own clock.
   ══════════════════════════════════════════════════════════════════ */
@property --px    { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --rz    { syntax: "<angle>";  inherits: false; initial-value: 0deg; }
@property --skew  { syntax: "<angle>";  inherits: true;  initial-value: 0deg; }
@property --ipy   { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --izoom { syntax: "<number>"; inherits: false; initial-value: 1; }
@property --ihov  { syntax: "<number>"; inherits: true;  initial-value: 1; }
@property --tiltx { syntax: "<angle>";  inherits: true;  initial-value: 0deg; }
@property --tilty { syntax: "<angle>";  inherits: true;  initial-value: 0deg; }
@property --lift  { syntax: "<length>"; inherits: true;  initial-value: 0px; }
@property --gla   { syntax: "<number>"; inherits: true;  initial-value: 0; }
@property --dev   { syntax: "<number>"; inherits: true;  initial-value: 1; }
@property --revy  { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --revs  { syntax: "<number>"; inherits: false; initial-value: 1; }
@property --arty  { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --arts  { syntax: "<number>"; inherits: false; initial-value: 1; }
@property --uw    { syntax: "<number>"; inherits: true;  initial-value: 0; }
@property --i     { syntax: "<number>"; inherits: false; initial-value: 0; }

/* ══════════════════════════════════════════════════════════════════
   HERO ATMOSPHERE — aurora wash, vignette, film grain
   ══════════════════════════════════════════════════════════════════ */
.hero-aurora,
.hero-vignette,
.hero-grain {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.hero-aurora {
  background:
    radial-gradient(60% 120% at 18% 20%, rgba(242, 170, 131, 0.4), transparent 60%),
    radial-gradient(52% 110% at 82% 78%, rgba(70, 119, 133, 0.45), transparent 62%),
    radial-gradient(46% 90% at 52% 8%, rgba(255, 217, 168, 0.32), transparent 65%);
  mix-blend-mode: soft-light;
  animation: aurora 22s ease-in-out infinite alternate;
}
@keyframes aurora {
  0%   { transform: translate3d(-3%, -2%, 0) scale(1.06); opacity: 0.75; }
  50%  { opacity: 1; }
  100% { transform: translate3d(3%, 2%, 0) scale(1.16); opacity: 0.8; }
}
.hero-vignette {
  background:
    radial-gradient(120% 100% at 50% 42%, transparent 42%, rgba(8, 10, 14, 0.5) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.22) 0%, transparent 26%, rgba(0, 0, 0, 0.3) 100%);
}
.hero-grain {
  opacity: 0.13;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.1s steps(4) infinite;
}
@keyframes grain {
  0%   { transform: translate3d(0, 0, 0); }
  25%  { transform: translate3d(-3%, 2%, 0); }
  50%  { transform: translate3d(2%, -3%, 0); }
  75%  { transform: translate3d(-2%, -2%, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* ══════════════════════════════════════════════════════════════════
   LAUREL — springs and glints when you point at it
   ══════════════════════════════════════════════════════════════════ */
.laurel { cursor: default; }
.js .laurel.is-in:hover {
  transform: scale(1.24) rotate(9deg);
  filter: drop-shadow(0 0 calc(4 * var(--u)) rgba(255, 199, 128, 0.95)) saturate(1.35);
}
.js .laurel.is-in {
  transition: opacity 0.7s var(--ease-out),
    transform 0.75s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter 0.5s ease;
}

/* ══════════════════════════════════════════════════════════════════
   SPLIT HEADINGS — portfolio.js dices these into words and letters
   ══════════════════════════════════════════════════════════════════ */
.split .wd {
  display: inline-block;
  white-space: nowrap;      /* keeps letter spans from breaking mid-word */
  transform-style: preserve-3d;
}
.split .ch {
  display: inline-block;
  transition: color 0.3s ease;
}

@keyframes ch-wave {
  0%   { transform: none; }
  38%  { transform: translateY(-0.17em) rotate(-4deg); }
  70%  { transform: translateY(0.04em) rotate(1.5deg); }
  100% { transform: none; }
}
@keyframes ch-flip {
  0%   { transform: none; }
  36%  { transform: translateY(-0.09em) rotateX(38deg) scale(1.07); }
  72%  { transform: translateY(0.015em) rotateX(-8deg) scale(0.995); }
  100% { transform: none; }
}

/* Section headings — letters roll through, rule sweeps in beneath */
.title { cursor: default; }
.title::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(-3 * var(--u));
  height: max(1.5px, calc(1.1 * var(--u)));
  border-radius: 999px;
  background: linear-gradient(90deg, var(--link), var(--accent) 62%, transparent);
  transform: scaleX(var(--uw, 0));
  transform-origin: 0 50%;
  transition: transform 0.55s var(--ease-out);
}
.title:hover { --uw: 1; }
.title:hover .ch {
  animation: ch-wave 0.62s var(--ease-out) both;
  animation-delay: calc(var(--i) * 24ms);
}
.title .ch:hover { color: var(--link); }

/* The name — a heavier, perspective flip */
.hero-name { perspective: 700px; cursor: default; }
.hero-name:hover .ch {
  animation: ch-flip 0.8s var(--ease-out) both;
  animation-delay: calc(var(--i) * 32ms);
}
.hero-name .ch:hover { color: var(--accent); }

.the-end { cursor: default; }
.the-end:hover .ch {
  animation: ch-wave 0.7s var(--ease-out) both;
  animation-delay: calc(var(--i) * 40ms);
}
.the-end .ch:hover { color: var(--link); }

/* ══════════════════════════════════════════════════════════════════
   PROSE — pointing at a paragraph brings it forward and dims the rest
   ══════════════════════════════════════════════════════════════════ */
.prose p {
  position: relative;
  transition: opacity 0.45s ease;
}
.prose p::before {
  content: "";
  position: absolute;
  left: calc(-9 * var(--u));
  top: 0.12em;
  bottom: 0.12em;
  width: max(2px, calc(1.7 * var(--u)));
  border-radius: 999px;
  background: linear-gradient(180deg, var(--link), var(--accent));
  transform: scaleY(0);
  transform-origin: 50% 0;
  opacity: 0;
  transition: transform 0.5s var(--ease-out), opacity 0.3s ease;
}
.prose:has(p:hover) p { opacity: 0.42; }
.prose:has(p:hover) p:hover { opacity: 1; }
.prose p:hover::before { transform: scaleY(1); opacity: 1; }

/* Inline emphasis lights up on its own */
.prose b,
.prose i {
  transition: color 0.3s ease, text-shadow 0.3s ease;
}
.prose b:hover {
  color: var(--link);
  text-shadow: 0 0 calc(7 * var(--u)) rgba(70, 119, 133, 0.4);
}
.prose i:hover { color: #3b4149; }

.accent {
  transition: text-shadow 0.35s ease;
}
@supports (-webkit-background-clip: text) or (background-clip: text) {
  .accent:hover {
    background-image: linear-gradient(
      90deg, var(--accent), #e98f5f 25%, #ffe0b5 50%, #e98f5f 75%, var(--accent)
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: accent-sweep 1.6s linear infinite;
  }
}
@keyframes accent-sweep {
  from { background-position: 0 0; }
  to   { background-position: -200% 0; }
}

/* ══════════════════════════════════════════════════════════════════
   HERO COPY — glow and slide on hover
   ══════════════════════════════════════════════════════════════════ */
.hero-loc,
.hero-motto {
  cursor: default;
  transition: transform 0.45s var(--ease-out), text-shadow 0.45s ease;
}
.hero-loc:hover,
.hero-motto:hover {
  transform: translateX(calc(2.5 * var(--u)));
  text-shadow: 0 0 calc(9 * var(--u)) rgba(255, 255, 255, 0.6),
    0 calc(0.3 * var(--u)) calc(1.6 * var(--u)) rgba(0, 0, 0, 0.35);
}
.hero-meta p {
  transition: opacity 0.4s ease, transform 0.45s var(--ease-out), text-shadow 0.4s ease;
}
.hero-meta:has(p:hover) p { opacity: 0.5; }
.hero-meta:has(p:hover) p:hover {
  opacity: 1;
  transform: translateX(calc(3 * var(--u)));
  text-shadow: 0 0 calc(9 * var(--u)) rgba(255, 255, 255, 0.55),
    0 calc(0.3 * var(--u)) calc(1.6 * var(--u)) rgba(0, 0, 0, 0.4);
}

/* ══════════════════════════════════════════════════════════════════
   REFLOW — below ~880px the fixed PDF grid would be unreadable, so
   the same content restacks into a single column.
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 880px) {
  :root { --u: 1px; }

  .sheet { max-width: 680px; padding: 0 0 60px; }

  .chapter {
    height: auto !important;
    position: relative;
    padding: 0 22px 46px;
    overflow: hidden;
  }
  .chapter--hero { padding: 0; overflow: hidden; }
  .chapter--end  { padding-bottom: 30px; }

  /* Engravings become a soft decorative wash behind each section. */
  .art {
    position: absolute;
    left: auto;
    right: -8%;
    top: 34%;
    width: 68%;
    height: auto;
    aspect-ratio: var(--w) / var(--ih);
    opacity: 0.4;
    z-index: 0;
    transform: translate3d(var(--px, 0px), var(--py, 0px), 0) rotate(var(--rz, 0deg));
  }
  .chapter:nth-of-type(even) .art { right: auto; left: -8%; }
  .art img { height: auto; }

  .art--hero {
    position: absolute;
    inset: 0;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 1;
    aspect-ratio: auto;
  }
  .art--hero img { height: 100%; }
  .art-hero-in { height: 100%; }

  .shot {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    height: auto;
    aspect-ratio: var(--w) / var(--ih);
    margin: 0 0 22px;
  }
  .shot-in { border-width: 1px; border-radius: 14px; }

  .title,
  .prose,
  .the-end {
    position: static;
    width: 100%;
  }
  .title {
    white-space: normal;
    font-size: clamp(24px, 6.2vw, 31px);
    margin: 0 0 14px;
    padding-right: 46px;
  }
  .prose { font-size: 16.5px; line-height: 1.5; letter-spacing: -0.006em; }
  .prose p { margin: 0 0 15px; }
  .the-end { font-size: clamp(30px, 8.5vw, 40px); }

  /* The laurel precedes its heading in the DOM, so floating it right
     parks it beside the title exactly as it sits in the PDF. */
  .laurel {
    position: static;
    float: right;
    width: 32px;
    height: 32px;
    margin: 3px 0 6px 12px;
  }

  /* Hero restacks as an overlay band */
  .chapter--hero {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: min(74vh, 460px);
    padding: 0 22px 26px;
  }
  .chapter--hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.34) 100%);
    pointer-events: none;
  }
  .hero-name,
  .hero-loc,
  .hero-motto,
  .hero-meta {
    position: static;
    width: 100%;
  }
  .hero-name { font-size: clamp(46px, 15vw, 82px); margin-bottom: 2px; }
  .hero-loc { font-size: clamp(16px, 4.4vw, 20px); margin-bottom: 8px; }
  .hero-motto { font-size: clamp(14px, 3.8vw, 17px); margin-bottom: 12px; }
  .hero-meta { font-size: clamp(12.5px, 3.4vw, 15px); line-height: 1.42; }
  .hero-meta p + p { margin-top: 1px; }

  .floating-nav { top: auto; bottom: 12px; right: 12px; }
  .floating-nav .pill {
    font-size: 11.5px;
    padding: 6px 11px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  }
}

@media (max-width: 420px) {
  .chapter { padding: 0 16px 38px; }
  .chapter--hero { padding: 0 16px 22px; }
  .prose { font-size: 15.5px; }
}

/* ══════════════════════════════════════════════════════════════════
   Reduced motion / print
   ══════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .shot-in,
  .js .art img,
  .js .laurel,
  .js .title,
  .js .prose,
  .js .the-end,
  .js .reveal,
  .js .art--hero img {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .js .art--hero img { transform: scale(1.38) !important; }
  .floating-nav { animation: none; opacity: 1; transform: none; }
  .shot:hover .sheen { animation: none; }
  .spark { display: none !important; }
}

@media print {
  .floating-nav,
  .scroll-progress,
  .sheen { display: none !important; }
  .art { mix-blend-mode: normal; }
  .js .shot-in,
  .js .art img,
  .js .laurel,
  .js .title,
  .js .prose,
  .js .the-end,
  .js .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ══════════════════════════════════════════════════════════════════
   REFLOW ADDENDA — the new effects, tuned for the single column
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 880px) {
  /* The engraving is a background wash here; a big drift would just
     slide it out from under the clip. JS damps the travel too. */
  .art { opacity: 0.34; }
  .title::after { bottom: -6px; }
  .prose p::before { left: -11px; }
  .hero-grain { opacity: 0.1; }
}

/* Coarse pointers get no tilt/glare — there is no cursor to track. */
@media (hover: none) {
  .shot-in { --tiltx: 0deg !important; --tilty: 0deg !important; }
  .glare { display: none; }
}

/* ══════════════════════════════════════════════════════════════════
   REDUCED MOTION ADDENDA
   ══════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .js .art.is-in:not(.art--hero) img,
  .js .art--hero.is-in img,
  .hero-aurora,
  .hero-grain,
  .title:hover .ch,
  .hero-name:hover .ch,
  .the-end:hover .ch,
  .accent:hover {
    animation: none !important;
  }
  .js .shot-in img,
  .js .art img {
    clip-path: none !important;
  }
  .js .laurel.is-in:hover { transform: none !important; }
  .hero-loc:hover,
  .hero-motto:hover,
  .hero-meta:hover p:hover { transform: none !important; }
  .glare { display: none !important; }
  .shot-in::after { opacity: 0 !important; }
}

@media print {
  .hero-aurora,
  .hero-vignette,
  .hero-grain,
  .glare,
  .shot-in::after,
  .title::after,
  .prose p::before { display: none !important; }
  .js .shot-in img,
  .js .art img { clip-path: none !important; }
}
