/* ---------- Offer bar and Early Bird mode, on the rest of the site ----------
   Store pages get these rules from store.css instead: the rules below are a
   copy, and tests/test_build_store.py fails if the two drift apart.
   One switch for the whole site: the offer's dates on the offer bar ("offer"
   in store/products.json). While the offer is on, js/offer-bar.js puts
   .offer-live on <html>, shows every [data-offer-show] and hides every
   [data-offer-hide]. They ship in their "off" state, so after the close,
   before the script runs, or without JavaScript, every page is exactly as it
   was. [hidden] has to beat any display rule on the element. Scrolling and
   the pulsing dot are an exception to BRAND_STANDARDS.md section 10, asked
   for by Nicola on 8 November 2026; both stop for reduced motion. */
[data-offer-show][hidden],
[data-offer-hide][hidden] { display: none !important; }

/* ---------- The offer bar ----------
   Teal with ink text (8.8:1), stuck to the top of the page with the nav. */
.offer-bar {
  position: sticky;
  top: 0;
  z-index: 110;
  background: var(--color-teal);
  color: var(--color-ink);
  font-size: var(--text-sm);
  line-height: 1.45;
}
.offer-bar:not([hidden]) { display: flex; align-items: stretch; min-height: 44px; overflow: hidden; }

.offer-bar__scroller {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.offer-bar__text {
  margin: 0;
  padding: 8px var(--space-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 14px;
  font-weight: 500;
}
.offer-bar__label {
  background: var(--color-ink);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}
.offer-bar__dot {
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-ink);
  opacity: 0.5;
}

/* Scrolling: the track holds the sentence several times and moves half its
   width, so the loop has no seam. Stops on hover, keyboard focus and the
   pause button; never moves for reduced motion. */
.offer-bar__track {
  display: flex;
  width: max-content;
  animation: offer-bar-scroll 40s linear infinite;
}
.offer-bar--scroll .offer-bar__scroller { justify-content: flex-start; }
.offer-bar--scroll .offer-bar__text {
  flex: none;
  flex-wrap: nowrap;
  white-space: nowrap;
  padding: 0 14px 0 0;
}
.offer-bar__track:hover,
.offer-bar__track:focus-within,
.offer-bar--paused .offer-bar__track { animation-play-state: paused; }
@keyframes offer-bar-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* The part that stays put on the right: pause, live dot, countdown, button. */
.offer-bar__fixed {
  flex: none;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 8px;
  background: var(--color-teal);
  box-shadow: -14px 0 14px var(--color-teal);
}
.offer-bar__pause {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(26, 26, 46, 0.35);
  border-radius: 50%;
  background: transparent;
  color: var(--color-ink);
  cursor: pointer;
}
.offer-bar__pause:focus-visible { outline: 2px solid var(--color-ink); outline-offset: 2px; }
.offer-bar__clock {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.offer-live-dot {
  flex: none;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: offer-live-pulse 1.4s ease-in-out infinite;
}
@keyframes offer-live-pulse { 50% { opacity: 0.25; } }
.offer-bar__cta {
  background: var(--color-ink);
  color: #fff;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  white-space: nowrap;
}
.offer-bar__cta:hover { background: var(--color-blue-dark); color: #fff; }

/* Phones: the floating button does the button's job, so the bar keeps the
   moving words and the countdown. A still bar (reduced motion) keeps only
   the label and the $99, so it stays one or two lines. */
@media (max-width: 640px) {
  .offer-bar__clock { display: none; }
}
@media (max-width: 599px) {
  .offer-bar__cta { display: none; }
  .offer-bar__fixed { padding-right: 10px; gap: 8px; }
  .offer-bar:not(.offer-bar--scroll) .offer-bar__text > :not(.offer-bar__label):not(.offer-bar__key) { display: none; }
}

/* The nav sits under the bar while the offer is on (desktop, where the nav is
   sticky), and anchors land below both. --offer-bar-h is set by the script. */
@media (min-width: 861px) {
  html.offer-live .site-header { top: var(--offer-bar-h, 44px); }
}
html.offer-live [id] { scroll-margin-top: calc(64px + var(--offer-bar-h, 44px) + var(--space-4)); }

/* ---------- Floating Early Bird button ---------- */
.offer-fab {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  z-index: 105;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 18px;
  background: var(--color-ink);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-pill);
  box-shadow: 0 12px 32px rgba(26, 26, 46, 0.35);
  transition: opacity var(--transition-base), transform var(--transition-base);
}
.offer-fab:hover { color: #fff; }
.offer-fab:hover .offer-fab__btn { background: #3DBDB4; }
.offer-fab__time { display: flex; flex-direction: column; line-height: 1.25; }
.offer-fab__title {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-teal-faint);
}
.offer-fab__clock { font-weight: 700; font-variant-numeric: tabular-nums; }
.offer-fab__btn {
  background: var(--color-teal);
  color: var(--color-ink);
  font-weight: 700;
  font-size: var(--text-sm);
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
/* Out of the way while the pricing it points to is on screen. */
.offer-fab--away { opacity: 0; transform: translateY(12px); pointer-events: none; }
/* The scroll-to-top button moves up above it. */
html.offer-live .scroll-fab { bottom: calc(var(--space-6) + 64px); }

@media (max-width: 599px) {
  .offer-fab { right: var(--space-4); bottom: var(--space-4); gap: 8px; padding: 6px 6px 6px 14px; }
  .offer-fab__title { display: none; }
  .offer-fab__clock { font-size: var(--text-sm); }
  .offer-fab__btn { padding: 8px 12px; }
  html.offer-live .scroll-fab { right: var(--space-4); bottom: calc(var(--space-4) + 56px); }
}

@media (prefers-reduced-motion: reduce) {
  .offer-bar__track,
  .offer-live-dot { animation: none !important; }
  .offer-fab { transition: none; }
}

/* Words for screen readers only (the site has no shared helper for this). */
.offer-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
