/* GO v49: hard mobile fixes for header search duplicates and hero overlap. */
@media (max-width: 700px) {
  html,
  body {
    overflow-x: hidden !important;
  }

  /* Header: no duplicated search/X controls on mobile. */
  html body:not(.wp-admin) header#site-header.go-v24-header {
    height: 52px !important;
    min-height: 52px !important;
  }

  html body:not(.wp-admin) .go-v24-header-inner {
    width: calc(100vw - 18px) !important;
    max-width: calc(100vw - 18px) !important;
    height: 52px !important;
    min-height: 52px !important;
    display: grid !important;
    grid-template-columns: auto 1fr auto !important;
    align-items: center !important;
    gap: 8px !important;
  }

  html body:not(.wp-admin) .go-v24-header-left {
    height: 52px !important;
    min-width: 0 !important;
    gap: 8px !important;
  }

  html body:not(.wp-admin) .go-v24-header-actions {
    height: 52px !important;
    min-width: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
  }

  /* Hide full desktop search form on mobile. It caused the extra search icon and native X. */
  html body:not(.wp-admin) .go-v24-header-search {
    display: none !important;
  }

  /* Keep one clean search trigger only. */
  html body:not(.wp-admin) .go-v24-search-icon-button {
    display: inline-grid !important;
    place-items: center !important;
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: inherit !important;
  }

  html body:not(.wp-admin) .go-v24-search-icon-button svg {
    width: 19px !important;
    height: 19px !important;
  }

  /* Hide social X/follow text on small screens to prevent the two-X bug. */
  html body:not(.wp-admin) .go-v38-follow-link,
  html body:not(.wp-admin) .go-v31-social-link--x {
    display: none !important;
  }

  html body:not(.wp-admin) .go-v31-theme-toggle.newsx-dark-mode-switcher,
  html body:not(.wp-admin) .go-v27-theme-toggle.newsx-dark-mode-switcher {
    width: 50px !important;
    min-width: 50px !important;
    height: 28px !important;
    flex: 0 0 50px !important;
  }

  html body:not(.wp-admin) .go-v31-theme-toggle .go-shell-dark-toggle-thumb,
  html body:not(.wp-admin) .go-v27-theme-toggle .go-shell-dark-toggle-thumb {
    width: 22px !important;
    height: 22px !important;
    top: 2px !important;
    left: 2px !important;
  }

  html body.dark-mode:not(.wp-admin) .go-v31-theme-toggle .go-shell-dark-toggle-thumb,
  html body.newsx-dark-mode:not(.wp-admin) .go-v31-theme-toggle .go-shell-dark-toggle-thumb,
  html.dark body:not(.wp-admin) .go-v31-theme-toggle .go-shell-dark-toggle-thumb,
  html body:not(.wp-admin) .go-v31-theme-toggle.newsx-dark-mode-switcher.active .go-shell-dark-toggle-thumb,
  html body.dark-mode:not(.wp-admin) .go-v27-theme-toggle .go-shell-dark-toggle-thumb,
  html body.newsx-dark-mode:not(.wp-admin) .go-v27-theme-toggle .go-shell-dark-toggle-thumb,
  html.dark body:not(.wp-admin) .go-v27-theme-toggle .go-shell-dark-toggle-thumb,
  html body:not(.wp-admin) .go-v27-theme-toggle.newsx-dark-mode-switcher.active .go-shell-dark-toggle-thumb {
    transform: translateX(22px) !important;
  }

  /* Functional latest bar below header: horizontal and compact, no layout break. */
  html body:not(.wp-admin) .go-v43-trending-inner {
    width: calc(100vw - 18px) !important;
    max-width: calc(100vw - 18px) !important;
    gap: 10px !important;
  }

  html body:not(.wp-admin) .go-v43-trending-links {
    overflow-x: auto !important;
    scrollbar-width: none !important;
    gap: 12px !important;
  }

  html body:not(.wp-admin) .go-v43-trending-links::-webkit-scrollbar {
    display: none !important;
  }

  html body:not(.wp-admin) .go-v43-trending-links a {
    flex: 0 0 auto !important;
    max-width: 140px !important;
  }

  /* Home hero: fix weird first card and overlapping cards. */
  body.home:not(.wp-admin) .go-ds-home {
    padding-top: 0 !important;
  }

  body.home:not(.wp-admin) .go-ds-wrap {
    width: calc(100vw - 18px) !important;
    max-width: calc(100vw - 18px) !important;
    margin-inline: auto !important;
  }

  body.home:not(.wp-admin) .go-ds-hero {
    margin-top: 18px !important;
    margin-bottom: 22px !important;
    overflow: visible !important;
  }

  body.home:not(.wp-admin) .go-ds-hero-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 18px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }

  body.home:not(.wp-admin) .go-ds-hero-card,
  body.home:not(.wp-admin) .go-ds-hero-card--main,
  body.home:not(.wp-admin) .go-ds-hero-card--small,
  body.home:not(.wp-admin) .go-ds-hero-card--1,
  body.home:not(.wp-admin) .go-ds-hero-card--2,
  body.home:not(.wp-admin) .go-ds-hero-card--3,
  body.home:not(.wp-admin) .go-ds-hero-card--4,
  body.home:not(.wp-admin) .go-ds-hero-card--5 {
    display: block !important;
    position: relative !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 16 / 10 !important;
    margin: 0 !important;
    grid-column: auto !important;
    grid-row: auto !important;
    border-radius: 12px !important;
    overflow: hidden !important;
  }

  body.home:not(.wp-admin) .go-ds-hero-card--main {
    aspect-ratio: 4 / 5 !important;
    min-height: 334px !important;
    max-height: 430px !important;
  }

  body.home:not(.wp-admin) .go-ds-hero-card img,
  body.home:not(.wp-admin) .go-ds-hero-card picture,
  body.home:not(.wp-admin) .go-ds-hero-card .go-ds-card-img,
  body.home:not(.wp-admin) .go-ds-hero-card .go-ds-card-media img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
  }

  body.home:not(.wp-admin) .go-ds-hero-shade {
    background: linear-gradient(180deg, rgba(0,0,0,.05) 0%, rgba(0,0,0,.24) 38%, rgba(0,0,0,.78) 100%) !important;
  }

  body.home:not(.wp-admin) .go-ds-hero-copy {
    left: 16px !important;
    right: 16px !important;
    bottom: 16px !important;
    top: auto !important;
    max-width: calc(100% - 32px) !important;
    transform: none !important;
  }

  body.home:not(.wp-admin) .go-ds-hero-card--main .go-ds-hero-copy strong {
    font-size: clamp(25px, 7.4vw, 32px) !important;
    line-height: 1.01 !important;
    letter-spacing: -.045em !important;
    -webkit-line-clamp: 4 !important;
    text-wrap: balance !important;
  }

  body.home:not(.wp-admin) .go-ds-hero-card--main .go-ds-hero-copy em {
    font-size: 14px !important;
    line-height: 1.32 !important;
    -webkit-line-clamp: 4 !important;
  }

  body.home:not(.wp-admin) .go-ds-hero-card:not(.go-ds-hero-card--main) .go-ds-hero-copy strong {
    font-size: clamp(19px, 5.7vw, 24px) !important;
    line-height: 1.03 !important;
    -webkit-line-clamp: 3 !important;
  }

  body.home:not(.wp-admin) .go-ds-hero-card:not(.go-ds-hero-card--main) .go-ds-hero-copy em {
    display: none !important;
  }
}

@media (max-width: 390px) {
  body.home:not(.wp-admin) .go-ds-hero-card--main {
    min-height: 318px !important;
  }

  body.home:not(.wp-admin) .go-ds-hero-copy {
    left: 14px !important;
    right: 14px !important;
    bottom: 14px !important;
  }

  body.home:not(.wp-admin) .go-ds-hero-card--main .go-ds-hero-copy strong {
    font-size: clamp(23px, 7vw, 29px) !important;
  }
}
