/* Heritage Section Advanced Redesign */

.heritage-advanced {
    position: relative;
    width: 100%;
    background: #eae7e4;
    padding: 100px 0;
    overflow: hidden;
}

.heritage-advanced::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('../../images/chezhudo.webp') no-repeat center center/cover;
    opacity: 0.15;
    z-index: 0;
}

.h-adv-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    box-sizing: border-box; /* padding込みで1400pxに収める。無いと1480pxになり画面からはみ出す */
}

.h-adv-title-wrap {
    text-align: center;
    margin-bottom: 60px;
}

.h-adv-title-svg {
    width: 100%;
    max-width: 450px;
}

.h-adv-layout {
    display: flex;
    gap: 60px;
    align-items: center;
}

/* ================= LEFT: TEXTS ================= */
.h-adv-texts {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 550px;
}

.h-text-item {
    padding: 30px 40px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    overflow: hidden;
    margin-bottom: 5px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    background: transparent; /* Remove fallback */
}

/* Base overlay for all cards (inactive by default = heavily washed out) */
.h-text-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.65); /* White fade for inactive */
    z-index: 1;
    transition: all 0.5s ease;
}

.h-text-item:hover::before {
    background: rgba(255, 255, 255, 0.5); 
}

.h-text-item.active {
    transform: translateX(15px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

/* When active, remove the white overlay to reveal the dark quad image perfectly */
.h-text-item.active::before {
    background: rgba(0, 0, 0, 0.4); /* Slight dark overlay to ensure white text is readable */
}

/* Background images for the cards via pseudo-element */
.h-text-item::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    transition: all 0.5s ease;
}

.h-text-item[data-index="0"]::after { background-image: url('../../images/card_01.jpg'); }
.h-text-item[data-index="1"]::after { background-image: url('../../images/card_02.jpg'); }
.h-text-item[data-index="2"]::after { background-image: url('../../images/card_03.jpg'); }
.h-text-item[data-index="3"]::after { background-image: url('../../images/card_04.jpg'); }
.h-text-item[data-index="4"]::after { background-image: url('../../images/card_05.jpg'); }

.h-text-subtitle,
.h-text-title,
.h-text-desc {
    position: relative;
    z-index: 10;
}

.h-text-subtitle {
    font-size: 13px;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 8px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.h-text-title {
    font-family: var(--font-en);
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.h-text-desc {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255,255,255,0.95);
    font-feature-settings: "palt";
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* ================= RIGHT: VISUALS (PC) ================= */
.h-adv-visuals {
    flex: 1.2;
    position: relative;
    height: 700px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.h-visual-track {
    position: relative;
    width: 100%;
    max-width: 450px;
    height: 100%;
}

.h-track-svg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
}

/* Hide new mobile in-card images on PC */
.h-text-m-img {
    display: none;
}

/* Visual Nodes */
.h-v-node {
    position: absolute;
    width: 90px;
    height: 90px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 2;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.h-v-node img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 50%;
    filter: grayscale(100%) brightness(0.6);
    transition: all 0.5s ease;
    border: 3px solid #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* PC Text overlay inside circles */
.h-v-node::after {
    content: attr(data-title);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-family: var(--font-en);
    font-weight: 700;
    font-size: 13px;
    text-align: center;
    z-index: 20;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    width: 90%;
    line-height: 1.2;
    pointer-events: none;
}

.h-v-node:hover img {
    filter: grayscale(50%) brightness(0.7);
}

/* The passed/active nodes become GREEN and full color (Attention State) */
.h-v-node.passed img,
.h-v-node.active img {
    filter: grayscale(0%) brightness(0.7); /* Brightness 0.7 ensures white text is readable */
    border-color: #38b2a1; /* Brand green */
    border-width: 4px;
    box-shadow: 0 10px 25px rgba(56,178,161, 0.2);
}

/* Only the truly active node is large */
.h-v-node.active {
    width: 140px;
    height: 140px;
    z-index: 10;
}
.h-v-node.active::after {
    font-size: 16px;
}
.h-v-node.active img {
    border-width: 5px;
    box-shadow: 0 15px 35px rgba(56,178,161, 0.4);
}

/* Outer glowing ring for just the active one */
.h-node-ring {
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    border: 2px dashed #38b2a1;
    animation: h-spin 15s linear infinite;
    opacity: 0;
    transition: all 0.4s ease;
}
.h-v-node.active .h-node-ring {
    opacity: 1;
}

/* Background Quad Illustrations (Line Art behind nodes) */
.h-quad-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    opacity: 0.15; /* Faint grey when inactive */
    transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    filter: grayscale(100%);
    pointer-events: none;
}

.h-v-node.active .h-quad-bg {
    opacity: 1;
    filter: grayscale(0%); /* Restores true color (brand green) when active */
    transform: translate(-50%, -50%) scale(1.05);
}

/* Hide mobile center display on PC */
.h-adv-mobile-visuals {
    display: none;
}

@keyframes h-spin { 100% { transform: rotate(360deg); } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }

/* ================= MOBILE RESPONSIVE ================= */
@media screen and (max-width: 1023px) {
    .heritage-advanced {
        padding: 40px 0 0 0; 
    }

    .h-adv-title-wrap {
        margin-bottom: 20px;
    }

    .h-adv-title-svg {
        max-width: 200px !important;   /* sp.css の img{max-width:100%!important} に負けて345pxで出ていた */
    }

    .h-adv-layout {
        display: flex;
        flex-direction: column;
        gap: 0;
        position: relative;
    }

    .h-adv-container {
        padding: 0;
    }

    /* 1. VISUALS ON TOP (Simplified for Mobile) */
    .h-adv-visuals {
        display: flex !important;
        order: -1;
        width: 100%;
        height: 60vh;
        min-height: 420px;
        position: relative;
        justify-content: center;
        align-items: center;
    }

    .h-visual-track {
        width: 100%;
        height: 100%;
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    /* Hide the SVG path on mobile completely (too complex/unclear) */
    .h-track-svg {
        display: none !important;
    }

    /* Hide inactive nodes on mobile */
    .h-v-node {
        display: none !important;
    }

    /* ONLY show the single active node, perfectly centered and large */
    .h-v-node.active {
        display: block !important;
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        width: 220px !important;
        height: 220px !important;
        z-index: 10;
        margin-top: -30px; /* Slight bump up to balance visually */
    }

    /* The glowing ring matches the giant active node */
    .h-node-ring {
        inset: -15px !important;
        border-width: 3px !important;
    }

    /* The active node image formatting */
    .h-v-node.active img {
        filter: grayscale(0%) brightness(0.8) !important;
        border: 4px solid #38b2a1 !important; /* Always brand green for the single focus */
        box-shadow: 0 15px 40px rgba(56, 178, 161, 0.4) !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* Text overlay inside the giant circle */
    .h-v-node.active::after {
        font-size: 18px !important;
        line-height: 1.3;
        text-shadow: 0 3px 6px rgba(0,0,0,0.8);
        padding: 0 10px;
        box-sizing: border-box;
    }
    .h-adv-texts {
        flex-direction: row;
        overflow-x: auto;
        padding: 0;
        margin: 0;
        gap: 0;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; 
        box-shadow: 0 -10px 30px rgba(0,0,0,0.15);
        border-radius: 20px 20px 0 0;
        position: relative;
        z-index: 100;
        width: 100%;
        background: #000;
    }
    .h-adv-texts::-webkit-scrollbar {
        display: none;
    }

    /* Image Backgrounds for each card on mobile */
    .h-text-item[data-index="0"] { background: url('../../images/card_01.jpg') no-repeat center center/cover !important; }
    .h-text-item[data-index="1"] { background: url('../../images/card_02.jpg') no-repeat center center/cover !important; }
    .h-text-item[data-index="2"] { background: url('../../images/card_03.jpg') no-repeat center center/cover !important; }
    .h-text-item[data-index="3"] { background: url('../../images/card_04.jpg') no-repeat center center/cover !important; }
    .h-text-item[data-index="4"] { background: url('../../images/card_05.jpg') no-repeat center center/cover !important; }

    .h-text-item {
        position: relative;
        /* 100vw だと親（横スクロールの器）より広くなり、右端の文字が画面の外に出る */
        width: 100%;
        min-width: 100%;
        flex-shrink: 0;
        height: auto;
        min-height: auto;
        scroll-snap-align: center;
        transform: none !important;
        text-align: center;
        border: none !important;
        box-shadow: none !important;
        /* 下のページャー（bottom:25px・高さ44px）に最終行が隠れていたので、
           その分の下余白を確保する */
        padding: 40px 20px 90px 20px !important;
        box-sizing: border-box;
        opacity: 1 !important; 
        border-radius: 0 !important;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    /* Dark Overlay for Text Readability */
    .h-text-item::before {
        content: '';
        position: absolute;
        inset: 0;
        background: rgba(47, 86, 74, 0.85) !important; /* Brand green tint overlay */
        z-index: 1 !important;
        transform: none !important;
        border-radius: 0 !important;
        width: 100%;
        opacity: 1 !important;
    }

    .h-text-subtitle,
    .h-text-title,
    .h-text-desc {
        position: relative;
        z-index: 10;
        color: #fff !important;
        text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    }

    .h-text-subtitle {
        margin-top: 0 !important;
        margin-bottom: 5px !important;
        font-size: 13px !important;
        letter-spacing: 2px !important;
        font-weight: 700 !important;
        opacity: 0.8 !important;
    }

    .h-text-title {
        font-size: 22px !important;
        margin: 0 0 15px 0 !important;
        padding-bottom: 0 !important;
        border-bottom: none !important;
        font-weight: 700 !important;
    }

    .h-text-desc {
        font-size: 13px !important;
        line-height: 1.6 !important;
        margin: 0 auto !important;
        width: 100%;
        max-width: 90%;
    }

    /* Hide the old decorative elements */
    .h-text-item::after { display: none !important; }
    .h-text-m-img { display: none !important; }

    /* Mobile Pagination Indicator styling (Now a control bar at bottom) */
    .h-m-pagination-wrap {
        position: absolute;
        bottom: 25px; /* Stay just above the bottom edge of the slider container */
        left: 0;
        width: 100%;
        display: flex;
        justify-content: center;
        z-index: 101;
        pointer-events: none; /* Let clicks pass through empty areas */
    }

    .h-m-pagination {
        display: inline-flex;
        align-items: center;
        gap: 15px;
        font-family: var(--font-en), sans-serif;
        font-weight: 500;
        color: #fff;
        background: rgba(0, 0, 0, 0.4);
        padding: 8px 20px;
        border-radius: 30px;
        backdrop-filter: blur(8px);
        font-size: 14px;
        letter-spacing: 2px;
        pointer-events: auto; /* Re-enable clicks for the actual pill box */
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .h-m-arrow {
        font-size: 16px;
        color: #fff;
        transition: opacity 0.3s ease;
        padding: 5px 15px;
        margin: 0 -5px; /* Expand hit area */
    }
    .h-m-arrow:active {
        opacity: 0.5;
    }
    .h-m-page-current { font-weight: 700; color: #fff; }
    .h-m-page-div { opacity: 0.7; }
    .h-m-page-total { opacity: 0.7; }
}
    



/* --- 押したあとも色を変えない（a:visited 対策） --- */
/* style.min.css の a:visited{color:#000} は (0,1,1) で、
   クラス1つの指定 (0,1,0) より強い。押したあとだけ黒くなるのを打ち消す。 */
.h-text-subtitle:visited { color: #fff; }
.h-text-title:visited { color: #fff; }
.h-text-desc:visited { color: rgba(255,255,255,0.95); }
.h-text-subtitle:visited,
.h-text-title:visited,
.h-text-desc:visited { color: #fff !important; }
.h-m-pagination:visited { color: #fff; }
.h-m-arrow:visited { color: #fff; }
.h-m-page-current:visited { color: #fff; }

/* 見出し「Our HERITAGE Journey」の組版。
   以前は heritage_title.svg（旧サイト＝RIMAN公式の制作物）を画像で貼っていた。
   他社の著作物なので、サイト共通の書体で組み直した（2026-10-28）。
   画像をやめたぶん軽くなり、文字として読まれるので検索にも効く。 */
.h-adv-title {
    margin: 0;
    color: #38584B;
    font-family: "Shippori Mincho", "Noto Serif JP", "游明朝", YuMincho, serif;
    font-weight: 400;
    line-height: 1.08;
}
.h-adv-title__pre,
.h-adv-title__post {
    display: block;
    font-size: 2.2rem;
    letter-spacing: 0.14em;
    opacity: 0.82;
}
.h-adv-title__main {
    display: block;
    font-size: 5.6rem;
    letter-spacing: 0.15em;
    margin: 0.06em 0;
}
.h-adv-title__post { margin-left: 2.2em; }

@media screen and (max-width: 767px) {
    .h-adv-title__pre,
    .h-adv-title__post { font-size: 1.4rem; }
    .h-adv-title__main { font-size: 3.0rem; }
}
