/* ====================================================================
   COUNTDOWN WIDGET (momo2)
   Markup: templates/momo2/inc/countdown.functions.php
   Config: includes/config/countdown.json
   Accent colour arrives as --m2-cd-accent on the section element.
   ==================================================================== */

.m2-cd {
    --m2-cd-accent: #ffb320;
    --m2-cd-urgent: #ff4d4d;
    --m2-cd-hue: var(--m2-cd-accent);
    position: relative;
    width: 100%;
    color: #fff;
    font-family: "Roboto", system-ui, sans-serif;
}

.m2-cd[hidden] { display: none; }

.m2-cd.is-urgent { --m2-cd-hue: var(--m2-cd-urgent); }

/* ---- shell ---- */
.m2-cd__inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px 28px;
    padding: 16px 46px 16px 24px;
    overflow: hidden;
    background:
        radial-gradient(120% 160% at 12% 0%, color-mix(in srgb, var(--m2-cd-hue) 16%, transparent) 0%, transparent 62%),
        linear-gradient(90deg, #101013 0%, #17171b 48%, #101013 100%);
    border-top: 1px solid color-mix(in srgb, var(--m2-cd-hue) 45%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--m2-cd-hue) 45%, transparent);
    box-shadow: inset 0 -22px 42px -28px color-mix(in srgb, var(--m2-cd-hue) 70%, transparent);
    transition: background 0.4s ease, border-color 0.4s ease;
}

/* Fallback for engines without color-mix() */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
    .m2-cd__inner {
        background: linear-gradient(90deg, #101013 0%, #17171b 48%, #101013 100%);
        border-top: 1px solid var(--m2-cd-hue);
        border-bottom: 1px solid var(--m2-cd-hue);
    }
}

/* light sweep travelling across the strip */
.m2-cd__sheen {
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    pointer-events: none;
    background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.07) 45%, transparent 100%);
    animation: m2cdSheen 7s ease-in-out infinite;
}

@keyframes m2cdSheen {
    0%, 62% { transform: translateX(0); }
    100%    { transform: translateX(350%); }
}

/* ---- title block ---- */
.m2-cd__head {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.m2-cd__badge {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 17px;
    color: var(--m2-cd-hue);
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--m2-cd-hue);
    box-shadow: 0 0 16px -4px var(--m2-cd-hue);
    animation: m2cdBadge 3.2s ease-in-out infinite;
}

@keyframes m2cdBadge {
    0%, 100% { box-shadow: 0 0 14px -6px var(--m2-cd-hue); }
    50%      { box-shadow: 0 0 22px -2px var(--m2-cd-hue); }
}

.m2-cd__titles { display: flex; flex-direction: column; min-width: 0; }

.m2-cd__title {
    font-family: "Cinzel", "Roboto", serif;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.4px;
    color: var(--m2-cd-hue);
    text-shadow: 0 0 18px color-mix(in srgb, var(--m2-cd-hue) 40%, transparent);
}

.m2-cd__sub {
    font-size: 12.5px;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.62);
}

.m2-cd__sub:empty { display: none; }

/* ---- clock ---- */
.m2-cd__clock {
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

.m2-cd__clock[hidden] { display: none; }

.m2-cd__unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 62px;
    padding: 8px 6px 7px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.m2-cd__unit[hidden] { display: none; }

.m2-cd__num {
    position: relative;
    display: block;
    height: 30px;
    font-size: 27px;
    font-weight: 700;
    line-height: 30px;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.m2-cd__cur,
.m2-cd__nxt {
    display: block;
    width: 100%;
    backface-visibility: hidden;
}

.m2-cd__nxt {
    position: absolute;
    inset: 0;
    opacity: 0;
}

/* flip: current digit rolls up and out, next digit rolls up and in */
.m2-cd__num.is-flip .m2-cd__cur { animation: m2cdOut 0.34s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.m2-cd__num.is-flip .m2-cd__nxt { animation: m2cdIn  0.34s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

@keyframes m2cdOut {
    0%   { transform: translateY(0) rotateX(0); opacity: 1; }
    100% { transform: translateY(-70%) rotateX(75deg); opacity: 0; }
}

@keyframes m2cdIn {
    0%   { transform: translateY(70%) rotateX(-75deg); opacity: 0; }
    100% { transform: translateY(0) rotateX(0); opacity: 1; }
}

.m2-cd__lbl {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
}

.m2-cd__sep {
    align-self: center;
    margin-top: -14px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    color: color-mix(in srgb, var(--m2-cd-hue) 55%, transparent);
    animation: m2cdBlink 1s steps(1, end) infinite;
}

@keyframes m2cdBlink {
    0%, 49%   { opacity: 1; }
    50%, 100% { opacity: 0.22; }
}

/* last minute: seconds pulse in the urgent colour */
.m2-cd.is-urgent .m2-cd__unit[data-cd-unit="s"] {
    border-color: color-mix(in srgb, var(--m2-cd-urgent) 55%, transparent);
    animation: m2cdPulse 1s ease-in-out infinite;
}

@keyframes m2cdPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 77, 0); }
    50%      { box-shadow: 0 0 18px -4px var(--m2-cd-urgent); }
}

/* ---- live state ---- */
.m2-cd__live {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--m2-cd-hue);
    box-shadow: 0 0 24px -8px var(--m2-cd-hue);
}

.m2-cd__live[hidden] { display: none; }

.m2-cd__live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #33d17a;
    box-shadow: 0 0 0 0 rgba(51, 209, 122, 0.6);
    animation: m2cdDot 1.6s ease-out infinite;
}

@keyframes m2cdDot {
    0%   { box-shadow: 0 0 0 0 rgba(51, 209, 122, 0.55); }
    70%  { box-shadow: 0 0 0 11px rgba(51, 209, 122, 0); }
    100% { box-shadow: 0 0 0 0 rgba(51, 209, 122, 0); }
}

/* ---- aside ---- */
.m2-cd__aside {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.m2-cd__btn {
    background: var(--m2-cd-hue);
    color: #131313;
}

.m2-cd__btn[hidden] { display: none; }

.m2-cd__local {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.42);
    text-align: center;
}

.m2-cd__local:empty { display: none; }

.m2-cd__close {
    position: absolute;
    top: 8px;
    right: 10px;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    font-size: 13px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.05);
    transition: color 0.2s ease, background 0.2s ease;
}

.m2-cd__close:hover { color: #fff; background: rgba(255, 255, 255, 0.14); }

/* ---- progress bar ---- */
.m2-cd__bar {
    position: relative;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.m2-cd__bar[hidden] { display: none; }

.m2-cd__bar-fill {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, color-mix(in srgb, var(--m2-cd-hue) 35%, transparent), var(--m2-cd-hue));
    box-shadow: 0 0 12px -1px var(--m2-cd-hue);
    transition: width 1s linear;
}

/* ====================================================================
   PLACEMENT VARIANTS
   ==================================================================== */

/* top: full-width strip directly under the site header */
.m2-cd--top { margin-bottom: 0; }

/* hero: sits inside the homepage banner, transparent shell */
.m2-cd--hero {
    max-width: 780px;
    margin: 0 auto 26px;
}

.m2-cd--hero .m2-cd__inner {
    justify-content: center;
    padding: 18px 22px;
    border: 1px solid color-mix(in srgb, var(--m2-cd-hue) 38%, transparent);
    border-radius: 16px;
    background:
        radial-gradient(120% 160% at 50% 0%, color-mix(in srgb, var(--m2-cd-hue) 18%, transparent) 0%, transparent 65%),
        rgba(10, 10, 12, 0.62);
    backdrop-filter: blur(6px);
}

.m2-cd--hero .m2-cd__bar { border-radius: 0 0 16px 16px; }

/* floating: fixed card in the lower-left corner */
.m2-cd--floating {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 9990;
    width: min(340px, calc(100vw - 32px));
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}

.m2-cd--floating .m2-cd__inner {
    flex-direction: column;
    gap: 12px;
    padding: 16px 16px 14px;
    text-align: center;
    border-left: 1px solid color-mix(in srgb, var(--m2-cd-hue) 45%, transparent);
    border-right: 1px solid color-mix(in srgb, var(--m2-cd-hue) 45%, transparent);
}

.m2-cd--floating .m2-cd__unit { min-width: 54px; }
.m2-cd--floating .m2-cd__num { height: 26px; font-size: 22px; line-height: 26px; }

/* ====================================================================
   RESPONSIVE
   ==================================================================== */

@media (max-width: 991px) {
    .m2-cd__inner { gap: 12px 20px; padding: 14px 42px 14px 18px; }
    .m2-cd__title { font-size: 16px; }
    .m2-cd__unit { min-width: 56px; }
    .m2-cd__num { height: 26px; font-size: 23px; line-height: 26px; }
}

@media (max-width: 700px) {
    .m2-cd__inner { flex-direction: column; text-align: center; padding: 14px 16px; }
    .m2-cd__head { flex-direction: column; gap: 8px; }
    .m2-cd__titles { align-items: center; }
    .m2-cd__close { top: 6px; right: 8px; }
    .m2-cd--hero { margin-bottom: 20px; }
}

@media (max-width: 400px) {
    .m2-cd__unit { min-width: 48px; padding: 6px 4px 5px; }
    .m2-cd__num { height: 23px; font-size: 20px; line-height: 23px; }
    .m2-cd__lbl { font-size: 8.5px; letter-spacing: 1px; }
    .m2-cd__sep { font-size: 18px; margin-top: -12px; }
}

@media (prefers-reduced-motion: reduce) {
    .m2-cd__sheen,
    .m2-cd__badge,
    .m2-cd__sep,
    .m2-cd__live-dot,
    .m2-cd.is-urgent .m2-cd__unit[data-cd-unit="s"] { animation: none; }
    .m2-cd__num.is-flip .m2-cd__cur,
    .m2-cd__num.is-flip .m2-cd__nxt { animation: none; }
    .m2-cd__bar-fill { transition: none; }
}
