/* =========================================================
   비룡운세 — 동양 신비 배경 시스템
   1) 한지 그라디언트 (베이스)
   2) 기와 패턴 (은은한 굽이치는 처마 골)
   3) 떠다니는 운세 이모지 (✨🌙🔮🃏📜🪷🐉☯)
   ========================================================= */

/* ── 1. 한지 베이스 ── */
html, body {
    background-color: #fdfaf3;
}
body {
    background:
        radial-gradient(ellipse at 18% 0%,   rgba(212, 175, 55, 0.07) 0%, transparent 40%),
        radial-gradient(ellipse at 82% 100%, rgba(61, 53, 40, 0.08)  0%, transparent 45%),
        radial-gradient(ellipse at 50% 60%,  rgba(255, 245, 230, 0.5) 0%, transparent 70%),
        linear-gradient(180deg, #fdfaf3 0%, #f6efe2 50%, #ece5dd 100%);
    background-attachment: fixed;
    background-size: 100% 100%;
    position: relative;
    isolation: isolate;
}

/* ── 2. 기와 패턴 (굽이치는 처마 골) ──
   화면 전체에 깔리는 fixed 레이어. 두 줄 골이 미세하게 어긋나 자연스러운 반복.
   opacity 매우 낮게(0.05) 둬서 본문 가독성 보존. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='80' viewBox='0 0 160 80'><g fill='none' stroke='%235a4520' stroke-width='1.2' stroke-linecap='round'><path d='M0,18 Q20,8 40,18 T80,18 T120,18 T160,18'/><path d='M-10,40 Q10,30 30,40 T70,40 T110,40 T150,40 T190,40'/><path d='M0,62 Q20,52 40,62 T80,62 T120,62 T160,62'/></g></svg>");
    background-size: 160px 80px;
    background-repeat: repeat;
    opacity: 0.055;
    pointer-events: none;
    z-index: -2;
}

/* ── 3. 동양 신비 배경 요소 (비룡 워터마크 & 구름) ── */
.bg-floating-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

/* --- 비룡 (Flying Dragon) 워터마크 --- */
.dragon-watermark-wrap {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150vw;
    height: 150vh;
    transform-origin: center center;
    /* 천천히 회전하며 위아래로 유영하는 베이스 애니메이션 */
    animation: dragonSwim 60s ease-in-out infinite alternate;
}
.dragon-watermark {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* 필터를 사용하여 먹색/골드 워터마크 느낌을 냄 */
    filter: sepia(0.8) hue-rotate(10deg) saturate(1.5) brightness(1.2) contrast(0.8) opacity(0.06);
    /* 용 자체가 미세하게 꿈틀거리는 효과 */
    animation: dragonBreathe 12s ease-in-out infinite alternate;
}

@keyframes dragonSwim {
    0% { transform: translate(-50%, -50%) rotate(-5deg) scale(0.9); }
    50% { transform: translate(-45%, -55%) rotate(5deg) scale(1.05); }
    100% { transform: translate(-55%, -45%) rotate(-2deg) scale(1); }
}
@keyframes dragonBreathe {
    0% { transform: scale(1); filter: sepia(0.8) hue-rotate(10deg) saturate(1.5) brightness(1.2) contrast(0.8) opacity(0.05); }
    100% { transform: scale(1.02); filter: sepia(0.8) hue-rotate(15deg) saturate(1.8) brightness(1.3) contrast(0.8) opacity(0.08); }
}

/* --- 안개 구름 (CSS Clouds) --- */
.cloud {
    position: absolute;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    filter: blur(20px);
    opacity: 0.5;
    animation: cloudDrift linear infinite;
    will-change: transform;
}
.cloud-1 { width: 400px; height: 150px; top: 10%; left: -200px; animation-duration: 45s; }
.cloud-2 { width: 500px; height: 200px; top: 40%; left: -250px; animation-duration: 60s; animation-delay: -15s; background: radial-gradient(ellipse at center, rgba(212, 175, 55, 0.15) 0%, rgba(255,255,255,0) 70%); }
.cloud-3 { width: 350px; height: 120px; top: 70%; left: -150px; animation-duration: 35s; animation-delay: -5s; }
.cloud-4 { width: 600px; height: 250px; top: 85%; left: -300px; animation-duration: 70s; animation-delay: -25s; }

@keyframes cloudDrift {
    0% { transform: translateX(0); }
    100% { transform: translateX(120vw); }
}

/* --- 보조 이모지 (구름, 별 등) --- */
.bg-floating-item {
    position: absolute;
    font-size: 2rem;
    opacity: 0.3;
    filter: drop-shadow(0 2px 4px rgba(61, 53, 40, 0.15));
    animation: mysticDrift 32s ease-in-out infinite;
    will-change: transform, opacity;
    user-select: none;
}
@keyframes mysticDrift {
    0%   { transform: translate(0, 0)      rotate(0deg);   opacity: 0.2; }
    25%  { transform: translate(20px, -30px) rotate(8deg);  opacity: 0.4; }
    50%  { transform: translate(-15px, -55px) rotate(-6deg); opacity: 0.2; }
    75%  { transform: translate(25px, -25px) rotate(10deg); opacity: 0.4; }
    100% { transform: translate(0, 0)      rotate(0deg);   opacity: 0.2; }
}

.bg-floating-item:nth-child(3) { top: 15%; left: 15%; font-size: 2.8rem; animation-delay: 0s;  animation-duration: 25s; }
.bg-floating-item:nth-child(4) { top: 25%; left: 80%; font-size: 2.2rem; animation-delay: -5s; animation-duration: 30s; }
.bg-floating-item:nth-child(5) { top: 60%; left: 10%; font-size: 2.5rem; animation-delay: -10s;animation-duration: 28s; }
.bg-floating-item:nth-child(6) { top: 40%; left: 70%; font-size: 1.8rem; animation-delay: -2s; animation-duration: 22s; }
.bg-floating-item:nth-child(7) { top: 80%; left: 85%; font-size: 2.4rem; animation-delay: -8s; animation-duration: 35s; }
.bg-floating-item:nth-child(8) { top: 75%; left: 25%; font-size: 2.0rem; animation-delay: -12s;animation-duration: 26s; }

/* ── 모바일: 워터마크 크기 조절 및 구름 개수 축소 ── */
@media (max-width: 768px) {
    .dragon-watermark-wrap {
        width: 250vw;
        height: 250vh;
    }
    .dragon-watermark {
        opacity: 0.08;
    }
    .cloud-3, .cloud-4 { display: none; }
    .bg-floating-item { font-size: 1.8rem; }
    body::before { opacity: 0.045; background-size: 120px 60px; }
}

/* ── 사용자 모션 줄이기 설정 존중 ── */
@media (prefers-reduced-motion: reduce) {
    .bg-floating-item { animation: none; opacity: 0.18; }
}

/* ── 본문 컨텐츠는 배경 위에 ──
   ⚠️ .header_wrap, .bottom-nav 는 이미 position:fixed 라 절대 건드리지 않는다.
   배경 레이어가 z-index: -1/-2 라서 일반 흐름 요소는 자동으로 위에 표시됨. */
.contents {
    position: relative;
    z-index: 0;
}
