/* Page loader */
#page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.38);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
#page-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-bar {
  width: 160px;
  height: 3px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.loader-bar span {
  display: block;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, #00b4f0, #33c9ff);
  border-radius: 999px;
  animation: loaderSlide 1s ease-in-out infinite;
}
@keyframes loaderPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(0.97); }
}
@keyframes loaderSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  will-change: opacity, transform;
  transition: opacity 1.65s cubic-bezier(0.16, 1, 0.3, 1), transform 1.65s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  will-change: auto;
}
.reveal-scale {
  opacity: 0;
  transform: translateY(28px) scale(0.98);
  will-change: opacity, transform;
  transition: opacity 1.85s cubic-bezier(0.16, 1, 0.3, 1), transform 1.85s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.is-visible .reveal-scale {
  opacity: 1;
  transform: translateY(0) scale(1);
  will-change: auto;
}
.reveal-delay-1 { transition-delay: 0.14s; }
.reveal-delay-2 { transition-delay: 0.28s; }
.reveal-delay-3 { transition-delay: 0.42s; }

@media (max-width: 900px) {
  .reveal {
    transform: translateY(28px);
    transition-duration: 1.65s, 1.65s;
  }

  .reveal-scale {
    transform: translateY(28px) scale(0.98);
    transition-duration: 1.85s, 1.85s;
  }
}

/* Header scroll — frosted glass */
header {
  transition: background 0.3s ease, box-shadow 0.3s ease, backdrop-filter 0.3s ease, border-color 0.3s ease;
}
header.is-scrolled {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: rgba(241, 245, 249, 0.8);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

/* 54smiles extras */
.hero.is-visible .hero-content > * {
  animation: heroFadeUp 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  opacity: 0;
}
.hero.is-visible .hero-label { animation-delay: 0.15s; }
.hero.is-visible .hero-title { animation-delay: 0.3s; }
.hero.is-visible .hero-tagline { animation-delay: 0.38s; }
.hero.is-visible .hero-supporting { animation-delay: 0.42s; }
.hero.is-visible .btn-consultation { animation-delay: 0.45s; }
@keyframes heroFadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
.contact-map-wrapper--embed { padding: 0; height: 220px; }
.contact-map-wrapper--embed iframe { width: 100%; height: 100%; border: 0; }
.contacts-grid--single { grid-template-columns: 1fr !important; max-width: 640px; margin: 0 auto; }
.form-message { margin-bottom: 1rem; padding: 0.875rem 1rem; border-radius: 10px; font-size: 0.9rem; }
.form-message.success { background: #ecfdf5; border: 1px solid #6ee7b7; color: #065f46; }
.form-message.error { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.form-message.hidden { display: none; }
.form-group input.is-error, .form-group textarea.is-error, .form-group select.is-error { border-color: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,0.15); }
.form-error { color: #dc2626; font-size: 0.8rem; margin-top: 0.35rem; }
.hp-field { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }
body.is-loading { overflow: hidden; }
body.modal-open { overflow: hidden; }

/* Consultation modal */
.consult-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.consult-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.consult-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.consult-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  max-height: min(90dvh, 720px);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.28) transparent;
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid rgba(0, 180, 240, 0.15);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.2);
  padding: 1.75rem 1.5rem 1.5rem;
  transform: translateY(24px) scale(0.98);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.consult-modal__panel::-webkit-scrollbar {
  width: 5px;
}
.consult-modal__panel::-webkit-scrollbar-track {
  background: transparent;
  margin: 0.5rem 0;
}
.consult-modal__panel::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  border: 1px solid transparent;
  background-clip: padding-box;
}
.consult-modal__panel:hover::-webkit-scrollbar-thumb,
.consult-modal__panel:focus-within::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.42);
  background-clip: padding-box;
}
.consult-modal.is-open .consult-modal__panel {
  transform: translateY(0) scale(1);
}
.consult-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.consult-modal__close:hover {
  background: #e0f7fe;
  color: #00b4f0;
}
.consult-modal__header {
  text-align: center;
  margin-bottom: 1.25rem;
  padding-right: 2rem;
}
.consult-modal__logo {
  height: 36px;
  width: auto;
  margin-bottom: 0.75rem;
}
.consult-modal__header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.35rem;
}
.consult-modal__header p {
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.45;
}
.consult-modal__form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
  min-width: 0;
}
.consult-modal__form .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.consult-modal__form .partner-fields:not([hidden]) {
  display: block;
}
.consult-modal__form label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}
.consult-modal__form input,
.consult-modal__form select,
.consult-modal__form textarea {
  padding: 0.65rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 16px;
  font-family: 'Inter', sans-serif;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.consult-modal__form input:focus,
.consult-modal__form select:focus,
.consult-modal__form textarea:focus {
  outline: none;
  border-color: #00b4f0;
  box-shadow: 0 0 0 3px rgba(0, 180, 240, 0.15);
}
.consult-modal__form input::placeholder,
.consult-modal__form textarea::placeholder {
  color: rgba(148, 163, 184, 0.65);
  font-size: 0.85rem;
  opacity: 1;
}
.consult-modal__form .form-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  margin-top: 0.5rem;
}
.consult-modal__form .consent-group {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  max-width: none;
  width: 100%;
}
.consult-modal__form .consent-group label {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.4;
}
.consult-modal__form .btn-submit {
  width: 100%;
  white-space: normal;
}

@media (min-width: 480px) {
  .consult-modal__form .form-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 1.25rem;
  }

  .consult-modal__form .btn-submit {
    width: auto;
    flex: 0 0 auto;
    min-width: 9rem;
  }

  .consult-modal__form .consent-group {
    flex: 1 1 12rem;
    min-width: 0;
  }
}

@media (max-width: 540px) {
  .consult-modal {
    align-items: flex-end;
    padding: 0;
  }
  .consult-modal__panel {
    max-width: none;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
    padding: 1.5rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  }
  .consult-modal__form .form-row {
    grid-template-columns: 1fr;
  }

  .consult-modal__form .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .consult-modal__form .btn-submit {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .consult-modal,
  .consult-modal__panel {
    transition: none;
  }
  .consult-modal__panel {
    transform: none;
  }
}

:root {
  --fab-inset-x: 1.5rem;
  --fab-inset-y: 1.5rem;
  --fab-size: 3.25rem;
  --fab-stack-gap: 0.5rem;
}

.whatsapp-float {
  position: fixed;
  bottom: calc(var(--fab-inset-y) + env(safe-area-inset-bottom, 0px));
  right: calc(var(--fab-inset-x) + env(safe-area-inset-right, 0px));
  z-index: 90;
  width: var(--fab-size);
  height: var(--fab-size);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #25d366;
  color: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.45);
  transition: transform 0.2s;
}
.whatsapp-float:hover { transform: scale(1.06); }
.whatsapp-float svg { width: 26px; height: 26px; fill: currentColor; }

/* Floating scroll — stacked above WhatsApp, all viewports */
.scroll-float {
  position: fixed;
  bottom: calc(var(--fab-inset-y) + var(--fab-size) + var(--fab-stack-gap) + env(safe-area-inset-bottom, 0px));
  right: calc(var(--fab-inset-x) + env(safe-area-inset-right, 0px));
  z-index: 91;
}

.scroll-float__btn {
  position: relative;
  width: var(--fab-size);
  height: var(--fab-size);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 180, 240, 0.35);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #00b4f0;
  cursor: pointer;
  opacity: 0.4;
  box-shadow: 0 4px 16px rgba(0, 180, 240, 0.15);
  transition: opacity 0.25s ease, background 0.25s ease, border-color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
}

.scroll-float__btn:hover,
.scroll-float__btn:focus-visible,
.scroll-float__btn.is-active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.92);
  border-color: #00b4f0;
  box-shadow: 0 6px 22px rgba(0, 180, 240, 0.3);
  transform: translateY(-2px);
  outline: none;
}

.scroll-float__icon {
  position: absolute;
  width: 18px;
  height: 18px;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.scroll-float__icon.is-hidden {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
}

.scroll-float__icon.is-visible {
  opacity: 1;
  transform: scale(1);
}

@media (prefers-reduced-motion: reduce) {
  #page-loader {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(255, 255, 255, 0.78);
  }

  .reveal,
  .reveal-scale {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .aligner-product-visual__img,
  .aligner-product-visual__glow {
    animation: none !important;
  }

  .aligner-product-visual__img {
    opacity: 1;
    transform: none;
  }
}