/* ============================================================
   Joey Belango — full-screen portfolio
   ============================================================ */

:root {
  --bg: #0a0a0a;
  --frame: #1c1c1e;
  --card: #1a1a1c;
  --card-hover: #262629;
  --text: #f5f5f7;
  --muted: #8a8a90;
  --accent: #3b82f6;

  /* One easing + duration used everywhere for a consistent, silky feel.
     transforms/opacity only => GPU compositing => 120fps-ready. */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.55s;

  /* Relaxed, iOS-like settle: eases out long and soft, no hard stop.
     Used for the card enlarge so motion feels like it's breathing. */
  --ease-relax: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-relax: 0.85s;

  /* Liquid-glass surface tokens */
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-bg-hover: rgba(255, 255, 255, 0.11);
  --glass-border: rgba(255, 255, 255, 0.16);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;               /* website is one full screen, never scrolls */
  background: #000;
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Outer frame (the dark border in the mockup) ---- */
.frame {
  position: fixed;
  inset: 10px;
  border-radius: 6px;
  background: var(--bg);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04);
}

/* ---- Per-page background layer ---- */
.bg-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
}
/* Two stacked slides; we fade the incoming one in over the outgoing one. */
.bg-slide {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1.1s var(--ease);
  will-change: opacity;
}
.bg-slide.show { opacity: 1; }

/* ---- Fade-to-black transition overlay ---- */
.fade-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s var(--ease);
  will-change: opacity;
}
.fade-overlay.active { opacity: 1; }

/* ---- Top bar ---- */
.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 46px 64px;
}
.logo {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text);
  text-decoration: none;
  transition: opacity 0.3s var(--ease);
}
.logo:hover { opacity: 0.7; }

.socials { display: flex; gap: 22px; }
.social {
  color: var(--muted);
  width: 22px; height: 22px;
  display: inline-flex;
  transition: color 0.3s var(--ease), transform 0.3s var(--ease);
  will-change: transform;
}
.social svg { width: 100%; height: 100%; }
.social:hover { color: var(--text); transform: translateY(-2px); }

/* ---- Stage: centered, full-screen section area ---- */
.stage {
  position: absolute;
  inset: 0;
  z-index: 20;
}
/* the safe area sections live in — clear of the topbar and the boxes */
.sections {
  position: absolute;
  top: 118px;
  bottom: 180px;
  left: 7%;
  right: 7%;
}

/* each section is a centered slide; only the active one is shown */
.section {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 14px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(26px);
  transition:
    opacity 0.6s var(--ease),
    transform 0.7s var(--ease),
    visibility 0.6s var(--ease);
  pointer-events: none;
  will-change: opacity, transform;
}
.section.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
.section > * { max-width: 780px; width: 100%; }

.title {
  font-size: clamp(44px, 6.5vw, 100px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 0;
}

/* live viewers badge, bottom-left */
.viewers {
  position: absolute;
  left: 44px;
  bottom: 26px;
  z-index: 26;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 15px;
  border-radius: 999px;
  background: rgba(14,14,16,0.6);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 13px;
  color: var(--muted);
}
.viewers #viewersCount { color: var(--text); font-weight: 600; }
.viewers-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  animation: pulse-dot 2.2s var(--ease) infinite;
}
@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0 rgba(46,204,113,0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(46,204,113,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,204,113,0); }
}

/* scroll cue, bottom-center */
.scroll-hint {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.8;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}
.scroll-hint.hide { opacity: 0; }
.scroll-hint svg { width: 18px; height: 18px; animation: bob 1.8s var(--ease) infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

.content {
  font-size: 16px;
  line-height: 1.7;
  color: var(--muted);
}
.content p { margin-bottom: 16px; }
/* keep body copy readable and centered, cards/grids use more width */
.content > p { max-width: 640px; margin-left: auto; margin-right: auto; }
.content > ul { max-width: 460px; margin: 0 auto 16px; }
.content h2 {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 26px 0 12px;
}
.content a { color: var(--accent); text-decoration: none; }
.content a:hover { text-decoration: underline; }
.content ul { list-style: none; }
.content li { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.06); color: var(--text); }
.content li span { color: var(--muted); float: right; font-size: 14px; }
.content em { color: var(--text); font-style: normal; border-bottom: 1px solid var(--accent); }

/* lead / intro paragraph */
.lead {
  font-size: 19px;
  line-height: 1.6;
  color: var(--text);
  margin: 0 auto;
  max-width: 620px;
}

/* case-study cards — spread across the width in a responsive grid */
.cases {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 6px auto 0;
  max-width: 780px;
}
.case-card {
  text-align: left;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  padding: 16px 18px;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease), transform 0.4s var(--ease);
  will-change: transform;
}
.case-card:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.20);
  transform: translateY(-2px);
}
.case-tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.case-card h3 { color: var(--text); font-size: 17px; font-weight: 600; margin: 0 0 2px; }
.case-card .metric { color: var(--accent); font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.case-card p { margin: 0; font-size: 14px; color: var(--muted); }

/* CTA */
.cta { margin: 30px 0 10px; }
.cta p { margin-bottom: 14px; }
.cta-btn {
  display: inline-block;
  padding: 13px 26px;
  border-radius: 999px;
  background: var(--text);
  color: #0a0a0a !important;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none !important;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), opacity 0.3s var(--ease);
}
.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 34px rgba(255,255,255,0.18);
  opacity: 0.92;
}

/* ---- Projects board: tiles + sticky hover panel ---- */
.section > .projects { max-width: 960px; }
.projects {
  display: flex;
  gap: 36px;
  align-items: stretch;
  justify-content: center;
  text-align: left;
  width: 100%;
}
.project-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 0 0 auto;
}
.project-item {
  text-align: left;
  min-width: 230px;
  padding: 18px 22px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease), transform 0.35s var(--ease-relax);
}
.project-item:hover,
.project-item.active {
  background: rgba(255,255,255,0.11);
  border-color: rgba(255,255,255,0.4);
}

.project-stage {
  position: relative;
  flex: 1 1 340px;
  min-width: 300px;
  display: flex;
  align-items: center;
}
.proj-hint {
  color: var(--muted);
  font-size: 15px;
  transition: opacity 0.3s var(--ease);
}
.proj-hint.hide { opacity: 0; }

.project-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 26px 28px;
  border-radius: 18px;
  background: rgba(14,14,16,0.62);
  border: 1px solid rgba(255,255,255,0.12);
  opacity: 0;
  transform: translateX(14px);
  pointer-events: none;
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease-relax);
}
.project-panel.show { opacity: 1; transform: translateX(0); pointer-events: auto; }
.project-panel .proj-title { font-size: 22px; font-weight: 600; color: var(--text); margin: 0 0 6px; }
.project-panel .proj-desc { color: var(--muted); font-size: 15px; margin: 0 0 18px; }
.proj-links { display: flex; flex-direction: column; gap: 10px; }
.proj-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 17px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text);
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.3s var(--ease-relax);
}
.proj-link:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.32); transform: translateX(3px); }
.proj-link .arrow { color: var(--muted); }

/* back link on sub-pages */
.back-link {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.3s var(--ease);
}
.back-link:hover { color: var(--text); }

/* ---- Website projects: horizontal card slider (center biggest) ---- */
.section > .sites { max-width: 1120px; width: 100%; }
.sites-title {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 22px;
}
.slider {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 420px;                  /* room for the enlarged card, no vertical cut */
  overflow-x: auto;
  overflow-y: visible;
  padding: 30px 10px;
  scrollbar-width: none;              /* Firefox */
  -ms-overflow-style: none;
  scroll-snap-type: x proximity;
  /* feather so the outer (~1st & 5th) cards fade to low opacity, no hard cut */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 20%, #000 80%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 20%, #000 80%, transparent 100%);
}
.slider::-webkit-scrollbar { width: 0; height: 0; display: none; }

.slide-card {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 190px;
  height: 270px;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  scroll-snap-align: center;
  transition: width 0.55s var(--ease-relax), height 0.55s var(--ease-relax);
}
/* the big "center" state only applies to whichever card is hovered */
.slider:hover .slide-card { width: 176px; height: 250px; }
.slider:hover .slide-card:hover { width: 250px; height: 360px; }

.slide-info {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px 20px;
  background: linear-gradient(to top, rgba(0,0,0,0.78), rgba(0,0,0,0));
}
.slide-tag {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.slide-name { margin: 0; font-size: 18px; font-weight: 600; color: var(--text); }

/* ---- Multimedia: scrollable masonry of glass-framed cards ---- */
.section > .gallery { max-width: 1000px; width: 100%; }
.gallery-scroll {
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 6px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* soft feather top & bottom so cards fade in/out at the edges */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 7%, #000 93%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 7%, #000 93%, transparent 100%);
}
.gallery-scroll::-webkit-scrollbar { width: 0; height: 0; display: none; }

.masonry {
  column-count: 3;
  column-gap: 16px;
}
.m-card {
  break-inside: avoid;
  margin-bottom: 16px;
  padding: 10px;                 /* the glass frame */
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 10px 30px rgba(0,0,0,0.35);
}
.m-img {
  width: 100%;
  display: block;
  border-radius: 10px;
  /* hidden until it scrolls into view */
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.6s var(--ease), transform 0.75s var(--ease-relax);
}
.m-card.in .m-img { opacity: 1; transform: scale(1); }
.m-cap {
  margin: 9px 2px 2px;
  font-size: 13px;
  color: var(--muted);
}

/* skills / tools card with pill chips */
.skill-card {
  text-align: left;
  max-width: 780px;
  margin: 0 auto;
  padding: 30px 32px 32px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 22px;
}
.skill-card .skill-title {
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.14);
}
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 9px 17px;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 999px;
  font-size: 14.5px;
  line-height: 1;
  color: var(--text);
  white-space: nowrap;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.3s var(--ease-relax);
}
.pill:hover {
  background: rgba(255,255,255,0.12);
  border-color: #fff;
  transform: translateY(-2px);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* boxes zoom in + fade as they return to position */
@keyframes cardIn {
  from { opacity: 0; transform: scale(0.82) translateY(14px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---- Left vertical square nav ---- */
.cards-viewport {
  position: absolute;
  left: 44px;
  top: 50%;
  z-index: 25;
  transform: translateY(-50%);
  /* the whole dock slides out to the left during page transitions */
  transition: transform var(--dur) var(--ease-relax), opacity var(--dur) var(--ease-relax);
  will-change: transform;
}
.cards-viewport.exit { transform: translateY(-50%) translateX(-180%); opacity: 0; }

.cards {
  display: flex;
  flex-direction: column;
  gap: 18px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.card {
  position: relative;
  --size: 62px;                    /* small, equal square */
  width: var(--size);
  height: var(--size);
  flex: 0 0 auto;
  border-radius: 16px;
  cursor: pointer;

  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.28),
    inset 0 -1px 0 rgba(255,255,255,0.05),
    0 8px 24px rgba(0,0,0,0.35);

  /* enlarge smoothly on hover (width/height so the label doesn't distort) */
  transition:
    width var(--dur-relax) var(--ease-relax),
    height var(--dur-relax) var(--ease-relax),
    background var(--dur-relax) var(--ease-relax),
    border-color var(--dur-relax) var(--ease-relax),
    box-shadow var(--dur-relax) var(--ease-relax);
  will-change: transform;
}

/* image layer — shows the same background as the card's page */
.card-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
  transition: filter var(--dur-relax) var(--ease-relax);
}
.card:hover .card-bg { filter: brightness(1.14); }

/* specular highlight + sheen for the glass feel */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background:
    radial-gradient(120% 90% at 20% 0%, rgba(255,255,255,0.30), rgba(255,255,255,0) 55%),
    radial-gradient(100% 70% at 90% 110%, rgba(120,170,255,0.18), rgba(255,255,255,0) 55%);
  opacity: 0.55;
  transition: opacity var(--dur-relax) var(--ease-relax);
  pointer-events: none;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0) 45%);
  opacity: 0;
  transition: opacity var(--dur-relax) var(--ease-relax);
  pointer-events: none;
}

/* enlarge on hover (a bit bigger, not huge) */
.card:hover {
  --size: 104px;
  background: var(--glass-bg-hover);
  border-color: rgba(255,255,255,0.30);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.40),
    inset 0 -1px 0 rgba(255,255,255,0.08),
    0 22px 60px rgba(0,0,0,0.55);
}
.card:hover::before { opacity: 1; }
.card:hover::after  { opacity: 1; }

/* the active page's square: highlighted, same size */
.card.active {
  background: var(--glass-bg-hover);
  border-color: rgba(255,255,255,0.45);
}
.card.active::before { opacity: 0.85; }

/* label appears to the right of the square on hover */
.card-label {
  position: absolute;
  z-index: 3;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  padding: 7px 14px;
  border-radius: 10px;
  background: rgba(14,14,16,0.82);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.35s var(--ease-relax);
}
.card:hover .card-label { opacity: 1; transform: translateY(-50%) translateX(0); }

/* ---- Right-side section dots ---- */
.dots {
  position: absolute;
  right: 46px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}
.dot {
  width: 11px;
  height: 11px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.55);
  background: transparent;
  cursor: pointer;
  transition: transform 0.4s var(--ease-relax), background 0.4s var(--ease), border-color 0.4s var(--ease);
}
.dot:hover { border-color: #fff; transform: scale(1.2); }
.dot.active {
  background: #fff;
  border-color: #fff;
  transform: scale(1.35);
}

/* ============================================================
   Glitch text effect
   Usage: <span class="glitch" data-text="WORD">WORD</span>
   (data-text must match the visible text)
   ============================================================ */
/* The word rests calm, then hard-glitches for ~0.6s every 5s:
   white slices shift sideways with red/cyan channel split.
   Change the interval by editing the three 5s durations below. */
.glitch {
  position: relative;
  display: inline-block;
  color: inherit;
  animation: glitch-skew 5s infinite steps(1, end);
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;                       /* hidden between bursts */
  background: inherit;              /* copies sit over the base word */
  color: #fff;                      /* displaced slices are white... */
}
.glitch::before {
  text-shadow: -3px 0 #ff2d3b;     /* ...with a red channel to the left */
  animation: glitch-red 5s infinite steps(1, end);
}
.glitch::after {
  text-shadow: 3px 0 #12e6ff;      /* ...and cyan to the right */
  animation: glitch-cyan 5s infinite steps(1, end);
}

/* RED channel — rapid, blocky slice displacement inside the burst window */
@keyframes glitch-red {
  0%, 85%, 100% { opacity: 0; transform: translate(0); clip-path: inset(0 0 100% 0); }
  86% { opacity: 1; transform: translate(-11px, 0); clip-path: inset(4%  0 82% 0); }
  88% { opacity: 1; transform: translate(9px, 0);   clip-path: inset(32% 0 54% 0); }
  90% { opacity: 1; transform: translate(-13px, 0); clip-path: inset(52% 0 34% 0); }
  92% { opacity: 1; transform: translate(7px, 0);   clip-path: inset(18% 0 70% 0); }
  94% { opacity: 1; transform: translate(-9px, 0);  clip-path: inset(70% 0 18% 0); }
  96% { opacity: 1; transform: translate(12px, 0);  clip-path: inset(40% 0 46% 0); }
  98% { opacity: 1; transform: translate(-6px, 0);  clip-path: inset(84% 0 6% 0); }
  99% { opacity: 1; transform: translate(4px, 0);   clip-path: inset(58% 0 30% 0); }
}
/* CYAN channel — offset timing so the two channels tear apart */
@keyframes glitch-cyan {
  0%, 85%, 100% { opacity: 0; transform: translate(0); clip-path: inset(0 0 100% 0); }
  87% { opacity: 1; transform: translate(10px, 0);  clip-path: inset(10% 0 74% 0); }
  89% { opacity: 1; transform: translate(-8px, 0);  clip-path: inset(44% 0 42% 0); }
  91% { opacity: 1; transform: translate(13px, 0);  clip-path: inset(64% 0 24% 0); }
  93% { opacity: 1; transform: translate(-11px, 0); clip-path: inset(24% 0 62% 0); }
  95% { opacity: 1; transform: translate(8px, 0);   clip-path: inset(78% 0 12% 0); }
  97% { opacity: 1; transform: translate(-12px, 0); clip-path: inset(36% 0 50% 0); }
  99% { opacity: 1; transform: translate(5px, 0);   clip-path: inset(6% 0 86% 0); }
}
/* base word shudders and nudges during the burst */
@keyframes glitch-skew {
  0%, 85%, 100% { transform: translate(0) skew(0deg); }
  86% { transform: translate(2px, 0) skew(-2deg); }
  90% { transform: translate(-2px, 0) skew(1.4deg); }
  94% { transform: translate(1px, 0) skew(-0.8deg); }
  98% { transform: translate(-1px, 0) skew(0.5deg); }
}
@media (prefers-reduced-motion: reduce) {
  .glitch, .glitch::before, .glitch::after { animation: none; }
}

/* ---- Responsive ---- */
@media (max-width: 820px) {
  .topbar { padding: 24px 22px; }
  .logo { font-size: 17px; }

  /* sections occupy 80% of the height, centered; content scrolls inside */
  .sections { top: 8%; bottom: 12%; left: 7%; right: 7%; }
  .section {
    justify-content: safe center;      /* center when short, scroll when tall */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 10px 2px;
    scrollbar-width: none;
  }
  .section::-webkit-scrollbar { width: 0; height: 0; display: none; }

  /* nav dock moves to the bottom as a horizontal row */
  .cards-viewport {
    left: 50%;
    right: auto;
    top: auto;
    bottom: 18px;
    transform: translateX(-50%);
  }
  .cards-viewport.exit { transform: translateX(-50%) translateY(180%); opacity: 0; }
  .cards { flex-direction: row; gap: 12px; }
  .card { --size: 54px; }
  .card:hover { --size: 72px; }

  /* label sits above the square instead of to its right */
  .card-label {
    left: 50%;
    top: auto;
    bottom: calc(100% + 10px);
    transform: translateX(-50%) translateY(6px);
  }
  .card:hover .card-label { transform: translateX(-50%) translateY(0); }

  .dots { right: 16px; }
  .viewers { display: none; }        /* hide visitor counter on mobile */
  .scroll-hint { display: none; }    /* would collide with the bottom dock */

  .masonry { column-count: 2; }

  /* Projects board: stack vertically with the preview panel on top */
  .projects { flex-direction: column; align-items: stretch; gap: 16px; }
  .project-list { width: 100%; }
  .project-item { min-width: 0; width: 100%; }
  .project-stage { order: -1; flex: none; min-width: 0; min-height: 158px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001s !important; transition-duration: 0.05s !important; }
}

/* ---- Full-screen glitch burst (on right-click) ---- */
#glitchFx {
  position: fixed;
  inset: 0;
  z-index: 100000;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: overlay;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.16) 2px 3px),
    linear-gradient(90deg, rgba(0,229,255,0.25), rgba(255,0,212,0.25));
}
#glitchFx.on { animation: fxGlitch 0.45s steps(1, end) both; }
.frame.glitching { animation: screenGlitch 0.45s steps(1, end) both; }

@keyframes fxGlitch {
  0%   { opacity: 0; }
  8%   { opacity: 0.9; clip-path: inset(8% 0 72% 0); transform: translateX(-10px); }
  18%  { opacity: 0.6; clip-path: inset(42% 0 40% 0); transform: translateX(12px); }
  28%  { opacity: 0.95; clip-path: inset(66% 0 12% 0); transform: translateX(-6px); }
  40%  { opacity: 0.5; clip-path: inset(20% 0 62% 0); transform: translateX(8px); }
  55%  { opacity: 0.85; clip-path: inset(0 0 0 0); transform: translateX(0); }
  100% { opacity: 0; }
}
@keyframes screenGlitch {
  0%   { transform: translate(0) skew(0); filter: none; }
  12%  { transform: translate(-8px, 3px) skewX(-4deg); filter: hue-rotate(45deg) contrast(1.5) saturate(2); }
  24%  { transform: translate(9px, -3px) skewX(3deg);  filter: invert(0.12) hue-rotate(-30deg); }
  36%  { transform: translate(-5px, 0);                filter: contrast(1.8) saturate(3); }
  48%  { transform: translate(7px, 2px) skewY(2deg);   filter: hue-rotate(90deg); }
  62%  { transform: translate(-3px, -2px);             filter: invert(0.08); }
  76%  { transform: translate(4px, 1px);               filter: hue-rotate(-60deg) contrast(1.3); }
  100% { transform: translate(0);                      filter: none; }
}

/* ---- Custom heat-reactive cursor (mouse/trackpad only) ---- */
#cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  * { cursor: none !important; }         /* hide the system cursor */
  #cursor {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99999;
    pointer-events: none;
    will-change: transform, filter;
  }
  #cursor path {
    fill: #ffffff;
    stroke: rgba(0,0,0,0.4);
    stroke-width: 1;
  }
}
