/* ==========================================================================
   Countdownify – styling
   Edit the variables in the first block to restyle the bar.
   ========================================================================== */

:root {
  /* ---- Colours ---- */
  --cdn-bg:            #26387a;   /* bar background            */
  --cdn-text:          #ffffff;   /* message + unit label text */
  --cdn-button-bg:     #ffc400;   /* button background         */
  --cdn-button-text:   #1a1a1a;   /* button text               */
  --cdn-digit-bg:      #ffc400;   /* flip card background      */
  --cdn-digit-text:    #1a1a1a;   /* flip card numbers         */

  /* ---- Position ----
     --cdn-position: fixed  (always visible, page content is pushed down/up)
                     sticky (sticks to the edge once you scroll to it)
     --cdn-top / --cdn-bottom: pin to the top (0 / auto) or bottom (auto / 0) */
  --cdn-position: fixed;
  --cdn-top:      auto;
  --cdn-bottom:   0;

  /* ---- Misc ---- */
  --cdn-font:     "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --cdn-z-index:  9999;
  --cdn-flip-ms:  600ms;          /* total flip duration */
}

/* ==========================================================================
   Layout – you normally don't need to edit below this line
   ========================================================================== */

.cdn-bar {
  position: var(--cdn-position);
  top: var(--cdn-top);
  bottom: var(--cdn-bottom);
  left: 0;
  right: 0;
  z-index: var(--cdn-z-index);
  box-sizing: border-box;
  display: none;                      /* shown by JS once config has loaded */
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 28px;
  padding: 10px 48px 10px 16px;
  background: var(--cdn-bg);
  color: var(--cdn-text);
  font-family: var(--cdn-font);
}
.cdn-bar.cdn-ready { display: flex; }

.cdn-message { font-size: 18px; line-height: 1.3; }

.cdn-timer { display: flex; gap: 14px; }
.cdn-unit  { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.cdn-unit-label { font-size: 12px; line-height: 1; }
.cdn-digits { display: flex; gap: 3px; }

.cdn-button {
  display: inline-block;
  padding: 11px 36px;
  background: var(--cdn-button-bg);
  color: var(--cdn-button-text);
  font: 600 13px/1 var(--cdn-font);
  text-decoration: none;
  white-space: nowrap;
  border-radius: 2px;
  transition: filter .15s;
}
.cdn-button:hover, .cdn-button:focus { filter: brightness(1.08); color: var(--cdn-button-text);}

.cdn-close {
  position: absolute;
  right: 12px;
  top: 35%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--cdn-text);
  opacity: .7;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}
.cdn-close:hover, .cdn-close:focus { opacity: 1; color: var(--cdn-button-bg);}

/* ---------- Flip-down digit ---------- */
.cdn-digit {
  --w: 22px;
  --h: 32px;
  position: relative;
  width: var(--w);
  height: var(--h);
  perspective: 200px;
  font: 700 22px/var(--h) var(--cdn-font);
  color: var(--cdn-digit-text);
  text-align: center;
}
.cdn-digit > span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  overflow: hidden;
  background: var(--cdn-digit-bg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.cdn-digit > span > i {
  position: absolute;
  left: 0;
  width: 100%;
  height: var(--h);
  font-style: normal;
}
.cdn-top, .cdn-flip-top               { top: 0;   border-radius: 3px 3px 0 0; transform-origin: 50% 100%; }
.cdn-bottom, .cdn-flip-bottom         { top: 50%; border-radius: 0 0 3px 3px; transform-origin: 50% 0;
                                        box-shadow: inset 0 1px 0 rgba(0,0,0,.25); }
.cdn-top > i, .cdn-flip-top > i       { top: 0; }
.cdn-bottom > i, .cdn-flip-bottom > i { top: calc(var(--h) / -2); }
.cdn-top, .cdn-flip-top { background-image: linear-gradient(rgba(255,255,255,.12), rgba(0,0,0,.06)); background-color: var(--cdn-digit-bg); }

/* the two flaps only exist while flipping */
.cdn-flip-top, .cdn-flip-bottom { visibility: hidden; }
.cdn-digit.cdn-flipping .cdn-flip-top {
  visibility: visible;
  animation: cdn-flip-top calc(var(--cdn-flip-ms) / 2) ease-in forwards;
}
.cdn-digit.cdn-flipping .cdn-flip-bottom {
  visibility: visible;
  transform: rotateX(90deg);
  animation: cdn-flip-bottom calc(var(--cdn-flip-ms) / 2) ease-out calc(var(--cdn-flip-ms) / 2) forwards;
}
@keyframes cdn-flip-top    { from { transform: rotateX(0); }     to { transform: rotateX(-90deg); } }
@keyframes cdn-flip-bottom { from { transform: rotateX(90deg); } to { transform: rotateX(0); } }

@media (max-width: 760px) {
  .cdn-bar { gap: 8px 16px; padding-right: 40px; }
  .cdn-message { font-size: 15px; width: 100%; text-align: center; }
  .cdn-timer { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .cdn-digit.cdn-flipping .cdn-flip-top,
  .cdn-digit.cdn-flipping .cdn-flip-bottom { animation-duration: 1ms; animation-delay: 0s; }
}
