:root {
  --bg: #f5f5f5;
  --card: #ffffff;
  --text: #111111;
  --gap: clamp(0.2rem, 0.42vw, 0.42rem);
  --radius: 12px;
  --ease: 240ms cubic-bezier(0.22, 1, 0.36, 1);
  --page-pad: clamp(0.5rem, 1.5vw, 0.9rem);
  --header-height: clamp(1.8rem, 4vh, 2.3rem);
  --nav-height: clamp(2rem, 4.2vh, 2.4rem);
  --section-gap: clamp(0.35rem, 1vh, 0.65rem);
  /* Loader */
  --loader-emblem-duration: 2.05s;
  --loader-screen-fade-duration: 580ms;
  --ease-loader-emblem: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-loader-fade: cubic-bezier(0.4, 0, 0.2, 1);
  /* Horizontal width reserve (keeps main grid sizing unchanged vs. old left rail) */
  --side-panel-inset: clamp(1rem, 4.5vmin, 2.25rem);
  --side-panel-reserve: calc(clamp(0px, 24vw, 200px) + var(--side-panel-inset));
  --side-panel-ease: 420ms cubic-bezier(0.22, 1, 0.36, 1);
  /* Nudge main block slightly left vs. geometric center (balances left rail visually). */
  --main-content-shift: clamp(0.4rem, 2.8vw, 1.05rem);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
}

.bg-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: var(--bg);
  opacity: 1;
  pointer-events: all;
  transition: opacity var(--loader-screen-fade-duration) var(--ease-loader-fade);
}

.loading-screen.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-logo {
  width: clamp(90px, 16vw, 170px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 14px;
  transform-origin: 50% 60%;
  backface-visibility: hidden;
  animation: loader-emblem var(--loader-emblem-duration) var(--ease-loader-emblem)
    forwards;
}

@keyframes loader-emblem {
  /* Entrance: scale up + spring overshoot + fade in */
  0% {
    transform: scale(0.56) translateY(8px);
    opacity: 0;
  }
  8% {
    transform: scale(1.14) translateY(0);
    opacity: 1;
  }
  15% {
    transform: scale(0.94) translateY(0);
    opacity: 1;
  }
  21% {
    transform: scale(1.05) translateY(0);
    opacity: 1;
  }
  27% {
    transform: scale(0.99) translateY(0);
    opacity: 1;
  }
  32% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
  /* Subtle wobble */
  38% {
    transform: scale(1) rotate(-2.6deg);
    opacity: 1;
  }
  44% {
    transform: scale(1) rotate(2.2deg);
    opacity: 1;
  }
  50% {
    transform: scale(1) rotate(-1.5deg);
    opacity: 1;
  }
  56% {
    transform: scale(1) rotate(1deg);
    opacity: 1;
  }
  62% {
    transform: scale(1) rotate(-0.55deg);
    opacity: 1;
  }
  68% {
    transform: scale(1) rotate(0.2deg);
    opacity: 1;
  }
  74% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes loader-emblem-reduced {
  from {
    transform: scale(0.96);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-logo {
    animation: loader-emblem-reduced 0.55s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }
}

/* Bottom-right branding — Game Boy–style tilt + staggered letter wobble */
.corner-title {
  position: fixed;
  right: clamp(1.35rem, 5.5vmin, 3.4rem);
  bottom: clamp(1.35rem, 5.5vmin, 3.4rem);
  z-index: 5;
  pointer-events: none;
}

.corner-title__track {
  display: inline-block;
  white-space: nowrap;
  transform: rotate(-9deg) skewX(-5deg);
  transform-origin: 100% 100%;
  font-family: "Press Start 2P", ui-monospace, monospace;
  font-size: clamp(0.84rem, 2.7vw, 1.44rem);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.12em;
  color: #0000ff;
  text-shadow:
    2px 4px 0 rgba(0, 0, 0, 0.12),
    0 2px 0 rgba(255, 255, 255, 0.35);
}

.corner-title__char {
  display: inline-block;
  animation: corner-title-wobble 3.65s cubic-bezier(0.45, 0.05, 0.25, 1) infinite;
  animation-delay: calc(var(--i) * 0.2s);
}

@keyframes corner-title-wobble {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  18% {
    transform: translateY(-0.38em) scale(1.06);
  }
  36% {
    transform: translateY(0) scale(1);
  }
  54% {
    transform: translateY(-0.22em) scale(1.03);
  }
  72% {
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .corner-title__char {
    animation: none;
  }
}

/* Top-centered primary navigation (horizontal, evenly spaced) */
.side-panel.side-panel--top {
  position: fixed;
  z-index: 28;
  left: 50%;
  top: var(--page-pad);
  transform: translateX(-50%);
  width: min(calc(100vw - 2 * var(--page-pad)), 40rem);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
  gap: clamp(0.35rem, 2vw, 1rem);
  max-height: none;
  overflow: visible;
  pointer-events: auto;
  box-sizing: border-box;
}

.side-panel.side-panel--top .side-panel__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.side-panel.side-panel--top .side-panel__trigger {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.48rem 0.2rem 0.46rem;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: clamp(0.72rem, 1.35vw, 0.88rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(0, 0, 0, 0.42);
  text-align: center;
  cursor: pointer;
  transition: color var(--ease);
}

.side-panel.side-panel--top .side-panel__trigger:hover,
.side-panel.side-panel--top .side-panel__trigger:focus-visible {
  color: rgba(0, 0, 0, 0.62);
  outline: none;
}

.side-panel.side-panel--top .side-panel__trigger:focus-visible {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  border-radius: 4px;
}

.side-panel.side-panel--top .side-panel__item.is-open .side-panel__trigger {
  color: rgba(0, 0, 0, 0.55);
}

.side-panel.side-panel--top .side-panel__drawer {
  position: absolute;
  left: 50%;
  top: calc(100% + 0.28rem);
  transform: translateX(-50%);
  z-index: 14;
  width: min(12.5rem, calc(100vw - 2 * var(--page-pad)));
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--side-panel-ease);
  pointer-events: none;
}

.side-panel.side-panel--top .side-panel__item.is-open .side-panel__drawer {
  grid-template-rows: 1fr;
  pointer-events: auto;
}

.side-panel.side-panel--top .side-panel__drawer-inner {
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.side-panel.side-panel--top .side-panel__surface {
  margin: 0 0 0.55rem;
  width: 100%;
  aspect-ratio: 1;
  max-width: 100%;
  border-radius: var(--radius);
  background: #e4e4e4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  position: relative;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .side-panel.side-panel--top .side-panel__drawer {
    transition-duration: 0.01ms;
  }
}

.page {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: grid;
  grid-template-rows: var(--header-height) 1fr var(--nav-height);
  align-content: stretch;
  justify-items: center;
  gap: var(--section-gap);
  padding: var(--page-pad);
}

/* Home (grid) vs Clients — shared sizing with video grid */
.main-stage {
  position: relative;
  justify-self: stretch;
  width: 100%;
  min-height: 0;
  transform: translateX(calc(-1 * var(--main-content-shift)));
  --usable-h: calc(100vh - (2 * var(--page-pad)) - var(--header-height) - var(--nav-height) - (2 * var(--section-gap)));
  --cell-h: calc((var(--usable-h) - (2 * var(--gap))) / 3);
  --cell-w-by-height: calc(var(--cell-h) * 9 / 16);
  --max-grid-w: calc(100vw - (2 * var(--page-pad)) - var(--side-panel-reserve));
  --cell-w-by-width: calc((var(--max-grid-w) - (2 * var(--gap))) / 3);
  --cell-w: min(var(--cell-w-by-height), var(--cell-w-by-width));
  --grid-total-w: calc((3 * var(--cell-w)) + (2 * var(--gap)));
  --clients-sq-base: min(var(--grid-total-w), var(--usable-h));
  --clients-sq: min(
    calc(var(--clients-sq-base) * 1.2),
    var(--usable-h),
    var(--max-grid-w)
  );
  /* Visible white box only; tile layout uses full --clients-sq via .clients-layout-ruler */
  --clients-surface-scale: 0.88;
  --clients-surface-size: calc(var(--clients-sq) * var(--clients-surface-scale));
}

/* Hidden: same inner box as a full-size clients-surface for stable tile math */
.clients-layout-ruler {
  position: absolute;
  visibility: hidden;
  left: -9999px;
  top: 0;
  width: var(--clients-sq);
  height: var(--clients-sq);
  box-sizing: border-box;
  padding: clamp(0.8rem, 2.2vmin, 1.25rem);
  pointer-events: none;
}

.clients-layout-ruler__inner {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

.main-view {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.988);
  transition:
    opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.5s step-end,
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.main-view.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
  transition:
    opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s step-start,
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Home only: smaller 3×3 video grid (Clients uses .main-stage --cell-w / --grid-total-w unchanged). */
.main-view--home {
  --home-video-grid-scale: 0.83;
  --cell-w: calc(
    min(var(--cell-w-by-height), var(--cell-w-by-width)) * var(--home-video-grid-scale)
  );
  --grid-total-w: calc((3 * var(--cell-w)) + (2 * var(--gap)));
}

.clients-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
}

.clients-section-label {
  display: none;
}

/* Clients enter animation: soft fade + left-to-right reveal */
.main-view--clients .clients-surface {
  opacity: 0;
  transform: translateX(56px);
  transition:
    opacity 980ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 1100ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.main-view--clients.is-active .clients-surface {
  opacity: 1;
  transform: translateX(0);
}

.about-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
}

.about-section-label {
  display: none;
}

/* About enter animation: soft fade + left-to-right drift */
.main-view--about .about-surface {
  opacity: 0;
  transform: translateX(-56px);
  transition:
    opacity 980ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 1100ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.main-view--about.is-active .about-surface {
  opacity: 1;
  transform: translateX(0);
}

.contact-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
}

/* Contact enter animation: rectangle drops in (top -> bottom) */
.main-view--contact .contact-surface {
  opacity: 0;
  transform: translateY(-56px);
  transition:
    opacity 980ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 1100ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.main-view--contact.is-active .contact-surface {
  opacity: 1;
  transform: translateY(0);
}

.characters-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  /* Match About horizontal reference for visual 2 placement */
  --about-w: min(
    calc(var(--clients-sq) * 0.94),
    var(--max-grid-w)
  );
}

.characters-section-label {
  display: none;
}

/* Characters enter: opacity transitions separately so 3D open/close can fade smoothly */
.main-view--characters .characters-visual-wrap {
  opacity: 0;
  transition: none;
}

.main-view--characters.is-active .characters-visual-wrap--1 {
  opacity: 1;
  transition: opacity var(--model-viewer-crossfade-duration, 0.6s)
    cubic-bezier(0.22, 1, 0.36, 1) 200ms;
  animation: characters-visual-1-in 900ms cubic-bezier(0.16, 1, 0.3, 1) 200ms both;
  transform: translate(
    calc(
      var(--clients-surface-size) * 0.5 - 42% + var(--characters-visual-1-shift-x)
    ),
    -50%
  );
  /* Wrap non-hittable; imgs use alpha hit-test in mei-viewer.js */
  pointer-events: none;
  cursor: default;
}

.main-view--characters.is-active .characters-visual-wrap--2 {
  opacity: 1;
  transition: opacity var(--model-viewer-crossfade-duration, 0.6s)
    cubic-bezier(0.22, 1, 0.36, 1) 200ms;
  animation: about-visual-on-characters-in 900ms cubic-bezier(0.16, 1, 0.3, 1) 200ms both;
  transform: translate(var(--about-visual-x), -50%);
}

.main-view--characters.is-active .characters-visual-wrap--3 {
  opacity: 1;
  transition: opacity var(--model-viewer-crossfade-duration, 0.6s)
    cubic-bezier(0.22, 1, 0.36, 1) 200ms;
  animation: contact-visual-on-characters-in 900ms cubic-bezier(0.16, 1, 0.3, 1) 200ms both;
  transform: translate(-50%, -50%);
}

.main-view--characters:not(.is-active) .characters-visual-wrap {
  animation: none;
}

/* Visual 1: enters from above (top → bottom), sits slightly right of Clients placement */
@keyframes characters-visual-1-in {
  from {
    transform: translate(
      calc(
        var(--clients-surface-size) * 0.5 - 42% + var(--characters-visual-1-shift-x)
      ),
      calc(-50% - 52px)
    );
  }
  to {
    transform: translate(
      calc(
        var(--clients-surface-size) * 0.5 - 42% + var(--characters-visual-1-shift-x)
      ),
      -50%
    );
  }
}

@keyframes about-visual-on-characters-in {
  from {
    transform: translate(var(--about-visual-x), calc(-50% - 28px));
  }
  to {
    transform: translate(var(--about-visual-x), -50%);
  }
}

@keyframes contact-visual-on-characters-in {
  from {
    transform: translate(-50%, calc(-50% + 28px));
  }
  to {
    transform: translate(-50%, -50%);
  }
}

/* Visual 1 — Clients placement + nudge right; rest state matches entrance end */
.characters-visual-wrap--1 {
  --characters-visual-1-shift-x: clamp(0.75rem, 3.2vmin, 2rem);
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(520px, 76vmin, 900px);
  aspect-ratio: 1;
  z-index: 2;
  transform: translate(
    calc(
      var(--clients-surface-size) * 0.5 - 42% + var(--characters-visual-1-shift-x)
    ),
    calc(-50% - 52px)
  );
  pointer-events: none;
}

.characters-visual-wrap--1:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.35);
  outline-offset: 4px;
  border-radius: 8px;
}

/* Visual 2 — same placement as About */
.characters-visual-wrap--2 {
  --about-visual-x: -52%;
  position: absolute;
  top: 50%;
  left: calc(50% - (var(--about-w, var(--clients-sq)) / 2));
  width: clamp(520px, 76vmin, 900px);
  aspect-ratio: 1;
  z-index: 1;
  transform: translate(var(--about-visual-x), calc(-50% - 28px));
  pointer-events: none;
}

.main-view--characters.is-active .characters-visual-wrap--2 {
  /* Wrap is non-hittable so overlaps pass through; imgs get pointer-events in mei-viewer.js */
  pointer-events: none;
  cursor: default;
}

.characters-visual-wrap--2:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.35);
  outline-offset: 4px;
  border-radius: 8px;
}

.characters-mei-3d-btn {
  display: none;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 0.45rem 0.85rem;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  font: inherit;
  font-size: clamp(0.78rem, 2.2vmin, 0.92rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(0, 0, 0, 0.62);
  cursor: pointer;
  transition:
    background-color var(--ease),
    transform var(--ease),
    box-shadow var(--ease);
}

.characters-mei-3d-btn:hover,
.characters-mei-3d-btn:focus-visible {
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  outline: none;
}

.characters-mei-3d-btn:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.28);
  outline-offset: 2px;
}

/* Visual 3 — same placement as Contact */
.characters-visual-wrap--3 {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(460px, 70vmin, 820px);
  aspect-ratio: 1;
  z-index: 3;
  transform: translate(-50%, calc(-50% + 28px));
  pointer-events: none;
}

.main-view--characters.is-active .characters-visual-wrap--3 {
  pointer-events: none;
  cursor: default;
}

.characters-visual-wrap--3:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.35);
  outline-offset: 4px;
  border-radius: 8px;
}

/* 3D viewer crossfade: same duration as .model-viewer-frame (mei-viewer.js VIEWER_FADE_MS) */
:root {
  --model-viewer-crossfade-duration: 0.6s;
}

/* After closing 3D viewer: fade characters in immediately (no 200ms entrance delay) */
.main-view--characters.is-active.characters-from-3d-close .characters-visual-wrap--1,
.main-view--characters.is-active.characters-from-3d-close .characters-visual-wrap--2,
.main-view--characters.is-active.characters-from-3d-close .characters-visual-wrap--3 {
  transition: opacity var(--model-viewer-crossfade-duration) cubic-bezier(0.22, 1, 0.36, 1) 0s;
}

/* While 3D viewer is open: fade out the three PNG stacks (opacity not in motion keyframes) */
.main-view--characters.is-model-viewer-open.is-active .characters-visual-wrap--1,
.main-view--characters.is-model-viewer-open.is-active .characters-visual-wrap--2,
.main-view--characters.is-model-viewer-open.is-active .characters-visual-wrap--3 {
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--model-viewer-crossfade-duration) cubic-bezier(0.22, 1, 0.36, 1) 0s;
}

/* Vertical float on shell so hover wobble on the img can stack (transform compose). */
.characters-visual-float-shell {
  display: block;
  width: 100%;
  height: 100%;
  transform: translateY(0);
  animation: clients-visual-float 7.5s ease-in-out infinite;
}

.characters-visual-wrap--1 .characters-visual-float-shell {
  animation-delay: 0s;
}

.characters-visual-wrap--2 .characters-visual-float-shell {
  animation-delay: 2.5s;
}

.characters-visual-wrap--3 .characters-visual-float-shell {
  animation-delay: 5s;
}

.characters-visual {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transform: translate3d(0, 0, 0) scale(1);
  filter: none;
  transform-origin: 50% 62%;
  /* Same curve + duration in and out so hover on/off both feel smooth */
  transition: transform 0.68s cubic-bezier(0.22, 1, 0.36, 1);
  /* Overlapping PNGs: non-hittable until mei-viewer.js sets auto on opaque pixels */
  pointer-events: none;
}

/* Opaque-pixel hover only — class toggled in mei-viewer.js */
.characters-visual.is-char-opaque-hover {
  transform: translate3d(0, 0, 0) scale(1.1);
}

.about-surface {
  --about-outline: #FFBF00;
  --about-h: max(220px, calc(var(--clients-sq) * 0.7));
  --about-w: min(
    calc(var(--clients-sq) * 0.94),
    var(--max-grid-w)
  );
  width: max(290px, var(--about-w));
  height: max(180px, calc(var(--about-h) * 0.84));
  max-width: 100%;
  max-height: 100%;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    inset 0 0 0 2px rgba(255, 191, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  position: relative;
  overflow: visible;
  box-sizing: border-box;
}

.contact-surface {
  --contact-outline: #FF0000;
  --contact-h: max(220px, calc(var(--clients-sq) * 0.7));
  /* Wider + shorter than About */
  --contact-w: min(calc(var(--clients-sq) * 1.18), var(--max-grid-w));
  width: max(290px, var(--contact-w));
  height: max(120px, calc(var(--contact-h) * 0.5));
  max-width: 100%;
  max-height: 100%;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    inset 0 0 0 2px rgba(255, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  position: relative;
  overflow: visible;
  box-sizing: border-box;
}

.contact-surface__inner {
  height: 100%;
  padding: clamp(0.8rem, 2.2vmin, 1.25rem);
  display: grid;
  align-items: center;
  justify-items: center;
  overflow: hidden;
  border-radius: inherit;
}

.contact-content {
  width: min(520px, 100%);
  text-align: left;
  display: grid;
  gap: clamp(0.45rem, 1.2vmin, 0.65rem);
  justify-items: start;
  /* Nudge text block left for better balance */
  justify-self: start;
  padding-left: clamp(0.9rem, 2.4vmin, 1.7rem);
  padding-right: clamp(0.35rem, 1.4vmin, 0.9rem);
}

/* Contact links: normal gray */
.contact-links {
  display: grid;
  gap: clamp(0.35rem, 1.1vmin, 0.55rem);
  align-content: center;
  justify-items: start;
  font-size: clamp(1.05rem, 2.55vmin, 1.3rem);
  font-weight: 550;
  letter-spacing: 0.01em;
}

.contact-link {
  color: rgba(0, 0, 0, 0.52);
  text-decoration: none;
  transition: transform var(--ease), filter var(--ease), opacity var(--ease);
}

.contact-link:hover,
.contact-link:focus-visible {
  outline: none;
  transform: translateY(-1px);
  filter: brightness(0.92);
}

.contact-link:active {
  transform: translateY(0);
  opacity: 0.85;
}

.about-surface__inner {
  height: 100%;
  padding: clamp(0.8rem, 2.2vmin, 1.25rem);
  display: grid;
  align-items: center;
  justify-items: center;
  overflow: hidden;
  border-radius: inherit;
}

.about-content {
  width: min(460px, 100%);
  text-align: left;
  display: grid;
  gap: clamp(0.45rem, 1.2vmin, 0.65rem);
  justify-items: start;
}

.about-title {
  margin: 0;
  font-size: clamp(1.05rem, 2.6vmin, 1.25rem);
  font-weight: 750;
  letter-spacing: 0.01em;
  color: rgba(0, 0, 0, 0.78);
}

.about-desc {
  margin: 0;
  max-width: 42ch;
  font-size: clamp(0.82rem, 2.15vmin, 0.98rem);
  line-height: 1.55;
  color: rgba(0, 0, 0, 0.52);
}

.about-visual-wrap {
  --about-visual-x: -52%;
  position: absolute;
  top: 50%;
  left: calc(50% - (var(--about-w, var(--clients-sq)) / 2));
  width: clamp(520px, 76vmin, 900px);
  aspect-ratio: 1;
  /* Left side of screen, slightly overlapping the About container. */
  transform: translate(var(--about-visual-x), calc(-50% - 28px));
  pointer-events: none;
  opacity: 0;
  transition: none;
}

.main-view--about.is-active .about-visual-wrap {
  animation: about-visual-in 900ms cubic-bezier(0.16, 1, 0.3, 1) 200ms both;
}

@keyframes about-visual-in {
  from {
    opacity: 0;
    transform: translate(var(--about-visual-x), calc(-50% - 28px));
  }
  to {
    opacity: 1;
    transform: translate(var(--about-visual-x), -50%);
  }
}

.main-view--about:not(.is-active) .about-visual-wrap {
  animation: none;
}

.about-visual {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transform: translateY(0);
  animation: clients-visual-float 7.5s ease-in-out infinite;
  filter: none;
}

.contact-visual-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(460px, 70vmin, 820px);
  aspect-ratio: 1;
  transform: translate(-50%, calc(-50% + 28px));
  pointer-events: none;
  opacity: 0;
  transition: none;
}

.main-view--contact.is-active .contact-visual-wrap {
  animation: contact-visual-in 900ms cubic-bezier(0.16, 1, 0.3, 1) 200ms both;
}

@keyframes contact-visual-in {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 28px));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.main-view--contact:not(.is-active) .contact-visual-wrap {
  animation: none;
}

.contact-visual {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transform: translateY(0);
  animation: clients-visual-float 7.5s ease-in-out infinite;
  filter: none;
}

.clients-surface {
  --clients-outline: #0000ff;
  width: var(--clients-surface-size);
  height: var(--clients-surface-size);
  max-width: 100%;
  max-height: 100%;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    inset 0 0 0 2px rgba(0, 0, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  /* Allow grid to match full-layout tile sizes when box is smaller */
  position: relative;
  overflow: visible;
  box-sizing: border-box;
}

/* Work detail: same footprint as grid first, then width/height grow to full --clients-sq (no transform shrink). */
.clients-surface.is-detail {
  overflow: hidden;
  transition:
    width 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.clients-surface.is-detail:not(.clients-surface--detail-expanded) {
  width: var(--clients-surface-size);
  height: var(--clients-surface-size);
}

.clients-surface.is-detail.clients-surface--detail-expanded {
  width: var(--clients-sq);
  height: var(--clients-sq);
}

.clients-surface.is-detail .work-detail {
  width: 100%;
  max-width: 100%;
  min-height: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.clients-surface.is-detail.clients-surface--detail-content-visible .work-detail {
  opacity: 1;
  pointer-events: auto;
}

/* Clients: 6-work grid + detail view */
.clients-surface__inner {
  min-height: 100%;
  padding: clamp(0.8rem, 2.2vmin, 1.25rem);
  display: grid;
  grid-template-rows: 1fr;
  gap: 0;
  overflow: hidden;
  border-radius: inherit;
}

.clients-surface.is-detail .clients-surface__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 0;
}

.clients-visual-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(520px, 76vmin, 900px);
  aspect-ratio: 1;
  --clients-visual-shift-x: 0px;
  transform: translate(
    calc(var(--clients-surface-size) * 0.5 - 42% + var(--clients-visual-shift-x)),
    calc(-50% + 28px)
  );
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 900ms cubic-bezier(0.16, 1, 0.3, 1) 200ms,
    transform 1600ms cubic-bezier(0.12, 1, 0.2, 1);
}

.main-view--clients.is-active .clients-visual-wrap {
  opacity: 1;
  transform: translate(
    calc(var(--clients-surface-size) * 0.5 - 42% + var(--clients-visual-shift-x)),
    -50%
  );
}

@property --clients-visual-shift-x {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

.main-view--clients.clients-visual-detail .clients-visual-wrap {
  --clients-visual-shift-x: 56px;
  animation: clients-visual-shift-in 1200ms cubic-bezier(0.12, 1, 0.2, 1) both;
}

.main-view--clients.clients-visual-return .clients-visual-wrap {
  --clients-visual-shift-x: 0px;
  animation: clients-visual-shift-out 1100ms cubic-bezier(0.12, 1, 0.2, 1) both;
}

@keyframes clients-visual-shift-in {
  0% {
    --clients-visual-shift-x: 0px;
  }
  72% {
    --clients-visual-shift-x: 70px;
  }
  100% {
    --clients-visual-shift-x: 56px;
  }
}

@keyframes clients-visual-shift-out {
  0% {
    --clients-visual-shift-x: 56px;
  }
  70% {
    --clients-visual-shift-x: -12px;
  }
  100% {
    --clients-visual-shift-x: 0px;
  }
}

.clients-visual {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transform: translateY(0);
  animation: clients-visual-float 7.5s ease-in-out infinite;
  filter: none;
}

@keyframes clients-visual-float {
  0% {
    transform: translateY(-10px);
  }
  50% {
    transform: translateY(8px);
  }
  100% {
    transform: translateY(-10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .clients-visual {
    animation: none;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .about-visual,
  .contact-visual {
    animation: none;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .characters-visual-float-shell {
    animation: none;
    transform: translateY(0);
  }

  .characters-visual,
  .characters-visual.is-char-opaque-hover {
    transform: translate3d(0, 0, 0) scale(1);
    transition: none;
  }

  .main-view--characters.is-active .characters-visual-wrap--1,
  .main-view--characters.is-active .characters-visual-wrap--2,
  .main-view--characters.is-active .characters-visual-wrap--3 {
    animation: none;
    opacity: 1;
    transition: none;
  }

  .main-view--characters.is-model-viewer-open.is-active .characters-visual-wrap--1,
  .main-view--characters.is-model-viewer-open.is-active .characters-visual-wrap--2,
  .main-view--characters.is-model-viewer-open.is-active .characters-visual-wrap--3 {
    opacity: 0;
    pointer-events: none;
  }
}

.clients-field {
  position: relative;
  min-height: 0;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  overflow: visible;
}

/* After closing work detail: grid fades in (initial load has no .clients-surface--grid-enter). */
.clients-surface.clients-surface--grid-enter .clients-field {
  transition: opacity 0.48s cubic-bezier(0.22, 1, 0.36, 1);
}

.clients-surface.clients-surface--grid-enter:not(.clients-surface--grid-content-visible)
  .clients-field {
  opacity: 0;
}

.clients-surface.clients-surface--grid-enter.clients-surface--grid-content-visible
  .clients-field {
  opacity: 1;
}

.work-tile {
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #e6e6e6;
  border-radius: 16px;
  position: absolute;
  padding: 0;
  margin: 0;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  transition:
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    border-color var(--ease),
    background-color 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  transform: translate3d(var(--push-x, 0px), var(--push-y, 0px), 0)
    scale(var(--dist-scale, 1));
  transform-origin: center center;
  will-change: transform;
  overflow: hidden;
}

.work-tile__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  opacity: 1;
  transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity;
}

.work-tile.work-tile--hover {
  transform: translate3d(0, 0, 0) scale(2);
  z-index: 8;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.12);
  outline: none;
  background: #ededed;
}

.work-tile.work-tile--hover .work-tile__img,
.work-tile.work-tile--hover .work-tile__home-arrow {
  opacity: 1;
}

.work-tile.work-tile--pushed:not(.work-tile--hover) {
  z-index: 2;
}

/* Work 6 tile: cover visible; blue arrow fades in on hover above the image */
.work-tile__home-arrow {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity;
}

.work-tile__home-arrow-icon {
  width: 52%;
  height: 52%;
  max-width: 64px;
  max-height: 64px;
  flex-shrink: 0;
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .work-tile {
    transition-duration: 0.01ms;
  }

  .work-tile.work-tile--hover {
    transform: translate3d(0, 0, 0) scale(1.08);
  }

  .work-tile__img,
  .work-tile__home-arrow {
    transition-duration: 0.01ms;
  }
}

.work-detail {
  position: relative;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(0.5rem, 2vmin, 1.05rem);
  align-items: center;
  /* Main image larger; top/bottom rails scale from this (smaller = more contrast vs center) */
  --work-detail-ph-scale: 0.44;
  /* Rail corners: slightly tighter than main so after uniform scale they match center (16px). */
  --work-detail-main-radius: 16px;
  --work-detail-rail-radius: calc(
    var(--work-detail-main-radius) * var(--work-detail-ph-scale)
  );
  /* Side rails (top/bottom): softer, slightly transparent “gray” read */
  --work-detail-rail-muted-opacity: 0.15;
  --work-detail-rail-muted-filter: grayscale(1) brightness(1.08) contrast(0.84);
  --work-detail-img-size: min(
    74%,
    380px,
    calc((100dvh - 11rem) / 2.12)
  );
  --work-detail-ph-size: calc(
    var(--work-detail-img-size) * var(--work-detail-ph-scale)
  );
}

.work-detail__topbar {
  position: absolute;
  top: 0;
  left: 0;
}

.back-arrow {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(0, 0, 0, 0.62);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.4rem;
  border-radius: 10px;
  transition: background-color var(--ease), color var(--ease), transform var(--ease);
  font: inherit;
  font-size: clamp(0.82rem, 2.1vmin, 0.92rem);
}

.back-arrow:hover,
.back-arrow:focus-visible {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.72);
  transform: translateY(-1px);
  outline: none;
}

.back-arrow__icon {
  width: 18px;
  height: 18px;
  display: inline-block;
}

.work-detail__title {
  margin: 0;
  font-size: clamp(1.05rem, 2.6vmin, 1.25rem);
  font-weight: 750;
  letter-spacing: 0.01em;
  color: rgba(0, 0, 0, 0.78);
}

.work-detail__desc {
  margin: 0;
  font-size: clamp(0.82rem, 2.15vmin, 0.98rem);
  line-height: 1.55;
  color: rgba(0, 0, 0, 0.52);
}

.work-detail__links {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.95rem;
}

.work-detail__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  margin-top: 0;
  padding: 0.25rem 0.35rem;
  border-radius: 10px;
  color: #2563eb;
  text-decoration: none;
  font: inherit;
  font-size: clamp(0.82rem, 2.05vmin, 0.95rem);
  font-weight: 650;
  letter-spacing: 0.01em;
  transition: transform var(--ease), background-color var(--ease), color var(--ease);
}

.work-detail__link:hover,
.work-detail__link:focus-visible {
  outline: none;
  transform: translateY(-1px);
  background: rgba(37, 99, 235, 0.08);
}

.work-detail__link:active {
  transform: translateY(0);
}

.work-detail__link-arrow {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.work-detail__media {
  display: grid;
  place-items: center;
  min-width: 0;
}

.work-detail__media-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.4rem, 1.2vmin, 0.65rem);
  width: 100%;
}

.work-detail__carousel-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transform-origin: center center;
  will-change: transform;
}

/* Matches Clients 6-works tile gray (.work-tile), smaller than main image */
.work-detail__ph {
  width: var(--work-detail-ph-size);
  aspect-ratio: 1;
  flex-shrink: 0;
  border-radius: 14px;
  background: #e6e6e6;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}

/* Rail = smaller slot; muted reads like gray tile until filter animates away */
.work-detail__stack-img--rail {
  width: var(--work-detail-ph-size);
  aspect-ratio: 1;
  border-radius: var(--work-detail-rail-radius);
  object-fit: cover;
  object-position: center;
  display: block;
  flex-shrink: 0;
  background: #e6e6e6;
  transform-origin: center center;
  backface-visibility: hidden;
  box-shadow: none;
}

.work-detail__stack-img--rail.work-detail__stack-img--muted {
  filter: var(--work-detail-rail-muted-filter);
  opacity: var(--work-detail-rail-muted-opacity);
}

.work-detail__stack-img--main {
  width: var(--work-detail-img-size);
  aspect-ratio: 1;
  border-radius: var(--work-detail-main-radius);
  object-fit: cover;
  background: #eaeaea;
  display: block;
  flex-shrink: 0;
  transform-origin: center center;
  box-shadow: none;
}

.work-detail__content {
  display: grid;
  gap: 1.15rem;
  align-content: center;
  justify-items: start;
  /* Nudged toward center (closer to image) while staying in the right column */
  justify-self: start;
  width: min(100%, 16rem);
  padding-left: clamp(0.2rem, 1.5vmin, 0.65rem);
  padding-right: clamp(0.35rem, 2vmin, 1rem);
  margin-right: auto;
}

@media (prefers-reduced-motion: reduce) {
  .main-view,
  .main-view.is-active {
    transition-duration: 0.01ms;
  }

  .main-view--clients .clients-surface {
    transition-duration: 0.01ms;
  }

  .clients-surface.is-detail {
    transition-duration: 0.01ms;
  }

  .clients-surface.is-detail .work-detail {
    transition-duration: 0.01ms;
  }

  .clients-surface.clients-surface--grid-enter .clients-field {
    transition-duration: 0.01ms;
  }
}

.site-header {
  height: var(--header-height);
  width: 100%;
  display: grid;
  place-items: center;
}

.social-nav {
  height: 100%;
  display: inline-flex;
  align-items: center;
  gap: clamp(0.35rem, 0.7vw, 0.6rem);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 0.22rem 0.42rem;
  backdrop-filter: blur(6px);
}

.social-nav a {
  width: clamp(2.05rem, 4vh, 2.45rem);
  aspect-ratio: 1;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #121212;
  text-decoration: none;
  transition: transform var(--ease), background-color var(--ease);
}

.social-nav a:hover {
  transform: translateY(-2px);
  background: rgba(0, 0, 0, 0.06);
}

.social-nav svg {
  width: 70%;
  height: 70%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.social-nav__tiktok svg {
  fill: currentColor;
  stroke: none;
  /* Slightly under other icons’ 70% — TikTok’s tall viewBox reads larger at the same %. */
  width: 62%;
  height: 62%;
}

.floating-sticker {
  position: fixed;
  top: 22px;
  left: 22px;
  width: clamp(108px, 17vw, 176px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  z-index: 24;
  opacity: 0.9;
  transform: translate3d(0, 0, 0) rotate(-2deg);
  will-change: transform;
  cursor: grab;
  transition: opacity 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.floating-sticker.is-nav-hidden {
  opacity: 0;
  pointer-events: none;
}

.surface-sticker {
  position: absolute;
  width: clamp(84px, 13.5vw, 148px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  z-index: 6;
  opacity: 0;
  filter: grayscale(1) saturate(0) contrast(1.02) brightness(0.98);
  transition:
    opacity 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Show only when the matching view is active */
.main-view--about.is-active .surface-sticker--about,
.main-view--clients.is-active .surface-sticker--clients,
.main-view--contact.is-active .surface-sticker--contact {
  opacity: 0.2;
}

/* About: top-right of the white rectangle, slightly outside */
.surface-sticker--about {
  top: -10px;
  right: 6px;
  transform: rotate(30deg);
}

/* Clients: bottom-left of the white rectangle, slightly outside */
.surface-sticker--clients {
  left: 10px;
  bottom: -6px;
  transform: rotate(210deg);
}

/* Clients detail: snap to top-right corner, rotated by 180deg */
.main-view--clients.is-active .clients-surface.is-detail .surface-sticker--clients {
  opacity: 0;
  pointer-events: none;
}

/* Contact: center-right of the white rectangle, slightly outside */
.surface-sticker--contact {
  right: 18px;
  top: 50%;
  transform: translateY(-50%) rotate(2.5deg);
}

.floating-sticker.is-dragging {
  cursor: grabbing;
}

.sticker-bubble {
  --sticker-bubble-gap: 12px;
  position: fixed;
  z-index: 26;
  left: 0;
  top: 0;
  transform: translate(-50%, calc(-100% - var(--sticker-bubble-gap)));
  pointer-events: none;
  max-width: min(260px, 90vw);
}

.sticker-bubble__inner {
  position: relative;
  display: inline-block;
  padding: 0.52rem 0.78rem 0.58rem;
  font-size: clamp(0.84rem, 2.15vw, 0.98rem);
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.25;
  color: #141414;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
  transform-origin: 50% 100%;
  opacity: 0;
}

.sticker-bubble__inner::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 14px;
  height: 7px;
  transform: translateX(-50%);
  background: #ffffff;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.06));
}

.sticker-bubble.is-visible .sticker-bubble__inner {
  animation: sticker-bubble-in 0.64s cubic-bezier(0.34, 1.4, 0.32, 1) both;
}

.sticker-bubble.is-hiding .sticker-bubble__inner {
  opacity: 0;
  animation: none;
  transition: opacity 0.65s cubic-bezier(0.33, 0, 0.25, 1);
}

@keyframes sticker-bubble-in {
  0% {
    transform: scale(0.52);
    opacity: 0;
  }
  52% {
    transform: scale(1.08);
    opacity: 1;
  }
  72% {
    transform: scale(0.96);
    opacity: 1;
  }
  88% {
    transform: scale(1.02);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes sticker-bubble-in-reduced {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sticker-bubble.is-visible .sticker-bubble__inner {
    animation: sticker-bubble-in-reduced 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
  }
}

.video-grid {
  width: var(--grid-total-w);
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(3, var(--cell-w));
  gap: var(--gap);
}

.video-card {
  margin: 0;
}

.video-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition:
    transform var(--ease),
    box-shadow var(--ease),
    filter var(--ease);
}

.video-shell:hover,
.video-shell:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
  filter: brightness(1.02);
}

.portfolio-video,
.video-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  object-fit: cover;
  background: #eaeaea;
  pointer-events: none;
}

.video-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: min(100vw, 100%);
  height: min(100vh, 100dvh);
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
  opacity: 0;
  transition: opacity var(--ease);
  /* Closed dialog must not paint a hit-target over the page (see [open] for flex). */
  display: none;
  box-sizing: border-box;
}

.video-modal[open] {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.video-modal::backdrop {
  background: rgba(7, 7, 7, 0.76);
  backdrop-filter: blur(2px);
}

.modal-video-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 3vmin, 1.75rem);
  box-sizing: border-box;
}

.modal-player-wrap {
  position: relative;
  width: fit-content;
  max-width: 100%;
  max-height: 100%;
  flex-shrink: 0;
}

.modal-player {
  /* Portrait 9:16 frame — do not use landscape ratios from oEmbed or metadata. */
  --modal-vpad: clamp(1.5rem, 5vmin, 3rem);
  /* Slight zoom so Vimeo / encoded letterboxing is clipped (no side bands). */
  --modal-inner-zoom: 1.11;
  position: relative;
  width: min(
    92vw,
    calc((min(100vh, 100dvh) - var(--modal-vpad)) * (9 / 16))
  );
  max-width: 100%;
  max-height: min(92vh, calc(100dvh - var(--modal-vpad)));
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
  background: #000;
  transform: translate3d(0, 0, 0) scale(1);
  opacity: 1;
}

.modal-player__media {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
}

.modal-player__media video,
.modal-player__media iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  object-fit: cover;
  object-position: center;
  transform: scale(var(--modal-inner-zoom));
  transform-origin: center center;
}

/* Browser fullscreen: uniform scale (9:16 preserved), cover viewport — no pillarboxing. */
.modal-player:-webkit-full-screen,
.modal-player:fullscreen {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  overflow: hidden;
  background: #000;
}

.modal-player:-webkit-full-screen .modal-player__media,
.modal-player:fullscreen .modal-player__media {
  position: absolute;
  inset: 0;
}

.modal-player:-webkit-full-screen .modal-player__media video,
.modal-player:-webkit-full-screen .modal-player__media iframe,
.modal-player:fullscreen .modal-player__media video,
.modal-player:fullscreen .modal-player__media iframe {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center;
  transform: scale(var(--modal-inner-zoom));
  transform-origin: center center;
}

.modal-player .modal-player__media video:-webkit-full-screen,
.modal-player .modal-player__media video:fullscreen {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: #000;
}

.modal-player .modal-player__media iframe:-webkit-full-screen,
.modal-player .modal-player__media iframe:fullscreen {
  width: 100%;
  height: 100%;
  border: 0;
}

.modal-close {
  position: absolute;
  top: -0.4rem;
  right: -0.4rem;
  width: 2rem;
  aspect-ratio: 1;
  border: 0;
  border-radius: 999px;
  z-index: 2;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  font-size: 1.1rem;
  line-height: 1;
  transition: transform var(--ease), box-shadow var(--ease);
}

.modal-close:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.24);
}

/* GLB 3D viewer (Characters → PSY v1, MEI v2, EON v3) */
.model-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  width: min(100vw, 100%);
  height: min(100vh, 100dvh);
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: clamp(0.5rem, 2vmin, 1.25rem);
  border-radius: 0;
  background: transparent;
  overflow: auto;
  opacity: 0;
  transition: opacity var(--ease);
  display: none;
  box-sizing: border-box;
}

.model-viewer-modal[open] {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.model-viewer-modal::backdrop {
  background: transparent;
  backdrop-filter: none;
}

.model-viewer-frame {
  position: relative;
  width: min(98vw, 1180px);
  height: min(92vh, 920px);
  max-height: calc(100dvh - 1rem);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--model-viewer-crossfade-duration, 0.52s)
    cubic-bezier(0.22, 1, 0.36, 1);
}

.model-viewer-modal.is-viewer-scene-visible .model-viewer-frame {
  opacity: 1;
}

.model-viewer-shell {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
}

.model-viewer-shell canvas {
  display: block;
  width: 100%;
  height: 100%;
  vertical-align: middle;
  touch-action: none;
  /* +35% vividity vs default (1) */
  filter: saturate(1.35);
}

.model-viewer-error {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 1rem 1.25rem;
  max-width: 28rem;
  text-align: center;
  font-size: clamp(0.88rem, 2.2vmin, 1rem);
  line-height: 1.45;
  color: rgba(20, 20, 20, 0.92);
  background: rgba(255, 255, 255, 0.94);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.model-viewer-modal__close {
  top: -0.35rem;
  right: -0.35rem;
  z-index: 3;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  .model-viewer-frame {
    opacity: 1;
    transition: none;
  }
}

/* Fixed proportional layout: design canvas 1920×1080, uniform viewport zoom (no reflow). */
.app-scale {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.app-scale__inner {
  pointer-events: auto;
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--app-design-w);
  height: var(--app-design-h);
  flex-shrink: 0;
  transform-origin: center center;
  --app-scale: min(100vw / var(--app-design-w), 100vh / var(--app-design-h));
  --app-shift-x: 0px;
  --app-shift-y: 0px;
  transform: translate3d(-50%, -50%, 0) scale(var(--app-scale))
    translate3d(var(--app-shift-x), var(--app-shift-y), 0);
  will-change: transform;
  /* Frozen tokens (≈1920×1080 viewport) — viewport units inside no longer track the real window. */
  --app-design-w: 1920px;
  --app-design-h: 1080px;
  --gap: 0.42rem;
  --page-pad: 14.4px;
  --header-height: 2.3rem;
  --nav-height: 2.4rem;
  --section-gap: 0.65rem;
  --side-panel-inset: 36px;
  --side-panel-reserve: 236px;
  --main-content-shift: 0rem;
}

.app-scale__inner .page {
  height: 100%;
  width: 100%;
}

.app-scale__inner .main-stage {
  --usable-h: calc(
    var(--app-design-h) - (2 * var(--page-pad)) - var(--header-height) - var(--nav-height) -
      (2 * var(--section-gap))
  );
  --max-grid-w: calc(
    var(--app-design-w) - (2 * var(--page-pad)) - var(--side-panel-reserve)
  );
}

.app-scale__inner .side-panel.side-panel--top {
  width: min(calc(var(--app-design-w) - 2 * var(--page-pad)), 40rem);
  gap: 1rem;
}

.app-scale__inner .side-panel.side-panel--top .side-panel__trigger {
  font-size: 0.88rem;
}

.app-scale__inner .side-panel.side-panel--top .side-panel__drawer {
  width: min(12.5rem, calc(var(--app-design-w) - 2 * var(--page-pad)));
}

.app-scale__inner .corner-title {
  right: 3.4rem;
  bottom: 3.4rem;
}

.app-scale__inner .corner-title__track {
  font-size: 1.44rem;
}

.app-scale__inner .social-nav {
  gap: 0.6rem;
}

.app-scale__inner .social-nav a {
  width: 2.45rem;
}

.app-scale__inner .floating-sticker {
  width: 176px;
}

.app-scale__inner .clients-layout-ruler {
  padding: 1.25rem;
}

.app-scale__inner .clients-surface__inner {
  padding: 1.25rem;
}

.app-scale__inner .about-surface__inner {
  padding: 1.25rem;
}

.app-scale__inner .about-content {
  gap: 0.65rem;
  /* Nudge the text block inward while keeping the about panel's
     left/right container placement unchanged. */
  padding-left: 1.55rem;
  padding-right: 0.8rem;
}

.app-scale__inner .about-stage {
  transform: none;
}

.app-scale__inner .about-visual-wrap {
  /* Visual overlaps text too much; push the artwork further left. */
  --about-visual-x: -57.5%;
}

.app-scale__inner .about-title {
  font-size: 1.25rem;
}

.app-scale__inner .about-desc {
  font-size: 0.98rem;
}

.app-scale__inner .about-visual-wrap,
.app-scale__inner .clients-visual-wrap,
.app-scale__inner .characters-visual-wrap--1,
.app-scale__inner .characters-visual-wrap--2 {
  width: 820px;
}

.app-scale__inner .characters-visual-wrap--3 {
  width: clamp(460px, 70vmin, 820px);
}

.app-scale__inner .characters-visual-wrap--2 {
  --about-visual-x: -57.5%;
}

.app-scale__inner .work-detail {
  gap: 1.05rem;
  --work-detail-img-size: min(
    74%,
    380px,
    calc((var(--app-design-h) - 11rem) / 2.12)
  );
}

.app-scale__inner .back-arrow {
  font-size: 0.92rem;
}

.app-scale__inner .work-detail__title {
  font-size: 1.25rem;
}

.app-scale__inner .work-detail__desc {
  font-size: 0.98rem;
}

.app-scale__inner .work-detail__media-stack {
  gap: 0.65rem;
}

.app-scale__inner .work-detail__content {
  padding-left: 0.65rem;
  padding-right: 1rem;
}

/*
 * Mobile layout — viewport ≤768px (must match `MOBILE_MQ` in script.js).
 * Uniform scaling is unchanged; these rules only affect real viewport width.
 */
@media (max-width: 768px) {
  .floating-sticker {
    display: none !important;
  }

  .clients-visual-wrap,
  .about-visual-wrap,
  .contact-visual-wrap,
  .characters-visual-wrap {
    display: none !important;
  }

  .side-panel.side-panel--top .side-panel__item[data-panel="contact"],
  #mainViewContact {
    display: none !important;
  }

  .side-panel.side-panel--top {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.2rem 0.38rem;
    width: min(calc(100vw - 2 * var(--page-pad)), 40rem);
  }

  .side-panel.side-panel--top .side-panel__trigger {
    font-size: clamp(0.78rem, 3.2vw, 1.05rem);
    font-weight: 650;
    padding: 0.52rem 0.14rem 0.5rem;
    letter-spacing: 0.025em;
  }

  /* Bottom social icons: larger + nudged up (all main views) */
  .page .social-nav {
    align-self: center;
    justify-self: center;
    transform: translateY(-18px);
    padding: 0.5rem 1rem;
    gap: 0.78rem;
  }

  .page .social-nav a {
    width: clamp(3.2rem, 10.5vmin, 4.1rem);
  }

  .page .social-nav svg {
    width: 72%;
    height: 72%;
  }

  .page .social-nav__tiktok svg {
    width: 64%;
    height: 64%;
  }

  .app-scale__inner .side-panel.side-panel--top {
    gap: 0.42rem 0.36rem;
  }

  .app-scale__inner .side-panel.side-panel--top .side-panel__trigger {
    font-size: 1.05rem;
    padding: 0.54rem 0.12rem 0.52rem;
  }

  .app-scale__inner .page .social-nav {
    transform: translateY(-26px);
    padding: 0.55rem 1.12rem;
    gap: 0.92rem;
  }

  .app-scale__inner .page .social-nav a {
    width: 3.95rem;
  }

  .clients-stage {
    flex-direction: column;
    justify-content: center;
    gap: 0.45rem;
  }

  .clients-section-label {
    display: block;
    margin: 0;
    padding: 0 0.5rem;
    font-size: clamp(0.58rem, 2.1vw, 0.72rem);
    font-weight: 650;
    letter-spacing: 0.14em;
    text-transform: lowercase;
    /* Same as --clients-outline on .clients-surface */
    color: #0000ff;
    text-align: center;
    flex-shrink: 0;
    line-height: 1.2;
  }

  .app-scale__inner .clients-section-label {
    font-size: 0.68rem;
    letter-spacing: 0.16em;
  }

  .about-stage {
    flex-direction: column;
    justify-content: center;
    gap: 0.45rem;
  }

  .characters-stage {
    flex-direction: column;
    justify-content: center;
    gap: 0.45rem;
  }

  .characters-section-label {
    display: block;
    margin: 0;
    padding: 0 0.5rem;
    font-size: clamp(0.58rem, 2.1vw, 0.72rem);
    font-weight: 650;
    letter-spacing: 0.14em;
    text-transform: lowercase;
    color: rgba(0, 0, 0, 0.45);
    text-align: center;
    flex-shrink: 0;
    line-height: 1.2;
  }

  .app-scale__inner .characters-section-label {
    font-size: 0.68rem;
    letter-spacing: 0.16em;
  }

  .characters-mei-3d-btn {
    display: inline-flex;
  }

  .about-section-label {
    display: block;
    margin: 0;
    padding: 0 0.5rem;
    font-size: clamp(0.58rem, 2.1vw, 0.72rem);
    font-weight: 650;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    /* Same as --about-outline on .about-surface */
    color: #ffbf00;
    text-align: center;
    flex-shrink: 0;
    line-height: 1.2;
  }

  .app-scale__inner .about-section-label {
    font-size: 0.68rem;
    letter-spacing: 0.16em;
  }

  .surface-sticker--clients {
    display: none !important;
  }

  /* Clients grid square: smaller white box (6 tiles scale via JS too). */
  .main-stage[data-main-view="clients"] {
    --clients-surface-scale: 0.62;
  }

  /* Work detail: expanded square smaller than full --clients-sq on mobile. */
  .main-view--clients .clients-surface.is-detail.clients-surface--detail-expanded {
    width: min(
      calc(var(--clients-sq) * 0.78),
      calc(100vw - 2 * var(--page-pad))
    );
    height: min(
      calc(var(--clients-sq) * 0.78),
      calc(100vw - 2 * var(--page-pad))
    );
  }

  /* About: narrower panel; sticker removed below. */
  .main-view--about .about-surface {
    --about-h: max(200px, calc(var(--clients-sq) * 0.66));
    width: max(200px, min(calc(var(--clients-sq) * 0.68), var(--max-grid-w)));
    height: max(200px, calc(var(--about-h) * 0.86));
    min-height: min(36vh, 340px);
  }

  .about-surface__inner {
    padding: clamp(0.65rem, 2vmin, 1rem);
    align-items: center;
  }

  .about-content {
    width: min(100%, min(320px, calc(var(--clients-sq) * 0.62)));
    gap: clamp(0.35rem, 1.4vmin, 0.55rem);
  }

  .about-desc {
    max-width: 38ch;
    font-size: clamp(0.86rem, 3.1vw, 1.05rem);
    line-height: 1.5;
  }

  .app-scale__inner .about-surface {
    --about-h: max(210px, calc(var(--clients-sq) * 0.7));
    height: max(215px, calc(var(--about-h) * 0.88));
    min-height: min(34vh, 340px);
  }

  .app-scale__inner .about-desc {
    font-size: 1rem;
    line-height: 1.52;
  }

  .app-scale__inner .about-surface__inner {
    padding: 0.85rem 0.8rem;
  }

  .surface-sticker--about {
    display: none !important;
  }

  /*
   * Work detail (Clients): proportional type; scaled for smaller grid + detail panels.
   */
  .work-detail__title {
    font-size: clamp(0.98rem, 3.6vw, 1.22rem);
    line-height: 1.22;
  }

  .work-detail__desc {
    font-size: clamp(0.86rem, 3.1vw, 1.05rem);
    line-height: 1.5;
  }

  .work-detail__link {
    font-size: clamp(0.86rem, 3.1vw, 1.05rem);
  }

  .back-arrow {
    font-size: clamp(0.82rem, 2.9vw, 0.98rem);
  }

  .back-arrow__icon {
    width: 17px;
    height: 17px;
  }

  .work-detail__link-arrow {
    width: 15px;
    height: 15px;
  }

  .app-scale__inner .work-detail__title {
    font-size: 1.12rem;
  }

  .app-scale__inner .work-detail__desc {
    font-size: 0.98rem;
    line-height: 1.5;
  }

  .app-scale__inner .work-detail__link {
    font-size: 0.98rem;
  }

  .app-scale__inner .back-arrow {
    font-size: 0.94rem;
  }

  .app-scale__inner .work-detail {
    gap: 0.82rem;
    --work-detail-img-size: min(
      64%,
      280px,
      calc((var(--app-design-h) - 12.5rem) / 2.35)
    );
  }

  .app-scale__inner .work-detail__media-stack {
    gap: 0.5rem;
  }

  .app-scale__inner .work-detail__content {
    padding-left: 0.5rem;
    padding-right: 0.75rem;
  }

  /* Clients 6-tile grid: no hover physics; covers always visible. */
  .clients-field .work-tile {
    transition: none;
    transform: none !important;
    will-change: auto;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  }

  .clients-field .work-tile.work-tile--hover,
  .clients-field .work-tile.work-tile--pushed {
    transform: none !important;
    z-index: auto;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.08);
    background: #e6e6e6;
  }

  .clients-field .work-tile__img,
  .clients-field .work-tile__home-arrow {
    opacity: 1 !important;
    transition: none;
  }

}
