/* Self-hosted (Latin subset) so the Figma fonts load even offline */
@font-face {
  font-family: "Unbounded";
  font-weight: 200 900; /* variable: one file, every weight, and weight changes can animate */
  font-display: swap;
  src: url("fonts/unbounded-var.woff2") format("woff2");
}
@font-face {
  font-family: "Instrument Sans";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/instrument-sans-400.woff2") format("woff2");
}
@font-face {
  font-family: "Instrument Sans";
  font-weight: 700;
  font-display: swap;
  src: url("fonts/instrument-sans-700.woff2") format("woff2");
}

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

:root {
  --ink: #000;
  --accent: #0f52ba; /* sapphire: text highlight */
  --fade: clamp(64px, 14vh, 150px); /* height of the blurred bands at the top and bottom of the screen */
  /* real damped springs (mass 1) sampled into easing curves; each animation runs the spring's full settle time */
  --spring-pop: linear(0, 0.073, 0.247, 0.467, 0.686, 0.881, 1.031, 1.13, 1.18, 1.191, 1.173, 1.137, 1.094, 1.052, 1.017, 0.99, 0.973, 0.965, 0.964, 0.968, 0.975, 0.983, 0.991, 0.998, 1.003, 1.006, 1.007, 1.007, 1.006, 1.004, 1.003, 1.001, 1, 0.999, 0.999, 0.999, 0.999, 0.999, 0.999, 1, 1); /* stiffness 260, damping 15: bouncy, settles in 1000ms */
  --spring-rise: linear(0, 0.023, 0.081, 0.161, 0.255, 0.351, 0.449, 0.539, 0.625, 0.7, 0.768, 0.824, 0.872, 0.911, 0.943, 0.967, 0.986, 1, 1.01, 1.017, 1.021, 1.022, 1.023, 1.022, 1.021, 1.019, 1.017, 1.014, 1.012, 1.01, 1.008, 1.007, 1.005, 1.004, 1.003, 1.002, 1.001, 1.001, 1, 1, 1); /* stiffness 170, damping 20: small overshoot, settles in 690ms */
  --spring-snap: linear(0, 0.021, 0.073, 0.146, 0.231, 0.321, 0.411, 0.498, 0.578, 0.652, 0.717, 0.775, 0.824, 0.866, 0.901, 0.929, 0.952, 0.97, 0.984, 0.994, 1.002, 1.007, 1.011, 1.013, 1.014, 1.014, 1.014, 1.013, 1.012, 1.01, 1.009, 1.008, 1.007, 1.006, 1.005, 1.004, 1.003, 1.002, 1.002, 1.001, 1); /* stiffness 500, damping 36: quick, a hint of overshoot, settles in 384ms (presses, small UI) */
  --spring-smooth: linear(0, 0.023, 0.079, 0.153, 0.236, 0.321, 0.403, 0.48, 0.551, 0.614, 0.671, 0.72, 0.764, 0.801, 0.833, 0.86, 0.883, 0.903, 0.919, 0.933, 0.944, 0.954, 0.962, 0.969, 0.974, 0.979, 0.983, 0.986, 0.988, 0.99, 0.992, 0.994, 0.995, 0.996, 0.997, 0.997, 0.998, 0.998, 0.998, 0.999, 1); /* stiffness 400, damping 40: critically damped, no overshoot, settles in 462ms (colour, opacity: an overshoot there reads as a flicker) */
}

/* nothing on the page can be highlighted or dragged (script.js also blocks drag starts) */
html { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }

body {
  background: #fff;
  color: #000;
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
}


img { display: block; max-width: 100%; -webkit-user-drag: none; }

/* ---------- Hero: sizes scale from the 1440px Figma frame ---------- */
.hero {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  text-align: center;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- Avatar ---------- */
.avatar {
  width: max(160px, min(35.5vw, 46svh, 512px));
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  animation: pop 1000ms var(--spring-pop) both;
  transition: scale 1000ms var(--spring-pop), rotate 1000ms var(--spring-pop);
}
/* the smiley wobbles when you point at it and squishes when pressed, springing back on release */
@media (hover: hover) { .avatar:hover, .contact-avatar:hover { scale: 1.05; rotate: -8deg; } }
.avatar:active, .contact-avatar:active { scale: 0.9; rotate: 6deg; transition-duration: 384ms; transition-timing-function: var(--spring-snap); }

.name {
  font-family: "Unbounded", "Arial Black", sans-serif;
  font-weight: 700;
  font-size: clamp(2.25rem, 10.4vw, 150px);
  line-height: 1.2;
  overflow-wrap: anywhere;
  animation: rise 690ms var(--spring-rise) 250ms both;
}

.tagline {
  font-size: clamp(1rem, 2.46vw, 35.4px);
  animation: rise 690ms var(--spring-rise) 350ms both;
}

/* name + contact title hover (script.js): each letter carries a gradient copy of itself on top, faded in by --g */
.name .ch, .contact-title .ch { display: inline-block; position: relative; transform-origin: 50% 100%; }
.name .ch::after, .contact-title .ch::after {
  content: attr(data-ch);
  position: absolute;
  /* grown past the letter box (padding keeps the text in place) so descenders like y and p and
     overhangs get the gradient too; otherwise the black letter underneath shows through there */
  inset: -0.25em -0.25em -0.4em;
  padding: 0.25em 0.25em 0.4em;
  background: linear-gradient(180deg, var(--grad, #ffb6f2, #0f52ba)); /* --grad: the hover look picked in script.js */
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: var(--g, 0);
  pointer-events: none;
}

/* ---------- Interests: photos down both sides, the list stays centred while they scroll past ---------- */
.interests {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: clamp(0.5rem, 4vw, 4rem);
  overflow-x: clip; /* mobile photos hang off the screen edges */
}

.interests-inner {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.interests h2 {
  font-family: "Unbounded", "Arial Black", sans-serif;
  font-weight: 700;
  font-size: clamp(1.125rem, 2.2vw, 2.25rem);
  margin-bottom: 0.75rem;
  white-space: nowrap;
}

.interests ul {
  padding: 0;
  list-style: none;
  text-align: center;
  font-size: clamp(1rem, 1.4vw, 1.5rem);
  line-height: 1.7;
}

/* Desktop: photos scattered in three lanes per side on a gently curved wall. Positions and
   the section height (--h) are in vw, so the scatter keeps its spacing at any screen size. */
.interests { height: var(--h); padding: 0; }
.side { grid-row: 1; position: relative; }
.side-left { grid-column: 1; }
.side-right { grid-column: 3; }

.side img {
  position: absolute;
  top: var(--t);
  width: var(--w);
  height: auto; /* whole photo, no cropping */
}
/* Per lane: --o offset from the outer edge (outer lane stays fully on screen), --ry tilt toward
   the list, --ax how far the lane sits from the screen centre (0 centre, 1 edge). */
.side .outer { --o: 6%;  --ry: 24deg; --ax: 0.86; }
.side .mid   { --o: 37%; --ry: 10deg; --ax: 0.62; }
.side .inner { --o: 70%; --ry: 3deg;  --ax: 0.36; }
.side-left img  { left: var(--o);  --dir: 1; }
.side-right img { right: var(--o); --dir: -1; }

/* Pincushion lens: --p is where the photo is on screen (1 bottom, 0 middle, -1 top), set by
   script.js, which follows the scroll with a spring. --r2 is its squared distance from the screen centre; the further out, the more
   it is magnified and pushed away from the centre, and the edge nearest the corner is pulled
   toward you (keystone), like the grid in a pincushion distortion. */
@property --p { syntax: "<number>"; inherits: false; initial-value: 0; }
.side img {
  --r2: calc(var(--ax) * var(--ax) + var(--p) * var(--p) * 0.7);
  transform:
    perspective(var(--persp, 900px))
    translate(var(--bx, 0%), calc(var(--p) * var(--r2) * 4vh))
    rotateY(calc(var(--ry) * var(--dir)))
    rotateX(calc(var(--p) * 14deg))
    scale(calc(1 + var(--r2) * 0.15));
}
/* typewriter (script.js): letters start transparent and switch on one by one behind a moving caret */
.tw { position: relative; opacity: 0; }
.tw.on { opacity: 1; }
/* the caret is one element that script.js moves after the last typed letter */
.tw-caret {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  background: currentColor;
  visibility: hidden;
  pointer-events: none;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* narrow screens: one stack per side, squeezed against the edges and tilted toward the list */
@media (max-width: 800px) {
  .interests { height: auto; padding: 4rem 0; }
  .side img { position: static; width: 100%; margin-bottom: 2.5rem; }
  .side img:nth-child(3n) { width: 82%; }
  .side-right img:nth-child(3n) { margin-left: auto; }
  .interests .side img { --persp: 600px; --ry: 18deg; --ax: 0.7; }
  .interests .side-left img { --bx: -24%; }
  .interests .side-right img { --bx: 24%; }
}

/* ---------- Work: GitHub projects. Left column: the names (the one being viewed is bold), and the
   description under them; the big preview fills the right, as tall as both, like the wireframe ---------- */
.work {
  min-height: 100svh;
  display: grid;
  align-content: center;
  padding: clamp(4rem, 12vh, 8rem) clamp(1rem, 10vw, 12rem);
}
.work-inner { display: grid; }
/* its own box, so its height comes from the preview (not the pinned screen) and the description row
   ends exactly where the preview does */
.work-grid {
  display: grid;
  /* wide enough for the longest name in bold on one line ("Game Jam 2026" is ~10em at the tab size) */
  grid-template-columns: max(15rem, calc(clamp(1.4rem, 2.1vw, 2.2rem) * 10.25)) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: clamp(1.25rem, 2.6vw, 3rem) clamp(1rem, 2.4vw, 2.75rem);
}
/* scroll mode (set by script.js when motion is on): the section is one screen tall per project,
   the content stays pinned, and each stretch of scroll shows the next project. The pinned screen is
   padded by the edge-fade height so nothing sits under the blurred top and bottom bands. */
.work.work--scroll { height: calc(100svh + (var(--n) - 1) * 70svh); min-height: 0; padding-block: 0; align-content: start; }
.work--scroll .work-inner { position: sticky; top: 0; height: 100svh; padding-block: var(--fade); align-content: center; }
.work-tabs { grid-area: 1 / 1; position: relative; z-index: 3; display: flex; flex-direction: column; gap: 0; align-self: start; } /* above the swapping panels */
.work-tab {
  position: relative;
  width: fit-content;
  padding: 0.2em 0;
  border: 0;
  background: none;
  color: rgb(0 0 0 / 0.55); /* #737373 on white: 4.7:1, readable while still clearly secondary */
  font-family: "Unbounded", "Arial Black", sans-serif;
  font-weight: 400;
  font-size: clamp(1.4rem, 2.1vw, 2.2rem);
  letter-spacing: -0.01em;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: color 462ms var(--spring-smooth), font-weight 690ms var(--spring-rise), translate 1000ms var(--spring-pop), scale 384ms var(--spring-snap);
}
@media (hover: hover) { .work-tab:hover { color: #000; translate: 0.25em 0; } } /* nudges toward its project */
.work-tab:active { scale: 0.96; }
.work-tab[aria-selected="true"] { color: #000; font-weight: 700; }
.work-tab:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* every panel covers the whole layout on a subgrid (so its description lines up under the names and its
   preview spans the right) and they all share it, so the outgoing project can animate out under the incoming one */
.work-panel { grid-column: 1 / -1; grid-row: 1 / -1; display: grid; grid-template-columns: subgrid; grid-template-rows: subgrid; }
.work-about { grid-column: 1; grid-row: 2; }
.work-preview { grid-column: 2; grid-row: 1 / -1; align-self: start; justify-self: end; } /* flush right, so the side margins match */
/* pinned: never taller than the space between the blur bands; the width shrinks with it to keep 16:10 */
.work--scroll .work-preview { width: min(100%, calc((100svh - 2 * var(--fade)) * 1.6)); }
.work-panel[hidden] { display: none; }
.work-about {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: clamp(1.1rem, 1.35vw, 1.4rem);
  line-height: 1.45;
}
.work-about > p:first-child { font-size: 0.82em; line-height: 1.5; } /* the description; links stay their size */
.work-tag { color: rgb(0 0 0 / 0.55); font-size: 0.72em; }
.work-links { margin-top: auto; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
/* no underline at rest; hovering draws one in from the left, leaving retracts it to the right.
   It's a background line (not text-decoration) so its width can animate. */
.work-links a {
  padding-bottom: 0.15em;
  color: #000;
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) no-repeat right bottom / 0% 1.5px;
  transition: color 462ms var(--spring-smooth), background-size 690ms var(--spring-rise);
}
@media (hover: hover) and (pointer: fine) { .work-links a:hover { color: var(--accent); background-position: left bottom; background-size: 100% 1.5px; } } /* taps would leave it stuck on */
.work-links a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.work-preview {
  margin: 0;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #f2f2f2;
}
.work-preview video, .work-preview img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.work-preview video { cursor: pointer; } /* click or tap the video to pause or resume it */

/* narrow screens: names become a swipeable row, then the preview, then the description */
@media (max-width: 800px) {
  .work { min-height: 0; padding: 4rem 1rem; }
  :root { --fade: clamp(48px, 8vh, 72px); } /* slimmer blur bands leave phones more room */
  .work-grid, .work-panel { grid-template-columns: 1fr; }
  /* the swipeable name row is a scroll box, which a grid will happily squash to 0px when space runs
     short (letting the preview slide over the names); max-content keeps its full height */
  .work-grid { grid-template-rows: max-content; }
  /* short screens: the preview gives up height so names, preview and description all fit between the
     blur bands (17rem covers the names, gaps and a four-line description) */
  .work--scroll .work-preview { max-height: max(10rem, calc(100svh - 2 * var(--fade) - 17rem)); }
  .work-tabs { flex-direction: row; gap: 1.25rem; overflow-x: auto; scrollbar-width: none; }
  /* the row bleeds to the screen edges and fades out there, instead of names being sliced at the padding */
  .work-tabs {
    margin-inline: -1rem;
    padding-inline: 1rem;
    mask-image: linear-gradient(to right, transparent, #000 2rem, #000 calc(100% - 2rem), transparent);
  }
  .work-tab { flex: none; white-space: nowrap; font-size: 1.15rem; } /* phones keep the old size: the pinned layout budgets for it */
  .work-panel { grid-area: 2 / 1; grid-template-rows: none; }
  .work-about, .work-preview { grid-column: auto; grid-row: auto; justify-self: normal; }
  .work-preview { order: -1; }
}

/* ---------- Tech stack: by default a grid of brand-coloured badges (.tool-fill is a filled copy of each
   name laid over it). With motion on, script.js adds .stack--reel and the same list becomes a 3D drum of
   giant names that rolls as you scroll; the name in the middle lights up in its brand colour. ---------- */
.stack { padding: var(--fade) clamp(1rem, 6vw, 6rem); }
.stack-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(2rem, 6vh, 3.5rem);
}
.stack-head { text-align: center; }
.stack h2 {
  font-family: "Unbounded", "Arial Black", sans-serif;
  font-weight: 700;
  font-size: clamp(1.125rem, 2.2vw, 2.25rem);
  margin-bottom: 0.4rem;
}
.stack-head p { color: rgb(0 0 0 / 0.55); font-size: clamp(1rem, 1.4vw, 1.5rem); }
.stack-now { display: none; }

.stack-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(0.4rem, 0.8vw, 0.75rem);
  max-width: 80rem;
  padding: 0;
  list-style: none;
}
.tool {
  position: relative;
  padding: 0.65em 1em;
  border-radius: 0.4em;
  font-family: "Unbounded", "Arial Black", sans-serif;
  font-weight: 700;
  font-size: clamp(0.95rem, min(2.3vw, 3.8svh), 2.3rem); /* height-capped so all 19 fit short screens */
  line-height: 1;
  white-space: nowrap;
}
.tool-fill {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: var(--bg);
  color: var(--fg);
}

/* reel mode: heading and live readout on the left (like the project names in Work), the drum on the right */
.stack.stack--reel { height: calc(100svh + var(--n) * 14svh); padding: 0 clamp(1rem, 10vw, 12rem); }
.stack--reel .stack-inner {
  position: sticky;
  top: 0;
  height: 100svh;
  display: grid;
  grid-template-columns: minmax(13rem, 0.3fr) 1fr;
  align-items: center;
  gap: clamp(1rem, 3vw, 3rem);
}
.stack--reel .stack-head { text-align: left; }
.stack--reel .stack-now {
  display: grid;
  gap: 0.35rem;
  margin-top: clamp(1.5rem, 5vh, 3rem);
  color: #000;
  white-space: nowrap;
}
.stack-index { font-family: "Unbounded", "Arial Black", sans-serif; font-weight: 700; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
/* rolling counter (script.js): each digit is a 0-9 strip behind a one-digit window */
.stack-index .digit { display: inline-block; height: 1.15em; overflow: hidden; vertical-align: bottom; }
.stack-index .strip { display: flex; flex-direction: column; line-height: 1.15; }
.stack-index::after { content: " / 19"; font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif; font-weight: 400; color: rgb(0 0 0 / 0.55); }
/* the role rolls in and out of this window, on its own row under the number */
.stack-role-clip { overflow: hidden; padding-block: 0.1em; font-size: clamp(1.15rem, 1.6vw, 1.6rem); }
.stack-role { display: inline-block; }

.stack--reel .stack-stage {
  position: relative;
  align-self: stretch;
  perspective: 1100px;
  /* names fade out as they roll away from the middle, and never cut hard at the edge of the stage */
  mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
}
.stack--reel .stack-tools { display: block; position: absolute; inset: 0; max-width: none; }
.stack--reel .tool {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 0.06em 0.28em;
  border-radius: 0.16em;
  color: #000;
  font-size: clamp(2.5rem, min(6.6vw, 12svh), 8rem);
  letter-spacing: -0.02em;
  backface-visibility: hidden;
  cursor: pointer; /* clicking a name rolls the reel to it */
  will-change: transform;
}

/* ---------- Contact: bookends the hero (the smiley comes back), then email and links ---------- */
.contact {
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: var(--fade) clamp(1rem, 6vw, 6rem) 0;
  text-align: center;
}
.contact-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 2.5vh, 1.75rem);
  padding-top: clamp(2rem, 10vh, 6rem); /* keeps the smiley clear of the top blur band */
}
.contact-avatar { width: clamp(80px, 10vw, 144px); height: auto; aspect-ratio: 1; border-radius: 50%; transition: scale 1000ms var(--spring-pop), rotate 1000ms var(--spring-pop); }
.contact-title {
  font-family: "Unbounded", "Arial Black", sans-serif;
  font-weight: 700;
  font-size: clamp(3rem, 11vw, 160px);
  line-height: 1.05;
}
.contact-lead { max-width: 34ch; font-size: clamp(1.05rem, 1.5vw, 1.4rem); line-height: 1.45; color: rgb(0 0 0 / 0.7); }

.contact-mail { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.75rem 1rem; margin-top: 0.5rem; }
.contact-mail a, .contact-links a, .to-top {
  color: #000;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) no-repeat right bottom / 0% 1.5px;
  padding-bottom: 0.1em;
  transition: color 462ms var(--spring-smooth), background-size 690ms var(--spring-rise);
}
.contact-mail a {
  font-family: "Unbounded", "Arial Black", sans-serif;
  font-weight: 700;
  font-size: clamp(1.05rem, 2.6vw, 2.25rem);
  overflow-wrap: anywhere;
  background-size: 0% 2px;
}
.copy {
  display: inline-grid;
  height: 2.5rem;
  padding: 0 1.1rem;
  border: 2px solid #000;
  border-radius: 999px;
  background: #fff;
  color: #000;
  font: 700 0.95rem/1 "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  cursor: pointer;
  overflow: hidden;
  transition: background-color 462ms var(--spring-smooth), border-color 462ms var(--spring-smooth), color 462ms var(--spring-smooth), scale 1000ms var(--spring-pop);
}
.copy:active { scale: 0.92; transition-duration: 384ms; transition-timing-function: var(--spring-snap); } /* pressed fast, released with a boing */
/* "Copy" and "Copied" share one cell; the label rolls up on success */
.copy-label { display: grid; place-items: center; }
.copy-label > span {
  grid-area: 1 / 1;
  transition: translate 1000ms var(--spring-pop), opacity 462ms var(--spring-smooth); /* the label bounces into place */
}
.copy-label > span:last-child { translate: 0 110%; opacity: 0; }
.copy.copied, .copy.copied:hover { background: #15803d; border-color: #15803d; color: #fff; } /* success green, white text 5:1 */
.copy.copied .copy-label > span:first-child { translate: 0 -110%; opacity: 0; }
.copy.copied .copy-label > span:last-child { translate: 0 0; opacity: 1; }

.contact-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 2rem; padding: 0; list-style: none; font-size: clamp(1rem, 1.3vw, 1.25rem); }
.contact-links a { display: inline-flex; align-items: center; gap: 0.5em; min-height: 44px; }
.contact-links svg { width: 1.2em; height: 1.2em; transition: scale 1000ms var(--spring-pop), rotate 1000ms var(--spring-pop); }

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 2rem 0 calc(var(--fade) * 0.6);
  color: rgb(0 0 0 / 0.55);
  font-size: 0.95rem;
}
.to-top { color: rgb(0 0 0 / 0.55); }

@media (hover: hover) and (pointer: fine) {
  .copy:hover { background: #000; color: #fff; }
  .contact-mail a:hover, .contact-links a:hover, .to-top:hover { color: var(--accent); background-position: left bottom; background-size: 100% 1.5px; }
  .contact-mail a:hover { background-size: 100% 2px; }
  .contact-links a:hover svg { scale: 1.2; rotate: -12deg; } /* the icon hops as you point at it */
}
.contact a:focus-visible, .copy:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@media (max-width: 800px) {
  .footer { justify-content: center; }
  .tool { font-size: 0.9rem; }
  /* phones: heading and readout on top, the drum fills the rest of the screen */
  .stack.stack--reel { height: calc(100svh + var(--n) * 10svh); padding-inline: 1rem; }
  .stack--reel .stack-inner { grid-template-columns: 1fr; grid-template-rows: auto 1fr; padding-top: calc(var(--fade) + 0.5rem); padding-bottom: var(--fade); }
  .stack--reel .stack-head { text-align: center; }
  .stack--reel .stack-now { justify-items: center; margin-top: 1rem; }
  .stack--reel .tool { font-size: min(11vw, 8svh); }
}

/* ---------- Phones: bigger hero smiley, 16px body text, 44px tap targets, notch-safe menu button ---------- */
@media (max-width: 800px) {
  .avatar { width: min(56vw, 40svh); }
  .work-tab { min-height: 44px; }
  .work-about > p:first-child { font-size: 1rem; }
  .work-tag { font-size: 0.85rem; }
  .work-links a, .contact-mail a { display: inline-flex; align-items: center; min-height: 44px; }
  .copy { height: 44px; padding-inline: 1.4rem; }
  .stack--reel .tool { font-size: min(13vw, 8svh); }
  .menu-open { top: max(0.75rem, env(safe-area-inset-top)); left: max(0.75rem, env(safe-area-inset-left)); }
}

/* ---------- Soft blurred fade at the top and bottom of the screen ----------
   Progressive blur: six stacked layers, each blurring a little more and masked to an overlapping
   band, so the blur ramps up smoothly toward the screen edge instead of crossfading one blur. */
.edge-fade {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 10;
  height: var(--fade);
  pointer-events: none;
}
.edge-top { top: 0; --to: to top; }
.edge-bottom { bottom: 0; --to: to bottom; transition: opacity 462ms var(--spring-smooth); }
.edge-bottom.gone { opacity: 0; }
.edge-fade i {
  position: absolute;
  inset: 0;
  --s: 14.2857%; /* 100% / 7 bands */
  backdrop-filter: blur(var(--b));
  mask-image: linear-gradient(var(--to),
    transparent calc(var(--k) * var(--s)),
    #000 calc((var(--k) + 1) * var(--s)),
    #000 calc((var(--k) + 2) * var(--s)),
    transparent calc((var(--k) + 3) * var(--s)));
}
.edge-fade i:nth-child(1) { --k: 0; --b: 0.5px; }
.edge-fade i:nth-child(2) { --k: 1; --b: 1px; }
.edge-fade i:nth-child(3) { --k: 2; --b: 2px; }
.edge-fade i:nth-child(4) { --k: 3; --b: 4px; }
.edge-fade i:nth-child(5) { --k: 4; --b: 7px; }
.edge-fade i:nth-child(6) { --k: 5; --b: 11px; }
/* white wash on top, eased so there's no visible line where it ends */
.edge-fade::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(var(--to),
    rgb(255 255 255 / 0) 0%, rgb(255 255 255 / 0.013) 8.1%, rgb(255 255 255 / 0.049) 15.5%,
    rgb(255 255 255 / 0.104) 22.5%, rgb(255 255 255 / 0.175) 29%, rgb(255 255 255 / 0.259) 35.3%,
    rgb(255 255 255 / 0.352) 41.2%, rgb(255 255 255 / 0.45) 47.1%, rgb(255 255 255 / 0.55) 52.9%,
    rgb(255 255 255 / 0.648) 58.8%, rgb(255 255 255 / 0.741) 64.7%, rgb(255 255 255 / 0.825) 71%,
    rgb(255 255 255 / 0.896) 77.5%, rgb(255 255 255 / 0.951) 84.5%, rgb(255 255 255 / 0.987) 91.9%, #fff 100%);
}

/* no visible scrollbar; the page still scrolls by wheel, touch and keys */
html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }

/* ---------- Phone menu: a button top-left opens a drawer from the left (script.js animates it) ---------- */
.menu-open, .menu-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: #000;
  cursor: pointer;
  transition: scale 1000ms var(--spring-pop);
}
.menu-open:active, .menu-close:active { scale: 0.85; transition-duration: 384ms; transition-timing-function: var(--spring-snap); }
.menu-open svg, .menu-close svg { width: 24px; height: 24px; stroke-width: 2; }
.menu-open { position: fixed; top: 0.75rem; left: 0.75rem; z-index: 11; } /* above the edge fades */
.menu-open:focus-visible, .menu-close:focus-visible, .sidebar a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (min-width: 801px) { .menu-open { display: none; } }

.sidebar {
  inset: 0 auto 0 0; /* pinned to the left edge, full height */
  width: min(82vw, 340px);
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0.75rem 1.5rem 2rem;
  border: 0;
  background: #fff;
  color: #000;
}
.sidebar::backdrop { background: rgb(0 0 0 / 0.35); transition: opacity 462ms var(--spring-smooth); }
.sidebar.closing::backdrop { opacity: 0; }
@starting-style { .sidebar[open]::backdrop { opacity: 0; } }
html:has(.sidebar[open]) { overflow: hidden; }
.menu-close { margin-left: -0.75rem; } /* lines up with the menu button it replaces */
.sidebar ul { list-style: none; padding: 0; }
.sidebar nav > ul { display: grid; gap: 1.75rem; margin-top: 1.5rem; }
.sidebar a { color: inherit; text-decoration: none; }
.nav-section { font-family: "Unbounded", "Arial Black", sans-serif; font-weight: 700; font-size: 1.4rem; }
.sidebar .nav-projects { display: grid; gap: 0.25rem; margin-top: 0.75rem; padding-left: 1rem; border-left: 2px solid rgb(0 0 0 / 0.12); }
.nav-projects a { display: block; padding: 0.4rem 0; font-size: 1.15rem; color: rgb(0 0 0 / 0.7); }
.nav-projects a { transition: color 462ms var(--spring-smooth); }
.nav-projects a:hover, .nav-projects a[aria-current="true"] { color: #000; }
.nav-projects a[aria-current="true"] { font-weight: 700; }

/* ---------- Animated icons (Hugeicons stroke set, animate-ui style): each part moves on hover or tap ---------- */
.hi path { transform-box: fill-box; transform-origin: center; }
.hi-tail { stroke-dasharray: 10; stroke-dashoffset: 0; }
.hi-menu path:first-child { transform-origin: left center; }
.hi-menu path:last-child { transform-origin: right center; }
@media (hover: hover) and (pointer: fine) {
  a:hover > .hi-github .hi-tail { animation: hi-draw 690ms var(--spring-rise); }
  a:hover > .hi-instagram .hi-lens { animation: hi-zoom 1000ms var(--spring-pop); }
  a:hover > .hi-instagram .hi-dot { animation: hi-blink 690ms var(--spring-rise) 120ms; }
  .menu-open:hover .hi-menu path { animation: hi-squeeze 1000ms var(--spring-pop); }
  .menu-open:hover .hi-menu path:nth-child(2) { animation-delay: 60ms; }
  .menu-open:hover .hi-menu path:nth-child(3) { animation-delay: 120ms; }
  .menu-close:hover .hi-cancel { rotate: 90deg; }
}
/* touch: the same moves play on press */
a:active > .hi-github .hi-tail { animation: hi-draw 690ms var(--spring-rise); }
a:active > .hi-instagram .hi-lens { animation: hi-zoom 1000ms var(--spring-pop); }
.menu-open:active .hi-menu path { animation: hi-squeeze 1000ms var(--spring-pop); }
.hi-cancel { transition: rotate 1000ms var(--spring-pop); }
.menu-close:active .hi-cancel { rotate: 90deg; }
@keyframes hi-draw { from { stroke-dashoffset: 10; } }
@keyframes hi-zoom { 40% { scale: 1.35; } }
@keyframes hi-blink { 50% { scale: 0; } }
@keyframes hi-squeeze { 40% { scale: 0.55 1; } }

@keyframes pop { from { transform: scale(0.5); opacity: 0; } } /* never from nothing: half size, faded */
@keyframes rise { from { opacity: 0; transform: translateY(30%); } }

