/* =================================================
   css/header.css
   ヘッダー・グローバルナビ・ドロワー
   ================================================= */


/* ─── サイトヘッダー ─── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-white, #fff);
    border-bottom: 1px solid #ebebeb;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.header-inner {
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    gap: 16px;
}


/* ─── ロゴ ─── */
.site-logo {
    flex-shrink: 0;
    margin: 0;
}

.site-logo a {
    display: flex;
    align-items: center;
}

.site-logo img {
    height: 40px;
    width: auto;
    display: block;
}


/* ─── グローバルナビ（デスクトップ） ─── */
.global-nav {
    margin-left: auto; /* ロゴとアイコンの間を埋める */
}

.global-nav ul {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2px;
}

.global-nav ul li a {
    display: block;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Shippori Mincho', serif;
    color: #444;
    text-decoration: none;
    border-radius: 4px;
    white-space: nowrap;
    transition: color 0.2s, background 0.2s;
}

.global-nav ul li a:hover,
.global-nav ul li.current-menu-item > a,
.global-nav ul li.current-menu-ancestor > a {
    color: var(--color-main, #219cd8);
    background: rgba(33,156,216,0.08);
}


/* ─── 右側アイコン群 ─── */
.header-icons {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* ─── アイコンボタン共通 ─── */
.header-icon-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 10px;
    border-radius: 6px;
    color: #555;
    text-decoration: none;
    font-size: 11px;
    font-family: 'Shippori Mincho', serif;
    transition: color 0.2s, background 0.2s;
    cursor: pointer;
}

.header-icon-btn svg,
.header-user__icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.header-icon-btn:hover {
    color: var(--color-main, #219cd8);
    background: rgba(33,156,216,0.08);
}

.header-icon-btn--logout {
    font-size: 11px;
    color: #999;
}

.header-icon-btn--logout:hover {
    color: #c0392b;
    background: rgba(192,57,43,0.06);
}


/* ─── カートバッジ ─── */
.cart-badge {
    position: absolute;
    top: 2px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--color-main, #219cd8);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    font-family: sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
}


/* ─── ハンバーガー ─── */
.hamburger {
    display: none; /* デスクトップでは非表示 */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

.hamburger:hover {
    background: rgba(0,0,0,0.05);
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #444;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.2s ease;
    transform-origin: center;
}

/* X に変形 */
.hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }


/* ─── モバイルドロワー ─── */
.nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100dvh;
    background: var(--color-white, #fff);
    z-index: 200;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: -4px 0 20px rgba(0,0,0,0.14);
    visibility: hidden;
}

.nav-drawer.is-open {
    transform: translateX(0);
    visibility: visible;
}

.nav-drawer__inner {
    padding: 20px 24px 48px;
}

/* 閉じるボタン */
.nav-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-left: auto;
    margin-bottom: 28px;
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.nav-drawer__close:hover {
    background: #f5f5f5;
    color: #333;
}

/* ドロワーナビ */
.drawer-menu {
    list-style: none;
    margin: 0 0 32px;
    padding: 0;
}

.drawer-menu li a {
    display: block;
    padding: 13px 0;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Shippori Mincho', serif;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: color 0.2s, padding-left 0.2s;
}

.drawer-menu li a:hover,
.drawer-menu li.current-menu-item > a {
    color: var(--color-main, #219cd8);
    padding-left: 8px;
}

/* ドロワーユーザーエリア */
.nav-drawer__user {
    border-top: 1px solid #f0f0f0;
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.drawer-user-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 4px;
    font-size: 14px;
    font-family: 'Shippori Mincho', serif;
    color: #444;
    text-decoration: none;
    border-bottom: 1px solid #f5f5f5;
    transition: color 0.2s;
}

.drawer-user-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.drawer-user-link:hover {
    color: var(--color-main, #219cd8);
}

.drawer-user-link--logout {
    font-size: 13px;
    color: #999;
    justify-content: flex-end;
    border-bottom: none;
}

.drawer-user-link--logout:hover {
    color: #c0392b;
}


/* ─── オーバーレイ ─── */
.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nav-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}


/* ─── レスポンシブ ─── */
@media (max-width: 767px) {
    .header-inner {
        height: 56px;
        padding: 0 16px;
    }

    .site-logo img {
        height: 32px;
    }

    /* デスクトップナビを非表示 */
    .global-nav {
        display: none;
    }

    /* ハンバーガーを表示 */
    .hamburger {
        display: flex;
    }

    /* アイコンのラベルを非表示 */
    .header-icon-btn__label {
        display: none;
    }

    /* ログアウトはドロワーに移動するため非表示 */
    .header-icon-btn--logout {
        display: none;
    }
}

@media (min-width: 768px) {
    /* デスクトップではドロワー非表示 */
    .nav-drawer,
    .nav-overlay {
        display: none;
    }
}
