/* PD Studio GEO Platform — formulario "Nueva oportunidad" (mobile-first) */
:root {
  --ink: #0f172a;
  --ink-soft: #475569;
  --line: #d4d4d8;
  --bg: #f5f5f4;
  --card: #ffffff;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #ccfbf1;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --warn: #92400e;
  --warn-soft: #fef3c7;
  --ok: #166534;
  --ok-soft: #dcfce7;
  --radius: 14px;
  --tap: 48px;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* .btn/.banner definen display y anulaban el atributo hidden */
button, .chip { -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; scroll-padding-bottom: 170px; /* la barra de acciones es sticky: que los campos enfocados no queden tapados */ }
body { margin: 0; min-height: 100dvh; line-height: 1.45; overflow-wrap: anywhere; }

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

/* Cabecera */
.app-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: var(--ink); color: #fff;
}
.brand { font-weight: 800; letter-spacing: .01em; }
.brand-sub { font-weight: 500; opacity: .7; }
.env-badge { font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }

.wrap { max-width: 640px; margin: 0 auto; padding: 16px 16px 0; }

h1 { font-size: 1.6rem; line-height: 1.15; margin: 8px 0 4px; }
h1:focus { outline: none; }
.lead { margin: 0 0 16px; color: var(--ink-soft); }
.muted { color: var(--ink-soft); font-weight: 400; }

/* Campos */
.field { margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
label, legend { display: block; font-weight: 650; margin: 0 0 6px; padding: 0; }
abbr { text-decoration: none; color: var(--danger); }

input[type='text'], input[type='tel'], input[type='email'], textarea {
  display: block; width: 100%; min-height: var(--tap);
  font: inherit; font-size: 1rem; /* 16px: evita el zoom automático de iOS */
  color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px;
  appearance: none; -webkit-appearance: none;
}
textarea { resize: vertical; min-height: 96px; }
input:focus-visible, textarea:focus-visible, button:focus-visible, .chip input:focus-visible + span {
  outline: 3px solid #2563eb; outline-offset: 2px;
}
input[aria-invalid='true'], textarea[aria-invalid='true'] { border-color: var(--danger); background: #fffafa; }

.error { margin: 6px 0 0; color: var(--danger); font-weight: 600; font-size: .92rem; }
.error::before { content: '⚠ '; }
.hint { margin: 6px 0 0; color: var(--ink-soft); font-size: .88rem; }
.privacy { margin: -4px 0 14px; }

/* Honeypot fuera de pantalla (no display:none: algunos bots lo ignoran) */
.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* Chips de interés (checkbox nativo → accesible y táctil) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; margin: 0; font-weight: 600; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink);
  user-select: none;
}
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: #064e3b; }
.chip input:checked + span::before { content: '✓'; font-weight: 800; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  min-height: 52px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid transparent;
  font: inherit; font-weight: 700; font-size: 1rem; line-height: 1.2; cursor: pointer; min-width: 0;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: var(--card); color: var(--accent); border-color: var(--accent); }
.btn-small { min-height: var(--tap); padding: 8px 16px; background: var(--ink); color: #fff; }
.btn[disabled] { opacity: .6; cursor: progress; }

.actions {
  position: sticky; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px;
  margin: 8px -16px 0; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 78%, rgba(245, 245, 244, 0));
}

/* Avisos */
.banner { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: var(--danger-soft); color: #7f1d1d; font-weight: 600; }
.banner p { margin: 0 0 8px; }
.banner p:last-child { margin: 0; }
.banner.banner-info { background: var(--warn-soft); color: var(--warn); }

/* Resultado */
.result-card { background: var(--card); border: 1px solid #e5e5e5; border-radius: 16px; padding: 18px; }
.result-card.is-duplicate { border-left: 6px solid #c2410c; }
.result-card.is-ok { border-left: 6px solid var(--ok); }
.result-list { margin: 12px 0 0; display: grid; gap: 10px; }
.result-list div { border-top: 1px solid #eee; padding-top: 10px; }
.result-list dt { font-size: .85rem; color: var(--ink-soft); font-weight: 600; }
.result-list dd { margin: 2px 0 0; font-weight: 650; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.note { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: .95rem; }
.note.note-ok { background: var(--ok-soft); color: var(--ok); }
.actions-result { position: static; background: none; margin: 8px 0 24px; padding: 8px 0; }
a { color: var(--accent); font-weight: 650; }

/* Pantallas algo más anchas */
@media (min-width: 380px) {
  .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actions-result { grid-template-columns: 1fr; }
}
@media (min-width: 520px) {
  .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wrap { padding-top: 24px; }
  .actions { margin-left: 0; margin-right: 0; border-radius: 14px; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, input, textarea, .chip span { transition: background-color .15s, border-color .15s, opacity .15s; }
}
@media (forced-colors: active) {
  .chip input:checked + span { outline: 2px solid Highlight; }
}
