/* ============================================================
   Base — reset, type, buttons, cursor, reveal utilities
   ============================================================ */

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-ui);
  font-weight: var(--body-weight);
  letter-spacing: var(--body-letter-spacing);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  cursor: none;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

h1, h2, h3, h4, h5 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-letter-spacing);
  line-height: var(--heading-line-height);
}
h1 em, h2 em, h3 em, h4 em { font-style: italic; font-weight: 500; }
p { margin: 0; }

button {
  font-family: inherit;
  cursor: none;
  border: 0;
  background: none;
  color: inherit;
  padding: 0;
}

a, button, input, textarea, [role="button"] { cursor: none; }

::selection { background: var(--blue); color: var(--white); }

/* Focus -------------------------------------------------- */
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 2px; }

/* Custom cursor -----------------------------------------
   Colour is driven by one --cursor-color variable so the light/dark
   inversion and the PXL game's colour cycling are single-line edits. */
body { --cursor-color: var(--blue); transition: --cursor-color .18s ease; }
body.cursor-light { --cursor-color: var(--ink); }

.cursor, .cursor-trail {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  will-change: transform;
}
.cursor svg { transition: transform .18s cubic-bezier(.2,.8,.2,1); }
.cursor-trail {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cursor-color);
  opacity: .55;
  transition: transform .25s cubic-bezier(.2,.8,.2,1),
              width .2s, height .2s, background .2s;
}
body.cursor-hover .cursor svg { transform: scale(1.5); }
body.cursor-hover .cursor-trail {
  width: 44px; height: 44px;
  opacity: .12;
}

@media (hover: none) {
  html, body, a, button { cursor: auto; }
  .cursor, .cursor-trail { display: none; }
}

/* ----------------------------------------------------------
   PXL pixel game
     .pxl-pixel  — placed target (hunt these)
     .pxl-drop   — transient pixel dropped when clicking empty space
   Pixels are deliberately tiny + subtly pulsing; positioned in the
   quiet parts of each section via --pxl-x/--pxl-y set inline by JS.
   ---------------------------------------------------------- */
.pxl-pixel {
  position: absolute;
  top: var(--pxl-y, 50%);
  left: var(--pxl-x, 50%);
  width: 6px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 1px;
  background: var(--cursor-color, var(--blue));
  opacity: .55;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .06);
  cursor: none;
  z-index: 4;
  transform: translate(-50%, -50%);
  animation: pxl-pulse 2.4s ease-in-out infinite;
  animation-delay: var(--pxl-delay, 0s);
  transition: opacity .2s, transform .2s, box-shadow .2s;
}
.pxl-pixel:hover {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.8);
  box-shadow: 0 0 0 1px currentColor, 0 0 14px currentColor;
}
.pxl-pixel.is-shot {
  opacity: 0;
  transform: translate(-50%, -50%) scale(3.2);
  animation: none;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0);
  transition: opacity .4s, transform .4s, box-shadow .4s;
}
/* Lightweight pulse — not distracting */
@keyframes pxl-pulse {
  0%, 100% { opacity: .35; }
  50%      { opacity: .8; }
}

/* Transient drop left behind on an empty-area click or while spraying */
.pxl-drop {
  position: fixed;
  width: 4px;
  height: 4px;
  border-radius: 1px;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, 0);
  animation: pxl-drop 1.5s ease-out forwards;
}
@keyframes pxl-drop {
  0%   { opacity: 1; transform: translate(-50%, 0) scale(1); }
  70%  { opacity: .7; transform: translate(-50%, 6px) scale(1); }
  100% { opacity: 0;  transform: translate(-50%, 14px) scale(.6); }
}

/* Burst targets — spawned en masse when the user clicks the "shoot
   our pxls" CTA. Slightly bigger than regular targets and with a
   staggered pop-in so they land like confetti. */
.pxl-pixel--burst {
  width: 8px; height: 8px;
  opacity: 0;
  animation:
    pxl-burst-in .45s cubic-bezier(.2,.8,.2,1) var(--pxl-delay, 0s) forwards,
    pxl-pulse 2.4s ease-in-out infinite calc(var(--pxl-delay, 0s) + 1.2s);
}
@keyframes pxl-burst-in {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1.25); }
  100% { opacity: .7; transform: translate(-50%, -50%) scale(1); }
}

/* ----------------------------------------------------------
   "+1" flash next to the nav counter — fires on every shot.
   Positioned fixed with coords set inline by flashPlusOne() from
   the counter's live bounding rect, so it always anchors correctly.
   ---------------------------------------------------------- */
.pxl-plus-one {
  position: fixed;
  z-index: 60;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .14em;
  color: var(--blue);
  pointer-events: none;
  animation: pxl-plus-one .9s cubic-bezier(.2, .8, .2, 1) forwards;
}
@keyframes pxl-plus-one {
  0%   { opacity: 0; transform: translateY(4px);  }
  20%  { opacity: 1; transform: translateY(0);    }
  100% { opacity: 0; transform: translateY(-14px); }
}

/* The shared conic-spin keyframe is still needed by the ✦ on the
   "shoot our pxls" CTA, so keep it around. */
@keyframes pxl-reveal-spin { to { rotate: 360deg; } }

/* ----------------------------------------------------------
   Tetris cluster — three bigger pixels in the bottom-right of the
   work hero, arranged as an L-tetromino. Larger + more opaque than
   the standard scattered targets so they read as a deliberate
   decorative detail rather than easter-egg dots.
   ---------------------------------------------------------- */
.pxl-pixel--tetris {
  width: 26px;
  height: 26px;
  /* override the default %-based positioning — tetris cells use
     right/bottom set inline so they lock to the corner */
  top: auto;
  left: auto;
  transform: none;
  border-radius: 3px;
  opacity: .9;
  /* Colour is set inline per cell (ink / mid-grey / warm-grey) */
  background: var(--ink);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
  animation-duration: 3s;  /* slower pulse than default, calmer */
}
.pxl-pixel--tetris:hover {
  opacity: 1;
  transform: scale(1.12);
  box-shadow: 0 0 0 2px currentColor, 0 0 18px rgba(0, 0, 0, .2);
}
.pxl-pixel--tetris.is-shot {
  opacity: 0;
  transform: scale(2.6);
  animation: none;
}

/* ----------------------------------------------------------
   "Shoot our pxls" secondary CTA on the contact section
   ---------------------------------------------------------- */
.pxl-shoot-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 10px 16px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #fff;
  background: transparent;
  border: 1px solid var(--border);
  cursor: none;
  transition: background .2s, color .2s, border-color .2s;
}
.pxl-shoot-cta:hover {
  background: var(--cream);
  color: var(--ink);
  border-color: var(--cream);
}
.pxl-shoot-cta .ast {
  display: inline-block;
  animation: pxl-reveal-spin 3.5s linear infinite;
  color: currentColor;
}

/* ----------------------------------------------------------
   Splatter banner — triggered by the `P` shortcut. One of the few
   places we keep text in the game on purpose (so the shortcut is
   self-explanatory). Has an × close button for quick dismiss. */
.pxl-banner {
  position: fixed;
  top: clamp(84px, 10vh, 120px);
  left: 50%;
  transform: translate(-50%, -8px);
  opacity: 0;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(17, 17, 17, .78);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .2);
  animation: pxl-banner-enter .35s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes pxl-banner-enter {
  to { opacity: 1; transform: translate(-50%, 0); }
}
.pxl-banner.is-exiting {
  animation: pxl-banner-exit .3s ease-out forwards;
}
@keyframes pxl-banner-exit {
  to { opacity: 0; transform: translate(-50%, -6px); }
}
.pxl-banner__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 3px rgba(91, 90, 255, .18);
}
.pxl-banner__close {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .2);
  background: transparent;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 300;
  line-height: 1;
  cursor: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .2s, border-color .2s;
}
.pxl-banner__close:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .45); }

@media (hover: none) {
  .pxl-pixel--burst, .pxl-shoot-cta, .pxl-banner { display: none; }
}

@media (hover: none) {
  /* Hide the PXL game's shoot-targets and hover drops on touch
     devices — the game needs hover to be playable. We target the
     game pixels via their `[data-pxl-pixel]` attribute (set by
     spawnInSection / spawnTetrisCluster / burst spawn in app.js)
     so the hero PixelGrid pixels — which share the `.pxl-pixel`
     class but are decorative-only and have no `data-pxl-pixel`
     attribute — stay visible on mobile. Pre-fix this rule used the
     bare `.pxl-pixel` selector and silently hid the entire hero
     grid the moment the page picked up `(hover: none)`, which is
     why the grid appeared for a frame then vanished on touch
     devices and Chrome DevTools mobile emulation. */
  [data-pxl-pixel], .pxl-drop { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pxl-pixel { animation: none; }
  .pxl-drop  { animation-duration: .3s; }
}

/* Reveal on scroll -------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .8s cubic-bezier(.2,.8,.2,1),
              transform .8s cubic-bezier(.2,.8,.2,1);
}
[data-reveal].in { opacity: 1; transform: none; }
[data-reveal-delay="1"] { transition-delay: .08s; }
[data-reveal-delay="2"] { transition-delay: .16s; }
[data-reveal-delay="3"] { transition-delay: .24s; }
[data-reveal-delay="4"] { transition-delay: .32s; }

/* Buttons (Inter Tight 500, pill, per brief) ----------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-weight: var(--button-weight);
  font-size: 14px;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  transition: transform .2s, background .2s, color .2s, border-color .2s, filter .2s;
  border: 1px solid transparent;
}
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn-secondary { background: transparent; color: #fff; border-color: #fff; }
.btn-secondary:hover { background: #fff; color: #111; }
.light .btn-secondary { border-color: var(--ink); color: var(--ink); }
.light .btn-secondary:hover { background: var(--ink); color: #fff; }
.btn .arr { display: inline-block; transition: transform .25s; }
.btn:hover .arr { transform: translateX(3px); }

/* ----------------------------------------------------------
   Liquid-glass chip — shared overlay tag for card badges
   (industry label, partner label, etc.). Used by both the
   homepage selected-work grid and the /work listing grid so
   the tags always stay readable against any image or video.
     · translucent dark layer underneath keeps white text legible
     · blur + saturation lifts the image tone into a frost
     · single crisp border, no drop shadow
   ---------------------------------------------------------- */
.pcard__badge,
.pcard__partner,
.proj .ph-badge,
.proj .ph-partner {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  line-height: 1;
  color: #ffffff;
  background: rgba(17, 17, 17, .55);
  border: 1px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  white-space: nowrap;
}
/* Light-context override — when the chip sits on a light background
   (e.g. a card with a pale image or on a light section), the dark ink
   body stays legible but the border flips to an ink-tinted line so it
   still reads. Pages using `.on-light` regions can apply this variant. */
.on-light .pcard__badge,
.on-light .pcard__partner,
.on-light .proj .ph-badge,
.on-light .proj .ph-partner {
  border-color: rgba(15, 15, 15, .18);
}
.pcard__badge,
.proj .ph-badge      { top: 14px; right: 14px; }
.pcard__partner,
.proj .ph-partner    { top: 14px; left: 14px; }
.pcard__partner::before,
.proj .ph-partner::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fff;
  flex: 0 0 6px;
}

/* Pill wrapper — when a card has BOTH a partner pill and a badge they
   used to be positioned individually (top-left + top-right) and could
   overlap on narrower cards if either label was long ("Delivered with
   SoBold" + "Professional Services" was the failure case). With a
   wrapper we keep them on one row when they fit and let them wrap to
   stacked rows when they don't. The trick: each pill sets its own
   margin-auto so it stays aligned to its edge whether wrapped or not.
   `pointer-events: none` on the wrapper lets clicks pass through to
   the underlying card link; we re-enable on the pills themselves. */
.pcard__pills,
.proj .ph__pills {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: none;
}
.pcard__pills > *,
.proj .ph__pills > * { pointer-events: auto; }
/* Inside the wrapper the individual pills become flow items rather
   than absolutely-positioned. Reset the position so the wrapper drives
   layout end-to-end. */
.pcard__pills .pcard__badge,
.pcard__pills .pcard__partner,
.proj .ph__pills .ph-badge,
.proj .ph__pills .ph-partner {
  position: static;
  top: auto; left: auto; right: auto;
}
/* Edge alignment via auto margins so partner stays left and badge
   stays right whether they share a row or wrap onto separate rows. */
.pcard__pills .pcard__partner,
.proj .ph__pills .ph-partner { margin-right: auto; }
.pcard__pills .pcard__badge,
.proj .ph__pills .ph-badge   { margin-left: auto; }
/* Long-label safety: if one pill alone is wider than the card width,
   let it shrink and ellipsis rather than push past the card edge. */
.pcard__pills > *,
.proj .ph__pills > * {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Eyebrow + rules --------------------------------------- */
.eye, .eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.hr { height: 1px; background: var(--border); border: 0; margin: 0; }

/* Prefers reduced motion ------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}

/* ============================================================
   Toast — non-blocking status pill.
   Fired from components.js' showToast() helper. Used today for
   "Email copied to clipboard" confirmations on mailto: clicks.
   ============================================================ */
.pxl-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  z-index: 300;
  padding: 10px 16px;
  background: #111111;
  color: #ffffff;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s cubic-bezier(.2, .8, .2, 1);
}
.pxl-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
