/* ============================================================
   Rukshan Edirisinghe — portfolio
   Dark editorial system: Antonio display + Inter body,
   charcoal ground, lime accent, grain, sticky-stack work cards.
   ============================================================ */

:root {
  /* palette round-tripped from the recording: base #1E1E1E, accent #D2FF6E */
  /* base is set BELOW the template's apparent #1E1E1E on purpose: the grain
     lifts the rendered tone, so this composites up to ~#212121 like theirs */
  --bg: #222222;
  --bg-2: #1e1e20;
  /* GRAIN STRENGTH. The tile is generated at 2x the measured amplitude, so
     0.5 reproduces the recording exactly; 0 = none, 1 = double. Because the
     tile's mean equals --bg, changing this scales grain WITHOUT shifting tone. */
  --grain: 0.5;
  --card: #262627;
  --card-2: #2e2e2f;
  --line: rgba(255, 255, 255, 0.12);
  --text: #ffffff;
  --muted: #b5b5b5;
  --faint: #7a7a7c;
  --lime: #d2ff6e;
  --ink: #161617;
  --radius: 20px;
  --container: 1120px;
  --nav-h: 64px;
  /* all three traveler slots share ONE box, so the flying card never resizes
     or changes aspect mid-flight — it only moves and rotates */
  --card-w: 380px;
  --card-h: 409px;
  --display: "Antonio", "Arial Narrow", sans-serif;
  --body: "Inter", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

/* base tone on <html> so the grain layer paints above it */
html { background: var(--bg); }

body {
  font-family: var(--body);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: transparent;
  overflow-x: hidden;
}

/* Measured from the recording, flat 300x300 patch across 33 frames:
     · base tone  #222222 (mean 33.74, perfectly neutral — 0.00 channel spread)
     · grain      luma sd 6.12, right-skewed (p1 −13.8, p99 +18.9 vs median)
     · grain size 1px autocorrelation 0.051 => TRUE per-pixel noise
     · animation  re-randomised every frame (13753/14400 pixels differ)
   An SVG feTurbulence layer could not reproduce this: Chrome rasterises the
   filter and upscales it, which measured 0.964 autocorrelation — smooth blobs,
   not grain. So the grain is a real 8-bit greyscale PNG of per-pixel noise,
   generated to the measured distribution, tiled and re-seeded by shifting
   background-position. Its mean equals --bg so opacity never shifts the tone. */
html { background: var(--bg); }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  /* z-index 0, NOT -1: negative would paint behind the root background and
     vanish. Content is lifted to 1 instead. */
  z-index: 0;
  pointer-events: none;
  opacity: var(--grain);
  background-image: url("../img/grain.png");
  background-repeat: repeat;
  /* ~60ms per field, the closest practical step to the 30fps re-randomisation
     measured in the recording without repainting on every single frame */
  animation: grain-seed 0.48s steps(1, end) infinite;
}
/* offsets are coprime-ish and larger than the tile so each step is a fresh
   field — 1px noise has no structure for the eye to track between positions */
@keyframes grain-seed {
  0%    { background-position: 0 0; }
  12.5% { background-position: 97px 41px; }
  25%   { background-position: -53px 113px; }
  37.5% { background-position: 149px -71px; }
  50%   { background-position: -101px -37px; }
  62.5% { background-position: 31px 157px; }
  75%   { background-position: -139px 79px; }
  87.5% { background-position: 67px -127px; }
}
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

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

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font: inherit; border: 0; background: none; color: inherit; cursor: pointer; }

/* content sits above the grain layer (which is fixed at z-index 0) */
main, .site-foot { position: relative; z-index: 1; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

/* ---------- type ---------- */
h1, h2, h3, .display {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.08;
  letter-spacing: 0;
}
h2 { font-size: clamp(38px, 5.2vw, 60px); }
h3 { font-size: clamp(22px, 2.4vw, 32px); font-weight: 400; }
.lead { color: var(--muted); max-width: 560px; font-size: 17px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 10000;
  background: var(--lime); color: var(--ink); padding: 10px 18px; font-weight: 500;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------- cursor follower ---------- */
.cursor-dot {
  position: fixed; z-index: 9500; top: 0; left: 0;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--lime);
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: width 0.25s ease, height 0.25s ease, opacity 0.25s ease;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--body); font-weight: 500; font-size: 0;
  color: var(--ink);
  will-change: transform;
}
.cursor-dot svg { width: 0; height: 0; transition: width 0.2s ease, height 0.2s ease; }
.cursor-dot.is-view { width: 64px; height: 64px; }
.cursor-dot.is-view svg { width: 22px; height: 22px; }
.cursor-dot.is-hidden { opacity: 0; }
@media (hover: none), (prefers-reduced-motion: reduce) {
  .cursor-dot { display: none; }
}

/* ---------- lime badge on the hero photo ----------
   Anchored to the FIRST photo (not the cursor). It holds one two-slot strip
   ("Hi" above, hand below) clipped by the circle, and shrinks + fades away as
   the card travels toward the second position — driven by --bk, which the
   traveler loop sets from scroll progress (1 at the hero, 0 by slot 2). */
.hero-badge {
  /* Centred on the photo's BOTTOM-LEFT CORNER, so most of the circle hangs
     outside the card. Diameter measured at 35% of the card width (149px against
     a 424px card in the reference), hence 132px against our 380px card. */
  position: absolute; left: -66px; bottom: -66px; z-index: 2;
  width: 132px; height: 132px; border-radius: 50%;
  background: var(--lime); color: var(--ink);
  overflow: hidden;               /* the circular mask clips the roll */
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  transform-origin: 50% 50%;
  /* Shrinks and fades LITTLE BY LITTLE, hitting TRUE zero a little before the
     card arrives at the second position (--bk is driven to 0 by 85% of the
     trip), so nothing lingers on the profile.yaml card. Scrolling back up
     reverses it, since --bk comes straight from scroll progress. */
  transform: scale(calc(0.01 + 0.99 * var(--bk, 1)));
  opacity: var(--bk, 1);
}
.hero-badge .roll {
  height: 200%;
  display: grid; grid-template-rows: 1fr 1fr;
  /* Rolls AUTOMATICALLY on a timer, not on hover. Measured from the 30fps
     closeup: rolls fire 2.03s apart, hand occupies 2.67s and "Hi" 1.93s, so the
     full cycle is 4.70s. Each roll itself eases out over ~550ms. */
  animation: badge-roll 4.7s infinite;
}
@keyframes badge-roll {
  /* roll up to the hand */
  0%     { transform: translateY(0);     animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  11.7%  { transform: translateY(-50%);  animation-timing-function: step-end; }
  /* hand holds (2.67s total occupancy) */
  56.7%  { transform: translateY(-50%);  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  /* roll back down to "Hi" */
  68.4%  { transform: translateY(0);     animation-timing-function: step-end; }
  /* "Hi" holds (1.93s total occupancy) */
  100%   { transform: translateY(0); }
}
.hero-badge .slot { display: grid; place-items: center; }
.hero-badge .slot-hi { font-size: 36px; font-weight: 500; line-height: 1; }
.hero-badge .slot-hand svg {
  width: 66px; height: 66px; fill: currentColor;
  transform: rotate(4.6deg);
  transform-origin: 50% 78%;      /* pivots at the wrist */
  animation: hand-wave 4.7s linear infinite;
}

/* The wave is locked to the roll cycle: same 4.7s duration, so it stays in
   phase. Nothing happens during the roll up (0 → 11.7%); the moment the hand
   lands it waves TWICE back to back, then holds still until the next roll.
   Gesture shape is frame-measured: 433ms each, rest +4.6 → dip -12 at 23% →
   swing +24.6 at 77% → back to rest. */
@keyframes hand-wave {
  0%, 11.7% { transform: rotate(4.6deg); }    /* still while it rolls up */
  13.8%     { transform: rotate(-12deg); }    /* wave 1: dip */
  18.8%     { transform: rotate(24.6deg); }   /* wave 1: swing */
  20.9%     { transform: rotate(4.6deg); }
  23.0%     { transform: rotate(-12deg); }    /* wave 2: dip */
  28.0%     { transform: rotate(24.6deg); }   /* wave 2: swing */
  30.1%     { transform: rotate(4.6deg); }
  100%      { transform: rotate(4.6deg); }    /* holds still */
}

@media (prefers-reduced-motion: reduce) {
  .hero-badge .slot-hand svg { animation: none; }
  .hero-badge .roll { animation: none; transform: translateY(-50%); }
}

/* ---------- nav: one pill shell, width morphs between states ---------- */
.site-nav {
  position: fixed; top: 14px; left: 50%; z-index: 8000;
  transform: translateX(-50%);
  background: rgba(15, 15, 15, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 99px;
  overflow: hidden;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav-full {
  display: flex; align-items: center; gap: 6px;
  /* max-content is load-bearing: while the shell is collapsed to the mini width
     this element would otherwise be squeezed to fit, its flex children would
     shrink, and scrollWidth would report the COMPRESSED width — which the JS
     then applies when expanding, permanently clipping the Contact button. */
  width: max-content;
  padding: 6px;
  white-space: nowrap;
}
/* perfectly round, and the source is a square face crop so the head fills it.
   40px against the 54px pill = 74% of its height, matching the template's ~73%
   (measured 44px avatar in a 60px pill) — it nearly fills the black shape. */
.nav-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.nav-full a.nav-link {
  flex: none; white-space: nowrap;
  padding: 8px 16px; border-radius: 99px;
  font-size: 14px; font-weight: 400; color: var(--muted);
  transition: color 0.2s ease, background 0.2s ease;
}
.nav-full a.nav-link:hover { color: var(--text); }
.nav-full a.nav-link.active { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.nav-cta {
  flex: none; white-space: nowrap;
  background: var(--text); color: var(--ink) !important;
  padding: 9px 22px; border-radius: 99px; font-size: 14px; font-weight: 500;
  transition: background 0.2s ease;
}
.nav-cta:hover { background: var(--lime); }

/* collapsed status pill — lives inside the same shell */
.nav-mini {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) translateY(10px);
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  /* extra right padding so the dot's 12px pulse ring has clearance — the nav
     shell is overflow:hidden for the width morph, so a tight edge clips it */
  padding: 6px 24px 6px 6px;
  font-size: 13px; color: var(--text);
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
/* the compact pill keeps the SAME 40px avatar — in the template it fills the
   black shape just as much when collapsed as when expanded */
.nav-mini .nav-avatar { width: 40px; height: 40px; }
.pulse-dot {
  /* display + flex:none are load-bearing: as a bare inline <span> width/height
     are ignored, and as a shrinkable flex item it squashes into an oval */
  display: inline-block; flex: none;
  width: 7px; height: 7px; border-radius: 50%; background: #0bde66;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(11, 222, 102, 0.6); }
  50% { box-shadow: 0 0 0 12px rgba(11, 222, 102, 0); }
}
.site-nav.is-mini .nav-full { opacity: 0; pointer-events: none; transform: translateY(-10px); }
.site-nav.is-mini .nav-mini { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
.nav-full { transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1); }

/* ---------- shared traveler card ---------- */
/* one card flies hero → build → about, flipping at 90° to swap its content */
.traveler {
  position: fixed; top: 0; left: 0; z-index: 600;
  width: var(--card-w); height: var(--card-h); /* fixed box — never animated */
  pointer-events: none;
  opacity: 0; transition: opacity 0.28s ease;
  transform-origin: center;
  will-change: transform; /* transform only: compositor-driven, no per-frame layout */
  backface-visibility: hidden;
}
.traveler.on { opacity: 1; }
/* Real two-faced 3D card: the browser decides which face is visible from the
   rotation, so there is no class-swapping at edge-on at all. Front carries the
   portrait, back carries profile.yaml pre-rotated 180° so it reads unmirrored. */
.traveler { transform-style: preserve-3d; }
.tv-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.tv-back { transform: rotateY(180deg); }
.tv-photo img {
  display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: top;
  border-radius: 24px;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.45);
}
.traveler .term { height: 100%; display: flex; flex-direction: column; }
.traveler .term-body { flex: 1; overflow: hidden; }
/* slots keep their layout box but hide content and lose tilt/sticky */
.hollow { position: relative !important; transform: none !important; }
.hollow > * { visibility: hidden !important; }

/* Desktop only: every slot is exactly the shared card box, so the traveler
   interpolates position but never size — no reflow, no aspect morphing. */
@media (min-width: 1025px) {
  .hero-card, .flip-media {
    width: var(--card-w); height: var(--card-h); flex: none;
  }
  .flip-media { align-self: start; }
}


/* ---------- first-paint intro ----------
   Measured from the recording (30fps): the photo card scales up from almost
   nothing while unfurling out of a 3D turn, and the headline fades in AND
   spreads outward from the centre. Card ramp: 36% @200ms, 69% @300, 90% @400,
   99% @633 — a strong ease-out. Headline: 5% @200ms, 50% @367, 95% @633.
   Only plays when the page opens at the top (JS adds .intro on <html>). */
html.intro .hero-left,
html.intro .hero-right { opacity: 0; }
html.intro-run .hero-left {
  animation: intro-slide-l 620ms cubic-bezier(0.16, 1, 0.3, 1) 60ms both;
}
html.intro-run .hero-right {
  animation: intro-slide-r 620ms cubic-bezier(0.16, 1, 0.3, 1) 60ms both;
}
@keyframes intro-slide-l {
  from { opacity: 0; transform: translateX(72px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes intro-slide-r {
  from { opacity: 0; transform: translateX(-72px); }
  to   { opacity: 1; transform: translateX(0); }
}
/* the eyebrow and the sub-paragraph trail the words slightly */
html.intro-run .hero-eyebrow { animation: intro-fade 520ms ease-out 200ms both; }
html.intro-run .hero-sub     { animation: intro-fade 520ms ease-out 260ms both; }
@keyframes intro-fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  html.intro .hero-left, html.intro .hero-right { opacity: 1; }
  html.intro-run .hero-left, html.intro-run .hero-right,
  html.intro-run .hero-eyebrow, html.intro-run .hero-sub { animation: none; }
}

/* ---------- reveals ---------- */
.rv {
  opacity: 0; transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--rvd, 0) * 90ms);
}
.rv.in { opacity: 1; transform: none; }
/* flip cards: the scroll spring owns transform — reveal fades opacity only,
   otherwise the reveal transition swallows every spring frame */
.rv[data-flip] { transition-property: opacity; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; transform: none; transition: none; }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(var(--nav-h) + 40px) 0 60px;
  overflow: hidden;
}
.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1fr minmax(300px, 380px) 1fr;
  align-items: center; gap: 24px;
}
.hero-eyebrow {
  font-family: var(--display); font-weight: 500; font-size: 20px;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--text);
  margin-bottom: 6px;
}
.hero-word {
  font-size: clamp(64px, 9.5vw, 132px);
  line-height: 1; letter-spacing: -0.03em; white-space: nowrap;
}
.hero-left { text-align: left; justify-self: end; }
/* Pull DATA left by its own side-bearing so its ink aligns with the name above.
   At 132px the "D" sits 8px inside its box while the 20px name sits 1px in —
   measured 7px of visual misalignment. Expressed in em so it holds as the
   clamped font-size shrinks. */
.hero-left .hero-word { margin-left: -0.053em; }
/* Nudge the right column out. The measured gap here (15px to SCIENTIST's ink)
   was already larger than the left (1.3px), but reads tighter because "S" is a
   solid vertical edge while "A" only approaches the photo at its baseline
   corner. +20px brings the perceived gap in line with the left side. */
.hero-right { text-align: left; justify-self: start; padding-left: 20px; }
.hero-sub {
  margin-top: 18px; max-width: 320px;
  color: var(--muted); font-size: 14px; line-height: 1.7;
}
.hero-card {
  position: relative;
  border-radius: 24px; overflow: visible;
  transform: rotate(-3deg);
  will-change: transform;
}
.hero-card img {
  border-radius: 24px;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: top; /* crop from the bottom, keep the head */
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.45);
}

/* ---------- section shell ---------- */
.section { padding: 110px 0; position: relative; }
.section-head { margin-bottom: 56px; }
.section-head .lead { margin-top: 18px; }

/* ---------- what I build (accordion) ---------- */
.build-grid {
  display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 64px; align-items: start;
}
.acc { border-top: 1px solid var(--line); }
.acc-item { border-bottom: 1px solid var(--line); position: relative; }
.acc-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 26px 4px; text-align: left; gap: 16px;
}
.acc-title {
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  font-size: clamp(20px, 2.2vw, 30px); letter-spacing: 0.01em;
  transition: color 0.25s ease;
}
.acc-item:hover .acc-title, .acc-item.open .acc-title { color: var(--lime); }
.acc-chev {
  flex: none; width: 30px; height: 30px; color: var(--muted);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), color 0.25s ease;
  display: flex; align-items: center; justify-content: center;
}
.acc-item.open .acc-chev { transform: rotate(180deg); color: var(--lime); }
.acc-body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.acc-body-inner { padding: 0 4px 28px; }
.acc-blurb { color: var(--muted); font-size: 15px; max-width: 560px; margin: 0 0 16px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card);
  padding: 7px 14px; font-size: 13.5px; font-weight: 400; color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.chip:hover { color: var(--lime); border-color: rgba(208, 255, 113, 0.4); }

/* flip media card (services / about / contact right column) */
.flip-media {
  position: sticky; top: 120px;
  border-radius: 24px;
  transform: rotate(2.5deg);
  will-change: transform;
}
.flip-media img {
  border-radius: 24px;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: top;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.45);
}

/* terminal card — profile.yaml (tuned to fit the shared card box exactly) */
.term {
  border-radius: 24px; overflow: hidden;
  border: 1px solid var(--line);
  background: #111112;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.45);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12.5px; line-height: 1.45;
}
.term-bar {
  display: flex; align-items: center; gap: 7px;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 12px 16px; color: var(--faint); font-size: 12px;
}
.term-bar i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.term-bar i:nth-child(1) { background: #ff5f57; }
.term-bar i:nth-child(2) { background: #febc2e; }
.term-bar i:nth-child(3) { background: #28c840; }
.term-bar span { margin-left: 8px; }
.term-body { padding: 15px 17px 17px; display: grid; gap: 8px; align-content: start; }
.term-row { display: grid; grid-template-columns: 84px 1fr; gap: 10px; }
.term-row .k { color: var(--lime); }
.term-row .v { color: var(--muted); overflow-wrap: anywhere; }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 64px; align-items: start; }
.stats-row { display: flex; gap: 56px; flex-wrap: wrap; margin: 44px 0 40px; }
.stat .num {
  font-family: var(--display); font-weight: 700; font-size: clamp(42px, 4.5vw, 60px);
  color: var(--lime); line-height: 1;
}
.stat .num .suffix { color: var(--lime); }
.stat .lbl { font-size: 13.5px; color: var(--muted); margin-top: 6px; font-weight: 400; }
.about-rows {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 40px; margin-bottom: 36px;
}
.about-row { font-size: 14.5px; padding: 7px 0; border-bottom: 1px dashed rgba(255,255,255,0.08); }
.about-row b { font-weight: 500; color: var(--text); }
.about-row span { color: var(--muted); }
.about-row a { color: var(--muted); border-bottom: 1px solid transparent; transition: color .2s ease; }
.about-row a:hover { color: var(--lime); }
.yaml-note {
  border-left: 2px solid var(--lime); padding: 4px 0 4px 18px; margin: 0 0 36px;
  color: var(--muted); font-size: 15px; font-style: italic;
}
.socials { display: flex; gap: 10px; margin-bottom: 36px; }
.socials a {
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.socials a:hover { color: var(--lime); border-color: rgba(208, 255, 113, 0.4); transform: translateY(-2px); }
.socials svg { width: 18px; height: 18px; fill: currentColor; }

/* pill buttons */
.btn-pill {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid var(--text); border-radius: 99px;
  padding: 12px 30px;
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  font-size: 15px; letter-spacing: 0.05em; color: var(--text);
  position: relative; overflow: hidden;
  transition: color 0.3s ease, border-color 0.3s ease;
}
.btn-pill:hover { color: var(--ink); border-color: var(--lime); }

/* ---------- blob fill on hover, shared by every button ----------
   Frame-measured from the recording: the fill sprouts at the LEFT edge and
   sweeps right with a CONVEX leading edge (~230ms), and on mouse-out it
   RETRACTS back to the left rather than carrying on rightwards (~270ms).
   A large circle sliding in from the left is what produces that curved edge —
   a scaling rectangle would give a flat one. Origin is fixed at the left
   regardless of where the pointer enters. */
.btn-pill,
.filters button,
.nav-cta,
.to-top {
  position: relative;
  overflow: hidden;
  isolation: isolate; /* keeps the z-index:-1 blob inside the button's own stack */
}
.btn-pill::before,
.filters button::before,
.nav-cta::before,
.to-top::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 130%; aspect-ratio: 1;   /* circle taller/wider than the pill => convex */
  border-radius: 50%;
  background: var(--lime);
  translate: -100% -50%;          /* parked just off the left edge */
  transition: translate 230ms ease-out;
  z-index: -1;
  pointer-events: none;
}
.btn-pill:hover::before,
.filters button:hover::before,
.nav-cta:hover::before,
.to-top:hover::before { translate: -12% -50%; }
/* leaving is the same path in reverse, a touch slower, as measured */
.btn-pill:not(:hover)::before,
.filters button:not(:hover)::before,
.nav-cta:not(:hover)::before,
.to-top:not(:hover)::before { transition-duration: 270ms; }

/* text flips as the fill arrives — the small delay lets the edge reach it first */
.btn-pill, .filters button, .nav-cta, .to-top {
  transition: color 180ms ease-out 40ms, border-color 200ms ease, background 200ms ease;
}
.filters button:hover { color: var(--ink); border-color: var(--lime); }
.filters button:hover .n { color: var(--ink); opacity: 0.6; }
.to-top:hover { color: var(--ink); }
/* already lime — nothing to fill */
.filters button.on::before { display: none; }
/* solid variants fill with the contrast colour instead */
.btn-pill.solid::before { background: var(--text); }
.nav-cta::before { background: var(--lime); }

.btn-pill.solid { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.btn-pill.solid:hover { border-color: var(--text); }

/* ---------- featured stack ---------- */
/* Pinned sticky stack, geometry measured frame-by-frame from the recording:
   pin offset 80px, card = container width at aspect 3:2 (so it deliberately
   overflows the viewport bottom and its lower corners are never seen), radius
   22px on the element itself, and the covered card SCALES 1 → 0.85 from its own
   centre with no dim and no blur. The incoming card is a pure translateY at
   full width — native sticky flow gives exactly that. */
.stack-zone { margin-top: 24px; }
.stack-item { position: sticky; top: 80px; }
.stack-card {
  position: relative; overflow: hidden;
  border-radius: 22px;
  width: 100%; aspect-ratio: 3 / 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  transform-origin: center center;
  will-change: transform;
}
.stack-card .cover {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
}
.stack-card .cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(22,22,23,0.25) 0%, rgba(22,22,23,0.72) 100%);
}
/* monogram cover for not-public work */
.cover-mono {
  position: absolute; inset: 0; z-index: 0;
  background:
    linear-gradient(rgba(208, 255, 113, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(208, 255, 113, 0.05) 1px, transparent 1px),
    var(--bg-2);
  background-size: 56px 56px, 56px 56px, auto;
  display: flex; align-items: center; justify-content: center;
}
.cover-mono span {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(160px, 26vw, 320px); line-height: 1;
  color: rgba(208, 255, 113, 0.1); text-transform: uppercase;
  user-select: none;
}
.stack-card > * { position: relative; z-index: 1; }
.cat-pill {
  display: inline-block;
  background: var(--lime); color: var(--ink);
  border-radius: 99px; padding: 4px 14px;
  font-size: 12px; font-weight: 500; letter-spacing: 0.02em;
  margin-bottom: 18px;
}
.stack-card h3 {
  font-weight: 700; font-size: clamp(30px, 4.4vw, 56px); line-height: 1.05;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}
.stack-card p { max-width: 560px; margin-top: 14px; color: rgba(255,255,255,0.85); font-size: 14.5px; }
.stack-tags { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 20px; }
.stack-tags .chip { background: rgba(22,22,23,0.55); backdrop-filter: blur(4px); }
.status-chip {
  position: absolute; top: 20px; right: 20px; z-index: 2;
  border: 1px solid var(--line); border-radius: 99px;
  background: rgba(22, 22, 23, 0.6); backdrop-filter: blur(6px);
  padding: 5px 14px; font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
}
.stack-lock {
  margin-top: 22px; font-size: 12.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
  display: inline-flex; align-items: center; gap: 7px;
}

/* ---------- all projects grid ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 40px 0 36px; }
.filters button {
  border: 1px solid var(--line); border-radius: 99px;
  padding: 9px 20px; font-size: 13.5px; color: var(--muted);
  display: inline-flex; gap: 8px; align-items: center;
}
.filters button .n { font-size: 11px; color: var(--faint); }
.filters button.on { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.filters button.on .n { color: var(--ink); opacity: 0.6; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.pcard {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.3s ease, opacity 0.35s ease;
  position: relative;
}
.pcard:hover { transform: translateY(-6px); border-color: rgba(208, 255, 113, 0.35); }
.pcard.hide { display: none; }
.pcard-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.pcard-media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.pcard:hover .pcard-media img { transform: scale(1.06); }
.pcard-media .cover-mono span { font-size: 92px; }
.pcard-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.pcard-cat { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--lime); font-weight: 500; }
.pcard h4 {
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  font-size: 21px; line-height: 1.15; letter-spacing: 0.01em;
}
.pcard p { font-size: 13.5px; color: var(--muted); flex: 1; }
.pcard-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pcard-tags span {
  font-size: 11px; color: var(--faint); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 8px;
}
.pcard-foot {
  margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint);
  display: flex; align-items: center; gap: 7px;
}
.pcard-foot.linked { color: var(--lime); }
.pcard .status-chip { top: 14px; right: 14px; }
.pcard a.cover-link { position: absolute; inset: 0; z-index: 3; }
/* sits above the full-card overlay link so both targets are clickable */
.pcard-repo {
  position: relative; z-index: 4; margin-left: auto;
  color: var(--faint); text-decoration: underline;
  letter-spacing: 0.08em; text-transform: uppercase; font-size: 11.5px;
}
.pcard-repo:hover { color: var(--lime); }

/* ---------- testimonials ----------
   Geometry measured from the recording: 3 × 2 grid, equal cards, 25px gaps in a
   1400px container (scaled to our 1120px), ~22px radius, 5 accent stars top-left,
   and the two stat cards sitting on a DIAGONAL (row1/col3 light, row2/col1 accent). */
.tst-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.tst {
  border-radius: 22px; background: var(--card);
  border: 1px solid var(--line);
  padding: 30px 32px; min-height: 238px;
  display: flex; flex-direction: column;
}
.tst-stars { display: flex; gap: 5px; margin-bottom: 16px; }
.tst-stars svg { width: 15px; height: 15px; fill: var(--lime); }
.tst q { quotes: none; font-size: 14.5px; line-height: 1.6; color: var(--muted); flex: 1; }
.tst-who { display: flex; align-items: center; gap: 11px; margin-top: 22px; }
.tst-av {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: #fff;
}
.tst-name { font-size: 13.5px; font-weight: 500; }
.tst-role { font-size: 12px; color: var(--faint); }
/* stat cards */
.tst.is-stat { justify-content: center; }
.tst.is-stat .n {
  font-family: var(--display); font-weight: 700; line-height: 1;
  font-size: clamp(46px, 5vw, 66px);
}
.tst.is-stat .k { font-size: 13px; margin-top: 8px; opacity: 0.65; }
.tst.is-stat .cap { font-size: 13px; margin-bottom: 14px; opacity: 0.7; max-width: 240px; }
.tst.is-light { background: #fff; border-color: #fff; color: var(--ink); }
.tst.is-lime { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.tst-src { font-size: 13px; color: var(--faint); margin-top: 22px; }
.tst-src a { color: var(--muted); text-decoration: underline; }
.tst-src a:hover { color: var(--lime); }
@media (max-width: 1024px) { .tst-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .tst-grid { grid-template-columns: 1fr; } }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 64px; align-items: center; }
.contact-rows { margin: 36px 0; display: grid; gap: 4px; }
.contact-row {
  display: flex; align-items: baseline; gap: 14px;
  padding: 12px 0; border-bottom: 1px dashed rgba(255,255,255,0.08);
  font-size: 15px;
}
.contact-row .k { width: 92px; flex: none; font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.contact-row a:hover { color: var(--lime); }


/* ---------- enquiry form ---------- */
.enq { display: grid; gap: 16px; max-width: 640px; }
.enq-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.enq-field { display: grid; gap: 7px; }
.enq-field label {
  font-size: 13.5px; font-weight: 500; color: var(--lime);
}
.enq-field input,
.enq-field select,
.enq-field textarea {
  font-family: var(--body); font-size: 15px; font-weight: 300;
  color: var(--text);
  background: #333335;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 14px 16px;
  width: 100%;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.enq-field textarea { resize: vertical; min-height: 132px; border-radius: 16px; }
.enq-field input::placeholder,
.enq-field textarea::placeholder { color: #8f8f92; }
.enq-field select { appearance: none; cursor: pointer; padding-right: 44px;
  /* chevron drawn inline so no icon font is needed */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none' stroke='%23b5b5b5' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M1 1l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 18px center;
}
.enq-field select option { background: #2a2a2c; color: var(--text); }
.enq-field input:focus,
.enq-field select:focus,
.enq-field textarea:focus {
  outline: none; border-color: var(--lime); background: #3a3a3c;
}
.enq-field input:user-invalid,
.enq-field textarea:user-invalid { border-color: #e0665f; }
.enq-submit { justify-self: start; margin-top: 4px; }
.enq-note { font-size: 13.5px; color: var(--muted); min-height: 1.2em; margin: 0; }
.enq-note.err { color: #e0865f; }
.enq-alt { margin-top: 26px; font-size: 13.5px; color: var(--faint); }
.enq-alt a { color: var(--muted); text-decoration: underline; }
.enq-alt a:hover { color: var(--lime); }
@media (max-width: 700px) { .enq-row { grid-template-columns: 1fr; } }

/* ---------- footer ---------- */
.site-foot { background: var(--lime); color: var(--ink); margin-top: 60px; }
.foot-inner {
  display: flex; flex-wrap: wrap; gap: 14px 32px;
  align-items: center; justify-content: space-between;
  /* single row now, so the bar only needs enough height to breathe */
  padding: 18px 24px;
  max-width: var(--container); margin: 0 auto;
  font-size: 13.5px;
}
.foot-inner a { font-weight: 500; }
.foot-inner a:hover { text-decoration: underline; }
.foot-social { display: flex; gap: 16px; }
.foot-social a { display: flex; }
.foot-social svg { width: 18px; height: 18px; fill: var(--ink); }

/* ---------- back to top ---------- */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 8000;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease, background 0.2s ease;
}
.to-top.show { opacity: 1; pointer-events: auto; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .hero-word { font-size: clamp(52px, 9vw, 96px); }
  .build-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; gap: 48px; }
  .flip-media { position: relative; top: 0; max-width: 420px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .site-nav { max-width: calc(100vw - 12px); }
  .nav-full { width: auto; overflow-x: auto; scrollbar-width: none; }
  .nav-full::-webkit-scrollbar { display: none; }
  .hero { padding-top: 120px; }
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-left, .hero-right { justify-self: center; text-align: center; }
  .hero-card { max-width: 300px; margin: 8px auto; }
  .hero-sub { margin-left: auto; margin-right: auto; }
  .hero-word { white-space: normal; }
  .nav-full a.nav-link { padding: 8px 10px; font-size: 13px; }
  .nav-cta { padding: 8px 14px; }
  .grid { grid-template-columns: 1fr; }
  .section { padding: 72px 0; }
  .stack-card { height: auto; min-height: 420px; }
  .about-rows { grid-template-columns: 1fr; }
  .foot-inner { justify-content: flex-start; }
}
