/* ============================================================
   animations.css — 習い事パスポート | Global Animations
   ============================================================ */

/* ============================================================
   1. スクロール進捗バー
   ============================================================ */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--ims-primary) 0%, var(--ims-accent) 60%, var(--green-disco) 100%);
    z-index: 9999;
    transition: width 0.1s linear;
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 8px rgba(0, 149, 217, 0.5);
}

/* ============================================================
   2. Back-to-top ボタン
   ============================================================ */
#back-to-top {
    position: fixed;
    bottom: 32px;
    right: 28px;
    width: 48px;
    height: 48px;
    background: var(--charcoal);
    color: #fff;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    z-index: 900;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: opacity 0.3s, transform 0.3s, background 0.2s;
    pointer-events: none;
}
#back-to-top.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
#back-to-top:hover {
    background: var(--ims-primary);
    transform: translateY(-2px) scale(1.05);
}

/* ============================================================
   3. Toast 通知システム
   ============================================================ */
#toast-container {
    position: fixed;
    bottom: 28px;
    right: 24px;
    z-index: 9990;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 380px;
    padding: 14px 18px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    font-weight: 700;
    font-size: 14px;
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.3s, transform 0.3s;
}
.toast.visible {
    opacity: 1;
    transform: translateX(0);
}
.toast-success { background: #EDFFF7; color: var(--charcoal); border-color: var(--green-disco); }
.toast-success i { color: var(--green-disco); }
.toast-error   { background: #FFF0F0; color: var(--charcoal); border-color: var(--red-active); }
.toast-error   i { color: var(--red-active); }
.toast-info    { background: #EAF6FD; color: var(--charcoal); border-color: var(--ims-primary); }
.toast-info    i { color: var(--ims-primary); }
.toast-warning { background: #FFFBEA; color: var(--charcoal); border-color: var(--gold-certified); }
.toast-warning i { color: #B8860B; }
.toast-msg { flex: 1; }
.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 16px;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}
.toast-close:hover { color: var(--charcoal); }

@media (max-width: 480px) {
    #toast-container { left: 16px; right: 16px; bottom: 20px; }
    .toast { min-width: auto; max-width: 100%; }
    #back-to-top { bottom: 80px; right: 16px; }
}

/* ============================================================
   4. リップルエフェクト（ボタン）
   ============================================================ */
.ripple-wave {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    pointer-events: none;
    animation: ripple-anim 0.55s ease-out forwards;
}
@keyframes ripple-anim {
    from { opacity: 0.8; transform: scale(0); }
    to   { opacity: 0;   transform: scale(1); }
}

/* ============================================================
   5. スクロール登場アニメーション（Intersection Observer）
   ============================================================ */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity  0.55s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   6. ヘッダー スクロール変化
   ============================================================ */
header.scrolled {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10) !important;
}
header.scrolled .header-main {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}
header { transition: box-shadow 0.3s; }
.header-main { transition: padding 0.25s; }

/* ============================================================
   7. ページ遷移フェード
   ============================================================ */
@keyframes fadeInPage {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.page-fade-in {
    animation: fadeInPage 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ============================================================
   8. スケルトンローダー（汎用）
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
    border-radius: 6px;
}
@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   9. フォーム — 入力フィールド フォーカス演出
   ============================================================ */
.form-group { position: relative; }

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--ims-primary) !important;
    box-shadow: 0 0 0 3px rgba(0, 149, 217, 0.15) !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* ============================================================
   10. ヒーロー 統計バー
   ============================================================ */
.hero-stats {
    display: flex;
    gap: 32px;
    margin-top: 32px;
    padding-top: 28px;
    border-top: 2px dashed rgba(46, 46, 46, 0.15);
    flex-wrap: wrap;
}
.hero-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.hero-stat-num {
    font-size: clamp(26px, 3vw, 34px);
    font-weight: 900;
    color: var(--charcoal);
    letter-spacing: -0.02em;
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 2px;
}
.hero-stat-num .unit {
    font-size: 16px;
    font-weight: 900;
    color: var(--ims-primary);
    margin-left: 2px;
}
.hero-stat-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-light);
    letter-spacing: 0.05em;
}
.hero-stat-sep {
    width: 1px;
    background: #D1D5DB;
    align-self: stretch;
    margin: 4px 0;
}

/* ============================================================
   11. フッター 信頼数値バー
   ============================================================ */
.footer-stats-bar {
    background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 100%);
    border-top: 4px solid var(--ims-primary);
    padding: 40px 24px;
}
.footer-stats-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    text-align: center;
}
.footer-stats-item {
    padding: 20px;
}
.footer-stat-num {
    font-size: 36px;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 6px;
}
.footer-stat-num .unit {
    font-size: 18px;
    color: var(--ims-primary);
    margin-left: 2px;
}
.footer-stat-label {
    font-size: 13px;
    color: #9CA3AF;
    font-weight: 700;
}

/* ============================================================
   12. focus-visible（キーボード操作用）
   ============================================================ */
:focus-visible {
    outline: 3px solid var(--ims-primary);
    outline-offset: 3px;
}
:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================================
   13. テキスト選択スタイル
   ============================================================ */
::selection {
    background: rgba(0, 149, 217, 0.2);
    color: var(--charcoal);
}

/* ============================================================
   14. スクロールバースタイル
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f0f0f0; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ims-primary); }

/* ============================================================
   15. カード ホバー強化（グロー）
   ============================================================ */
.class-card:hover,
.large-blog-card:hover,
.child-card:hover {
    box-shadow: 4px 4px 0 var(--ims-primary) !important;
    border-color: var(--ims-primary) !important;
    transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

/* ============================================================
   16. モバイル対応
   ============================================================ */
@media (max-width: 768px) {
    .hero-stats { gap: 20px; }
    .footer-stats-inner { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .footer-stat-num { font-size: 28px; }
}
