/* ============================================================
   fun.css — 초등 친화·미래지향 동적 레이어 (base.css 위에 추가 적용)
   과하지 않게: 교육청·교사 사용을 고려한 밝고 정돈된 모션
   ============================================================ */

/* ---------- 히어로: 애니메이션 그라데이션 + 떠다니는 도형 ---------- */
.hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(120deg, #eef4ff 0%, #f3edfb 30%, #e7f7f7 60%, #fdf0e3 100%);
    background-size: 300% 300%;
    animation: heroShift 18s ease-in-out infinite;
}
@keyframes heroShift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}
.hero .container { position: relative; z-index: 2; }

.float-shape {
    position: absolute;
    border-radius: 50%;
    opacity: .5;
    pointer-events: none;
    z-index: 1;
    animation: floatY 7s ease-in-out infinite;
}
.float-shape.s1 { width: 90px;  height: 90px;  right: 8%;  top: 14%; background: radial-gradient(circle at 30% 30%, #b4ccff, #2f6fed33); animation-delay: 0s; }
.float-shape.s2 { width: 56px;  height: 56px;  right: 22%; top: 58%; background: radial-gradient(circle at 30% 30%, #ffd9b8, #ff8a3d33); animation-delay: 1.4s; }
.float-shape.s3 { width: 38px;  height: 38px;  left: 6%;   top: 68%; background: radial-gradient(circle at 30% 30%, #c8f2ec, #0ea5a433); animation-delay: 2.6s; }
.float-shape.s4 { width: 26px;  height: 26px;  left: 14%;  top: 20%; background: radial-gradient(circle at 30% 30%, #f6d5ea, #d6458033); animation-delay: 3.4s; }
.float-emoji {
    position: absolute;
    font-size: 30px;
    opacity: .85;
    pointer-events: none;
    z-index: 1;
    animation: floatY 6s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(20,30,60,.12));
}
.float-emoji.e1 { right: 12%; top: 30%; animation-delay: .8s; font-size: 40px; }
.float-emoji.e2 { left: 8%;  top: 42%; animation-delay: 2s; }
.float-emoji.e3 { right: 30%; top: 12%; animation-delay: 3.2s; font-size: 24px; }
@keyframes floatY {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50%      { transform: translateY(-16px) rotate(3deg); }
}

/* ---------- 스크롤 리빌 ---------- */
.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity .6s ease, transform .6s cubic-bezier(.22,.9,.35,1.2);
}
.reveal.is-visible { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: .07s; }
.reveal.d2 { transition-delay: .14s; }
.reveal.d3 { transition-delay: .21s; }

/* ---------- 카드 인터랙션 ---------- */
.card.card-hover {
    transition: transform .25s cubic-bezier(.22,.9,.35,1.4), box-shadow .25s ease, border-color .25s ease;
}
.card.card-hover:hover {
    transform: translateY(-6px) scale(1.015);
    box-shadow: var(--shadow-lg);
    border-color: var(--c-brand-200);
}
.card .area-emoji {
    font-size: 30px;
    line-height: 1;
    display: inline-block;
    margin-bottom: 6px;
    transition: transform .3s cubic-bezier(.22,.9,.35,1.6);
}
.card.card-hover:hover .area-emoji { transform: scale(1.25) rotate(-6deg); }

/* ---------- 섹션 제목 언더라인 ---------- */
.tac h2, .container-narrow h1 {
    position: relative;
    display: inline-block;
}
.tac.mb-5 h2::after {
    content: "";
    display: block;
    margin: 10px auto 0;
    width: 64px;
    height: 5px;
    border-radius: 3px;
    background: linear-gradient(90deg, #2f6fed, #0ea5a4, #ff8a3d);
}

/* ---------- CTA 펄스 ---------- */
.header-actions .btn-accent {
    animation: ctaPulse 2.8s ease-in-out infinite;
}
@keyframes ctaPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,138,61,.45); }
    55%      { box-shadow: 0 0 0 9px rgba(255,138,61,0); }
}
.hero-cta .btn-accent { position: relative; }
.hero-cta .btn-accent:hover { transform: translateY(-2px) scale(1.03); }
.btn { transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }

/* ---------- 헤더 로고 마크 통통 ---------- */
.site-logo .mark { transition: transform .3s cubic-bezier(.22,.9,.35,1.6); }
.site-logo:hover .mark { transform: rotate(-8deg) scale(1.12); }

/* ---------- 진행바(검사 화면) 그라데이션 ---------- */
.progress > span {
    background: linear-gradient(90deg, #2f6fed, #0ea5a4) !important;
    transition: width .5s cubic-bezier(.22,.9,.35,1);
}

/* ---------- 숫자 스탯 강조 ---------- */
.hero-meta strong { color: var(--c-brand-600); }

/* ---------- Powered by ---------- */
.powered-by {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    letter-spacing: .4px;
    color: var(--c-text-mute);
    text-transform: uppercase;
}
.powered-by b { color: var(--c-text-soft); font-weight: 700; }

/* ---------- 히어로 3D 로고 ---------- */
.hero-logo3d {
    position: absolute;
    right: 6%;
    top: 50%;
    transform: translateY(-50%);
    width: clamp(150px, 22vw, 300px);
    z-index: 1;
    pointer-events: none;
    filter: drop-shadow(0 18px 30px rgba(20,30,60,.22));
    animation: logoFloat 6.5s ease-in-out infinite;
}
@keyframes logoFloat {
    0%, 100% { transform: translateY(-50%) rotate(-2.5deg); }
    50%      { transform: translateY(calc(-50% - 14px)) rotate(2.5deg); }
}
@media (max-width: 860px) {
    .hero-logo3d { display: none; }
}

/* ---------- 다크 히어로 (별자리 키비주얼 — 인터랙티브 레이어) ---------- */
.hero.hero-dark {
    background: #0a1130;
    animation: none;
    overflow: hidden;
}
.hero-art {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    aspect-ratio: 2804 / 1536;
    z-index: 0;
}
.hero-art img { display: block; }
.hero-art .art-sky {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.hero-art .art-plane { position: absolute; left: 38.34%; top: 9.77%;  width: 34.95%;
    animation: planeIdle 7s ease-in-out infinite; }
.hero-art .art-bull  { position: absolute; left: 11.41%; top: 14.97%; width: 17.65%; }
.hero-art .art-lion  { position: absolute; left: 75.25%; top: 31.90%; width: 22.82%; aspect-ratio: 640 / 485; }
.art-lion .lion-body { position: absolute; inset: 0; width: 100%; }
.art-lion .lion-jaw  { position: absolute; left: 37.19%; top: 30.93%; width: 10.62%;
    transform-origin: 92% 8%; }

/* 비행기: 평소 은은한 활공, 호버 시 하늘을 나는 스윙 */
@keyframes planeIdle {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-12px) rotate(1.6deg); }
}
@keyframes planeFly {
    0%   { transform: translate(0, 0) rotate(0deg); }
    30%  { transform: translate(26px, -34px) rotate(6deg); }
    55%  { transform: translate(6px, -14px) rotate(-2.5deg); }
    78%  { transform: translate(-14px, -26px) rotate(3deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}
.art-plane.anim {
    animation: planeFly 2.6s ease-in-out infinite;
    filter: brightness(1.15) drop-shadow(0 0 14px rgba(120, 220, 255, .45));
}

/* 황소: 호버 시 머리 흔들기 (머리 쪽 축) */
@keyframes bullShake {
    0%, 100% { transform: rotate(0deg); }
    18%  { transform: rotate(-5deg); }
    36%  { transform: rotate(4deg); }
    54%  { transform: rotate(-3.5deg); }
    72%  { transform: rotate(2.5deg); }
    88%  { transform: rotate(-1.2deg); }
}
.art-bull { transform-origin: 72% 30%; }
.art-bull.anim {
    animation: bullShake .9s ease-in-out infinite;
    filter: brightness(1.18) drop-shadow(0 0 12px rgba(120, 220, 255, .4));
}

/* 사자: 호버 시 몸 들썩 + 입 벌리기(포효) */
@keyframes lionMove {
    0%, 100% { transform: translateY(0) scale(1); }
    35%  { transform: translateY(-7px) scale(1.035) rotate(-1.2deg); }
    65%  { transform: translateY(-3px) scale(1.02) rotate(.8deg); }
}
@keyframes jawRoar {
    0%, 100% { transform: rotate(0deg); }
    25%  { transform: rotate(14deg); }
    45%  { transform: rotate(11deg); }
    62%  { transform: rotate(15deg); }
    82%  { transform: rotate(4deg); }
}
.art-lion.anim { animation: lionMove 1.6s ease-in-out infinite; }
.art-lion.anim .lion-body { filter: brightness(1.18) drop-shadow(0 0 14px rgba(120, 220, 255, .45)); }
.art-lion.anim .lion-jaw  { animation: jawRoar 1.6s ease-in-out infinite; }
.hero.hero-dark::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        rgba(8, 14, 40, .92) 0%, rgba(8, 14, 40, .72) 40%,
        rgba(8, 14, 40, .28) 72%, rgba(8, 14, 40, .05) 100%);
    z-index: 1;
}
.hero.hero-dark h1 { color: #ffffff; }
.hero.hero-dark .lead { color: #c7d4f2; }
.hero.hero-dark .badge {
    background: rgba(124, 196, 255, .14);
    color: #a8cbff;
    border: 1px solid rgba(124, 196, 255, .35);
}
.hero.hero-dark .lead strong { color: #ffd9a8; }
.hero.hero-dark .hero-meta { color: #8fa2cc; }
.hero.hero-dark .hero-meta strong { color: #7cc4ff; }
.hero.hero-dark .btn-outline {
    border-color: rgba(255, 255, 255, .45);
    color: #eaf1ff;
    background: rgba(255, 255, 255, .06);
}
.hero.hero-dark .btn-outline:hover { background: rgba(255, 255, 255, .14); }
.hero.hero-dark .float-shape,
.hero.hero-dark .float-emoji,
.hero.hero-dark .hero-logo3d { display: none; }
@media (max-width: 860px) {
    .hero.hero-dark { background-position: 68% center; }
    .hero.hero-dark::before {
        background: linear-gradient(180deg, rgba(8,14,40,.86) 0%, rgba(8,14,40,.62) 100%);
    }
}

/* ---------- 카드 상세 팝업 ---------- */
.modal-card { cursor: pointer; position: relative; padding-bottom: 40px !important; }
.modal-card .more-hint {
    position: absolute;
    right: 16px;
    bottom: 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--c-brand-500);
    opacity: .75;
    transition: opacity .2s ease, transform .2s ease;
}
.modal-card:hover .more-hint { opacity: 1; transform: translateX(2px); }

.ym-overlay {
    position: fixed;
    inset: 0;
    background: rgba(18, 26, 48, .55);
    backdrop-filter: blur(3px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: ymFade .22s ease;
}
.ym-overlay[hidden] { display: none; }
@keyframes ymFade { from { opacity: 0; } to { opacity: 1; } }
.ym-dialog {
    background: var(--c-bg, #fff);
    border-radius: var(--radius-lg, 16px);
    max-width: 560px;
    width: 100%;
    max-height: 82vh;
    overflow-y: auto;
    padding: 28px 26px 22px;
    position: relative;
    box-shadow: 0 30px 80px -20px rgba(20, 30, 60, .45);
    animation: ymPop .28s cubic-bezier(.22,.9,.35,1.35);
}
@keyframes ymPop { from { opacity: 0; transform: translateY(24px) scale(.96); } to { opacity: 1; transform: none; } }
.ym-dialog h3 { margin: 6px 0 12px; font-size: 19px; color: var(--c-brand-700, #1842a3); }
.ym-dialog p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.75; color: var(--c-text-soft, #4a536b); }
.ym-emoji { font-size: 40px; line-height: 1; }
.ym-close {
    position: absolute;
    top: 12px;
    right: 14px;
    border: none;
    background: var(--c-bg-mute, #eef0f5);
    color: var(--c-text-soft);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}
.ym-close:hover { background: #ffd9b8; transform: rotate(90deg); }

/* ---------- 모션 최소화 존중 ---------- */
@media (prefers-reduced-motion: reduce) {
    .hero, .float-shape, .float-emoji, .header-actions .btn-accent, .hero-logo3d,
    .art-plane, .art-bull, .art-lion, .lion-jaw { animation: none !important; }
    .reveal { opacity: 1; transform: none; transition: none; }
}
