/* css/topPage-hero.css */
/* ヒーローヘッダー（ファーストビュー）専用スタイル */

/* =========================================
   アニメーション定義 (Keyframes)
   ========================================= */

/* タイトル画像の登場：ハンコのように左上起点でドンと押す */
@keyframes stamp-in {
    0% {
        opacity: 0;
        /* 左上を起点に少し拡大した状態から */
        transform: scale(1.4);
        filter: blur(2px);
    }
    50% {
        opacity: 1;
        /* 勢いよく縮む（少し行き過ぎる） */
        transform: scale(0.95);
    }
    75% {
        /* 揺り戻し */
        transform: scale(1.03);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }
}

/* タイトル画像の退場：右へ流れる残像 */
@keyframes stamp-out {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0);
    }
    100% {
        opacity: 0;
        /* 右へ移動 + 進行方向に引き伸ばす(skew) + ぼかし */
        transform: translateX(80px) skewX(-20deg) scale(0.95);
        filter: blur(6px);
    }
}

/* サブタイトルの退場：左へ流れる残像 */
@keyframes slide-out-left {
    0% {
        opacity: 1;
        transform: translateX(0);
        filter: blur(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-60px) skewX(20deg);
        filter: blur(4px);
    }
}

/* サブタイトルの登場：下からふわっと */
@keyframes fade-up-in {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* その他 */
@keyframes blink {
    0%, 100% { border-color: #555; }
    50% { border-color: transparent; }
}
@keyframes progress-fill {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* =========================================
   パンくず黒いバーの変更
   ========================================= */
.indicator-subtitle {
    opacity: 1;
}

/* =========================================
   ヒーローセクション
   ========================================= */
.hero-section {
    padding: 45px 20px 115px;
    position: relative;
    border-bottom: none; 
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    overflow: visible;
    z-index: 6;
    transition: background-color 0.8s ease, color 0.8s ease;
}

@media screen and (min-width: 501px) {
.hero-section {
    margin-top: 35px;
	margin-bottom:40px;
    border-radius:25px;
}
}

/* テーマ別カラー */
.hero-section.theme-intro { background-color: #042138; color: #fff; }
.hero-section.theme-intro .sub-title { color: #fff; }

.hero-section.theme-card { background-color: #e3c51e; color: #000; }
.hero-section.theme-card .sub-title { color: #111; }

.hero-section.theme-quiz { background-color: #780707; color: #fff; }
.hero-section.theme-quiz .sub-title { color: #fff; }

.hero-section.theme-list { background-color: #48b4db; color: #000; }
.hero-section.theme-list .sub-title { color: #111; }

.hero-section.theme-details { background-color: #2eb875; color: #fff; }
.hero-section.theme-details .sub-title { color: #fff; }

/* =========================================
   コンテンツレイアウト
   ========================================= */
.hero-content {
    max-width: 500px;
    margin: 0 auto;
    position: relative;
    display: block;
    min-height: 260px;
}

.hero-text {
    position: relative;
    z-index: 2;
    padding-top: 0px;
    max-width: 90%;
    padding-bottom: 30px; 
}

/* --- タイトル画像 (Title Image) --- */
.hero-title-image-container {
    position: relative;
    width: calc(100% - 120px);
    height: 150px;
    margin-bottom: 10px;
}

.hero-title-img {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: contain;
    object-position: left top; /* 画像自体の配置も左上 */
    
    /* ★ここが重要：アニメーション(拡大縮小)の起点を左上に固定 */
    transform-origin: left top;

    /* 初期状態は非表示 */
    opacity: 0;
    pointer-events: none;
}

/* 登場時 (.active) */
.hero-title-img.active {
    opacity: 1;
    /* ハンコアニメーションを実行 */
    animation: stamp-in 0.6s cubic-bezier(0.2, 0.6, 0.35, 1) forwards;
}

/* 退場時 (.exit) */
.hero-title-img.exit {
    /* 右へ流れるアニメーションを実行 */
    animation: stamp-out 0.5s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

@media (max-width: 340px) {
    .hero-title-image-container { width: 100%; height: auto; aspect-ratio: 2 / 1; }
}

/* --- サブタイトル (Sub Title) --- */
.sub-title {
    font-size: 16px;
    width: calc(100% - 160px);
    font-weight: 700;
    margin: 0 0 0 4px;
    line-height: 1.6;
    min-height: 3.2em;
    opacity: 1;
    transform: translateY(0);
}

.hero-section.theme-intro .sub-title {
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

/* サブタイトル退場 (.fade-out) */
.sub-title.fade-out {
    animation: slide-out-left 0.4s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

/* サブタイトル登場 (.fade-in) */
.sub-title.fade-in {
    animation: fade-up-in 0.5s ease-out forwards;
}

/* --- 進捗バー --- */
.hero-progress-indicators {
    position: absolute;
    bottom: 20px; 
    left: 24px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
}
.progress-bar {
    position: relative;
    height: 12px;
    width: 12px;
    border-radius: 10px;
    background: transparent;
    overflow: hidden;
    transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
.progress-bar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: currentColor;
    opacity: 0.2;
    border-radius: 10px;
}
.progress-bar::after {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 0%;
    background-color: currentColor;
    opacity: 1;
    border-radius: 10px;
}
.progress-bar.active { width: 75px; }
.progress-bar.active::after {
    animation: progress-fill 4.8s linear forwards;
}

/* --- キャラクター画像 --- */
.hero-character-container {
    position: absolute;
    z-index: 1;
    right: -25px;
    bottom: -165px;
    width: 260px;
    height: 280px;
    z-index:5;
}
@media screen and (min-width: 501px) {
.hero-character-container {
    right: -65px;
    bottom: -150px;
}
}

.hero-char-img {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: bottom right;
    
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 1, 0.3, 1);
}

.hero-char-img.active {
    opacity: 1;
}

/* --- 吹き出し --- */
.speech-bubble {
    position: absolute;
    bottom: 75px;
    right: 25px;
    z-index: 5;
    background-color: #fff;
    border-radius: 50px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1), 0 6px #d6d6d6;
    width: 155px;
    height: 55px;
    padding: 0 10px 0 15px;
    box-sizing: border-box;
    display: flex;
    align-items: center; 
}
.speech-bubble p {
    font-size: 14px;
    font-weight: 700;
    color: #444;
    margin: 0;
    padding: 0;
    line-height: 1.25;
    text-align: left;
    width: 100%;
}
.speech-bubble::after {
    content: '';
    position: absolute;
    /* 高さが20pxなので、底辺に合わせるために -20px */
    bottom: -25px;
    /* 位置調整（お好みで微調整してください） */
    left: 40px;
    
    /* 指定されたサイズ */
    width: 40px;
    height: 25px;
    
    /* 画像読み込み */
    background-image: url('../images/topPage-balloon_tail.svg');
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center top;

    /* 以前のCSS三角形の設定をリセット */
    border: none;
    
}
.typing-text {
    border-right: 2px solid #555;
    padding-right: 2px;
    animation: blink 0.7s infinite;
}

@media screen and (min-width: 501px) {
.speech-bubble {
    bottom: 90px;
    right: -5px;
}
}
