/* Consensus Economics — streamlined phone masthead + homepage proof grid.
 * This stylesheet comes after the existing mobile UX layers. It does not
 * change desktop/tablet headings, cards, navigation, or sample/order flows. */

/* The header's dedicated phone action never appears at tablet/desktop sizes. */
.cei-phone-header-order { display: none; }

@media (max-width: 767px) {
  /* Menu launcher remains the existing functional phone-drawer trigger.
     Give the actual logo a clear centre position, with Order at the right. */
  html body .site-header .header-top {
    min-height: 60px !important;
    padding: 0 !important;
    background: #fff !important;
  }
  html body .site-header .header-top > .wrap {
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-height: 60px !important;
    padding: 8px 14px 8px 62px !important;
    gap: 10px !important;
  }
  html body .site-header .header-top .logo {
    display: flex !important;
    visibility: visible !important;
    align-items: center !important;
    flex: 1 1 auto !important;
    float: none !important;
    position: static !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  html body .site-header .header-top .logo .custom-logo-link {
    display: inline-flex !important;
    align-items: center !important;
    width: auto !important;
    max-width: min(100%, 210px) !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  html body .site-header .header-top .logo .custom-logo-link img,
  html body .site-header .header-top .logo img.custom-logo {
    display: block !important;
    visibility: visible !important;
    width: auto !important;
    max-width: 100% !important;
    max-height: 36px !important;
    height: auto !important;
    object-fit: contain;
  }
  /* Hide the old Samples/Order utility row, not its actual routes: samples
     remain accessible from the drawer and the homepage's full-width CTA. */
  html body .site-header .header-top .header-top-right,
  html body .site-header .header-top .header-top-middle {
    display: none !important;
  }
  html body .site-header .header-top .cei-phone-header-order {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    min-height: 44px !important;
    min-width: 82px;
    padding: 0 14px;
    margin: 0;
    border: 1px solid #244366;
    border-radius: 8px;
    background: #244366;
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.15;
    text-decoration: none !important;
    white-space: nowrap;
  }
  html body .site-header .header-top .cei-phone-header-order:focus-visible {
    outline: 2px solid #2676af !important;
    outline-offset: 3px !important;
  }
  /* This existing control opens the same mobile menu as before. */
  html body .cei-phone-v2-launcher {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
  }

  /* More restrained hero typography on phones; leave the text and CTA as is. */
  html body.home .cei-home-hero__title {
    font-size: clamp(30px, 8.15vw, 34.5px) !important;
    line-height: 1.14 !important;
  }
  /* Supporting copy stays readable, but no longer competes with the H1. */
  html body.home .cei-home-hero__text {
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 1.55 !important;
  }

  /* Phone statistics are two equal-width cards; the fifth fills the row. */
  html body.home .cei-home-hero__proof {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    align-items: stretch !important;
  }
  html body.home .cei-home-hero__proof > .cei-home-hero__stat {
    grid-column: auto !important;
    min-width: 0 !important;
    min-height: 100px !important;
    padding: 12px 14px !important;
  }
  html body.home .cei-home-hero__proof > .cei-home-hero__stat strong {
    font-size: clamp(25px, 6.9vw, 29px) !important;
    min-height: 0 !important;
  }
  html body.home .cei-home-hero__proof > .cei-home-hero__stat span {
    font-size: 12px !important;
    line-height: 1.35 !important;
    font-weight: 500 !important;
    min-height: 0 !important;
    margin-top: 8px;
  }
  html body.home .cei-home-hero__proof > .cei-home-hero__stat:last-child {
    grid-column: 1 / -1 !important;
    min-height: 78px !important;
    align-items: stretch !important;
    text-align: left !important;
  }
  html body.home .cei-home-hero__proof > .cei-home-hero__stat:last-child strong,
  html body.home .cei-home-hero__proof > .cei-home-hero__stat:last-child span {
    text-align: left !important;
    align-self: auto !important;
  }
  html body.home .cei-home-hero__proof > .cei-home-hero__stat:last-child::after {
    left: 20px;
  }
  html body.home .cei-home-hero__proof > .cei-home-hero__stat:last-child::before {
    left: 20px !important;
    right: auto !important;
    transform: none !important;
  }
}

/* Narrower phones need more room for the logo and country/stat captions. */
@media (max-width: 359px) {
  html body .site-header .header-top > .wrap {
    padding-left: 59px !important;
    padding-right: 11px !important;
    gap: 6px !important;
  }
  html body .site-header .header-top .cei-phone-header-order {
    min-width: 72px;
    padding: 0 10px;
  }
  html body.home .cei-home-hero__proof {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  html body.home .cei-home-hero__proof > .cei-home-hero__stat:last-child {
    grid-column: auto !important;
  }
}

/* Compact masthead: real Order link text must remain readable.
   Higher specificity than generic legacy header anchor rules. */
@media screen and (max-width: 767px) {
    html body .site-header .header-top > .wrap > a.cei-phone-header-order,
    html body .site-header .header-top > .wrap > a.cei-phone-header-order:link,
    html body .site-header .header-top > .wrap > a.cei-phone-header-order:visited {
        color: #fff;
        -webkit-text-fill-color: #fff;
        opacity: 1;
        text-shadow: none;
        font-size: 13px;
        font-weight: 650;
        line-height: 1.2;
        background-color: #173f63;
        border-color: #173f63;
    }
    html body .site-header .header-top > .wrap > a.cei-phone-header-order:hover {
        background-color: #24577e;
        border-color: #24577e;
    }
}
