/* ==========================================================
   🎃 Halloween seasonal decoration (ชั่วคราว – inc/seasonal-halloween.php)
   ตกแต่งอย่างเดียว ไม่ยุ่งกับเลย์เอาต์ / ไม่รับคลิก
   ========================================================== */
:root {
    --hw-night: #1a1030;
    --hw-plum: #2b1747;
    --hw-pumpkin: #ff7a1a;
    --hw-glow: rgba(255, 122, 26, .45);
}

/* ---------- แถบประกาศ ---------- */
.hw-ribbon {
    position: relative;
    z-index: 101;
    color: #fff;
    background:
        radial-gradient(600px 80px at 15% 50%, rgba(255, 122, 26, .28), transparent 70%),
        linear-gradient(90deg, var(--hw-night), var(--hw-plum) 55%, var(--hw-night));
    overflow: hidden;
    transition: opacity .3s, max-height .3s;
    max-height: 120px;
}

.hw-ribbon.is-leaving {
    opacity: 0;
    max-height: 0;
}

.hw-ribbon-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 9px 48px 9px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 13px;
    line-height: 1.4;
}

.hw-pumpkin {
    font-size: 18px;
    filter: drop-shadow(0 0 8px var(--hw-glow));
    animation: hw-flicker 3.2s ease-in-out infinite;
}

.hw-ribbon-text {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    align-items: baseline;
}

.hw-ribbon-text strong {
    font-weight: 600;
    letter-spacing: .04em;
    color: #ffd2a8;
}

.hw-ribbon-text span {
    color: rgba(255, 255, 255, .78);
}

.hw-ribbon-cta {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 210, 168, .45);
    color: #ffd2a8 !important;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background .25s, color .25s;
}

.hw-ribbon-cta:hover {
    background: var(--hw-pumpkin);
    border-color: var(--hw-pumpkin);
    color: #fff !important;
}

.hw-ribbon-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, .7);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.hw-ribbon-close:hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.hw-ribbon a:focus-visible,
.hw-ribbon button:focus-visible {
    outline: 2px solid #ffd2a8;
    outline-offset: 2px;
}

@media (max-width: 640px) {
    .hw-ribbon-inner {
        justify-content: flex-start;
        font-size: 12px;
    }

    .hw-ribbon-text span {
        display: none;
    }
}

/* ---------- ค้างคาว ---------- */
.hw-bats {
    position: fixed;
    inset: 0;
    z-index: 95;
    pointer-events: none;
    overflow: hidden;
}

.hw-bat {
    position: absolute;
    left: -80px;
    width: 44px;
    color: #1c1230;
    opacity: 0;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .25));
    animation: hw-fly 18s linear infinite;
}

.hw-bat svg {
    display: block;
    width: 100%;
    height: auto;
    transform-origin: 50% 40%;
    animation: hw-flap .28s ease-in-out infinite alternate;
}

.hw-bat--1 { top: 18%; animation-delay: 0s; }
.hw-bat--2 { top: 32%; width: 30px; animation-delay: 4s; animation-duration: 22s; }
.hw-bat--3 { top: 12%; width: 36px; animation-delay: 9s; animation-duration: 20s; }
.hw-bat--4 { top: 46%; width: 26px; animation-delay: 13s; animation-duration: 24s; }
.hw-bat--5 { top: 24%; width: 52px; animation-delay: 17s; animation-duration: 26s; }

@keyframes hw-fly {
    0% { transform: translate(0, 0); opacity: 0; }
    5% { opacity: .85; }
    25% { transform: translate(28vw, -30px); }
    50% { transform: translate(55vw, 25px); }
    75% { transform: translate(82vw, -20px); }
    95% { opacity: .85; }
    100% { transform: translate(calc(100vw + 120px), 10px); opacity: 0; }
}

@keyframes hw-flap {
    from { transform: scaleY(1); }
    to { transform: scaleY(.7); }
}

@media (max-width: 767px) {
    .hw-bat--3,
    .hw-bat--4,
    .hw-bat--5 {
        display: none;
    }
}

/* ---------- แมงมุมห้อยมุมขวา (จอใหญ่) ---------- */
.hw-spider {
    position: fixed;
    top: 0;
    right: 7%;
    z-index: 96;
    display: none;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    color: #1c1230;
    animation: hw-dangle 6s ease-in-out infinite;
    transform-origin: top center;
}

.hw-thread {
    width: 1px;
    height: 120px;
    background: linear-gradient(rgba(28, 18, 48, 0), rgba(28, 18, 48, .45));
}

.hw-spider-body {
    width: 30px;
    height: 30px;
    margin-top: -2px;
}

@keyframes hw-dangle {
    0%, 100% { transform: translateY(-20px) rotate(-2deg); }
    50% { transform: translateY(18px) rotate(2deg); }
}

@media (min-width: 1024px) {
    .hw-spider {
        display: flex;
    }
}

/* ---------- แตะสีในส่วนต่างๆ ---------- */
@keyframes hw-flicker {
    0%, 100% { opacity: 1; }
    45% { opacity: .85; }
    50% { opacity: 1; }
    52% { opacity: .7; }
    55% { opacity: 1; }
}

/* การ์ดติดต่อใน footer: ใยแมงมุมจางๆ มุมขวาบน */
.is-halloween .ft-card--dark::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    z-index: -1;
    opacity: .18;
    pointer-events: none;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='white' stroke-width='.8'><path d='M100 0L20 80M100 0L50 100M100 0L0 50M100 0L0 15M100 0L85 100'/><path d='M84 0Q86 14 100 16M66 0Q70 30 100 34M46 0Q54 46 100 54M26 0Q36 64 100 74'/></svg>") no-repeat top right / contain;
}

/* ตัวอักษรใหญ่ท้าย footer: เรืองส้มอ่อนๆ */
.is-halloween .ft-watermark {
    background: linear-gradient(to bottom, #f6c7a3 0%, rgba(246, 199, 163, .25) 70%, rgba(246, 199, 163, 0) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

/* ป้าย Hot บนการ์ดเรือ -> ฟักทอง */
.is-halloween .yacht-card-item .text-amber-500 {
    color: var(--hw-pumpkin) !important;
}

/* ---------- ลดการเคลื่อนไหว ---------- */
@media (prefers-reduced-motion: reduce) {
    .hw-bats,
    .hw-spider {
        display: none !important;
    }

    .hw-pumpkin {
        animation: none;
    }
}

@media print {
    .hw-ribbon,
    .hw-bats,
    .hw-spider {
        display: none !important;
    }
}

/* ==========================================================
   v2 – Halloween เต็มขึ้น
   ========================================================== */

/* นับถอยหลังในแถบประกาศ */
.hw-countdown {
    flex-shrink: 0;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 122, 26, .18);
    color: #ffb27a;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* header: ขอบล่างเรืองม่วง-ส้ม */
.is-halloween #main-header {
    border-bottom-color: transparent !important;
}

.is-halloween #main-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #7b3fe4 20%, var(--hw-pumpkin) 50%, #7b3fe4 80%, transparent);
    opacity: .7;
    pointer-events: none;
}

/* ---------- ธงประดับใต้ header ---------- */
.hw-garland {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 44px;
    z-index: 80;
    pointer-events: none;
}

.hw-garland-string {
    position: absolute;
    inset: 0 0 auto 0;
    width: 100%;
    height: 30px;
}

.hw-flag {
    position: absolute;
    width: 22px;
    margin-left: -11px;
    transform-origin: 50% 0;
    animation: hw-swing 3.4s ease-in-out infinite;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .18));
}

.hw-flag svg {
    display: block;
    width: 100%;
    height: auto;
}

.hw-flag--b {
    width: 26px;
    margin-left: -13px;
}

.hw-flag--g svg {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, .6));
}

@keyframes hw-swing {
    0%, 100% { transform: rotate(-6deg); }
    50% { transform: rotate(6deg); }
}

@media (max-width: 767px) {
    .hw-flag:nth-child(odd) {
        display: none;
    }

    .hw-flag {
        width: 18px;
        margin-left: -9px;
    }
}

/* เมื่อเลื่อนลง header ซ่อน -> ธงซ่อนตาม (อยู่ใน header อยู่แล้ว) */

/* ---------- Hero หน้าแรก ---------- */
.hw-hero-fx {
    position: absolute;
    inset: 0;
    z-index: 15; /* เหนือวิดีโอ+ฟิล์มมืด (z-10) ใต้ข้อความ (z-20) */
    pointer-events: none;
    overflow: hidden;
}

.hw-tint {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(120% 80% at 50% 0%, rgba(43, 23, 71, .0), rgba(43, 23, 71, .45) 70%),
        linear-gradient(to bottom, rgba(26, 16, 48, .35), rgba(26, 16, 48, .1) 45%, rgba(26, 16, 48, .55));
    mix-blend-mode: multiply;
}

.hw-moon {
    position: absolute;
    top: 9%;
    right: 9%;
    width: clamp(70px, 9vw, 130px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 35%, #fff7e0 0%, #ffe3a3 45%, #f3b860 100%);
    box-shadow: 0 0 40px 10px rgba(255, 214, 140, .45), 0 0 120px 40px rgba(255, 170, 80, .25);
    opacity: .92;
}

.hw-moon::after {
    /* หลุมบนดวงจันทร์ */
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle at 62% 60%, rgba(200, 140, 60, .35) 0 9%, transparent 10%),
        radial-gradient(circle at 35% 68%, rgba(200, 140, 60, .25) 0 6%, transparent 7%),
        radial-gradient(circle at 55% 30%, rgba(200, 140, 60, .2) 0 5%, transparent 6%);
}

.hw-fog {
    position: absolute;
    left: -50%;
    bottom: -10%;
    width: 200%;
    height: 45%;
    background:
        radial-gradient(40% 60% at 20% 60%, rgba(255, 255, 255, .28), transparent 70%),
        radial-gradient(35% 55% at 55% 70%, rgba(220, 210, 255, .24), transparent 70%),
        radial-gradient(30% 50% at 85% 60%, rgba(255, 255, 255, .22), transparent 70%);
    filter: blur(8px);
    animation: hw-fog 38s linear infinite;
}

.hw-fog--2 {
    bottom: -18%;
    opacity: .7;
    animation-duration: 55s;
    animation-direction: reverse;
}

@keyframes hw-fog {
    from { transform: translateX(0); }
    to { transform: translateX(25%); }
}

.hw-lanterns {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 6px;
    display: flex;
    justify-content: space-between;
    padding: 0 4%;
    align-items: flex-end;
}

.hw-lantern {
    width: 54px;
    height: auto;
    filter: drop-shadow(0 0 14px rgba(255, 140, 40, .55));
}

.hw-lantern--2 {
    width: 40px;
    margin-left: auto;
    margin-right: 6px;
}

.hw-lantern--3 {
    width: 64px;
}

.hw-lantern--sm {
    width: 38px;
}

.hw-face {
    animation: hw-candle 2.6s ease-in-out infinite;
}

@keyframes hw-candle {
    0%, 100% { fill: #ffd36b; }
    40% { fill: #ffb43b; }
    45% { fill: #fff1b0; }
    60% { fill: #ffc65a; }
}

@media (max-width: 767px) {
    .hw-lantern { width: 40px; }
    .hw-lantern--3 { width: 46px; }
    .hw-lantern--2 { display: none; }
}

/* ---------- ฟักทองบนตัวอักษรท้าย footer ---------- */
.hw-ft-pumpkins {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: -30px;
    pointer-events: none;
}

.hw-ft-pumpkins .hw-lantern {
    width: 48px;
}

.hw-ft-pumpkins .hw-lantern--sm {
    width: 34px;
}

/* การ์ดติดต่อใน footer -> ท้องฟ้ายามค่ำ */
.is-halloween .ft-card--dark {
    background:
        radial-gradient(70px 70px at 88% 22%, rgba(255, 233, 180, .95) 0 45%, rgba(255, 200, 120, .25) 60%, transparent 72%),
        linear-gradient(150deg, #241040, #13355a 70%);
}

/* ปุ่มสีส้มเรืองแสงฟักทองเบาๆ */
.is-halloween .bg-brand-orange,
.is-halloween [class*="bg-[var(--color-brand-orange)]"],
.is-halloween .ft-pill--light {
    animation: hw-glow 2.8s ease-in-out infinite;
}

@keyframes hw-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 122, 26, 0); }
    50% { box-shadow: 0 0 18px 2px rgba(255, 122, 26, .45); }
}

/* ป้าย Hot บนการ์ดเรือ: ดาว -> ฟักทอง */
.is-halloween .yacht-card-item svg.text-amber-500 {
    display: none;
}

.is-halloween .yacht-card-item span:has(> svg.text-amber-500)::before {
    content: "🎃";
    font-size: 12px;
    line-height: 1;
}

/* ---------- ผีลอย ---------- */
.hw-ghost {
    position: fixed;
    left: 4%;
    bottom: -90px;
    z-index: 94;
    width: 46px;
    opacity: 0;
    pointer-events: none;
    filter: drop-shadow(0 6px 14px rgba(26, 16, 48, .25));
    animation: hw-ghost 26s ease-in-out infinite;
    animation-delay: 6s;
}

.hw-ghost svg {
    display: block;
    width: 100%;
    height: auto;
}

@keyframes hw-ghost {
    0% { transform: translate(0, 0) rotate(-6deg); opacity: 0; }
    8% { opacity: .75; }
    30% { transform: translate(40px, -35vh) rotate(6deg); }
    55% { transform: translate(-10px, -65vh) rotate(-5deg); opacity: .6; }
    70% { transform: translate(30px, -85vh) rotate(4deg); opacity: 0; }
    100% { transform: translate(30px, -85vh); opacity: 0; }
}

/* ---------- ค้างคาวกระจายเมื่อกดปุ่มจอง ---------- */
.hw-burst {
    position: fixed;
    z-index: 2000;
    font-size: 18px;
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: hw-burst .9s ease-out forwards;
}

@keyframes hw-burst {
    to {
        transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.6) rotate(20deg);
        opacity: 0;
    }
}

/* ลดการเคลื่อนไหว / พิมพ์ */
@media (prefers-reduced-motion: reduce) {
    .hw-flag,
    .hw-fog,
    .hw-face,
    .hw-ghost,
    .is-halloween .bg-brand-orange,
    .is-halloween [class*="bg-[var(--color-brand-orange)]"],
    .is-halloween .ft-pill--light {
        animation: none !important;
    }
}

@media print {
    .hw-garland,
    .hw-hero-fx,
    .hw-ft-pumpkins,
    .hw-ghost {
        display: none !important;
    }
}

/* มือถือ: แถบประกาศบรรทัดเดียว */
.hw-ribbon-text strong {
    white-space: nowrap;
}

@media (max-width: 420px) {
    .hw-countdown {
        display: none;
    }
}
