/* ==========================================================================
   SAJ Dental Clinic — "Smile Statistics" section
   Scope: every selector is prefixed smile-stats / smile-stat.

   Desktop (≥ 1024px): stats around a central glass tooth standing on a
   glass platform; light trails connect stats → tooth; the ticker runs
   along the platform rim on a curve (.is-arc, set by JS).
   Tablet portrait: tooth on top, stats in a 2 × 2 grid, flat ticker band.
   Mobile: tooth, then stats stacked, flat ticker band.
   ========================================================================== */

/* Standalone preview page only (smile-stats.html) */
.smile-stats-preview {
  margin: 0;
  padding-bottom: 40vh;
  background: #FFFFFF;
}

/* --------------------------------------------------------------------------
   Variables + base
   -------------------------------------------------------------------------- */
.smile-stats {
  --ss-navy: #0B347A;
  --ss-blue: #2F80ED;
  --ss-light-blue: #DCEEFF;
  --ss-sky: #EAF5FF;
  --ss-orange: #FF6B1A;
  --ss-orange-text: #E2541A;          /* AA on white */
  --ss-body: #4F6385;

  --ss-font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --ss-font-body: "DM Sans", Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --ss-font-script: "Dancing Script", "Brush Script MT", cursive;

  --ss-title-size: clamp(2.4rem, 3.7vw, 4.2rem);
  --ss-tooth-w: clamp(280px, 24vw, 420px);
  --ss-icon: clamp(96px, 7.4vw, 134px);
  --ss-number-size: clamp(2.6rem, 4vw, 4.9rem);
  --ss-platform-h: clamp(170px, 17vw, 300px);
  --ss-ease: cubic-bezier(0.22, 1, 0.36, 1);

  box-sizing: border-box;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  overflow: clip;
  padding: clamp(56px, 5vw, 96px) 0 calc(var(--ss-platform-h) * 0.52);
  background:
    radial-gradient(50% 38% at 50% 8%, #FFFFFF 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, #F3F9FF 0%, var(--ss-sky) 50%, #DDEDFD 100%);
  font-family: var(--ss-font-body);
  color: var(--ss-body);
  -webkit-font-smoothing: antialiased;
}

.smile-stats *,
.smile-stats *::before,
.smile-stats *::after {
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Background (outer = scroll parallax, inner layer = mouse + idle drift)
   -------------------------------------------------------------------------- */
.smile-stats__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.smile-stats__bg-item {
  position: absolute;
}

.smile-stats__bg-layer {
  display: block;
  width: 100%;
  height: 100%;
}

/* Large soft glass "bubbles" in the corners */
.smile-stats__bg-item--bubble-left {
  left: -12vw;
  top: -10vw;
  width: 34vw;
  height: 34vw;
}

.smile-stats__bg-item--bubble-right {
  right: -10vw;
  top: -6vw;
  width: 30vw;
  height: 30vw;
}

.smile-stats__bg-item--bubble-left .smile-stats__bg-layer,
.smile-stats__bg-item--bubble-right .smile-stats__bg-layer {
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 45%),
    radial-gradient(circle at 60% 65%, rgba(170, 206, 245, 0.35), rgba(170, 206, 245, 0) 70%);
}

/* Soft blue glow behind the tooth */
.smile-stats__bg-item--glow {
  left: 50%;
  top: 34%;
  width: 60vw;
  height: 46vw;
  margin-left: -30vw;
}

.smile-stats__bg-item--glow .smile-stats__bg-layer {
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(160, 205, 252, 0.55), rgba(160, 205, 252, 0));
}

.smile-stats__bg-item--waves {
  left: -4%;
  top: 0;
  width: 108%;
  height: 100%;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.smile-stats__container {
  position: relative;
  z-index: 2;
  width: min(92%, 1500px);
  margin: 0 auto;
}

.smile-stats__header {
  max-width: 900px;
  margin: 0 auto clamp(20px, 2vw, 36px);
  text-align: center;
}

.smile-stats__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 clamp(12px, 1.2vw, 20px);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ss-navy);
}

.smile-stats__eyebrow-line {
  display: block;
  width: 56px;
  height: 2px;
  border-radius: 2px;
  background: var(--ss-orange);
  transform-origin: right center;
}

.smile-stats__title {
  margin: 0 0 clamp(12px, 1.2vw, 20px);
  font-family: var(--ss-font-display);
  font-size: var(--ss-title-size);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: var(--ss-navy);
}

.smile-stats__title-line {
  display: block;
  overflow: hidden;
  padding: 0 0.1em 0.12em;
  margin-bottom: -0.12em;
}

.smile-stats__title-text,
.smile-stats__title-highlight {
  display: inline-block;
}

.smile-stats__title-highlight {
  font-style: italic;
  color: var(--ss-orange-text);
}

.smile-stats__description {
  max-width: 34em;
  margin: 0 auto;
  font-size: clamp(1rem, 1.08vw, 1.1875rem);
  line-height: 1.55;
}

/* --------------------------------------------------------------------------
   Stage (desktop: stats in the corners around the tooth)
   -------------------------------------------------------------------------- */
.smile-stats__stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--ss-tooth-w) minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: start;
  row-gap: clamp(36px, 4.4vw, 84px);
  column-gap: 0;
}

.smile-stats__paths {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.smile-stats__trail {
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.smile-stats__trail-glow {
  fill: none;
  stroke: #FFFFFF;
  stroke-width: 6;
  stroke-linecap: round;
  opacity: 0.55;
}

.smile-stats__trail-node {
  stroke: #FFFFFF;
  stroke-width: 3;
}

.smile-stats__trail-spark {
  fill: #FFFFFF;
  stroke-width: 2;
  opacity: 0;
}

/* --------------------------------------------------------------------------
   Central tooth
   -------------------------------------------------------------------------- */
.smile-stats__tooth {
  position: relative;
  z-index: 2;
  grid-column: 2;
  grid-row: 1 / span 2;
  width: var(--ss-tooth-w);
  align-self: start;
  margin-top: calc(var(--ss-tooth-w) * -0.06);
}

.smile-stats__tooth-inner {
  position: relative;
  width: 100%;
  aspect-ratio: 416 / 440;
}

.smile-stats__tooth-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.smile-stats__tooth-glow {
  fill: none;
  stroke: #A9D0FF;
  stroke-width: 16;
  opacity: 0.9;
}

.smile-stats__tooth-fill {
  fill: url(#smile-stats-tooth-fill);
}

.smile-stats__tooth-inset {
  fill: none;
  stroke: #FFFFFF;
  stroke-width: 2.4;
  opacity: 0.6;
}

.smile-stats__tooth-outline {
  fill: none;
  stroke: #FFFFFF;
  stroke-width: 4;
  stroke-linejoin: round;
}

.smile-stats__tooth-shine {
  fill: none;
  stroke: #FFFFFF;
  stroke-width: 6;
  stroke-linecap: round;
  opacity: 0.85;
}

.smile-stats__sparkles circle {
  fill: #FFFFFF;
}

.smile-stats__orbit-line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 2;
}

.smile-stats__orbit-dot {
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 3;
}

.smile-stats__orbit-dot--blue { fill: var(--ss-blue); }
.smile-stats__orbit-dot--orange { fill: var(--ss-orange); }

.smile-stats__tooth-message {
  position: absolute;
  left: 50%;
  top: 46%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  font-family: var(--ss-font-script);
  font-size: calc(var(--ss-tooth-w) * 0.13);
  font-weight: 700;
  line-height: 0.95;
  text-align: center;
  transform: translate(-50%, -50%) rotate(-7deg);
  white-space: nowrap;
}

.smile-stats__tooth-word {
  display: block;
  color: #5C8FE6;
  text-shadow: 0 2px 10px rgba(255, 255, 255, 0.9);
}

.smile-stats__tooth-word:nth-child(2) { margin-left: 0.3em; }

.smile-stats__tooth-word--accent {
  margin-left: 0.15em;
  color: var(--ss-orange);
}

.smile-stats__tooth-smile {
  width: 1.9em;
  height: auto;
  margin-top: 0.08em;
  fill: none;
  stroke: var(--ss-orange);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Floating particles around the tooth */
.smile-stats__particles {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.smile-stats__particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, #FFFFFF 0%, #7DB4F5 55%, rgba(125, 180, 245, 0) 72%);
  opacity: 0.8;
}

.smile-stats__particle--orange {
  background: radial-gradient(circle, #FFFFFF 0%, #FF9A5C 55%, rgba(255, 154, 92, 0) 72%);
}

.smile-stats__particle:nth-child(1) { left: 36%; top: 12%; width: 10px; height: 10px; }
.smile-stats__particle:nth-child(2) { left: 62%; top: 22%; }
.smile-stats__particle:nth-child(3) { left: 40%; top: 70%; width: 6px; height: 6px; }
.smile-stats__particle:nth-child(4) { left: 64%; top: 64%; width: 12px; height: 12px; }
.smile-stats__particle:nth-child(5) { left: 33%; top: 44%; width: 7px; height: 7px; }
.smile-stats__particle:nth-child(6) { left: 67%; top: 42%; width: 6px; height: 6px; }

/* --------------------------------------------------------------------------
   Statistic
   -------------------------------------------------------------------------- */
.smile-stat {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  gap: clamp(16px, 1.6vw, 28px);
}

.smile-stat--tl { grid-column: 1; grid-row: 1; justify-self: end; margin-right: clamp(24px, 4.4vw, 96px); }
.smile-stat--bl { grid-column: 1; grid-row: 2; justify-self: end; margin-right: clamp(12px, 3vw, 64px); }
.smile-stat--tr { grid-column: 3; grid-row: 1; justify-self: start; margin-left: clamp(24px, 4.4vw, 96px); }
.smile-stat--br { grid-column: 3; grid-row: 2; justify-self: start; margin-left: clamp(24px, 4.4vw, 96px); }

.smile-stat__icon {
  position: relative;
  flex: none;
  width: var(--ss-icon);
  height: var(--ss-icon);
}

.smile-stat__ring {
  position: absolute;
  z-index: 1;                         /* above the disc halo at every icon size */
  inset: -12%;
  width: 124%;
  height: 124%;
  overflow: visible;
  transform: rotate(-90deg);
}

.smile-stat__ring-dots {
  fill: none;
  stroke: rgba(47, 128, 237, 0.35);
  stroke-width: 1.4;
  stroke-dasharray: 0.5 6;
  stroke-linecap: round;
}

.smile-stat__ring-progress {
  fill: none;
  stroke: var(--ss-blue);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 100 100;
  stroke-dashoffset: calc(100 - var(--ss-ring, 75));
}

.smile-stat[data-accent="orange"] .smile-stat__ring-progress {
  stroke: var(--ss-orange);
}

.smile-stat__icon-disc {
  position: absolute;
  inset: 4%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFFFFF 0%, #F4F9FF 60%, #E6F1FD 100%);
  box-shadow:
    0 18px 34px -18px rgba(11, 52, 122, 0.35),
    0 0 0 calc(var(--ss-icon) * 0.05) rgba(255, 255, 255, 0.55),
    inset 0 0 0 1px rgba(47, 128, 237, 0.12);
  color: var(--ss-blue);
}

.smile-stat__icon-disc svg {
  width: 40%;
  height: 40%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.smile-stat__content {
  min-width: 0;
  padding-top: calc(var(--ss-icon) * 0.02);
}

.smile-stat__number {
  margin: 0 0 4px;
  font-family: var(--ss-font-display);
  font-size: var(--ss-number-size);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ss-navy);
  font-variant-numeric: lining-nums tabular-nums;
  white-space: nowrap;
}

.smile-stat__suffix {
  margin-left: 0.04em;
  font-weight: 600;
}

.smile-stat__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.smile-stat__label {
  margin: 0 0 8px;
  font-family: var(--ss-font-display);
  font-size: clamp(1.15rem, 1.4vw, 1.6rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ss-navy);
}

.smile-stat__description {
  max-width: 12.5em;
  margin: 0;
  font-size: clamp(0.9375rem, 1vw, 1.0625rem);
  line-height: 1.45;
}

/* --------------------------------------------------------------------------
   Platform + ripples
   -------------------------------------------------------------------------- */
.smile-stats__platform {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 1;
  width: 106vw;
  height: var(--ss-platform-h);
  margin-left: -53vw;
  pointer-events: none;
}

.smile-stats__platform-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.smile-stats__ripple {
  fill: none;
  stroke: #FFFFFF;
  stroke-width: 2;
  opacity: 0.7;
}

/* --------------------------------------------------------------------------
   Ticker
   -------------------------------------------------------------------------- */
.smile-stats__ticker {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 3;
  /* centred on the platform's front rim (rim band centre ≈ 18% from the bottom) */
  bottom: calc(var(--ss-platform-h) * 0.183 - 22px);
  height: 44px;
  overflow: visible;              /* curved items rise above the box; the section clips sideways */
  pointer-events: none;
}

.smile-stats__ticker-track {
  display: flex;
  width: max-content;
  height: 100%;
  will-change: transform;
}

.smile-stats__ticker-group {
  display: flex;
  align-items: center;
  flex: none;
}

.smile-stats__ticker-item,
.smile-stats__ticker-sep {
  display: inline-flex;
  align-items: baseline;
  flex: none;
  will-change: transform;
}

.smile-stats__ticker-item {
  gap: 8px;
  padding: 0 clamp(18px, 1.8vw, 34px);
  font-size: clamp(0.75rem, 0.82vw, 0.9375rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ss-navy);
}

.smile-stats__ticker-item strong {
  font-family: var(--ss-font-display);
  font-size: 1.55em;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.smile-stats__ticker-item--accent strong {
  color: var(--ss-orange-text);
}

.smile-stats__ticker-sep {
  align-items: center;
  color: #7FAEEB;
}

.smile-stats__ticker-sep svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

/* --------------------------------------------------------------------------
   Reveal pre-state + fail-safe
   -------------------------------------------------------------------------- */
.smile-stats:not(.is-animated) [data-ss-reveal] {
  opacity: 0;
  animation: smile-stats-failsafe 0.8s ease 1.8s forwards;
}

@keyframes smile-stats-failsafe {
  to { opacity: 1; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* iPad landscape: same composition, tighter */
@media (max-width: 1199px) {
  .smile-stats {
    --ss-tooth-w: clamp(260px, 27vw, 320px);
    --ss-icon: clamp(84px, 8vw, 96px);
    --ss-number-size: clamp(2.3rem, 3.8vw, 2.9rem);
  }

  .smile-stat { gap: 14px; }
  .smile-stat--tl,
  .smile-stat--tr,
  .smile-stat--br { margin-left: 0; margin-right: 0; }
  .smile-stat--tl { margin-right: 28px; }
  .smile-stat--bl { margin-right: 18px; }
  .smile-stat--tr,
  .smile-stat--br { margin-left: 28px; }

  .smile-stat__label { font-size: 1.1rem; }
  .smile-stat__description { font-size: 0.875rem; }
}

/* iPad portrait + mobile: tooth on top, stats below, flat ticker band */
@media (max-width: 1023px) {
  .smile-stats {
    --ss-tooth-w: clamp(220px, 40vw, 330px);
    --ss-icon: 84px;
    --ss-number-size: clamp(2.3rem, 5.6vw, 3rem);
    padding-bottom: 120px;
  }

  .smile-stats__stage {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
    row-gap: 40px;
    column-gap: 32px;
  }

  .smile-stats__tooth {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
    margin: 10px 0 24px;
  }

  /* Small glass "platform" glow under the tooth instead of the big disc */
  .smile-stats__tooth::after {
    content: "";
    position: absolute;
    left: -20%;
    right: -20%;
    bottom: -8%;
    z-index: -1;
    height: 22%;
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(255, 255, 255, 0.85), rgba(210, 230, 251, 0.5));
  }

  .smile-stat,
  .smile-stat--tl,
  .smile-stat--bl,
  .smile-stat--tr,
  .smile-stat--br {
    grid-column: auto;
    grid-row: auto;
    justify-self: stretch;
    margin: 0;
  }

  .smile-stats__paths,
  .smile-stats__platform {
    display: none;
  }

  .smile-stats__ticker {
    bottom: 32px;
    height: 56px;
    overflow: hidden;
    border-top: 1px solid rgba(47, 128, 237, 0.2);
    border-bottom: 1px solid rgba(47, 128, 237, 0.2);
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 10px 30px -18px rgba(11, 52, 122, 0.35);
  }

  .smile-stats__particle:nth-child(n+5) { display: none; }
}

/* Mobile: compact horizontal stat rows */
@media (max-width: 639px) {
  .smile-stats {
    --ss-title-size: clamp(2.1rem, 9.4vw, 2.6rem);
    --ss-tooth-w: clamp(210px, 62vw, 260px);
    --ss-icon: 72px;
    --ss-number-size: 2.4rem;
    padding-top: 56px;
  }

  .smile-stats__eyebrow {
    gap: 12px;
    font-size: 0.75rem;
  }

  .smile-stats__description {
    font-size: 0.9375rem;
  }

  .smile-stats__stage {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 26px;
  }

  .smile-stat {
    align-items: center;
    padding: 4px 0;
  }

  .smile-stat__label { font-size: 1.125rem; margin-bottom: 4px; }
  .smile-stat__description { max-width: none; }

  .smile-stats__bg-item--bubble-left,
  .smile-stats__bg-item--bubble-right { opacity: 0.6; }

  .smile-stats__particle:nth-child(n+4) { display: none; }
}
