/* Base común. Cada versión define sus tokens (--bg, --ink, --accent...) y su layout. */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.0625rem/1.6 var(--font-body); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.ph-slot { width: 100%; height: 100%; display: grid; place-items: center; align-content: center; gap: .5rem; text-align: center; color: var(--muted); background: repeating-linear-gradient(135deg, transparent 0 14px, color-mix(in srgb, var(--ink) 5%, transparent) 14px 15px); font-size: .9rem; }
.ph-slot .ph { font-size: 2rem; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 16px; z-index: 100; background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 8px; }
.skip:focus { left: 16px; }
.wrap { width: min(1240px, 100% - 32px); margin-inline: auto; }

/* Aparición progresiva (solo con JS y sin reduced-motion) */
.js [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .8s cubic-bezier(.16,1,.3,1), transform .8s cubic-bezier(.16,1,.3,1); transition-delay: calc(var(--i, 0) * 90ms); }
.js [data-reveal].in { opacity: 1; transform: none; }

/* Botones: microinteracción común */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; white-space: nowrap; text-decoration: none; font-weight: 600; background: none; color: inherit; border: 1.5px solid transparent; transition: transform .25s cubic-bezier(.16,1,.3,1), background-color .25s, color .25s, border-color .25s, box-shadow .25s; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn .ph { font-size: 1.2em; }
.btn[aria-busy=true] { opacity: .75; pointer-events: none; }
.btn[aria-busy=true]::after { content: ""; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Formularios */
.fields { display: grid; gap: 1.1rem; }
.grid2 { display: grid; gap: 1rem 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid2 .full { grid-column: 1 / -1; } }
.field { display: grid; gap: .35rem; align-content: start; }
.field label { font-weight: 600; font-size: .92rem; }
.field label small { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea { font: inherit; font-size: 1rem; width: 100%; padding: .8rem .95rem; border: 1.5px solid var(--field-line); border-radius: var(--r-field); background: var(--field-bg); color: var(--ink); transition: border-color .2s, box-shadow .2s; }
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }
.field [aria-invalid=true] { border-color: var(--error); }
.err { color: var(--error); font-size: .85rem; min-height: 1.2em; }
.hp { position: absolute; left: -9999px; }
.fine { font-size: .85rem; color: var(--muted); }
.sent .fields { display: none; }
.form-ok { display: grid; gap: .75rem; justify-items: start; padding: 1rem 0; outline: none; animation: rise .5s cubic-bezier(.16,1,.3,1); }
.form-ok[hidden] { display: none; }
.form-ok .ph-check-circle { font-size: 2.5rem; color: var(--ok, var(--accent)); }
.linkbtn { background: none; border: 0; padding: 0; text-decoration: underline; color: inherit; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* Pestañas */
[role=tabpanel][hidden] { display: none; }

/* Modal WhatsApp */
dialog { border: 0; padding: 0; width: min(540px, 100% - 32px); max-height: calc(100dvh - 32px); border-radius: var(--r-card); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgb(10 12 10 / .55); backdrop-filter: blur(4px); }
dialog[open] { animation: rise .4s cubic-bezier(.16,1,.3,1); }
.dlg-in { padding: clamp(1.25rem, 4vw, 2rem); display: grid; gap: 1rem; }
.dlg-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.dlg-head h2 { font-size: 1.5rem; line-height: 1.2; }
.x { background: none; border: 0; font-size: 1.5rem; padding: .25rem; color: inherit; border-radius: 8px; }

/* Barra fija móvil + volver arriba */
.mbar { display: none; }
@media (max-width: 767px) {
  .mbar { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr auto; gap: .5rem; padding: .6rem 16px calc(.6rem + env(safe-area-inset-bottom)); background: var(--mbar-bg, var(--surface)); border-top: 1px solid var(--line); }
  .mbar .btn { padding: .85rem 1rem; }
  body { padding-bottom: 80px; }
}
.totop { position: fixed; z-index: 30; right: 16px; bottom: 24px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 1.25rem; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .3s, transform .3s; }
.totop.show { opacity: 1; transform: none; pointer-events: auto; }
@media (max-width: 767px) { .totop { bottom: 92px; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}
