/* =========================================================
   Header / Global Nav
   - nav.php 専用
   - PC: bottom fixed nav
   - SP/Tablet: hamburger menu
   - style.css の後に読み込む想定
========================================================= */

/* =========================================================
   0) Base
========================================================= */
.cloud-header {
    position: relative;
    z-index: 1000;
    text-align: center;
}

.logo-area {
    position: relative;
    z-index: 1100;
    background: #fff;
    margin-bottom: 0;
}

.logo-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.logo-img {
    display: block;
    width: 100%;
    height: auto;
}

.pc-logo {
    display: block;
}

.mobile-logo {
    display: none;
}

.dotted-line {
    width: 100%;
    margin: 12px 0;
    /*border-bottom: 10px dashed var(--dotted, #bfe7f7);*/
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.dotted-line.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.menu-toggle {
    display: none;
    appearance: none;
    border: none;
    background: rgba(255, 255, 255, 0.92);
    color: #f5a1a1;
    cursor: pointer;
    font-size: 2rem;
    line-height: 1;
}

.main-nav {
    box-sizing: border-box;
}

.nav-icons {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-icons li {
    margin: 0;
    padding: 0;
}

.nav-item {
    display: flex;
    /*flex-direction: column;文字をアイコン下部に置く*/
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
    border-radius: 14px;
    transition:
        transform .2s ease,
        background .2s ease,
        box-shadow .2s ease,
        opacity .5s ease,
        filter .2s ease;
}

.nav-item img {
    display: block;
    object-fit: contain;
    height: auto;
}

.nav-item .label {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 6px;
    line-height: 1.15;
}

.nav-item .label .en {
    font-style: normal;
    font-weight: 700;
    letter-spacing: .04em;
    font-size: 12px;
    color: #5a4fff;
    text-transform: uppercase;
}

.nav-item:focus-visible,
.main-nav a:focus-visible,
.menu-toggle:focus-visible {
    outline: 3px solid var(--focus, #93c5fd);
    outline-offset: 3px;
    border-radius: 10px;
}

.menu-illustration img {
    display: block;
    max-width: 100%;
    height: auto;
    margin-inline: auto;
}

/* stagger reveal 用 */
.main-nav .nav-item {
    opacity: 0;
    transform: translateY(22px);
    transition:
        opacity 1s ease,
        transform 1s cubic-bezier(.16, 1, .3, 1),
        background .2s ease,
        box-shadow .2s ease,
        filter .2s ease;
}

.main-nav .nav-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (min-width: 1024px) {
    .main-nav.stop-above-footer {
        position: absolute;
        left: 0;
        right: 0;
        bottom: calc(100% + 12px);
        width: 100%;
    }

    .main-nav {
        transition:
            opacity 1.9s ease,
            transform 1.9s ease,
            filter 1.9s ease;
        transform-origin: center bottom;
    }

    .main-nav.is-leaving {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
        filter: blur(1px);
        pointer-events: none;
    }
}

@media (hover: hover) {
    .main-nav .nav-item:hover {
        transform: translateY(-2px) scale(1.04);
        filter: brightness(1.02);
    }
}

/* =========================================================
   1) SP / Tablet : hamburger menu
   - 1023px以下
========================================================= */
@media (max-width: 1023px) {
    .pc-logo {
        display: none;
    }

    .mobile-logo {
        display: block;
    }

    .logo-area {
        background: #fff;
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 12px;
        right: 12px;
        z-index: 1300;
        width: 48px;
        height: 48px;
        border-radius: 999px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
    }

    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: min(86vw, 340px);
        height: 100dvh;
        padding: 88px 18px 24px;
        background: linear-gradient(to bottom, #fef6f9 0%, #d6f0fa 100%);
        box-shadow: -8px 0 24px rgba(0, 0, 0, .12);
        overflow-y: auto;
        z-index: 1250;
        transition: right .35s ease;
    }

    .main-nav.active {
        right: 0;
    }

    .nav-icons {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 10px;
        justify-items: stretch;
    }

    .nav-item {
        min-height: 118px;
        padding: 14px 10px;
        background: rgba(255, 255, 255, .88);
        box-shadow: 0 4px 10px rgba(0, 0, 0, .08);
        opacity: 1;
        transform: none;
    }

    .nav-item img {
        width: 48px;
    }

    .nav-item .label {
        margin-top: 8px;
    }

    .nav-item .label .en {
        font-size: 11px;
    }

    .menu-illustration {
        margin-top: 20px;
        text-align: center;
    }

    .menu-illustration img {
        max-width: 120px;
    }

    .dotted-line:last-of-type {
        display: none;
    }
}

/* =========================================================
   2) Desktop : bottom fixed nav
   - あとで下固定やめたくなったら、
     このブロックを差し替えると戻しやすい
========================================================= */
@media (min-width: 1024px) {
    .menu-toggle {
        display: none !important;
    }

    .pc-logo {
        display: block;
    }

    .mobile-logo {
        display: none;
    }

    .cloud-header {
        position: relative;
    }

    .logo-area {
        position: relative;
        z-index: 1100;
        background: #fff;
    }

    .main-nav {
        position: fixed;
        left: 0;
        bottom: 0;
        width: 100%;
        z-index: 1200;
        padding: 2px 2px;
        background: #d5f2ff24;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .nav-icons {
        display: grid;
        grid-template-columns: repeat(6, minmax(90px, 1fr));
        gap: 12px;
        align-items: center;
        max-width: 1100px;
        margin: 0 auto;
    }

    .nav-item {
        min-height: 76px;
        padding: 1px 1px;
        background: transparent;
        box-shadow: none;
    }

    .nav-item img {
        width: clamp(50px, 1vw, 72px);
    }

    .nav-item .label {
        margin-top: 6px;
    }

    .nav-item .label .en {
        font-size: 11px;
    }

    @media (hover: hover) {
        .nav-item:hover {
            background: rgba(157, 217, 247, 0.10);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
        }
    }

    .menu-illustration,
    .menu-illustration img {
        display: none;
    }

    body {
        padding-bottom: 112px;
    }
}

/* =========================================================
   3) Large desktop adjustment
========================================================= */
@media (min-width: 1360px) {
    /*.main-nav {
        padding-top: 12px;
        padding-bottom: 12px;
    }*/

    .nav-icons {
        max-width: 1240px;
    }

    .nav-item img {
        width: 50px;
    }

    .nav-item .label .en {
        font-size: 12px;
    }
}

/* =========================================================
   4) Reduce motion
========================================================= */
@media (prefers-reduced-motion: reduce) {

    .main-nav,
    .nav-item,
    .dotted-line {
        transition: none !important;
    }
}