/* ============================================================
   Formulario de Retos · Innovación Abierta · Estratek — v2
   Dirección: editorial-corporativa refinada. Tipografía con carácter,
   identidad teal, asistente por pasos, responsive total.
   ============================================================ */

:root {
  --teal:#0F6E56; --teal-lt:#E7F3EE; --teal-mid:#5DCAA5; --teal-dk:#063D31;
  --ink:#14201C; --mid:#586660; --hint:#8A938E;
  --paper:#FBFAF6; --card:#FFFFFF; --line:#E3E0D6;
  --field:#F6F5EF; --white:#fff;
  --err:#BC3B2E; --err-lt:#FBEDEB; --ok:#1E8453; --ok-lt:#E9F6EE;
  --gold:#C9A84C;
  --shadow-sm:0 1px 2px rgba(20,32,28,.05);
  --shadow:0 10px 30px -12px rgba(6,61,49,.22);
  --radius:14px;
  --display:'Fraunces',Georgia,'Times New Roman',serif;
  --sans:'Hanken Grotesk',-apple-system,Segoe UI,sans-serif;
}

* { box-sizing:border-box; margin:0; padding:0; }
html { -webkit-text-size-adjust:100%; }
body {
  font-family:var(--sans); color:var(--ink); font-size:16px; line-height:1.55;
  background:
    radial-gradient(60% 50% at 100% 0%, rgba(93,202,165,.12), transparent 60%),
    radial-gradient(50% 40% at 0% 12%, rgba(15,110,86,.08), transparent 55%),
    var(--paper);
  background-attachment:fixed;
  min-height:100vh;
}
a { color:var(--teal); }

/* ---------- Header ---------- */
.site-header { background:var(--teal-dk); color:#fff; }
.hwrap { max-width:820px; margin:0 auto; padding:1.5rem 1.5rem; display:flex; align-items:center; gap:1rem; justify-content:space-between; }
.brand { display:flex; align-items:center; gap:.85rem; }
.brand-mark { font-size:22px; color:var(--gold); line-height:1; }
.site-header h1 { font-family:var(--display); font-weight:600; font-size:clamp(22px,4.2vw,30px); letter-spacing:-.01em; line-height:1.1; }
.site-header p { font-size:12.5px; opacity:.78; margin-top:3px; }
.time-badge { flex-shrink:0; background:rgba(255,255,255,.12); border:1px solid rgba(255,255,255,.2); color:#fff; font-size:12px; font-weight:600; padding:6px 12px; border-radius:999px; white-space:nowrap; }

.container { max-width:820px; margin:0 auto; padding:1.75rem 1.5rem 3rem; }

/* ---------- Progreso ---------- */
.wizard-progress { margin-bottom:1.75rem; }
.steps { list-style:none; display:flex; gap:4px; justify-content:space-between; margin-bottom:14px; }
.steps li { flex:1; display:flex; flex-direction:column; align-items:center; gap:6px; cursor:default; position:relative; }
.steps li .dot { width:30px; height:30px; border-radius:50%; display:grid; place-items:center; background:var(--card); border:1.5px solid var(--line); color:var(--hint); font-size:13px; font-weight:700; transition:.25s; }
.steps li .lbl { font-size:11px; color:var(--hint); font-weight:600; letter-spacing:.02em; transition:.25s; text-align:center; }
.steps li.done .dot { background:var(--teal); border-color:var(--teal); color:#fff; }
.steps li.done .lbl { color:var(--mid); }
.steps li.active .dot { background:var(--teal-dk); border-color:var(--teal-dk); color:#fff; transform:scale(1.12); box-shadow:0 0 0 4px var(--teal-lt); }
.steps li.active .lbl { color:var(--teal-dk); }
.steps li.clickable { cursor:pointer; }
.bar { height:5px; background:var(--line); border-radius:999px; overflow:hidden; }
.bar-fill { height:100%; width:16.6%; background:linear-gradient(90deg,var(--teal),var(--teal-mid)); border-radius:999px; transition:width .4s cubic-bezier(.4,0,.2,1); }
.step-count { font-size:12px; color:var(--hint); text-align:right; margin-top:7px; font-weight:600; }

/* ---------- Pasos ---------- */
.step { border:none; padding:0; margin:0; animation:fade .35s ease both; }
.step[hidden] { display:none; }
@keyframes fade { from{opacity:0; transform:translateY(10px);} to{opacity:1; transform:none;} }
.step-head { margin-bottom:1.6rem; }
.step-kicker { display:inline-block; font-size:11px; font-weight:700; letter-spacing:.09em; text-transform:uppercase; color:var(--teal); background:var(--teal-lt); padding:5px 12px; border-radius:999px; margin-bottom:12px; }
.step-head h2 { font-family:var(--display); font-weight:500; font-size:clamp(21px,4.6vw,27px); line-height:1.15; letter-spacing:-.015em; color:var(--ink); }
.step-head .desc { font-size:14px; color:var(--mid); margin-top:8px; max-width:60ch; }

/* ---------- Bloques de pregunta ---------- */
.q-block { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:1.4rem 1.5rem; margin-bottom:1.1rem; box-shadow:var(--shadow-sm); }
.q-label { display:flex; gap:10px; align-items:flex-start; font-weight:600; font-size:15.5px; color:var(--ink); line-height:1.4; }
.q-num { flex-shrink:0; width:26px; height:26px; border-radius:8px; background:var(--teal); color:#fff; font-size:12px; font-weight:700; display:grid; place-items:center; margin-top:1px; }
.q-hint { font-size:12.5px; color:var(--hint); margin:8px 0 12px 36px; line-height:1.6; }
.req { color:var(--err); }

textarea, input[type=text], input[type=email] {
  width:100%; font-family:inherit; font-size:14.5px; color:var(--ink);
  background:var(--field); border:1.5px solid var(--line); border-radius:10px;
  transition:border-color .18s, background .18s, box-shadow .18s;
}
textarea { min-height:108px; padding:12px 14px; resize:vertical; line-height:1.6; }
input[type=text], input[type=email] { height:44px; padding:0 14px; }
textarea:focus, input:focus { outline:none; border-color:var(--teal-mid); background:#fff; box-shadow:0 0 0 4px var(--teal-lt); }
::placeholder { color:#b3b8b3; }

.counter { font-size:11px; color:var(--hint); text-align:right; margin-top:5px; }
.counter.warn { color:var(--gold); }

/* Campos etiquetados (reemplazan tablas, responsive) */
.field-grid { display:flex; flex-direction:column; gap:10px; margin-top:4px; }
.field-row { display:grid; grid-template-columns:140px 1fr; align-items:center; gap:12px; }
.field-label { font-size:12.5px; font-weight:600; color:var(--teal); }

/* Errores */
.field-error { color:var(--err); font-size:12.5px; margin:9px 0 0 36px; display:none; font-weight:500; }
.field-error.show { display:block; }
textarea.invalid, input.invalid { border-color:var(--err); background:var(--err-lt); }
.options-grid.invalid { outline:2px solid var(--err); outline-offset:5px; border-radius:10px; }

/* Chips */
.options-grid { display:flex; flex-wrap:wrap; gap:8px; margin-top:6px; }
.opt { font-family:inherit; padding:9px 15px; border-radius:999px; border:1.5px solid var(--line); background:#fff; color:var(--ink); font-size:13px; cursor:pointer; transition:.16s; user-select:none; }
.opt:hover { border-color:var(--teal-mid); transform:translateY(-1px); }
.opt.sel { background:var(--teal); border-color:var(--teal); color:#fff; font-weight:600; }

/* Consentimiento */
.consent-block { background:var(--teal-lt); border-color:transparent; }
.consent { display:flex; gap:11px; align-items:flex-start; font-size:13.5px; color:var(--mid); line-height:1.6; cursor:pointer; }
.consent input { margin-top:3px; width:18px; height:18px; flex-shrink:0; accent-color:var(--teal); cursor:pointer; }

/* Vista previa del reto */
.reto-preview { background:linear-gradient(135deg,var(--teal-dk),var(--teal)); color:#fff; border-radius:var(--radius); padding:1.5rem 1.6rem; margin-bottom:1.3rem; box-shadow:var(--shadow); }
.reto-tag { display:inline-block; font-size:10.5px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--teal-mid); margin-bottom:10px; }
.reto-q { font-family:var(--display); font-size:clamp(17px,3.6vw,21px); font-weight:500; font-style:italic; line-height:1.5; }

.turnstile-box { margin-top:1rem; min-height:0; }
.turnstile-box:not(:empty) { margin-bottom:.5rem; }

/* Honeypot */
.hp-field { position:absolute; left:-9999px; width:1px; height:1px; overflow:hidden; }

/* ---------- Navegación wizard ---------- */
.wizard-nav { display:flex; align-items:center; gap:12px; margin-top:1.5rem; flex-wrap:wrap; }
.btn { font-family:inherit; font-size:14.5px; font-weight:600; padding:12px 26px; border-radius:11px; border:none; cursor:pointer; transition:.18s; }
.btn:disabled { opacity:.55; cursor:not-allowed; }
.btn.primary { background:var(--teal); color:#fff; box-shadow:var(--shadow-sm); }
.btn.primary:hover:not(:disabled) { background:var(--teal-dk); transform:translateY(-1px); }
.btn.ghost { background:transparent; color:var(--mid); border:1.5px solid var(--line); }
.btn.ghost:hover:not(:disabled) { border-color:var(--teal-mid); color:var(--teal); }
.autosave { font-size:12px; color:var(--hint); margin-left:auto; transition:.2s; }
.wizard-nav .primary:last-of-type, #btn-next { margin-left:0; }
#btn-back { margin-right:auto; }
.wizard-nav #btn-next, .wizard-nav #btn-submit { margin-left:auto; }

/* ---------- Banner estado ---------- */
.status-banner { display:none; border-radius:var(--radius); padding:1rem 1.25rem; margin-bottom:1.4rem; font-size:14px; line-height:1.55; animation:fade .3s ease both; }
.status-banner.show { display:block; }
.status-banner.error { background:var(--err-lt); border:1.5px solid var(--err); color:var(--err); }
.status-banner.success { background:var(--ok-lt); border:1.5px solid var(--ok); color:var(--ok); }
.status-banner strong { display:block; font-weight:700; margin-bottom:3px; }

.spinner { display:inline-block; width:14px; height:14px; border:2px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; animation:spin .7s linear infinite; vertical-align:-2px; margin-right:7px; }
@keyframes spin { to{transform:rotate(360deg);} }

/* ---------- Footer ---------- */
.site-footer { text-align:center; padding:1.4rem; font-size:12px; color:var(--hint); border-top:1px solid var(--line); }

/* ---------- Responsive ---------- */
@media (max-width:680px) {
  .field-row { grid-template-columns:1fr; gap:5px; }
  .field-label { font-size:12px; }
  .steps li .lbl { display:none; }
  .steps { gap:6px; }
  .q-hint, .field-error { margin-left:0; }
  .container { padding:1.25rem 1rem 5.5rem; }
  .q-block { padding:1.15rem 1.1rem; }
  /* Nav fija inferior en móvil */
  .wizard-nav { position:fixed; left:0; right:0; bottom:0; margin:0; background:var(--card); border-top:1px solid var(--line); padding:12px 16px; box-shadow:0 -6px 20px -12px rgba(6,61,49,.3); z-index:30; gap:10px; }
  .autosave { display:none; }
  .btn { flex:1; padding:13px 16px; text-align:center; }
  #btn-back { flex:0 0 auto; }
}
@media (max-width:380px){
  .hwrap { flex-direction:column; align-items:flex-start; gap:.6rem; }
  .site-header h1 { font-size:20px; }
}

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

/* ---------- Impresión ---------- */
@media print {
  body { background:#fff; }
  .wizard-progress, .wizard-nav, .site-header .time-badge, .turnstile-box, .status-banner { display:none!important; }
  .step[hidden] { display:block!important; }
  .q-block { break-inside:avoid; box-shadow:none; }
}
