/* ==========================================================================
   Company banner - the navbar on every page, in the selected company's colours.

   The navbar (partials/navbar.ejs, class bms-banner) is a band in the colours
   of whichever company is selected in its TCO / ITSL / ESUPPLY buttons: The
   Change midnight and blue (the TCO design system - George's "The Change
   Organisation" design system artifact: tco-midnight #00001F, tco-blue
   #406FB2, tco-sky #45BBE7, Montserrat, pill buttons), Inspired green and
   eSupply orange,
   both taken from their own websites (inspiredtech.co.uk --primary #00cd82;
   esupply.co.uk's primary button #ffb63d / #f5a828 with navy #1c2d4b text).

   A small script in navbar.ejs keeps body[data-company] equal to the hidden
   company input, however the page sets it (a button click, or the page's own
   company, as on the Sales Buddy pages), and the blocks below swap the
   --cb-* tokens. Anything that is not a company (TEST) keeps The Change's.

   Loaded by partials/header.ejs on every page, before the page's own styles,
   so a page theme can build on the tokens: Stock Tools draws the same banner
   taller, behind a transparent navbar (stock-theme.css). The banner keeps its
   colours in the dark theme too.
   ========================================================================== */

body {
  --cb-bg: linear-gradient(100deg, #00001f, #071831);   /* tco-midnight into the dark surface-alt */
  /* The wave, for a page that draws the banner taller (Stock Tools); the navbar band itself is the gradient alone. */
  --cb-wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 240' preserveAspectRatio='none'%3E%3Cg fill='none' stroke='%2345bbe7'%3E%3Cpath d='M620 -10 C 900 60, 1150 150, 1600 205' stroke-opacity='.55' stroke-width='1.4'/%3E%3Cpath d='M660 -10 C 940 70, 1180 158, 1600 196' stroke-opacity='.35'/%3E%3Cpath d='M700 -10 C 980 80, 1210 166, 1600 187' stroke-opacity='.28'/%3E%3Cpath d='M740 -10 C 1020 90, 1240 174, 1600 178' stroke-opacity='.22'/%3E%3Cpath d='M780 -10 C 1060 100, 1270 182, 1600 169' stroke-opacity='.16'/%3E%3Cpath d='M820 -10 C 1100 110, 1300 190, 1600 160' stroke-opacity='.12'/%3E%3Cpath d='M860 -10 C 1140 120, 1330 198, 1600 151' stroke-opacity='.09'/%3E%3C/g%3E%3C/svg%3E");
  --cb-rule: #406fb2;                 /* the line along the bottom: tco-blue */
  --cb-glow: rgba(64, 111, 178, .6);
  --cb-ink: 255, 255, 255;            /* r, g, b - text on the banner, used at several opacities */
  --cb-kicker: #45bbe7;               /* eyebrow on a page's own banner (Stock Tools): tco-sky on dark */
  --cb-pill-ink: #00001f;             /* text on the selected (white) company pill: tco-midnight */
  --cb-active: #45bbe7;               /* underline under the current page's link: tco-sky */
  --cb-menu: #00001f;                 /* the folded-open menu on narrow screens */
  --cb-icon-filter: invert(1);        /* the menu button's dark icon, made light */
  --cb-logo: url('/images/the-change-white.png');
  --cb-logo-w: 94px;
}

/* Inspired: deep green into the brand green, white text and the white logo
   (its mark is green, so the logo end of the banner stays dark). */
body[data-company='ITSL'] {
  --cb-bg: linear-gradient(100deg, #0b3a2b 0%, #00875a 45%, #00cd82 100%);
  --cb-wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 240' preserveAspectRatio='none'%3E%3Cg fill='none' stroke='%23ffffff'%3E%3Cpath d='M620 -10 C 900 60, 1150 150, 1600 205' stroke-opacity='.5' stroke-width='1.4'/%3E%3Cpath d='M660 -10 C 940 70, 1180 158, 1600 196' stroke-opacity='.32'/%3E%3Cpath d='M700 -10 C 980 80, 1210 166, 1600 187' stroke-opacity='.25'/%3E%3Cpath d='M740 -10 C 1020 90, 1240 174, 1600 178' stroke-opacity='.2'/%3E%3Cpath d='M780 -10 C 1060 100, 1270 182, 1600 169' stroke-opacity='.15'/%3E%3Cpath d='M820 -10 C 1100 110, 1300 190, 1600 160' stroke-opacity='.11'/%3E%3Cpath d='M860 -10 C 1140 120, 1330 198, 1600 151' stroke-opacity='.08'/%3E%3C/g%3E%3C/svg%3E");
  --cb-rule: #00cd82;
  --cb-glow: rgba(0, 205, 130, .6);
  --cb-kicker: #a6f0d2;
  --cb-pill-ink: #1a2323;
  --cb-active: #ffffff;
  --cb-menu: #0b3a2b;
  --cb-logo: url('/images/inspired-white.png');
  --cb-logo-w: 128px;
}

/* eSupply: the orange of its buttons, with their navy text. */
body[data-company='ESUPPLY'] {
  --cb-bg: linear-gradient(100deg, #f5a828, #ffb63d 55%, #ffc463);
  --cb-wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 240' preserveAspectRatio='none'%3E%3Cg fill='none' stroke='%231c2d4b'%3E%3Cpath d='M620 -10 C 900 60, 1150 150, 1600 205' stroke-opacity='.3' stroke-width='1.4'/%3E%3Cpath d='M660 -10 C 940 70, 1180 158, 1600 196' stroke-opacity='.2'/%3E%3Cpath d='M700 -10 C 980 80, 1210 166, 1600 187' stroke-opacity='.16'/%3E%3Cpath d='M740 -10 C 1020 90, 1240 174, 1600 178' stroke-opacity='.12'/%3E%3Cpath d='M780 -10 C 1060 100, 1270 182, 1600 169' stroke-opacity='.09'/%3E%3Cpath d='M820 -10 C 1100 110, 1300 190, 1600 160' stroke-opacity='.07'/%3E%3Cpath d='M860 -10 C 1140 120, 1330 198, 1600 151' stroke-opacity='.05'/%3E%3C/g%3E%3C/svg%3E");
  --cb-rule: #1c2d4b;
  --cb-glow: rgba(28, 45, 75, .35);
  --cb-kicker: #6b4a0e;
  --cb-ink: 28, 45, 75;
  --cb-pill-ink: #1c2d4b;
  --cb-active: #1c2d4b;
  --cb-menu: #ffc463;
  --cb-icon-filter: none;
  --cb-logo: url('/images/esupply-logo.png');
  --cb-logo-w: 112px;
}

/* ---- The band ----------------------------------------------------------- */
/* :root lifts these rules over main.css's dark-theme navbar rules (and, with
   !important, Bootstrap's text-primary / text-white / bg-primary utilities on
   the links). The band is the gradient alone: at navbar height the wave's
   lines would run through the company pills. */
.navbar.bms-banner {
  font-family: Montserrat, Arial, sans-serif;
  position: relative;
  z-index: 2;
  min-height: 68px;
  background: var(--cb-bg);
  border-bottom: 4px solid var(--cb-rule);
  box-shadow: 0 6px 18px -8px var(--cb-glow);
}
/* The logo, drawn here so it changes with the company. */
.navbar.bms-banner > .container-fluid::before {
  content: '';
  flex: 0 0 auto;
  width: var(--cb-logo-w);
  height: 44px;
  margin-right: 1.75rem;
  background: var(--cb-logo) left center / contain no-repeat;
}
/* eSupply's logo is navy and orange on white, so it sits in a white chip. */
body[data-company='ESUPPLY'] .navbar.bms-banner > .container-fluid::before {
  background-color: #fff;
  background-origin: content-box;
  padding: 4px 8px;
  border-radius: 8px;
  box-sizing: border-box;
}

:root .navbar.bms-banner .nav-link {
  color: rgba(var(--cb-ink), .78) !important;
  background: transparent !important;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 12px !important;
  border-radius: 6px;
  position: relative;
}
:root .navbar.bms-banner .nav-link:hover {
  color: rgb(var(--cb-ink)) !important;
  background: rgba(var(--cb-ink), .06) !important;
}
/* The current page: full-strength text and an underline. */
:root .navbar.bms-banner .nav-link.active { color: rgb(var(--cb-ink)) !important; }
.navbar.bms-banner .nav-link.active::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -2px;
  height: 3px;
  border-radius: 2px;
  background: var(--cb-active);
}

:root .navbar.bms-banner .navbar-toggler { border-color: rgba(var(--cb-ink), .4); }
:root .navbar.bms-banner .navbar-toggler-icon { filter: var(--cb-icon-filter); }
/* Below xl the menu folds open over the band: give it a ground to sit on. */
@media (max-width: 1199.98px) {
  .navbar.bms-banner .navbar-collapse.show {
    background: var(--cb-menu);
    border-radius: 10px;
    padding: .5rem;
    margin-top: .5rem;
  }
}
@media (max-width: 767.98px) {
  .navbar.bms-banner > .container-fluid::before { width: calc(var(--cb-logo-w) * .77); height: 34px; }
}

/* ---- Company pills ------------------------------------------------------ */
/* Glass with a coloured dot; the selected company's pill is white. The pages
   mark the selected button in different ways (fw-bold, opacity-50, MSA Admin's
   database-btn-*-filter), so the pill follows body[data-company] instead. */
.navbar.bms-banner #company_database { gap: 8px !important; }
.navbar.bms-banner #company_database .btn {
  --cb-dot: #9aa7bd;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(var(--cb-ink), .18);
  background: rgba(var(--cb-ink), .05);
  color: rgba(var(--cb-ink), .8);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-decoration: none !important;
  opacity: 1 !important;
}
.navbar.bms-banner #company_database .btn::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cb-dot);
}
.navbar.bms-banner #company_database .btn[data-company='TCO'] { --cb-dot: #45bbe7; }
.navbar.bms-banner #company_database .btn[data-company='ITSL'] { --cb-dot: #00cd82; }
.navbar.bms-banner #company_database .btn[data-company='ESUPPLY'] { --cb-dot: #f5a828; }
.navbar.bms-banner #company_database .btn[data-company='TEST'] { --cb-dot: #9aa7bd; }
.navbar.bms-banner #company_database .btn:hover {
  background: rgba(var(--cb-ink), .14);
  color: rgb(var(--cb-ink));
}
body[data-company='TCO'] .navbar.bms-banner #company_database .btn[data-company='TCO'],
body[data-company='ITSL'] .navbar.bms-banner #company_database .btn[data-company='ITSL'],
body[data-company='ESUPPLY'] .navbar.bms-banner #company_database .btn[data-company='ESUPPLY'],
body[data-company='TEST'] .navbar.bms-banner #company_database .btn[data-company='TEST'] {
  background: #fff;
  border-color: #fff;
  color: var(--cb-pill-ink);
}

:root .navbar.bms-banner #theme_toggle {
  color: rgb(var(--cb-ink));
  border-color: rgba(var(--cb-ink), .4);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 13px;
}
:root .navbar.bms-banner #theme_toggle:hover { background: rgba(var(--cb-ink), .1); }
