:root {
  --page-inline: max(var(--pad), env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
}

.section-pad,
.site-header,
.site-header.liquid-interactive {
  padding-inline: var(--page-inline);
}

.editorial-figure-contained img {
  max-width: 100%;
}

.detail-back,
.case-footer-bottom button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.project-dialog .dialog-top .dialog-close,
.case-lightbox .case-viewer-top > button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
}

.textile-help .textile-touch-help {
  display: none;
}

@media (hover: none), (pointer: coarse) {
  .textile-help .textile-pointer-help {
    display: none;
  }

  .textile-help .textile-touch-help {
    display: inline;
  }

  .cursor-label,
  .case-cursor.cursor-label {
    display: none;
  }
}

@media (641px <= width <= 1024px) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(24px, 4vw, 44px);
  }

  .project-grid .project-card:nth-child(even),
  .project-grid .project-card.is-offset {
    margin-top: 28px;
  }

  .project-grid .project-card.web-card {
    width: min(85%, 720px);
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  :root {
    --pad: clamp(16px, 5vw, 28px);
    --site-header-height: calc(64px + env(safe-area-inset-top, 0px));
  }

  html {
    scroll-padding-top: calc(var(--site-header-height) + 10px);
  }

  .site-header,
  .site-header.liquid-interactive {
    grid-template-columns: minmax(0, 1fr) auto auto;
    padding: env(safe-area-inset-top, 0px) var(--page-inline) 0;
    gap: 8px;
  }

  .brand { display: inline-flex; align-items: center; min-height: 44px; }
  .brand-wordmark { font-size: 17px; }
  .desktop-nav, .motion-toggle > span:nth-child(2) { display: none; }
  .motion-toggle { min-width: 44px; padding: 0; justify-content: center; }

  .menu-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 44px;
    height: 44px;
    padding: 10px;
  }

  .menu-toggle span {
    width: 19px;
    height: 1px;
  }

  .mobile-nav {
    inset: calc(var(--site-header-height) + 8px) var(--page-inline) auto;
    padding: 10px 18px;
    max-height: calc(100dvh - var(--site-header-height) - 24px);
    overflow-y: auto;
  }

  .mobile-nav > a {
    display: flex;
    min-height: 48px;
    align-items: center;
    font-size: 18px;
  }

  .hero-track { height: 106svh; }
  .hero-sticky { min-height: 0; }
  .hero-scene { bottom: 84px; }
  .hero-bottom { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }

  .work-section,
  .about-section {
    padding-block: clamp(44px, 10vw, 64px);
  }

  .project-toolbar {
    margin-bottom: 22px;
  }

  .project-toolbar .filter-bar {
    gap: 2px 6px;
  }

  .project-toolbar .filter {
    min-width: 44px;
    min-height: 44px;
    padding-inline: 5px;
  }

  .project-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .project-grid .project-card:nth-child(even),
  .project-grid .project-card.is-offset,
  .project-grid .project-card.web-card {
    grid-column: auto;
    width: 100%;
    margin: 0;
  }

  .scroll-ready .project-open {
    transform: translateY(clamp(0px, var(--entry-y, 0px), 20px));
    opacity: 1;
    filter: none;
  }

  .project-grid .project-visual {
    border-radius: 20px;
  }

  .project-details {
    padding: 8px 10px;
    border-radius: 13px;
  }

  .project-details > p {
    font-size: 12px;
    line-height: 1.45;
  }

  .about-layout,
  .about-path {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .about-art {
    grid-row: 2;
    width: min(72%, 300px);
    margin-inline: auto;
  }

  .about-path {
    margin-top: 36px;
    padding-top: 28px;
  }

  .site-footer {
    padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
  }

  .project-dialog {
    --case-pad: var(--page-inline);
    scroll-padding-top: calc(60px + env(safe-area-inset-top, 0px));
    scrollbar-gutter: auto;
  }

  .project-dialog .dialog-top {
    height: calc(60px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) var(--case-pad) 0;
  }

  .editorial-case { --reel-pad: var(--page-inline); }
  .editorial-opening {
    display: block;
    width: 100%;
    padding-block: 28px 12px;
  }

  .detail-content .editorial-opening h2 {
    font-size: clamp(36px, 10.5vw, 52px);
    margin-bottom: 14px;
  }

  .editorial-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #25252525;
  }

  .editorial-summary > div { min-width: 0; }
  .editorial-reel { width: 100%; }
  .editorial-hero-film { padding-top: 20px; }
  .editorial-concept { padding-block: 36px; }
  .editorial-direction { padding-top: 0; }
  .editorial-pair { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .grandjd-direction-film {
    width: min(100%, 300px);
  }

  .grandjd-volume {
    justify-content: flex-start;
  }

  .grandjd-volume input {
    min-width: 0;
    flex: 1;
    max-width: 190px;
  }

  .case-next.detail-next {
    grid-template-columns: minmax(0, 1fr) clamp(68px, 21vw, 120px);
    gap: 14px;
    padding-block: 32px;
  }

  .case-next strong {
    font-size: clamp(24px, 7vw, 38px);
    letter-spacing: -.035em;
    overflow-wrap: anywhere;
  }

  .case-next-preview { height: clamp(58px, 20vw, 106px); }
  .case-next .case-eyebrow { margin-bottom: 10px; }
  .editorial-case .case-footer { padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)); }

  .case-lightbox[open] {
    grid-template-rows: calc(54px + env(safe-area-inset-top, 0px)) minmax(0, 1fr) calc(62px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 380px) {
  .project-toolbar .filter-bar { gap: 0 4px; }
  .project-toolbar .filter { font-size: 12px; padding-inline: 2px; }
  .precepteur-film-caption > a { flex-basis: 100%; }
}

@media (max-height: 530px) and (orientation: landscape) {
  .hero-track { height: 100svh; }
  .hero-sticky { min-height: 0; }
  .hero-scene { bottom: 70px; }
  .hero-bottom { bottom: max(10px, env(safe-area-inset-bottom, 0px)); }
}
