/* Header / top-bar: [digtiali_weekly_offers_countdown], [digtiali_weekly_offers_marquee] */

/* wpautop / block editor can leave empty <p> around shortcodes — hide so margins do not stack */
#digi-announce p:empty,
#digi-announce .dwo-marquee-shell p:empty,
#digi-announce .dwo-weekly-widget p:empty {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* wpautop can insert lone <br> before block children of the shortcode root */
#digi-announce .dwo-weekly-widget--has-close > br {
    display: none;
}

#digi-announce .dwo-weekly-widget,
#digi-announce .dwo-marquee-shell {
    margin-bottom: 0 !important;
}

.dwo-weekly-widget {
    /* Matches WoodMart header top bar in your theme */
    --dwo-strip-bar-bg: rgba(120, 27, 175, 1);
    --dwo-strip-brand: var(--dsa-primary, #4e0078);
    --dwo-strip-brand-deep: #3a0060;
    --dwo-strip-line: rgba(15, 23, 42, 0.1);
    --dwo-strip-text: #0c1222;
    --dwo-strip-muted: #475569;
    --dwo-strip-digit: #0f172a;
    box-sizing: border-box;
    max-width: 100%;
    margin-bottom: 0.25rem;
    font-family: "Almarai", system-ui, -apple-system, "Segoe UI", sans-serif;
    isolation: isolate;
}

.dwo-weekly-widget *,
.dwo-weekly-widget *::before,
.dwo-weekly-widget *::after {
    box-sizing: border-box;
}

/* ----- Countdown (card / default) ----- */

.dwo-weekly-widget .dwo-countdown--strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: clamp(10px, 2vw, 18px);
    margin: 0;
    padding: clamp(10px, 1.8vw, 14px) clamp(12px, 2.5vw, 20px);
    border: 1px solid var(--dwo-strip-line);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(78, 0, 120, 0.06) 0%, rgba(255, 255, 255, 0.92) 55%, rgba(15, 118, 110, 0.04) 100%);
    color: var(--dwo-strip-text);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
    position: relative;
    z-index: 2;
}

.dwo-weekly-widget .dwo-countdown--strip .dwo-countdown__copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    flex: 1 1 140px;
}

/* Text-only label (no pill, no underline — reads as plain text) */
.dwo-weekly-widget .dwo-countdown--strip .dwo-countdown__eyebrow--plain {
    display: inline-block;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--dwo-strip-brand);
    font-size: clamp(12px, 1.4vw, 14px);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0.02em;
    text-decoration: none;
    white-space: nowrap;
}

.dwo-weekly-widget .dwo-countdown--strip .dwo-countdown__message {
    margin: 0;
    color: var(--dwo-strip-muted);
    font-size: 13px;
    line-height: 1.45;
    max-width: 42ch;
}

.dwo-weekly-widget .dwo-countdown--strip .dwo-countdown__clock {
    display: grid;
    grid-template-columns: repeat(4, minmax(52px, 1fr));
    gap: clamp(6px, 1.2vw, 10px);
    flex: 0 1 auto;
}

.dwo-weekly-widget .dwo-countdown--strip .dwo-countdown__unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 5px 5px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    min-height: 0;
}

/* Digits must stay visible on light cards (parent header themes often set light `color`). */
.dwo-weekly-widget .dwo-countdown--strip .dwo-countdown__unit > strong {
    font-size: clamp(15px, 2vw, 22px);
    line-height: 1;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
    color: var(--dwo-strip-digit);
}

.dwo-weekly-widget .dwo-countdown--strip .dwo-countdown__unit > span {
    color: var(--dwo-strip-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.dwo-weekly-widget--compact .dwo-countdown--strip {
    padding: 8px 12px;
    gap: 8px;
    border-radius: 14px;
}

.dwo-weekly-widget--compact .dwo-countdown--strip .dwo-countdown__clock {
    grid-template-columns: repeat(4, minmax(46px, 1fr));
    gap: 6px;
}

.dwo-weekly-widget--compact .dwo-countdown--strip .dwo-countdown__eyebrow--plain {
    font-size: 11px;
}

.dwo-weekly-widget--compact .dwo-countdown--strip .dwo-countdown__unit {
    padding: 5px 4px 4px;
    min-height: 0;
    border-radius: 10px;
}

.dwo-weekly-widget--compact .dwo-countdown--strip .dwo-countdown__unit > strong {
    font-size: clamp(15px, 2vw, 21px);
}

.dwo-weekly-widget--compact .dwo-countdown--strip .dwo-countdown__unit > span {
    font-size: 10px;
}

/* Close beside countdown (card layout only; bar uses .dwo-countdown--rail) */
.dwo-weekly-widget--has-close {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.dwo-weekly-widget--has-close .dwo-countdown--strip {
    flex: 1 1 auto;
    min-width: 0;
}

.dwo-weekly-widget--has-close .dwo-weekly-strip-close {
    flex-shrink: 0;
}

/* ----- Full-width bar (theme="bar"): single rail, reference-style cells + CTA ----- */

.dwo-weekly-widget--theme-bar {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding-block: 10px;
    padding-left: max(clamp(12px, 3vw, 28px), env(safe-area-inset-left, 0px));
    padding-right: max(clamp(12px, 3vw, 28px), env(safe-area-inset-right, 0px));
    background: linear-gradient(90deg, #4a0e73 0%, #781baf 46%, #9b2dd4 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: none;
    position: relative;
    z-index: auto;
    overflow: visible;
}

/* Bar rail: do NOT combine with .dwo-countdown--strip (strip adds wrap + card styles) */
.dwo-weekly-widget--theme-bar .dwo-countdown--rail {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(6px, 1.5vw, 14px);
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    min-height: 44px;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.dwo-weekly-widget--theme-bar .dwo-countdown--rail::-webkit-scrollbar {
    display: none;
}

.dwo-weekly-widget--theme-bar .dwo-countdown__spark {
    flex-shrink: 0;
    font-size: 1.35rem;
    line-height: 1;
    user-select: none;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.28));
}

.dwo-weekly-widget--theme-bar .dwo-countdown__copy--rail {
    display: none;
}

.dwo-weekly-widget--theme-bar .dwo-countdown__eyebrow--rail {
    margin: 0;
    padding: 0;
    font-size: clamp(13px, 1.75vw, 15px);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0.02em;
    color: #fff;
}

.dwo-weekly-widget--theme-bar .dwo-countdown__message--rail {
    margin: 0;
    padding: 0;
    font-size: clamp(11px, 1.35vw, 13px);
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.88);
    max-width: min(44ch, 46vw);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dwo-weekly-widget--theme-bar .dwo-countdown--rail .dwo-countdown__clock {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 6px;
    flex-shrink: 0;
    margin-inline: auto;
    padding: 0;
}

.dwo-weekly-widget--theme-bar .dwo-countdown--rail .dwo-countdown__unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 44px;
    padding: 6px 6px 5px;
    border-radius: 10px;
    background: rgba(22, 5, 40, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.dwo-weekly-widget--theme-bar .dwo-countdown--rail .dwo-countdown__unit > strong {
    font-size: clamp(14px, 1.85vw, 18px);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
    line-height: 1;
    color: #fff;
}

.dwo-weekly-widget--theme-bar .dwo-countdown--rail .dwo-countdown__unit > span {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.15;
}

.dwo-weekly-widget--theme-bar .dwo-countdown__cta {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    color: #fff;
    font-weight: 800;
    font-size: clamp(13px, 1.5vw, 15px);
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 1.5px;
    white-space: nowrap;
}

.dwo-weekly-widget--theme-bar .dwo-countdown__cta:hover {
    color: #f5e9ff;
}

.dwo-weekly-widget--theme-bar .dwo-countdown__cta:focus-visible {
    outline: 2px solid #a8ff3e;
    outline-offset: 3px;
    border-radius: 4px;
}

.dwo-weekly-widget--theme-bar .dwo-countdown__cta-arrow {
    font-size: 1.1em;
    line-height: 1;
    text-decoration: none;
}

/* Close control matches timer “cells” (reference strip) */
.dwo-weekly-widget--theme-bar .dwo-weekly-strip-close--cell.digi-announce-close {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    margin: 0;
    padding: 0;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    background: rgba(22, 5, 40, 0.92) !important;
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.dwo-weekly-widget--theme-bar .dwo-weekly-strip-close--cell.digi-announce-close:hover {
    background: rgba(34, 10, 58, 0.95) !important;
    color: #fff;
}

@media (max-width: 640px) {
    .dwo-weekly-widget--theme-bar {
        padding-block: 8px;
        padding-inline: max(10px, env(safe-area-inset-left, 0px));
    }

    .dwo-weekly-widget--theme-bar .dwo-countdown--rail {
        flex-wrap: nowrap;
        gap: 6px;
    }

    .dwo-weekly-widget--theme-bar .dwo-countdown__copy--rail {
        display: none;
    }

    .dwo-weekly-widget--theme-bar .dwo-countdown--rail .dwo-countdown__unit {
        min-width: 38px;
        padding: 4px 4px 3px;
    }

    .dwo-weekly-widget--theme-bar .dwo-weekly-strip-close--cell.digi-announce-close {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        min-height: 38px !important;
    }
}

/* ----- Marquee ----- */

.dwo-marquee-shell {
    width: 100%;
    max-width: 100%;
    padding: 6px 0px;
    position: relative;
    z-index: 10;
    margin-block: 0;
    margin-bottom: 0.35rem;
    color: rgba(255, 255, 255, 0.95);
}

/* Countdown lives inside the scrolling track (same animated row as text) */
.dwo-marquee-shell--scrolls-countdown {
    min-width: 0;
}

.dwo-marquee__clock-wrap {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    vertical-align: middle;
    --dwo-strip-digit: #1e1b4b;
    --dwo-strip-muted: #5b21b6;
}

.dwo-marquee__clock-wrap .dwo-countdown__clock {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
    min-width: 0;
    margin: 0;
}

.dwo-marquee__clock-wrap .dwo-countdown__unit {
    padding: 2px 4px 3px;
    gap: 2px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dwo-marquee__clock-wrap .dwo-countdown__unit > strong {
    font-size: clamp(11px, 1.4vw, 14px);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
    color: var(--dwo-strip-digit);
    line-height: 1;
}

.dwo-marquee__clock-wrap .dwo-countdown__unit > span {
    font-size: 8px;
    font-weight: 700;
    color: var(--dwo-strip-muted);
    line-height: 1.1;
}

.dwo-weekly-widget--theme-bar + .dwo-marquee-shell {
    margin-top: 0;
}

.dwo-marquee {
    display: flex;
    align-items: center;
    min-height: 0;
    overflow: hidden;
    padding-inline: 0;
    color: rgba(255, 255, 255, 0.95);
    font-family: "Almarai", system-ui, sans-serif;
    font-size: clamp(12px, 1.05vw, 14px);
    line-height: 1.45;
    letter-spacing: 0.02em;
    -webkit-font-smoothing: antialiased;
    -webkit-mask-image: linear-gradient(
        90deg,
        transparent 0,
        #000 12px,
        #000 calc(100% - 12px),
        transparent 100%
    );
    mask-image: linear-gradient(
        90deg,
        transparent 0,
        #000 12px,
        #000 calc(100% - 12px),
        transparent 100%
    );
}

.dwo-marquee--multi .dwo-marquee__cluster {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.4em;
    white-space: nowrap;
    direction: rtl;
    unicode-bidi: isolate;
}

.dwo-marquee__item {
    color: inherit;
    font-weight: 700;
    text-decoration: none;
}

a.dwo-marquee__item--link {
    color: inherit;
    cursor: pointer;
    transition: opacity 0.15s ease, color 0.15s ease;
}

a.dwo-marquee__item--link:hover {
    color: #fff;
    opacity: 0.95;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.dwo-marquee__sep {
    opacity: 0.55;
    font-weight: 700;
    user-select: none;
}

.dwo-marquee__track {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    width: max-content;
    max-width: none;
    gap: clamp(2rem, 6vw, 4.5rem);
    padding-inline: clamp(1rem, 4vw, 2.5rem);
    animation: dwo-marquee-scroll var(--dwo-marquee-duration, 36s) linear infinite;
    /* LTR track keeps transform math stable inside RTL shells */
    direction: ltr;
}

@keyframes dwo-marquee-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .dwo-marquee__track {
        animation: none;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        text-align: center;
        row-gap: 0.35rem;
    }

    .dwo-marquee__cluster[aria-hidden="true"] {
        display: none;
    }

    .dwo-marquee {
        -webkit-mask-image: none;
        mask-image: none;
    }
}

@media (max-width: 600px) {
    .dwo-weekly-widget .dwo-countdown--strip .dwo-countdown__clock {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .dwo-weekly-widget--compact .dwo-countdown--strip .dwo-countdown__clock {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dwo-weekly-widget--theme-bar .dwo-countdown--strip {
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 10px;
    }

    .dwo-weekly-widget--theme-bar .dwo-countdown--strip .dwo-countdown__copy {
        text-align: center;
        flex: 1 1 100%;
    }

    .dwo-marquee__clock-wrap .dwo-countdown__clock {
        gap: 2px;
    }

    .dwo-marquee__clock-wrap .dwo-countdown__unit {
        padding: 2px 2px 2px;
    }

    .dwo-marquee__clock-wrap .dwo-countdown__unit > strong {
        font-size: 10px;
    }

    .dwo-marquee__clock-wrap .dwo-countdown__unit > span {
        font-size: 7px;
    }
}

/* -----------------------------------------------------------------------------
 * WoodMart header builder: .whb-top-bar-inner uses fixed --wd-top-bar-h (~42px),
 * which clips tall shortcodes. General header rows use the same pattern.
 * -------------------------------------------------------------------------- */

.whb-top-bar .whb-top-bar-inner:has(.dwo-weekly-widget),
.whb-top-bar .whb-top-bar-inner:has(.dwo-marquee-shell),
.whb-clone .whb-top-bar .whb-top-bar-inner:has(.dwo-weekly-widget),
.whb-clone .whb-top-bar .whb-top-bar-inner:has(.dwo-marquee-shell),
.whb-clone .whb-top-bar-inner:has(.dwo-weekly-widget),
.whb-clone .whb-top-bar-inner:has(.dwo-marquee-shell) {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding-block: 5px !important;
}

.whb-sticked .whb-top-bar .whb-top-bar-inner:has(.dwo-weekly-widget),
.whb-sticked .whb-top-bar .whb-top-bar-inner:has(.dwo-marquee-shell),
.whb-sticked .whb-clone .whb-top-bar-inner:has(.dwo-weekly-widget),
.whb-sticked .whb-clone .whb-top-bar-inner:has(.dwo-marquee-shell) {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

.whb-top-bar:has(.dwo-weekly-widget),
.whb-top-bar:has(.dwo-marquee-shell) {
    overflow: visible !important;
}

.whb-top-bar .whb-flex-row:has(.dwo-weekly-widget),
.whb-top-bar .whb-flex-row:has(.dwo-marquee-shell),
.whb-top-bar .whb-column:has(.dwo-weekly-widget),
.whb-top-bar .whb-column:has(.dwo-marquee-shell) {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
}

.whb-general-header .whb-general-header-inner:has(.dwo-weekly-widget),
.whb-general-header .whb-general-header-inner:has(.dwo-marquee-shell) {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    min-height: var(--wd-header-general-h, 60px);
}

.whb-general-header .whb-flex-row:has(.dwo-weekly-widget),
.whb-general-header .whb-flex-row:has(.dwo-marquee-shell),
.whb-general-header .whb-column:has(.dwo-weekly-widget),
.whb-general-header .whb-column:has(.dwo-marquee-shell) {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
}

.elementor-widget-shortcode.elementor-element:has(.dwo-weekly-widget),
.elementor-widget-shortcode.elementor-element:has(.dwo-marquee-shell),
.elementor-widget-html.elementor-element:has(.dwo-weekly-widget),
.elementor-widget-html.elementor-element:has(.dwo-marquee-shell) {
    overflow: visible !important;
}

/* Let the purple bar fill the widget column when the shortcode sits in Elementor / narrow flex cells */
.elementor-widget-shortcode.elementor-element:has(.dwo-weekly-widget--theme-bar),
.elementor-widget-html.elementor-element:has(.dwo-weekly-widget--theme-bar) {
    width: 100%;
    max-width: 100%;
}

.whb-top-bar .whb-column:has(.dwo-weekly-widget--theme-bar),
.whb-general-header .whb-column:has(.dwo-weekly-widget--theme-bar) {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

/* -----------------------------------------------------------------------------
 * Digtiali FSE (digtiali-fse): block theme header + `.digi-announce` strip
 * Same goals as WoodMart rules above: no clipping, flex children min-width:0,
 * full-width band for theme="bar" + marquee under the same purple system.
 * -------------------------------------------------------------------------- */

.digi-announce:has(.dwo-weekly-widget),
.digi-announce:has(.dwo-marquee-shell) {
    overflow: visible;
}

.digi-announce .digi-announce-inner--weekly.wp-block-group {
    max-width: none;
    width: 100%;
    margin: 0;
    padding-inline: max(16px, env(safe-area-inset-left, 0px));
    padding-inline-end: max(16px, env(safe-area-inset-right, 0px));
    padding-block: 0;
    box-sizing: border-box;
}

.digi-announce .digi-announce-toprow.wp-block-group {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-width: 0;
}

.digi-announce .digi-announce-toprow .wp-block-shortcode {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
}

.digi-announce .digi-announce-inner--weekly > .wp-block-shortcode {
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
}

.digi-announce .dwo-weekly-widget--theme-bar {
    margin-bottom: 0;
}

.digi-announce .dwo-marquee-shell {
    margin-top: 0;
    margin-bottom: 0;
    width: 100%;
    max-width: 100%;
    display: flex;
}

/* Align strip chrome with theme tokens when available */
.digi-announce .dwo-weekly-widget--theme-bar,
.digi-announce .dwo-marquee .dwo-marquee__track {
    --dwo-strip-bar-bg: var(--digi-purple, rgba(120, 27, 175, 1));
}

.digi-announce .dwo-marquee {
    font-family: var(--digi-font, "Almarai", system-ui, sans-serif);
}

.digi-nav-wrapper .wp-block-shortcode:has(.dwo-weekly-widget),
.digi-nav-wrapper .wp-block-shortcode:has(.dwo-marquee-shell) {
    min-width: 0;
    max-width: 100%;
    overflow: visible;
}

header .wp-block-shortcode:has(.dwo-marquee-shell),
header .wp-block-shortcode:has(.dwo-weekly-widget),
#digi-announce .wp-block-shortcode:has(.dwo-marquee-shell),
#digi-announce .wp-block-shortcode:has(.dwo-weekly-widget) {
    overflow: visible;
}
