/*
 * Rebrand pop-up
 * resources/views/partials/rebrand.php, resources/assets/scripts/rebrand.js, loaded by app/rebrand.php (admins only for now)
 * The rubber theme's pop-up (Figma "Frame 4317"): a modal w/ no close button, pointing visitors to apexsurfacing.ca.
 * Plain CSS, loaded on its own so it doesn't need a Mix build. It sets its own fonts, colours and margins over the theme's h2, p and a.
 */

html:has(dialog.rebrand[open]) {
  overflow: hidden;
}

dialog.rebrand {
  --rebrand-gold: #c49a6c;
  --rebrand-dark: #231f20;
  --rebrand-grey: #939598;
  --logos-width: 220px;
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(1100px, calc(100% - 32px));
  max-width: none;
  min-height: min(622px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  padding: 48px 32px;
  box-sizing: border-box;
  border: 0;
  overflow-y: auto;
  background-color: var(--rebrand-dark);
  font-family: "Lexend", sans-serif;
}

@media (min-width: 768px) {
  dialog.rebrand {
    --logos-width: 313px;
  }
}

dialog.rebrand[open] {
  display: flex;
}

/* rebrand.js focuses the pop-up itself when it opens, so the button doesn't show a focus ring */
dialog.rebrand:focus {
  outline: none;
}

dialog.rebrand::backdrop {
  background-color: rgba(0, 0, 0, 0.6);
}

/* Rubber photo across the top, darkened towards the bottom by the Figma's two gradients */
dialog.rebrand .rebrand__background {
  position: absolute;
  inset: 0;
  isolation: isolate;
  pointer-events: none;
}

dialog.rebrand .rebrand__background img {
  z-index: -1; /* Under both gradients */
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  max-width: none;
  height: 82%;
  object-fit: cover;
}

dialog.rebrand .rebrand__background::before,
dialog.rebrand .rebrand__background::after {
  content: '';
  position: absolute;
  inset: 0;
  mix-blend-mode: multiply;
}

dialog.rebrand .rebrand__background::before {
  background: linear-gradient(to top, black 12.87%, rgba(36, 36, 36, 0.74));
}

dialog.rebrand .rebrand__background::after {
  top: 15.76%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.94), rgba(102, 102, 102, 0));
}

dialog.rebrand .rebrand__content {
  position: relative;
  z-index: 1;
  width: min(714px, 100%);
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

@media (min-width: 768px) {
  dialog.rebrand .rebrand__content {
    gap: 66px;
  }
}

/* Logos and text */
dialog.rebrand .rebrand__intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

@media (min-width: 768px) {
  dialog.rebrand .rebrand__intro {
    gap: 37px;
  }
}

/* Apex logo, then a bracket over the old logos */
dialog.rebrand .rebrand__logos {
  width: min(var(--logos-width), 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

dialog.rebrand img.rebrand__apex {
  width: 100%;
  height: auto;
  margin-bottom: calc(var(--logos-width) * 0.0876);
}

dialog.rebrand img.rebrand__bracket {
  width: 53.79%;
  height: auto;
  margin-bottom: calc(var(--logos-width) * 0.0219);
}

dialog.rebrand .rebrand__old-logos {
  position: relative;
  width: 86.57%;
  aspect-ratio: 270.951 / 72.795;
  overflow: hidden;
}

dialog.rebrand .rebrand__old-logos span {
  position: absolute;
  opacity: 0.4;
}

dialog.rebrand .rebrand__old-logos img {
  display: block;
  width: 100%;
  height: 100%;
}

/* Text: sizes grow w/ the screen, like the rubber theme's .font-size() */
dialog.rebrand .rebrand__text {
  display: flex;
  flex-direction: column;
  gap: 15px;
  text-align: center;
  line-height: 1.2;
}

@media (min-width: 768px) {
  dialog.rebrand .rebrand__text {
    line-height: 1;
  }
}

dialog.rebrand h2.rebrand__heading {
  margin: 0;
  padding: 0;
  color: var(--rebrand-gold);
  font-family: inherit;
  font-size: clamp(36px, calc(36px + 28 * (100vw - 370px) / 1270), 64px);
  font-weight: 700;
  line-height: inherit;
  text-transform: none;
}

dialog.rebrand p.rebrand__tagline {
  margin: 0;
  color: #fff;
  font-family: inherit;
  font-size: clamp(18px, calc(18px + 14 * (100vw - 370px) / 1270), 32px);
  font-weight: 500;
  line-height: inherit;
}

/* Button: gold, grey on hover, w/ the rubber theme's dotted chevron (.arrow-btn2) */
dialog.rebrand a.rebrand__button {
  width: 260px;
  height: 56px;
  padding: 0 24px;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background-color: var(--rebrand-gold);
  border: 2px solid var(--rebrand-gold);
  color: #fff;
  font-family: inherit;
  font-size: clamp(16px, calc(16px + 2 * (100vw - 370px) / 1270), 18px);
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
  transition: all 0.35s ease;
}

dialog.rebrand a.rebrand__button:hover,
dialog.rebrand a.rebrand__button:focus-visible {
  background-color: var(--rebrand-grey);
  border-color: var(--rebrand-grey);
  color: #fff;
  text-decoration: none;
}

dialog.rebrand .rebrand__button-text {
  white-space: nowrap;
  transition: all 0.35s ease;
}

/* Chevron: 7 dots, the middle one stretching on hover */
dialog.rebrand .rebrand__arrow {
  position: relative;
  flex-shrink: 0;
  height: 21px;
  width: 25px;
  transition: all 0.35s ease;
}

dialog.rebrand .rebrand__dot {
  position: absolute;
  height: 3px;
  width: 3px;
  background-color: #fff;
  transition: all 0.35s ease;
}

dialog.rebrand .rebrand__dot--1 { right: 9px; top: 0; }
dialog.rebrand .rebrand__dot--2 { right: 6px; top: 3px; }
dialog.rebrand .rebrand__dot--3 { right: 3px; top: 6px; }
dialog.rebrand .rebrand__dot--4 { right: 0; top: 9px; }
dialog.rebrand .rebrand__dot--5 { right: 3px; top: 12px; }
dialog.rebrand .rebrand__dot--6 { right: 6px; top: 15px; }
dialog.rebrand .rebrand__dot--7 { right: 9px; top: 18px; }

dialog.rebrand a.rebrand__button:hover .rebrand__arrow {
  transform: translateX(10px);
}

dialog.rebrand a.rebrand__button:hover .rebrand__dot--4 {
  width: 100%;
}
