/* =========================================================
   라이브운세 — 동양 신비 배경 시스템
   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 안에 8~12개 .bg-floating-item 을 위치별로 깔고
   각 아이템에 다른 애니메이션 딜레이/속도 부여해 자연스러운 군무 효과. */
.bg-floating-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}
.bg-floating-item {
    position: absolute;
    font-size: 2.2rem;
    opacity: 0.22;
    filter: drop-shadow(0 1px 2px 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.18; }
    25%  { transform: translate(20px, -30px) rotate(8deg);  opacity: 0.28; }
    50%  { transform: translate(-15px, -55px) rotate(-6deg); opacity: 0.22; }
    75%  { transform: translate(25px, -25px) rotate(10deg); opacity: 0.30; }
    100% { transform: translate(0, 0)      rotate(0deg);   opacity: 0.18; }
}

/* 위치·속도·딜레이 분산 — 12개 슬롯 */
.bg-floating-item:nth-child(1)  { top:  6%; left:  8%;  font-size: 2.4rem; animation-delay:  0s;  animation-duration: 30s; }
.bg-floating-item:nth-child(2)  { top: 18%; left: 78%;  font-size: 2.0rem; animation-delay: -4s;  animation-duration: 35s; }
.bg-floating-item:nth-child(3)  { top: 28%; left: 35%;  font-size: 1.8rem; animation-delay: -8s;  animation-duration: 28s; opacity: 0.16; }
.bg-floating-item:nth-child(4)  { top: 42%; left: 12%;  font-size: 2.6rem; animation-delay: -2s;  animation-duration: 38s; }
.bg-floating-item:nth-child(5)  { top: 50%; left: 88%;  font-size: 2.0rem; animation-delay: -12s; animation-duration: 33s; }
.bg-floating-item:nth-child(6)  { top: 60%; left: 50%;  font-size: 1.6rem; animation-delay: -6s;  animation-duration: 26s; opacity: 0.14; }
.bg-floating-item:nth-child(7)  { top: 70%; left: 22%;  font-size: 2.2rem; animation-delay: -10s; animation-duration: 36s; }
.bg-floating-item:nth-child(8)  { top: 78%; left: 70%;  font-size: 2.0rem; animation-delay: -14s; animation-duration: 30s; }
.bg-floating-item:nth-child(9)  { top: 86%; left: 40%;  font-size: 1.8rem; animation-delay: -3s;  animation-duration: 34s; opacity: 0.18; }
.bg-floating-item:nth-child(10) { top: 12%; left: 55%;  font-size: 1.6rem; animation-delay: -16s; animation-duration: 27s; opacity: 0.15; }
.bg-floating-item:nth-child(11) { top: 36%; left: 65%;  font-size: 2.0rem; animation-delay: -7s;  animation-duration: 32s; }
.bg-floating-item:nth-child(12) { top: 64%; left:  5%;  font-size: 1.8rem; animation-delay: -11s; animation-duration: 29s; opacity: 0.16; }

/* ── 모바일: 이모지 개수·크기 조절 (성능·가독성) ── */
@media (max-width: 768px) {
    .bg-floating-item { font-size: 1.6rem; opacity: 0.16; }
    .bg-floating-item:nth-child(n+9) { display: none; }   /* 8개로 줄임 */
    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;
}
