/* ============ Tokens ============ */
:root {
  --bg: #070707;
  --bg-band: #0a0a0a;
  --surface: #0e0e0e;
  --border: #1c1c1c;
  --border-strong: #2a2a2a;
  --text: #f3f1ee;
  --muted: #9a9a9a;
  --dim: #6a6a6a;
  --orange: #f5a524;
  --teal: #2dd4bf;
  --blue: #60a5fa;
  --violet: #a78bfa;
  /* Chrome: slanted reflections with deliberately uneven spacing and strength
     (one wide bright face, one sharp dark slant, a soft mid highlight, a shallow
     late dip) so nothing reads as a repeating stripe. A faint top-to-bottom wash
     on top adds depth without a hard horizon line. */
  --chrome: linear-gradient(180deg, rgba(255, 255, 255, .22) 0%, transparent 45%, rgba(0, 0, 0, .05) 100%),
            linear-gradient(104deg, #a4a7ad 0%, #e6e8eb 7%, #fafbfc 17%, #d4d7db 29%, #8f9399 36%, #b3b6bb 42%,
                                    #edeff1 58%, #f6f7f8 64%, #c9ccd0 79%, #b2b5ba 86%, #dfe1e4 100%);
  /* Hover light sweep: a bright band on a layer 2.5x the pill's width, slid
     across with background-position (see .pill--grad). */
  --sweep: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .85) 49%, rgba(255, 255, 255, .95) 50%, transparent 60%);
  /* SY logo: same idea as text */
  --chrome-text: linear-gradient(180deg, #ffffff 0%, #d7dade 40%, #7f848b 52%, #c3c6cb 66%, #f4f5f7 100%);
  /* The progress bar is only 2px tall, so its chrome runs sideways. */
  --grad: linear-gradient(90deg, #8f9399 0%, #f1f2f4 35%, #a9adb3 60%, #eceef1 100%);
  --line-rgb: 255, 255, 255;   /* hero line colour, read by js/hero.js */
  --line-alpha: 0.2;     /* dense lines -> fainter each */
  --orb-follow-fade: 0.5;  /* hero orb opacity while following the cursor */

  --term-bg: #0b0b0b;
  --term-text: #e8e6e3;
  --term-h: min(48vh, 420px);

  --serif: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --pad: clamp(1.25rem, 4vw, 4.5rem);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --orb-follow-fade: 0.9;
  --bg: #f3f1ec;
  --bg-band: #ebe8e2;
  --surface: #faf9f6;
  --border: #dedad2;
  --border-strong: #c9c4ba;
  --text: #121212;
  --muted: #555;
  --dim: #7a7a7a;
  --orange: #c77700;
  --chrome-text: linear-gradient(180deg, #5d6168 0%, #2a2c30 45%, #0e0f11 52%, #3b3e43 70%, #6d7178 100%);
  --teal: #0f8f80;
  --blue: #2563eb;
  --violet: #7c3aed;
  --line-rgb: 18, 18, 18;
  --line-alpha: 0.16;
  color-scheme: light;
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
/* Sections focused by js/scroll.js after a link click: no focus ring on the whole section. */
main [tabindex="-1"]:focus, footer[tabindex="-1"]:focus { outline: none; }
/* html carries the page colour too, so iOS Safari tints its bars to match */
html { background: var(--bg); }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body.term-open { padding-bottom: var(--term-h); }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 400; }
p { margin: 0 0 1em; }
ul, ol { list-style: none; margin: 0; padding: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.label {
  font-family: var(--mono); font-size: .68rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .16em; color: var(--muted);
}
kbd {
  font-family: var(--mono); font-size: .95em; padding: 0 .35em;
  border: 1px solid var(--border-strong); border-radius: 4px; color: var(--text);
}
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 4px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 1rem; top: -3rem; z-index: 100;
  background: var(--text); color: var(--bg); padding: .5rem 1rem; border-radius: 999px;
}
.skip-link:focus { top: 1rem; }
.container { width: 100%; max-width: 1840px; margin-inline: auto; padding-inline: var(--pad); }

.display {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 400;
  line-height: .98;
  letter-spacing: -.02em;
  font-size: clamp(2.8rem, 6.4vw, 6.2rem);
}

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: .4em;
  padding: .95rem 1.6rem; border-radius: 999px;
  border: 1px solid var(--text);
  font: 600 .74rem var(--sans); letter-spacing: .08em; text-transform: uppercase;
  color: var(--text); text-decoration: none; background: transparent;
}
.pill:hover { background: var(--text); color: var(--bg); }
.pill--sm { padding: .5rem 1rem; font-size: .66rem; }
.pill--grad, .pill--grad:hover {
  /* The sweep is painted as part of the pill's own background (not a child
     layer), so it can never show outside the rounded edge, however fast you
     hover in and out. At rest (position 100%) the band sits just off the left edge. */
  background: var(--sweep) 100% 0 / 250% 100% no-repeat, var(--chrome);
  color: #0a0a0a; border-color: transparent;
  /* top-edge sheen + soft rim so the metal reads as rounded */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), inset 0 -1px 0 rgba(0, 0, 0, .2), 0 0 0 1px rgba(0, 0, 0, .14);
}
/* Hover (mouse/trackpad only): the band glides left to right once and ends off
   the right edge (position 0%). On mouse-out it snaps back unseen. The
   transition is set with the CTA rules below. */
@media (hover: hover) and (pointer: fine) {
  .pill--grad:hover { background-position: 0% 0, 0 0; }
}

/* ============ Nav ============ */
.nav {
  --nav-h: 72px;
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  height: var(--nav-h); padding-inline: var(--pad);
}
/* Fade mask (progressive blur), like the reference: no solid bar. Content scrolling
   up under the nav stays visible but gets blurrier and darker toward the top edge.
   Two layers behind the nav links blur whatever is behind them (backdrop-filter);
   mask-image fades each layer out downward, so the blur dissolves to nothing
   ~60px below the nav instead of ending at a hard edge.
   ::before = light blur + soft tint, reaching furthest down
   ::after  = heavier blur, only near the very top                              */
.nav::before, .nav::after, .pnav::before, .pnav::after {
  content: ""; position: absolute; inset: 0 0 -64px 0; z-index: -1; pointer-events: none;
  transition: opacity .3s ease;
}
.nav::before, .pnav::before {
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--bg) 72%, transparent) 0%,
    color-mix(in srgb, var(--bg) 40%, transparent) 55%,
    transparent 100%);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 35%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, #000 35%, transparent 100%);
}
.nav::after, .pnav::after {
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 55%);
          mask-image: linear-gradient(to bottom, #000 0%, transparent 55%);
}
/* At the very top of the home page (set by js/hero.js) there's nothing under the
   nav yet, so the effect is off and the hero lines run up to the top on their own. */
.nav--clear::before, .nav--clear::after { opacity: 0; }
.nav__logo {
  justify-self: start;
  font: 700 1.3rem var(--sans); letter-spacing: -.04em; text-decoration: none; color: var(--text);
  /* chrome lettering (gunmetal in the light theme) */
  background: var(--chrome-text); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nav__links { display: flex; gap: 2.2rem; }
.nav__links a {
  font: 500 .72rem var(--sans); letter-spacing: .14em; text-transform: uppercase;
  text-decoration: none; color: var(--muted);
}
.nav__links a:hover { color: var(--text); }
.nav__actions { justify-self: end; display: flex; align-items: center; gap: .5rem; }
.icon-btn {
  display: inline-grid; place-items: center; min-width: 36px; height: 36px; padding: 0 .45rem;
  border: 0; border-radius: 999px; background: transparent; color: var(--text);
  font: 500 .8rem var(--mono); cursor: pointer;
}
.icon-btn:hover { background: var(--border); }
.icon-btn--term span[aria-hidden] {   /* chrome >_ (gunmetal in the light theme) */
  background: var(--chrome-text); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.icon-btn--term[aria-expanded="true"] { background: var(--chrome); }
.icon-btn--term[aria-expanded="true"] span[aria-hidden] { background: none; -webkit-text-fill-color: #0a0a0a; }

@media (max-width: 760px) {
  .nav { --nav-h: 60px; grid-template-columns: auto 1fr auto; gap: .5rem; }
  .hero { --nav-h: 60px; }
  .nav__actions { grid-column: 3; }
  .nav__resume { display: none; }   /* resume still in footer */
  .icon-btn { min-width: 32px; height: 32px; }

  /* Phones: the section links move to a solid bar pinned to the bottom of the
     screen (thumb reach); logo, theme and terminal stay at the top. */
  :root { --bnav-h: 58px; }
  .nav nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--bnav-h) + env(safe-area-inset-bottom));
    padding: 0 var(--pad) env(safe-area-inset-bottom);
    background: var(--bg); border-top: 1px solid var(--border);
  }
  .nav__links { height: 100%; align-items: center; justify-content: space-around; gap: 0; }
  .nav__links a {
    display: block; padding: .6rem .4rem;
    font: 400 1.08rem var(--serif); letter-spacing: 0; text-transform: none; color: var(--text);
  }
  /* keep the bottom of the page (and the hero buttons) clear of the bar */
  body { padding-bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom)); }
  .hero { padding-bottom: calc(clamp(1.5rem, 4vh, 2.75rem) + var(--bnav-h)); }
}

/* ============ Hero (static) ============ */
/* The hero slides up under the (sticky) nav so the line field fills the whole
   first screen; padding-top keeps the content clear of the nav. */
.hero {
  container-type: inline-size;   /* lets the headline size in cqi */
  --nav-h: 72px;
  position: relative;
  margin-top: calc(-1 * var(--nav-h));
  min-height: 100vh; min-height: 100svh;
  display: grid; grid-template-rows: 1fr auto;
  padding: calc(var(--nav-h) + 2rem) var(--pad) clamp(1.5rem, 4vh, 2.75rem);
  overflow: hidden;
}
/* Line field: behind the content, never catches clicks, and fades out at the
   top and bottom instead of ending in a hard edge. */
.hero__lines {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 22%, #000 74%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0%, #000 22%, #000 74%, transparent 100%);
}
.hero__center, .hero__bottom { position: relative; z-index: 1; }
/* Experiment: symbol sea, no orb (and no orb-masked text inversion) */
.hero--glyphs .hero__orb, .hero--glyphs .hero__inv { display: none !important; }
/* floating letters (js/glyph-sea.js): hero headline, contact email and name */
.tl-w { display: inline-block; white-space: nowrap; }
.tl-c { display: inline-block; will-change: transform; transform-origin: 50% 70%; }
/* the giant name's fade: each letter carries the gradient itself */
.contact__name .tl-c { background: var(--name-fade); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Orb: dark plum core fading into a pink-lavender haze, blurred, with film grain.
   js/hero.js moves it; translate(-50%,-50%) centres it on that point.
   Haze is toned down so white text stays readable. Lines are drawn on top of the orb.
   --orb-follow-fade: orb opacity while following the cursor (read by js/hero.js). */
.hero__orb {
  position: absolute; left: 0; top: 0;
  width: min(60vmin, 620px); aspect-ratio: 1; border-radius: 50%;
  translate: -50% -50%;
  pointer-events: none; will-change: transform, opacity;
}
.hero__glow {                /* blurred gradient layer */
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle,
    #12080f 0%, #1d0d1c 18%, #351a31 32%, #5d3c59 46%,
    rgba(150, 112, 145, .75) 58%, rgba(185, 150, 180, .4) 68%, rgba(185, 150, 180, 0) 80%);
  filter: blur(26px);
}
/* Light theme: full-strength orb with a paler haze, so the dark core reads
   clearly on the cream background (the headline turns cream over it). */
:root[data-theme="light"] .hero__glow {
  background: radial-gradient(circle,
    #12080f 0%, #1d0d1c 18%, #351a31 32%, #7a5675 46%,
    rgba(205, 175, 200, .92) 57%, rgba(215, 190, 210, .55) 67%, rgba(215, 190, 210, 0) 80%);
}
.hero__grain {               /* sharp grain layer (not blurred) */
  position: absolute; inset: 0; border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay; opacity: .6;
  -webkit-mask-image: radial-gradient(circle, #000 30%, transparent 68%);
          mask-image: radial-gradient(circle, #000 30%, transparent 68%);
}
.hero__center { align-self: center; text-align: center; }
.hero__kicker { margin: 1.8rem 0 0; }   /* name sits under the headline */
.hero__title {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: clamp(3.6rem, 13.5vw, 14rem);
  font-size: clamp(3.6rem, calc((100cqi + 2 * var(--pad)) * .135), 14rem);   /* cqi: tracks the hero's real width, even when zoomed (Safari keeps vw unzoomed) */
  line-height: .88;
  letter-spacing: -.035em;
}
/* Text inversion (light theme only): an aria-hidden copy of the kicker + headline
   sits exactly on top of the real one in cream, masked to the orb's dark core.
   js/hero.js sets --mx/--my (orb centre, relative to the headline) and --mr
   (the radius the orb's gradient stops are measured against). */
.hero__titlewrap { position: relative; --mx: 50%; --my: 50%; --mr: 300px; }
.hero__inv { display: none; }
:root[data-theme="light"] .hero__inv {
  display: block;
  position: absolute; inset: 0;
  pointer-events: none; user-select: none;
  --inv-mask: radial-gradient(circle var(--mr) at var(--mx) var(--my), #000 37%, transparent 39%);
  -webkit-mask-image: var(--inv-mask);
          mask-image: var(--inv-mask);
}
:root[data-theme="light"] .hero__inv .hero__title,
:root[data-theme="light"] .hero__inv .hero__kicker { color: #f3f1ec; }
.hero__bottom { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 1.5rem; }
.hero__intro { max-width: 30ch; margin: 0; font-size: .92rem; color: var(--muted); text-wrap: balance; }
.hero__ctas { justify-self: end; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .75rem; }
/* Hero buttons (home: See my work / Get in touch; project pages: Live / Code) grow
   a little on hover (mouse/trackpad only). Size, fill and text colour share one
   long ease-out so the hover reads as a single smooth motion. */
.hero__ctas .pill--grad:hover, .phero__ctas .pill--grad:hover {
  transition: scale .5s cubic-bezier(.22, 1, .36, 1), background-position 1s cubic-bezier(.22, 1, .36, 1);
}
.hero__ctas .pill, .phero__ctas .pill {
  transition: scale .5s cubic-bezier(.22, 1, .36, 1),
              background-color .5s cubic-bezier(.22, 1, .36, 1),
              color .5s cubic-bezier(.22, 1, .36, 1);
}
@media (hover: hover) { .hero__ctas .pill:hover, .phero__ctas .pill:hover { scale: 1.06; } }
.hint {
  justify-self: center; background: none; border: 0; cursor: pointer; padding: .5rem .75rem;
  color: var(--muted);
}
.hint:hover { color: var(--text); }

@media (max-width: 860px) {
  .hero__bottom { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: .9rem; }
  .hero__ctas { justify-self: center; justify-content: center; }
  .pill { padding: .8rem 1.3rem; }
}
@media (max-width: 600px) {
  .hero__title { font-size: 18vw; font-size: calc((100cqi + 2 * var(--pad)) * .18); line-height: .9; }
}

/* ============ Sections ============ */
.section { padding: clamp(5rem, 12vw, 10rem) 0; }

/* Work */
#projects .display { margin-bottom: clamp(2.5rem, 6vw, 5rem); }
.work { border-bottom: 1px solid var(--border); }
.work__row {
  display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 2.2fr) minmax(0, 1.5fr) auto;
  align-items: center; gap: 2rem;
  padding: clamp(1.6rem, 3vw, 2.6rem) 0;
  border-top: 1px solid var(--border);
}
a.work__row { color: inherit; text-decoration: none; }
a.work__row:focus-visible { outline-offset: -2px; }
.work__meta { color: var(--dim); font-size: .62rem; letter-spacing: .12em; }
.work__meta b { color: var(--muted); font-weight: 500; margin-right: .9em; }
.work__title {
  font-family: var(--serif); font-optical-sizing: auto;
  font-size: clamp(1.9rem, 3vw, 3.3rem); line-height: 1.05; letter-spacing: -.02em;
}
.work__desc { margin: 0; color: var(--muted); font-size: .92rem; max-width: 52ch; }
.work__arrow { font-size: 1.2rem; color: var(--dim); }

/* Row hover: name goes italic; index, tags and description brighten; the other
   rows dim slightly. Colour/opacity ease over 250ms. (font-style can't be
   interpolated, so the italic swap itself is instant.) Only on devices with a
   real hover, so a tap on a phone doesn't leave a row stuck "hovered". */
.work__row, .work__meta, .work__meta b, .work__desc { transition: opacity .25s ease, color .25s ease; }
.work__row:focus-visible .work__title { font-style: italic; }
.work__row:focus-visible .work__meta,
.work__row:focus-visible .work__meta b,
.work__row:focus-visible .work__desc { color: var(--text); }
@media (hover: hover) {
  .work__row:hover .work__title { font-style: italic; }
  .work__row:hover .work__meta,
  .work__row:hover .work__meta b,
  .work__row:hover .work__desc { color: var(--text); }
  .work:hover .work__row:not(:hover) { opacity: .55; }
}

/* Floating preview card with a real screenshot of the hovered project.
   Sits above the rows like the reference; never catches clicks. */
.preview {
  position: fixed; left: 0; top: 0; z-index: 20;
  width: clamp(260px, 22vw, 380px); aspect-ratio: 800 / 460;
  border-radius: 6px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12);
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  pointer-events: none;
  opacity: 0; scale: .92;
  transition: opacity .25s ease, scale .25s ease;
  will-change: transform;
}
.preview.is-on { opacity: 1; scale: 1; }
.preview img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .25s ease;      /* crossfade between projects */
}
.preview img.is-on { opacity: 1; }
@media (hover: none), (pointer: coarse) { .preview { display: none; } }

@media (max-width: 900px) {
  .work__row { grid-template-columns: 1fr auto; gap: .5rem 1rem; }
  .work__meta, .work__desc { grid-column: 1 / -1; }
  .work__arrow { grid-column: 2; grid-row: 2; }
}

/* About */
.about { display: grid; gap: clamp(2.5rem, 6vw, 6rem); }
/* Desktop: two columns of equal height. The right column spreads out so the
   paragraph lines up with the top of the heading and the facts list with its bottom. */
@media (min-width: 960px) {
  .about { grid-template-columns: 1fr 1fr; align-items: stretch; }
  .about__body { display: flex; flex-direction: column; justify-content: space-between; gap: 2.5rem; }
}
.about__h { max-width: 9ch; }
.about__body .lead { font-size: clamp(1.1rem, 1.6vw, 1.4rem); line-height: 1.45; margin-bottom: 0; }
.about__body .facts { margin-top: 2.5rem; }
@media (min-width: 960px) { .about__body .facts { margin-top: 0; } }
/* Quick facts: mono label left, value right, hairline between rows. */
.facts { margin: 0; border-top: 1px solid var(--border); }
.facts__row {
  display: grid; grid-template-columns: 9.5rem 1fr; gap: 1rem; align-items: baseline;
  padding: .95rem 0; border-bottom: 1px solid var(--border);
}
.facts dt { color: var(--dim); }
.facts dd { margin: 0; font-size: .95rem; color: var(--text); }
@media (max-width: 520px) { .facts__row { grid-template-columns: 7.2rem 1fr; } }
/* Pull "Behind the lens" closer to About. */
.about-sec { padding-bottom: clamp(3rem, 6vw, 5rem); }

/* Skills */
/* ---- Skills as an architecture map (js/arch.js) ----
   One project per slide in a swipeable track, with dots underneath. Each lane
   is an ordered list of nodes laid out in a gentle wave (desktop) or a two-
   column snake (phones); js/arch.js draws the curved wires between them and
   plays the light-up. */
.arch__head { display: grid; gap: 1.2rem; margin-bottom: clamp(2.5rem, 5vw, 4rem); max-width: 60ch; }
.arch__h { font-size: clamp(2.4rem, 5vw, 4.6rem); }
.arch__sub { color: var(--muted); font-size: .95rem; margin: 0; }
.arch {
  --arch-line: color-mix(in srgb, var(--text) 18%, transparent);
  --arch-glow: rgba(226, 230, 240, .5);
}
:root[data-theme="light"] .arch { --arch-line: color-mix(in srgb, var(--text) 22%, transparent); --arch-glow: rgba(70, 50, 80, .28); }
.arch__track {
  display: flex; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none;
  border-radius: 22px;
}
.arch__track::-webkit-scrollbar { display: none; }
.arch__track:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; }
.arch__slide {
  flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; flex-direction: column;
  padding: clamp(1.5rem, 3.2vw, 3rem);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent); border-radius: 22px;
  /* a faint plum haze in one corner, echoing the hero orb */
  background:
    radial-gradient(55% 75% at 92% 0%, rgba(93, 60, 89, .2), transparent 70%),
    radial-gradient(40% 60% at 0% 100%, rgba(93, 60, 89, .08), transparent 70%);
}
:root[data-theme="light"] .arch__slide {
  background:
    radial-gradient(55% 75% at 92% 0%, rgba(150, 112, 145, .14), transparent 70%),
    radial-gradient(40% 60% at 0% 100%, rgba(150, 112, 145, .07), transparent 70%);
}
.arch__ghead {
  display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: .4rem 1.4rem;
  margin-bottom: clamp(2rem, 4vw, 3.2rem);
}
.arch__num { margin: 0; color: var(--text); }
.arch__num span { color: var(--dim); }
.arch__title { font: 400 clamp(1.9rem, 3.4vw, 3rem)/1 var(--serif); letter-spacing: -.02em; margin: 0; }
.arch__title a { color: var(--text); text-decoration: none; }
.arch__title a span { font: .5em var(--sans); vertical-align: .55em; color: var(--muted); transition: color .3s ease; }
.arch__title a:hover span { color: var(--text); }
.arch__note { grid-column: 2; margin: 0; color: var(--muted); font-size: .6rem; }

.arch__stage { position: relative; flex: 1; display: grid; align-content: center; gap: clamp(1.6rem, 3vw, 2.6rem); }
.arch__wires, .arch__vias { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.arch__lane { position: relative; z-index: 1; display: grid; grid-template-columns: 8rem 1fr; align-items: start; gap: 1rem; }
.arch__lname { margin: .55rem 0 0; font: italic 400 1.15rem var(--serif); color: var(--muted); }
.arch__chain {   /* four aligned columns, so lanes spread across the card */
  --hop: clamp(2.4rem, 4vw, 4.5rem);
  display: grid; grid-template-columns: repeat(4, minmax(0, max-content)); justify-content: space-between;
  align-items: start; column-gap: var(--hop); max-width: 1100px;
}
.arch__chain > :nth-child(even) { margin-top: 2.1rem; }   /* the wave */

/* Nodes: glassy pills with a chrome bead; outside-AWS ends are italic serif. */
.fnode {
  display: inline-flex; align-items: center; gap: .65rem; flex: none;
  padding: .55rem 1rem .55rem .7rem; border-radius: 999px;
  border: 1px solid var(--arch-line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--muted);
  transition: color .7s ease, border-color .7s ease, box-shadow .7s ease;
}
.fnode i {
  flex: none; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #c9ccd1 40%, #6f737a 100%);
  opacity: .45; transition: opacity .7s ease, box-shadow .7s ease;
}
.fnode span { display: grid; gap: .1rem; }
.fnode b { font: 600 .88rem var(--sans); letter-spacing: -.01em; white-space: nowrap; }
.fnode small { font: .58rem var(--mono); letter-spacing: .04em; color: var(--dim); white-space: nowrap; transition: color .7s ease; }
.fnode--ext { border-style: dashed; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; display: inline-grid; gap: 0; padding: .45rem 1rem; }
.fnode--ext b { font: italic 400 1.05rem var(--serif); letter-spacing: 0; }
.fnode.is-lit { color: var(--text); border-color: color-mix(in srgb, var(--text) 55%, transparent); box-shadow: 0 0 22px -6px var(--arch-glow); }
.fnode.is-lit i { opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 8%, transparent), 0 0 14px var(--arch-glow); }
.fnode.is-lit small { color: var(--muted); }

/* Wires (SVG, drawn by js/arch.js): a faint base curve, and a bright signal
   curve that draws along it. No arrowheads: the light-up shows direction. */
.wire__base { fill: none; stroke: var(--arch-line); stroke-width: 1; transition: stroke .7s ease; }
.wire--cross .wire__base { stroke-dasharray: 3 5; }
.wire__sig { fill: none; stroke: var(--text); stroke-width: 1.4; stroke-linecap: round; filter: drop-shadow(0 0 4px var(--arch-glow)); }
.wire.is-lit .wire__base { stroke: color-mix(in srgb, var(--text) 30%, transparent); }
.via {   /* a small tag sitting on the wire's midpoint */
  position: absolute; translate: -50% -50%; white-space: nowrap;
  padding: .12rem .45rem; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--arch-line);
  font: .52rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dim);
  transition: color .7s ease, border-color .7s ease;
}
.via--side { translate: -50% -50%; }
.via.is-lit { color: var(--text); border-color: color-mix(in srgb, var(--text) 40%, transparent); }

/* Dots: one per slide; the current one stretches and turns chrome. */
.arch__dots {   /* dots with spacing wide enough for the bubble to rest on each */
  position: relative; display: flex; justify-content: center; align-items: center;
  gap: 1.5rem; height: 20px; margin-top: 1.3rem;
}
.arch__dots button {
  position: relative; width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; cursor: pointer;
  background: color-mix(in srgb, var(--text) 22%, transparent);
  transition: background-color .3s ease;
}
.arch__dots button::after { content: ""; position: absolute; inset: -8px; }   /* bigger tap target */
.arch__dots button:hover { background-color: color-mix(in srgb, var(--text) 45%, transparent); }
/* the bubble: positioned and stretched every frame by js/arch.js */
.arch__bubble {
  position: absolute; left: 0; top: 50%; width: 24px; height: 8px; border-radius: 999px;
  background: var(--chrome-text); pointer-events: none; will-change: transform, width, height;
  box-shadow: 0 0 10px -2px var(--arch-glow, rgba(226, 230, 240, .5));
}

@media (max-width: 1000px) {
  .arch__lane { grid-template-columns: 1fr; gap: .8rem; }
  .arch__lname { margin: 0; }
  .fnode b, .fnode small { white-space: normal; }
}
@media (max-width: 700px) {
  .arch__ghead { grid-template-columns: 1fr; }
  .arch__note { grid-column: 1; }
  /* two-column snake: 1 2 / 4 3 / 5 */
  .arch__slide { padding: 1.4rem 1.1rem; }
  .arch__chain { display: grid; grid-template-columns: 1fr 1fr; justify-content: stretch; gap: 2.4rem 3.6rem; max-width: none; }
  .via { font-size: .47rem; letter-spacing: .04em; padding: .1rem .3rem; }
  .arch__chain > :nth-child(even) { margin-top: 0; }
  .arch__chain > :nth-child(1) { grid-area: 1 / 1; }
  .arch__chain > :nth-child(2) { grid-area: 1 / 2; }
  .arch__chain > :nth-child(3) { grid-area: 2 / 2; }
  .arch__chain > :nth-child(4) { grid-area: 2 / 1; }
  .arch__chain > :nth-child(5) { grid-area: 3 / 1; }
  .fnode { justify-self: stretch; min-width: 0; padding: .5rem .6rem .5rem .55rem; gap: .45rem; }
  .fnode--ext { padding: .45rem .8rem; }
  .fnode b { white-space: normal; }
  .fnode small { white-space: normal; }
}
/* Resume-style list under the map */
.stack { margin: clamp(2.5rem, 5vw, 4rem) 0 0; display: grid; border-top: 1px solid var(--border); }
.stack__row { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--border); }
.stack__row dt { margin: 0; padding-top: .2rem; }
.stack__row dd { margin: 0; color: var(--text); }

@media (max-width: 700px) {
  .stack__row { grid-template-columns: 1fr; gap: .35rem; }
}

/* Contact / footer: lead line, big serif email (mailto) with a copy button,
   round icon links, a base line, then a huge name fading out at the bottom.
   The hero's line field drifts behind it all (js/footer.js) and over the name. */
.contact { container-type: inline-size; position: relative; overflow: hidden; text-align: center; padding: clamp(6rem, 12vw, 9rem) 0 0; }
.contact__lines { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 16%, #000 100%);
          mask-image: linear-gradient(to bottom, transparent 0%, #000 16%, #000 100%); }
.contact__inner { position: relative; z-index: 2; display: grid; justify-items: center; }
.contact__lead { margin: 0 0 clamp(1rem, 2.4vw, 1.8rem); font: italic 400 clamp(1.2rem, 2.2vw, 1.8rem) var(--serif); color: var(--muted); }
.contact__email {
  position: relative; display: inline-block;
  font: 400 clamp(2rem, 7.6vw, 8.4rem)/1 var(--serif); letter-spacing: -.035em;
  font-size: clamp(1.4rem, 7.6cqi, 8.4rem);   /* sized to the footer's width, so it fits at any zoom */
  color: var(--text); text-decoration: none; white-space: nowrap;
}
/* Hover: an underline draws in from left to right; on leave it carries on
   out to the right, so it never just snaps away. */
.contact__email::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -.24em;   /* below the y and g descenders */
  height: max(2px, .028em); border-radius: 999px; background: currentColor;
  transform: scaleX(0); transform-origin: right center;
  transition: transform .7s cubic-bezier(.65, 0, .35, 1);
}
.contact__email:hover::after, .contact__email:focus-visible::after { transform: scaleX(1); transform-origin: left center; }
/* Bodoni's 1 looks like an l at this size; set the digit in the sans so the address reads right */
.contact__digit { font-family: var(--sans); font-weight: 300; font-size: .86em; letter-spacing: 0; margin: 0 .02em; }
.contact__copy {
  display: inline-flex; align-items: center; gap: .5rem; margin-top: clamp(1.4rem, 2.6vw, 2.2rem);
  padding: .5rem .9rem; border: 1px solid transparent; border-radius: 999px; background: none;
  color: var(--muted); cursor: pointer; transition: color .25s ease, border-color .25s ease;
}
.contact__copy:hover { color: var(--text); border-color: var(--border-strong); }
.contact__copy.is-copied { color: var(--text); }
.contact__icons { display: flex; justify-content: center; gap: .9rem; margin: clamp(3rem, 6vw, 5rem) 0 clamp(4rem, 8vw, 6.5rem); }
.contact__icons a {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--border-strong); color: var(--muted);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  transition: color .3s ease, border-color .3s ease, scale .45s cubic-bezier(.22, 1, .36, 1);
}
.contact__icons a:hover { color: var(--text); border-color: color-mix(in srgb, var(--text) 50%, transparent); }
@media (hover: hover) { .contact__icons a:hover { scale: 1.06; } }
.contact__base {
  width: 100%; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .75rem 2rem;
  font-size: .78rem; color: var(--dim);
}
.contact__copyright { font: 400 .95rem var(--serif); color: var(--muted); }
.contact__base kbd { font-size: .7rem; }
/* the giant name: a chrome fade that dissolves into the page, cut off at the bottom */
.contact__name {
  position: relative; z-index: 0; margin: clamp(1.5rem, 4vw, 3rem) 0 0;
  font: 400 clamp(4rem, 17.5vw, 22rem)/.8 var(--serif); letter-spacing: -.045em; white-space: nowrap;
  font-size: clamp(2.6rem, 17.5cqi, 22rem);
  --name-fade: linear-gradient(180deg, color-mix(in srgb, var(--text) 80%, transparent) 0%, color-mix(in srgb, var(--text) 35%, transparent) 55%, transparent 92%);
  background: var(--name-fade);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: -.08em; user-select: none;
}
@media (max-width: 600px) {
  .contact__base { justify-content: center; text-align: center; }
  .contact__icons a { width: 48px; height: 48px; }
  .contact__email { font-size: 7.1vw; font-size: 7.1cqi; }
}

/* used by the terminal's `goto` command */
.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 100% { box-shadow: inset 0 0 0 9999px transparent; } 30% { box-shadow: inset 0 0 0 9999px color-mix(in srgb, #966f91 12%, transparent); } }

/* ============ Terminal (js/terminal.js) ============ */
/* A glassy dark panel in the site's language: plum haze, hairline border,
   chrome beads instead of traffic lights, a serif title and chrome prompt.
   It stays dark in both themes (it's a terminal). Phones: a bottom sheet;
   desktop: a floating window. */
.terminal {
  position: fixed; inset: auto 0 0 0; z-index: 50; height: var(--term-h);
  display: flex; flex-direction: column;
  color: var(--term-text);
  background:
    radial-gradient(70% 90% at 100% 0%, rgba(93, 60, 89, .32), transparent 70%),
    radial-gradient(50% 70% at 0% 100%, rgba(93, 60, 89, .14), transparent 70%),
    rgba(10, 9, 11, .9);
  -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  border-top: 1px solid rgba(255, 255, 255, .1); border-radius: 18px 18px 0 0;
  box-shadow: 0 -18px 50px rgba(0, 0, 0, .55);
  transform: translateY(100%); opacity: 0;
  transition: transform .45s cubic-bezier(.22, 1, .36, 1), opacity .3s ease;
}
.terminal[hidden] { display: none; }
.terminal.is-open { transform: translateY(0); opacity: 1; }
@media (min-width: 900px) {
  .terminal {
    left: auto; right: 1.5rem; bottom: 1.5rem; width: 720px;
    border: 1px solid rgba(255, 255, 255, .1); border-radius: 18px; overflow: hidden;
    box-shadow: 0 30px 80px -10px rgba(0, 0, 0, .7), 0 0 0 1px rgba(0, 0, 0, .4);
    transform: translateY(18px) scale(.98);
  }
  .terminal.is-open { transform: none; }
  body.term-open { padding-bottom: 0; }
}
.terminal__bar { display: flex; align-items: center; gap: .9rem; padding: .7rem 1rem .65rem 1.1rem; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.terminal__dots { display: flex; gap: 7px; }
.terminal__dots i {   /* chrome beads, like the skills diagram */
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #c9ccd1 40%, #6f737a 100%);
  opacity: .8;
}
.terminal__title { display: flex; align-items: baseline; gap: .7rem; min-width: 0; }
.terminal__name { font: italic 400 1.1rem var(--serif); color: #f3f1ee; }
.terminal__sub { font-size: .6rem; letter-spacing: .14em; text-transform: uppercase; color: #77777d; white-space: nowrap; }
.terminal__close {
  margin-left: auto; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: none; border: 1px solid transparent; color: #a9a9ae; font-size: 1.2rem; line-height: 1; cursor: pointer;
  transition: border-color .25s ease, color .25s ease;
}
.terminal__close:hover { border-color: rgba(255, 255, 255, .18); color: #fff; }
.terminal__out {
  flex: 1; overflow-y: auto; padding: 1rem 1.2rem; font-size: .8rem; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; scrollbar-width: thin; scrollbar-color: #333 transparent;
}
.terminal__out .line { margin: 0; }
.terminal__out .cmd { color: #8a8a90; }
.terminal__out .cmd b, .terminal__prompt {   /* chrome prompt */
  font-weight: 500;
  background: linear-gradient(180deg, #ffffff 0%, #d7dade 45%, #8d9298 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.terminal__out .hl { color: #f3f1ee; font-weight: 500; }
.terminal__out .dim { color: #85858c; }
.terminal__out .ok { color: #a7dfb9; }
.terminal__out .err { color: #f0a5a5; }
.terminal__out a { color: #f3f1ee; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .35); text-underline-offset: 3px; }
.terminal__out a:hover { text-decoration-color: #fff; }
.terminal__chips { display: flex; gap: .45rem; padding: .55rem 1.1rem; overflow-x: auto; border-top: 1px solid rgba(255, 255, 255, .06); scrollbar-width: none; }
.terminal__chips::-webkit-scrollbar { display: none; }
.terminal__chips button {
  flex: none; font: .7rem var(--mono); color: #c9c9ce; background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 999px; padding: .32rem .8rem; cursor: pointer;
  transition: border-color .25s ease, color .25s ease, background-color .25s ease;
}
.terminal__chips button:hover { border-color: rgba(255, 255, 255, .4); color: #fff; background: rgba(255, 255, 255, .06); }
.terminal__form { display: flex; align-items: center; gap: .6rem; padding: .65rem 1.2rem .8rem; border-top: 1px solid rgba(255, 255, 255, .06); }
.terminal__prompt { font-size: .8rem; white-space: nowrap; }
.terminal__form input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: none;
  color: var(--term-text); font: 16px var(--mono); /* 16px stops iOS zoom-on-focus */
  caret-color: #e9ebee;
}
@media (max-width: 420px) {
  .terminal__out { font-size: .7rem; padding: .85rem 1rem; }
  .terminal__prompt { font-size: .72rem; }
  .terminal__sub { display: none; }
}

/* ============ Project pages (knightro.html, s3-site.html, portfolio.html) ============ */
.pnav {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center;
  height: 88px; padding-inline: var(--pad);
}
.pnav .nav__actions { display: flex; align-items: center; gap: .5rem; }

.phero {
  position: relative;
  padding: clamp(9rem, 18vw, 13rem) 0 clamp(4rem, 8vw, 6.5rem);
  border-bottom: 1px solid var(--border);
  background: radial-gradient(70% 90% at 0% 0%, rgba(93, 60, 89, .22), transparent 70%);   /* plum haze, like the orb */
}
:root[data-theme="light"] .phero { background: radial-gradient(70% 90% at 0% 0%, rgba(150, 112, 145, .16), transparent 70%); }
/* tag line: metallic plum (pale lilac sheen in dark, deep plum in light) */
.phero__tags {
  display: inline-block; margin-bottom: 1.6rem; color: #b07ea8;
  background: linear-gradient(100deg, #8f5f88 0%, #d9a9d1 18%, #7a4c73 40%, #c993c0 62%, #f0d2ea 76%, #8f5f88 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
:root[data-theme="light"] .phero__tags {
  background: linear-gradient(100deg, #5a2a52 0%, #9a6a92 22%, #3f1b39 45%, #8a5a82 68%, #4d2446 100%);
  -webkit-background-clip: text; background-clip: text;
}
.phero__title { font-size: clamp(3rem, 8vw, 8.2rem); margin-bottom: 2rem; }
.phero__sum { max-width: 46ch; font-size: clamp(1.05rem, 1.5vw, 1.3rem); line-height: 1.55; color: var(--muted); margin-bottom: 2.6rem; }
.phero__ctas { display: flex; flex-wrap: wrap; gap: .9rem; }

.pbody { padding: clamp(4rem, 8vw, 7rem) 0; }
/* Scroll progress bar (project pages only) */
.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 40; pointer-events: none;
  background: color-mix(in srgb, var(--text) 8%, transparent); }
.progress__bar { display: block; height: 100%; background: var(--grad);
  transform: scaleX(0); transform-origin: 0 50%; will-change: transform; }

/* Sticky section list on the left + one content column */
.pgrid { display: grid; gap: 3rem; }
.ptoc { display: none; }
@media (min-width: 960px) {
  .pgrid { grid-template-columns: minmax(170px, 230px) minmax(0, 1fr); gap: clamp(3rem, 6vw, 6rem); }
  .ptoc { display: block; }
  .ptoc ol { position: sticky; top: 130px; display: grid; gap: .95rem; }
  .ptoc a { display: flex; gap: 1.1rem; text-decoration: none; color: var(--dim); font-size: .95rem; transition: color .25s ease; }
  .ptoc a:hover { color: var(--muted); }
  .ptoc a.is-active { color: var(--text); }
  .ptoc__n { font-family: var(--mono); font-size: .8rem; padding-top: .12em; min-width: 1.6em; }
}
.pcontent { display: grid; gap: clamp(4rem, 8vw, 6.5rem); max-width: 860px; }
.pblock { scroll-margin-top: 120px; }
.pblock__h { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.8rem; }
.pblock__n { color: var(--text); }
.pblock__h::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.pblock__body { font-size: clamp(1rem, 1.25vw, 1.12rem); line-height: 1.6; }
.pblock__body p { max-width: 60ch; }
.pblock__body code {
  font-size: .86em; color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  padding: .08em .35em; border-radius: 4px;
}
.plist { display: grid; gap: 1.1rem; margin: 0 0 1em; }
.plist > li { padding-left: 1.1rem; border-left: 1px solid rgba(150, 112, 145, .5); }   /* plum rule, one colour */
.plist--sub { gap: .55rem; margin: .8rem 0 0; }
.plist--sub > li { border-left-color: var(--border-strong) !important; color: var(--muted); }


/* Gallery: every shot sits in the same framed card (16:10, the first one wide
   at 16:9) on a faint plum haze, so screenshots of any shape line up; captions
   are numbered by a CSS counter. Clicking opens the viewer (js/project.js). */
.gallery { counter-reset: shot; display: grid; gap: clamp(1.2rem, 2.4vw, 2rem) clamp(1rem, 2vw, 1.6rem); }
@media (min-width: 760px) { .gallery { grid-template-columns: 1fr 1fr; } }
.gallery__item { counter-increment: shot; margin: 0; min-width: 0; }
.gallery__item:first-child { grid-column: 1 / -1; }
.gallery__item a {
  --pad-in: clamp(.9rem, 2.2vw, 1.8rem);
  position: relative; display: block; aspect-ratio: 16 / 10;
  border: 1px solid color-mix(in srgb, var(--text) 9%, transparent); border-radius: 16px; overflow: hidden;
  background:
    radial-gradient(70% 90% at 85% 0%, rgba(93, 60, 89, .22), transparent 70%),
    radial-gradient(60% 80% at 0% 100%, rgba(93, 60, 89, .1), transparent 70%),
    var(--surface);
  cursor: zoom-in; transition: border-color .35s ease;
}
:root[data-theme="light"] .gallery__item a {
  background: radial-gradient(70% 90% at 85% 0%, rgba(150, 112, 145, .16), transparent 70%), var(--surface);
}
.gallery__item:first-child a { aspect-ratio: 16 / 9; }
.gallery__item img {   /* fills the card's inner box, so tall phone shots fit too */
  position: absolute; inset: var(--pad-in); width: calc(100% - 2 * var(--pad-in)); height: calc(100% - 2 * var(--pad-in));
  object-fit: contain;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, .45));
  transition: scale .6s cubic-bezier(.22, 1, .36, 1);
}
:root[data-theme="light"] .gallery__item img { filter: drop-shadow(0 10px 22px rgba(40, 30, 20, .18)); }
/* Very wide, short screenshots (console strips) would shrink to a sliver in a
   uniform card: show a readable close-up instead, focused by --focus (x
   position, set per figure); the viewer still shows the whole thing. */
.gallery__item.is-strip img { object-fit: cover; object-position: var(--focus, 0%) 0; border-radius: 8px; }
/* Tall phone screenshots get a taller card and show in full (they sit in pairs). */
.gallery__item.is-tall a { aspect-ratio: 3 / 4; }
.gallery__item--full { grid-column: 1 / -1; }
.gallery__item a:hover { border-color: color-mix(in srgb, var(--text) 28%, transparent); }
@media (hover: hover) { .gallery__item a:hover img { scale: 1.025; } }
.gallery__item figcaption {
  display: flex; align-items: baseline; gap: .8rem; margin-top: .85rem;
  font: 400 .92rem/1.4 var(--sans); letter-spacing: 0; text-transform: none; color: var(--muted);
}
.gallery__item figcaption::before { content: counter(shot, decimal-leading-zero); font: 500 .62rem var(--mono); letter-spacing: .1em; color: var(--dim); }

.pnext { padding-bottom: clamp(4rem, 8vw, 6rem); }
.pnext a {
  display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap;
  padding-top: 2.2rem; border-top: 1px solid var(--border); text-decoration: none;
}
.pnext__title { font-family: var(--serif); font-size: clamp(2rem, 5vw, 4rem); line-height: 1; letter-spacing: -.02em; }
@media (hover: hover) { .pnext a:hover .pnext__title { font-style: italic; } }
.pfoot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .75rem; padding-bottom: 2.5rem; font-size: .6rem; color: var(--dim); }
.pfoot a { text-decoration: none; }
.pfoot a:hover { color: var(--text); }

/* ============ Behind the lens (js/lens.js) ============ */
/* A loose pile of photo cards. Desktop: absolutely placed on a 16:9 board
   (--x/--y/--w in % of the board, --r tilt), draggable with the mouse.
   Phones: a tilted two-column grid; drag with a finger, tap to enlarge. */
.lens { padding-top: 0; }
.lens__head { margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.lens__h { font-size: clamp(2.4rem, 5vw, 4.6rem); margin-bottom: 1.2rem; }
.lens__sub { color: var(--muted); font-size: .95rem; margin-bottom: .9rem; }
.lens__hint { color: var(--dim); margin: 0; }
.lens__hint-touch { display: none; }
@media (hover: none) { .lens__hint-fine { display: none; } .lens__hint-touch { display: inline; } }

.lens__board {
  position: relative; aspect-ratio: 16 / 9; max-width: 1500px;
  /* No-scroll zone: touches anywhere on the board (photos and the gaps between
     them) go to dragging, not page scrolling. Scroll by touching outside it. */
  touch-action: none;
}
.lens__card {
  position: absolute; left: var(--x); top: var(--y); width: var(--w);
  padding: 0; border: 0; background: var(--surface); border-radius: 6px; overflow: hidden;
  rotate: var(--r); cursor: zoom-in;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .06);
  transition: scale .45s cubic-bezier(.22, 1, .36, 1), rotate .45s cubic-bezier(.22, 1, .36, 1),
              box-shadow .45s cubic-bezier(.22, 1, .36, 1);
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
.lens__card img { width: 100%; height: auto; display: block; pointer-events: none; user-select: none; }
:root[data-theme="light"] .lens__card { box-shadow: 0 10px 28px rgba(40, 30, 20, .18), 0 0 0 1px rgba(0, 0, 0, .06); }
@media (hover: hover) and (pointer: fine) {
  .lens__card { cursor: grab; }
  .lens__card:hover { scale: 1.02; }
}
.lens__card.is-dragging {
  cursor: grabbing; scale: 1.05; rotate: 0deg;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .08);
  transition: scale .3s cubic-bezier(.22, 1, .36, 1), rotate .3s cubic-bezier(.22, 1, .36, 1), box-shadow .3s ease;
}
.lens__card:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

@media (max-width: 700px) {
  .lens__board { aspect-ratio: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem .9rem; }
  .lens__card { position: relative; left: auto; top: auto; width: auto; rotate: calc(var(--r) * .6); }
  .lens__card:nth-child(4) { grid-row: span 2; }   /* the tall reflection photo */
  .lens__card:nth-child(4) img { height: 100%; object-fit: cover; }
}

/* Lightbox: the page dims and the photo opens large in the centre. */
.lightbox {
  border: 0; padding: 0; background: transparent; color: #f3f1ee;
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  display: grid; place-items: center;
}
.lightbox:not([open]) { display: none; }
.lightbox:focus { outline: none; }
.lightbox { touch-action: none; }   /* sideways swipes step through photos (js/lens.js) */
.lightbox::backdrop { background: rgba(5, 5, 5, .86); }
.lightbox[open] { animation: lb-in .4s cubic-bezier(.22, 1, .36, 1); }
.lightbox[open]::backdrop { animation: lb-fade .4s ease; }
.lightbox.is-closing { animation: lb-out .25s ease forwards; }
.lightbox.is-closing::backdrop { animation: lb-fade .25s ease reverse forwards; }
@keyframes lb-in { from { opacity: 0; scale: .96; } }
@keyframes lb-out { to { opacity: 0; scale: .97; } }
@keyframes lb-fade { from { opacity: 0; } }
.lightbox__fig { margin: 0; display: grid; justify-items: center; gap: .9rem; }
.lightbox__img {
  max-width: min(88vw, 1400px); max-height: 80vh; max-height: 80dvh; width: auto; height: auto;
  border-radius: 6px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.lightbox__cap { color: #9a9a9a; }
.lightbox__btn {
  position: fixed; display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 999px;
  background: rgba(20, 20, 20, .6); color: #f3f1ee; font: 400 1.2rem var(--sans); cursor: pointer;
  transition: background-color .3s ease, border-color .3s ease;
}
.lightbox__btn:hover { background: rgba(60, 60, 60, .8); border-color: rgba(255, 255, 255, .4); }
.lightbox__close { top: 1.1rem; right: 1.1rem; font-size: 1.5rem; }
.lightbox__prev { left: 1.1rem; top: 50%; translate: 0 -50%; }
.lightbox__next { right: 1.1rem; top: 50%; translate: 0 -50%; }
@media (max-width: 700px) {
  .lightbox__img { max-width: 94vw; }
  .lightbox__prev, .lightbox__next { top: auto; bottom: 1.2rem; translate: none; }
  .lightbox__prev { left: calc(50% - 54px); } .lightbox__next { right: calc(50% - 54px); }
}
html.lightbox-open { overflow: hidden; }

/* ============ Scroll reveals (js/reveal.js) ============ */
/* Hidden states only apply once the script has set up (html.reveal-ready). */
.reveal-ready .rv {
  opacity: 0; transform: translateY(26px);
  transition: opacity .9s cubic-bezier(.2, .7, .2, 1), transform .9s cubic-bezier(.2, .7, .2, 1);
}
.reveal-ready .rv.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .terminal, .terminal.is-open { transition: none; transform: none; }
  .contact__email::after { transition: none; }
  .work__row, .work__meta, .work__meta b, .work__desc { transition: none; }
  .preview, .preview img { transition: none; }
  .ptoc a, .nav::before, .nav::after, .pnav::before, .pnav::after { transition: none; }
  .hero__ctas .pill, .phero__ctas .pill { transition: none; }
  .fnode, .fnode i, .via, .arch__dots button { transition: none; }   /* the bubble just jumps (scroll is instant) */
  .hero__ctas .pill--grad:hover, .phero__ctas .pill--grad:hover { transition: none; }   /* no light sweep */
  .gallery__item img, .lens__card, .lightbox[open], .lightbox[open]::backdrop, .lightbox.is-closing, .lightbox.is-closing::backdrop { transition: none; animation: none; }
  .reveal-ready .rv { opacity: 1; transform: none; transition: none; }
}
