/* Tu foto en Experiencia Endeavor · mismos tokens que la landing de la Ruta de Innovación */
:root {
  --brand-300: #a8c4a6; --brand-500: #4a8548; --brand-600: #356a33; --brand-700: #244a22; --brand-900: #142a13;
  --lime-300: #cfd996; --lime-500: #adbe52;
  --ink-900: #0a0f1a; --ink-800: #111827; --ink-500: #4b5563;
  --paper-000: #fff; --paper-100: #f7f4ee; --line: #e6e1d6;
  --font-display: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-sans: "Poppins", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; color: var(--ink-900); font: 400 16px/24px var(--font-sans);
  background: var(--paper-100);
  background-image: radial-gradient(60% 40% at 15% 0%, #adbe5240, transparent 70%), radial-gradient(60% 50% at 100% 100%, #356a3322, transparent 70%);
  background-attachment: fixed;
}
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.app { width: min(100%, 560px); margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); display: grid; gap: 20px; }
.top { display: flex; justify-content: center; padding-top: 8px; }
.top-logo { width: 190px; height: auto; }

/* pasos: solo se ve el actual */
.paso { display: none; }
.app[data-step="inicio"] .paso-inicio,
.app[data-step="resultado"] .paso-resultado { display: grid; }

/* ---------- paso 1 ---------- */
.paso-inicio { gap: 16px; justify-items: center; text-align: center; padding-top: 12px; }
h1 { margin: 0; font: 400 clamp(32px, 9vw, 44px)/1.1 var(--font-display); letter-spacing: -0.02em; text-wrap: balance; }
.lead { margin: 0; color: var(--ink-500); font-size: 18px; line-height: 24px; max-width: 30ch; }
.nota { margin: 0; color: var(--ink-500); font-size: 13px; line-height: 18px; max-width: 34ch; }
.nota b { color: var(--ink-800); font-weight: 500; }
.err { margin: 0; color: #b42318; font-size: 14px; }
/* ilustración: un marco vertical y uno horizontal, para anunciar que se adapta */
.hero-demo { position: relative; width: 220px; height: 170px; margin: 8px 0 4px; }
.demo { position: absolute; border-radius: 14px; background: var(--paper-000); box-shadow: 0 0 0 1px var(--line), 0 18px 36px -22px #0a0f1a66; }
.demo::before { content: ""; position: absolute; inset: 14% 10% 26%; border-radius: 8px; background: linear-gradient(135deg, #cfd996, #4a8548); }
.demo::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: 10%; height: 6%; border-radius: 4px; background: #356a33; }
.demo-v { width: 92px; height: 164px; left: 18px; top: 0; transform: rotate(-6deg); }
.demo-h { width: 150px; height: 92px; right: 0; bottom: 6px; transform: rotate(5deg); }
.demo-h::before { inset: 10% 40% 10% 6%; }
.demo-h::after { left: 64%; right: 8%; bottom: 44%; height: 8%; }
@media (prefers-reduced-motion: no-preference) {
  .demo-v { animation: flotaA 5s ease-in-out infinite alternate; }
  .demo-h { animation: flotaB 6s ease-in-out infinite alternate; }
}
@keyframes flotaA { to { transform: rotate(-3deg) translateY(-6px); } }
@keyframes flotaB { to { transform: rotate(3deg) translateY(5px); } }

/* ---------- botones (mismo patrón que la landing: píldora) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 48px; padding: 0 26px; border: 0; border-radius: 9999px;
  font: 500 16px/24px var(--font-sans); text-decoration: none; cursor: pointer; transition: background-color .15s, transform .15s; }
.btn:active { transform: scale(.97); }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.btn-main { background: var(--brand-900); color: var(--paper-100); }
.btn-main:hover { background: var(--brand-700); }
.btn-sec { background: var(--paper-000); color: var(--ink-900); box-shadow: inset 0 0 0 1px var(--line); }
.btn-sec:hover { background: #fbfaf6; }
.btn-dark { background: var(--brand-900); color: var(--paper-100); height: 36px; padding: 0 20px; font-weight: 400; }
.btn-dark svg { width: 14px; height: 14px; stroke-width: 1.6; }
.btn-dark:hover { background: var(--brand-700); }
.btn:focus-visible, .btn-link:focus-visible, .grupo input:focus-visible + span { outline: 3px solid var(--lime-500); outline-offset: 2px; }
#f-foto:focus-visible + * , .paso-inicio label.btn:focus-within { outline: 3px solid var(--lime-500); }
.btn-link { background: none; border: 0; padding: 4px 2px; color: var(--brand-600); font: 500 15px/20px var(--font-sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- paso 2 ---------- */
.paso-resultado { gap: 18px; }
.preview { margin: 0; display: grid; gap: 10px; justify-items: center; }
#lienzo { display: block; width: auto; height: auto; max-width: 100%; max-height: 62dvh; border-radius: 16px; box-shadow: 0 24px 48px -28px #0a0f1a80; background: var(--paper-000); }
.ia-estado { min-height: 20px; font-size: 13px; line-height: 18px; color: var(--ink-500); text-align: center; }
.app.ia-lista .ia-estado { color: var(--brand-600); font-weight: 500; }

.controles { display: grid; gap: 10px; }
.grupo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grupo-t { width: 70px; font-size: 14px; font-weight: 500; color: var(--ink-800); }
.grupo label { position: relative; cursor: pointer; }
.grupo input { position: absolute; opacity: 0; pointer-events: none; }
.grupo label span { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 9999px; border: 1px solid var(--line); background: var(--paper-000); font-size: 15px; color: var(--ink-800); transition: background-color .15s, color .15s; }
.grupo input:checked + span { background: var(--brand-900); border-color: var(--brand-900); color: var(--paper-100); }
.grupo input:disabled + span { opacity: .55; cursor: progress; }
.spin { display: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; }
.app.ia-cargando .spin { display: inline-block; animation: gira .8s linear infinite; }
.app.ia-error .opt-ia { display: none; }
@keyframes gira { to { transform: rotate(1turn); } }

.acciones { display: grid; grid-template-columns: 1fr; gap: 10px; }
.etiqueta { display: grid; justify-items: start; gap: 4px; padding: 12px 16px; border-radius: 16px; background: var(--paper-000); box-shadow: inset 0 0 0 1px var(--line); }
.etiqueta p { margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-500); }
.etiqueta b { color: var(--brand-600); font-weight: 600; }
.aviso { margin: 0; min-height: 20px; font-size: 14px; color: var(--brand-600); text-align: center; }
.otra { justify-self: center; }

.puente { margin-top: 8px; display: grid; justify-items: center; gap: 12px; padding: 24px 16px; border-radius: 22px; background: var(--brand-900); text-align: center; }
.puente-q { margin: 0; display: inline-flex; align-items: center; gap: 10px; color: #f4f2ea; font-weight: 500; font-size: 17px; }
.puente .btn-dark { background: var(--lime-500); color: var(--ink-900); }
.puente .btn-dark:hover { background: var(--lime-300); }
.dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--lime-500); }
@media (prefers-reduced-motion: no-preference) {
  .dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--lime-500); animation: ping 2.4s cubic-bezier(0, 0, .2, 1) infinite; }
}
@keyframes ping { 0% { transform: scale(1); opacity: .9; } 80%, 100% { transform: scale(3.2); opacity: 0; } }

.pie { text-align: center; font-size: 12px; color: var(--ink-500); padding-top: 8px; }
.redes { display: grid; justify-items: center; gap: 10px; margin: 8px 0 16px; }
.redes-t { margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink-800); }
.redes-i { display: flex; gap: 10px; }
.soc { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--paper-000); color: var(--brand-900); box-shadow: inset 0 0 0 1px var(--line); transition: background-color .15s, color .15s, transform .15s; }
.soc svg { width: 22px; height: 22px; }
.soc:hover { background: var(--brand-900); color: var(--paper-100); transform: translateY(-1px); }
.soc:hover svg path[fill^="var"] { fill: var(--brand-900); }
.soc:focus-visible { outline: 3px solid var(--lime-500); outline-offset: 2px; }
.redes-h { margin: 0; font-size: 13px; font-weight: 600; color: var(--brand-600); }

/* escritorio: resultado horizontal más ancho */
@media (min-width: 900px) {
  .app[data-formato="horizontal"] { width: min(100%, 980px); }
  .app[data-formato="horizontal"] .paso-resultado { grid-template-columns: 1.6fr 1fr; align-items: start; column-gap: 28px; }
  .app[data-formato="horizontal"] .preview { grid-row: span 6; }
  .app[data-formato="horizontal"] .acciones { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* =============================================================================
   Pasos "estilo" y "creando" + revelado del resultado
   ========================================================================== */
.app[data-step="estilo"] .paso-estilo,
.app[data-step="creando"] .paso-creando { display: grid; }

/* ---------- elegir a dónde te llevamos ---------- */
.paso-estilo { gap: 18px; justify-items: center; text-align: center; }
.estilos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: 100%; }
.estilo-card { position: relative; display: grid; gap: 2px; padding: 6px 6px 10px; border-radius: 18px; background: var(--paper-000);
  box-shadow: 0 0 0 1px var(--line); cursor: pointer; text-align: center; transition: box-shadow .15s, transform .15s; }
.estilo-card input { position: absolute; opacity: 0; pointer-events: none; }
.estilo-card img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 13px; display: block; margin-bottom: 6px; }
.estilo-card b { font-weight: 600; font-size: 15px; line-height: 20px; color: var(--ink-900); }
.estilo-card small { font-size: 12px; line-height: 16px; color: var(--ink-500); }
.estilo-card:has(input:checked) { box-shadow: 0 0 0 3px var(--brand-900); transform: translateY(-2px); }
.estilo-card:has(input:checked)::after { content: "✓"; position: absolute; top: 12px; right: 12px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--lime-500); color: var(--ink-900); font: 600 13px/24px var(--font-sans); }
.estilo-card:has(input:focus-visible) { outline: 3px solid var(--lime-500); outline-offset: 2px; }
.mi-foto { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-500); }
.mi-foto img { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; box-shadow: 0 0 0 1px var(--line); }
.paso-estilo .btn-main { width: 100%; }

/* ---------- creando: la foto se queda y una luz lima la recorre ---------- */
.paso-creando { gap: 18px; justify-items: center; text-align: center; padding-top: 8px; }
.scan { position: relative; margin: 0; width: min(100%, 420px); border-radius: 24px; overflow: hidden; background: var(--brand-900);
  box-shadow: 0 24px 48px -26px #0a0f1a99; isolation: isolate; }
.app[data-formato="horizontal"] .scan { width: 100%; }
.scan img { display: block; width: 100%; height: auto; max-height: 56dvh; object-fit: cover; filter: saturate(.75) brightness(.8); }
/* banda de luz que baja y sube */
.scan-luz { position: absolute; left: 0; right: 0; top: 0; height: 34%; z-index: 2;
  background: linear-gradient(180deg, transparent, #adbe5233 40%, #e2ec9fcc 50%, #adbe5233 60%, transparent);
  mix-blend-mode: screen; animation: escanea 2.6s cubic-bezier(.45, 0, .55, 1) infinite alternate; }
/* destello suave que respira sobre toda la foto */
.scan-brillo { position: absolute; inset: 0; z-index: 1; background: radial-gradient(70% 60% at 50% 40%, #adbe5240, transparent 70%); animation: respira 3s ease-in-out infinite; }
@keyframes escanea { from { transform: translateY(-40%); } to { transform: translateY(230%); } }
@keyframes respira { 0%, 100% { opacity: .35; } 50% { opacity: .9; } }
.frase { margin: 0; min-height: 28px; font: 500 20px/28px var(--font-sans); color: var(--ink-900); }
.barra { width: min(100%, 320px); height: 6px; border-radius: 9999px; background: #142a131a; overflow: hidden; }
.barra i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-600), var(--lime-500)); transform-origin: left; transform: scaleX(0); transition: transform .5s linear; }
.app.lento #creando-nota::after { content: " Está tardando más de lo normal; ya casi."; }

/* ---------- resultado ---------- */
.paso-resultado > h1 { text-align: center; }
.preview { position: relative; }
/* revelado: la portada se descubre de arriba hacia abajo, una sola vez */
.app.revelar #lienzo { animation: aparece 1s cubic-bezier(.7, 0, .2, 1) both; }
@keyframes aparece { from { clip-path: inset(0 0 100% 0 round 16px); transform: scale(.97); } to { clip-path: inset(0 0 0 0 round 16px); transform: none; } }
.reintentar { justify-self: center; }
.otras { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; }
.app.sin-ia .ia-estado { color: var(--ink-800); }

/* inicio: cámara directa + galería (en computadora solo galería) */
.origen { display: grid; gap: 10px; width: min(100%, 340px); }
.origen .btn { width: 100%; }
.origen .btn svg { stroke-linejoin: round; }
@media (hover: hover) and (pointer: fine) {
  .solo-movil { display: none; }
  .origen .btn-sec { background: var(--brand-900); color: var(--paper-100); box-shadow: none; }   /* en computadora, galería es la acción principal */
  .origen .btn-sec:hover { background: var(--brand-700); }
}
.origen label:focus-within, .origen label:has(+ input:focus-visible) { outline: 3px solid var(--lime-500); outline-offset: 2px; }
