/* Motion layer: parallax, reveals and the tooth animations.
   Everything animated is gated behind html.motion (set only when the
   visitor hasn't asked for reduced motion), so the page reads fine without it. */

:root {
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-soft: cubic-bezier(.4, 0, .2, 1);
}

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 80;
  background: linear-gradient(90deg, var(--sky), var(--navy));
  transform-origin: 0 50%;
  transform: scaleX(var(--progress, 0));
  pointer-events: none;
}

/* ---------- Header ---------- */
.site-header { transition: box-shadow .4s var(--ease-soft), background .4s var(--ease-soft), border-color .4s var(--ease-soft); }
.site-header.is-scrolled {
  background: rgba(255, 255, 255, 0.82);
  border-bottom-color: transparent;
  box-shadow: 0 1px 0 rgba(13, 59, 140, .06), 0 8px 30px rgba(13, 59, 140, .06);
}
.nav a:not(.btn) { position: relative; }
.nav a:not(.btn)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1.5px;
  background: var(--sky); border-radius: 2px;
  transform: scaleX(0); transform-origin: right;
  transition: transform .45s var(--ease-out);
}
.nav a:not(.btn):hover::after, .nav a.is-active::after { transform: scaleX(1); transform-origin: left; }
.nav a.is-active { color: var(--navy); }

/* ---------- Buttons ---------- */
.btn { position: relative; overflow: hidden; isolation: isolate; transition: transform .35s var(--ease-out), background .25s ease, color .25s ease, border-color .25s ease, box-shadow .35s var(--ease-out); }
.btn-primary:hover { box-shadow: 0 10px 24px -8px rgba(13, 59, 140, .55); }
.btn-primary::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.22) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .8s var(--ease-out);
}
.btn-primary:hover::before { transform: translateX(120%); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; }
.hero-inner { position: relative; z-index: 1; }
.hero-deco { position: absolute; inset: 0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; }
.blob-a { width: 420px; height: 420px; left: -120px; top: -140px; background: #cdeafc; }
.blob-b { width: 360px; height: 360px; right: 8%; bottom: -160px; background: #dbe6fb; }
.hero-ghost-tooth {
  position: absolute; width: 300px; left: 41%; top: 40px;
  fill: none; stroke: var(--navy); stroke-width: .6; opacity: .07;
}

.hero-media { position: relative; }
.frame { overflow: hidden; border-radius: 24px; box-shadow: var(--shadow); transform: translateZ(0); }
.hero-media .frame img { box-shadow: none; border-radius: 0; }
.doctor-photo .frame img { border-radius: 0; }

/* Floating badge with the drawing tooth */
.hero-badge {
  position: absolute; left: -36px; bottom: 36px;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px 14px 14px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 18px;
  box-shadow: 0 18px 40px -12px rgba(10, 42, 102, .25);
}
.badge-tooth {
  position: relative; flex: none;
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--sky-soft);
  display: grid; place-items: center;
}
.badge-copy { display: flex; flex-direction: column; line-height: 1.3; }
.badge-copy strong { font-size: .95rem; color: var(--navy-deep); }
.badge-copy span { font-size: .8rem; color: var(--muted); }

.tooth { width: 30px; height: 33px; overflow: visible; }
.tooth-line, .tooth-shine, .smile-line, .smile-shine {
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}
.tooth-line { stroke: var(--navy); stroke-width: 6; }
.tooth-shine { stroke: var(--sky); stroke-width: 6; }
.tooth-fill { fill: #fff; }

.spark { position: absolute; width: 10px; height: 10px; fill: var(--sky); opacity: 0; }
.spark.s1 { top: 4px; right: 4px; }
.spark.s2 { top: 16px; right: -2px; width: 7px; height: 7px; }
.spark.s3 { bottom: 6px; left: 3px; width: 6px; height: 6px; }

/* ---------- Smile band (scroll-driven tooth) ---------- */
.smile-band {
  --p: 1; /* 0 → 1 as the band scrolls through; JS drives this */
  padding: 72px 0;
  background: linear-gradient(180deg, #fff 0%, var(--sky-soft) 50%, var(--tint) 100%);
  overflow: hidden;
}
.smile-inner { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 64px; align-items: center; }
.smile-visual { position: relative; width: min(340px, 80%); aspect-ratio: 1; margin-inline: auto; display: grid; place-items: center; }
.smile-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(58, 174, 234, .25);
}
.smile-ring.r2 { inset: 14%; border-color: rgba(13, 59, 140, .1); }
.smile-tooth { width: 58%; overflow: visible; filter: drop-shadow(0 18px 28px rgba(13, 59, 140, .14)); }
.smile-line { stroke: var(--navy); stroke-width: 2.4; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--draw, 1)); }
.smile-shine { stroke: var(--sky); stroke-width: 3; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--shine, 1)); }
.smile-fill { transform: translateY(calc((1 - var(--fill, 1)) * 110px)); }
.smile-sweep { fill: rgba(255, 255, 255, .85); transform: rotate(18deg) translateX(calc(var(--sweep, 0) * 190px)); transform-origin: 50px 55px; }
.smile-visual .spark { width: 16px; height: 16px; opacity: var(--glint, 1); transform: scale(var(--glint, 1)); transition: none; }
.spark.sb1 { top: 16%; right: 22%; }
.spark.sb2 { top: 30%; right: 12%; width: 10px; height: 10px; }
.spark.sb3 { bottom: 24%; left: 18%; width: 11px; height: 11px; fill: var(--navy); }

.smile-words { font-family: var(--serif); font-size: clamp(2.4rem, 5.4vw, 4.2rem); line-height: 1.05; margin: 0 0 20px; color: var(--navy-deep); }
.smile-words span { display: inline-block; }
.smile-note { color: var(--muted); max-width: 440px; font-size: 1.05rem; }

/* ---------- Marquee ---------- */
.marquee {
  overflow: hidden; padding: 30px 0;
  border-block: 1px solid var(--line);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track { display: flex; width: max-content; }
.marquee-group { display: flex; align-items: center; gap: 36px; padding-right: 36px; }
.marquee-group span { font-family: var(--serif); font-size: clamp(1.4rem, 2.4vw, 2rem); color: var(--navy-deep); white-space: nowrap; }
.marquee-group svg { width: 18px; height: 20px; fill: none; stroke: var(--sky); stroke-width: 8; flex: none; }

/* ---------- Cards: cursor spotlight ---------- */
.service-card { position: relative; overflow: hidden; }
.service-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), rgba(58, 174, 234, .10), transparent 60%);
  opacity: 0; transition: opacity .35s ease;
}
.service-card:hover::after { opacity: 1; }
.service-card-accent::after { background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .10), transparent 60%); }
.service-card, .blog-card { transition: box-shadow .45s var(--ease-out), transform .45s var(--ease-out), border-color .3s ease; }
.service-card:hover { transform: translateY(-4px); }
.service-card h3 { position: relative; }
.service-card h3::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 2px; width: 100%;
  background: var(--sky); transform: scaleX(0); transform-origin: left;
  transition: transform .6s var(--ease-out);
}
.service-card:hover h3::after { transform: scaleX(1); }
.service-card-accent h3::after { display: none; }

.checklist li { transition: transform .4s var(--ease-out), background .3s ease; }
.checklist li:hover { transform: translateX(6px); background: var(--sky-soft); }

.gallery img { transition: transform 1.2s var(--ease-out); }
.gallery figure:hover img { transform: scale(1.06); }

/* ================= Motion-only states ================= */
.motion [data-parallax], .motion [data-parallax-img] { will-change: transform; }
.motion [data-parallax-img] { transform: translate3d(0, var(--py, 0px), 0) scale(1.14); }

/* Hero intro */
.motion [data-hero] { opacity: 0; transform: translateY(18px); }
.motion .is-loaded [data-hero] { opacity: 1; transform: none; transition: opacity 1s var(--ease-out), transform 1.1s var(--ease-out); transition-delay: var(--d, 0s); }
.motion .hero-media[data-hero] { transform: translateY(28px) scale(.98); }
.motion .is-loaded .hero-media[data-hero] { transform: none; }

.motion [data-split] .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.motion [data-split] .w > span { display: inline-block; transform: translateY(105%); }
.motion .is-loaded [data-split] .w > span { transform: none; transition: transform 1.1s var(--ease-out); transition-delay: calc(.12s + var(--i) * .06s); }

/* Badge: float + tooth drawing itself */
.motion .badge-tooth { animation: bob 6s ease-in-out infinite; }
.motion .tooth-line { stroke-dasharray: 1; stroke-dashoffset: 1; }
.motion .tooth-shine { stroke-dasharray: 1; stroke-dashoffset: 1; }
.motion .tooth-fill { opacity: 0; }
.motion .is-loaded .tooth-line { animation: draw 1.8s var(--ease-soft) .9s forwards; }
.motion .is-loaded .tooth-fill { animation: fade-in .8s ease 2.3s forwards; }
.motion .is-loaded .tooth-shine { animation: draw .7s var(--ease-out) 2.5s forwards, shine-pulse 4s ease-in-out 3.4s infinite; }
.motion .is-loaded .spark.s1 { animation: twinkle 2.6s ease-in-out 2.7s infinite; }
.motion .is-loaded .spark.s2 { animation: twinkle 2.6s ease-in-out 3.2s infinite; }
.motion .is-loaded .spark.s3 { animation: twinkle 2.6s ease-in-out 3.7s infinite; }

/* Scroll reveals */
.motion [data-reveal]:not([data-reveal="stagger"]),
.motion [data-reveal="stagger"] > * {
  opacity: 0; transform: translateY(28px);
  transition: opacity 1s var(--ease-out), transform 1.1s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.motion [data-reveal].is-in:not([data-reveal="stagger"]),
.motion [data-reveal="stagger"].is-in > * { opacity: 1; transform: none; }
/* Cards keep their own hover transform once revealed */
.motion [data-reveal="stagger"].is-in > .service-card:hover,
.motion [data-reveal="stagger"].is-in > .blog-card:hover { transform: translateY(-4px); transition-delay: 0s; }
.motion [data-reveal="stagger"].is-in > .checklist li:hover,
.motion .checklist.is-in > li:hover { transform: translateX(6px); transition-delay: 0s; }

/* Gallery: soft wipe-in instead of slide */
.motion .gallery[data-reveal] > figure { transform: none; clip-path: inset(12% 12% 12% 12% round 16px); transition: opacity 1s var(--ease-out), clip-path 1.3s var(--ease-out); transition-delay: calc(var(--i, 0) * 80ms); }
.motion .gallery.is-in > figure { clip-path: inset(0 0 0 0 round 16px); }

/* Smile band words light up with scroll progress */
.motion .smile-words span { opacity: calc(.15 + var(--w, 1) * .85); transform: translateY(calc((1 - var(--w, 1)) * 14px)); }

.motion .marquee-track { animation: marquee 48s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { to { opacity: 1; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); }
  20% { opacity: 1; transform: scale(1) rotate(45deg); }
  40% { opacity: 0; transform: scale(.3) rotate(90deg); }
}
@keyframes shine-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .smile-inner { grid-template-columns: 1fr; gap: 32px; text-align: center; }
  .smile-note { margin-inline: auto; }
  .hero-badge { left: 16px; bottom: -24px; }
  .hero-ghost-tooth { left: auto; right: -60px; top: auto; bottom: 30%; }
}
@media (max-width: 560px) {
  .hero-ghost-tooth { display: none; }
  .hero-badge { padding: 10px 14px 10px 10px; gap: 10px; }
  .badge-tooth { width: 44px; height: 44px; }
  .smile-band { padding: 56px 0; }
  .marquee { padding: 22px 0; }
}
