/* Shared layout safeguards, loaded after the visual styles. */
.intro > *, .section-heading > *, .contact-grid > *, .field-grid > *,
.detail-grid > *, .lab-grid > *, .footer-top > *, .hero-editorial > * { min-width: 0; }
.hero-actions { width: auto; max-width: 100%; flex-wrap: wrap; }
.detail-hero h1, .contact h2, .legal h1 { overflow-wrap: anywhere; hyphens: auto; }
.button { max-width: 100%; text-align: center; }
.privacy-summary { font-size: 12px; }
.city-tabs, #ap-choices { overscroll-behavior-inline: contain; }
.city-tabs button, #ap-choices button, .city-scene-top button,
.city-navigation button, #city-expand, .detail-visual figcaption button { min-height: 44px; }
.city-navigation button { min-width: 44px; }
.city-expanded .campus-stage { min-height: 0; }
.city-expanded .city-caption { min-height: 0; max-height: 24dvh; overflow-y: auto; }
.city-expanded #ap-inspector { max-height: 20dvh; overflow-y: auto; }
.mobile-contact.is-suppressed { display: none; }

@media (max-width: 900px) {
  .contact input, .contact select, .contact textarea { font-size: 16px; }
  .lab-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
}

@media (max-width: 650px) {
  .header { padding-inline: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right)); gap: 8px; }
  .header .brand { width: 96px; }
  .header .brand img { width: 96px; }
  .header .compact { font-size: 11px; min-height: 44px; padding-inline: 10px; line-height: 1.35; }
  .menu { width: 44px; flex: 0 0 44px; align-items: center; }
  .header nav { top: 100%; max-height: calc(100dvh - 76px); overflow-y: auto; overscroll-behavior: contain; }
  .contact h2 { font-size: clamp(36px, 10vw, 53px); }
  .detail-hero h1 { font-size: clamp(28px, 8.5vw, 37px); }
  .detail-visual figcaption { flex-wrap: wrap; }
  .lab-grid { grid-template-columns: minmax(0, 1fr); }
  .lab-tabs button { min-width: 0; line-height: 1.5; }
  .campus-stage { height: clamp(330px, 105vw, 490px); }
  .city-stage-bottom { right: 70px; }
  .city-navigation { right: 8px; }
  .city-scene-top { left: 12px; right: 12px; }
  .city-scene-top > span { max-width: 48%; }
  .city-caption { overflow-wrap: anywhere; }
  .mobile-contact { bottom: max(12px, env(safe-area-inset-bottom)); }
  .footer-bottom { padding-bottom: calc(85px + env(safe-area-inset-bottom)); }
  .city-expanded { padding-bottom: env(safe-area-inset-bottom); }
  .city-expanded .city-toolbar { max-height: 30dvh; }
  .city-expanded .city-caption { padding: 12px 16px; }
}

/* Short landscape screens give the city its own column and scrollable controls. */
@media (min-width: 560px) and (max-height: 600px) {
  .city-shell.city-expanded {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(210px, 32vw, 280px);
    grid-template-rows: auto auto minmax(0, 1fr);
  }
  .city-expanded .campus-stage { grid-column: 1; grid-row: 1 / 4; height: 100%; min-width: 0; }
  .city-expanded .city-toolbar { grid-column: 2; grid-row: 1; max-height: 58dvh; padding: 10px; }
  .city-expanded .city-toolbar-heading { flex-wrap: wrap; }
  .city-expanded .city-toolbar-heading p { display: none; }
  .city-expanded #city-expand { width: 100%; }
  .city-expanded .city-tabs { flex-wrap: wrap; overflow: visible; }
  .city-expanded .city-tabs button { flex: 1 1 auto; white-space: normal; }
  .city-expanded #ap-inspector { grid-column: 2; grid-row: 2; max-height: 18dvh; padding: 8px; }
  .city-expanded .city-caption { grid-column: 2; grid-row: 3; max-height: none; padding: 12px; }
  .city-expanded #scene-heading { font-size: 14px; }
  .city-expanded #scene-caption { font-size: 12px; }
  .city-expanded .city-navigation { top: auto; bottom: 10px; right: 10px; transform: none; flex-direction: row; }
  .city-expanded .city-navigation > span { width: 1px; height: 28px; margin: 8px 2px; }
  .city-expanded .city-stage-bottom { display: none; }
  .city-expanded .city-scene-top { left: 10px; right: 10px; top: 10px; gap: 6px; }
  .city-expanded .city-scene-top > span { font-size: 8px; max-width: 45%; padding: 6px; }
  .city-expanded .city-scene-top button { font-size: 10px; padding-inline: 9px; }
  .city-expanded #garage-hud { left: 10px; right: 10px; top: 66px; }
  .city-expanded #garage-hud > div { min-width: 0; width: 50%; padding: 8px; }
}
