/* Compact composition for wide screens with phone-sized height. */
@media (orientation: landscape) and (max-width: 1100px) and (max-height: 650px) and (min-aspect-ratio: 3 / 2) {
  :root {
    --short-landscape-top: max(58px, calc(env(safe-area-inset-top) + 50px));
    --short-landscape-bottom: max(56px, calc(env(safe-area-inset-bottom) + 50px));
    --short-landscape-inline: clamp(20px, 5vw, 64px);
    --short-monitor-scale: 0.5;
    --short-phone-scale: 0.52;
  }

  .site-mark {
    top: max(8px, env(safe-area-inset-top)) !important;
    left: max(10px, env(safe-area-inset-left)) !important;
    gap: 5px !important;
    padding: 5px !important;
  }

  .site-mark .home-planet {
    width: 1.65rem !important;
    height: 1.65rem !important;
  }

  .site-mark .home-logo-text span {
    font-size: 0.6rem !important;
  }

  .float-nav {
    bottom: max(9px, env(safe-area-inset-bottom)) !important;
    gap: 2px !important;
    padding: 5px 8px !important;
    border-radius: 15px !important;
  }

  .float-nav-items { gap: 2px !important; }

  .float-nav .nav-item {
    padding: 5px 10px !important;
    font-size: 0.65rem !important;
  }

  .tips-launcher {
    width: 38px !important;
    height: 38px !important;
  }

  #Crisis,
  #Educate,
  #PhoneSafety,
  html.paragraph-scroll-enhanced #Crisis.story-section.paragraph-scroll-section,
  html.paragraph-scroll-enhanced #Educate.story-section.paragraph-scroll-section,
  html.paragraph-scroll-enhanced #PhoneSafety.story-section.paragraph-scroll-section {
    height: var(--mobile-card-height, 100svh) !important;
    min-height: var(--mobile-card-height, 100svh) !important;
    max-height: var(--mobile-card-height, 100svh) !important;
    overflow: hidden !important;
  }

  #Crisis > .hero-sticky-shell,
  #Educate > .reg-void-inner,
  #PhoneSafety > .phone-tabs-inner,
  html.paragraph-scroll-enhanced #Crisis.story-section.paragraph-scroll-section > .hero-sticky-shell,
  html.paragraph-scroll-enhanced #Educate.story-section.paragraph-scroll-section > .reg-void-inner,
  html.paragraph-scroll-enhanced #PhoneSafety.story-section.paragraph-scroll-section > .phone-tabs-inner {
    box-sizing: border-box !important;
    width: 100% !important;
    height: var(--mobile-card-height, 100svh) !important;
    min-height: var(--mobile-card-height, 100svh) !important;
    max-height: var(--mobile-card-height, 100svh) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    align-items: stretch !important;
    gap: clamp(16px, 3vw, 32px) !important;
    padding: var(--short-landscape-top) var(--short-landscape-inline) var(--short-landscape-bottom) !important;
    overflow: hidden !important;
  }

  #Crisis > .hero-sticky-shell,
  #PhoneSafety > .phone-tabs-inner,
  html.paragraph-scroll-enhanced #Crisis.story-section.paragraph-scroll-section > .hero-sticky-shell,
  html.paragraph-scroll-enhanced #PhoneSafety.story-section.paragraph-scroll-section > .phone-tabs-inner {
    grid-template-columns: minmax(0, 1.3fr) minmax(190px, 0.7fr) !important;
  }

  #Educate > .reg-void-inner,
  html.paragraph-scroll-enhanced #Educate.story-section.paragraph-scroll-section > .reg-void-inner {
    grid-template-columns: minmax(190px, 0.7fr) minmax(0, 1.3fr) !important;
  }

  /* Keep the section quotes visible without letting them cover the artwork. */
  #Crisis .hero-monitor-quote,
  #Educate .ai-poster-quote,
  #PhoneSafety .phone-platform-quote {
    display: block !important;
    z-index: 8 !important;
    width: min(100%, 300px) !important;
    margin: 0 !important;
    font-size: clamp(0.76rem, 1.65vw, 0.98rem) !important;
    line-height: 1.08 !important;
    white-space: normal !important;
    text-wrap: balance;
  }

  #Crisis .hero-monitor-quote,
  #PhoneSafety .phone-platform-quote {
    position: absolute !important;
    top: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
  }

  #Educate .ai-poster-quote {
    position: relative !important;
    inset: auto !important;
    flex: 0 0 auto !important;
    transform: none !important;
  }

  #Crisis .hero-left,
  #Educate .reg-void-left,
  #PhoneSafety .phone-tabs-copy,
  html.paragraph-scroll-enhanced #Crisis .hero-left,
  html.paragraph-scroll-enhanced #Educate .reg-void-left,
  html.paragraph-scroll-enhanced #PhoneSafety .phone-tabs-copy {
    align-self: stretch !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  #Crisis .hero-scroll-copy,
  #Educate .hero-scroll-copy,
  #PhoneSafety .hero-scroll-copy,
  html.paragraph-scroll-enhanced #Crisis .hero-scroll-copy,
  html.paragraph-scroll-enhanced #Educate .hero-scroll-copy,
  html.paragraph-scroll-enhanced #PhoneSafety .hero-scroll-copy {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  #Crisis .hero-scroll-kicker,
  #Educate .hero-scroll-kicker,
  #PhoneSafety .hero-scroll-kicker {
    display: none !important;
  }

  #Crisis .hero-scroll-stage,
  #Educate .hero-scroll-stage,
  #PhoneSafety .phone-tabs-stage,
  html.paragraph-scroll-enhanced #Crisis .hero-scroll-stage,
  html.paragraph-scroll-enhanced #Educate .hero-scroll-stage,
  html.paragraph-scroll-enhanced #PhoneSafety .phone-tabs-stage {
    flex: 1 1 auto !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain !important;
    scrollbar-gutter: stable !important;
    touch-action: pan-y !important;
  }

  #Crisis .hero-scroll-stage,
  #Educate .hero-scroll-stage {
    padding: 11px 14px !important;
  }

  #Crisis .hero-scroll-title,
  #Educate .hero-scroll-title {
    margin: 0 0 9px !important;
    font-size: clamp(1rem, 2vw, 1.2rem) !important;
    line-height: 1.14 !important;
  }

  #Crisis .hero-scroll-item p,
  #Educate .hero-scroll-item p,
  #PhoneSafety .hero-scroll-item p {
    font-size: clamp(0.74rem, 1.35vw, 0.86rem) !important;
    line-height: 1.48 !important;
  }

  #Crisis .hero-scroll-item p + p,
  #Educate .hero-scroll-item p + p,
  #PhoneSafety .hero-scroll-item p + p {
    margin-top: 0.72em !important;
  }

  #Crisis .hero-scroll-refs li,
  #Educate .hero-scroll-refs li {
    font-size: 0.64rem !important;
    line-height: 1.35 !important;
  }

  #Crisis .hero-circles,
  #Educate .ai-switch-right-col,
  #PhoneSafety .phone-tabs-right-col {
    position: relative !important;
    inset: auto !important;
    align-self: stretch !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow: hidden !important;
  }

  #Crisis .hero-circles {
    grid-column: 2 !important;
    grid-row: 1 !important;
    padding: 0 !important;
    align-items: center !important;
    align-content: center !important;
  }

  #Crisis .overload-monitor {
    width: min(460px, 100%) !important;
    transform: scale(var(--short-monitor-scale)) !important;
    transform-origin: center !important;
  }

  #Crisis .monitor-signal-icon {
    width: 44px !important;
    height: 44px !important;
    padding: 9px !important;
  }

  #Educate .ai-switch-right-col {
    grid-column: 1 !important;
    grid-row: 1 !important;
    justify-content: center !important;
    gap: 2px !important;
    overflow: visible !important;
  }

  #Educate .reg-void-left {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }

  #Educate .ai-number-card-stack {
    flex: 1 1 auto !important;
    width: min(calc(100% - 32px), 360px) !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
  }

  #Educate .ai-number-card {
    width: clamp(82px, 10vw, 124px) !important;
  }

  #Educate .ai-number-card--911 { left: clamp(46px, 5.5vw, 74px) !important; }
  #Educate .ai-number-card--311 { left: clamp(92px, 11vw, 148px) !important; }
  #Educate .ai-number-card--211 { left: clamp(138px, 16.5vw, 222px) !important; }

  #Educate .ai-poster-order-button {
    flex: 0 0 auto !important;
    height: 2rem !important;
    margin-top: -34px !important;
    padding: 0 15px !important;
    font-size: 0.62rem !important;
  }

  #PhoneSafety .phone-tabs-copy {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }

  #PhoneSafety .phone-tabs-right-col {
    grid-column: 2 !important;
    grid-row: 1 !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #PhoneSafety .phone-tabs-right-col .static-phone-holder {
    height: 100% !important;
  }

  #PhoneSafety .phone-tabs-right-col .static-phone.phone-shell {
    transform: scale(var(--short-phone-scale)) !important;
    transform-origin: center !important;
  }

  #PhoneSafety .phone-tabs-layout {
    display: grid !important;
    flex: 1 1 auto !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
  }

  #PhoneSafety .phone-tab-bar::after {
    width: 42px !important;
    height: 36px !important;
  }

  #PhoneSafety .phone-tab-list { padding-right: 42px !important; }

  #PhoneSafety .phone-tab,
  #PhoneSafety .phone-tab.phone-tab-add {
    min-height: 36px !important;
    height: 36px !important;
    padding: 7px 13px !important;
    font-size: 0.69rem !important;
  }

  #PhoneSafety .phone-tab.phone-tab-add {
    width: 42px !important;
    min-width: 42px !important;
  }

  #PhoneSafety .phone-tabs-stage,
  html.paragraph-scroll-enhanced #PhoneSafety .phone-tabs-stage {
    padding: 12px 14px 10px !important;
  }

  #PhoneSafety .phone-tab-panel,
  #PhoneSafety .phone-tabs-panels { gap: 9px !important; }

  #PhoneSafety .phone-tab-panel h3 {
    font-size: clamp(0.88rem, 1.55vw, 1rem) !important;
    line-height: 1.22 !important;
  }

  #PhoneSafety .phone-platform-icon { transform: scale(0.86) !important; }
}

@media (orientation: landscape) and (max-width: 850px) and (max-height: 650px) and (min-aspect-ratio: 3 / 2) {
  #Educate .ai-number-card {
    width: clamp(68px, 9.2vw, 82px) !important;
  }

  #Educate .ai-number-card--911 { left: clamp(35px, 4.5vw, 46px) !important; }
  #Educate .ai-number-card--311 { left: clamp(70px, 9vw, 92px) !important; }
  #Educate .ai-number-card--211 { left: clamp(105px, 13.5vw, 138px) !important; }
}

@media (orientation: landscape) and (max-width: 1100px) and (max-height: 500px) and (min-aspect-ratio: 3 / 2) {
  :root {
    --short-monitor-scale: 0.45;
    --short-phone-scale: 0.46;
  }
}

@media (orientation: landscape) and (max-width: 1100px) and (max-height: 420px) and (min-aspect-ratio: 3 / 2) {
  :root {
    --short-monitor-scale: 0.4;
    --short-phone-scale: 0.42;
  }
}

/* On extremely shallow screens, readable content wins over decoration. */
@media (orientation: landscape) and (max-width: 1100px) and (max-height: 360px) and (min-aspect-ratio: 3 / 2) {
  :root {
    --short-landscape-top: max(50px, calc(env(safe-area-inset-top) + 44px));
    --short-landscape-bottom: max(48px, calc(env(safe-area-inset-bottom) + 43px));
  }

  #Crisis > .hero-sticky-shell,
  #Educate > .reg-void-inner,
  #PhoneSafety > .phone-tabs-inner,
  html.paragraph-scroll-enhanced #Crisis.story-section.paragraph-scroll-section > .hero-sticky-shell,
  html.paragraph-scroll-enhanced #Educate.story-section.paragraph-scroll-section > .reg-void-inner,
  html.paragraph-scroll-enhanced #PhoneSafety.story-section.paragraph-scroll-section > .phone-tabs-inner {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #Crisis .hero-circles,
  #Educate .ai-switch-right-col,
  #PhoneSafety .phone-tabs-right-col {
    display: none !important;
  }

  #Crisis .hero-left,
  #Educate .reg-void-left,
  #PhoneSafety .phone-tabs-copy {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }
}
