/* Taj Catalog 5.49.7 - the "Scientific & Chemical" / "Surgical & Medical" buttons and the gaps of the header.

   1. Phones and desktop: the buttons no longer slide away when you scroll. The whole header (logo bar, the two
      buttons, search) stays frozen; before, only the logo bar and the search stayed.
   2. Desktop: the two buttons sit in the MIDDLE of the logo row (between the logo and Phone / Mail) as small rounded boxes
      with a hairline (1/4 pt) outline. On screens narrower than 1180px they stay in their own row under the logo bar.
   3. Desktop: the spare gaps are gone (logo row > search, search > line, category names > line, breadcrumb > page).

   Separate file so taj-catalog.css and taj-catalog.js stay untouched (and a cached copy of them can never hide these rules).
   taj-catalog.js still measures the header and writes --taj-stick / --taj-hh / --taj-mstick; the rules below simply
   add the part that used to slide away (minus --taj-stick) back on. Tablets (721px - 1000px) show no unit buttons and are not touched.
   If the page HTML is an older cached copy without the extra unit links (.taj-ub-nav), the old row simply stays where it was. */

@media (min-width: 1001px), (max-width: 720px) {
    :root {
        --taj-hhf: calc(var(--taj-hh, 96px) - var(--taj-stick, 0px));          /* height of everything that is frozen */
        --taj-mstickf: calc(var(--taj-mstick, 71px) - var(--taj-stick, 0px));  /* where the frozen category names start */
    }
    html { scroll-padding-top: calc(var(--taj-ab, 0px) + var(--taj-hhf)); }

    /* The header sticks right under the logo bar and does not slide up behind it. */
    body.taj-active .taj-header { top: calc(var(--taj-ab, 0px) + var(--taj-bh, 0px)); }

    /* Everything that sticks under the header moves down by the same amount. */
    body.taj-active .taj-help-nav,
    body.taj-active .taj-wrapped-cart .cart-collaterals .cart_totals { top: calc(var(--taj-ab, 0px) + var(--taj-hhf) + 16px); }
    body.taj-active:is(.taj-unit-scientific, .taj-unit-medical) .taj-mcats { top: calc(var(--taj-ab, 0px) + var(--taj-bh, 0px) + var(--taj-mstickf)); }
}

/* ======================================================================== phone */
@media (max-width: 720px) {
    /* The buttons are frozen now, so give the frozen area back a little: less air above them and between them and the search. */
    body.taj-active .taj-header .taj-header-in {
        padding-top: 3px !important;
        row-gap: 8px !important;
    }
}

/* ======================================================================== desktop: gaps */
@media (min-width: 1001px) {
    body.taj-active .taj-unitbar {
        top: calc(var(--taj-ab, 0px) + var(--taj-hhf) + 12px);
        max-height: calc(100vh - var(--taj-ab, 0px) - var(--taj-hhf) - 24px);
    }
    /* logo bar -> search: no line, no spare space */
    body.taj-active .taj-mobile-phone { border-bottom: 0 !important; }
    body.taj-active .taj-mobile-phone .taj-wrap { padding: 6px 32px 6px !important; }
    body.taj-active .taj-header .taj-header-in { padding-top: 4px !important; padding-bottom: 6px !important; row-gap: 5px !important; }
    /* category names -> the line below them, circles closer to the line above */
    body.taj-active:is(.taj-unit-scientific, .taj-unit-medical, .taj-is-home) .taj-mcats a.taj-mcat { padding-bottom: 3px !important; }
    body.taj-active:is(.taj-unit-scientific, .taj-unit-medical) .taj-mcats .taj-mcats-in { padding-top: 10px !important; }
    /* breadcrumb -> sidebar / page */
    body.taj-active .taj-landing .taj-crumbs { margin: 4px 0 0 !important; }
    body.taj-active .taj-withbar { padding-top: 8px; }
    body.taj-active .taj-wrap-bar .taj-withbar { padding-top: 14px; }
}

/* ======================================================================== desktop: the unit boxes (own row, 1001px - 1179px) */
@media (min-width: 1001px) {
    body.taj-active .taj-header .taj-header-in a.taj-us {
        --ub: #43A047;                                   /* Scientific = green */
        min-width: 0 !important;
        padding: 0 22px !important;
        background: #fff !important;
        background-color: #fff !important;
        color: #000 !important;
        border: 0.333px solid var(--ub) !important;      /* 1/4 pt: the thinnest line the screen can draw */
        border-radius: 8px !important;
        box-shadow: none !important;
        font-weight: 600;
    }
    body.taj-active .taj-header .taj-header-in a.taj-us-medical { --ub: #D32F2F; }   /* Surgical = red */
    body.taj-active .taj-header .taj-header-in a.taj-us .taj-i,
    body.taj-active .taj-header .taj-header-in a.taj-us svg { color: var(--ub) !important; }
    body.taj-active .taj-header .taj-header-in a.taj-us.is-active { font-weight: 800; border-color: #F28C28 !important; background: #FFF6EE !important; background-color: #FFF6EE !important; box-shadow: none !important; }
    body.taj-active .taj-header .taj-header-in a.taj-us:hover { border-color: #F28C28 !important; }
}

/* ======================================================================== desktop: the unit boxes in the middle of the logo row (1180px and wider) */
@media (min-width: 1180px) {
  @supports selector(:has(a)) {
    /* the old row under the logo bar goes away, but only when the page really has the new links */
    body.taj-active:has(.taj-mobile-phone .taj-ub-nav) .taj-header .taj-header-in .taj-unitswitch { display: none !important; }
    body.taj-active:has(.taj-mobile-phone .taj-ub-nav) .taj-header .taj-header-in { grid-template-areas: "search actions" !important; }

    /* logo | unit boxes | phone + mail: the boxes are exactly in the middle of the page */
    body.taj-active:has(.taj-ub-nav) .taj-mobile-phone .taj-wrap {
        display: grid !important;
        grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
        align-items: center;
        column-gap: 24px;
    }
    body.taj-active:has(.taj-ub-nav) .taj-mobile-phone a.taj-mbrand { grid-column: 1; justify-self: start; }
    body.taj-active:has(.taj-ub-nav) .taj-mobile-phone .taj-mobile-contact { grid-column: 3; justify-self: end; }
    body.taj-active .taj-mobile-phone .taj-ub-nav { display: flex !important; grid-column: 2; justify-self: center; align-items: center; gap: 14px; }

    body.taj-active .taj-mobile-phone .taj-ub-nav a.taj-ub {
        --ub: #43A047;                                   /* Scientific = green */
        display: flex;
        align-items: center;
        gap: 8px;
        box-sizing: border-box;
        height: 30px;
        padding: 0 22px;
        background: #fff !important;
        color: #000 !important;
        border: 0.333px solid var(--ub);                 /* 1/4 pt: the thinnest line the screen can draw */
        border-radius: 8px;
        font-size: 12.5px;
        font-weight: 600;
        line-height: 1.2;
        white-space: nowrap;
        text-decoration: none !important;
    }
    body.taj-active .taj-mobile-phone .taj-ub-nav a.taj-ub-medical { --ub: #D32F2F; }   /* Surgical = red */
    body.taj-active .taj-mobile-phone .taj-ub-nav a.taj-ub .taj-i { width: 15px !important; height: 15px !important; flex: none; color: var(--ub) !important; }
    body.taj-active .taj-mobile-phone .taj-ub-nav a.taj-ub.is-active { font-weight: 800; border-color: #F28C28; background: #FFF6EE !important; }
    body.taj-active .taj-mobile-phone .taj-ub-nav a.taj-ub:hover { border-color: #F28C28; }
  }
}
