/* =========================
   1. カスタムプロパティ定義
========================= */
@property --draw-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

/* =========================
   2. 全体レイアウト・コンテナ
========================= */
.icon_field {
    margin: 0;
    padding-top: 440px;
    padding-bottom: 100px;
    color: black;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.ui-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    position: relative;
}

/* =========================
   3. ナビゲーションボタン
========================= */
.nav-zone {
    background: none;
    border: none;
    color: #666;
    font-size: 1.5rem;
    padding: 4rem;
    cursor: pointer;
    user-select: none;
    transition: color 0.3s, transform 0.3s;
    z-index: 10;
    flex: 0 0 auto;
}

.prev-zone:hover {
    color: #fff;
    transform: translateX(-5px);
}

.next-zone:hover {
    color: #fff;
    transform: translateX(5px);
}

/* =========================
   4. スライダー領域
========================= */
.slider-window {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    display: flex;

    padding-top: 8rem;
    padding-bottom: 8rem;
    /* 上下の余白ではみ出たSVGが欠けないように */
    position: relative;
    cursor: grab;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent);
}

.slider-window:active {
    cursor: grabbing;
}

.slider-track {
    display: flex;
    gap: 3.5rem;
    padding-left: 1.75rem;
    will-change: transform;
    width: max-content;
}

/* =========================
   5. メニューアイテム（共通）
========================= */
.menu-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: transform .3s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.menu-item:hover {
    transform: scale(1.05);
}

/* =========================
   6. アイコン枠・下線・アニメーション
========================= */
.icon-circle {
    width: 150px;
    height: 150px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    box-sizing: border-box;
    z-index: 1;
}

/* 通常時の固定下線 */
.icon-circle::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    height: 2px;
    background-color: rgb(196, 196, 196);
    transition: opacity 0.4s ease;
    z-index: 1;
}

/* ホバー時の角丸四角枠（反時計回りの描画） */
.icon-circle::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 2px;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 2;

    background: conic-gradient(from 138deg,
            rgba(123, 184, 255, 1) 0deg,
            rgba(123, 184, 255, 1) var(--draw-angle),
            transparent var(--draw-angle),
            transparent 180deg,
            rgba(123, 184, 255, 1) 180deg,
            rgba(123, 184, 255, 1) calc(180deg + var(--draw-angle)),
            transparent calc(180deg + var(--draw-angle)),
            transparent 360deg);

    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;

    --draw-angle: 0deg;
    transition: --draw-angle 1.3s cubic-bezier(0.5, 1, 0.5, 1);
}

/* ホバー時：元の下線を消す */
.menu-item:hover .icon-circle::before {
    opacity: 0;
}

/* ホバー時：角丸四角枠を描画 */
.menu-item:hover .icon-circle::after {
    --draw-angle: 180deg;
}

/* 追加の下線（緑色） */
.extra-line {
    display: block;
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 90%;
    height: 2px;
    background-color: rgb(76, 204, 100);
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%);
    transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s ease;
    z-index: 1;
}

/* ホバー時：追加の下線が下にスライド */
.menu-item:hover .extra-line {
    opacity: 1;
    transform: translate(-50%, 8px);
}

/* =========================
   7. アイコン（画像 / SVG）
========================= */
/* 画像アイコンの設定 */
.icon-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scale(0.7);
    transform-origin: center;
}

/* SVGアイコンの設定 */
.icon-circle svg {
    position: absolute;
    width: 100%;
    height: 100%;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-base {
    stroke: #7e7e7e;
}

/* ホバー用アイコン（画像・SVG共通） */
.icon-hover {
    stroke: rgba(123, 184, 255, 1);
    /* SVG用 */
    clip-path: inset(100% 0 0 0);
    transition: clip-path 0.5s ease-out;
}

/* ホバー時：下から青色アイコンを表示 */
.menu-item:hover .icon-hover {
    clip-path: inset(0 0 0 0);
}

/* =========================
   8. ラベル
========================= */
.iconLabel {
    font-size: 0.9rem;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: #666;
    opacity: .6;
    transition: color .3s ease, opacity .3s ease;
}

.menu-item:hover .iconLabel {
    font-weight: bold;
    color: #0059b3;
    opacity: 1;
}

/* =========================
   9. メディアクエリ
========================= */
/* =========================
   9. メディアクエリ
========================= */
@media screen and (max-width: 767px) {

    /* =========================
       全体レイアウト
    ========================= */
    .icon_field {
        padding-top: 230px;
        padding-bottom: 0px;
        width: 100%;
        overflow: hidden;
    }

    .ui-container {
        width: 100%;
        margin: 0;
    }


    /* =========================
       ナビゲーションボタン
       モバイルではスワイプを基本操作にする
    ========================= */
    .nav-zone {
        display: none;
    }


    /* =========================
       スライダー領域
    ========================= */
    .slider-window {
        width: 100%;
        flex: 1 1 auto;

        padding-top: 5rem;
        padding-bottom: 8rem;

        overflow: hidden;

        /* 指で横方向へ操作することを明示 */
        touch-action: pan-x pan-y;

        cursor: grab;

        -webkit-mask-image: linear-gradient(to right,
                transparent 0%,
                #000 12%,
                #000 88%,
                transparent 100%);

        mask-image: linear-gradient(to right,
                transparent 0%,
                #000 12%,
                #000 88%,
                transparent 100%);
    }

    .slider-window:active {
        cursor: grabbing;
    }


    /* =========================
       スライダートラック
    ========================= */
    .slider-track {
        gap: 1.2rem;
        padding-left: 0;
        padding-right: 0;
        width: max-content;
        will-change: transform;
    }


    /* =========================
       メニューアイテム
    ========================= */
    .menu-item {
        /*
         * PC版の flex: 1 を解除。
         * モバイルでは各アイコンを固定幅にする。
         */
        flex: 0 0 140px;

        width: 140px;

        transform: none;

        /*
         * スマホの長押し・ドラッグ時に
         * 画像が選択されるのを防ぐ
         */
        user-select: none;
        -webkit-user-select: none;
        -webkit-user-drag: none;
    }

    /*
     * スマホでは hover による拡大はさせない。
     */
    .menu-item:hover {
        transform: none;
    }


    /* =========================
       アイコン
    ========================= */
    .icon-circle {
        width: 125px;
        height: 125px;

        margin-bottom: .8rem;
    }


    /* =========================
       通常時の下線
    ========================= */
    .icon-circle::before {
        width: 86%;
        height: 2px;
    }


    /* =========================
       青い枠
       PC版と同じ描画アニメーションを維持
    ========================= */
    .icon-circle::after {
        border-radius: 10px;
    }


    /* =========================
       タップ時
    ========================= */

    /*
     * :active は指を離すと解除されるので、
     * タップ中のフィードバックとして使用。
     */
    .menu-item:active {
        transform: scale(0.97);
    }

    .menu-item:active .icon-circle::before {
        opacity: 0;
    }

    .menu-item:active .icon-circle::after {
        --draw-angle: 180deg;
    }

    .menu-item:active .icon-hover {
        clip-path: inset(0 0 0 0);
    }

    .menu-item:active .iconLabel {
        font-weight: bold;
        color: #0059b3;
        opacity: 1;
    }


    .menu-item.is-active {
        transform: scale(1.05);
    }

    /* 下線を消す */
    .menu-item.is-active .icon-circle::before {
        opacity: 0;
    }

    /* 青い角丸枠を描画 */
    .menu-item.is-active .icon-circle::after {
        --draw-angle: 180deg;
    }

    /* 青いアイコンを表示 */
    .menu-item.is-active .icon-hover {
        clip-path: inset(0 0 0 0);
    }

    /* ラベル */
    .menu-item.is-active .iconLabel {
        font-weight: bold;
        color: #0059b3;
        opacity: 1;
    }

    /* 追加の緑線 */
    .menu-item.is-active .extra-line {
        opacity: 1;
        transform: translate(-50%, 7px);
    }

    /* =========================
       フォーカス時
       タップ後の選択状態をある程度維持
    ========================= */
    .menu-item:focus {
        outline: none;
    }

    .menu-item:focus .icon-circle::before {
        opacity: 0;
    }

    .menu-item:focus .icon-circle::after {
        --draw-angle: 180deg;
    }

    .menu-item:focus .icon-hover {
        clip-path: inset(0 0 0 0);
    }

    .menu-item:focus .iconLabel {
        font-weight: bold;
        color: #0059b3;
        opacity: 1;
    }


    /* =========================
       アイコン画像
    ========================= */
    .icon-image img {
        transform: scale(0.68);
    }


    /* =========================
       SVG
    ========================= */
    .icon-circle svg {
        width: 100%;
        height: 100%;
    }


    /* =========================
       追加の下線
       モバイルでは hover ではなく
       タップ時に反応
    ========================= */
    .extra-line {
        width: 86%;
    }

    .menu-item:active .extra-line,
    .menu-item:focus .extra-line {
        opacity: 1;
        transform: translate(-50%, 7px);
    }


    /* =========================
       ラベル
    ========================= */
    .iconLabel {
        font-size: 0.72rem;
        letter-spacing: .12em;
        white-space: nowrap;

        opacity: .65;
    }


    /* =========================
       モバイルでは hover の青状態を
       基本的に無効化
    ========================= */

    .menu-item:hover .icon-circle::before {
        opacity: 1;
    }

    .menu-item:hover .icon-circle::after {
        --draw-angle: 0deg;
    }

    .menu-item:hover .icon-hover {
        clip-path: inset(100% 0 0 0);
    }

    .menu-item:hover .extra-line {
        opacity: 0;
        transform: translateX(-50%);
    }

    .menu-item:hover .iconLabel {
        font-weight: normal;
        color: #666;
        opacity: .6;
    }


    /* =========================
       タップ・フォーカスだけを有効にする
    ========================= */
    .menu-item:active:hover .icon-circle::before,
    .menu-item:focus:hover .icon-circle::before {
        opacity: 0;
    }

    .menu-item:active:hover .icon-circle::after,
    .menu-item:focus:hover .icon-circle::after {
        --draw-angle: 180deg;
    }

    .menu-item:active:hover .icon-hover,
    .menu-item:focus:hover .icon-hover {
        clip-path: inset(0 0 0 0);
    }

    .menu-item:active:hover .iconLabel,
    .menu-item:focus:hover .iconLabel {
        font-weight: bold;
        color: #0059b3;
        opacity: 1;
    }
}
