/* ==========================================================================
   Header + menu trượt mùa Noel (1/12–26/12, utils/season.js → res.locals.season).
   views/partials/header.ejs chỉ nạp file này trong mùa và gắn class .hdr-noel lên #header.
   Ảnh: public/images/home/noel/ — hdr-garland.webp, hdr-kit.webp, drawer.webp, stickers.webp (Gemini, cắt bằng
   scripts/genNoelArt.js); snowcap.svg vẽ tay (tuyết phủ pill).
   Chuyển động chỉ transform/opacity bằng CSS, không JS (giữ INP); tắt khi giảm chuyển động.
   Menu trượt mở ở ≤1280px (cùng mốc với CSS header).
   ========================================================================== */

/* ---------------------------- Sprite sticker 4x4 ---------------------------- */
.nst {
    display: inline-block;
    flex: 0 0 auto;
    width: var(--sz, 48px);
    height: var(--sz, 48px);
    background: url(/images/home/noel/stickers.webp) 0 0 / 400% 400% no-repeat;
}

.nst--bauble-pink  { background-position: 0 0; }
.nst--bauble-peach { background-position: 33.333% 0; }
.nst--bauble-lav   { background-position: 66.667% 0; }
.nst--star         { background-position: 100% 0; }
.nst--bells        { background-position: 0 33.333%; }
.nst--candy        { background-position: 66.667% 33.333%; }
.nst--gingerbread  { background-position: 100% 33.333%; }
.nst--cocoa        { background-position: 0 66.667%; }
.nst--stocking     { background-position: 33.333% 66.667%; }
.nst--snowman      { background-position: 66.667% 66.667%; }
.nst--gift-cat     { background-position: 100% 66.667%; }
.nst--sled         { background-position: 33.333% 100%; }
.nst--holly        { background-position: 66.667% 100%; }
.nst--cat-santa    { background-position: 100% 100%; }

/* Bộ 4 sticker riêng của header: mũ Noel, gạc tuần lộc, bông tuyết, cây thông (lưới 2x2). */
.hdr-hat,
.hdr-antlers {
    position: absolute;
    pointer-events: none;
    background: url(/images/home/noel/hdr-kit.webp) 0 0 / 200% 200% no-repeat;
}

/* ------------------------- Mũ Noel trên tai mèo của logo -------------------- */
#header.hdr-noel > a:first-child {
    position: relative;
}

.hdr-hat {
    left: 74%;
    top: -34%;
    width: 31%;
    aspect-ratio: 1;
    transform: rotate(8deg);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 2px 2px rgba(107, 79, 71, 0.18));
}

#header.hdr-noel > a:first-child:hover .hdr-hat {
    transform: rotate(-4deg) translateY(-3px);
}

/* ------------------- Dây thông treo quả châu dưới mép header ------------------- */
/* Ảnh Gemini hdr-garland.webp (dây thông thẳng có đèn + quả châu, sao, chuông, kẹo gậy treo bên dưới),
   tile ghép đối xứng nên lặp ngang liền. Cao 30px, mép trên chồng 7px lên đáy header như treo từ header xuống. */
#header.hdr-noel::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% - 7px);
    height: 30px;
    pointer-events: none;
    background: url(/images/home/noel/hdr-garland.webp) 0 0 / auto 30px repeat-x;
}

/* Dải dây thông kéo dài ~23px dưới đáy header → đẩy nội dung mọi trang xuống thêm 24px (layout.css: 90px) cho
   vật treo khỏi đè breadcrumb / tiêu đề (chủ dự án 1/12/2026: "để header cách xa ra xíu"). Trang tự đặt padding
   cho <main> (vd trang chủ: 0) nạp CSS SAU file này nên vẫn giữ cách của nó. */
main {
    padding-top: 114px;
}

/* ------------------- Nút + chip giá Noel cho mọi trang (trong mùa) ------------------- */
/* Ảnh Gemini: btn-snow.webp (dải tuyết lặp ngang) + btn-kit.webp (sprite 2x2: nhựa ruồi, nơ chuông, thẻ giá, nhựa ruồi).
   Nút pill chung .btn / .cute-button (layout.css, đã position: relative): tuyết phủ mép trên (bỏ ở nút ghost nền trắng
   vì tuyết trắng không thấy) + nhánh nhựa ruồi nghiêng ở góc trái. Không nút nào khác dùng ::before/::after của .btn. */
.btn:not(.ghost)::before,
.cute-button::before {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    top: -6px;
    height: 16px;
    border-radius: 10px 10px 4px 4px;
    background: url(/images/home/noel/btn-snow.webp) 0 0 / auto 100% repeat-x;
    pointer-events: none;
}

.btn::after,
.cute-button::after {
    content: "";
    position: absolute;
    left: -8px;
    top: -12px;
    width: 32px;
    height: 32px;
    transform: rotate(-14deg);
    background: url(/images/home/noel/btn-kit.webp) 0 0 / 200% 200% no-repeat;
    pointer-events: none;
}

.btn.btn-mini::before,
.btn.btn-sm::before,
.btn.sm::before,
.btn.mini::before {
    left: 10px;
    right: 10px;
    top: -4px;
    height: 11px;
}

.btn.btn-mini::after,
.btn.btn-sm::after,
.btn.sm::after,
.btn.mini::after {
    left: -6px;
    top: -8px;
    width: 20px;
    height: 20px;
}

/* ---------- Nút CAM (coral, chữ trắng) → skin Noel "thanh bánh quy phủ kem tuyết" (Gemini btn-skin-*) ----------
   Gồm: nút .btn của các trang kết quả bói (.xx-wrap — định nghĩa trong <style> inline của từng view), nút tử vi,
   nút Bói Kiều / trang Tarot-Lenormand (.tw-btn) / bảng mở khoá (.mp-btn) / hộp góp ý (.mf-send), pill Tarot trên header.
   3 lớp nền: đầu trái + đầu phải (cao 100%, giữ tỉ lệ, nằm cả trong viền) đè lên khúc giữa lặp ngang (chỉ trong
   padding-box). Viền trong suốt 1.45em mỗi bên = chỗ hai đầu bo tròn, nên khúc giữa không lòi góc vuông ra ngoài.
   Tiền tố body / :is() để thắng <style> inline đặt sau file này. Bóng theo hình nút bằng drop-shadow (border-radius 0
   để nhánh nhựa ruồi ở góc trái không bị bo cắt). */
body :is(.nr-wrap, .tr-wrap, .pc-wrap, .as-wrap, .fr-wrap, .pl-wrap, .bt-wrap, .kd-wrap, .dr-wrap) .btn:not(.ghost),
body .tu-vi-wrapper .btn:not(.ghost):not(.lavender):not(.gold),
body :is(.bq-btn:not(.ghost), .tw-btn, .mp-btn, .mf-send),
#header.hdr-noel .dropbtn.tarot-btn {
    border-style: solid;
    border-color: transparent;
    border-width: 0 1.45em;
    padding-left: 0.35em;
    padding-right: 0.35em;
    border-radius: 0;
    background:
        url(/images/home/noel/btn-skin-l.webp) 0 50% / auto 100% no-repeat border-box,
        url(/images/home/noel/btn-skin-r.webp) 100% 50% / auto 100% no-repeat border-box,
        url(/images/home/noel/btn-skin-m.webp) 0 0 / auto 100% repeat-x padding-box;
    box-shadow: none;
    filter: drop-shadow(0 6px 8px rgba(214, 125, 99, 0.3));
    /* Lớp kem chiếm ~1/3 trên của nút → chữ dời xuống thân coral (đệm trên dày hơn đệm dưới). */
    padding-top: 1.1em;
    padding-bottom: 0.7em;
    /* Chữ trắng đậm viền nâu kiểu chữ dán trên bánh quy: đọc rõ cả trên kem trắng lẫn nền coral. */
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.01em;
    text-shadow:
        1.5px 0 0 #9c4a34, -1.5px 0 0 #9c4a34, 0 1.5px 0 #9c4a34, 0 -1.5px 0 #9c4a34,
        1px 1px 0 #9c4a34, -1px 1px 0 #9c4a34, 1px -1px 0 #9c4a34, -1px -1px 0 #9c4a34,
        0 3px 2px rgba(120, 50, 30, 0.35);
}

body :is(.nr-wrap, .tr-wrap, .pc-wrap, .as-wrap, .fr-wrap, .pl-wrap, .bt-wrap, .kd-wrap, .dr-wrap) .btn:not(.ghost) svg,
body .tu-vi-wrapper .btn:not(.ghost):not(.lavender):not(.gold) svg,
body :is(.bq-btn:not(.ghost), .tw-btn, .mp-btn, .mf-send) svg {
    color: #fff;
    filter: drop-shadow(1px 0 0 #9c4a34) drop-shadow(-1px 0 0 #9c4a34) drop-shadow(0 1px 0 #9c4a34) drop-shadow(0 -1px 0 #9c4a34);
}

/* layout.css gán màu cho MỌI thẻ (* { color }) → chữ trong <span>/<b> của nút không ăn màu nút; cho kế thừa lại. */
body :is(.nr-wrap, .tr-wrap, .pc-wrap, .as-wrap, .fr-wrap, .pl-wrap, .bt-wrap, .kd-wrap, .dr-wrap) .btn:not(.ghost) :is(span, b, strong, em, small),
body .tu-vi-wrapper .btn:not(.ghost):not(.lavender):not(.gold) :is(span, b, strong, em, small),
body :is(.bq-btn:not(.ghost), .tw-btn, .mp-btn, .mf-send) :is(span, b, strong, em, small) {
    color: inherit;
    font-weight: inherit;
}

/* Nút nhỏ (ô "Mở khoá" từng cung tử vi…): đệm gọn hơn. */
body .tu-vi-wrapper .btn.btn-mini:not(.ghost) {
    padding-top: 0.95em;
    padding-bottom: 0.5em;
}

body :is(.nr-wrap, .tr-wrap, .pc-wrap, .as-wrap, .fr-wrap, .pl-wrap, .bt-wrap, .kd-wrap, .dr-wrap) .btn:not(.ghost):hover:not(:disabled),
body .tu-vi-wrapper .btn:not(.ghost):not(.lavender):not(.gold):hover:not(:disabled),
body :is(.bq-btn:not(.ghost), .tw-btn, .mp-btn, .mf-send):hover:not(:disabled) {
    box-shadow: none;
    filter: drop-shadow(0 9px 11px rgba(214, 125, 99, 0.4)) saturate(1.06);
}

/* Skin đã có kem tuyết + nhựa ruồi → bỏ lớp tuyết / nhựa ruồi chung của .btn và của pill header. */
body :is(.nr-wrap, .tr-wrap, .pc-wrap, .as-wrap, .fr-wrap, .pl-wrap, .bt-wrap, .kd-wrap, .dr-wrap) .btn:not(.ghost)::before,
body :is(.nr-wrap, .tr-wrap, .pc-wrap, .as-wrap, .fr-wrap, .pl-wrap, .bt-wrap, .kd-wrap, .dr-wrap) .btn:not(.ghost)::after,
body .tu-vi-wrapper .btn:not(.ghost):not(.lavender):not(.gold)::before,
body .tu-vi-wrapper .btn:not(.ghost):not(.lavender):not(.gold)::after,
#header.hdr-noel .dropbtn.tarot-btn::before {
    content: none;
}

/* Pill Tarot trên header: chừa hẹp hơn kẻo menu laptop tràn dòng. */
#header.hdr-noel .dropbtn.tarot-btn {
    border-width: 0 1.2em;
    padding: 0.75em 0.2em 0.45em;
    color: #fff !important;
}

#header.hdr-noel .dropbtn.tarot-btn .nav-tag {
    text-shadow: none;
}

/* Chip "Giá đã giảm cho bạn" (partials/priceBreakdown): tuyết phủ + thẻ giá / ngôi sao thay emoji 🏷️ ⭐. */
.pbk-chip {
    position: relative;
}

.pbk-chip::before {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    top: -5px;
    height: 10px;
    border-radius: 8px 8px 3px 3px;
    background: url(/images/home/noel/btn-snow.webp) 0 0 / auto 100% repeat-x;
    pointer-events: none;
}

.pbk-ic {
    display: inline-block;
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin: -3px 1px -3px -3px;
}

.pbk-ic--tag {
    background: url(/images/home/noel/btn-kit.webp) 0 100% / 200% 200% no-repeat;
}

.pbk-ic--star {
    background: url(/images/home/noel/stickers.webp) 100% 0 / 400% 400% no-repeat;
}

/* ----------------------- Tuyết phủ trên các nút pill ------------------------ */
#header.hdr-noel .dropbtn.seduyen-btn::before,
#header.hdr-noel .dropbtn.account-btn::before {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    top: -4px;
    height: 11px;
    border-radius: 8px 8px 3px 3px;
    background: url(/images/home/noel/snowcap.svg) 0 0 / auto 100% repeat-x;
    filter: drop-shadow(0 1px 0 rgba(170, 150, 200, 0.55));
    pointer-events: none;
}

/* ------------------------------ Menu desktop -------------------------------- */
/* Chấm màu đầu mỗi nhóm Tâm linh → quả châu / ngôi sao / nhựa ruồi cùng tông. */
#header.hdr-noel .mega-title::before {
    width: 18px;
    height: 18px;
    border-radius: 0;
    background: url(/images/home/noel/stickers.webp) 0 0 / 400% 400% no-repeat;
}

#header.hdr-noel .mega-col:nth-child(2) .mega-title::before { background-position: 100% 0; }
#header.hdr-noel .mega-col:nth-child(3) .mega-title::before { background-position: 66.667% 100%; }
#header.hdr-noel .mega-col:nth-child(4) .mega-title::before { background-position: 66.667% 0; }

.hdr-noel-ic,
.hdr-drawer-art,
.hdr-drawer-stand {
    display: none;
}

@media (min-width: 1281px) {
    /* Cây thông nhỏ ở góc trống dưới cột "Bói bài" (cột ngắn nhất của mega menu). */
    #header.hdr-noel .dropdown-content.mega::after {
        content: "";
        position: absolute;
        left: 26px;
        bottom: 16px;
        width: 70px;
        height: 70px;
        background: url(/images/home/noel/hdr-kit.webp) 100% 100% / 200% 200% no-repeat;
        pointer-events: none;
    }
}

/* ------------------------------ Menu trượt ---------------------------------- */
@media (max-width: 1280px) {
    /* Gạc tuần lộc trên nút mở menu: chỉ lộ phần gạc + nửa trên vòng băng đô. */
    #header.hdr-noel .mobile-menu-button {
        position: relative;
        overflow: visible;
    }

    .hdr-antlers {
        left: 50%;
        top: -10px;
        width: 46px;
        height: 25px;
        transform: translateX(-50%);
        background-size: 92px 92px;
        background-position: -46px 0;
    }

    /* Tranh Noel tràn hết bề ngang đầu menu, nút đóng nổi lên góc phải tranh. */
    .hdr-drawer-art {
        display: block;
        position: relative;
        flex: 0 0 auto;
        align-self: stretch;
        margin: -26px -22px 2px;
        overflow: hidden;
    }

    .hdr-drawer-art img {
        display: block;
        width: 100%;
        height: auto;
        -webkit-mask-image: linear-gradient(180deg, #000 78%, transparent 100%);
        mask-image: linear-gradient(180deg, #000 78%, transparent 100%);
    }

    .hdr-drawer-snow {
        position: absolute;
        top: 0; right: 0; bottom: 0; left: 0;
        pointer-events: none;
    }

    .hdr-drawer-snow i {
        position: absolute;
        top: -8px;
        left: var(--x);
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 0 0 1px rgba(227, 212, 240, 0.6);
        animation: hdr-fall var(--d) linear var(--w) infinite;
    }

    @keyframes hdr-fall {
        to { transform: translate3d(-14px, 220px, 0); }
    }

    #header.hdr-noel #close-menu {
        position: absolute;
        top: 12px;
        right: 12px;
        z-index: 3;
        margin: 0;
        background-color: rgba(255, 255, 255, 0.88);
        box-shadow: 0 4px 12px rgba(214, 125, 99, 0.18);
    }

    /* Sticker cạnh tên nhóm (Photobooth / Tâm linh / Khám phá). */
    .hdr-noel-ic {
        display: inline-block;
        --sz: 30px;
        margin: -6px 0;
    }

    /* Pill Se Duyên rộng cả hàng: tuyết phủ thụt vào xa hơn cho khớp bo tròn (pill Tarot đã có skin kem tuyết). */
    #header.hdr-noel .dropbtn.seduyen-btn::before {
        left: 22px;
        right: 22px;
    }

    /* Nút Tài khoản trong menu là tiêu đề nhóm — bỏ tuyết. */
    #header.hdr-noel .dropbtn.account-btn::before {
        display: none;
    }

    /* Bãi tuyết cuối menu: người tuyết, mèo hộp quà, Mèo Béo mũ Noel, ca cacao, xe trượt. */
    .hdr-drawer-stand {
        display: flex;
        position: relative;
        flex: 0 0 auto;
        align-self: stretch;
        justify-content: center;
        align-items: flex-end;
        height: 112px;
        margin: 8px -22px calc(-26px - env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        overflow: hidden;
    }

    .hdr-drawer-stand::before {
        content: "";
        position: absolute;
        left: -30%;
        right: -30%;
        bottom: -64px;
        height: 112px;
        border-radius: 50% 50% 0 0;
        background: linear-gradient(180deg, #fffdfb, #fbf4fb);
        box-shadow: 0 -5px 14px rgba(227, 212, 240, 0.5);
    }

    .hdr-drawer-stand .nst {
        position: relative;
        --sz: 50px;
        margin: 0 -2px 12px;
    }

    .hdr-drawer-stand .nst--cat-santa {
        --sz: 64px;
        margin-bottom: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hdr-drawer-snow i {
        animation: none;
    }
}
