/* =========================================================
   HEADER
========================================================= */

.site-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 50;

    width: 100%;

    border-bottom: 1px solid transparent;

    background-color: oklch(0.16 0.07 265 / 0.60);

    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);

    transition:
        background-color 0.3s ease,
        border-color 0.3s ease,
        -webkit-backdrop-filter 0.3s ease,
        backdrop-filter 0.3s ease;
}

.site-header.is-scrolled {
    border-bottom-color: rgba(255, 255, 255, 0.10);

    background-color: oklch(0.16 0.07 265 / 0.90);

    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

/* =========================================================
   內層
========================================================= */

.site-header__inner {
    display: flex;

    width: 100%;
    max-width: 1280px;
    height: 64px;

    margin-right: auto;
    margin-left: auto;

    padding-right: 16px;
    padding-left: 16px;

    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* =========================================================
   品牌
========================================================= */

.site-header__brand {
    display: flex;

    min-width: 0;

    flex: 0 0 auto;

    align-items: center;
    gap: 8px;

    color: #ffffff;

    text-decoration: none;
}

.site-header__logo {
    display: block;

    width: 40px;
    height: 40px;

    max-width: none;

    flex: 0 0 40px;

    border-radius: 50%;

    object-fit: cover;

    box-shadow:
        0 0 0 2px oklch(0.82 0.16 82 / 0.60);
}

.site-header__brand-text {
    display: flex;

    min-width: 0;

    flex-direction: column;
    justify-content: center;
}

.site-header__title {
    overflow: hidden;

    color: #ffffff;

    font-size: 18px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: 0.025em;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-header__title-accent {
    color: oklch(0.82 0.16 82);
}

.site-header__subtitle {
    margin-top: 2px;

    color: rgba(255, 255, 255, 0.55);

    font-size: 10px;
    font-weight: 500;
    line-height: 1.2;

    white-space: nowrap;
}

/* =========================================================
   桌機導覽
========================================================= */

.site-header__nav {
    display: flex;

    min-width: 0;

    flex: 1;

    align-items: center;
    justify-content: center;
    gap: 4px;
}

.site-header__nav a {
    display: inline-flex;

    padding:
        8px
        12px;

    align-items: center;
    justify-content: center;

    border-radius: 6px;

    color: rgba(255, 255, 255, 0.80);

    font-size: 14px;
    font-weight: 500;
    line-height: 1.25;

    text-decoration: none;
    white-space: nowrap;

    transition:
        color 0.2s ease,
        background-color 0.2s ease;
}

.site-header__nav a:hover {
    color: oklch(0.82 0.16 82);
}

/* =========================================================
   右側會員區
========================================================= */

.site-header__member {
    display: flex;

    min-width: 0;

    flex: 0 0 auto;

    align-items: center;
    justify-content: flex-end;
}

/* =========================================================
   會員下拉選單
========================================================= */

.site-header__member-dropdown {
    position: relative;

    display: block;

    min-width: 0;
}

.site-header__profile {
    display: inline-flex;

    min-width: 0;
    min-height: 42px;

    padding:
        4px
        8px;

    align-items: center;
    gap: 9px;

    border: 1px solid transparent;
    border-radius: 10px;

    color: #ffffff;
    background-color: transparent;

    font-family: inherit;

    text-decoration: none;

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        background-color 0.2s ease;
}

.site-header__profile:hover,
.site-header__profile[aria-expanded="true"] {
    border-color: rgba(255, 255, 255, 0.10);

    background-color: rgba(255, 255, 255, 0.07);
}

/* =========================================================
   頭像
========================================================= */

.site-header__avatar-wrap {
    position: relative;

    display: inline-flex;

    width: 36px;
    height: 36px;

    flex: 0 0 36px;

    align-items: center;
    justify-content: center;
}

.site-header__avatar {
    display: block;

    width: 36px;
    height: 36px;

    max-width: none;

    border-radius: 50%;

    object-fit: cover;

    box-shadow:
        0 0 0 2px oklch(0.82 0.16 82 / 0.55);
}

.site-header__avatar-fallback {
    display: flex;

    width: 36px;
    height: 36px;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    color: #07111d;

    background:
        linear-gradient(
            135deg,
            oklch(0.82 0.16 82) 0%,
            oklch(0.72 0.19 55) 100%
        );

    font-size: 14px;
    font-weight: 900;
    line-height: 1;

    box-shadow:
        0 0 0 2px oklch(0.82 0.16 82 / 0.55);
}

/* =========================================================
   會員名稱與等級
========================================================= */

.site-header__member-info {
    display: flex;

    min-width: 0;

    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 3px;
}

.site-header__member-name {
    display: block;

    max-width: 110px;

    overflow: hidden;

    color: rgba(255, 255, 255, 0.92);

    font-size: 14px;
    font-weight: 700;
    line-height: 1.1;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-header__member-level {
    display: inline-flex;

    min-height: 16px;

    padding:
        2px
        6px;

    align-items: center;
    justify-content: center;

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;

    color: rgba(255, 255, 255, 0.58);
    background-color: rgba(255, 255, 255, 0.05);

    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;

    white-space: nowrap;
}

.site-header__member-level--vip {
    border-color: oklch(0.82 0.16 82 / 0.40);

    color: oklch(0.82 0.16 82);
    background-color: oklch(0.82 0.16 82 / 0.10);
}

/* =========================================================
   下拉箭頭
========================================================= */

.site-header__member-arrow {
    display: block;

    width: 7px;
    height: 7px;

    margin-right: 3px;
    margin-left: 2px;

    flex: 0 0 7px;

    border-right: 1.5px solid rgba(255, 255, 255, 0.65);
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.65);

    transform:
        rotate(45deg)
        translateY(-2px);

    transition: transform 0.2s ease;
}

.site-header__member-dropdown.is-open
.site-header__member-arrow {
    transform:
        rotate(225deg)
        translate(-1px, -1px);
}

/* =========================================================
   桌機會員選單
========================================================= */

.site-header__member-menu {
    position: absolute;
    top: calc(100% + 9px);
    right: 0;
    z-index: 100;

    display: none;

    width: 178px;

    padding: 7px;

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;

    background-color: rgba(9, 20, 35, 0.98);

    box-shadow:
        0 18px 50px -18px rgba(0, 0, 0, 0.75);

    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.site-header__member-dropdown.is-open
.site-header__member-menu {
    display: block;
}

.site-header__member-menu::before {
    position: absolute;
    top: -5px;
    right: 20px;

    width: 9px;
    height: 9px;

    border-top: 1px solid rgba(255, 255, 255, 0.12);
    border-left: 1px solid rgba(255, 255, 255, 0.12);

    background-color: rgba(9, 20, 35, 0.98);

    content: "";

    transform: rotate(45deg);
}

.site-header__member-menu a {
    position: relative;
    z-index: 1;

    display: flex;

    width: 100%;
    min-height: 40px;

    padding:
        9px
        11px;

    align-items: center;

    border-radius: 7px;

    color: rgba(255, 255, 255, 0.88);

    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;

    text-decoration: none;

    transition:
        color 0.2s ease,
        background-color 0.2s ease;
}

.site-header__member-menu a:hover {
    color: #ffffff;

    background-color: rgba(255, 255, 255, 0.07);
}

.site-header__member-menu a + a {
    margin-top: 3px;
}

.site-header__member-menu-logout {
    border-top: 1px solid rgba(255, 255, 255, 0.08);

    color: rgba(255, 135, 135, 0.92) !important;
}

.site-header__member-menu-logout:hover {
    color: #ffb0b0 !important;

    background-color: rgba(255, 95, 95, 0.08) !important;
}

/* =========================================================
   Header 登入按鈕
========================================================= */

.site-header__login {
    display: inline-flex;

    box-sizing: border-box;

    min-height: 36px;

    padding:
        8px
        16px;

    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 999px;

    color: oklch(0.16 0.07 265);

    background:
        linear-gradient(
            135deg,
            oklch(0.82 0.16 82) 0%,
            oklch(0.72 0.19 55) 100%
        );

    font-size: 14px;
    font-weight: 700;
    line-height: 1;

    text-decoration: none;
    white-space: nowrap;

    box-shadow:
        0 10px 30px -10px
        oklch(0.72 0.19 55 / 0.45);

    transition:
        filter 0.2s ease,
        transform 0.2s ease;
}

.site-header__login:hover {
    filter: brightness(1.10);

    transform: translateY(-1px);
}

/* =========================================================
   手機選單按鈕
========================================================= */

.site-header__menu-button {
    display: none;

    box-sizing: border-box;

    width: 40px;
    height: 40px;

    padding: 9px;

    flex: 0 0 40px;

    border: 0;
    border-radius: 8px;

    color: #ffffff;
    background-color: transparent;

    cursor: pointer;

    transition: background-color 0.2s ease;
}

.site-header__menu-button:hover,
.site-header__menu-button[aria-expanded="true"] {
    background-color: rgba(255, 255, 255, 0.10);
}

.site-header__menu-button span {
    display: block;

    width: 100%;
    height: 2px;

    margin:
        4px
        0;

    border-radius: 999px;

    background-color: #ffffff;

    transition:
        transform 0.2s ease,
        opacity 0.2s ease;
}

.site-header__menu-button.is-open span:nth-child(1) {
    transform:
        translateY(6px)
        rotate(45deg);
}

.site-header__menu-button.is-open span:nth-child(2) {
    opacity: 0;
}

.site-header__menu-button.is-open span:nth-child(3) {
    transform:
        translateY(-6px)
        rotate(-45deg);
}

/* =========================================================
   手機選單
========================================================= */

.site-header__mobile-menu {
    display: none;

    width: 100%;
    max-height: calc(100vh - 64px);
    max-height: calc(100dvh - 64px);

    padding:
        8px
        16px
        14px;

    overflow-y: auto;
    overscroll-behavior: contain;

    border-top: 1px solid rgba(255, 255, 255, 0.10);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);

    background-color: oklch(0.16 0.07 265 / 0.98);

    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);

    -webkit-overflow-scrolling: touch;
}

.site-header__mobile-menu.is-open {
    display: block;
}

.site-header__mobile-menu > a {
    display: flex;

    box-sizing: border-box;

    width: 100%;
    min-height: 46px;

    padding:
        11px
        12px;

    align-items: center;

    border-radius: 6px;

    color: rgba(255, 255, 255, 0.85);

    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;

    text-decoration: none;

    transition:
        color 0.2s ease,
        background-color 0.2s ease;
}

.site-header__mobile-menu > a + a {
    margin-top: 2px;
}

.site-header__mobile-menu > a:hover,
.site-header__mobile-menu > a:focus {
    color: oklch(0.82 0.16 82);

    background-color: rgba(255, 255, 255, 0.05);
}

/* =========================================================
   手機會員資訊
========================================================= */

.site-header__mobile-member {
    margin-top: 9px;
    margin-bottom: 5px;
    padding-top: 12px;

    border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.site-header__mobile-member-summary {
    display: flex;

    width: 100%;
    min-height: 60px;

    padding:
        8px
        10px;

    align-items: center;
    gap: 11px;

    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;

    background-color: rgba(255, 255, 255, 0.04);
}

.site-header__mobile-avatar-wrap {
    display: inline-flex;

    width: 40px;
    height: 40px;

    flex: 0 0 40px;

    align-items: center;
    justify-content: center;
}

.site-header__mobile-avatar {
    display: block;

    width: 40px;
    height: 40px;

    max-width: none;

    border-radius: 50%;

    object-fit: cover;

    box-shadow:
        0 0 0 2px oklch(0.82 0.16 82 / 0.55);
}

.site-header__mobile-avatar-fallback {
    display: flex;

    width: 40px;
    height: 40px;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    color: #07111d;

    background:
        linear-gradient(
            135deg,
            oklch(0.82 0.16 82) 0%,
            oklch(0.72 0.19 55) 100%
        );

    font-size: 15px;
    font-weight: 900;
    line-height: 1;

    box-shadow:
        0 0 0 2px oklch(0.82 0.16 82 / 0.55);
}

.site-header__mobile-member-info {
    display: flex;

    min-width: 0;

    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 5px;
}

.site-header__mobile-member-name {
    display: block;

    max-width: 220px;

    overflow: hidden;

    color: rgba(255, 255, 255, 0.94);

    font-size: 14px;
    font-weight: 700;
    line-height: 1.15;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-header__mobile-member-level {
    display: inline-flex;

    min-height: 17px;

    padding:
        2px
        7px;

    align-items: center;
    justify-content: center;

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;

    color: rgba(255, 255, 255, 0.58);
    background-color: rgba(255, 255, 255, 0.05);

    font-size: 9px;
    font-weight: 700;
    line-height: 1;

    white-space: nowrap;
}

.site-header__mobile-member-level--vip {
    border-color: oklch(0.82 0.16 82 / 0.40);

    color: oklch(0.82 0.16 82);
    background-color: oklch(0.82 0.16 82 / 0.10);
}

/* =========================================================
   手機登入與登出
========================================================= */

.site-header__mobile-menu
.site-header__mobile-logout {
    margin-top: 2px;

    color: rgba(255, 145, 145, 0.92);
}

.site-header__mobile-menu
.site-header__mobile-logout:hover {
    color: #ffb0b0;

    background-color: rgba(255, 95, 95, 0.08);
}

.site-header__mobile-menu
.site-header__mobile-login {
    margin-top: 9px;

    justify-content: center;

    border-radius: 999px;

    color: #07111d;

    background:
        linear-gradient(
            135deg,
            oklch(0.82 0.16 82) 0%,
            oklch(0.72 0.19 55) 100%
        );

    font-weight: 800;
}

.site-header__mobile-menu
.site-header__mobile-login:hover {
    color: #07111d;

    background:
        linear-gradient(
            135deg,
            oklch(0.86 0.15 82) 0%,
            oklch(0.77 0.18 55) 100%
        );
}

/* =========================================================
   平板
========================================================= */

@media (min-width: 640px) {
    .site-header__inner {
        padding-right: 24px;
        padding-left: 24px;
    }
}

/* =========================================================
   桌機
========================================================= */

@media (min-width: 1024px) {
    .site-header__inner {
        padding-right: 32px;
        padding-left: 32px;
    }
}

/* =========================================================
   1279px 以下使用漢堡選單
========================================================= */

@media (max-width: 1279px) {
    .site-header__nav {
        display: none;
    }

    .site-header__member {
        margin-left: auto;
    }

    .site-header__menu-button {
        display: block;
    }

    .site-header__member-dropdown {
        display: none;
    }
}

/* =========================================================
   手機
========================================================= */

@media (max-width: 639px) {
    .site-header__inner {
        padding-right: 12px;
        padding-left: 12px;

        gap: 8px;
    }

    .site-header__subtitle {
        display: none;
    }

    .site-header__member {
        gap: 0;

        margin-left: auto;
    }

    /*
     * Header 右上角登入按鈕
     */
    .site-header__member
    > .site-header__login {
        min-height: 32px;

        padding:
            7px
            10px;

        font-size: 11px;
        line-height: 1;

        box-shadow:
            0 8px 22px -12px
            rgba(245, 154, 35, 0.60);
    }

    /*
     * 手機漢堡／關閉按鈕
     */
    .site-header__menu-button {
        width: 36px;
        height: 36px;

        margin-left: 0;
        padding: 8px;

        flex: 0 0 36px;

        border-radius: 8px;
    }

    .site-header__mobile-menu {
        padding:
            8px
            12px
            12px;
    }

    .site-header__mobile-menu > a {
        min-height: 44px;

        padding:
            10px
            10px;

        font-size: 14px;
    }

    /*
     * 漢堡選單裡的登入按鈕
     */
    .site-header__mobile-menu
    > a.site-header__mobile-login {
        box-sizing: border-box;

        width: calc(100% - 48px);
        min-height: 40px;

        margin:
            10px
            auto
            2px;

        padding:
            8px
            14px;

        font-size: 13px;
        line-height: 1.2;
    }
}

/* =========================================================
   420px 以下
========================================================= */

@media (max-width: 420px) {
    .site-header__inner {
        gap: 7px;
    }

    .site-header__brand {
        gap: 7px;
    }

    .site-header__title {
        font-size: 16px;
    }

    .site-header__logo {
        width: 38px;
        height: 38px;

        flex-basis: 38px;
    }

    /*
     * 右上方登入再稍微縮小
     */
    .site-header__member
    > .site-header__login {
        min-height: 31px;

        padding:
            6px
            9px;

        font-size: 10.5px;
    }

    .site-header__menu-button {
        width: 35px;
        height: 35px;

        padding: 8px;

        flex-basis: 35px;
    }

    .site-header__mobile-member-name {
        max-width: 190px;
    }
}

/* =========================================================
   380px 以下
========================================================= */

@media (max-width: 380px) {
    .site-header__inner {
        padding-right: 10px;
        padding-left: 10px;

        gap: 6px;
    }

    .site-header__brand-text {
        max-width: 105px;
    }

    .site-header__title {
        font-size: 15px;
    }

    .site-header__logo {
        width: 36px;
        height: 36px;

        flex-basis: 36px;
    }

    .site-header__member
    > .site-header__login {
        padding:
            6px
            8px;

        font-size: 10px;
    }

    .site-header__menu-button {
        width: 34px;
        height: 34px;

        padding: 7px;

        flex-basis: 34px;
    }

    .site-header__mobile-member-name {
        max-width: 160px;
    }

    .site-header__mobile-menu
    > a.site-header__mobile-login {
        width: calc(100% - 36px);
    }
}

/* =========================================================
   不支援 OKLCH 的瀏覽器
========================================================= */

@supports not (color: oklch(0.82 0.16 82)) {
    .site-header {
        background-color: rgba(7, 13, 38, 0.60);
    }

    .site-header.is-scrolled {
        background-color: rgba(7, 13, 38, 0.90);
    }

    .site-header__logo,
    .site-header__avatar,
    .site-header__mobile-avatar {
        box-shadow:
            0 0 0 2px rgba(245, 198, 90, 0.60);
    }

    .site-header__avatar-fallback,
    .site-header__mobile-avatar-fallback {
        color: #07111d;

        background:
            linear-gradient(
                135deg,
                #f5c65a 0%,
                #e89028 100%
            );

        box-shadow:
            0 0 0 2px rgba(245, 198, 90, 0.60);
    }

    .site-header__title-accent,
    .site-header__nav a:hover,
    .site-header__mobile-menu > a:hover {
        color: #f5c65a;
    }

    .site-header__member-level--vip,
    .site-header__mobile-member-level--vip {
        border-color: rgba(245, 198, 90, 0.40);

        color: #f5c65a;
        background-color: rgba(245, 198, 90, 0.10);
    }

    .site-header__login,
    .site-header__mobile-menu
    .site-header__mobile-login {
        color: #070d26;

        background:
            linear-gradient(
                135deg,
                #f5c65a 0%,
                #e89028 100%
            );

        box-shadow:
            0 10px 30px -10px
            rgba(232, 144, 40, 0.45);
    }

    .site-header__mobile-menu {
        background-color: rgba(7, 13, 38, 0.98);
    }
}