/* WhatsApp para Pymes — lenguaje del diseño base (Dribbble #1):
   fondo claro azulado, tarjetas blancas, panel de vista previa azul royal,
   inputs minimalistas de una línea, botones píldora y micro-animaciones. */
:root {
  --ink: #0a1e5e;
  --royal: #0b2ea8;
  --royal-deep: #010847;
  --accent: #f45301;
  --sky: #1ea7e8;
  --mut: #5a6b8c;
  --line: #d8e2f0;
  --soft: #f2f6fd;
  --radius: 28px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #d9e9f8 0%, #e9f1fa 55%, #eef4fb 100%);
  line-height: 1.55;
  min-height: 100vh;
}
body::before, body::after {
  content: ""; position: fixed; border-radius: 50%; filter: blur(90px);
  pointer-events: none; z-index: 0; opacity: .5;
}
body::before { width: 480px; height: 480px; background: #bcd6ff; top: -140px; right: -120px; animation: floaty 16s ease-in-out infinite alternate; }
body::after { width: 420px; height: 420px; background: #ffd9c2; bottom: -160px; left: -120px; animation: floaty 20s ease-in-out infinite alternate-reverse; }
@keyframes floaty { from { transform: translate(0, 0) scale(1); } to { transform: translate(-40px, 34px) scale(1.08); } }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }

/* ---------- Header ---------- */
.top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(10, 30, 94, .08);
  transition: box-shadow .25s ease;
}
.top.scrolled { box-shadow: 0 10px 30px rgba(10, 46, 160, .12); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 13px; padding-bottom: 13px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.brand img { background: var(--royal-deep); border-radius: 9px; padding: 3px; box-shadow: 0 6px 14px rgba(1, 8, 71, .28); }
nav { display: flex; align-items: center; gap: 26px; }
nav a { position: relative; color: #41538a; text-decoration: none; font-weight: 600; font-size: 14.5px; padding: 4px 0; transition: color .2s ease; }
nav a::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--accent); border-radius: 2px; transform: scaleX(0); transform-origin: left; transition: transform .25s ease; }
nav a:hover { color: var(--ink); }
nav a:hover::after { transform: scaleX(1); }
nav a.nav-pro { background: linear-gradient(180deg, #ff6a1f, var(--accent)); color: #fff; padding: 9px 18px; border-radius: 999px; font-weight: 700; box-shadow: 0 10px 22px rgba(244, 83, 1, .32); transition: transform .18s ease, box-shadow .18s ease; }
nav a.nav-pro::after { display: none; }
nav a.nav-pro:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 14px 28px rgba(244, 83, 1, .4); }

/* ---------- Riel lateral de navegación (como el del diseño) ---------- */
.pg-rail {
  position: fixed; left: 18px; top: 50%; transform: translateY(-50%); z-index: 40;
  background: #fff; border-radius: 999px; padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: 0 18px 44px rgba(10, 46, 160, .18);
}
.pg-rail a {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  color: #8296bd; transition: all .22s ease;
}
.pg-rail a svg { width: 20px; height: 20px; }
.pg-rail a:hover { color: var(--royal); background: var(--soft); }
.pg-rail a.on { background: var(--royal-deep); color: #fff; box-shadow: 0 8px 18px rgba(1, 8, 71, .35); }
@media (max-width: 1279px) { .pg-rail { display: none; } }

/* ---------- Hero ---------- */
.hero { padding: 58px 0 6px; max-width: 700px; }
.hero h1 { font-size: 46px; line-height: 1.08; letter-spacing: -.025em; margin: 0 0 16px; color: var(--royal-deep); }
.hero h1 .hl { color: var(--royal); }
.lead { font-size: 18px; color: var(--mut); margin: 0; }
.lead strong { color: var(--ink); }

/* ---------- Tarjetas de herramienta ---------- */
.tool {
  background: #fff; border-radius: var(--radius); padding: 40px;
  display: grid; grid-template-columns: 1.05fr 400px; gap: 38px;
  box-shadow: 0 24px 60px rgba(10, 46, 160, .10);
  margin: 26px 0;
}
.kicker { color: var(--accent); font-weight: 800; font-size: 11px; letter-spacing: .15em; text-transform: uppercase; margin: 0 0 10px; }
.kicker.light { color: #ffb287; }
.tool-form h2, .pro h2 { font-size: 28px; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 8px; color: var(--royal-deep); }
label, .lbl { display: block; font-weight: 600; font-size: 13.5px; color: #33477a; margin-top: 20px; }
label:first-of-type { margin-top: 14px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 11px 2px;
  border: 0; border-bottom: 1.5px solid var(--line); border-radius: 0;
  background: transparent; font: inherit; font-size: 15.5px; color: var(--ink);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
input::placeholder, textarea::placeholder { color: #9db0d2; }
input:hover, select:hover, textarea:hover { border-bottom-color: #b7c8e6; }
input:focus, select:focus, textarea:focus { outline: none; border-bottom-color: var(--royal); box-shadow: 0 1.5px 0 var(--royal); background: linear-gradient(180deg, transparent 88%, rgba(11, 46, 168, .05)); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 26px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%230a1e5e' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 4px center;
}
input[type="file"] { border: 1.5px dashed #b9c9e4; border-radius: 14px; padding: 14px; background: var(--soft); cursor: pointer; }
input[type="file"]:hover { border-color: var(--royal); }
textarea { resize: vertical; min-height: 52px; }
.hint { color: var(--mut); font-size: 13px; margin: 14px 0 0; }
.err { color: #d92d20; font-size: 13.5px; min-height: 1.2em; margin: 10px 0 0; font-weight: 600; }
.row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

/* ---------- Selector de tipo QR (riel de píldoras con íconos) ---------- */
.typerail { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.typebtn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--soft);
  color: #41538a; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
  transition: all .2s ease;
}
.typebtn svg { width: 17px; height: 17px; }
.typebtn:hover { border-color: var(--royal); color: var(--royal); transform: translateY(-1px); }
.typebtn.on { background: linear-gradient(180deg, #0d33b8, #0a247e); border-color: transparent; color: #fff; box-shadow: 0 10px 22px rgba(10, 46, 160, .30); }

/* ---------- Panel de vista previa (azul royal, como el diseño) ---------- */
.tool-preview {
  background: linear-gradient(165deg, #0d33b4 0%, var(--royal) 42%, var(--royal-deep) 115%);
  border-radius: 22px; padding: 26px; color: #fff; text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 18px 38px rgba(1, 8, 71, .25);
  align-self: start;
}
.tool-preview > * { margin-bottom: 14px; }
.tool-preview > *:last-child { margin-bottom: 0; }
.pv-title { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: rgba(255, 255, 255, .55); font-weight: 800; margin: 0 0 14px; }
.pv-ph { border: 1.5px dashed rgba(255, 255, 255, .35); border-radius: 16px; padding: 28px 16px; color: rgba(255, 255, 255, .78); font-size: 13.5px; }
.pv-ph p { margin: 8px 0 0; }
.pv-qr-icon { font-size: 30px; color: rgba(255, 255, 255, .85); }
.out { display: block; width: 100%; }
.out > * { margin-bottom: 12px; }
.out > *:last-child { margin-bottom: 0; }
.out code {
  display: block; width: 100%; word-break: break-all; text-align: left;
  background: rgba(255, 255, 255, .10); border: 1px solid rgba(255, 255, 255, .22);
  color: #dbe7ff; padding: 10px 12px; border-radius: 12px; font-size: 12.5px;
  user-select: all; cursor: text;
}
.qr-box {
  width: 100%; max-width: 236px; aspect-ratio: 1 / 1; margin-inline: auto;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 18px; padding: 12px;
  background: rgba(255, 255, 255, .06);
}
.qr-box:has(> canvas[hidden]) { display: none; }
.tool-preview canvas { width: 100% !important; height: 100% !important; display: block; border-radius: 8px; }
.st-box {
  width: 100%; max-width: 236px; aspect-ratio: 1 / 1; margin-inline: auto;
  background: #fff; border-radius: 18px; padding: 10px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .25);
}
#st-canvas { background: repeating-conic-gradient(#e8eaf6 0% 25%, #fff 0% 50%) 0 0/24px 24px; }
.tool-preview .hint { color: rgba(255, 255, 255, .68); }
section[id] { scroll-margin-top: 92px; }

/* ---------- Blindaje responsive ---------- */
.tool > *, .pro > * { min-width: 0; }
.tool-form { min-width: 0; }
.tool-form input, .tool-form select, input[type="file"] { max-width: 100%; min-width: 0; }
canvas, img, svg, video { max-width: 100%; }
@media (max-width: 380px) {
  .wrap { padding: 0 14px; }
  .tool, .pro { padding: 20px; }
}

/* ---------- Botones píldora ---------- */
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border-radius: 999px; border: 0;
  font: inherit; font-size: 14.5px; font-weight: 700; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease;
}
.pill svg { width: 17px; height: 17px; flex: none; }
.pill:active { transform: scale(.97); }
.pill:focus-visible, a:focus-visible, .typebtn:focus-visible { outline: 3px solid rgba(244, 83, 1, .55); outline-offset: 2px; }
.pill[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-white { background: #fff; color: var(--ink); box-shadow: 0 8px 20px rgba(0, 0, 0, .18); }
.btn-white:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(0, 0, 0, .24); }
.btn-white.done { background: #12b76a; color: #fff; }
.btn-glass { background: rgba(255, 255, 255, .13); color: #fff; border: 1px solid rgba(255, 255, 255, .38); }
.btn-glass:hover { background: rgba(255, 255, 255, .22); transform: translateY(-1px); }
.btn-sky { background: linear-gradient(180deg, #45c2f5, var(--sky)); color: #fff; box-shadow: 0 12px 24px rgba(30, 167, 232, .35); }
.btn-sky:hover { transform: translateY(-1px); box-shadow: 0 16px 30px rgba(30, 167, 232, .45); }
.btn-orange { background: linear-gradient(180deg, #ff6a1f, var(--accent)); color: #fff; box-shadow: 0 12px 24px rgba(244, 83, 1, .38); }
.btn-orange:hover { transform: translateY(-1px); box-shadow: 0 16px 32px rgba(244, 83, 1, .48); }
.btn-navy { background: linear-gradient(180deg, #0d33b8, #0a247e); color: #fff; box-shadow: 0 14px 28px rgba(10, 46, 160, .35); }
.btn-navy:hover { transform: translateY(-1px); box-shadow: 0 18px 34px rgba(10, 46, 160, .42); }
.pill.wide { width: 100%; }
.pill.big { height: 54px; padding: 0 30px; font-size: 16px; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.btn-grid .pill { width: 100%; padding: 0 10px; }

/* ---------- Filas de opciones (FRAME / SHAPE & COLOR / LOGO del diseño) ---------- */
.opt-stack { display: block; text-decoration: none; margin-top: 16px; }
.optrow {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; margin-bottom: 8px; border-radius: 12px;
  background: rgba(255, 255, 255, .10); border: 1px solid rgba(255, 255, 255, .10);
  color: #cfe0ff; font-size: 11px; font-weight: 800; letter-spacing: .11em;
  transition: background .2s ease, transform .2s ease;
}
.optrow:last-child { margin-bottom: 0; }
.optrow .chev { font-size: 16px; color: rgba(255, 255, 255, .6); }
.opt-stack:hover .optrow { background: rgba(255, 255, 255, .17); }
.opt-stack:hover .optrow:nth-child(2) { transform: translateX(3px); }

/* ---------- Pro ---------- */
.pro {
  background: linear-gradient(160deg, #12298f, var(--royal-deep) 75%);
  color: #e7edff; border-radius: var(--radius); padding: 40px; margin: 26px 0;
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 30px;
  box-shadow: 0 24px 60px rgba(1, 8, 71, .35);
}
.pro h2 { color: #fff; }
.pro ul { margin: 12px 0 0; padding-left: 18px; }
.pro li { margin-bottom: 10px; }
.pro-buy {
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 20px; padding: 26px; text-align: center; align-self: start;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.price { font-size: 46px; font-weight: 800; margin: 0; color: #fff; letter-spacing: -.02em; }
.price-sub { margin: 0; color: #b9c8f2; font-size: 13.5px; }
.pro-buy .hint { color: #93a7dd; margin: 0; }
.pro-steps { grid-column: 1 / -1; border-top: 1px solid rgba(255, 255, 255, .18); padding-top: 20px; }
.pro-steps h3 { margin: 0 0 10px; font-size: 17px; color: #fff; }
.pro-steps ol { margin: 0; padding-left: 20px; }
.pro-steps li { margin-bottom: 7px; }

/* ---------- Contenido SEO y pie ---------- */
.seo { padding: 18px 6px 8px; max-width: 780px; }
.seo h2 { font-size: 21px; color: var(--royal-deep); letter-spacing: -.015em; margin: 26px 0 8px; }
.seo h3 { font-size: 18px; color: var(--royal-deep); margin: 26px 0 8px; }
.seo p { color: var(--mut); margin: 0 0 12px; }
.seo strong { color: var(--ink); }
.foot { border-top: 1px solid rgba(10, 30, 94, .10); margin-top: 34px; padding: 22px 0 30px; color: var(--mut); font-size: 13.5px; }
.foot strong { color: var(--ink); }

/* ---------- Animaciones ---------- */
.reveal { opacity: 0; }
.reveal.in { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.pop { animation: pop .45s cubic-bezier(.2, .7, .2, 1); }
@keyframes pop { 0% { transform: scale(.9); opacity: .35; } 55% { transform: scale(1.035); } 100% { transform: scale(1); opacity: 1; } }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .tool { grid-template-columns: 1fr; padding: 26px; gap: 24px; }
  .tool-preview { align-self: stretch; }
  .pro { grid-template-columns: 1fr; padding: 26px; }
  .hero { padding-top: 34px; }
  .hero h1 { font-size: 33px; }
  nav a:not(.nav-pro) { display: none; }
  .brand { font-size: 17px; }
}
@media (max-width: 420px) {
  .btn-grid { grid-template-columns: 1fr; }
  .pill { height: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; }
}

/* Placeholders de vista previa: se ocultan cuando ya hay resultado */
section:has(#wa-out:not([hidden])) .pv-ph { display: none; }
section:has(#qr-canvas:not([hidden])) .pv-ph-qr { display: none; }
