/* =========================================================================
   Sistema de diseño base compartido. Cada app redefine las variables en
   apps/<id>/public/css/app.css para tener su propia marca.
   ========================================================================= */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #f3f3f6;
  --text: #16161a;
  --muted: #5f6270;
  --line: #e5e5ea;
  --brand: #5b3df5;
  --brand-ink: #ffffff;
  --brand-soft: #efeaff;
  --accent: #ff6b4a;
  --success: #0f9f6e;
  --danger: #e5384a;
  --warning: #e08a00;
  --focus: #5b3df5;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --shadow-sm: 0 1px 2px rgb(16 16 24 / 0.06);
  --shadow: 0 1px 2px rgb(16 16 24 / 0.05), 0 10px 30px rgb(16 16 24 / 0.08);
  --shadow-lg: 0 2px 4px rgb(16 16 24 / 0.05), 0 24px 60px rgb(16 16 24 / 0.16);
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: var(--font-sans);
  --font-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --maxw: 1120px;
  --header-h: 64px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

/* ---------- reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
}
h1,
h2,
h3,
h4 {
  margin: 0 0 0.5em;
  line-height: 1.12;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}
p {
  margin: 0 0 1em;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}
::selection {
  background: var(--brand);
  color: var(--brand-ink);
}
[hidden] {
  display: none !important;
}

/* ---------- layout ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: 16px;
}
@media (min-width: 720px) {
  .container {
    padding-inline: 24px;
  }
}
.section {
  padding-block: 56px;
}
@media (min-width: 900px) {
  .section {
    padding-block: 96px;
  }
}
.stack > * + * {
  margin-top: var(--gap, 12px);
}
.row {
  display: flex;
  align-items: center;
  gap: var(--gap, 12px);
  flex-wrap: wrap;
}
.grid {
  display: grid;
  gap: var(--gap, 16px);
}
@media (min-width: 720px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.center {
  text-align: center;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.875rem;
}
.tiny {
  font-size: 0.75rem;
}
.lead {
  font-size: clamp(1.05rem, 1.4vw + 0.7rem, 1.3rem);
  line-height: 1.5;
}
.kicker {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 10px;
}
.display {
  font-size: clamp(2.4rem, 6vw + 1rem, 5rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.display-md {
  font-size: clamp(2rem, 4vw + 1rem, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hide-sm {
  display: none;
}
@media (min-width: 640px) {
  .hide-sm {
    display: initial;
  }
  .only-sm {
    display: none !important;
  }
}

/* ---------- botones ---------- */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 650;
  font-size: 0.98rem;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform 0.15s var(--ease),
    box-shadow 0.2s var(--ease),
    background 0.2s var(--ease),
    opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0) scale(0.98);
}
.btn[disabled],
.btn.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}
.btn-primary {
  --btn-bg: var(--brand);
  --btn-fg: var(--brand-ink);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 30%, transparent);
}
.btn-primary:hover {
  box-shadow: 0 10px 26px color-mix(in srgb, var(--brand) 38%, transparent);
}
.btn-secondary {
  --btn-bg: var(--surface);
  border-color: var(--line);
}
.btn-ghost {
  --btn-bg: transparent;
}
.btn-ghost:hover {
  --btn-bg: var(--surface-2);
}
.btn-sm {
  min-height: 36px;
  padding: 7px 14px;
  font-size: 0.88rem;
}
.btn-lg {
  min-height: 56px;
  padding: 14px 26px;
  font-size: 1.08rem;
}
.btn-block {
  display: flex;
  width: 100%;
}
.btn .pro-tag,
.pro-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: linear-gradient(120deg, #ffcf3f, #ff8a3d);
  color: #2b1600;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

/* ---------- tarjetas y piezas ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.86rem;
  font-weight: 600;
}
.divider {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 24px 0;
}

/* ---------- formularios ---------- */
.field {
  display: grid;
  gap: 6px;
}
.field label {
  font-size: 0.85rem;
  font-weight: 600;
}
.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 16px; /* evita el zoom automático en iOS */
}
.input:focus {
  outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent);
  border-color: var(--focus);
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}
.check input {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  flex: none;
}
.form-error {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 1.2em;
  margin: 0;
}

/* ---------- cabecera y pie ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.logo svg {
  width: 32px;
  height: 32px;
  flex: none;
}
.nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-link {
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--muted);
}
.nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
}
.lang-link {
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}
.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px 0 28px;
  margin-top: 40px;
}
.footer-inner {
  display: grid;
  gap: 24px;
}
@media (min-width: 720px) {
  .footer-inner {
    grid-template-columns: 1.2fr 2fr;
    align-items: start;
  }
}
.footer-brand p {
  max-width: 34ch;
  margin-top: 10px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}
.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
}
.footer-links a:hover {
  color: var(--text);
}
.copyright {
  margin-top: 20px;
}

/* ---------- blog y textos legales ---------- */
.prose-wrap {
  max-width: 760px;
  padding-block: 40px 24px;
}
.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--muted);
  text-decoration: none;
}
.post-title {
  font-size: clamp(2rem, 3vw + 1.2rem, 3rem);
  margin-top: 0.2em;
}
.prose {
  font-size: 1.06rem;
  line-height: 1.75;
}
.prose h2 {
  font-size: 1.6rem;
  margin-top: 1.8em;
}
.prose h3 {
  font-size: 1.25rem;
  margin-top: 1.5em;
}
.prose a {
  color: var(--brand);
  text-underline-offset: 3px;
}
.prose ul,
.prose ol {
  padding-left: 1.3em;
}
.prose li {
  margin: 0.35em 0;
}
.prose blockquote {
  margin: 1.5em 0;
  padding: 0.6em 1.2em;
  border-left: 4px solid var(--brand);
  background: var(--surface-2);
  border-radius: 0 12px 12px 0;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
}
.prose th,
.prose td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.prose th {
  background: var(--surface-2);
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 6px;
}
.prose img {
  border-radius: var(--radius);
}
.legal h2 {
  font-size: 1.25rem;
}
.post-list {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}
.post-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}
.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.post-link {
  display: block;
  padding: 22px;
  text-decoration: none;
}
.post-link h2 {
  font-size: 1.35rem;
  margin-bottom: 6px;
}
.post-link .link {
  color: var(--brand);
  font-weight: 650;
}
.blog-cta {
  margin: 48px 0 16px;
  padding: 28px;
  border-radius: var(--radius-xl);
  background: var(--brand-soft);
  text-align: center;
}
.blog-cta h2 {
  font-size: 1.6rem;
}

/* ---------- modal (kit de crecimiento) ---------- */
dialog.g-modal {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: auto;
}
dialog.g-modal::backdrop {
  background: rgb(10 10 16 / 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
dialog.g-modal[open] {
  animation: g-pop 0.28s var(--ease);
}
@keyframes g-pop {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}
.g-modal-body {
  padding: 26px 22px 22px;
  position: relative;
}
@media (min-width: 560px) {
  .g-modal-body {
    padding: 32px 30px 26px;
  }
}
.g-modal-close {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
}
.g-modal h2 {
  font-size: 1.5rem;
  margin: 8px 0 8px;
  padding-right: 36px;
}
.g-fd-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  font-size: 28px;
  border-radius: 18px;
  background: var(--brand-soft);
  margin-bottom: 12px;
}
.g-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.g-success {
  text-align: center;
  padding: 10px 0 4px;
}
.g-success .big {
  font-size: 46px;
  margin-bottom: 6px;
}
.g-plans {
  display: grid;
  gap: 10px;
  margin: 18px 0 14px;
}
.g-plan {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  text-align: left;
  width: 100%;
}
.g-plan[aria-checked='true'] {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.g-plan .g-plan-name {
  font-weight: 750;
}
.g-plan .g-plan-price {
  font-weight: 800;
  font-size: 1.15rem;
  text-align: right;
}
.g-plan .g-plan-old {
  text-decoration: line-through;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.g-plan .g-plan-tag {
  position: absolute;
  top: -10px;
  left: 14px;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.g-benefits {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 8px;
}
.g-benefits li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.95rem;
}
.g-benefits li::before {
  content: '✓';
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 0.75rem;
  font-weight: 900;
  margin-top: 1px;
}
.g-link-btn {
  border: 0;
  background: none;
  padding: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- toast ---------- */
.g-toasts {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 100;
  display: grid;
  gap: 8px;
  width: min(440px, calc(100vw - 24px));
  pointer-events: none;
}
.g-toast {
  padding: 12px 16px;
  border-radius: 14px;
  background: #16161a;
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  box-shadow: var(--shadow-lg);
  animation: g-toast-in 0.3s var(--ease);
  text-align: center;
}
.g-toast.is-error {
  background: var(--danger);
}
@keyframes g-toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* ---------- banner de consentimiento ---------- */
.g-consent {
  position: fixed;
  z-index: 90;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  line-height: 1.4;
  animation: g-toast-in 0.4s var(--ease);
}
.g-consent p {
  margin: 0;
  flex: 1 1 260px;
}
.g-consent .row {
  gap: 8px;
}

/* ---------- carga / progreso ---------- */
.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, currentColor 20%, transparent);
  border-top-color: currentColor;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  width: var(--p, 0%);
  background: var(--brand);
  border-radius: inherit;
  transition: width 0.25s var(--ease);
}
.progress.is-indeterminate > span {
  width: 40%;
  animation: indet 1.2s ease-in-out infinite;
}
@keyframes indet {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(260%);
  }
}

/* ---------- utilidades de la app ---------- */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.fade-in {
  animation: fade-in 0.35s var(--ease) both;
}
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
.mirror {
  transform: scaleX(-1);
}

/* Modo demo para grabar vídeos (?demo=1): oculta banners y muestra el gancho */
.demo-hook {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  width: min(92vw, 560px);
  padding: 12px 16px;
  border-radius: 16px;
  background: #fff;
  color: #111;
  font-weight: 800;
  font-size: clamp(1.1rem, 4.5vw, 1.6rem);
  line-height: 1.15;
  text-align: center;
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.25);
}
html.is-demo .g-consent,
html.is-demo .site-header {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Nunca tapar los controles de la cámara con el banner de privacidad */
body.is-stage .g-consent,
body.is-session .g-consent {
  display: none !important;
}
