/* Mobile stability layer: loaded last to normalize legacy visual overrides. */

html {
  min-width: 320px;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  overflow-x: clip;
  overscroll-behavior-x: none;
  overscroll-behavior-y: auto;
}

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

button,
a,
input,
textarea,
select {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@supports (padding: max(0px)) {
  .cinematic-site .editorial-header {
    padding-top: max(9px, env(safe-area-inset-top));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .editorial-mobile-menu-inner {
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) {
  html {
    scroll-padding-top: 78px;
  }

  main section,
  [id] {
    scroll-margin-top: 84px;
  }

  input,
  textarea,
  select {
    font-size: 16px;
  }

  .cinematic-site .editorial-header {
    width: 100%;
    min-height: 68px;
    gap: 10px;
  }

  .cinematic-site .editorial-brand {
    min-width: 0;
  }

  .cinematic-site .editorial-brand-copy {
    min-width: 0;
  }

  .cinematic-site .editorial-brand-copy strong {
    font-size: clamp(0.92rem, 4.6vw, 1.08rem);
    line-height: 1.05;
    white-space: nowrap;
  }

  .cinematic-site .editorial-brand-copy small {
    max-width: 18ch;
    overflow: hidden;
    font-size: 0.38rem;
    line-height: 1.2;
    letter-spacing: 0.2em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cinematic-site .editorial-header-actions {
    flex: 0 0 auto;
  }

  .cinematic-site .editorial-language,
  .cinematic-site .editorial-menu-toggle {
    box-sizing: border-box;
    min-width: 44px !important;
    min-height: 44px !important;
  }

  #editorial-mobile-menu {
    max-height: calc(100dvh - 68px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .editorial-home .editorial-hero {
    padding-top: 92px;
    padding-bottom: 64px;
  }

  .editorial-home .editorial-hero-grid,
  #reference-authority-host,
  .reference-section-shell {
    width: min(calc(100% - 32px), 560px);
  }

  .editorial-home .editorial-hero-copy {
    padding-top: 10px;
  }

  .editorial-home .cinematic-headline {
    max-width: 100%;
    margin-top: 22px;
    font-size: clamp(2.75rem, 13.5vw, 4rem);
    line-height: 0.98;
    letter-spacing: -0.045em;
    overflow-wrap: anywhere;
    text-wrap: balance;
  }

  .editorial-home .editorial-lead {
    max-width: 42rem;
    margin-top: 22px;
    padding-top: 20px;
    font-size: 1rem;
    line-height: 1.65;
    text-wrap: pretty;
  }

  .editorial-home .editorial-actions a,
  .editorial-mobile-cta {
    min-height: 48px;
  }

  .reference-trajectory-section,
  .reference-testimonials-section {
    padding-block: 72px;
  }

  .reference-trajectory-heading h2,
  .reference-testimonials-heading h2 {
    font-size: clamp(2.55rem, 12vw, 3.75rem);
    line-height: 1;
    text-wrap: balance;
  }

  .reference-trajectory-card-head h3 {
    font-size: clamp(1.25rem, 6vw, 1.5rem);
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .reference-testimonial-quote blockquote {
    font-size: clamp(1.05rem, 5vw, 1.25rem);
    line-height: 1.55;
  }

  .reference-authority-strip article,
  .reference-trajectory-card,
  .reference-testimonial-quote,
  .reference-testimonial-profile {
    min-width: 0;
  }
}

@media (max-width: 640px) and (max-height: 500px) and (orientation: landscape) {
  .editorial-home .editorial-hero {
    padding-top: 76px;
    padding-bottom: 40px;
  }

  .editorial-home .cinematic-headline {
    margin-top: 12px;
    font-size: clamp(2.3rem, 10vw, 3.2rem);
  }
}

@media (max-width: 380px) {
  .cinematic-site .editorial-brand-copy small {
    display: none;
  }

  .editorial-home .editorial-hero-grid,
  #reference-authority-host,
  .reference-section-shell {
    width: min(calc(100% - 24px), 560px);
  }

  .editorial-home .cinematic-headline {
    font-size: clamp(2.45rem, 13vw, 3.2rem);
  }
}

@media (display-mode: standalone) {
  body {
    -webkit-user-select: none;
    user-select: none;
  }

  input,
  textarea,
  [contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
