/* ============================================================
   ÉMALIA — Composants UI réutilisables
   ============================================================ */

/* ---------- Eyebrow / badge pilule ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.4rem 0.85rem;
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.eyebrow--coral { background: var(--accent-soft); color: var(--coral-600); }
.eyebrow--coral::before { background: var(--accent); }
.eyebrow--invert { background: rgba(255,255,255,0.10); color: #EAF4F0; }

.badge {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.3rem 0.7rem;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600;
  background: var(--surface-sand); color: var(--text-soft);
  border: 1px solid var(--border-soft);
}
.badge--accent { background: var(--accent-soft); color: var(--coral-600); border-color: transparent; }
.badge--primary { background: var(--primary-soft); color: var(--primary-deep); border-color: transparent; }

/* ---------- Boutons ---------- */
.btn {
  --_bg: var(--primary);
  --_fg: #fff;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.35rem 0.9rem 1.5rem;
  border-radius: var(--r-pill);
  background: var(--_bg);
  color: var(--_fg);
  font-weight: 600;
  font-size: var(--fs-sm);
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--dur-fast) var(--ease-soft),
              box-shadow var(--dur-base) var(--ease-soft),
              background var(--dur-base) var(--ease-soft);
  box-shadow: var(--shadow-teal);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 30px 60px -22px rgba(31,92,83,0.55); }
.btn:active { transform: translateY(0) scale(0.985); }

/* ---- CTA verts pleins : dégradé subtil + reflet glossy + balayage de lumière ---- */
.btn--cta, .btn:not(.btn--ghost):not(.btn--soft):not(.btn--light) {
  background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-600) 50%, var(--teal-700) 100%);
}
.btn:not(.btn--ghost):not(.btn--soft):not(.btn--light)::before,
.btn:not(.btn--ghost):not(.btn--soft):not(.btn--light)::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border-radius: inherit; pointer-events: none;
}
/* reflet glossy statique en haut (effet verre) */
.btn:not(.btn--ghost):not(.btn--soft):not(.btn--light)::before {
  background: linear-gradient(180deg, rgba(255,255,255,0.38), rgba(255,255,255,0.10) 46%, transparent 66%);
}
/* fine bande de lumière, hors-champ au repos */
.btn:not(.btn--ghost):not(.btn--soft):not(.btn--light)::after {
  background: linear-gradient(115deg, transparent 24%, rgba(255,255,255,0.30) 42%, rgba(255,255,255,0.70) 50%, rgba(255,255,255,0.30) 58%, transparent 76%);
  transform: translateX(-120%);
}
@media (prefers-reduced-motion: no-preference) {
  .btn:not(.btn--ghost):not(.btn--soft):not(.btn--light)::after {
    transition: transform 0.85s var(--ease-soft);
  }
  .btn:not(.btn--ghost):not(.btn--soft):not(.btn--light):hover::after {
    transform: translateX(120%);
  }
}

/* icône nichée dans son propre cercle (button-in-button) */
.btn__ico {
  display: grid; place-items: center;
  width: 1.85rem; height: 1.85rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.16);
  transition: transform var(--dur-base) var(--ease-soft), background var(--dur-base) var(--ease-soft);
}
.btn:hover .btn__ico { transform: translate(3px, -2px) scale(1.06); background: rgba(255,255,255,0.26); }
.btn__ico svg { width: 0.95rem; height: 0.95rem; stroke: currentColor; }

.btn--ghost {
  --_bg: transparent; --_fg: var(--text);
  box-shadow: none;
  border: 1px solid var(--border);
  background: var(--surface);
}
.btn--ghost:hover { box-shadow: var(--shadow-md); background: var(--surface); }
.btn--ghost .btn__ico { background: var(--primary-soft); color: var(--primary-deep); }
.btn--ghost:hover .btn__ico { background: var(--primary-soft); }

.btn--soft {
  --_bg: var(--primary-soft); --_fg: var(--primary-deep);
  box-shadow: none;
}
.btn--soft:hover { box-shadow: var(--shadow-sm); }
.btn--soft .btn__ico { background: rgba(39,117,104,0.14); color: var(--primary-deep); }

.btn--light {
  --_bg: #fff; --_fg: var(--teal-800);
  box-shadow: var(--shadow-md);
}
.btn--light .btn__ico { background: var(--primary-soft); color: var(--primary-deep); }

.btn--lg { padding: 1.05rem 1.5rem 1.05rem 1.75rem; font-size: var(--fs-base); }
.btn--block { display: flex; width: 100%; justify-content: center; }

.link-arrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 600; color: var(--primary-deep); font-size: var(--fs-sm);
}
.link-arrow svg { width: 1rem; height: 1rem; stroke: currentColor; transition: transform var(--dur-base) var(--ease-soft); }
.link-arrow:hover svg { transform: translateX(4px); }

/* ---------- Double-Bezel : coque + cœur ---------- */
.bezel {
  background: var(--shell);
  border: 1px solid var(--shell-line);
  border-radius: var(--r-2xl);
  padding: 0.5rem;
}
.bezel__core {
  background: var(--surface);
  border-radius: calc(var(--r-2xl) - 0.5rem);
  box-shadow: var(--inset-hi);
  overflow: hidden;
}
/* Interactive 3D tooth (model-viewer) — gradient backdrop matches the editorial render */
.bezel__core--3d {
  background: radial-gradient(125% 125% at 22% 85%,
    var(--sand) 0%, var(--cream) 38%, var(--teal-300) 118%);
  /* model-viewer is a custom element with no intrinsic width, unlike the <img>
     this layout was built around. Without a definite width the surrounding grid
     track and this core collapse toward 0 (the tooth then can't render or receive
     pointer drags). Sizing the core off the viewport gives a definite width that
     aspect-ratio turns into a height, independent of model-viewer's 0 intrinsic
     size. clamp() keeps it responsive; the parent's max-width still caps it. */
  width: 100%;
  min-width: 220px;
}
/* Three.js mounts its <canvas> inside this div; transparent so the gradient shows */
.tooth-3d {
  width: 100%; height: 100%; min-height: 280px; display: block;
  position: relative;
  cursor: grab;
  touch-action: pan-y;
}
.tooth-3d canvas { position: absolute; inset: 0; display: block; width: 100% !important; height: 100% !important; z-index: 1; }
.tooth-3d:active { cursor: grabbing; }
/* Poster de repli (affiché tant que la 3D n'a pas rendu / si WebGL KO) */
.tooth-3d__poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; z-index: 0; }

/* ---- Dark mode : finitions 3D / icônes ---- */
[data-theme="dark"] .bezel__core--3d {
  background: radial-gradient(125% 125% at 28% 22%,
    var(--teal-700) 0%, var(--teal-900) 58%, var(--teal-950) 100%);
}
[data-theme="dark"] .ic-3d,
[data-theme="dark"] .trust-ico {
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.40));
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease-soft),
              box-shadow var(--dur-base) var(--ease-soft),
              border-color var(--dur-base) var(--ease-soft);
}
.card--hover:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--border); }
.card--flat { box-shadow: none; }
.card--sand { background: var(--surface-sand); border-color: transparent; }
.card--primary { background: var(--primary); color: #EAF6F2; border-color: transparent; box-shadow: var(--shadow-teal); }
.card--primary h2, .card--primary h3 { color: #fff; }

.card__ico {
  display: grid; place-items: center;
  width: 3.25rem; height: 3.25rem;
  border-radius: var(--r-md);
  background: var(--primary-soft);
  color: var(--primary-deep);
  margin-bottom: var(--space-4);
}
.card__ico svg { width: 1.5rem; height: 1.5rem; stroke: currentColor; stroke-width: 1.5; fill: none; }
.card__ico--coral { background: var(--accent-soft); color: var(--coral-600); }
/* ---- Icônes 3D glossy (PNG) : la tuile colorée laisse place à l'icône 3D ---- */
.card__ico:has(.ic-3d), .f-ico:has(.ic-3d) { background: transparent !important; box-shadow: none; }
.card__ico .ic-3d, .f-ico .ic-3d { width: 100%; height: 100%; object-fit: contain; display: block; }
.checklist .tick:has(img) { background: transparent !important; overflow: visible; }
.checklist .tick img { width: 1.4rem; height: 1.4rem; max-width: none; object-fit: contain; display: block; }
.stars img.ic-star { width: 1.15rem; height: 1.15rem; object-fit: contain; display: inline-block; vertical-align: middle; }

/* ---- Carte de localisation (Leaflet) ---- */
.clinic-map { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; background: var(--surface-sand); }
.bezel__core .media-tag { z-index: 1000; pointer-events: none; }
.clinic-map .leaflet-control-attribution { font-size: 10px; background: rgba(255,255,255,0.75); }
.clinic-map .leaflet-bar a { color: var(--primary-deep); }
.clinic-map .leaflet-popup-content { font-family: var(--font-body, inherit); }
.card__num {
  font-family: var(--font-display); font-size: var(--fs-2xl);
  color: var(--primary); font-weight: 600; font-style: normal; letter-spacing: -0.02em;
}

/* ---------- Service card (avec visuel) ---------- */
.svc-card { display: flex; flex-direction: column; gap: var(--space-4); height: 100%; }
.svc-card .card__media {
  border-radius: var(--r-lg);
  overflow: hidden;
  aspect-ratio: 16 / 11;
  background: var(--surface-sand);
}
.svc-card .card__media img,
.svc-card .card__media svg { width: 100%; height: 100%; object-fit: cover; }
.svc-card h3 { font-size: var(--fs-xl); }
.svc-card .price-from { color: var(--text-muted); font-size: var(--fs-sm); }
.svc-card .price-from b { color: var(--primary-deep); font-weight: 600; }

/* ---------- Stat ---------- */
.stat { }
.stat__num {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 1.6rem + 2.5vw, 3.6rem);
  font-weight: 600;
  line-height: 1;
  color: var(--primary);
  letter-spacing: -0.03em;
}
.section--ink .stat__num { color: var(--teal-300); }
.stat__label { margin-top: var(--space-2); color: var(--text-soft); font-size: var(--fs-sm); }
.section--ink .stat__label { color: #B9D2CB; }

/* ---------- Avatar / portrait ---------- */
.avatar {
  border-radius: 50%;
  background: var(--surface-sand);
  object-fit: cover;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-sm);
}
.avatar-row { display: flex; }
.avatar-row .avatar { width: 2.6rem; height: 2.6rem; margin-left: -0.7rem; }
.avatar-row .avatar:first-child { margin-left: 0; }

/* ---------- Stars ---------- */
.stars { display: inline-flex; gap: 2px; color: var(--gold); }
.stars svg { width: 1.05rem; height: 1.05rem; fill: currentColor; }

/* ---------- Témoignage ---------- */
.quote { display: flex; flex-direction: column; gap: var(--space-4); height: 100%; }
.quote__text { font-family: var(--font-display); font-size: var(--fs-lg); line-height: 1.5; font-weight: 450; letter-spacing: -0.015em; color: var(--text); }
.quote__person { display: flex; align-items: center; gap: var(--space-3); margin-top: auto; }
.quote__person .avatar { width: 2.9rem; height: 2.9rem; }
.quote__name { font-weight: 600; font-size: var(--fs-sm); }
.quote__meta { color: var(--text-muted); font-size: var(--fs-xs); }

/* ---------- Pricing ---------- */
.price-list { display: flex; flex-direction: column; }
.price-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--border-soft);
}
.price-row:last-child { border-bottom: none; }
.price-row__name { font-weight: 600; }
.price-row__desc { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 400; }
.price-row__dots { flex: 1; border-bottom: 1px dotted var(--border); transform: translateY(-4px); }
.price-row__amount { font-family: var(--font-display); font-size: var(--fs-lg); color: var(--primary-deep); white-space: nowrap; }
.price-row__amount small { font-family: var(--font-sans); font-size: var(--fs-xs); color: var(--text-muted); display: block; text-align: right; font-weight: 500; }

.price-note {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-4); border-radius: var(--r-md);
  background: var(--primary-tint); color: var(--text-soft); font-size: var(--fs-sm);
}
.price-note svg { width: 1.2rem; height: 1.2rem; stroke: var(--primary); flex: none; margin-top: 2px; fill: none; }

/* ---------- Accordion / FAQ ---------- */
.accordion { border-top: 1px solid var(--border); }
.acc-item { border-bottom: 1px solid var(--border); }
.acc-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-5) 0; text-align: left;
  font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 420; color: var(--text);
}
.acc-trigger .acc-sign {
  flex: none; width: 2rem; height: 2rem; border-radius: 50%;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-deep);
  transition: transform var(--dur-base) var(--ease-soft), background var(--dur-base);
}
.acc-trigger .acc-sign svg { width: 1rem; height: 1rem; stroke: currentColor; stroke-width: 2; fill: none; }
.acc-item[aria-expanded="true"] .acc-sign { transform: rotate(45deg); background: var(--primary); color: #fff; }
.acc-panel {
  overflow: hidden; height: 0;
  transition: height var(--dur-base) var(--ease-soft);
}
.acc-panel__inner { padding-bottom: var(--space-5); color: var(--text-soft); max-width: 60ch; }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 0.45rem; }
.label {
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: var(--tracking-wide);
  text-transform: uppercase; color: var(--text-soft);
}
.input, .textarea, .select {
  width: 100%;
  padding: 0.9rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  color: var(--text);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--ring);
}
.textarea { resize: vertical; min-height: 8rem; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234C5B57' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; background-size: 1.1rem; padding-right: 2.6rem; }

/* Choix horaire / chips radio */
.chip-group { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span {
  display: inline-flex; padding: 0.6rem 1rem; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface); font-size: var(--fs-sm); font-weight: 500;
  transition: all var(--dur-fast) var(--ease-soft);
}
.chip input:checked + span { background: var(--primary); color: #fff; border-color: transparent; box-shadow: var(--shadow-sm); }
.chip input:focus-visible + span { box-shadow: 0 0 0 4px var(--ring); }

.form-note { font-size: var(--fs-xs); color: var(--text-muted); }

/* ---------- Liste à puces check ---------- */
.checklist { display: flex; flex-direction: column; gap: var(--space-3); }
.checklist li { display: flex; gap: var(--space-3); align-items: flex-start; }
.checklist .tick {
  flex: none; width: 1.4rem; height: 1.4rem; border-radius: 50%; margin-top: 2px;
  background: var(--primary-soft); color: var(--primary-deep); display: grid; place-items: center;
}
.checklist .tick svg { width: 0.8rem; height: 0.8rem; stroke: currentColor; stroke-width: 2.5; fill: none; }

/* ---------- Pas-à-pas ---------- */
.steps { counter-reset: step; display: grid; gap: var(--space-6); }
.step { display: flex; gap: var(--space-4); align-items: flex-start; }
.step__num {
  counter-increment: step; flex: none;
  width: 2.8rem; height: 2.8rem; border-radius: var(--r-md);
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border);
  font-family: var(--font-display); color: var(--primary); font-size: var(--fs-lg);
}
.step__num::before { content: counter(step, decimal-leading-zero); }

/* ---------- Tag pill (filtres) ---------- */
.pill-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pill-nav a {
  padding: 0.5rem 1rem; border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 500;
  border: 1px solid var(--border); color: var(--text-soft); transition: all var(--dur-fast) var(--ease-soft);
}
.pill-nav a:hover, .pill-nav a[aria-current="true"] { background: var(--primary); color: #fff; border-color: transparent; }

/* ---------- Media tile (visuel de soin : dégradé + icône) ---------- */
.media-tile {
  position: relative;
  display: grid; place-items: center;
  width: 100%; height: 100%;
  border-radius: inherit;
  background: linear-gradient(150deg, var(--teal-100), var(--teal-50));
  overflow: hidden;
  color: var(--primary-deep);
}
.media-tile::before {
  content: ""; position: absolute; width: 60%; aspect-ratio: 1; border-radius: 50%;
  top: -18%; right: -12%; background: radial-gradient(circle, rgba(255,255,255,0.6), transparent 70%);
}
.media-tile::after {
  content: ""; position: absolute; width: 45%; aspect-ratio: 1; border-radius: 50%;
  bottom: -16%; left: -10%; background: radial-gradient(circle, var(--sand), transparent 70%); opacity: 0.7;
}
.media-tile svg { position: relative; width: 38%; max-width: 5.5rem; height: auto; stroke: currentColor; stroke-width: 1.4; fill: none; opacity: 0.92; }
.media-tile--sand  { background: linear-gradient(150deg, var(--sand), var(--cream)); color: var(--coral-600); }
.media-tile--teal  { background: linear-gradient(150deg, var(--teal-500), var(--teal-700)); color: #EAF6F2; }
.media-tile--deep  { background: radial-gradient(120% 120% at 30% 20%, var(--teal-600), var(--teal-900)); color: #EAF6F2; }
.media-tile--coral { background: linear-gradient(150deg, var(--coral-200), var(--coral-50)); color: var(--coral-600); }
[data-theme="dark"] .media-tile { background: linear-gradient(150deg, rgba(53,145,131,0.22), rgba(53,145,131,0.08)); color: var(--teal-300); }

/* tag posé sur un visuel */
.media-tag {
  position: absolute; top: 0.9rem; left: 0.9rem; z-index: 2;
  background: rgba(252,250,245,0.92); color: var(--primary-deep);
  padding: 0.35rem 0.8rem; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* ---------- Reveal au scroll ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  filter: blur(6px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out),
              filter var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal].is-in { opacity: 1; transform: none; filter: blur(0); }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; filter: none; }
}
