/* Generador de enlaces de WhatsApp — estilos */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/bricolage-grotesque-latin-wght.woff2") format("woff2");
}

:root {
  --paper: #f3f6f2;
  --surface: #ffffff;
  --ink: #15291f;
  --muted: #4d6157;
  --line: #d2dcd5;
  --line-strong: #a9b9ae;
  --deep: #0b3d2e;
  --deep-hover: #0e5440;
  --go: #13853f;
  --go-hover: #0f6f34;
  --go-done: #0b5a2a;
  --focus: #2f7dd1;
  --wall: #e6ede3;
  --wall-dot: #d6e1d2;
  --warn-bg: #fff4d6;
  --warn-ink: #6b4500;
  --error-bg: #fde8e6;
  --error-ink: #9b1c14;

  --radius-lg: 22px;
  --radius-md: 12px;
  --font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

img, svg { display: block; max-width: 100%; }

a { color: var(--deep); text-underline-offset: 3px; }
a:hover { color: var(--go-hover); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip {
  position: absolute;
  left: 16px; top: -60px;
  background: var(--deep); color: #fff;
  padding: 10px 14px; border-radius: 8px;
  z-index: 10;
}
.skip:focus { top: 12px; color: #fff; }

/* Encabezado */
.site-header { padding: 20px 0 8px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

/* Portada */
.hero { padding-top: 28px; padding-bottom: 56px; }

h1 {
  margin: 0;
  max-width: 15ch;
  font-size: clamp(2.3rem, 5.6vw, 4rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.lead {
  max-width: 58ch;
  margin: 18px 0 36px;
  font-size: 1.15rem;
  color: var(--muted);
}

/* Herramienta */
.tool {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 28px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -28px rgba(11, 61, 46, 0.45);
}

.field { margin-bottom: 18px; }
.field-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
}
.field-row .field { margin-bottom: 0; }

label {
  display: block;
  margin-bottom: 7px;
  font-weight: 650;
  font-size: 0.98rem;
}
.optional { font-weight: 400; color: var(--muted); }

input,
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  background: #fbfcfb;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  min-height: 50px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.45; }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%2315291f' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
input::placeholder,
textarea::placeholder { color: #7f9187; }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--deep);
  box-shadow: 0 0 0 3px rgba(47, 125, 209, 0.35);
}

input[aria-invalid="true"] { border-color: var(--error-ink); }

.hint {
  margin: 7px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}
.hint-split {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.hint-split span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }

#wa-phone-hint { margin-bottom: 18px; }

.notice {
  margin: -8px 0 18px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.93rem;
  line-height: 1.45;
  background: var(--warn-bg);
  color: var(--warn-ink);
}
.notice-error { background: var(--error-bg); color: var(--error-ink); }

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }

.btn-generate {
  width: 100%;
  min-height: 56px;
  font-size: 1.15rem;
  color: #fff;
  background: var(--deep);
}
.btn-generate:hover { background: var(--deep-hover); }

/* Resultado */
.result {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px dashed var(--line-strong);
}
.result.is-new { animation: aparecer .32s ease-out; }

.result-row {
  display: flex;
  gap: 10px;
}
.result-row input {
  flex: 1 1 auto;
  min-width: 0;
  background: #f1f5f1;
  border-color: var(--line);
  font-size: 0.98rem;
  color: var(--ink);
  text-overflow: ellipsis;
}

.btn-copy {
  flex: 0 0 auto;
  min-height: 50px;
  padding: 0 20px;
  font-size: 1rem;
  color: #fff;
  background: var(--go);
}
.btn-copy:hover { background: var(--go-hover); }
.btn-copy .ico-ok { display: none; }
.btn-copy.is-copied { background: var(--go-done); }
.btn-copy.is-copied .ico-ok { display: block; }
.btn-copy.is-copied .ico-copy { display: none; }

.result-foot { margin: 12px 0 0; font-size: 0.95rem; }

/* Código QR */
.btn[hidden] { display: none; }

.qr-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.btn-qr {
  flex: 1 1 220px;
  min-height: 54px;
  padding: 0 20px;
  font-size: 1.08rem;
  color: var(--deep);
  background: var(--surface);
  border: 2px solid var(--deep);
}
.btn-qr:hover { background: #e7f0ea; }
.btn-qr:disabled { cursor: progress; opacity: 0.75; }
.btn-download {
  flex: 0 1 auto;
  min-height: 54px;
  padding: 0 24px;
  font-size: 1.08rem;
  color: #fff;
  background: var(--go);
  text-decoration: none;
}
.btn-download:hover { color: #fff; background: var(--go-hover); }
.qr-bar .notice { flex-basis: 100%; margin: 0; }

.qr-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin: 0;
  padding: 22px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -28px rgba(11, 61, 46, 0.45);
  text-align: center;
}
.qr-card[hidden] { display: none; }
.qr-card.is-new { animation: aparecer .32s ease-out; }
.qr-card img {
  width: 240px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
}
.qr-card figcaption {
  display: grid;
  gap: 4px;
  max-width: 34ch;
  font-size: 0.93rem;
  line-height: 1.45;
  color: var(--muted);
}
.qr-card figcaption strong { color: var(--ink); font-size: 1rem; }
.qr-card .notice { margin: 0; text-align: left; }

@keyframes aparecer {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Vista previa del chat */
/* Columnas del generador */
.tool-main,
.tool-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.preview-title {
  margin: 0 0 10px 4px;
  font-weight: 650;
  font-size: 0.98rem;
  color: var(--muted);
}

.phone {
  border-radius: 28px;
  overflow: hidden;
  background: var(--wall);
  border: 8px solid var(--ink);
  box-shadow: 0 24px 48px -30px rgba(21, 41, 31, 0.7);
}

.phone-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--deep);
  color: #fff;
}
.avatar {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  background: #cfe0d6;
  color: #7c9a88;
  overflow: hidden;
}
.avatar svg { margin-top: 6px; }
.phone-contact { display: grid; line-height: 1.25; min-width: 0; }
.phone-contact strong {
  font-size: 1rem;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.phone-contact span { font-size: 0.8rem; opacity: 0.8; }

.phone-body {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 230px;
  padding: 18px 16px;
  background-color: var(--wall);
  background-image: radial-gradient(var(--wall-dot) 1.4px, transparent 1.5px);
  background-size: 18px 18px;
}
.phone-note {
  margin: 0;
  max-width: 30ch;
  padding: 7px 12px;
  border-radius: 10px;
  background: #fdf6dc;
  color: #5b5131;
  font-size: 0.82rem;
  line-height: 1.4;
  text-align: center;
}

.phone-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px;
  background: var(--wall);
}
.compose-box {
  flex: 1 1 auto;
  min-width: 0;
  max-height: 168px;
  overflow: auto;
  padding: 10px 14px;
  border-radius: 20px;
  background: #fff;
  font-size: 0.95rem;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.pv-empty { color: #8a9a91; }
.send {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--go);
  color: #fff;
}

/* Contenido informativo */
.content { padding-bottom: 64px; }
.content section {
  max-width: 760px;
  padding: 36px 0;
  border-top: 1px solid var(--line);
}

h2 {
  margin: 0 0 14px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.content p { margin: 0 0 14px; }

.example {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}
code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9em;
  color: var(--deep);
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: paso;
}
.steps li {
  position: relative;
  counter-increment: paso;
  padding: 0 0 18px 52px;
}
.steps li::before {
  content: counter(paso);
  position: absolute;
  left: 0; top: -2px;
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--deep);
  color: #fff;
  font-weight: 750;
}

.uses { margin: 0 0 18px; padding-left: 1.2em; }
.uses li { margin-bottom: 6px; }
.uses li::marker { color: var(--go); }

.tip {
  padding: 14px 16px;
  border-left: 4px solid var(--go);
  background: #e7f3ea;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.faq details {
  border-bottom: 1px solid var(--line);
}
.faq summary {
  position: relative;
  padding: 16px 40px 16px 0;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--deep);
}
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 18px; color: var(--muted); }

/* Pie */
.site-footer {
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
  font-size: 0.93rem;
  color: var(--muted);
}
.site-footer p { margin: 0 0 6px; }
.legal { font-size: 0.85rem; }

/* Botón con aspecto de enlace (pie de página) */
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--deep);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { color: var(--go-hover); }

/* Banner de cookies */
.ck-banner {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 50;
  width: min(420px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 20px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 48px -18px rgba(11, 61, 46, 0.45);
  font-size: 0.95rem;
  line-height: 1.5;
  animation: aparecer .32s ease-out;
}
.ck-banner[hidden] { display: none; }
.ck-titulo {
  margin: 0 0 6px;
  font-weight: 750;
  font-size: 1.05rem;
}
.ck-texto { margin: 0 0 16px; color: var(--muted); }

.ck-opciones {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
}
.ck-opciones[hidden] { display: none; }
.ck-opcion {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-weight: 400;
  font-size: 0.92rem;
  cursor: pointer;
}
.ck-opcion input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--go);
  cursor: pointer;
}
.ck-opcion input:disabled { cursor: not-allowed; }
.ck-opcion span { display: block; color: var(--muted); }
.ck-opcion strong { display: block; color: var(--ink); font-weight: 650; }

.ck-acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.ck-btn {
  flex: 1 1 120px;
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--deep);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.ck-btn:hover { background: var(--deep-hover); }
.ck-btn[hidden], .ck-enlace[hidden] { display: none; }
.ck-btn-guardar { flex-basis: 100%; background: var(--go); }
.ck-btn-guardar:hover { background: var(--go-hover); }
.ck-enlace {
  padding: 6px 2px;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 650;
  color: var(--deep);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Pantallas medianas y celulares */
@media (max-width: 860px) {
  /* En celular: formulario, simulador, botones de QR y el QR debajo */
  .tool { display: flex; flex-direction: column; gap: 22px; }
  .tool-main, .tool-side { display: contents; }
  .panel { order: 1; }
  .preview { order: 2; width: 100%; max-width: 420px; }
  .qr-bar { order: 3; }
  .qr-card { order: 4; }
  .phone-body { min-height: 120px; }
}

@media (max-width: 520px) {
  .ck-banner { left: 12px; bottom: 12px; width: calc(100% - 24px); padding: 18px 16px; }
  .ck-enlace { width: 100%; text-align: center; }
  .hero { padding-top: 16px; padding-bottom: 40px; }
  .lead { font-size: 1.05rem; margin-bottom: 24px; }
  .panel { padding: 20px 16px; border-radius: 18px; }
  .field-row { grid-template-columns: 1fr; gap: 18px; }
  .result-row { flex-direction: column; }
  .btn-copy { width: 100%; min-height: 54px; }
  .btn-qr, .btn-download { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
