/* ==========================================================================
   Header Component Styles
   ========================================================================== */

/* --------------------------------------------------
   Base Header (Transparent Background / White Text)
   -------------------------------------------------- */
.hh-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100000;
    padding: 20px 40px;
    transition: background-color 0.8s ease, padding 0.8s ease, box-shadow 0.8s ease, color 0.8s ease, backdrop-filter 0.8s ease;
    background-color: transparent;
    color: #ffffff; /* Default: White Text */
    box-sizing: border-box;
}

.hh-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    gap: 20px;
}

/* PC版: ナビゲーションとボタンエリアの配置調整 */
@media (min-width: 1025px) {
    .hh-header-inner {
        justify-content: space-between;
    }
    
    .hh-header-nav {
        flex: 1;
        display: flex;
        justify-content: center;
    }
}

/* --------------------------------------------------
   Scrolled State (White Background / Navy Text)
   -------------------------------------------------- */
.hh-header.is-scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 40px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    color: var(--lp-navy, #253742);
}

/* --------------------------------------------------
   Variation: Header on White Page (Navy Text)
   -------------------------------------------------- */
.hh-header.header-white-bg:not(.is-scrolled) {
    color: var(--lp-navy, #253742);
}

/* --------------------------------------------------
   Logo
   -------------------------------------------------- */
.hh-header-logo img {
    display: block;
    height: 43px;
    width: auto;
    transition: all 0.3s ease;
}

/* --------------------------------------------------
   Navigation
   -------------------------------------------------- */
.hh-header-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 30px;
}

.hh-header-nav a {
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
    position: relative;
    color: inherit; /* Inherit from .hh-header color */
}

/* Hover Underline */
.hh-header-nav a::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: var(--lp-accent, #00bfff);
    transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.hh-header-nav a:hover::after {
    width: 100%;
}

.hh-header-nav a:hover {
    color: var(--lp-accent, #00bfff) !important;
}

/* Variation: Navigation Color on White Page */
.hh-header.header-white-bg:not(.is-scrolled) .hh-header-nav ul li a::after {
    background-color: var(--lp-navy, #253742);
}

/* --------------------------------------------------
   Header Actions (Buttons)
   -------------------------------------------------- */
.hh-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* PC版: ボタンを左寄せ、ハンバーガーメニューを右寄せ */
@media (min-width: 1025px) {
    .hh-header-actions {
        display: flex;
        align-items: center;
        gap: 15px;
        flex-shrink: 0;
    }
    
    /* ボタン2つをワンセットとして左に配置 */
    .hh-header-actions .hh-header-btn {
        flex-shrink: 0;
    }
    
    /* ハンバーガーメニューを右端に配置 */
    .hh-header-actions .hh-menu-trigger {
        margin-left: 20px;
        flex-shrink: 0;
    }
}

.hh-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

/* --------------------------------------------------
   Button: Document Request (Left)
   -------------------------------------------------- */
.btn-doc {
    background: transparent;
    border: 1.5px solid #ffffff;
    color: #ffffff;
}

.btn-doc::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: #ffffff;
    transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: -1;
}

.btn-doc:hover {
    color: var(--lp-navy, #253742) !important;
    border-color: #ffffff;
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.2);
}

.btn-doc:hover::before {
    width: 100%;
}

/* Scrolled State */
.hh-header.is-scrolled .btn-doc {
    border-color: var(--lp-navy, #253742);
    color: var(--lp-navy, #253742);
}

.hh-header.is-scrolled .btn-doc::before {
    background: var(--lp-navy, #253742);
}

.hh-header.is-scrolled .btn-doc:hover {
    color: #ffffff !important;
}

/* Variation: White Page State */
.hh-header.header-white-bg:not(.is-scrolled) .btn-doc {
    color: var(--lp-navy, #253742);
    border-color: var(--lp-navy, #253742);
}

.hh-header.header-white-bg:not(.is-scrolled) .btn-doc::before {
    background: var(--lp-navy, #253742);
}

.hh-header.header-white-bg:not(.is-scrolled) .btn-doc:hover {
    color: #ffffff !important;
}

/* --------------------------------------------------
   Button: Contact (Right)
   -------------------------------------------------- */
.btn-contact {
    background: var(--lp-red, #dc4750);
    border: 1.5px solid var(--lp-red, #dc4750);
    color: #ffffff !important;
}

.btn-contact::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: none;
    z-index: 1;
    pointer-events: none;
    transform: skewX(-20deg);
}

.btn-contact:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(220, 71, 80, 0.4);
    background: #c23e46;
    color: #ffffff !important;
}

.btn-contact:hover::after {
    left: 100%;
    transition: left 0.6s ease;
}

/* --------------------------------------------------
   Hamburger Menu Trigger
   -------------------------------------------------- */
.hh-menu-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: transparent;
    border: 1.5px solid #ffffff;
    cursor: pointer;
    position: relative;
    z-index: 10001;
    margin-left: 15px;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    flex-shrink: 0;
}

.hh-menu-trigger span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #ffffff;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.3s ease;
}

.hh-menu-trigger span:nth-child(1) { top: 18px; }
.hh-menu-trigger span:nth-child(2) { top: 24px; }
.hh-menu-trigger span:nth-child(3) { top: 30px; }

/* Hamburger Hover */
.hh-menu-trigger::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-radius: 50%;
    background: #ffffff;
    transition: width 0.4s ease, height 0.4s ease;
    z-index: -1;
}

.hh-menu-trigger:hover::before {
    width: 120%;
    height: 120%;
}

.hh-menu-trigger:hover span {
    background-color: var(--lp-navy, #253742);
}

/* Hamburger Active State */
.hh-menu-trigger.is-active {
    background-color: transparent;
    border-color: #253742;
}

.hh-menu-trigger.is-active span {
    background-color: #253742;
}

.hh-menu-trigger.is-active span:nth-child(1) {
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}

.hh-menu-trigger.is-active span:nth-child(2) {
    opacity: 0;
}

.hh-menu-trigger.is-active span:nth-child(3) {
    top: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
}

.hh-menu-trigger.is-active::before {
    display: none;
}

/* Scrolled State for Hamburger */
.hh-header.is-scrolled .hh-menu-trigger {
    border-color: var(--lp-navy, #253742);
}

.hh-header.is-scrolled .hh-menu-trigger span {
    background-color: var(--lp-navy, #253742);
}

.hh-header.is-scrolled .hh-menu-trigger:hover span {
    background-color: #ffffff;
}

.hh-header.is-scrolled .hh-menu-trigger::before {
    background: var(--lp-navy, #253742);
}

/* Variation: White Page State for Hamburger */
.hh-header.header-white-bg:not(.is-scrolled) .hh-menu-trigger {
    border-color: var(--lp-navy, #253742);
}

.hh-header.header-white-bg:not(.is-scrolled) .hh-menu-trigger span {
    background-color: var(--lp-navy, #253742);
}

.hh-header.header-white-bg:not(.is-scrolled) .hh-menu-trigger:hover span {
    background-color: #ffffff;
}

.hh-header.header-white-bg:not(.is-scrolled) .hh-menu-trigger::before {
    background: var(--lp-navy, #253742);
}

/* --------------------------------------------------
   Mobile Menu Overlay
   -------------------------------------------------- */
.hh-mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.hh-mobile-menu.is-active {
    pointer-events: auto;
    opacity: 1;
}

.hh-mobile-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.hh-mobile-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.hh-mobile-nav ul {
    list-style: none;
    padding: 0;
    margin: 0 0 40px 0;
    text-align: center;
}

.hh-mobile-nav li {
    margin-bottom: 20px;
}

.hh-mobile-nav a {
    text-decoration: none;
    color: #253742;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hh-mobile-nav .en {
    font-size: 14px;
    color: var(--lp-red, #dc4750); /* 赤色に変更 */
    margin-bottom: 5px;
    font-family: var(--font-archetype, "Archetype", sans-serif);
    font-weight: 500; /* ミディアム */
}

.hh-mobile-nav .jp {
    font-size: 18px;
}

.hh-mobile-btns {
    width: 100%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.hh-btn.full-width {
    width: 100%;
    text-align: center;
    padding: 14px 40px; /* custom-contact-btnと同じサイズに変更 */
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem; /* 16px */
}

.hh-btn.secondary {
    border: 1px solid #253742;
    color: #253742;
}

.hh-btn.primary {
    background: #dc4750;
    color: #fff;
}

/* --------------------------------------------------
   Responsive
   -------------------------------------------------- */
@media screen and (max-width: 1024px) {
    .hh-header-nav { display: none; }
    .hh-header-btn { display: none; }
    .hh-menu-trigger { display: flex; }
    .hh-header { padding: 15px 20px; }
}

/* --------------------------------------------------
   SP Styles (Max-width: 768px)
   -------------------------------------------------- */
@media (max-width: 768px) {
    /* ヘッダーの高さを正確に再定義 */
    /* レスポンシブ版のヘッダー構造：
     * - padding: 4vw 6vw（上下が4vw、左右が6vw）
     * - ロゴ高さ: 35px
     * - .hh-header-innerはflexboxでalign-items: center
     * 実際のヘッダーの高さ = 上padding(4vw) + ロゴ高さ(35px) + 下padding(4vw) = 8vw + 35px
     */
    :root {
        --header-height: calc(8vw + 35px);
    }

    /* Header Logo */
    .hh-header-logo img,
    #hh-logo-img {
        height: 35px;
        width: auto;
    }

    /* Header Padding */
    .hh-header {
        padding: 4vw 6vw;
        /* ヘッダーの高さを明示的に定義（box-sizing: border-boxのため、paddingを含む） */
        height: var(--header-height);
        box-sizing: border-box;
    }

    /* Hamburger Menu Icon */
    .hh-menu-trigger {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        width: 10vw;
        height: 10vw;
        background-color: transparent;
        border: 1.5px solid var(--lp-navy, #253742);
    }

    /* レスポンシブ版で通常状態の背景色を強制的に透明に */
    .hh-header .hh-menu-trigger,
    .hh-header.is-scrolled .hh-menu-trigger,
    .hh-header.header-white-bg .hh-menu-trigger {
        background-color: transparent;
    }

    /* レスポンシブ版でホバー時の::before疑似要素を無効化 */
    .hh-header .hh-menu-trigger::before,
    .hh-header.is-scrolled .hh-menu-trigger::before,
    .hh-header.header-white-bg .hh-menu-trigger::before {
        display: none;
    }

    /* レスポンシブ版でホバー時の背景色変更を無効化 */
    .hh-header .hh-menu-trigger:hover,
    .hh-header.is-scrolled .hh-menu-trigger:hover,
    .hh-header.header-white-bg .hh-menu-trigger:hover {
        background-color: transparent;
    }

    .hh-menu-trigger span {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin: 1.5px 0;
        width: 4vw;
        height: 0.5vw;
        background-color: #ffffff;
    }

    /* レスポンシブ版で通常状態（白背景でない状態）のハンバーガーメニューを白色に */
    .hh-header:not(.is-scrolled):not(.header-white-bg) .hh-menu-trigger span {
        background-color: #ffffff;
    }

    .hh-header:not(.is-scrolled):not(.header-white-bg) .hh-menu-trigger {
        border-color: #ffffff;
    }

    /* レスポンシブ版で通常状態の3本線を明示的に設定 */
    .hh-header:not(.is-scrolled):not(.header-white-bg) .hh-menu-trigger:not(.is-active) span {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin: 1.5px 0;
        width: 4vw;
        height: 0.5vw;
        background-color: #ffffff;
        opacity: 1;
    }

    .hh-header.is-scrolled .hh-menu-trigger:not(.is-active) span,
    .hh-header.header-white-bg .hh-menu-trigger:not(.is-active) span {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin: 1.5px 0;
        width: 4vw;
        height: 0.5vw;
        background-color: var(--lp-navy, #253742);
        opacity: 1;
    }

    .hh-header:not(.is-scrolled):not(.header-white-bg) .hh-menu-trigger:not(.is-active) span:nth-child(1),
    .hh-header:not(.is-scrolled):not(.header-white-bg) .hh-menu-trigger:not(.is-active) span:nth-child(2),
    .hh-header:not(.is-scrolled):not(.header-white-bg) .hh-menu-trigger:not(.is-active) span:nth-child(3) {
        top: auto;
        transform: none;
    }

    .hh-header.is-scrolled .hh-menu-trigger:not(.is-active) span:nth-child(1),
    .hh-header.is-scrolled .hh-menu-trigger:not(.is-active) span:nth-child(2),
    .hh-header.is-scrolled .hh-menu-trigger:not(.is-active) span:nth-child(3),
    .hh-header.header-white-bg .hh-menu-trigger:not(.is-active) span:nth-child(1),
    .hh-header.header-white-bg .hh-menu-trigger:not(.is-active) span:nth-child(2),
    .hh-header.header-white-bg .hh-menu-trigger:not(.is-active) span:nth-child(3) {
        top: auto;
        transform: none;
    }

    /* ホバー時も通常状態の色を維持 */
    .hh-header:not(.is-scrolled):not(.header-white-bg) .hh-menu-trigger:not(.is-active):hover span {
        background-color: #ffffff;
    }

    .hh-header.is-scrolled .hh-menu-trigger:not(.is-active):hover span,
    .hh-header.header-white-bg .hh-menu-trigger:not(.is-active):hover span {
        background-color: var(--lp-navy, #253742);
    }

    /* Hamburger Active State - バッテン（×）を円の中心に配置 */
    .hh-header .hh-menu-trigger.is-active,
    .hh-header.is-scrolled .hh-menu-trigger.is-active,
    .hh-header.header-white-bg .hh-menu-trigger.is-active,
    .hh-header:not(.is-scrolled):not(.header-white-bg) .hh-menu-trigger.is-active {
        background-color: transparent;
        border-color: var(--lp-navy, #253742);
    }

    .hh-header .hh-menu-trigger.is-active span,
    .hh-header.is-scrolled .hh-menu-trigger.is-active span,
    .hh-header.header-white-bg .hh-menu-trigger.is-active span,
    .hh-header.is-scrolled .hh-menu-trigger.is-active:hover span {
        position: absolute;
        margin: 0;
        background-color: var(--lp-navy, #253742);
    }

    .hh-header .hh-menu-trigger.is-active span:nth-child(1),
    .hh-header.is-scrolled .hh-menu-trigger.is-active span:nth-child(1),
    .hh-header.header-white-bg .hh-menu-trigger.is-active span:nth-child(1),
    .hh-header.is-scrolled .hh-menu-trigger.is-active:hover span:nth-child(1) {
        top: 50%;
        left: 50%;
        width: 4vw;
        height: 0.6vw;
        min-height: 2px;
        transform: translate(-50%, -50%) rotate(45deg);
        background-color: var(--lp-navy, #253742);
    }

    .hh-header .hh-menu-trigger.is-active span:nth-child(2),
    .hh-header.is-scrolled .hh-menu-trigger.is-active span:nth-child(2),
    .hh-header.header-white-bg .hh-menu-trigger.is-active span:nth-child(2) {
        opacity: 0;
    }

    .hh-header .hh-menu-trigger.is-active span:nth-child(3),
    .hh-header.is-scrolled .hh-menu-trigger.is-active span:nth-child(3),
    .hh-header.header-white-bg .hh-menu-trigger.is-active span:nth-child(3),
    .hh-header.is-scrolled .hh-menu-trigger.is-active:hover span:nth-child(3) {
        top: 50%;
        left: 50%;
        width: 4vw;
        height: 0.6vw;
        min-height: 2px;
        transform: translate(-50%, -50%) rotate(-45deg);
        background-color: var(--lp-navy, #253742);
    }

    /* レスポンシブ版でホバースタイルを上書き */
    .hh-header.is-scrolled .hh-menu-trigger.is-active:hover span {
        background-color: var(--lp-navy, #253742);
    }

    .hh-header.header-white-bg .hh-menu-trigger.is-active:hover span {
        background-color: var(--lp-navy, #253742);
    }

    /* Mobile Menu */
    .hh-mobile-menu {
        z-index: 10000;
    }

    .hh-mobile-bg {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
    }

    .hh-mobile-nav a {
        font-size: 3.7vw;
    }

    .hh-mobile-btns {
        gap: 3vw;
    }

    .hh-btn.full-width {
        font-size: 1rem; /* 16px - custom-contact-btnと同じサイズ */
        height: auto; /* 高さを自動に */
        width: 100%; /* 幅を100%に */
        padding: 14px 40px; /* custom-contact-btnと同じサイズ */
        min-height: 2.75rem; /* 最小高さを維持 */
    }
}
