/* Layout fixes for widths the Webflow design never fitted.
 *
 * Hand-maintained. The Webflow export (clover-medical.webflow.css) is kept
 * verbatim for pixel parity, so these overrides live here, loaded after it,
 * instead of being edited into the export. Each section only applies inside
 * the width range where the original overflowed; outside it the design is
 * exactly as exported.
 */

/* ---------------------------------------------------------------------------
 * 1. Desktop navbar, 992px to 1365px
 *
 * The exported navbar is a three-column grid (.25fr 1fr .25fr) whose columns
 * cannot shrink below their content: logo 148px, six links padded 24px each
 * side (756px), and the "Request consultation" pill plus a 16px margin
 * (280px). That is 1216px of content, which only fits inside the 5% side
 * padding from about 1366px up. Below that the pill was pushed off the right
 * edge (to x=1268 at a 1024px window), cutting it off and making every page
 * scroll sideways. Webflow only switches to the hamburger at 991px, so 992px
 * to 1365px had no layout that fitted.
 *
 * In that range the menu takes whatever space the logo and pill leave and
 * spreads the links evenly across it, with tighter padding. Below 1280px the
 * nav type, pill and logo also step down a size so it still fits at 992px.
 * ------------------------------------------------------------------------- */
@media screen and (min-width: 992px) and (max-width: 1365px) {
  .navbar_container {
    grid-template-columns: auto 1fr auto;
  }

  /* The export centres the menu through this generated id
     (justify-self: center), which would hold it at its content width. Only an
     id selector outranks it; the id is the same on every page's navbar. */
  #w-node-_12482f3a-1788-8953-1afe-045ad567e70d-d567e709 {
    justify-self: stretch;
  }

  .navbar_menu {
    justify-content: space-around;
  }

  .navbar_button-wrapper {
    margin-left: 0;
  }

  .navbar_link {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  /* 8px either side of the label like the plain links, plus room for the
     chevron, so the gaps between all six items stay even. */
  .navbar_dropdwn-toggle {
    padding-left: 0.5rem;
    padding-right: 2rem;
  }

  .dropdown-icon {
    margin-right: 0.5rem;
  }
}

@media screen and (min-width: 992px) and (max-width: 1279px) {
  .navbar_link,
  .navbar_dropdwn-toggle,
  .navbar_button {
    font-size: 0.875rem;
  }

  .navbar_button {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .navbar_logo-link,
  .navbar_logo-link.w--current {
    width: 120px;
  }
}

/* ---------------------------------------------------------------------------
 * 2. Package tabs on /packages (Standard, Sexual health, Fertility...)
 *
 * The tab pills never wrap their text (white-space: nowrap) and sit in equal
 * 1fr grid columns: five across for Clover Woman, four for Clover Man, two
 * below 992px. Equal columns are as wide as the widest pill ("Sexual health
 * Add-on", about 289px), so the row needs about 1500px and overflowed the
 * page from 992px to about 1416px (to x=1282 at 1024px), and the two-column
 * tablet grid overflowed again between 480px and 559px.
 *
 * Fix: from 992px to 1439px the pills lose some side padding and size to
 * their labels in one row; below 1280px, where one row cannot fit, they form
 * two balanced rows (3 + 2 for Woman, 2 + 2 for Man). Below 560px Woman uses
 * the single column that Man and the phone layout already use, and on phones
 * a pill may wrap its label rather than spill out of a 320px screen.
 * ------------------------------------------------------------------------- */
@media screen and (min-width: 992px) and (max-width: 1439px) {
  ._w-tab-link {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .tabs-menu,
  .tabs-menu.woman {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: auto;
  }
}

@media screen and (min-width: 992px) and (max-width: 1279px) {
  .tabs-menu,
  .tabs-menu.woman {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Six narrow columns: the first three pills span two each, the last two
     span three each, giving two full-width rows of 3 + 2. */
  .tabs-menu.woman {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .tabs-menu.woman > :nth-child(-n + 3) {
    grid-column: span 2;
  }

  .tabs-menu.woman > :nth-child(n + 4) {
    grid-column: span 3;
  }
}

@media screen and (max-width: 559px) {
  .tabs-menu.woman {
    grid-template-columns: 1fr;
  }
}

@media screen and (max-width: 479px) {
  ._w-tab-link {
    padding-left: 1rem;
    padding-right: 1rem;
    white-space: normal;
  }
}

/* ---------------------------------------------------------------------------
 * 3. Long addresses in rich text (privacy policy, terms, blog posts)
 *
 * An email address or URL is one unbreakable word, so on a 320px phone
 * "enquiries@clovermedical.co.uk" in the privacy policy ran 23px past the
 * screen. break-word only splits a word when it cannot fit on a line by
 * itself, so ordinary text wraps exactly as before.
 * ------------------------------------------------------------------------- */
.w-richtext {
  overflow-wrap: break-word;
}

/* ---------------------------------------------------------------------------
 * 4. Long button labels on small phones
 *
 * .button never wraps (white-space: nowrap), so "Get the Clover Woman package"
 * on /packages is 318px wide and ran past a 320px screen. On phones a label
 * may now wrap onto a second line when, and only when, it does not fit; the
 * pill already centres its text and has a 56px minimum height.
 * ------------------------------------------------------------------------- */
@media screen and (max-width: 479px) {
  .button {
    white-space: normal;
  }
}
