/* ==========================================================================
   COUNTDOWN CLOCK — styles
   Pairs with assets/js/countdown.js. Switched on via sections/countdown.html.

   COLORS ARE NOT IN THIS FILE. Like the rest of the site's stylesheets, the
   color block below just forwards to assets/css/theme.css — the --countdown-*
   names. Change them there, not here.

   Everything else (sizes, corners, spacing) is a variable in the block below,
   and every rule past it is scoped under .pbc-countdown, so nothing in this
   file can affect the rest of the page.

   Full documentation, plus a live demo you can open in a browser, is in
   countdown-kit/ — README.md and demo.html.
   ========================================================================== */

:root {
  /* --- Colors: one per unit box ---
     The hex after each comma is only a fallback, used if theme.css hasn't
     loaded (as in countdown-kit/demo.html). It changes nothing on the site,
     but keep it in step with theme.css so the demo previews the real thing. */
  --cd-day-bg:      var(--countdown-days,    #2E5E4E);  /* green  */
  --cd-hour-bg:     var(--countdown-hours,   #B45247);  /* red    */
  --cd-minute-bg:   var(--countdown-minutes, #006E90);  /* blue   */
  --cd-second-bg:   var(--countdown-seconds, #A8643A);  /* copper */

  /* One text color per box. The unit labels drop below 16px on a phone, so
     they need 4.5:1 — check every box if you recolor one. */
  --cd-day-text:    var(--countdown-days-text,    #ffffff);
  --cd-hour-text:   var(--countdown-hours-text,   #ffffff);
  --cd-minute-text: var(--countdown-minutes-text, #ffffff);
  --cd-second-text: var(--countdown-seconds-text, #ffffff);

  /* --- Shape: both values are shared with the sponsorship table --- */
  --cd-radius:      12px;
  --cd-shadow:      0 10px 20px -5px rgba(0, 0, 0, 0.125);

  /* --- Sizing --- */
  --cd-number-size: 3.75rem;         /* the big number       */
  --cd-label-size:  0.9em;           /* the word underneath  */
  --cd-box-padding: 1.15em 0.75em;   /* space inside a box   */
  --cd-box-gap:     0.75rem;         /* space between boxes  */
  --cd-box-width:   7.5rem;          /* box minimum; they share the row evenly */

  /* --- The "we've arrived" message shown at zero --- */
  --cd-message-size:  2.5rem;
  --cd-message-color: var(--countdown-message, #00263F);
}


/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.pbc-countdown {
  text-align: center;
}

/* The list resets let the kit look right without a host-page reset. */
.pbc-countdown__units {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--cd-box-gap);
  list-style: none;
  margin: 0;
  padding: 0;
}

/* One box (days, hours, minutes, or seconds). The flex basis plus max-width is
   what gives all four the same width instead of sizing each to its own label. */
.pbc-countdown__unit {
  box-sizing: border-box;
  flex: 1 1 var(--cd-box-width);
  max-width: 12rem;
  padding: var(--cd-box-padding);
  border-radius: var(--cd-radius);
  box-shadow: var(--cd-shadow);
  font-size: var(--cd-label-size);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.2;
}

/* The big number. `display: block` is what stacks it above its label. */
.pbc-countdown__number {
  display: block;
  font-size: var(--cd-number-size);
  font-weight: 700;
  line-height: 1;
  /* The box sets label tracking; digits must not inherit it. */
  letter-spacing: normal;
  margin-bottom: 0.12em;
  /* Keeps the box from resizing as digits change width (e.g. 1 -> 11). */
  font-variant-numeric: tabular-nums;
}


/* --------------------------------------------------------------------------
   Per-unit colors
   -------------------------------------------------------------------------- */

.pbc-countdown__unit--days    { background-color: var(--cd-day-bg);    color: var(--cd-day-text); }
.pbc-countdown__unit--hours   { background-color: var(--cd-hour-bg);   color: var(--cd-hour-text); }
.pbc-countdown__unit--minutes { background-color: var(--cd-minute-bg); color: var(--cd-minute-text); }
.pbc-countdown__unit--seconds { background-color: var(--cd-second-bg); color: var(--cd-second-text); }


/* --------------------------------------------------------------------------
   The message that replaces the timer at zero
   Hidden until countdown.js removes its [hidden] attribute.
   -------------------------------------------------------------------------- */

.pbc-countdown__message {
  font-size: var(--cd-message-size);
  color: var(--cd-message-color);
  font-weight: bold;
  margin: 0;
  /* Not --cd-box-padding: that is a two-value shorthand for the boxes. */
  padding: 1em 0;
}

/* Some stylesheets set display on every element, defeating [hidden]. */
.pbc-countdown [hidden] {
  display: none !important;
}


/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */

@media all and (max-width: 768px) {
  .pbc-countdown {
    --cd-number-size: 2.25rem;
    --cd-label-size: 0.8em;
    --cd-box-padding: 0.85em 0.5em;
    --cd-box-gap: 0.5rem;
    --cd-box-width: 6rem;
    --cd-radius: 10px;
    --cd-message-size: 1.6rem;
  }
}

/* Narrower than this, four boxes on one row leave a single orphan on the
   second row. Pin them to an even 2x2 instead. */
@media all and (max-width: 480px) {
  .pbc-countdown__unit {
    flex-basis: calc(50% - var(--cd-box-gap));
    max-width: none;
  }
}


/* --------------------------------------------------------------------------
   Accessibility
   -------------------------------------------------------------------------- */

/* Hides the spoken description that stands in for the aria-hidden boxes.
   Duplicates .sr-only on purpose so the kit works in any project. */
.pbc-countdown__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* The clock does not animate; this only stops the finished message fading. */
@media (prefers-reduced-motion: reduce) {
  .pbc-countdown,
  .pbc-countdown * {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}

/* High Contrast Mode strips backgrounds and shadows, which would leave four
   invisible boxes. Ask for a real border back. */
@media (forced-colors: active) {
  .pbc-countdown__unit {
    border: 2px solid CanvasText;
  }
}
