/* contactページ */
.page-contact .second-nav {
    margin-top: 0 !important;
    top: 0 !important;
}

/* parts-libraryページ */
.page-parts-library .second-nav-logo {
    display: none;
}

.page-parts-library .second-nav {
    position: fixed;
    left: 280px;
    width: calc(100% - 280px);
    padding: 20px 30px;
    box-sizing: border-box;
}

/* 二番目のナビ */
.second-nav {
    position: sticky;
    top: var(--sticky-top-offset, 0px);
    z-index: 100;
    padding: 10px 0;
    /*消さない*/
    /* background-color: transparent; */
    background-color: #fff;
    display: flex;
    /*消さない*/
    /* justify-content: center; */
    justify-content: flex-end;
    align-items: center;
}

.second-nav-logo {
    -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 50%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 0%, #000 50%, transparent 100%);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 200% 100%;
    mask-size: 200% 100%;
    -webkit-mask-position: 200% 0;
    mask-position: 200% 0;
    opacity: 1;
}

.second-nav-logo.reveal {
    animation: maskFadeInLogo 1.8s cubic-bezier(0.65, 0.05, 0.36, 1) forwards;
}

@keyframes maskFadeInLogo {
    to {
        -webkit-mask-position: 0% 0;
        mask-position: 0% 0;
    }
}

.second-nav__body {
    display: flex;
    align-items: center;
    /*消さない*/
    /* background-color: #F9F9F9; */
    border-radius: 9999px;
    padding: 17px 24px;
    gap: clamp(0.5rem, 2vw, 2rem);
    justify-content: center;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    box-shadow: none;
    transition: box-shadow 0.8s ease;

    /* ベール用マスクの初期設定はそのまま */
    -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 50%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 0%, #000 50%, transparent 100%);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 200% 100%;
    mask-size: 200% 100%;
    -webkit-mask-position: 200% 0;
    mask-position: 200% 0;
}

.second-nav__body.shadow-visible {
    /*消さない*/
    /* box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3); */
}

/* ▼ アニメーションクラスを追加したときに動作 */
.second-nav__body.reveal {
    animation: maskFadeIn 1.8s cubic-bezier(0.65, 0.05, 0.36, 1) forwards;
}

@keyframes maskFadeIn {
    to {
        -webkit-mask-position: 0% 0;
        mask-position: 0% 0;
        /* シャドウの指定はここには不要（mask-imageが解除された時に見えるようになるため） */
    }
}

/* ★光の要素のスタイル修正★ */
.nav-glow {
    position: absolute;
    top: 0;
    height: 100%;
    width: 200%;
    background: radial-gradient(circle at center,
            rgba(255, 255, 255, 0.9) 0%,
            rgba(255, 255, 255, 0.7) 30%,
            rgba(255, 255, 255, 0.4) 60%,
            rgba(255, 255, 255, 0) 100%
        );
    z-index: 1;
    pointer-events: none;
    filter:
        blur(30px)
        drop-shadow(0 0 15px rgba(255, 255, 255, 0.8))
        drop-shadow(0 0 40px rgba(255, 255, 255, 0.5));
    opacity: 0;
}

/* 光の動作用 */
.nav-glow.animate {
    animation: glow-move 1.5s linear forwards;
}

@keyframes glow-move {
    0% {
        transform: translateX(50%);
        opacity: 1;
    }

    100% {
        transform: translateX(-50%);
        opacity: 0;
    }
}

.second-nav__list {
    display: flex;
    gap: clamp(0.5rem, 2vw, 2rem);
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
}

.second-nav__item a {
    position: relative;
    display: block;
    height: 1.4em;
    line-height: 1.4em;
    overflow: hidden;
    font-weight: bold;
    font-size: 0.9rem;
    text-decoration: none;
    color: #343434;
    padding: 0 0.6em;
    min-width: max-content;
    white-space: nowrap;
    text-align: center;
    perspective: 200px;
}

.second-nav__item a span {
    display: block;
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
    will-change: transform, opacity;
    color: #333333;
    backface-visibility: hidden;
}

.second-nav__item a .en {
    transform: rotateX(0deg);
    opacity: 1;
}

.second-nav__item a .ja {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    transform: rotateX(90deg);
    opacity: 0;
    visibility: hidden;
}

.second-nav__item a:hover .en {
    transform: rotateX(-90deg);
    opacity: 0;
    visibility: hidden;
}

.second-nav__item a:hover .ja {
    transform: rotateX(0deg);
    opacity: 1;
    visibility: visible;
}

@media screen and (max-width: 1024px) {
    .second-nav {
        top: var(--sticky-top-offset, 0px);
    }

    .second-nav__body {
        padding: 12px 16px;
        gap: clamp(0.2rem, 1.5vw, 0.8rem);
        margin-top: 6px;
    }

    .second-nav__list {
        gap: clamp(0.3rem, 1.5vw, 0.8rem);
    }

    .second-nav__item a {
        font-size: 0.8rem;
    }
}

@media screen and (max-width: 900px) {
    .second-nav {
        display: none;
    }
}