/* Commerce on any public page (app/commerce/public.php links this file only when the page shows one of these): the countdown,
   the sticky offer bar, the offer popup, the campaign band, the package offer box and a service's live price fact.
   The redesign's language (DESIGN.md): oil and coal surfaces, 1px rules, mist text, Red Hat Mono for figures, and orange only
   for what is live (a running campaign's square) or the primary action. Every mark is drawn with borders.
   Stacking: the bar sits at 780, under the back-to-top square (800), the phone dock (790), the header (900), the menu and search
   dialogs (1000), the drawer (1100) and the toast (1200). The popup is a native modal dialog in the top layer.
   ----------------------------------------------------------------------- */

/* Countdown: four mono figures in rail-edged oil cells, the end in words beneath. Without JS the figures hide and the sentence
   says it all; at zero the cells dim and the live square turns rail. */
.wg-countdown { display: grid; gap: .5rem; min-width: 0; }
.wg-countdown__label {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin: 0;
    color: var(--fg-strong);
    font-size: var(--fs-label);
    font-weight: 620;
    line-height: 1.3;
    letter-spacing: var(--track-label);
}
.wg-countdown__live { flex: none; width: 7px; height: 7px; background: var(--c-orange); }
.wg-countdown__clock { display: flex; flex-wrap: wrap; gap: .375rem; margin: 0; }
.wg-countdown__part {
    display: grid;
    justify-items: center;
    min-width: 3.25rem;
    padding: .5rem .375rem .375rem;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius-sm);
    background: var(--c-oil);
}
.wg-countdown__num {
    color: var(--c-mist);
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.wg-countdown__unit { color: var(--fg-muted); font-size: .6875rem; font-weight: 500; letter-spacing: .02em; line-height: 1.4; }
.wg-countdown__when { margin: 0; color: var(--fg-muted); font-size: var(--fs-label); line-height: 1.45; }
.no-js .wg-countdown__clock { display: none; }
.no-js .wg-countdown__when { color: var(--fg); font-size: var(--fs-small); }
.wg-countdown.is-ended .wg-countdown__clock { opacity: .45; }
.wg-countdown.is-ended .wg-countdown__live { background: var(--rule-strong); }
.wg-countdown.is-ended .wg-countdown__when { color: var(--fg); }

/* Card: smaller cells */
.wg-countdown--card .wg-countdown__part { min-width: 2.75rem; padding: .375rem .3rem .3rem; }
.wg-countdown--card .wg-countdown__num { font-size: 1.125rem; }
.prc-card.is-featured .wg-countdown__part { background: var(--c-coal); }

/* Bar: one compact line, label and figures side by side; the sentence stays for screen readers */
.wg-countdown--bar { grid-auto-flow: column; align-items: center; gap: .75rem; }
.wg-countdown--bar .wg-countdown__part { grid-auto-flow: column; align-items: baseline; gap: .2rem; min-width: 0; padding: .25rem .45rem; }
.wg-countdown--bar .wg-countdown__num { font-size: 1rem; }
.wg-countdown--bar .wg-countdown__unit { font-size: .625rem; }
.wg-countdown--bar .wg-countdown__when {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}
.no-js .wg-countdown--bar .wg-countdown__when { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal; }

/* Sticky offer bar. Without JS: a plain strip after the main content. With JS: pinned to the bottom edge, shown by commerce.js
   once its rules allow, above the phone dock, and the back-to-top square and toast step up over it. */
.wg-promo-bar {
    position: relative;
    z-index: 780;
    border-top: 1px solid var(--c-line);
    background: var(--c-oil);
    color: var(--fg);
}
.wg-promo-bar__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-3) var(--s-6);
    padding-block: .75rem;
}
.wg-promo-bar__text { flex: 1 1 16rem; min-width: 0; }
.wg-promo-bar__title {
    display: flex;
    align-items: center;
    gap: .625rem;
    margin: 0;
    color: var(--fg-strong);
    font-size: var(--fs-small);
    font-weight: 620;
    line-height: 1.35;
}
.wg-promo-bar__mark { flex: none; width: 8px; height: 8px; background: var(--c-orange); }
.wg-promo-bar__body,
.wg-promo-bar__code { margin: .15rem 0 0 calc(8px + .625rem); color: var(--fg); font-size: var(--fs-label); line-height: 1.45; }
.wg-promo-bar__actions { display: flex; align-items: center; gap: var(--s-2); margin-left: auto; }
.wg-promo-bar__close,
.wg-promo-pop__close {
    display: none;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    color: var(--fg);
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.wg-promo-bar__close .wg-icon,
.wg-promo-pop__close .wg-icon { width: 20px; height: 20px; }
.js .wg-promo-bar__close,
.js .wg-promo-pop__close { display: grid; }
.wg-promo-bar__close:hover,
.wg-promo-bar__close:focus-visible,
.wg-promo-pop__close:hover,
.wg-promo-pop__close:focus-visible { border-color: var(--rule-strong); color: var(--fg-strong); }

.js .wg-promo-bar {
    position: fixed;
    inset: auto 0 0;
    background: var(--c-oil);
    box-shadow: var(--shadow-lift);
    visibility: hidden;
    transform: translateY(100%);
    transition: transform 180ms var(--ease-in-out), visibility 0s linear 180ms;
}
.js .wg-promo-bar .wg-promo-bar__inner { padding-bottom: calc(.75rem + env(safe-area-inset-bottom)); }
.js .wg-promo-bar.is-visible {
    visibility: visible;
    transform: none;
    transition: transform var(--dur) var(--ease-out), visibility 0s;
}
.has-promo-bar { scroll-padding-bottom: calc(var(--promo-h, 4.5rem) + 1rem); }
.has-promo-bar .wg-top,
.has-promo-bar .wg-toast { bottom: calc(var(--promo-h, 4.5rem) + 1rem); }
/* Phones: two rows. The title and the close button, then the figures and the link; the figures stack their units, no label. */
@media (max-width: 39.99em) {
    .wg-promo-bar__inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "text close" "clock cta";
        align-items: center;
        gap: .5rem .75rem;
    }
    .wg-promo-bar__text { grid-area: text; }
    .wg-promo-bar .wg-countdown { grid-area: clock; }
    .wg-promo-bar__actions { display: contents; }
    .wg-promo-bar__actions > .wg-btn { grid-area: cta; justify-self: end; }
    .wg-promo-bar__close { grid-area: close; justify-self: end; }
    .wg-promo-bar__body,
    .wg-promo-bar .wg-countdown__label { display: none; }
    .wg-countdown--bar .wg-countdown__clock { flex-wrap: nowrap; gap: .25rem; }
    .wg-countdown--bar .wg-countdown__part { grid-auto-flow: row; justify-items: center; gap: 0; min-width: 2.375rem; padding: .2rem .25rem .15rem; }
    .wg-countdown--bar .wg-countdown__num { font-size: .9375rem; }
    .wg-countdown--bar .wg-countdown__unit { font-size: .5625rem; }
    .js.has-dock .wg-promo-bar { bottom: var(--dock-h); }
    .has-dock.has-promo-bar .wg-top,
    .has-dock.has-promo-bar .wg-toast { bottom: calc(var(--dock-h) + var(--promo-h, 4.5rem) + .75rem); }
    .has-dock.has-promo-bar { scroll-padding-bottom: calc(var(--dock-h) + var(--promo-h, 4.5rem) + 1rem); }
}

/* The offer popup: a native modal dialog on a coal panel with the panel shadow, over the drawer's 70% obsidian scrim */
.wg-promo-pop {
    width: min(34rem, calc(100% - 2rem));
    max-height: calc(100dvh - 2rem);
    margin: auto;
    padding: 0;
    overflow: auto;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    background: var(--c-coal);
    color: var(--fg);
    box-shadow: var(--shadow-panel);
}
.wg-promo-pop::backdrop { background: rgba(11, 18, 21, .7); }
.wg-promo-pop__panel { position: relative; }
.wg-promo-pop__close { position: absolute; top: .5rem; right: .5rem; z-index: 1; }
.wg-promo-pop__image { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.wg-promo-pop__body { display: grid; gap: var(--s-4); padding: clamp(1.5rem, 1.2rem + 1vw, 2.25rem); }
.wg-promo-pop__title {
    margin: 0 2.75rem 0 0;
    color: var(--fg-strong);
    font-size: var(--fs-h3);
    font-weight: 620;
    line-height: 1.2;
    letter-spacing: -.014em;
}
.wg-promo-pop__text,
.wg-promo-pop__code { margin: 0; color: var(--fg); line-height: 1.55; }
.wg-promo-pop__actions { margin-top: var(--s-2); }
.wg-promo-pop__later {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: var(--fs-small);
    font-weight: 620;
    cursor: pointer;
}
@media (prefers-reduced-motion: no-preference) {
    .wg-promo-pop[open] { animation: wg-pop-in var(--dur) var(--ease-out) both; }
    .wg-promo-pop[open]::backdrop { animation: wg-pop-fade var(--dur) var(--ease-out) both; }
}
@keyframes wg-pop-in { from { opacity: 0; transform: translateY(.5rem); } to { opacity: 1; transform: none; } }
@keyframes wg-pop-fade { from { opacity: 0; } to { opacity: 1; } }

/* The campaign band (home, pricing and campaign pages): obsidian between two hairlines, the live square before the headline */
.wg-campaign {
    padding-block: clamp(1.75rem, 1.3rem + 1.8vw, 2.75rem);
    border-block: 1px solid var(--rule);
    background: var(--c-obsidian);
    color: var(--fg);
}
.wg-campaign + .wg-campaign { border-top: 0; }
.wg-campaign__inner { display: grid; gap: var(--s-5); }
@media (min-width: 992px) {
    .wg-campaign__inner { grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--gap) var(--s-7); }
}
.wg-campaign__text { min-width: 0; }
.wg-campaign__title {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    margin: 0;
    color: var(--fg-strong);
    font-size: var(--fs-h3);
    font-weight: 620;
    line-height: 1.25;
    letter-spacing: -.014em;
}
.wg-campaign__title--small { font-size: var(--fs-h4); }
.wg-campaign__mark { flex: none; width: 9px; height: 9px; background: var(--c-orange); transform: translateY(-2px); }
.wg-campaign__lead { max-width: 40rem; margin: .5rem 0 0 calc(9px + .75rem); color: var(--fg); line-height: 1.55; }
.wg-campaign__when { margin: .5rem 0 0 calc(9px + .75rem); color: var(--fg-muted); font-size: var(--fs-small); }
.wg-campaign__action { margin: 0; }

/* A package's price today (offer-box.php). In its band under the package banner it lies flat on one line from 768px. */
.wg-offer-band { border-bottom: 1px solid var(--rule); background: var(--c-obsidian); padding-block: var(--s-6); }
.wg-offer-band + .wg-section:not(.wg-section--stone) { border-top: 0; }
.wg-offer-box {
    display: grid;
    gap: .5rem var(--s-6);
    min-width: 0;
    color: var(--fg);
}
.wg-offer-box__title { margin: 0; color: var(--fg-muted); font-size: var(--fs-label); font-weight: 620; letter-spacing: var(--track-label); }
.wg-offer-box__amount { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; margin: 0; }
.wg-offer-box__from { color: var(--fg-muted); font-size: var(--fs-small); font-weight: 600; }
.wg-offer-box__figure {
    color: var(--fg-strong);
    font-family: var(--font-mono);
    font-size: clamp(1.75rem, 1.5rem + 1vw, 2.25rem);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: -.03em;
}
.wg-offer-box__billing,
.wg-offer-box__was { margin: 0; color: var(--fg-muted); font-size: var(--fs-small); line-height: 1.45; }
.wg-offer-box__was s { font-family: var(--font-mono); }
.wg-offer-box__offer { display: inline-flex; align-items: center; gap: .55rem; margin: 0; color: var(--fg-strong); font-size: var(--fs-label); font-weight: 620; }
.wg-offer-box__mark { flex: none; width: 8px; height: 8px; background: var(--c-orange); }
.wg-offer-box__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-5); margin: .5rem 0 0; }
@media (min-width: 768px) {
    .wg-offer-band .wg-offer-box {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas: "title offer actions" "amount offer actions" "billing offer actions";
        align-items: center;
    }
    .wg-offer-band .wg-offer-box__title { grid-area: title; }
    .wg-offer-band .wg-offer-box__amount { grid-area: amount; }
    .wg-offer-band .wg-offer-box__billing { grid-area: billing; }
    .wg-offer-band .wg-offer-box__actions { grid-area: actions; margin: 0; }
    .wg-offer-band .wg-offer-box__offer,
    .wg-offer-band .wg-offer-box__was,
    .wg-offer-band .wg-offer-box .wg-countdown { grid-column: 2; }
    .wg-offer-band .wg-offer-box__offer { grid-row: 1; }
    .wg-offer-band .wg-offer-box .wg-countdown { grid-row: 2 / 4; }
}

/* A service's live price beside its banner button (service.php) */
.wg-price-fact { display: inline-flex; align-items: baseline; gap: .5rem; margin: 0; color: var(--fg); }
.wg-price-fact__label { color: var(--fg-muted); font-size: var(--fs-label); font-weight: 620; letter-spacing: var(--track-label); }
.wg-price-fact__figure { color: var(--fg-strong); font-family: var(--font-mono); font-size: 1.0625rem; font-variant-numeric: tabular-nums; }

/* A discount code shown in a promo: mono, a dashed rail edge (it is copied, not clicked) */
.wg-code {
    padding: .05rem .4rem;
    border: 1px dashed var(--rule-strong);
    border-radius: var(--radius-sm);
    color: var(--fg-strong);
    font-family: var(--font-mono);
    font-size: .9em;
    letter-spacing: .04em;
}

@media (prefers-reduced-motion: reduce) {
    .js .wg-promo-bar,
    .js .wg-promo-bar.is-visible { transform: none; transition: visibility 0s; }
}
@media (forced-colors: active) {
    .wg-countdown__live,
    .wg-promo-bar__mark,
    .wg-campaign__mark,
    .wg-offer-box__mark { forced-color-adjust: none; background: Highlight; }
}
@media print {
    .wg-promo-bar,
    .wg-promo-pop { display: none !important; }
}
