/* ==========================================================
   입체감과 움직임 (style.css 다음에 불러온다)
   눈길이 필요한 곳, 손으로 누르는 곳에만 넣는다.
   ========================================================== */

/* ---- 카드: 두 겹 그림자로 살짝 떠 있는 느낌 ---- */
.card { box-shadow: 0 1px 2px rgba(80, 60, 30, 0.06), 0 6px 18px rgba(80, 60, 30, 0.07); }

/* ---- 스크롤 등장 ---- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.reveal.in { opacity: 1; transform: none; }

/* ---- 기본 버튼: 입체 + 누르면 쑥 들어감 ---- */
.btn {
  position: relative; overflow: hidden;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(0, 0, 0, 0.08));
  box-shadow: 0 6px 16px rgba(139, 46, 46, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -2px 0 rgba(0, 0, 0, 0.15);
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 2px 6px rgba(139, 46, 46, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.2); }
.btn.ghost { background-image: none; box-shadow: none; }
.btn.ghost:active { transform: translateY(1px); background: rgba(139, 46, 46, 0.05); }
.btn.gold { box-shadow: 0 6px 16px rgba(201, 162, 75, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -2px 0 rgba(0, 0, 0, 0.12); }
/* 첫 화면 '사주 보기'처럼 가장 중요한 버튼에만 빛이 스쳐가는 효과 */
.btn.shine::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: skewX(-20deg); animation: sweep 3.2s ease-in-out infinite;
}

/* ---- 성별·양력/음력 선택: 고르면 쑥 눌린 버튼처럼 ---- */
.choices span { transition: background 0.15s, box-shadow 0.15s, transform 0.1s; box-shadow: 0 2px 0 #e6dccb; }
.choices input:checked + span {
  background-image: linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.06));
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.25); transform: translateY(1px);
}

/* ---- 사주 글자 타일: 도장·패처럼 입체 ---- */
.pillars td, .flow-gz span { position: relative; }
.pillars td {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -4px 0 rgba(0, 0, 0, 0.18), 0 4px 10px rgba(40, 25, 10, 0.18);
}
.pillars td::before, .flow-gz span::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, 0.08) 100%);
}
.pillars td > * { position: relative; }
.pillars .hanja { text-shadow: 0 2px 3px rgba(0, 0, 0, 0.25); }
.flow-gz span { box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 2px 4px rgba(40, 25, 10, 0.15); }
.gz { box-shadow: 0 3px 8px rgba(60, 40, 20, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.gz i { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.06)); }

/* 결과 화면 사주 표: 한 글자씩 뒤집히며 등장 */
/* 투명에서 시작하지 않는다: 효과가 멈춰도 글자는 항상 보이게 */
@keyframes tileIn { from { transform: perspective(400px) rotateX(-55deg) translateY(-6px); } }
.reveal.in .pillars td { animation: tileIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.reveal.in .pillars tr:nth-child(2) td:nth-child(1) { animation-delay: 0.05s; }
.reveal.in .pillars tr:nth-child(2) td:nth-child(2) { animation-delay: 0.12s; }
.reveal.in .pillars tr:nth-child(2) td:nth-child(3) { animation-delay: 0.19s; }
.reveal.in .pillars tr:nth-child(2) td:nth-child(4) { animation-delay: 0.26s; }
.reveal.in .pillars tr:nth-child(3) td:nth-child(1) { animation-delay: 0.33s; }
.reveal.in .pillars tr:nth-child(3) td:nth-child(2) { animation-delay: 0.40s; }
.reveal.in .pillars tr:nth-child(3) td:nth-child(3) { animation-delay: 0.47s; }
.reveal.in .pillars tr:nth-child(3) td:nth-child(4) { animation-delay: 0.54s; }

/* ---- 막대 그래프: 화면에 들어오면 왼쪽부터 차오름 ---- */
.reveal .bar, .reveal .mini-bar, .reveal .trait-bar i.on { transform: scaleX(0); transform-origin: left center; }
.reveal.in .bar, .reveal.in .mini-bar, .reveal.in .trait-bar i.on { transform: scaleX(1); transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s; }
.bar, .mini-bar { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3); }

/* ---- 상품 목록: 마우스를 올리면 살짝 떠오르고, 누르면 들어감 ---- */
.menu-item { transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
@media (hover: hover) {
  .menu-item:not(.is-current):hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25); border-color: rgba(201, 162, 75, 0.7); }
}
.menu-item:not(.is-current):active { transform: translateY(1px) scale(0.99); }

/* ---- 페이지 머리 메달: 천천히 떠 있는 느낌 ---- */
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.hero-medal { animation: float 4.5s ease-in-out infinite; }

/* ---- 키워드 칩: 하나씩 톡톡 등장 ---- */
@keyframes pop { from { transform: scale(0.85) translateY(6px); } }
.reveal.in .r-kw { animation: pop 0.45s cubic-bezier(0.3, 1.4, 0.5, 1) both; }
.reveal.in .r-kw:nth-child(2) { animation-delay: 0.12s; }
.reveal.in .r-kw:nth-child(3) { animation-delay: 0.24s; }
.reveal.in .r-kw:nth-child(4) { animation-delay: 0.36s; }

/* ---- '지금' 표시: 은은하게 숨 쉬듯 빛남 ---- */
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(139, 46, 46, 0.45); } 50% { box-shadow: 0 0 0 5px rgba(139, 46, 46, 0); } }
.flow-age em, .sy.now { animation: glow 2.4s ease-in-out infinite; }
.chart tr.now .lbl small { display: inline-block; border-radius: 4px; padding: 0 4px; background: var(--accent); color: #fff; animation: glow 2.4s ease-in-out infinite; }

/* ---- 움직임 줄이기 설정을 켠 사람에게는 효과 없이 ---- */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .reveal .bar, .reveal .mini-bar, .reveal .trait-bar i.on { transform: none; }
  .hero-medal, .btn.shine::after, .flow-age em, .sy.now, .chart tr.now .lbl small, .best-ribbon { animation: none; }
  .reveal.in .pillars td, .reveal.in .r-kw { animation: none; }
}
@media print { .reveal { opacity: 1 !important; transform: none !important; } }
