/*
 * Twelve × Mofu partnership theme (design: Metronic Theme/Twelve New desgin/موفو,
 * "dual" style).
 *
 * Applies only when body[data-festive="mofu"] is set from SiteTheme::isMofu()
 * (site-wide switch). Twelve's pink stays the brand color — Mofu purple comes in
 * as the second brand stop, the tinted surfaces and the ambience — so the legacy
 * pink overrides National Day needs are not repeated here.
 */

@keyframes mfGlow {
    0%, 100% { opacity: 0.35; transform: scale(1); }
    50% { opacity: 0.65; transform: scale(1.1); }
}

@keyframes mfSpark {
    0%, 100% { transform: scale(0) rotate(0); opacity: 0; }
    45% { transform: scale(1) rotate(20deg); opacity: 1; }
    60% { transform: scale(0.8) rotate(30deg); opacity: 0.8; }
}

@keyframes mfDrift {
    0% { transform: translate(0, 0) rotate(-6deg); }
    50% { transform: translate(12px, -16px) rotate(5deg); }
    100% { transform: translate(0, 0) rotate(-6deg); }
}

/* ── Tokens ─────────────────────────────────────────────────────────── */

body[data-festive="mofu"] {
    --tw-brand-2: #9a5ce8;
    --tw-brand-soft: #fbe4f0;
    --tw-bg: #f5f2fa;
    --tw-surface2: #f9f7fd;
    --tw-line: #e6e0f0;
    --tw-chip: #f0ebf8;
    --tw-foot: #ede8f5;
    --tw-ink: #1b1526;
    --tw-ink2: #786f8e;
    --tw-foot-ink: #786f8e;
    --tw-foot-strong: #1b1526;
    --tw-foot-line: rgba(63, 35, 114, 0.14);
    --tw-foot-chip: rgba(63, 35, 114, 0.06);
    --tw-shadow: 0 2px 10px rgba(63, 35, 114, 0.07);

    /* Mofu's own colors, for the partner chips and the ambience. */
    --mf: #7c3fe0;
    --mf-2: #c77dff;
    --mf-rgb: 124, 63, 224;
    --mf-deep: #3f2372;
    --mf-glow-1: 0.07;
    --mf-glow-2: 0.09;
    /* Clouds read fainter on the light background, so they are drawn stronger. */
    --mf-bg-mult: 2.4;
}

body.darkMode[data-festive="mofu"],
html.darkMode body:not(.lightMode)[data-festive="mofu"] {
    --tw-brand-2: #a66cf5;
    --tw-brand-soft: #36182f;
    --tw-bg: #0e0a16;
    --tw-surface: #171024;
    --tw-surface2: #1e1630;
    --tw-line: #2c2340;
    --tw-chip: #251c38;
    --tw-head: #130d1f;
    --tw-foot: #0a0712;
    --tw-ink: #f5f2fa;
    --tw-ink2: #a89fbe;
    --tw-foot-ink: #9a91b0;
    --tw-foot-strong: #ffffff;
    --tw-foot-line: rgba(255, 255, 255, 0.08);
    --tw-foot-chip: rgba(255, 255, 255, 0.06);
    --tw-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);

    --mf: #9a5ce8;
    --mf-rgb: 154, 92, 232;
    --mf-glow-1: 0.18;
    --mf-glow-2: 0.24;
    --mf-bg-mult: 1;
}

/* ── Partner chip (header + footer) ─────────────────────────────────── */

.tw-brand-partner {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
}

.tw-brand-partner__x {
    font-size: 13px;
    font-weight: 800;
    color: var(--tw-ink2);
}

.tw-brand-partner__chip,
.tw-foot__partner-chip {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, var(--mf-deep), var(--mf));
    transition: transform 0.2s, box-shadow 0.2s;
}

.tw-brand-partner__chip {
    height: 38px;
    padding: 0 13px;
    border-radius: 11px;
    box-shadow: 0 4px 12px rgba(var(--mf-rgb), 0.3);
}

.tw-brand-partner__chip:hover,
.tw-foot__partner-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(var(--mf-rgb), 0.4);
}

.tw-brand-partner__chip img {
    display: block;
    height: 22px;
    width: auto;
}

.tw-foot__partner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tw-foot__partner-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--tw-foot-ink);
}

.tw-foot__partner-chip {
    height: 30px;
    padding: 0 10px;
    border-radius: 9px;
}

.tw-foot__partner-chip img {
    display: block;
    height: 15px;
    width: auto;
}

@media (max-width: 991.98px) {
    .tw-brand-partner__chip {
        height: 34px;
        padding: 0 10px;
        border-radius: 10px;
    }

    .tw-brand-partner__chip img {
        height: 18px;
    }
}

/* The design drops the "Twelve" word on phones to make room for the partner chip. */
@media (max-width: 575.98px) {
    body[data-festive="mofu"] .tw-brand__name {
        display: none;
    }

    .tw-brand-partner {
        gap: 6px;
    }

    .tw-brand-partner__x {
        font-size: 12px;
    }
}

/* ── Announcement bar skin ──────────────────────────────────────────── */

body[data-festive="mofu"] .tw-announce {
    background: linear-gradient(90deg, #3f2372, #6d3fe0 44%, #a83d8e 76%, #f5395f);
}

[dir="ltr"] body[data-festive="mofu"] .tw-announce {
    background: linear-gradient(270deg, #3f2372, #6d3fe0 44%, #a83d8e 76%, #f5395f);
}

/* The badge's little flag becomes the Mofu logo. */
body[data-festive="mofu"] .tw-announce__flag {
    width: 40px;
    height: 13px;
    border-radius: 0;
    background: url('../images/themes/mofu/mofu-logo-white.png') center / contain no-repeat;
}

body[data-festive="mofu"] .tw-announce__flag::after {
    content: none;
}

/* ── Homepage ambience (web/home/_mofu-overlay.blade.php) ───────────── */

.mf-home-clouds {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.mf-home-clouds__cloud {
    position: absolute;
    background: var(--mf);
    opacity: calc(var(--mf-op, 0.08) * var(--mf-bg-mult, 1));
    -webkit-mask: url('../images/themes/mofu/mofu-cloud.png') center / contain no-repeat;
    mask: url('../images/themes/mofu/mofu-cloud.png') center / contain no-repeat;
    animation: mfDrift var(--mf-dur, 20s) ease-in-out var(--mf-delay, 0s) infinite;
}

.mf-home-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    pointer-events: none;
    overflow: hidden;
}

.mf-home-overlay__glow {
    position: absolute;
    border-radius: 50%;
}

.mf-home-overlay__glow--tr {
    top: -180px;
    right: -160px;
    width: 560px;
    height: 560px;
    background: radial-gradient(circle, rgba(var(--tw-brand-rgb), var(--mf-glow-1)), transparent 68%);
    animation: mfGlow 8s ease-in-out infinite;
}

.mf-home-overlay__glow--bl {
    bottom: -220px;
    left: -160px;
    width: 620px;
    height: 620px;
    background: radial-gradient(circle, rgba(var(--mf-rgb), var(--mf-glow-2)), transparent 68%);
    animation: mfGlow 10s ease-in-out 2s infinite;
}

.mf-home-overlay__spark {
    position: absolute;
    opacity: 0.6;
    animation: mfSpark 4s ease-in-out var(--mf-delay, 0s) infinite;
}

.mf-home-overlay__spark--mofu {
    color: var(--mf);
}

.mf-home-overlay__spark--brand {
    color: var(--tw-brand);
}

.mf-home-overlay__logo {
    position: absolute;
    top: 58%;
    left: 2%;
    width: 220px;
    height: 73px;
    background: var(--mf);
    opacity: calc(0.07 * var(--mf-bg-mult, 1));
    -webkit-mask: url('../images/themes/mofu/mofu-logo-white.png') center / contain no-repeat;
    mask: url('../images/themes/mofu/mofu-logo-white.png') center / contain no-repeat;
    animation: mfDrift 13s ease-in-out infinite;
}

@media (max-width: 575.98px) {
    .mf-home-overlay__glow--tr {
        width: 360px;
        height: 360px;
        top: -120px;
        right: -120px;
    }

    .mf-home-overlay__glow--bl {
        width: 400px;
        height: 400px;
        bottom: -160px;
        left: -120px;
    }

    .mf-home-overlay__logo {
        width: 140px;
        height: 46px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mf-home-clouds__cloud,
    .mf-home-overlay__glow,
    .mf-home-overlay__spark,
    .mf-home-overlay__logo {
        animation: none;
    }
}
