:root {
  --ink: #14110f;
  --ink-2: #1a1613;
  --ink-card: #211c18;
  --ivory: #f4efe7;
  --ivory-dim: #b9b0a2;
  --ivory-faint: #8a8175;
  --gold: #c9a86a;
  --gold-light: #e2c894;
  --gold-soft: #b79a63;
  --gold-dark: #a98849;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
  font-family: 'Manrope', sans-serif;
  background-color: var(--ink);
  color: var(--ivory);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Font + color utilities (backup for Tailwind arbitrary) */
.font-fraunces { font-family: 'Fraunces', Georgia, serif; }
.font-manrope { font-family: 'Manrope', sans-serif; }
.bg-ink { background-color: var(--ink); }
.bg-ink-2 { background-color: var(--ink-2); }
.bg-ink-card { background-color: var(--ink-card); }
.bg-gold { background-color: var(--gold); }
.bg-gold-light { background-color: var(--gold-light); }
.text-ink { color: var(--ink); }
.text-ivory { color: var(--ivory); }
.text-ivory-dim { color: var(--ivory-dim); }
.text-ivory-faint { color: var(--ivory-faint); }
.text-gold { color: var(--gold); }
.text-gold-soft { color: var(--gold-soft); }
.text-gold-light { color: var(--gold-light); }
.border-gold\/25 { border-color: rgba(201,168,106,.25); }
.hover\:text-gold:hover { color: var(--gold); }
.hover\:bg-gold-light:hover { background-color: var(--gold-light); }
.placeholder-ivory-faint::placeholder { color: var(--ivory-faint); }
.focus\:border-gold:focus { border-color: var(--gold); }

.text-gradient-gold {
  background: linear-gradient(105deg, var(--gold-light) 0%, var(--gold) 45%, var(--gold-dark) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Header */
#header { background: transparent; }
#header.scrolled {
  background: rgba(20, 17, 15, 0.85);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(201, 168, 106, 0.12);
}
.wordmark { letter-spacing: -0.01em; }
.nav-link { position: relative; }
.nav-link::after {
  content: ''; position: absolute; left: 0; bottom: -6px; width: 0; height: 1px;
  background: var(--gold); transition: width .35s cubic-bezier(.16,1,.3,1);
}
.nav-link:hover::after { width: 100%; }
.cta-line { box-shadow: 0 0 0 0 rgba(201,168,106,.4); transition: transform .3s, background-color .3s, box-shadow .3s; }
.cta-line:hover { transform: translateY(-1px); }

/* Hero */
.hero { background: var(--ink); }
.hero-bg {
  background:
    radial-gradient(ellipse 60% 50% at 78% 18%, rgba(201,168,106,0.16), transparent 60%),
    radial-gradient(ellipse 50% 60% at 15% 90%, rgba(201,168,106,0.08), transparent 55%),
    radial-gradient(circle at 50% 50%, rgba(30,25,21,1) 0%, var(--ink) 70%);
}
.hero-grain {
  opacity: .5; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}
.hero::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 140px; z-index: 5;
  background: linear-gradient(to bottom, transparent, var(--ink));
  pointer-events: none;
}
.credential { display: flex; flex-direction: column; gap: 2px; }
.credential span:first-child { line-height: 1; }

@keyframes pulseSoft { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: .4; } }
.animate-pulse-soft { animation: pulseSoft 2.6s ease-in-out infinite; }

/* Marquee */
.marquee-wrap { --gap: 2.5rem; }
.marquee { animation: marquee 32s linear infinite; will-change: transform; }
.marquee-item { font-family: 'Fraunces', serif; font-size: 1.35rem; color: var(--ivory-dim); font-weight: 400; }
.dot { color: var(--gold); font-size: .8rem; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marquee { animation: none; } }

/* Reveal */
.reveal-up { opacity: 0; transform: translateY(38px); transition: opacity .9s cubic-bezier(.16,1,.3,1), transform .9s cubic-bezier(.16,1,.3,1); }
.reveal-up.revealed { opacity: 1; transform: translateY(0); }

/* Buttons */
.btn-gold {
  box-shadow: 0 8px 30px -8px rgba(201,168,106,.5);
  transition: transform .3s ease, box-shadow .3s ease, background-color .3s ease;
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 14px 40px -8px rgba(201,168,106,.65); }
.btn-outline-gold {
  color: var(--gold); border: 1px solid rgba(201,168,106,.4);
  transition: background-color .3s, border-color .3s, color .3s, transform .3s;
}
.btn-outline-gold:hover { background: rgba(201,168,106,.1); border-color: var(--gold); transform: translateY(-2px); }

/* Feature card */
.feature-card { background: linear-gradient(120deg, rgba(201,168,106,.06), rgba(33,28,24,.6)); transition: transform .4s, border-color .4s; }
.feature-card:hover { transform: translateY(-3px); border-color: rgba(201,168,106,.4); }
.feature-glow { background: radial-gradient(ellipse 40% 80% at 90% 50%, rgba(201,168,106,.12), transparent 70%); opacity: 0; transition: opacity .5s; }
.feature-card:hover .feature-glow { opacity: 1; }
.icon-frame {
  width: 100px; height: 100px; border-radius: 20px;
  background: rgba(201,168,106,.07); border: 1px solid rgba(201,168,106,.2);
  display: flex; align-items: center; justify-content: center;
}

/* Service cards */
.svc-card {
  background: var(--ink-card); border: 1px solid rgba(255,255,255,.05);
  border-radius: 20px; padding: 2rem;
  transition: transform .4s, border-color .4s, box-shadow .4s;
}
.svc-card:hover { transform: translateY(-5px); border-color: rgba(201,168,106,.25); box-shadow: 0 24px 50px -20px rgba(0,0,0,.6); }
.svc-icon {
  width: 56px; height: 56px; border-radius: 14px; margin-bottom: 1.25rem;
  background: rgba(201,168,106,.08); border: 1px solid rgba(201,168,106,.15);
  display: flex; align-items: center; justify-content: center; color: var(--gold);
  transition: transform .4s, background-color .4s;
}
.svc-icon svg { width: 30px; height: 30px; }
.svc-card:hover .svc-icon { transform: scale(1.08) rotate(-3deg); background: rgba(201,168,106,.14); }

/* Ortho */
.ortho-accent { background: radial-gradient(ellipse 50% 40% at 85% 0%, rgba(201,168,106,.08), transparent 60%); }
.ortho-card {
  position: relative; background: var(--ink-card); border: 1px solid rgba(255,255,255,.05);
  border-radius: 22px; padding: 2.5rem 2.25rem;
  transition: transform .4s, border-color .4s;
}
.ortho-card:hover { transform: translateY(-4px); border-color: rgba(201,168,106,.3); }
.ortho-card.featured-ortho { background: linear-gradient(150deg, rgba(201,168,106,.09), var(--ink-card) 60%); border-color: rgba(201,168,106,.2); }
.ortho-num {
  position: absolute; top: 1.75rem; right: 2rem;
  font-family: 'Fraunces', serif; font-size: 2.5rem; color: rgba(201,168,106,.22); line-height: 1;
}

/* Doctor */
.doctor-portrait {
  position: relative; aspect-ratio: 4/5; border-radius: 24px; overflow: hidden;
  background:
    radial-gradient(circle at 50% 35%, rgba(201,168,106,.2), transparent 55%),
    linear-gradient(160deg, #241f1a, #14110f);
  border: 1px solid rgba(201,168,106,.18);
  display: flex; align-items: center; justify-content: center;
}
.doctor-portrait::before {
  content: ''; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}
.monogram {
  font-size: 6rem; font-weight: 300; letter-spacing: .05em;
  color: transparent; -webkit-text-stroke: 1px rgba(201,168,106,.55);
  position: relative; z-index: 1;
}
.portrait-badge {
  position: absolute; left: 1.25rem; bottom: 1.25rem; z-index: 2;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--gold); border-radius: 14px; padding: .75rem 1.1rem;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.6);
}
.doctor-quote { position: relative; padding-left: 1.5rem; border-left: 2px solid var(--gold); }
.cred-row { display: flex; gap: .85rem; align-items: flex-start; }

/* Resultados / case slots */
.case-slot { aspect-ratio: 3/4; }
.case-inner {
  position: relative; width: 100%; height: 100%; border-radius: 18px; overflow: hidden;
  background: linear-gradient(160deg, #221d19, #16120f);
  border: 1px solid rgba(201,168,106,.14);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
  transition: border-color .4s, transform .4s;
}
.case-slot:hover .case-inner { border-color: rgba(201,168,106,.35); transform: translateY(-4px); }
.case-smile { width: 60%; color: rgba(201,168,106,.5); }
.case-label {
  font-family: 'Manrope', sans-serif; font-size: .7rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ivory-faint); position: absolute; top: 1rem; left: 1rem;
}
.case-inner::after {
  content: 'Próximamente'; position: absolute; bottom: 1rem; left: 1rem;
  font-family: 'Manrope', sans-serif; font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(201,168,106,.6);
}

/* Frontera */
.border-glow { background: radial-gradient(ellipse 45% 60% at 20% 30%, rgba(201,168,106,.1), transparent 60%); }
.stat-card {
  background: var(--ink-card); border: 1px solid rgba(255,255,255,.05);
  border-radius: 18px; padding: 1.75rem 1.5rem;
  display: flex; flex-direction: column; gap: .5rem;
  transition: border-color .4s, transform .4s;
}
.stat-card:hover { border-color: rgba(201,168,106,.28); transform: translateY(-3px); }
.stat-card span:first-child { line-height: 1; }

/* Testimonials */
.testi-card {
  background: var(--ink-card); border: 1px solid rgba(255,255,255,.05);
  border-radius: 20px; padding: 2rem;
  transition: transform .4s, border-color .4s, box-shadow .4s;
}
.testi-card:hover { transform: translateY(-4px); border-color: rgba(201,168,106,.25); box-shadow: 0 24px 50px -20px rgba(0,0,0,.6); }
.stars { color: var(--gold); letter-spacing: .1em; margin-bottom: 1.25rem; font-size: 1rem; }
.testi-name { display: flex; flex-direction: column; gap: 2px; padding-top: 1.25rem; border-top: 1px solid rgba(255,255,255,.06); }

/* FAQ */
.faq-item { border: 1px solid rgba(255,255,255,.07); border-radius: 16px; overflow: hidden; transition: border-color .3s; background: var(--ink-card); }
.faq-item.active { border-color: rgba(201,168,106,.3); }
.faq-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.35rem 1.75rem; text-align: left; background: none; border: none; cursor: pointer;
}
.faq-icon { transition: transform .35s; flex-shrink: 0; }
.faq-item.active .faq-icon { transform: rotate(180deg); }
.faq-answer { max-height: 0; overflow: hidden; padding: 0 1.75rem; transition: max-height .45s cubic-bezier(.16,1,.3,1); }
.faq-answer.open { max-height: 320px; }

/* CTA */
.cta-glow { background: radial-gradient(ellipse 50% 70% at 50% 50%, rgba(201,168,106,.12), transparent 65%); }

/* Contact */
.field {
  width: 100%; background: var(--ink-card); border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px; padding: .9rem 1.15rem; font-family: 'Manrope', sans-serif;
  color: var(--ivory); font-size: .95rem; transition: border-color .3s, box-shadow .3s;
}
.field::placeholder { color: var(--ivory-faint); }
.field:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 1px rgba(201,168,106,.35); }
select.field {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23b79a63' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 14px center; background-repeat: no-repeat; background-size: 20px;
}
select.field option { background: var(--ink-card); color: var(--ivory); }
.contact-row { display: flex; gap: 1rem; align-items: flex-start; }
.contact-ic {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  background: rgba(201,168,106,.08); border: 1px solid rgba(201,168,106,.18);
  display: flex; align-items: center; justify-content: center; color: var(--gold);
}
.contact-ic svg { width: 22px; height: 22px; }

/* Footer */
.footer-link { font-family: 'Manrope', sans-serif; font-size: .875rem; color: var(--ivory-dim); transition: color .3s; }
.footer-link:hover { color: var(--gold); }
.social-ic {
  width: 40px; height: 40px; border-radius: 999px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); color: var(--ivory-dim);
  transition: background-color .3s, border-color .3s, color .3s;
}
.social-ic svg { width: 18px; height: 18px; }
.social-ic:hover { background: rgba(201,168,106,.14); border-color: rgba(201,168,106,.35); color: var(--gold); }

/* Chat widget */
.chat-header { background: linear-gradient(100deg, var(--gold), var(--gold-dark)); }
@keyframes chatPulse { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08); opacity: .85; } 100% { transform: scale(1); opacity: 1; } }
.chat-pulse { animation: chatPulse 2.5s ease-in-out infinite; }
.chat-pulse.no-pulse { animation: none; }
#chat-panel.open { display: flex; }
.chat-msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; font-family: 'Manrope', sans-serif; font-size: .875rem; line-height: 1.5; word-wrap: break-word; }
.chat-msg.user { background: var(--gold); color: var(--ink); margin-left: auto; border-bottom-right-radius: 4px; font-weight: 500; }
.chat-msg.assistant { background: rgba(255,255,255,.06); color: var(--ivory); border-bottom-left-radius: 4px; }
.chat-msg a { color: var(--gold-light); text-decoration: underline; word-break: break-all; }
.chat-msg.user a { color: var(--ink); }
.chat-typing { display: flex; gap: 4px; padding: 12px 16px; align-items: center; }
.chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--ivory-faint); animation: typingBounce 1.4s ease-in-out infinite; }
.chat-typing span:nth-child(2) { animation-delay: .2s; }
.chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typingBounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* Scrollbar */
::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: rgba(201,168,106,.25); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(201,168,106,.4); }
#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); }

/* Hero portrait */
.hero-portrait-wrap { position: relative; width: 100%; max-width: 400px; margin: 0 auto; aspect-ratio: 4/5; }
.hero-geo {
  position: absolute; inset: -20px -20px 20px 22px; border-radius: 26px;
  background-color: #100d0b;
  background-image:
    repeating-linear-gradient(45deg, rgba(201,168,106,.09) 0 1px, transparent 1px 15px),
    repeating-linear-gradient(-45deg, rgba(201,168,106,.09) 0 1px, transparent 1px 15px);
  border: 1px solid rgba(201,168,106,.16);
}
.hero-geo::after { content: ''; position: absolute; inset: 0; border-radius: 26px; background: radial-gradient(circle at 72% 22%, rgba(201,168,106,.16), transparent 62%); }
.hero-portrait-img {
  position: relative; z-index: 2; width: 100%; height: 100%; object-fit: cover; object-position: top center;
  border-radius: 22px; border: 1px solid rgba(201,168,106,.38); box-shadow: 0 34px 70px -24px rgba(0,0,0,.75);
}
.hero-logo-badge {
  position: absolute; z-index: 3; bottom: -16px; left: -14px; width: 92px; height: auto;
  border-radius: 12px; border: 1px solid rgba(201,168,106,.3); box-shadow: 0 14px 34px -10px rgba(0,0,0,.7);
}
.hero-loc {
  position: absolute; z-index: 3; top: 16px; right: -12px; display: flex; align-items: center; gap: 8px;
  background: rgba(16,13,11,.85); backdrop-filter: blur(6px); border: 1px solid rgba(201,168,106,.2);
  padding: 7px 12px; border-radius: 999px;
}

/* Doctor real photo */
.doctor-portrait-img { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.doctor-portrait .portrait-badge { z-index: 3; }
.doctor-portrait::before { z-index: 1; pointer-events: none; }

/* Responsive */
@media (max-width: 1023px) {
  .hero-portrait-wrap { max-width: 340px; margin-top: 1.5rem; }
}
@media (max-width: 640px) {
  #chat-panel { width: calc(100vw - 32px); right: -8px; height: 440px; }
  #chat-tooltip { display: none; }
  .monogram { font-size: 4.5rem; }
}
