/* ============================================
   서울티스치과 — 커스텀 스타일
   Tailwind CDN 보완 (component classes)
   ============================================ */

/* 헤더 스크롤 반응 */
#site-header.scrolled {
  background-color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(8px);
}
#site-header.scrolled #brand-logo { color: #6F9CE8; }
#site-header.scrolled .nav-link { color: #1A2233; }
#site-header.scrolled #mobile-menu-btn { color: #1A2233; }
#site-header.scrolled .nav-link:hover { color: #6F9CE8; }
#site-header.scrolled a[href^="tel:"] { color: #6F9CE8; }

/* 네비 링크 */
.nav-link {
  position: relative;
  font-size: 0.95rem;
  font-weight: 500;
  color: #ffffff;
  transition: color 0.2s ease;
  padding: 4px 2px;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.25s ease;
}
.nav-link:hover::after { transform: scaleX(1); }

.mobile-link {
  font-size: 1rem;
  font-weight: 500;
  padding: 4px 0;
}

/* 모바일 드로어 */
#mobile-drawer.open {
  transform: translateX(0);
}

/* 진료과목 카드 */
.service-card {
  display: block;
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  text-align: center;
  border: 1px solid #E2E8F0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.service-card:hover {
  border-color: #6F9CE8;
  transform: translateY(-6px);
  box-shadow: 0 12px 24px rgba(111, 156, 232, 0.12);
}
.service-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 1rem;
  border-radius: 14px;
  background-color: #E8F0FF;
  color: #6F9CE8;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}
.service-icon svg { width: 32px; height: 32px; }
.service-card:hover .service-icon { transform: scale(1.1); background-color: #6F9CE8; color: white; }

.service-title {
  font-weight: 700;
  font-size: 1.125rem;
  margin-bottom: 0.25rem;
}
.service-desc {
  font-size: 0.875rem;
  color: #4A5568;
  margin-bottom: 0.75rem;
  min-height: 2.5em;
}
.service-link {
  display: inline-block;
  font-size: 0.875rem;
  color: #6F9CE8;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.service-card:hover .service-link { opacity: 1; }

/* 단계 카드 */
.step-card {
  background: white;
  border-radius: 1rem;
  padding: 2rem 1.5rem;
  border: 1px solid #E2E8F0;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}
.step-card:hover {
  border-color: #6F9CE8;
  transform: translateY(-4px);
}
.step-num {
  font-size: 3rem;
  font-weight: 800;
  color: #E8F0FF;
  line-height: 1;
  margin-bottom: 0.5rem;
}

/* FAQ */
.faq-item {
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 0.75rem;
  overflow: hidden;
  transition: border-color 0.2s ease;
}
.faq-item[open] {
  border-color: #6F9CE8;
  box-shadow: 0 4px 12px rgba(111, 156, 232, 0.06);
}
.faq-item summary {
  list-style: none;
  padding: 1.1rem 1.5rem;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.5rem;
  color: #6F9CE8;
  transition: transform 0.2s ease;
  font-weight: 300;
}
.faq-item[open] summary::after {
  content: "−";
  transform: rotate(180deg);
}
.faq-answer {
  padding: 0 1.5rem 1.3rem;
  color: #4A5568;
  line-height: 1.7;
  font-size: 0.95rem;
}

/* 폼 인풋 */
.form-input {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.75rem 1rem;
  border: 1px solid #E2E8F0;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-family: inherit;
  background: white;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-input:focus {
  outline: none;
  border-color: #6F9CE8;
  box-shadow: 0 0 0 3px rgba(111, 156, 232, 0.12);
}

/* 플로팅 버튼 */
.floating-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: white;
  color: #6F9CE8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  border: 1px solid #E8F0FF;
}
.floating-btn:hover {
  background: #6F9CE8;
  color: white;
  transform: translateY(-2px);
}

/* 스크롤 인뷰 애니메이션 */
[data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Reduce motion respect */
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .animate-bounce { animation: none; }
}

/* 본문 여백 */
body {
  padding-bottom: 70px; /* 하단 CTA 바 높이 보정 */
}

/* 모바일 드로어 오버레이 */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* 접근성 - sr-only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   Section 4 · 3분과 협진 시스템 애니메이션
   ============================================ */

/* — 핵심 차별점 칩 (살짝 떠오름) — */
.differentiator-chip {
  animation: chipFloat 3.2s ease-in-out infinite;
}
@keyframes chipFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* — 시스템 비교 카드 (stagger 등장) — */
.compare-card {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.3s ease,
              border-color 0.3s ease;
}
.compare-card[data-stagger="1"] { transition-delay: 0.05s, 0.05s, 0s, 0s; }
.compare-card[data-stagger="2"] { transition-delay: 0.20s, 0.20s, 0s, 0s; }
.compare-card[data-stagger="3"] { transition-delay: 0.35s, 0.35s, 0s, 0s; }
[data-reveal].revealed .compare-card,
[data-reveal-stagger].revealed .compare-card {
  opacity: 1;
  transform: translateY(0);
}
.compare-card:hover {
  box-shadow: 0 6px 20px rgba(14, 31, 77, 0.06);
}
.compare-card--highlight {
  position: relative;
}
[data-reveal].revealed .compare-card--highlight,
[data-reveal-stagger].revealed .compare-card--highlight {
  animation: highlightPulse 2.4s ease 1.0s 1;
}
@keyframes highlightPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(108, 153, 232, 0); }
  50% { box-shadow: 0 0 0 10px rgba(108, 153, 232, 0.18); }
}

/* — 5가지 이유 · 카드별 개별 등장 (숫자 먼저 → 텍스트 나중) —
   각 카드는 viewport에 들어올 때마다 자기 자신만 애니메이션됨
   (전체 stagger가 아닌 per-card observer 방식 → 스크롤 속도와 무관하게 모든 카드가 보임) */
.reason-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* 카드 자체: 살짝 떠오름 */
.reason-item-card {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}
.reason-item-card.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* 숫자 원: 카드와 동시에 팝 등장 */
.reason-item__num {
  transform: scale(0.5);
  opacity: 0;
  transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.45s ease,
              background-color 0.3s ease,
              color 0.3s ease;
  transition-delay: 0.05s;
}
.reason-item-card.is-revealed .reason-item__num {
  transform: scale(1);
  opacity: 1;
}

/* 내용(제목 + 설명): 숫자보다 0.35s 늦게 좌→우로 슬라이드 */
.reason-item__content {
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.5s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: 0.40s;
}
.reason-item-card.is-revealed .reason-item__content {
  opacity: 1;
  transform: translateX(0);
}

/* 호버 인터랙션 (등장 후) */
.reason-item-card {
  /* 호버 트랜지션은 별도 선언으로 딜레이 영향 없음 */
}
.reason-item-card.is-revealed {
  transition: opacity 0.65s ease, transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.reason-item-card.is-revealed:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(14, 31, 77, 0.08);
  border-color: rgba(108, 153, 232, 0.5);
}
.reason-item-card.is-revealed:hover .reason-item__num {
  background-color: var(--c-primary, #6F9CE8);
  color: white;
  transform: scale(1.06) rotate(-4deg);
  transition-delay: 0s;
}

/* ============================================
   5가지 이유 · 자동 재생 카드 로테이터 (캐러셀)
   ============================================ */
.reason-rotator {
  position: relative;
  max-width: 880px;
  margin: 0 auto;
  isolation: isolate;
}

/* 무대: 모든 슬라이드가 같은 그리드 셀에 stack → 가장 큰 슬라이드 기준으로 자동 사이징 */
.reason-rotator__stage {
  display: grid;
  position: relative;
}

/* 개별 슬라이드 */
.reason-slide {
  grid-area: 1 / 1;
  opacity: 0;
  transform: translateY(20px) scale(0.985);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.reason-slide.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  z-index: 2;
}

/* 슬라이드 내부 카드 */
.reason-slide__inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  align-items: center;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 1.25rem;
  padding: 1.75rem 1.5rem;
  box-shadow: 0 4px 16px rgba(14, 31, 77, 0.04);
  min-height: 180px;
}
@media (min-width: 1024px) {
  .reason-slide__inner {
    gap: 2rem;
    padding: 2.5rem 2.75rem;
    min-height: 220px;
  }
}

/* 숫자 원: 활성 슬라이드는 강조 색 */
.reason-slide__num {
  flex-shrink: 0;
  width: 3.75rem;
  height: 3.75rem;
  border-radius: 9999px;
  background: #6F9CE8;
  color: white;
  font-weight: 800;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.02em;
  box-shadow: 0 6px 18px rgba(108, 153, 232, 0.32);
}
@media (min-width: 1024px) {
  .reason-slide__num {
    width: 4.5rem;
    height: 4.5rem;
    font-size: 1.4rem;
  }
}

/* 활성 슬라이드 진입 시 숫자 원이 살짝 팝 */
.reason-slide.is-active .reason-slide__num {
  animation: rotatorNumPop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes rotatorNumPop {
  0% { transform: scale(0.5) rotate(-12deg); opacity: 0.4; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* 본문 */
.reason-slide__body h4 {
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.35;
  color: #0E1F4D;
  margin-bottom: 0.6rem;
  letter-spacing: -0.01em;
}
@media (min-width: 1024px) {
  .reason-slide__body h4 {
    font-size: 1.45rem;
    margin-bottom: 0.85rem;
  }
}
.reason-slide__body p {
  font-size: 0.92rem;
  line-height: 1.65;
  color: #5B6C8A;
  margin: 0;
}
@media (min-width: 1024px) {
  .reason-slide__body p {
    font-size: 1rem;
  }
}
.reason-slide__body strong {
  color: #0E1F4D;
  font-weight: 600;
}

/* 활성 슬라이드 본문은 살짝 늦게 페이드인 (숫자보다 0.18s 후) */
.reason-slide.is-active .reason-slide__body {
  animation: rotatorBodyIn 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.18s both;
}
@keyframes rotatorBodyIn {
  0% { opacity: 0; transform: translateX(16px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* 진행 바 */
.reason-rotator__progress {
  position: relative;
  height: 3px;
  background: rgba(14, 31, 77, 0.07);
  border-radius: 999px;
  margin: 1.5rem auto 0;
  max-width: 280px;
  overflow: hidden;
}
.reason-rotator__progress-bar {
  display: block;
  width: 100%;
  height: 100%;
  background: #6F9CE8;
  border-radius: inherit;
  transform-origin: left;
  transform: scaleX(0);
}
.reason-rotator.is-running .reason-rotator__progress-bar {
  animation: rotatorProgress var(--rotator-interval, 4.5s) linear forwards;
}
@keyframes rotatorProgress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* 숫자 인디케이터 */
.reason-rotator__nav {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
.reason-dot {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  border: 1.5px solid #E2E8F0;
  background: white;
  color: #5B6C8A;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: inherit;
}
.reason-dot:hover {
  border-color: #6F9CE8;
  color: #4A78C5;
  transform: translateY(-1px);
}
.reason-dot.is-active {
  background: #6F9CE8;
  color: white;
  border-color: #6F9CE8;
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(108, 153, 232, 0.3);
}

/* Reduced motion: 자동 재생 OFF, 즉시 표시 */
@media (prefers-reduced-motion: reduce) {
  .reason-slide,
  .reason-slide.is-active .reason-slide__num,
  .reason-slide.is-active .reason-slide__body,
  .reason-rotator__progress-bar {
    animation: none !important;
    transition: none !important;
  }
  .reason-rotator.is-running .reason-rotator__progress-bar {
    transform: scaleX(1);
  }
}

/* — 클로징 다크박스 · scale-in — */
.closing-box {
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
[data-reveal].revealed.closing-box {
  opacity: 1;
  transform: scale(1);
}

/* — Reduced motion 존중 — */
@media (prefers-reduced-motion: reduce) {
  .differentiator-chip,
  .compare-card,
  .compare-card--highlight,
  .reason-item-card,
  .reason-item__num,
  .reason-item__content,
  .closing-box {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
}

/* — 자바스크립트 미동작 시 fallback (no-js 또는 IO 미지원) —
   reason-item-card가 영원히 opacity:0인 상태로 남는 걸 방지 */
.no-js .reason-item-card,
html:not(.js) .reason-item-card {
  opacity: 1 !important;
  transform: none !important;
}
.no-js .reason-item__num,
.no-js .reason-item__content,
html:not(.js) .reason-item__num,
html:not(.js) .reason-item__content {
  opacity: 1 !important;
  transform: none !important;
}
