/* ─── Kraft Worth — Festive Theme ─────────────────────────────────────────────
   Self-contained seasonal layer. EVERY rule is scoped to `html.kw-festive`,
   a class festive.js adds only while the theme is enabled. Switch the theme
   off (Admin → Festive Theme, or window.KW_FESTIVE.enabled = false in
   festive-config.js) and the class is never added, so none of these styles
   apply and there is nothing left to clean up.

   Palette: deep pine #14352A / #1B4332 · warm cream #F3ECE4 · gold #D4AF37
   (#B91C1C crimson is kept for the badges and the hairline). The bar is dark
   like the rest of the site, so it sits under the navbar instead of cutting a
   white stripe across it. Existing backgrounds and typography are untouched. */

html.kw-festive {
    --kw-xmas-red: #b91c1c;
    --kw-xmas-red-deep: #991b1b;
    --kw-xmas-pine: #1b4332;
    --kw-xmas-pine-deep: #14352a;
    --kw-xmas-white: #faf9f6;
    --kw-xmas-cream: #f3ece4;
    --kw-xmas-gold: #d4af37;
    /* Height the fixed site nav is pushed down by while the bar is shown. */
    --kw-festive-bar-h: 34px;
}

/* ── Announcement bar ─────────────────────────────────────────────────────── */
html.kw-festive .kw-festive-bar {
    /* Above the fixed site nav (z-index 100) so it never covers the bar and
       the dismiss button stays clickable. */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 101;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: .2rem .6rem;
    padding: .55rem 2.75rem;
    /* Lifted off the near-black page: a richer evergreen with brighter edges,
       so the band reads as a deliberate banner at a glance rather than a tint. */
    background: linear-gradient(90deg,
        #1a3d2e 0%,
        #2a6049 50%,
        #1a3d2e 100%);
    color: #fff9f0;
    border-top: 1px solid rgba(212, 175, 55, .5);
    border-bottom: 1px solid var(--kw-xmas-gold);
    box-shadow: 0 4px 18px rgba(0, 0, 0, .45);
    font-family: var(--font-body);
    font-size: .84rem;
    font-weight: 600;
    letter-spacing: .06em;
    line-height: 1.35;
    text-align: center;
}

/* Even line breaks on narrow phones, so the sentence stops orphaning a word. */
html.kw-festive .kw-festive-bar-text { text-wrap: balance; }

/* The CTA is a solid gold pill: the strongest, easily the most premium cue in
   the bar, and it survives a small screen far better than underlined gold. */
html.kw-festive .kw-festive-bar a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .3rem .85rem;
    border-radius: 999px;
    background: var(--kw-xmas-gold);
    color: #14352a;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 1px 2px rgba(0, 0, 0, .3);
    transition: background-color .18s ease, transform .18s ease;
}

html.kw-festive .kw-festive-bar a:hover {
    background: #e8c65a;
    color: #14352a;
    text-decoration: none;
    transform: translateY(-1px);
}

html.kw-festive .kw-festive-bar-close {
    position: absolute;
    top: 50%;
    right: .15rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 40px touch target around a small × glyph — the old 22px box was below
       the 24px WCAG minimum and hard to hit on a phone. */
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--kw-xmas-cream);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1;
    opacity: .7;
    cursor: pointer;
}

html.kw-festive .kw-festive-bar-close:hover,
html.kw-festive .kw-festive-bar-close:focus-visible {
    opacity: 1;
    background: rgba(212, 175, 55, .16);
    color: var(--kw-xmas-gold);
}

html.kw-festive.kw-festive-bar-dismissed { --kw-festive-bar-h: 0px; }
html.kw-festive.kw-festive-bar-dismissed .kw-festive-bar { display: none; }

/* The site nav is position:fixed/top:0 on every page — slide it down so the
   announcement bar sits above it instead of underneath. */
html.kw-festive .navbar { top: var(--kw-festive-bar-h); }

/* ── Berry & pine garland, pinned under the bar's corners ─────────────────── */
html.kw-festive .kw-festive-garland {
    position: absolute;
    top: 100%;
    width: 120px;
    height: 22px;
    overflow: visible;
    pointer-events: none;
    /* Above the bar (101) and the site nav (100): the berries are meant to
       dangle across the navbar's top edge, not disappear behind it. */
    z-index: 102;
}

html.kw-festive .kw-festive-garland--left { left: 0; }
html.kw-festive .kw-festive-garland--right { right: 0; transform: scaleX(-1); }

/* ── "Gift Ready" product badge ───────────────────────────────────────────── */
html.kw-festive .product-card { position: relative; }

html.kw-festive .kw-festive-badge {
    position: absolute;
    top: .6rem;
    left: .6rem;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: .32rem;
    padding: .24rem .62rem;
    border: 1px solid var(--kw-xmas-red);
    border-radius: 999px;
    background: var(--kw-xmas-white);
    color: var(--kw-xmas-red-deep);
    font-family: var(--font-body);
    font-size: .56rem;
    font-weight: 600;
    letter-spacing: .13em;
    line-height: 1.4;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
    pointer-events: none;
}

html.kw-festive .kw-festive-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--kw-xmas-red);
}

/* ── Ambient snowfall ─────────────────────────────────────────────────────── */
html.kw-festive .kw-festive-snow {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 30;
    opacity: .6;
}

/* ── Small screens: shrink the trimmings, never crowd navigation ──────────── */
@media (max-width: 640px) {
    html.kw-festive .kw-festive-bar {
        font-size: .76rem;
        /* Right padding reserves room for the 40px dismiss target. */
        padding: .45rem 2.9rem .45rem 2.4rem;
        gap: .15rem .45rem;
    }
    html.kw-festive .kw-festive-bar a {
        font-size: .68rem;
        padding: .26rem .7rem;
        letter-spacing: .06em;
    }
    html.kw-festive .kw-festive-garland {
        width: 88px;
        height: 16px;
    }
    html.kw-festive .kw-festive-badge {
        top: .45rem;
        left: .45rem;
        font-size: .5rem;
        padding: .18rem .5rem;
    }
}

/* ── Narrow phones (≤400px) ────────────────────────────────────────────────
   At 320-360px the copy wrapped to four lines and pushed the page down 64px.
   Tighter type keeps it to two or three lines. */
@media (max-width: 400px) {
    html.kw-festive .kw-festive-bar {
        font-size: .7rem;
        letter-spacing: .015em;
        line-height: 1.25;
        padding: .3rem 2.5rem .3rem 2rem;
        gap: .15rem .3rem;
    }
    html.kw-festive .kw-festive-bar a {
        font-size: .62rem;
        padding: .22rem .55rem;
        letter-spacing: .03em;
    }
    html.kw-festive .kw-festive-bar-close {
        width: 36px;
        height: 36px;
        right: .05rem;
        font-size: .95rem;
    }
    html.kw-festive .kw-festive-garland {
        width: 68px;
        height: 13px;
    }
}

/* ── Admin readout pill (used only by Admin → Festive Theme) ────────────────
   Deliberately not scoped to html.kw-festive: the panel must show its state
   while the theme itself is switched off. */
.festive-state {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .72rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.festive-state::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.festive-state.is-on { color: #4ade80; }
.festive-state.is-off { color: #9ca3af; }

/* Respect the viewer's motion preference: no falling snow at all. */
@media (prefers-reduced-motion: reduce) {
    html.kw-festive .kw-festive-snow { display: none; }
}
