/* ---------------------------------------------------------------------------
   Find tyres by reg
   ---------------------------------------------------------------------------
   The tab on the right edge of an article or the hub and the panel it opens,
   both built by find-by-reg.js. The form inside is the home page hero's
   markup and classes, styled by main.css; this sheet only sets the sizes a
   narrow panel needs, then draws the tab, the backdrop and the panel.
   Prefixed .fbr throughout. Registered in EcommerceBase.Site.csproj -
   without that the deploy leaves it behind.
   --------------------------------------------------------------------------- */

.fbr {
  --fbr-red: #ff0801;
  --fbr-red-dark: #d40600;
  --fbr-ink: #202020;
  --fbr-body: #5b6068;
  --fbr-soft: #878d97;
  --fbr-head: "Montserrat", "Inter", Helvetica, Arial, sans-serif;
  --fbr-sans: "Inter", Helvetica, Arial, sans-serif;
  font-family: var(--fbr-sans);
}
.fbr *, .fbr *::before, .fbr *::after { box-sizing: border-box; }

/* the site's own mark - the favicon's speeding tyre, cut out of its white
   ground as tyre-mark.png - as a mask, so it takes the colour of whatever it
   sits in */
.fbr__icon {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  background-color: currentColor;
  -webkit-mask: url("../img/tyre-mark.png") center / contain no-repeat;
  mask: url("../img/tyre-mark.png") center / contain no-repeat;
}

/* ----------------------------------------------------------------- form */

/* main.css sizes the hero's plate for a wide band - 70px tall on a desktop,
   the postcode on half a row. In a 400px panel the plate is 56px and every
   field runs the full width, one under the other. */
.fbr-form { display: block; }
.fbr-form__plate { margin: 0; }
.fbr-form .hero__input--reg {
  width: 100%;
  height: 56px;
  padding: 0 12px 0 54px;
  border: 3px solid #808285;
  font-size: 28px !important;
  letter-spacing: 0.03em;
}
.fbr-form .hero__input--reg:focus { outline: none; border-color: #4b4e53; }
.fbr-form .hero__input-gb { width: 44px; height: auto; padding-bottom: 5px; font-size: 18px; }
.fbr-form .hero__postcode {
  display: block;
  flex: none;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 52px;
  margin: 10px 0 0;
  padding: 0 14px 0 44px;
  border: 2px solid #d9dde3;
  border-radius: 8px;
  background-position: 15px 50%;
  font-size: 16px;
  color: var(--fbr-ink);
}
.fbr-form .hero__postcode:focus {
  outline: none;
  border-color: var(--fbr-red);
  box-shadow: 0 0 0 3px rgba(255, 8, 1, 0.14);
}
.fbr-form__error {
  min-height: 0;
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--fbr-red-dark);
}
.fbr-form__error:empty { display: none; }
.fbr-form__go {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  margin: 12px 0 0;
  font-size: 16px;
  text-decoration: none !important;
}

/* ------------------------------------------------------------------ tab */

/* Pinned to the right edge, half way down, clear of the article column.
   Reads bottom to top, the way a spine does, so the eye lands on the icon. */
.fbr__tab {
  position: fixed;
  right: 0;
  top: 50%;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 16px 11px 16px 12px;
  border: 0;
  border-radius: 10px 0 0 10px;
  background: var(--fbr-red);
  color: #fff;
  font-family: var(--fbr-head);
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  text-decoration: none;
  box-shadow: -6px 0 22px rgba(20, 22, 26, 0.18);
  transform: translateY(-50%);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.15s ease, transform 0.25s ease, opacity 0.2s ease;
}
.fbr__tab:hover { background: var(--fbr-red-dark); color: #fff; }
.fbr__tab:focus-visible { outline: 3px solid #fff; outline-offset: -5px; }
.fbr__tab .fbr__icon { width: 24px; height: 24px; }
.fbr__tab-text { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.fbr.is-open .fbr__tab { transform: translate(110%, -50%); opacity: 0; pointer-events: none; }
/* on a wide screen the dock is nothing and the chevron is not needed */
.fbr__dock { display: contents; }
.fbr__hide { display: none; }
.fbr__spacer { display: none; }

/* ------------------------------------------------------------- backdrop */

.fbr__backdrop {
  position: fixed;
  inset: 0;
  z-index: 901;
  background: rgba(20, 22, 26, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}
.fbr.is-open .fbr__backdrop { opacity: 1; visibility: visible; transition-delay: 0s; }

/* ---------------------------------------------------------------- panel */

.fbr__panel {
  position: fixed;
  right: 0;
  top: 50%;
  z-index: 902;
  width: min(400px, calc(100vw - 24px));
  padding: 26px;
  border-radius: 16px 0 0 16px;
  background: #fff;
  color: var(--fbr-ink);
  box-shadow: -14px 0 40px rgba(20, 22, 26, 0.22);
  transform: translate(105%, -50%);
  visibility: hidden;
  transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s linear 0.28s;
}
.fbr.is-open .fbr__panel { transform: translate(0, -50%); visibility: visible; transition-delay: 0s; }

.fbr__close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--fbr-soft);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.fbr__close:hover { background: #f3f4f6; color: var(--fbr-ink); }
.fbr__close:focus-visible { outline: 2px solid var(--fbr-red); outline-offset: 2px; }
.fbr__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 40px 8px 0;
  color: var(--fbr-red);
}
.fbr__head .fbr__icon { width: 28px; height: 28px; }
.fbr__title {
  margin: 0;
  font-family: var(--fbr-head);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--fbr-ink);
}
.fbr__note { margin: 0 0 18px; font-size: 13.5px; line-height: 1.55; color: var(--fbr-body); }

/* --------------------------------------------------------------- narrow */

/* Under 1024px the article column runs to the edges, so a side tab would sit
   on the words. A small pill in the bottom corner sits on almost nothing,
   and its chevron tucks it against the edge until only the tyre shows; a
   tap on the tyre brings it back. The spacer keeps the page's foot clear of
   it. The panel becomes a sheet from the bottom. */
@media (max-width: 1023px) {
  .fbr__dock {
    position: fixed;
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    z-index: 900;
    display: flex;
    align-items: stretch;
    height: 40px;
    border-radius: 999px;
    background: var(--fbr-red);
    box-shadow: 0 8px 24px rgba(20, 22, 26, 0.28);
    transition: transform 0.25s ease, opacity 0.2s ease;
  }
  .fbr__tab {
    position: static;
    flex-direction: row;
    gap: 8px;
    height: auto;
    padding: 0 10px 0 10px;
    border-radius: 999px 0 0 999px;
    font-size: 13.5px;
    box-shadow: none;
    transform: none;
  }
  .fbr__tab .fbr__icon { width: 22px; height: 22px; }
  .fbr__tab-text { writing-mode: horizontal-tb; transform: none; }
  .fbr__hide {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    margin: 0;
    padding: 0;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 0 999px 999px 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
  }
  .fbr__hide:hover { background: var(--fbr-red-dark); }
  .fbr__hide:focus-visible { outline: 3px solid #fff; outline-offset: -5px; }
  .fbr__hide::before {
    content: "";
    width: 9px;
    height: 9px;
    margin-left: -4px;
    border-right: 2.5px solid #fff;
    border-bottom: 2.5px solid #fff;
    transform: rotate(-45deg);
    transition: transform 0.25s ease;
  }
  /* tucked: the pill slides right until only the tyre is left at the edge -
     the first 40px of the tab, its own rounded end - and the chevron is off
     screen; the tyre is the way back */
  .fbr.is-tucked .fbr__dock { transform: translateX(calc(100% - 40px + 14px)); }
  /* the words would otherwise show a sliver past the tyre */
  .fbr.is-tucked .fbr__tab-text { visibility: hidden; }
  .fbr.is-tucked .fbr__hide { visibility: hidden; }
  .fbr.is-open .fbr__dock { transform: translateY(160%); opacity: 0; pointer-events: none; }
  .fbr.is-open .fbr__tab { transform: none; opacity: 1; }
  .fbr__spacer { display: block; height: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .fbr__panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    padding: 22px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    border-radius: 18px 18px 0 0;
    transform: translateY(105%);
  }
  .fbr.is-open .fbr__panel { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .fbr__tab, .fbr__dock, .fbr__hide::before, .fbr__backdrop, .fbr__panel { transition: none; }
}
