/* Branch Writing evergreen deadline timer: sticky bar under the navbar, plus the
   full block above the pricing grid. Both are driven by bw-countdown.js. */

/* Brand and timer share one sticky row, so the deadline reads as part of the header rather
   than as a second bar stacked under it.
   Specificity has to beat `html.bw-sales-page-branch-writing #__next > *`, which sets
   position: relative on every direct child of the page wrapper. */
html.bw-sales-page-branch-writing #__next > .bw-page-header,
.bw-page-header {
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 16px;
  background: color-mix(in srgb, var(--color-primary-bg, #0b1120) 92%, black 8%);
  border-bottom: 1px solid rgba(var(--color-accent-rgb, 96, 165, 250), 0.25);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* The brand keeps its own padding; the header supplies the backdrop for both. */
.bw-page-header > .bw-navbar {
  flex: 0 0 auto;
  width: auto;
  background: transparent;
}

/* Inside the header the bar is just a flex cell — the sticky/backdrop treatment moved up. */
.bw-page-header > .bw-countdown-bar {
  position: static;
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 12px 8px 0;
  background: none;
  border-bottom: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Standalone fallback: the bar still styles itself on pages that don't wrap it in a header. */
.bw-countdown-bar {
  position: sticky;
  top: 0;
  z-index: 900;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--color-primary-bg, #0b1120) 92%, black 8%);
  border-bottom: 1px solid rgba(var(--color-accent-rgb, 96, 165, 250), 0.25);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.bw-countdown-bar[hidden] {
  display: none;
}

.bw-countdown-bar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 950px;
  margin: 0 auto;
}

/* Timer sits to the right of the brand rather than centred in the viewport. */
.bw-page-header .bw-countdown-bar-inner {
  justify-content: flex-end;
  flex-wrap: nowrap;
  max-width: none;
  margin: 0;
}

/* Narrow screens, no timer in the row: nothing to squeeze, so leave the header alone. */
@media (max-width: 639px) {
  .bw-page-header {
    flex-wrap: wrap;
    gap: 0 12px;
  }

  .bw-page-header > .bw-countdown-bar {
    flex-basis: 100%;
    padding: 0 12px 8px;
  }

  .bw-page-header .bw-countdown-bar-inner {
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* ---------------------------------------------------------------- *
 * Phone header, timer running
 *
 * Brand mark, label, digits and button on one line. Wrapping the timer onto a second row
 * cost about sixty pixels off the top of every screen and still looked cramped, and the
 * header is stuck to the top of the page the whole way down, so the row is paid for over
 * and over. Everything here is a trade for that single line: the long sentence and the
 * clock icon go, the brand keeps its mark and loses its word, and the digits stay the
 * biggest thing in the row because they are the only part that is actually news.
 *
 * Keyed to the flag bw-countdown.js sets, not to the media query alone: the full-price
 * page shares this stylesheet, has no timer, and must keep its brand.
 * ---------------------------------------------------------------- */

/* The long sentence carries it everywhere the room exists. */
.bw-countdown-bar-text-compact {
  display: none;
}

@media (max-width: 639px) {
  .bw-page-header--with-timer {
    flex-wrap: nowrap;
    gap: 0 8px;
  }

  .bw-page-header--with-timer > .bw-navbar {
    padding-top: 5px;
    padding-bottom: 5px;
    padding-right: 0;
  }

  .bw-page-header--with-timer .bw-navbar-left {
    flex: 0 0 auto;
  }

  /* The mark alone. The word is spelled out in the page title one scroll below. */
  .bw-page-header--with-timer .bw-navbar-brand {
    display: none;
  }

  .bw-page-header--with-timer > .bw-countdown-bar {
    flex: 1 1 auto;
    flex-basis: auto;
    padding: 5px max(12px, env(safe-area-inset-right, 0px)) 5px 0;
  }

  .bw-page-header--with-timer .bw-countdown-bar-inner {
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 8px;
  }

  /* Two words of context beat a clock face and a full sentence at this width. */
  .bw-page-header--with-timer .bw-countdown-bar-icon,
  .bw-page-header--with-timer .bw-countdown-bar-text {
    display: none;
  }

  .bw-page-header--with-timer .bw-countdown-bar-text-compact {
    display: block;
    flex: 0 1 auto;
    min-width: 0;
    white-space: nowrap;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.9);
  }

  .bw-page-header--with-timer .bw-countdown-boxes-row--bar {
    flex: 0 0 auto;
    gap: 4px;
  }

  .bw-page-header--with-timer .bw-countdown-bar-cta {
    flex: 0 0 auto;
    padding: 5px 11px;
  }

  /*
   * Every size in the row, stated loudly enough to survive.
   *
   * The page type scale sets `font-size: inherit !important` on everything inside #__next,
   * so a plain rule here never lands and the whole row comes out at body size — which is
   * what made it feel cramped in the first place. Nothing below is a new opinion about
   * type; it is the sizes this row always meant to have, written where they hold.
   */
  html.sales-page-font-scale #__next .bw-page-header--with-timer .bw-countdown-bar-text-compact,
  html.sales-page-font-scale #__next .bw-page-header--with-timer .bw-countdown-bar-cta,
  .bw-page-header--with-timer .bw-countdown-bar-text-compact,
  .bw-page-header--with-timer .bw-countdown-bar-cta {
    font-size: 12px !important;
  }

  html.sales-page-font-scale #__next .bw-page-header--with-timer .bw-countdown-seg,
  html.sales-page-font-scale #__next .bw-page-header--with-timer .bw-countdown-value,
  .bw-page-header--with-timer .bw-countdown-seg,
  .bw-page-header--with-timer .bw-countdown-value {
    font-size: 17px !important;
  }

  html.sales-page-font-scale #__next .bw-page-header--with-timer .bw-countdown-unit,
  .bw-page-header--with-timer .bw-countdown-unit {
    font-size: 11px !important;
  }
}

/*
 * An extended window runs past a day, which puts a fourth number in the row. On the
 * narrowest phones the words have to give way for it, so the clock face comes back and
 * says the same thing in sixteen pixels.
 */
@media (max-width: 419px) {
  .bw-page-header--with-timer .bw-countdown-bar--with-days .bw-countdown-bar-text-compact {
    display: none;
  }

  .bw-page-header--with-timer .bw-countdown-bar--with-days .bw-countdown-bar-icon {
    display: block;
  }
}

/* ---------------------------------------------------------------- *
 * Tucking the header away
 *
 * While the full block above the pricing cards is on screen, the header is only saying
 * the same thing a second time, so it slides out of the row. Movement rather than
 * display: none, so the sticky header keeps its place in the flow and the page does not
 * jump underneath the reader as it goes and comes back.
 * ---------------------------------------------------------------- */

.bw-page-header {
  transition: transform 240ms ease, opacity 240ms ease;
}

.bw-page-header--tucked {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .bw-page-header {
    transition: none;
  }
}

.bw-countdown-bar-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-accent, #60a5fa);
}

.bw-countdown-bar-text {
  font-size: 13px;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.9);
}

@media (min-width: 640px) {
  .bw-countdown-bar-text {
    font-size: 14px;
  }
}

/* Same segments, scaled down for the header row. */
.bw-countdown-boxes-row--bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bw-countdown-boxes-row--bar .bw-countdown-seg {
  font-size: 19px;
}

.bw-countdown-boxes-row--bar .bw-countdown-value {
  letter-spacing: -0.5px;
}

.bw-countdown-bar-cta {
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    var(--color-accent, #60a5fa) 0%,
    color-mix(in srgb, var(--color-accent, #60a5fa) 78%, black 22%) 100%
  );
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.bw-countdown-bar-cta:hover {
  color: #fff;
  filter: brightness(1.08);
}

/* Full block above the pricing grid. */

.bw-countdown {
  max-width: 950px;
  margin: 0 auto 28px auto;
  padding: 20px 16px;
  text-align: center;
}

@media (min-width: 640px) {
  .bw-countdown {
    margin-bottom: 36px;
    padding: 24px 20px;
  }
}

.bw-countdown[hidden] {
  display: none;
}

.bw-countdown-label-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
  color: rgba(226, 232, 240, 0.9);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

@media (min-width: 640px) {
  .bw-countdown-label-row {
    font-size: 16px;
  }
}

.bw-countdown-label-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--color-accent, #60a5fa);
}

.bw-countdown-boxes-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

@media (min-width: 640px) {
  .bw-countdown-boxes-row {
    gap: 10px;
  }
}

/* One number with its unit letter tucked in beside it, all on a single line.
   No boxes: the numerals carry the weight, the letters stay quiet. */
.bw-countdown-seg {
  display: inline-flex;
  align-items: baseline;
  /* Reads as "20 h" rather than "20h". In em so it holds at every size the segment is
     used at, and a little wider than it looks because the value's negative letter-spacing
     eats into the space after the last digit. */
  gap: 0.14em;
  font-size: 30px;
}

@media (min-width: 640px) {
  .bw-countdown-seg {
    font-size: 40px;
  }
}

.bw-countdown-value {
  font-size: 1em;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  letter-spacing: -1px;
}

.bw-countdown-unit {
  font-size: 0.34em;
  font-weight: 600;
  line-height: 1;
  color: rgba(148, 163, 184, 0.75);
  letter-spacing: 0;
}

/* Hairline slash between segments, in the spirit of a divided clock face. */
.bw-countdown-separator {
  display: inline-block;
  width: 1px;
  height: 0.72em;
  align-self: center;
  background: rgba(148, 163, 184, 0.35);
  transform: rotate(16deg);
}

.bw-countdown-note {
  margin: 14px 0 0 0;
  font-size: 13px;
  color: rgba(148, 163, 184, 0.75);
}

/* The named moment the window closes. Lifted slightly out of the note because it is the
   checkable part: a date a visitor can write down and come back to. */
.bw-countdown-note time {
  color: rgba(203, 213, 225, 0.95);
  font-weight: 500;
}

/* The "need more time?" link lives only on the full-price page now (bwx-expired.css).
   Offering an extension under a running clock contradicted the clock. */

/* An expired state used to live here — a red "Time's up" badge in the space the clock had
   been using. Nothing replaces the timer now: it simply goes, and the price says the rest. */

/* ---------------------------------------------------------------- *
 * Extend modal
 * ---------------------------------------------------------------- */

.bw-countdown-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.bw-countdown-modal-card {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  border-radius: 20px;
  background: var(--color-primary-bg, #0b1120);
  border: 1.5px solid rgba(var(--color-accent-rgb, 96, 165, 250), 0.28);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  text-align: left;
}

.bw-countdown-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.bw-countdown-modal-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: #fff;
}

.bw-countdown-modal-close {
  background: none;
  border: none;
  font-size: 15px;
  line-height: 1;
  padding: 6px;
  color: rgba(148, 163, 184, 0.9);
  cursor: pointer;
}

.bw-countdown-modal-close:hover {
  color: #fff;
}

.bw-countdown-modal-description {
  margin: 0 0 18px 0;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(226, 232, 240, 0.85);
}

.bw-countdown-modal-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bw-countdown-modal-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(148, 163, 184, 0.85);
  margin-top: 8px;
}

.bw-countdown-modal-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1.5px solid rgba(148, 163, 184, 0.25);
  color: #fff;
  font-size: 15px;
}

.bw-countdown-modal-input:focus {
  outline: none;
  border-color: rgba(var(--color-accent-rgb, 96, 165, 250), 0.6);
  box-shadow: 0 0 0 3px rgba(var(--color-accent-rgb, 96, 165, 250), 0.15);
}

.bw-countdown-modal-error,
.bw-countdown-modal-success {
  margin: 10px 0 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.bw-countdown-modal-error {
  color: #fca5a5;
}

.bw-countdown-modal-success {
  color: #6ee7b7;
}

.bw-countdown-modal-submit {
  margin-top: 18px;
  width: 100%;
  padding: 14px 20px;
  border-radius: 14px;
  border: 1px solid rgba(var(--color-accent-rgb, 96, 165, 250), 0.4);
  background: linear-gradient(
    135deg,
    var(--color-accent, #60a5fa) 0%,
    color-mix(in srgb, var(--color-accent, #60a5fa) 78%, black 22%) 100%
  );
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
}

.bw-countdown-modal-submit:disabled {
  opacity: 0.65;
  cursor: default;
}
