/**
 * Hello Home — sticky offer bar.
 *
 * Fixed to the foot of the viewport, translated out of view until the
 * visitor has scrolled past the hero. Transform rather than display, so it
 * slides rather than appearing, and so it costs nothing to animate.
 */

.hello-offer-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 900;
  background: #0d0d0d;
  border-top: 1px solid #262626;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
  transform: translateY(110%);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  /* Keeps the bar clear of the iOS home indicator. */
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.hello-offer-bar.is-shown {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .hello-offer-bar {
    transition: none;
  }
}

.hello-offer-bar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.4vw, 32px);
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px clamp(16px, 3vw, 40px);
  box-sizing: border-box;
}

/* ---- member faces ------------------------------------------------------- */

.hello-offer-bar__faces {
  display: flex;
  align-items: center;
  padding-left: 10px; /* offsets the first face's negative margin */
}

.hello-offer-bar__face {
  display: block;
  width: 52px;
  height: 52px;
  margin-left: -10px; /* overlap */
  border: 2px solid #0d0d0d;
  border-radius: 50%;
  object-fit: cover;
  background: #1a1a1a;
}

/* ---- discount ----------------------------------------------------------- */

/**
 * The sale figure, between the faces and the offer copy.
 *
 * Its own flex item rather than a line inside __copy, which is what puts it
 * where it is: __copy is a column, so anything added to it stacks under the
 * offer line instead of sitting beside the faces.
 *
 * Larger than everything else in the bar on purpose -- it is the one thing in
 * here a visitor should be able to read without stopping. nowrap because the
 * bar's height is set by the 52px faces and button; a wrapped second line
 * would push past them and grow the bar rather than wrap inside it.
 *
 * White with *asterisks* for the accent, matching __offer and every other
 * widget, rather than accent throughout -- "*55%* off" reads better than a
 * solid red block, and a solid block is still available by wrapping the lot.
 */
.hello-offer-bar__discount {
  flex: 0 0 auto;
  margin: 0;
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #fff;
  white-space: nowrap;
}

/* ---- copy --------------------------------------------------------------- */

.hello-offer-bar__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: center;
}

.hello-offer-bar__offer {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin: 0;
  font-size: clamp(18px, 1.6vw, 22px);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
}

.hello-offer-bar__lead {
  color: var(--hello-accent);
}

.hello-offer-bar__dash {
  color: #8a8a8a;
  font-weight: 500;
}

.hello-offer-bar__strap {
  margin: 0;
  font-size: 1em;
  font-weight: 700;
  color: #fff;
}

/* ---- call to action ----------------------------------------------------- */

.hello-offer-bar__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 32px;
  border-radius: 8px;
  background: var(--hello-accent);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}
.hello-offer-bar__cta:hover,
.hello-offer-bar__cta:focus-visible {
  background: var(--hello-accent-dark);
  color: #fff;
  text-decoration: none;
}

/* ---- dismiss ------------------------------------------------------------ */

.hello-offer-bar__close {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  top: 8px;
  right: 10px;
  width: 30px;
  height: 30px;
  padding: 0;
  background: transparent;
  border: 0;
  color: #8a8a8a;
  cursor: pointer;
  transition: color 0.15s ease;
}
.hello-offer-bar__close:hover,
.hello-offer-bar__close:focus-visible {
  color: #fff;
  outline: none;
}
.hello-offer-bar__close::before,
.hello-offer-bar__close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}
.hello-offer-bar__close::before { transform: translate(-50%, -50%) rotate(45deg); }
.hello-offer-bar__close::after  { transform: translate(-50%, -50%) rotate(-45deg); }

/* ---- mobile -------------------------------------------------------------
 * Something has to give on a phone: faces, strap and button together do not
 * fit on one line. The strap goes rather than the faces -- the faces are the
 * social proof the bar exists for, while "(billed annually) access
 * everything" largely restates what the offer line already says, and the
 * full terms are on the pricing section anyway.
 * ------------------------------------------------------------------------ */

/**
 * With a discount showing, the copy column gives way in two stages.
 *
 * Everything below is scoped to --has-discount, so a bar without one behaves
 * at every width exactly as it did before the element existed.
 *
 * STAGE ONE, below 960px: the offer LINE goes, the strap stays.
 *
 * Not 767, where the next block starts. The inner's padding and gaps are both
 * vw-based, so what the items need shrinks more slowly than what is available
 * -- the row runs out well above the phone breakpoint, and leaving the band
 * between them alone would break it at 768, an iPad in portrait.
 *
 * 960 with a lot of slack rather than the measured cliff, because the cliff
 * moves with the copy: "55% off" is 84px and "55% Off!" is 96px, and twelve
 * pixels of typing moved it from 820 to 855. A breakpoint fitted to one
 * sample string is a trap for whoever writes the next sale. At 960 there is
 * room for a discount three times the length of a sane one.
 *
 * The offer line is the one to drop, by the same argument the strap was
 * dropped on below: with a sale running, "Special - $10/month" and "55% off"
 * are two ways of saying the same thing. The strap is kept because it is
 * usually where the actual price ends up, and it fits where the pair did not.
 */
@media (max-width: 959px) {
  .hello-offer-bar--has-discount .hello-offer-bar__offer {
    display: none;
  }
}

@media (max-width: 767px) {
  .hello-offer-bar__inner {
    gap: 12px;
    padding: 12px 44px 12px 16px; /* right padding clears the close button */
  }
  .hello-offer-bar__face {
    width: 40px;
    height: 40px;
  }
  .hello-offer-bar__cta {
    height: 46px;
    padding: 0 22px;
    font-size: 16px;
  }
  .hello-offer-bar__discount {
    font-size: 26px;
  }

  /**
   * STAGE TWO, below 768px: the strap goes with it.
   *
   * It survived stage one and does not survive this one. Measured at 600px:
   * faces, discount, strap and button want 564px of the 540px going, so the
   * strap is 24px more than the row has. Hiding __copy rather than __strap
   * also takes the empty column out of the flex line, which is worth another
   * gap.
   */
  .hello-offer-bar--has-discount .hello-offer-bar__copy {
    display: none;
  }
}

@media (max-width: 559px) {
  .hello-offer-bar__strap {
    display: none;
  }
  /* Tighter overlap keeps five faces inside ~130px. */
  .hello-offer-bar__face {
    width: 34px;
    height: 34px;
    margin-left: -12px;
  }
  .hello-offer-bar__inner {
    gap: 10px;
    padding-right: 40px;
  }
  .hello-offer-bar__offer {
    font-size: 17px;
  }
  .hello-offer-bar__cta {
    height: 44px;
    padding: 0 16px;
    font-size: 15px;
  }

  /**
   * STAGE THREE, below 560px: on a phone the faces go too.
   *
   * There is no arrangement that keeps them. Measured at 388px, which is a
   * common phone: 317px of usable width, and the faces alone are 120px of it
   * against a 166px button -- the discount, at any size that is still worth
   * reading, does not fit in what is left. Shrinking everything gets to 338px
   * and stops. So this is a genuine choice rather than a tuning problem, and
   * the sale figure wins: it is the reason the bar is dressed up at all, and
   * the faces are back the moment the discount field is emptied.
   *
   * Leaves the discount and the button, one row, 69px -- the same height the
   * bar has had on a phone all along.
   */
  .hello-offer-bar--has-discount .hello-offer-bar__faces {
    display: none;
  }

  .hello-offer-bar__discount {
    font-size: 22px;
  }
}

/**
 * The last 30px. At 320px -- still on enough QA checklists to be worth the
 * four lines -- the discount and the button come to 253px against 251px of
 * usable width, and wrap over two pixels. Nothing downstream depends on the
 * bar's height, so wrapping is survivable rather than broken, but one line
 * was the brief. A smaller figure and a tighter button buy 16px and keep it.
 */
@media (max-width: 359px) {
  .hello-offer-bar--has-discount .hello-offer-bar__discount {
    font-size: 19px;
  }
  .hello-offer-bar--has-discount .hello-offer-bar__cta {
    padding: 0 12px;
  }
}
