/* Small-screen exploration; the existing desktop composition stays in charge. */
.mobile-enlarge-cue,
.mobile-viewer-tools,
.mobile-viewer-hint {
  display: none;
}

@media (max-width: 700px) {
  .mobile-explore-image {
    position: relative;
    touch-action: manipulation;
  }

  .mobile-explore-image > .mobile-enlarge-cue {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    right: 12px;
    bottom: 12px;
    left: auto;
    width: auto;
    padding: 7px 10px;
    border: 1px solid #706b61;
    border-radius: 4px;
    background: #090909;
    color: var(--cream, #f4efe3);
    font: 14px/1.2 var(--sans, sans-serif);
    letter-spacing: .01em;
    pointer-events: none;
  }

  .project-tabs {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0 8px;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0 7% 24px;
    padding: 3px 0;
    scroll-padding-inline: 8px;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .project-tabs button {
    flex: 0 0 auto;
    min-width: 44px;
    min-height: 48px;
    padding: 11px 12px 13px;
    white-space: nowrap;
    font-size: 16px;
  }

  .project-tabs button:focus-visible {
    outline-offset: -3px;
  }

  .map-section .section-heading,
  .projects .section-heading {
    padding: 44px 7% 22px;
  }

  .map-section .section-heading h2,
  .projects .section-heading h2,
  .mobility-heading h2 {
    min-width: 0;
    font-size: clamp(34px, 9.5vw, 44px);
    line-height: 1.1;
    overflow-wrap: break-word;
  }

  .mobility-heading {
    padding: 30px 7%;
    gap: 16px;
  }

  .mobility-nav {
    gap: 8px 18px;
    padding: 18px 7%;
    font-size: 17px;
  }

  .mobility-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 7px 3px;
  }

  .project-detail {
    margin-inline: 7%;
  }

  .project-detail h3 {
    font-size: 20px;
    line-height: 1.4;
    margin-bottom: 22px;
  }

  .comparison {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .comparison figcaption {
    font-size: 15px;
    margin-bottom: 10px;
  }

  .comparison img {
    height: min(76vw, 360px);
    object-fit: contain;
    background: #e7dfd0;
  }

  #image-viewer.mobile-explore-viewer[open] {
    display: flex;
    flex-direction: column;
    width: calc(100vw - 24px);
    height: min(760px, calc(100vh - 24px));
    height: min(760px, calc(100dvh - 24px));
    max-width: 676px;
    max-height: calc(100dvh - 24px);
    padding: 14px;
    gap: 12px;
    overflow: hidden;
    border-color: #706b61;
  }

  .mobile-explore-viewer .viewer-top {
    flex: 0 0 auto;
    gap: 12px;
    margin-bottom: 0;
  }

  .mobile-explore-viewer .viewer-top h2 {
    min-width: 0;
    font: 18px/1.3 var(--sans, sans-serif);
  }

  .mobile-explore-viewer #viewer-close {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 8px 12px;
  }

  .mobile-explore-viewer .mobile-viewer-tools {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
  }

  .mobile-viewer-tools button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid #777166;
    border-radius: 4px;
    background: transparent;
    color: var(--cream, #f4efe3);
    padding: 8px 12px;
    font: 16px/1 var(--sans, sans-serif);
    touch-action: manipulation;
  }

  .mobile-viewer-tools button[data-mobile-zoom="in"],
  .mobile-viewer-tools button[data-mobile-zoom="out"] {
    font-size: 25px;
  }

  .mobile-viewer-tools button:disabled {
    opacity: .4;
    cursor: default;
  }

  .mobile-viewer-tools output {
    margin-left: auto;
    min-width: 49px;
    font: 14px/1.2 var(--sans, sans-serif);
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  .mobile-viewer-viewport {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow: auto;
    background: #171612;
    touch-action: pan-x pan-y pinch-zoom;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-viewer-viewport:focus-visible {
    outline: 2px solid var(--red, #c82e2b);
    outline-offset: -3px;
  }

  .mobile-viewer-canvas {
    position: relative;
    min-width: 100%;
    min-height: 100%;
  }

  .mobile-viewer-canvas > #viewer-image {
    position: absolute;
    display: block;
    max-width: none;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
  }

  .mobile-explore-viewer .mobile-viewer-hint {
    display: block;
    flex: 0 0 auto;
    margin: 0;
    color: #c9c2b3;
    font: 13px/1.4 var(--sans, sans-serif);
  }
}

@media (max-width: 700px) and (prefers-reduced-motion: reduce) {
  .project-tabs,
  .mobile-viewer-viewport {
    scroll-behavior: auto;
  }

  .mobile-explore-image img {
    transition: none;
  }
}

/* Mobile expand controls stay outside the route illustrations. */
.mobile-expand-button,
.mobile-expand-walking { display: none; }

@media (max-width: 700px) {
  .mobile-expand-heading { position: relative; }
  #secteur .section-heading.mobile-expand-heading,
  .mobility-heading.mobile-expand-heading { padding-right: calc(5% + 54px); }
  .mobile-expand-button {
    display: inline-flex;
    position: absolute;
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 11px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #000;
    touch-action: manipulation;
  }
  .mobile-expand-button svg { width: 22px; height: 22px; flex: none; }
  .mobile-expand-button:focus-visible { outline-offset: -3px; }
  .mobile-expand-walking {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 44px;
    padding-right: 5%;
    background: #000;
  }
  .mobile-expand-walking .mobile-expand-button {
    position: static;
    transform: none;
    background: transparent;
    color: var(--cream);
  }
}
