/* ===========================================================
   Clínica Dental Bahía — estilos personalizados
   =========================================================== */

:root {
  --primary: #0a2a4a;
  --primary-dark: #061b32;
  --accent: #14b8a6;
}

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* Material Symbols */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}
.material-symbols-outlined.filled { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

/* Elevation helpers */
.shadow-low { box-shadow: 0 2px 8px rgba(10, 42, 74, 0.06); }
.shadow-high { box-shadow: 0 24px 60px -12px rgba(10, 42, 74, 0.22); }

/* Glass surfaces */
.glass-panel {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.55);
}
.glass-dark {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

/* Gradient text */
.text-gradient {
  background: linear-gradient(120deg, #0a2a4a 0%, #1e4a78 55%, #14b8a6 120%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.9s cubic-bezier(0.16,1,0.3,1), transform 0.9s cubic-bezier(0.16,1,0.3,1); will-change: opacity, transform; }
.reveal.is-visible { opacity: 1; transform: none; }
.reveal.delay-1 { transition-delay: 0.12s; }
.reveal.delay-2 { transition-delay: 0.24s; }
.reveal.delay-3 { transition-delay: 0.36s; }

/* Hero background canvas */
#shader-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: 0.7; }

/* ===========================================================
   Hero 3D — embed de Sketchfab (carilla E-MAX real)
   =========================================================== */
.hero-panel { background: radial-gradient(120% 120% at 50% 22%, #17324e 0%, #0c2740 60%, #071b30 100%); }
.sketchfab-embed { width: 100%; height: 100%; border: 0; display: block; }
.hero-3d-wrap { position: absolute; inset: 0; }
.ar-btn { display: inline-flex; align-items: center; gap: 0.5rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; font-family: 'Inter', sans-serif; font-weight: 600; letter-spacing: 0.02em; border-radius: 9999px; transition: all 0.3s cubic-bezier(0.16,1,0.3,1); cursor: pointer; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 24px rgba(10,42,74,0.18); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 16px 34px rgba(10,42,74,0.28); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-ghost { background: rgba(255,255,255,0.85); color: var(--primary); border: 1px solid rgba(10,42,74,0.15); }
.btn-ghost:hover { background: #fff; border-color: rgba(10,42,74,0.3); transform: translateY(-2px); }

/* Underline nav link */
.nav-link { position: relative; }
.nav-link::after { content: ''; position: absolute; left: 0; bottom: -6px; height: 2px; width: 0; background: var(--primary); transition: width 0.3s cubic-bezier(0.16,1,0.3,1); }
.nav-link:hover::after, .nav-link.active::after { width: 100%; }

/* Service card icon micro-interaction */
.service-card:hover .service-icon { transform: scale(1.08) rotate(-6deg); }
.service-icon { transition: transform 0.4s cubic-bezier(0.16,1,0.3,1); }

/* Toast */
#toast-wrap { position: fixed; z-index: 100; top: 1.25rem; right: 1.25rem; display: flex; flex-direction: column; gap: 0.6rem; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 0.7rem; min-width: 280px; max-width: 92vw; padding: 0.9rem 1.1rem; border-radius: 0.875rem; background: #fff; color: #1a1c1c; box-shadow: 0 18px 40px rgba(10,42,74,0.18); border: 1px solid #eef2f6; transform: translateX(120%); opacity: 0; transition: transform 0.5s cubic-bezier(0.16,1,0.3,1), opacity 0.5s; pointer-events: auto; }
.toast.show { transform: none; opacity: 1; }
.toast .material-symbols-outlined { font-size: 22px; }
.toast--success { border-left: 4px solid #0E8F84; }
.toast--success .material-symbols-outlined { color: #0E8F84; }
.toast--error { border-left: 4px solid #ba1a1a; }
.toast--error .material-symbols-outlined { color: #ba1a1a; }
.toast--info { border-left: 4px solid #1E4A78; }
.toast--info .material-symbols-outlined { color: #1E4A78; }

/* Mobile menu drawer */
#mobile-menu { transition: opacity 0.4s ease, visibility 0.4s ease; }
#mobile-menu .drawer { transition: transform 0.45s cubic-bezier(0.16,1,0.3,1); }

/* Form field states */
.field-error { border-color: #ba1a1a !important; }
.error-msg { color: #ba1a1a; font-size: 0.78rem; margin-top: 0.35rem; display: none; }
.error-msg.show { display: block; }

/* Calendar */
.cal-day { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 9999px; font-size: 0.9rem; transition: all 0.2s ease; }
.cal-day:not(.disabled):not(.selected):hover { background: #DDE7F1; }
.cal-day.selected { background: var(--primary); color: #fff; font-weight: 600; box-shadow: 0 6px 16px rgba(10,42,74,0.25); }
.cal-day.disabled { opacity: 0.32; cursor: not-allowed; }
.cal-day.today:not(.selected) { box-shadow: inset 0 0 0 1.5px var(--accent); }

/* Time slot */
.slot { padding: 0.6rem 0.5rem; border-radius: 0.75rem; border: 1px solid #dfe1e8; font-size: 0.9rem; transition: all 0.2s ease; }
.slot:not(.disabled):hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.slot.selected { border: 2px solid var(--primary); background: rgba(10,42,74,0.05); color: var(--primary); font-weight: 600; }
.slot.disabled { opacity: 0.4; cursor: not-allowed; text-decoration: line-through; }

/* Spinner */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* FAQ accordion */
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.4s cubic-bezier(0.16,1,0.3,1); }
.faq-item.open .faq-answer { max-height: 320px; }
.faq-item.open .faq-chevron { transform: rotate(180deg); }
.faq-chevron { transition: transform 0.4s ease; }

/* Success pop */
.success-pop { animation: popIn 0.7s cubic-bezier(0.175,0.885,0.32,1.275) forwards; }
@keyframes popIn { 0% { transform: scale(0.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.tabular { font-variant-numeric: tabular-nums; }
.pb-safe { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
@media (min-width: 768px) { main { scroll-margin-top: 0; } }
section[id] { scroll-margin-top: 96px; }

/* ===========================================================
   Slider Antes / Después
   =========================================================== */
.ba-frame { position: relative; overflow: hidden; border-radius: 1.75rem; touch-action: none; user-select: none; --pos: 50%; cursor: ew-resize; }
.ba-frame img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.ba-layer { position: absolute; inset: 0; }
.ba-before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.ba-before img { filter: sepia(0.38) saturate(0.55) brightness(0.9) contrast(0.96); }
.ba-line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; background: rgba(255,255,255,0.95); transform: translateX(-1px); box-shadow: 0 0 14px rgba(10,42,74,0.4); }
.ba-knob { position: absolute; top: 50%; left: var(--pos); transform: translate(-50%,-50%); width: 46px; height: 46px; border-radius: 9999px; background: #fff; box-shadow: 0 10px 26px rgba(10,42,74,0.35); display: flex; align-items: center; justify-content: center; color: #0A2A4A; }
.ba-chip { position: absolute; top: 16px; padding: 0.32rem 0.85rem; border-radius: 9999px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; backdrop-filter: blur(8px); }
.case-btn { transition: all 0.3s cubic-bezier(0.16,1,0.3,1); }
.case-btn.active { background: var(--primary); color: #fff; box-shadow: 0 8px 22px rgba(10,42,74,0.25); }

/* Pasos del laboratorio */
.steps { position: relative; }
@media (min-width: 768px) {
  .steps::before { content: ''; position: absolute; top: 36px; left: 9%; right: 9%; height: 2px;
    background: linear-gradient(90deg, rgba(20,184,166,0.35), rgba(10,42,74,0.18)); }
}
.step-num { position: relative; z-index: 1; }

/* Línea de tiempo tecnológica */
.tl { position: relative; }
.tl::before { content: ''; position: absolute; left: 23px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(rgba(10,42,74,0.15), rgba(20,184,166,0.4)); }
.tl-item { position: relative; padding-left: 68px; padding-bottom: 2.4rem; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: 23px; transform: translateX(-50%); top: 0; width: 46px; height: 46px;
  border-radius: 9999px; background: #fff; border: 2px solid #14B8A6; display: flex; align-items: center;
  justify-content: center; color: #0A2A4A; box-shadow: 0 8px 20px rgba(10,42,74,0.12); }
@media (min-width: 900px) {
  .tl::before { left: 50%; transform: translateX(-1px); }
  .tl-item { width: 50%; padding-left: 0; padding-right: 60px; text-align: right; }
  .tl-item:nth-child(even) { margin-left: 50%; padding-right: 0; padding-left: 60px; text-align: left; }
  .tl-item .tl-dot { left: auto; right: 0; transform: translateX(50%); }
  .tl-item:nth-child(even) .tl-dot { right: auto; left: 0; transform: translateX(-50%); }
}
