/* --- [01. 基礎設定] --- */
body {
    margin: 0; padding: 0; 
    background-color: #f2f9ff; /* クリア・クリスタル */
    color: #2d2d2d;
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    position: relative; 
    overflow-x: hidden; 
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

/* --- [02. 質感ノイズ] --- */
body::before {
    content: ""; 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.04; 
    pointer-events: none; 
    z-index: 9998; 
}

main { position: relative; z-index: 1; }

section {
    width: 100%;
    position: relative;
    overflow: hidden;
}

.main-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 35px;
    position: relative;
    z-index: 5;
}

/* --- [追加：ふわっと表示のアニメーション設定] --- */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    filter: blur(4px);
    transition: opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1), 
                transform 1.2s cubic-bezier(0.22, 1, 0.36, 1), 
                filter 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.fade-in-up.is-visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

/* --- [セクション1設定: TOP画像と右下ロゴ] --- */
.top-visual-section {
    width: 100%;
    height: 100vh;
    position: relative;
    background-color: #0a111a;
    margin-bottom: -1px;
    padding-bottom: 1px;
}

.top-visual-area {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover; 
    object-position: center;
    vertical-align: bottom;
    box-shadow: none; 
}

.mergen-brand-box {
    position: absolute;
    right: 25px;
    bottom: 95px;
    text-align: right;
    z-index: 10;
}

@keyframes softSlideIn {
    0% { opacity: 0; transform: translateX(-20px); filter: blur(4px); }
    100% { opacity: 1; transform: translateX(0); filter: blur(0); }
}

@keyframes lineFlowRight {
    0% { transform: scaleX(0); transform-origin: left; opacity: 0; }
    50% { opacity: 0.6; }
    100% { transform: scaleX(1); transform-origin: left; opacity: 0.6; }
}

.mergen-logo-en {
    width: 180px;
    max-width: 60vw;
    height: auto;
    display: block;
    margin: 0 0 0 auto;
    opacity: 0;
    animation: softSlideIn 1.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.4s;
}

.mergen-line {
    width: 180px;
    height: 1px;
    background-color: #ffffff;
    margin: 15px 0 15px auto;
    opacity: 0;
    transform: scaleX(0);
    animation: lineFlowRight 1.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.8s;
}

.mergen-logo-jp {
    width: 90px;
    max-width: 30vw;
    height: auto;
    display: block;
    margin: 0 0 0 auto;
    opacity: 0;
    animation: softSlideIn 1.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 1.2s;
}

/* --- [第1セクション: 背景色設定] --- */
.dark-bg {
    background-color: #0a111a;
    color: #ffffff;
    margin-top: -1px; 
    padding-top: 1px;
    position: relative;
    z-index: 2;
}

@keyframes messageFlow {
    0% { opacity: 0; transform: translateX(-30px); filter: blur(3px); }
    100% { opacity: 1; transform: translateX(0); filter: blur(0); }
}

.mergen-message-area {
    text-align: left;
    font-family: 'Noto Serif JP', serif;
    font-size: 22px;
    font-weight: 300;
    line-height: 2;
    letter-spacing: 0.13em;
    padding: 10px 0 40px;
    display: block;
    width: fit-content;
    margin: 0 auto;
}

.mergen-message-area span {
    display: block;
    opacity: 0;
    animation: messageFlow 2.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.mergen-message-area span:nth-child(1) { animation-delay: 1.8s; }
.mergen-message-area span:nth-child(2) { animation-delay: 2.1s; }
.mergen-message-area span:nth-child(3) { animation-delay: 2.4s; }

.mergen-image-box {
    width: 100%;
    display: flex;
    justify-content: center;
    background: linear-gradient(to bottom, #0a111a 0%, #0a111a 30%, #f2f9ff 85%, #f2f9ff 100%);
    padding-top: 40px;
    padding-bottom: 0px;
    position: relative;
    margin-top: -1px;
}

.mergen-image-box img {
    width: 60%;
    max-width: 600px;
    height: auto;
    display: block;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* --- [セクション2: 水の波紋統合] --- */
.light-blue-section {
    background-color: #f2f9ff; 
    color: #0a111a;
    padding-bottom: 60px;
    margin-top: -1px; 
    padding-top: 1px;
    position: relative;
    overflow: hidden;
}

.ripple-background {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.8) 0%, transparent 60%);
}

.water-ripple {
    position: absolute;
    z-index: 1;
    width: 20px; height: 12px;
    border-radius: 50%;
    border: 1.5px solid rgba(100, 140, 180, 0.45);
    background: radial-gradient(circle, rgba(100, 140, 180, 0.05) 0%, transparent 70%);
    opacity: 0;
    top: 15%; left: 60%;
    filter: blur(0.8px);
    transform: translate(-50%, -50%) scale(1, 1) rotate(-5deg);
}

.double-ring::after {
    content: "";
    position: absolute;
    top: 8px; left: 8px; right: 8px; bottom: 8px;
    border-radius: inherit;
    border: 1.2px solid rgba(100, 140, 180, 0.2);
    display: block;
}

/* 発生頻度を下げ、広がる速度も少し緩やかに。
   60%で拡大・消失が完了し、残り40%は何も起きない「間」にすることで、
   1周期＝再生時間を長くするだけで頻度・速度の両方を落とせるようにしている。 */
.is-active .ripple1 { animation: water-spread 22s infinite ease-out; }
.is-active .ripple2 { animation: water-spread 22s infinite 5s ease-out; }
.is-active .ripple3 { animation: water-spread 26s infinite 9s ease-out; }

/* 4つ目の波源: セクション下部（「メルゲンが担う三つの役割」内）にも波紋を配置 */
.is-active .ripple4 { animation: water-spread 24s infinite 12s ease-out; }

/* width/heightではなくtransform:scaleで拡大する（レイアウト再計算を伴わずGPU合成だけで済む） */
@keyframes water-spread {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(1, 1) rotate(-5deg); }
    10% { opacity: 0.7; }
    60% { opacity: 0; transform: translate(-50%, -50%) scale(80, 75) rotate(10deg); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(80, 75) rotate(10deg); }
}

/* text-unit内に置く波源: main-contentより手前に出てしまわないよう背面へ回す */
.text-unit .ripple-background {
    z-index: -1;
}

.ripple4 {
    top: 25%;
    left: 20%;
}

/* --- [セクション3: 泡エフェクト設定] --- */
.dark-navy-section {
    background: linear-gradient(to bottom, #f2f9ff 0%, #0a111a 15%, #0a111a 100%);
    color: #ffffff;
    padding: 80px 0;
    margin-top: -1px;
    position: relative;
    z-index: 2;
    overflow: hidden;
}

.bubble-container {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
}

.bubble {
    position: absolute;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.1) 70%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    box-shadow: inset -2px -2px 6px rgba(255, 255, 255, 0.2),
                inset 2px 2px 8px rgba(255, 255, 255, 0.5),
                0 0 10px rgba(255, 255, 255, 0.1);
    opacity: 0;
    animation: rise 12s infinite linear;
    /* 従来はページ読み込み直後から画面外でも無条件で再生されていた。
       画面内にいる間だけ再生し、位相を保ったまま一時停止/再開する */
    animation-play-state: paused;
}

.bubble-observe.is-active .bubble {
    animation-play-state: running;
}

.bubble:nth-child(1) { width: 40px; height: 40px; left: 10%; bottom: 10%; animation-duration: 8s; animation-delay: -1s; }
.bubble:nth-child(2) { width: 20px; height: 20px; left: 30%; bottom: 40%; animation-duration: 6s; animation-delay: -4s; }
.bubble:nth-child(3) { width: 50px; height: 50px; left: 50%; bottom: 20%; animation-duration: 12s; animation-delay: -7s; }
.bubble:nth-child(4) { width: 15px; height: 15px; left: 70%; bottom: 60%; animation-duration: 5s; animation-delay: -2s; }
.bubble:nth-child(5) { width: 30px; height: 30px; left: 85%; bottom: 30%; animation-duration: 9s; animation-delay: -5s; }

@keyframes rise {
    0% { transform: translateY(0) scale(1); opacity: 0; }
    10% { opacity: 0.6; } 
    85% { opacity: 0.6; }
    100% { transform: translateY(-100vh) scale(0.5); opacity: 0; }
}

/* --- [サブタイトル・共通設定] --- */
.text-unit .sub-title, 
.text-unit .inner-sub-title {
    display: block; font-size: 20px; font-weight: 600;
    margin-bottom: 25px; letter-spacing: 0.1em;
    border-top: 1px solid rgba(10, 17, 26, 1); border-bottom: 1px solid rgba(10, 17, 26, 1);
    padding: 15px 0; width: 100%; text-align: center;
    background: rgba(255, 255, 255, 0.02); box-sizing: border-box;
}

.dark-navy-section .text-unit .sub-title,
.dark-navy-section .text-unit .inner-sub-title {
    color: #ffffff; border-top: 1px solid rgba(255, 255, 255, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.06); margin-top: 60px;
    position: relative; z-index: 10;
}

.text-unit h2 + .sub-title,
.text-unit h2 + .inner-sub-title { margin-top: 0 !important; }

.noto-serif { font-family: 'Noto Serif JP', serif; font-weight: 300; }
.text-unit { padding: 50px 0; position: relative; z-index: 10; }
.text-unit h2 { font-size: 32px; font-weight: 600; margin: 0 0 30px 0; letter-spacing: 0.1em; line-height: 1.6; }
.text-unit p { font-size: 1.1rem; font-weight: 500; margin: 0; opacity: 0.9; max-width: 700px; line-height: 2.2; text-align: justify; }
.text-unit .paragraph-spacing { margin-bottom: 45px; }

.conversion-area { display: flex; flex-direction: column; gap: 20px; align-items: center; padding: 80px 0 100px; position: relative; z-index: 10; }
.btn-purchase {
    display: flex; align-items: end; justify-content: center; width: 100%; max-width: 400px; padding: 22px 20px;
    border-radius: 2px; text-decoration: none; font-family: 'Noto Serif JP', serif; font-size: 18px;
    letter-spacing: 0.15em; transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1); position: relative; overflow: hidden; box-sizing: border-box;
}
.btn-purchase.primary { background-color: #0a111a; color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); }
.btn-purchase.subscription { background-color: #ffffff; color: #bda16b; border: 1px solid #bda16b; }
.btn-purchase:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15); opacity: 0.9; }
.btn-purchase.subscription:hover { background-color: #bda16b; color: #ffffff; }

.purchase-group { display: flex; flex-direction: column; align-items: center; gap: 20px; width: 100%; }
.btn-purchase .type-word { font-size: 1.11em; }

.totop-button {
    position: fixed; right: 20px; bottom: 20px; width: 54px; height: 54px; background-color: #bda16b; color: #ffffff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; text-decoration: none; font-size: 10px; font-weight: 200;
    z-index: 9999; box-shadow: 0 2px 10px rgba(0,0,0,0.2); transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
    cursor: pointer; opacity: 0; visibility: hidden; text-align: center; line-height: 1.3; letter-spacing: 0.1em;
}
.totop-button.is-show { opacity: 1; visibility: visible; }



@media screen and (max-width: 768px) {
    .text-unit h2 { font-size: 28px; }
    .text-unit .sub-title, .text-unit .inner-sub-title { padding: 12px 10px; }
    .text-unit p { font-size: 1.0rem; }
    .btn-purchase { font-size: 16px; max-width: 90%; }
}

@media screen and (max-width: 378px) {
    .text-unit h2 { font-size: 26px; }
    .text-unit .inner-sub-title,
    .text-unit .sub-title, .text-unit .inner-sub-title { font-size: 19px;}
}

/* =============================================
   タブレット / PC レスポンシブ (768px以上)
   ============================================= */
@media (min-width: 768px) {
    .main-content {
        max-width: 960px;
        padding: 90px 55px 0;
    }

    .mergen-brand-box {
        right: 50px;
        bottom: 130px;
    }
    .mergen-logo-en { width: 240px; }
    .mergen-line    { width: 240px; }
    .mergen-logo-jp { width: 120px; }

    .mergen-message-area { font-size: 26px; }
    .mergen-image-box img { max-width: 740px; }

    .text-unit h2 {
        font-size: 32px;
        text-align: center;
        margin-bottom: 35px;
    }
    .text-unit .sub-title,
    .text-unit .inner-sub-title { font-size: 20px !important; }
    .text-unit .paragraph-spacing {
        margin-bottom: 50px;
    }

    .conversion-area {
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
        gap: 40px;
        padding: 80px 0 120px;
    }
    .purchase-group { width: auto; gap: 16px; }
    .btn-purchase { width: 280px; }

    .footer-kinchan-clip {
        top: -25px !important;
    }
    .footer-kinchan-left img {
        width: 80% !important;
    }
}

/* =============================================
   PC レスポンシブ (1024px以上)
   ============================================= */
@media (min-width: 1024px) {
    .main-content {
        padding: 120px 65px 0;
    }

    /* PC版TOPビジュアル: x_pro_m.png(750x470)の実比率に合わせて高さを自動算出し、クロップなしで全体を表示 */
    .top-visual-section {
        height: auto;
        aspect-ratio: 750 / 470;
        max-height: 100vh;
    }
    .top-visual-area {
        height: 100%;
        object-fit: contain;
    }

    .mergen-brand-box {
        right: 70px;
        bottom: 160px;
    }
    .mergen-logo-en { width: 300px; }
    .mergen-line    { width: 300px; }
    .mergen-logo-jp { width: 150px; }

    .mergen-message-area { font-size: 30px; }
    .mergen-image-box img { width: unset; max-width: 860px; }

    .text-unit {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    .text-unit h2 { font-size: 40px; }
    .text-unit .sub-title,
    .text-unit .inner-sub-title { font-size: 22px !important; }
    .text-unit p {
        max-width: 850px;
    }
    .text-unit .paragraph-spacing {
        margin-bottom: 75px;
    }
    .btn-purchase {
        width: 320px;
        font-size: 20px;
        padding: 24px 20px;
    }
    .conversion-area { gap: 50px; }
}