﻿/* ===== Become Portal Design System =====
   Shared visual language across the root landing and all demos.
   One source of truth — no duplication across demo folders.
*/

/* ---- Design tokens (inspired by asobancaria-2026 visual direction) ---- */
:root {
  --color-navy-deep: #182142;
  --color-navy: #1e2a4d;
  --color-teal-bright: #05a8b8;
  --color-teal: #02739d;
  --color-ink: #f1f5f9;
  --color-ink-muted: #9aa6c4;
  --color-ink-faint: #6b7a99;
  --surface: #0f1729;
  --surface-border: #1e2a4a;
  --surface-light: rgba(255,255,255,0.04);
  --surface-light-border: rgba(255,255,255,0.08);
  --text-on-surface: #e2e8f0;
  --text-muted: #94a3b8;
  --gradient-brand: linear-gradient(135deg, #05a8b8 0%, #02739d 100%);
  --shadow-cta: 0 10px 40px -12px rgba(2,115,207,0.8);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  --transition: 0.15s ease;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Reset & base ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: "Source Sans 3", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-navy-deep);
  color: var(--color-ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  width: 100%;
  height: 100%;
}
h1, h2, h3, .font-display {
  font-family: "Montserrat", "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-ink);
}
.container { width: 100%; max-width: 430px; margin: 0 auto; padding: 0 20px; }
.center { text-align: center; }

/* ---- Off-screen: <become-button> MUST stay mounted but hidden ---- */
/* display:none is deliberately avoided so the SDK can initialize. */
.be-button-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}
.be-button-placeholder { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Status badges ---- */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  border: 1px solid transparent;
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.status--loading { background: rgba(234,173,14,0.15); color: #fbbf24; border-color: rgba(251,191,38,0.30); }
.status--loading::before { background: #fbbf24; }
.status--ready   { background: rgba(34,197,94,0.15); color: #4ade80; border-color: rgba(74,222,128,0.30); }
.status--ready::before { background: #4ade80; }
.status--done    { background: rgba(59,130,246,0.15); color: #60a5fa; border-color: rgba(96,165,248,0.30); }
.status--done::before { background: #60a5fa; }
.status--exited  { background: rgba(168,85,178,0.15); color: #a855f7; border-color: rgba(168,85,178,0.30); }
.status--exited::before { background: #a855f7; }
.status--error   { background: rgba(239,68,68,0.15); color: #f87171; border-color: rgba(248,113,111,0.30); }
.status--error::before { background: #f87171; }

/* ---- Surfaces, panels ---- */
.surface {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
}
.surface__title {
  font-family: "Montserrat", system-ui, sans-serif;
  font-size: 17px; font-weight: 700; margin: 0 0 16px;
  color: var(--text-on-surface);
}
.demo-copy { font-size: 15px; line-height: 1.6; color: var(--color-ink-muted); margin: 0; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.panel__title { margin: 0 0 12px; font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.panel__row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--surface-light-border);
  font-size: 14px;
}
.panel__row:last-child { border-bottom: 0; }
.panel__row span:first-child { color: var(--text-muted); }

/* ---- Event log ---- */
.event-log {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--surface-light-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.event-log__header {
  padding: 14px 20px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-muted); border-bottom: 1px solid var(--surface-light-border);
}
.event-log__list { list-style: none; margin: 0; padding: 8px 0; max-height: 340px; overflow-y: auto; }
.event-log__item {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 20px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.event-log__item:last-child { border-bottom: 0; }
.event-log__name { color: var(--text-on-surface); font-weight: 600; }
.event-log__time { color: var(--text-muted); flex-shrink: 0; }

/* ---- Steps ---- */
.steps { display: flex; overflow-x: auto; padding: 4px 0 4px; scroll-padding-left: 10px; }
.step { flex: 0 0 33%; text-align: center; min-width: 100px; }
.step__num {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gradient-brand); color: #fff;
  display: grid; place-items: center; margin: 0 auto 8px;
  font-size: 13px; font-weight: 700;
}
.step__label { font-size: 13px; font-weight: 600; color: var(--text-on-surface); margin-bottom: 4px; }
.step__desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* ---- Features ---- */
.features { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.feature {
  background: var(--surface-light);
  border: 1px solid var(--surface-light-border);
  border-radius: var(--radius-sm);
  padding: 16px; text-align: center;
}
.feature__icon { font-size: 22px; margin-bottom: 8px; }
.feature__title { font-size: 13px; font-weight: 600; color: var(--text-on-surface); margin-bottom: 4px; }
.feature__desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

/* ---- CTA ---- */
.cta-holder { text-align: center; padding: 12px 0; }
.btn {
  font: inherit; font-family: "Montserrat", system-ui, sans-serif;
  font-weight: 700; font-size: 16px;
  border: none; border-radius: var(--radius-pill);
  padding: 0 28px; min-height: 52px;
  cursor: pointer;
  background: var(--gradient-brand); color: #fff;
  transition: transform var(--transition), filter var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-cta);
}
.btn-primary { background: var(--gradient-brand); padding: 6px 28px; min-height: 52px; }
.btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.05); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.cta-hint { color: var(--color-ink-muted); font-size: 12px; margin-top: 10px; }

/* ---- Demo layout ---- */
.demo {
  max-width: 720px; margin: 0 auto;
  padding: max(1.25rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-right)) max(3rem, env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
  display: flex; flex-direction: column;
}
.demo-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 1.5rem; }
.demo-header__brand { display: flex; align-items: center; gap: 12px; }
.demo-header__logo { width: 38px; height: 38px; }
.demo-header__name { font-family: "Montserrat", sans-serif; font-weight: 700; font-size: 17px; color: #fff; }
.demo-header__tag {
  font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; text-align: center;
  color: var(--color-teal-bright);
  display: none;
}
@media (min-width: 460px) {
  .demo-header__tag { display: block; }
}
.demo-hero { text-align: center; padding: 1rem 0; }
.demo-hero__eyebrow { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-ink-muted); }
.demo-hero__title { font-size: clamp(1.75rem, 4.5vw, 2rem); margin: 8px 0 10px; line-height: 1.15; color: #fff; }
.demo-hero__subtitle { font-size: 15px; line-height: 1.55; color: var(--color-ink-muted); max-width: 340px; margin: 0 auto; }
.demo-hero__status { margin-top: 14px; }
.demo-hero__contract {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 14px;
}
.demo-hero__contract-label {
  font-size: 13px; font-weight: 600; color: var(--color-ink-muted);
  font-family: "Montserrat", system-ui, sans-serif;
}
.demo-hero__contract-select {
  font: inherit; font-family: "Montserrat", system-ui, sans-serif;
  font-size: 13px; font-weight: 600;
  height: 40px; padding: 0 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--surface-light-border);
  border-radius: var(--radius-pill);
  color: var(--color-ink); outline: none;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239aa6c4' d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.763 2.938 10.825 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
.demo-hero__contract-select:focus { border-color: var(--color-teal-bright); background-color: rgba(255,255,255,0.08); }
.demo-hero__contract-select option { background: var(--color-navy); color: var(--color-ink); }
.sdk-area { margin-top: 6px; }
.demo-footer { margin-top: auto; padding: 24px 0; text-align: center; font-size: 12px; color: var(--color-ink-faint); }

/* ---- Root portal ---- */
.portal {
  min-height: 100dvh; min-height: 100vh;
  width: 100vw; max-width: 430px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center;
  position: relative; overflow-x: hidden;
}
.portal__frame { width: 100%; max-width: 430px; margin: 0 auto; }
.portal__header { width: 100%; padding: 20px 0; }
.portal__wordmark { width: 120px; height: auto; display: block; margin: 0 auto; }
.portal__hero { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1.1rem; text-align: center; padding: 1rem 0; }
.portal__visual { position: relative; width: 150px; height: 150px; }
.portal__glow { position: absolute; inset: 0; border-radius: 50%; background: var(--gradient-brand); filter: blur(40px); opacity: 0.30; }
.portal__isotype-wrap { width: 100%; height: 100%; display: grid; place-items: center; }
.portal__isotype { width: 80px; height: auto; position: relative; z-index: 2; }
.portal__corner { position: absolute; width: 22px; height: 22px; border: 2px solid var(--color-teal-bright); opacity: 0.85; }
.portal__corner-tl { top: 0; left: 0; border-bottom: 0; border-right: 0; border-radius: 0 0 0 0; }
.portal__corner-tr { top: 0; right: 0; border-bottom: 0; border-left: 0; }
.portal__corner-bl { bottom: 0; left: 0; border-top: 0; border-right: 0; }
.portal__corner-br { bottom: 0; right: 0; border-top: 0; border-left: 0; }
.portal__corner { border-radius: 0; }
.portal__corner-tl { border-top-left-radius: 6px; }
.portal__corner-tr { border-top-right-radius: 6px; }
.portal__corner-bl { border-bottom-left-radius: 6px; }
.portal__corner-br { border-bottom-right-radius: 6px; }
.portal__badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.85rem; border-radius: var(--radius-pill);
  background: rgba(0,0,0,0.30); border: 1px solid rgba(255,255,255,0.10);
  font-size: 0.7rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--color-teal-bright);
}
.portal__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-teal-bright); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }
.portal__title { font-size: clamp(1.75rem, 6vw, 2rem); margin: 0; line-height: 1.15; color: #fff; }
.portal__accent {
  background: var(--gradient-brand);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.portal__lede { font-size: 1rem; line-height: 1.55; color: var(--color-ink-muted); margin: 0; max-width: 280px; }
.portal__input-row { width: 100%; max-width: 260px; margin: 10px auto 0; }
.portal__input-label { display: block; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-ink-muted); margin-bottom: 6px; }
.portal__input {
  width: 100%; height: 48px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--surface-light-border);
  border-radius: var(--radius-pill);
  padding: 0 16px; color: #fff; font-size: 15px; font-family: "Montserrat", system-ui, sans-serif;
  outline: none; transition: border-color var(--transition), background var(--transition);
}
.portal__input::placeholder { color: var(--color-ink-muted); }
.portal__input:focus { border-color: var(--color-teal-bright); background: rgba(255,255,255,0.10); }
.portal__footer { padding: 24px 0; }
.portal__footer p { margin: 0; font-size: 12px; color: var(--color-ink-faint); text-align: center; }

/* Entrance animation */
.portal > *, .demo-hero > * { animation: rise 0.7s var(--ease-out) both; }
.portal__header { animation-delay: 0.02s; }
.portal__visual { animation-delay: 0.08s; }
.portal__badge { animation-delay: 0.14s; }
.portal__title { animation-delay: 0.2s; }
.portal__lede { animation-delay: 0.26s; }
.portal__input-row { animation-delay: 0.32s; }
.portal__footer { animation-delay: 0.38s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

@media (max-width: 460px) {
  .features { grid-template-columns: 1fr; }
  .demo { padding: 56px max(1rem, env(safe-area-inset-right)) 44px max(1rem, env(safe-area-inset-left)); }
}

/* ===== Demos directory listing ===== */
.demo-list { display: flex; flex-direction: column; gap: 10px; }
.demo-list__item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--surface-light);
  border: 1px solid var(--surface-light-border);
  text-decoration: none; color: inherit;
  transition: background var(--transition), border-color var(--transition);
}
.demo-list__item:hover { background: rgba(255,255,255,0.07); border-color: var(--color-teal-bright); }
.demo-list__num {
  font-family: "Montserrat", system-ui, sans-serif;
  font-size: 13px; font-weight: 700; color: var(--color-teal-bright);
  background: rgba(5,168,184,0.12);
  padding: 4px 10px; border-radius: var(--radius-pill);
  flex-shrink: 0; margin-top: 2px;
}
.demo-list__name { font-size: 15px; font-weight: 600; color: var(--text-on-surface); margin-bottom: 2px; }
.demo-list__desc { font-size: 13px; color: var(--text-muted); line-height: 1.4; }

/* ===== ATDP (Aviso de Tratamiento de Datos Personales) ===== */
/* Shown first on every demo. User must accept before proceeding. */
.atdp {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 24px 22px 18px;
  margin-bottom: 16px;
}
.atdp__title {
  font-family: "Montserrat", system-ui, sans-serif;
  font-size: 20px; font-weight: 700; color: #fff;
  margin: 0 0 18px; text-align: center; line-height: 1.25;
}
.text-gradient-brand {
  background: var(--gradient-brand);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.atdp__list {
  list-style: none; margin: 0 0 20px; padding: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.atdp__item {
  background: var(--surface-light);
  border: 1px solid var(--surface-light-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.atdp__item-title {
  font-size: 14px; font-weight: 600; color: var(--text-on-surface); margin: 0 0 4px;
}
.atdp__item-text {
  font-size: 13px; line-height: 1.5; color: var(--text-muted); margin: 0;
}
.atdp__accept {
  width: 100%; margin: 10px 0;
}
.atdp__version {
  text-align: center; font-size: 11px; color: var(--text-muted); margin: 0;
}
.atdp__consent-text {
    font-size: 12px; line-height: 1.5; color: var(--text-muted);
}

/* Demo content is hidden until ATDP is accepted */
.demo-content { display: none; }
.demo-content.is-visible { display: block; }

/* ===== ATDP expand/collapse ===== */
.atdp__toggle {
  display: block; width: 100%; text-align: left;
  background: none; border: none; padding: 10px 0 6px;
  font: inherit; font-size: 14px; font-weight: 600;
  color: var(--color-teal-bright);
  text-decoration: underline; text-underline-offset: 4px;
  cursor: pointer; margin-bottom: 8px;
}
.atdp__toggle:hover { color: #fff; }
.atdp__full {
  display: none; margin-bottom: 16px;
  background: var(--surface-light);
  border: 1px solid var(--surface-light-border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.atdp__full.is-open { display: block; }
.atdp__full p {
  font-size: 13px; line-height: 1.6; color: var(--text-muted); margin: 0 0 12px;
}
.atdp__full p:last-child { margin-bottom: 0; }
.atdp__full a {
  color: var(--color-teal-bright); text-decoration: underline; text-underline-offset: 3px;
}
.atdp__full a:hover { color: #fff; }

/* ===== Start Fresh / Reset ===== */
.demo-header__reset {
  background: none; border: 1px solid var(--surface-light-border);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  font: inherit; font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
  flex-shrink: 0;
}
.demo-header__reset:hover { border-color: var(--color-teal-bright); color: #fff; }

/* ===== Portal input error ===== */
.portal__input-error { min-height: 16px; }
