/* =========================================================
   디테일랩 카케어 — 보조 CSS
   본문은 Tailwind utility 중심. 여기에는 full-bleed/overflow/
   슬라이더·애니메이션 보정 등 예외 보조만 둔다.
   ========================================================= */

:root { --primary: #2563eb; --accent: #06b6d4; }

html, body { overflow-x: clip; }
html { scroll-behavior: smooth; }
body { font-family: "Pretendard Variable", Pretendard, "Noto Sans KR", sans-serif; }
.font-eng { font-family: "Inter", "Pretendard Variable", sans-serif; }

/* 그리드 함정 방지: 자식 min-width 0 */
[class*="grid-cols"] > * { min-width: 0; }

/* ===== Page Loader ===== */
.page-loader {
  position: fixed; inset: 0; z-index: 9999; background: #111;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.page-loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-text { font-size: 7vw; font-weight: 900; color: #fff; letter-spacing: -0.03em; }
@media (min-width: 768px) { .loader-text { font-size: 3vw; } }
.loader-bar { position: absolute; bottom: 0; left: 0; height: 3px; background: var(--primary); width: 0; transition: width 0.3s ease; }

/* ===== Custom Cursor ===== */
.cursor-dot {
  width: 8px; height: 8px; background: var(--primary); border-radius: 50%;
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9998;
  transition: transform 0.15s ease, opacity 0.3s ease; mix-blend-mode: difference;
}
.cursor-ring {
  width: 40px; height: 40px; border: 1.5px solid rgba(37,99,235,0.5); border-radius: 50%;
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9997;
  transition: width 0.3s ease, height 0.3s ease, border-color 0.3s ease;
  transform: translate(-50%, -50%);
}
.cursor-dot.hovering { transform: translate(-50%,-50%) scale(3); }
.cursor-ring.hovering { width: 60px; height: 60px; border-color: rgba(37,99,235,0.8); }
@media (max-width: 768px), (pointer: coarse) { .cursor-dot, .cursor-ring { display: none !important; } }

/* ===== Scroll Reveal ===== */
[data-reveal] {
  opacity: 0; transform: translateY(50px);
  transition: opacity 0.9s cubic-bezier(0.16,1,0.3,1), transform 0.9s cubic-bezier(0.16,1,0.3,1);
}
[data-reveal].revealed { opacity: 1; transform: translateY(0); }
[data-reveal="left"] { transform: translateX(-60px); }
[data-reveal="left"].revealed { transform: translateX(0); }
[data-reveal="right"] { transform: translateX(60px); }
[data-reveal="right"].revealed { transform: translateX(0); }
[data-reveal="scale"] { transform: scale(0.9); opacity: 0; }
[data-reveal="scale"].revealed { transform: scale(1); opacity: 1; }
[data-reveal="fade"] { transform: none; }
[data-reveal="clipX"] { clip-path: inset(0 100% 0 0); transform: none; opacity: 1; transition: clip-path 1.2s cubic-bezier(0.16,1,0.3,1); }
[data-reveal="clipX"].revealed { clip-path: inset(0 0 0 0); }

/* Stagger */
[data-stagger] > * { opacity: 0; transform: translateY(30px); transition: opacity 0.7s cubic-bezier(0.16,1,0.3,1), transform 0.7s cubic-bezier(0.16,1,0.3,1); }
[data-stagger].revealed > * { opacity: 1; transform: translateY(0); }

/* Hero text */
.hero-line { overflow: hidden; }
.hero-line > span { display: inline-block; opacity: 0; transform: translateY(110%); transition: opacity 0.8s cubic-bezier(0.16,1,0.3,1), transform 0.8s cubic-bezier(0.16,1,0.3,1); }
.hero-line.revealed > span { opacity: 1; transform: translateY(0); }

/* ===== Marquee ===== */
.marquee { display: flex; overflow: clip; white-space: nowrap; }
.marquee-inner { display: flex; animation: marqueeScroll 25s linear infinite; }
.mq-word { flex-shrink: 0; padding: 0 2vw; font-size: 11vw; font-weight: 900; line-height: 1; letter-spacing: -0.04em; color: rgba(255,255,255,0.03); }
@media (min-width: 768px) { .mq-word { font-size: 6vw; } }
@keyframes marqueeScroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.marquee:hover .marquee-inner { animation-play-state: paused; }

/* ===== Magnetic Button ===== */
.magnetic-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; transition: transform 0.3s cubic-bezier(0.16,1,0.3,1), background 0.3s ease, color 0.3s ease; }

/* ===== Misc hover ===== */
.img-zoom { overflow: hidden; }
.img-zoom img { transition: transform 0.8s cubic-bezier(0.16,1,0.3,1); }
.img-zoom:hover img { transform: scale(1.08); }
.svc-row { transition: padding-left 0.5s cubic-bezier(0.16,1,0.3,1), background 0.3s ease; }
.svc-row:hover { padding-left: 1.5rem; background: rgba(37,99,235,0.02); }
.link-slide { position: relative; }
.link-slide::after { content:''; position:absolute; bottom:-2px; left:0; width:0; height:1px; background:var(--primary); transition: width 0.4s cubic-bezier(0.16,1,0.3,1); }
.link-slide:hover::after { width: 100%; }
.text-stroke { -webkit-text-stroke: 1.5px #111; color: transparent; }

/* ===== Scroll progress ===== */
.scroll-progress { position: fixed; top: 0; left: 0; height: 2px; background: var(--primary); z-index: 9999; width: 0; }

/* ===== Grain Overlay ===== */
.grain::after {
  content: ''; position: fixed; inset: -50%; width: 200%; height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 9990; opacity: 0.3;
}

/* ===== Scroll Hint ===== */
.scroll-hint-anim { animation: scrollDrop 2.5s ease-in-out infinite; }
@keyframes scrollDrop { 0%{ opacity:0; transform:scaleY(0); transform-origin:top; } 40%{ opacity:1; transform:scaleY(1); } 100%{ opacity:0; transform:scaleY(1); transform-origin:bottom; } }

/* ===== Beyond bg text ===== */
.beyond-bg-text { animation: beyondSlide 30s linear infinite; will-change: transform; }
@keyframes beyondSlide { 0%{transform:translateX(0)} 100%{transform:translateX(-50%)} }

/* ===== Process Section ===== */
.process-card { transition: transform 0.5s cubic-bezier(0.16,1,0.3,1), background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease; }
.process-card:hover { transform: translateY(-4px); }

.process-card:nth-child(1) { animation: pcPulse 8s ease-in-out 0s infinite; }
.process-card:nth-child(2) { animation: pcPulse 8s ease-in-out 1s infinite; }
.process-card:nth-child(3) { animation: pcPulse 8s ease-in-out 2s infinite; }
.process-card:nth-child(4) { animation: pcPulse 8s ease-in-out 3s infinite; }
.process-card:nth-child(5) { animation: pcPulse 8s ease-in-out 4s infinite; }
.process-card:nth-child(6) { animation: pcPulse 8s ease-in-out 5s infinite; }
.process-card:nth-child(7) { animation: pcPulse 8s ease-in-out 6s infinite; }
.process-card:nth-child(8) { animation: pcPulse 8s ease-in-out 7s infinite; }
@keyframes pcPulse {
  0%, 8% { border-color: rgba(255,255,255,0.06); background: rgba(255,255,255,0.03); box-shadow: none; }
  12.5% { border-color: rgba(37,99,235,0.4); background: rgba(37,99,235,0.08); box-shadow: 0 0 30px rgba(37,99,235,0.15), inset 0 1px 0 rgba(37,99,235,0.1); }
  25%, 100% { border-color: rgba(255,255,255,0.06); background: rgba(255,255,255,0.03); box-shadow: none; }
}

.process-progress { animation: processBarLoop 8s linear infinite; }
@keyframes processBarLoop { 0% { width: 0; } 100% { width: 100%; } }

.bubble {
  position: absolute; bottom: -20px; width: 14px; height: 14px;
  border: 1.5px solid rgba(37,99,235,0.25); border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(37,99,235,0.12), transparent);
  animation: bubbleUp linear infinite;
}
.bubble.sm { width: 8px; height: 8px; border-color: rgba(6,182,212,0.2); }
@keyframes bubbleUp {
  0% { transform: translateY(0) scale(0.5); opacity: 0; }
  10% { opacity: 0.7; transform: translateY(-5vh) scale(1); }
  40% { opacity: 0.5; transform: translateY(-40vh) scale(1.1); }
  70% { opacity: 0.3; }
  100% { transform: translateY(-110vh) scale(0.6); opacity: 0; }
}

.water-stream {
  position: absolute; top: -10%; width: 1px; height: 25%;
  background: linear-gradient(to bottom, transparent, rgba(37,99,235,0.12), rgba(6,182,212,0.08), transparent);
  animation: streamFall 5s ease-in infinite;
}
@keyframes streamFall {
  0% { transform: translateY(-100%); opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 0.4; }
  100% { transform: translateY(500%); opacity: 0; }
}

/* ===== Mobile bottom bar safe area ===== */
.safe-bottom { padding-bottom: max(10px, env(safe-area-inset-bottom)); }

/* ===== body scroll lock (mobile menu) ===== */
body.menu-open { overflow: hidden; }

/* ===== 패밀리사이트 셀렉트 ===== */
.family-wrap { position: relative; }
.family-select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  width: 100%; padding: 0.7rem 2.2rem 0.7rem 1rem;
  font-size: 0.8125rem; color: #374151; background: #fff;
  border: 1px solid #e5e7eb; border-radius: 0.625rem; cursor: pointer;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.family-select:hover { border-color: var(--primary); }
.family-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.family-icon { position: absolute; right: 0.9rem; top: 50%; transform: translateY(-50%); font-size: 0.7rem; color: #9ca3af; pointer-events: none; }

/* ===== 진입 팝업 ===== */
.popup-overlay {
  position: fixed; inset: 0; z-index: 9996;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: rgba(17,17,17,0.6);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  animation: popupFade 0.3s ease;
}
.popup-overlay.hidden { display: none; }
@keyframes popupFade { from { opacity: 0; } to { opacity: 1; } }
.popup-card {
  position: relative; width: 100%; max-width: 400px;
  max-height: calc(100vh - 2rem); margin: auto;
  background: #fff; border-radius: 1.25rem; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4); display: flex; flex-direction: column;
  animation: popupRise 0.45s cubic-bezier(0.16,1,0.3,1);
}
@keyframes popupRise { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: none; } }
.popup-media { position: relative; flex-shrink: 0; }
.popup-media img { width: 100%; height: 200px; object-fit: cover; display: block; }
.popup-badge {
  position: absolute; top: 1rem; left: 1rem;
  background: var(--primary); color: #fff; font-size: 0.65rem; font-weight: 800;
  letter-spacing: 0.12em; padding: 0.35rem 0.7rem; border-radius: 999px;
}
.popup-body { padding: 1.6rem 1.5rem 1.2rem; overflow-y: auto; }
.popup-eyebrow { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--primary); margin-bottom: 0.6rem; }
.popup-heading { font-size: 1.4rem; font-weight: 900; line-height: 1.25; letter-spacing: -0.02em; color: #111; margin-bottom: 0.75rem; }
.popup-desc { font-size: 0.8125rem; line-height: 1.7; color: #6b7280; margin-bottom: 1.25rem; }
.popup-cta {
  display: block; width: 100%; text-align: center;
  background: #111; color: #fff; font-weight: 700; font-size: 0.875rem;
  padding: 0.85rem; border-radius: 0.75rem; transition: background 0.3s ease;
}
.popup-cta:hover { background: var(--primary); }
.popup-x {
  position: absolute; top: 0.85rem; right: 0.85rem; z-index: 2;
  width: 2.25rem; height: 2.25rem; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.45); color: #fff; border-radius: 999px; font-size: 1rem;
  transition: background 0.25s ease;
}
.popup-x:hover { background: rgba(0,0,0,0.7); }
.popup-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; padding: 0.85rem 1.5rem; border-top: 1px solid #f1f1f1; flex-shrink: 0;
}
.popup-today { display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; color: #6b7280; cursor: pointer; }
.popup-today input { width: 1rem; height: 1rem; accent-color: var(--primary); cursor: pointer; }
.popup-close-text { font-size: 0.78rem; font-weight: 600; color: #9ca3af; transition: color 0.25s ease; }
.popup-close-text:hover { color: #111; }
body.popup-open { overflow: hidden; }
@media (max-width: 360px) {
  .popup-media img { height: 160px; }
  .popup-heading { font-size: 1.2rem; }
  .popup-body { padding: 1.3rem 1.2rem 1rem; }
  .popup-foot { padding: 0.75rem 1.2rem; }
}

/* ===== 모션 최소화 선호 사용자 ===== */
@media (prefers-reduced-motion: reduce) {
  .beyond-bg-text, .marquee-inner, .bubble, .water-stream,
  .process-card, .process-progress, .scroll-hint-anim { animation: none !important; }
  .popup-overlay, .popup-card { animation: none !important; }
  [data-reveal], [data-stagger] > *, .hero-line > span { transition: none !important; opacity: 1 !important; transform: none !important; clip-path: none !important; }
}
