/* Mobile-only refinements. Desktop layout remains unchanged. */
@media (max-width: 768px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  img {
    max-width: 100%;
  }

  .portfolio-header,
  .project-nav {
    padding-top: max(18px, env(safe-area-inset-top));
    padding-right: 5vw;
    padding-left: 5vw;
    align-items: flex-start;
  }

  .portfolio-header .brand,
  .project-nav .brand {
    width: 142px !important;
    height: 44px !important;
    flex: 0 0 142px;
  }

  .portfolio-header nav {
    display: flex !important;
    position: absolute;
    top: calc(max(18px, env(safe-area-inset-top)) + 58px);
    left: 5vw;
    right: 5vw;
    justify-content: space-between;
    gap: 12px;
    font-size: 11px;
  }

  .portfolio-header nav a,
  .project-nav > a:last-child {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  .project-nav > a:last-child {
    max-width: 130px;
    justify-content: flex-end;
    text-align: right;
    font-size: 11px;
    line-height: 1.2;
  }

  .portfolio-hero,
  .case-hero {
    width: 100%;
    height: 100svh;
    min-height: 560px;
    background-position: center;
  }

  .portfolio-hero {
    padding: 0 6vw max(44px, env(safe-area-inset-bottom));
  }

  .portfolio-hero h1 {
    max-width: 88vw;
    font-size: clamp(54px, 17vw, 76px);
    line-height: .84;
    margin: 22px 0 0;
  }

  .statement {
    padding: 84px 6vw;
    gap: 34px;
  }

  .statement h2 {
    max-width: 100%;
    font-size: clamp(46px, 14vw, 66px);
    line-height: .96;
  }

  .statement-copy {
    max-width: 100%;
    margin: 0;
    font-size: 17px;
  }

  .work {
    padding: 8px 6vw 72px;
  }

  .work-head {
    padding-bottom: 45px;
  }

  .card,
  .card-pair .card {
    width: 100%;
    margin-right: 0;
    margin-left: 0;
    margin-bottom: 72px;
  }

  .card-pair {
    display: block;
  }

  .card img,
  .card-wide img,
  .card-portrait img,
  .card-small img,
  .card-cinema img {
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    object-fit: contain;
  }

  .card h2 {
    max-width: calc(100% - 42px);
    font-size: clamp(28px, 9vw, 38px);
    line-height: 1;
  }

  .portfolio-contact {
    padding: 82px 6vw max(64px, env(safe-area-inset-bottom));
  }

  .portfolio-contact h2 {
    max-width: 100%;
    margin: 32px 0 68px;
    font-size: clamp(82px, 28vw, 120px);
    line-height: .78;
  }

  .portfolio-contact a {
    min-height: 58px;
    padding: 16px 0;
    overflow-wrap: anywhere;
    line-height: 1.35;
  }

  .case-title {
    left: 6vw;
    right: 6vw;
    bottom: max(44px, env(safe-area-inset-bottom));
  }

  .case-title h1 {
    max-width: 88vw;
    font-size: clamp(48px, 14vw, 68px);
    line-height: .84;
    overflow-wrap: anywhere;
  }

  .case-intro {
    padding: 82px 6vw;
    gap: 40px;
  }

  .case-intro h2 {
    font-size: clamp(46px, 14vw, 66px);
  }

  .case-intro p {
    font-size: 17px;
  }

  .gallery {
    padding: 0 6vw 52px;
  }

  .gallery img,
  .gallery .pair img {
    width: 100%;
    height: auto;
    margin-bottom: 6vw;
  }

  .gallery .pair {
    display: block;
  }

  .case-facts {
    padding: 0 6vw 72px;
    gap: 26px;
  }

  .next {
    padding: 64px 6vw max(64px, env(safe-area-inset-bottom));
  }

  .next strong {
    max-width: 100%;
    font-size: clamp(44px, 14vw, 66px);
    line-height: .9;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 370px) {
  .portfolio-header .brand,
  .project-nav .brand {
    width: 128px !important;
    flex-basis: 128px;
  }

  .portfolio-hero h1,
  .case-title h1 {
    font-size: 15vw;
  }
}
