/* UX stability and responsive fixes — 2026-07 */
html.intro-active {
  overflow: auto;
  scrollbar-gutter: stable;
}

html,
body {
  max-width: 100%;
  overscroll-behavior-y: none;
}

body {
  min-width: 0;
  overflow-x: clip;
}

img,
video,
canvas,
iframe {
  max-width: 100%;
}

.site-loader {
  touch-action: none;
  overscroll-behavior: none;
}

.pixel-wolf {
  animation: pixel-layer-out 0.28s 1.05s ease forwards;
}

@keyframes pixel-layer-out {
  to {
    opacity: 0;
    filter: blur(2px);
    visibility: hidden;
  }
}

.nav,
.case-nav,
.midea-detail__nav {
  z-index: 10000 !important;
  position: fixed !important;
  top: 0 !important;
  transform: translate3d(-50%, 0, 0) !important;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
  visibility: visible !important;
  opacity: 1 !important;
}

.nav::before,
.case-nav::before,
.midea-detail__nav::before {
  transform: translate3d(-50%, 0, 0);
}

.figma-prototype-stage > * {
  min-width: 0;
}

@media (max-width: 820px) {
  html {
    scroll-behavior: auto;
    scrollbar-gutter: auto;
  }

  .pixel-wolf {
    animation-delay: 0.7s;
    animation-duration: 0.24s;
  }

  .contact-marquee__track {
    transform: none !important;
    will-change: auto;
  }

  .figma-prototype-stage {
    align-items: center;
    width: 100%;
  }

  .figma-prototype-stage .figma-case__shell {
    order: 1;
    width: min(100%, 425px);
    margin-inline: auto;
    border: 1px solid #ffffff24;
    border-radius: 34px;
    background: #040706;
    padding: 7px;
    overflow: hidden;
    box-shadow: 0 30px 80px #0009;
  }

  .figma-case__bar {
    border: 0;
    border-bottom: 1px solid var(--line);
    padding-inline: 10px;
  }

  .figma-case__frame {
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 393 / 852;
    border: 0;
    border-radius: 27px;
    background: #08040e;
    overflow: hidden;
  }

  .figma-case__frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .today-detail,
  .midea-detail {
    overflow-x: clip;
  }

  .today-detail__hero,
  .today-detail__title,
  .today-detail__summary,
  .figma-case,
  .figma-spec,
  .midea-detail__hero-copy,
  .archive-case__head {
    min-width: 0;
  }

  .today-detail__title h1 {
    max-width: 100%;
    font-size: clamp(48px, 18vw, 76px);
    line-height: 0.84;
    overflow-wrap: normal;
    word-break: keep-all;
  }

  .today-detail__summary h2,
  .today-detail__summary p,
  .today-detail__summary dd,
  .figma-case__note,
  .figma-spec p,
  .archive-case__head h2,
  .archive-case__head p {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .figma-case__controls {
    min-width: 0;
  }

  .figma-case__controls button,
  .figma-case__controls a {
    min-width: 0;
    white-space: normal;
    text-align: center;
  }

  .midea-detail__nav,
  .case-nav {
    column-gap: 10px;
  }

  .midea-detail__nav > a,
  .case-nav > a {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .work-entry__caption h3,
  .section-heading h2,
  .about-overview__title h2 {
    max-width: 100%;
    overflow-wrap: break-word;
  }
}

@media (max-width: 480px) {
  .figma-prototype-stage .figma-case__shell {
    width: min(100%, 393px);
    border-radius: 30px;
    padding: 5px;
  }

  .figma-case__bar {
    min-height: 64px;
    padding: 8px;
  }

  .figma-case__controls {
    gap: 4px;
  }

  .figma-case__controls button,
  .figma-case__controls a {
    padding-inline: 6px;
    font-size: 6px;
  }

  .figma-case__frame {
    border-radius: 24px;
  }

  .today-detail__title h1 {
    font-size: clamp(44px, 17vw, 68px);
  }
}

/* Midea case-study: keep the report sequence calm, contained and readable. */
.midea-detail__cover {
  overflow: hidden;
}

.midea-cover-mosaic {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
  image-rendering: pixelated;
  transform: translateZ(0);
  will-change: opacity;
}

.midea-detail__hero-copy,
.midea-detail__cover,
.midea-detail__cover figcaption,
.midea-document,
.midea-document__head,
.midea-document__intro,
.midea-document__pages,
.midea-pdf-page,
.midea-pdf-page figcaption {
  min-width: 0;
}

.midea-pdf-page {
  overflow: hidden;
}

.midea-pdf-page img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.midea-detail__cover figcaption span,
.midea-pdf-page figcaption span,
.midea-document__head h2,
.midea-document__head p,
.midea-document__intro p {
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (max-width: 820px) {
  .midea-detail__hero-copy h1 {
    width: 100%;
    max-width: 100%;
    font-size: clamp(30px, 10vw, 68px) !important;
    letter-spacing: -0.055em;
    overflow-wrap: normal;
    word-break: keep-all;
  }

  .midea-document__pages {
    gap: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .midea-cover-mosaic {
    display: none;
  }
}

/* Project archive: the visible “VIEW COMPLETE CASE” line is part of the link. */
.archive-case__cover {
  position: relative;
}

.archive-case__cover > a {
  display: block;
}

.archive-case__cover > a::after {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0;
  cursor: pointer;
}

.archive-case__cover figcaption {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.archive-case__cover > a:hover + figcaption span:last-child,
.archive-case__cover > a:focus-visible + figcaption span:last-child {
  color: #b98cff;
}

.archive-case__cover > a:focus-visible {
  outline: none;
}

.archive-case__cover > a:focus-visible::after {
  outline: 2px solid #b98cff;
  outline-offset: 4px;
}
