/* Sistema de diseño compartido. Oscuro, premium; --brand y --accent los fija la marca blanca. */
:root {
  --brand: #7C5CFF;
  --accent: #00E5C7;
  --bg: #07070C;
  --bg-2: #0D0D16;
  --surface: #13131F;
  --surface-2: #1A1A29;
  --surface-3: #232336;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #F4F4FA;
  --text-2: #B4B4C8;   /* contraste ≥ 7:1 sobre --surface */
  --text-3: #8A8AA3;   /* contraste ≥ 4.5:1 sobre --surface */
  --ok: #2BE38B;
  --warn: #FFC53D;
  --danger: #FF5470;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow: 0 10px 40px -10px rgba(0, 0, 0, .6);
  --glow: 0 0 0 1px color-mix(in srgb, var(--brand) 40%, transparent), 0 10px 40px -10px color-mix(in srgb, var(--brand) 60%, transparent);
  --grad: linear-gradient(135deg, var(--brand), var(--accent));
  --font: "Inter", "SF Pro Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.02em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.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; }
.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 1000; background: var(--accent); color: #000; padding: .6rem 1rem; border-radius: var(--radius-sm); font-weight: 700; }
.skip-link:focus { top: 1rem; }

.text-grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--text-2); }
.small { font-size: .875rem; }

/* ---------- Botones ---------- */
.btn {
  --b: var(--surface-3);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .6rem 1.1rem;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--b); color: var(--text);
  font: inherit; font-weight: 600; font-size: .95rem; text-decoration: none;
  cursor: pointer; transition: transform .15s var(--ease), background .2s, box-shadow .2s, border-color .2s;
}
.btn:hover { border-color: color-mix(in srgb, var(--brand) 60%, var(--line-strong)); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn--primary { background: var(--grad); border-color: transparent; color: #0A0A12; box-shadow: var(--glow); }
.btn--ghost { background: transparent; }
.btn--danger { background: color-mix(in srgb, var(--danger) 18%, transparent); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.btn--sm { min-height: 36px; padding: .35rem .8rem; font-size: .85rem; }
.btn--icon { width: 44px; padding: 0; }

/* ---------- Formularios ---------- */
.field { display: grid; gap: .35rem; margin-bottom: 1rem; }
.field > label, .label { font-size: .85rem; font-weight: 600; color: var(--text-2); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: .6rem .85rem;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font: inherit;
}
.input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); }
input[type="color"].input { padding: .25rem; height: 44px; width: 64px; }
input[type="range"] { accent-color: var(--brand); width: 100%; }
.hint { font-size: .8rem; color: var(--text-3); }

/* Interruptor accesible: <label class="switch"><input type="checkbox" role="switch"><span></span> Texto</label> */
.switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 46px; height: 26px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-strong); position: relative; transition: background .2s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--grad); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Selector de opciones en tarjeta (asistente) */
.choice-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.choice { position: relative; display: block; padding: 1rem; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; transition: border-color .2s, transform .2s var(--ease); }
.choice:hover { transform: translateY(-2px); }
.choice input { position: absolute; opacity: 0; }
.choice:has(input:checked) { border-color: var(--brand); box-shadow: var(--glow); }
.choice:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Superficies ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.25rem; }
.card--glass { background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(16px); }
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .6rem; border-radius: 99px; font-size: .75rem; font-weight: 700; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--line); }
.badge--ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.badge--warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.badge--danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.badge--brand { color: #0A0A12; background: var(--grad); border-color: transparent; }
.dot { width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; display: inline-block; }

.alert { display: grid; gap: .25rem; padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); }
.alert--ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.alert--warn { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.alert--error { border-color: color-mix(in srgb, var(--danger) 60%, transparent); }

/* ---------- Toasts y modal ---------- */
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 2000; }
.toast { padding: .8rem 1.1rem; border-radius: var(--radius); background: var(--surface-3); border: 1px solid var(--line-strong); box-shadow: var(--shadow); animation: toast-in .35s var(--ease); max-width: 360px; }
.toast--ok { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.toast--error { border-color: color-mix(in srgb, var(--danger) 60%, transparent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }

dialog.modal { padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); width: min(640px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); box-shadow: var(--shadow); }
dialog.modal::backdrop { background: rgba(3, 3, 8, .7); backdrop-filter: blur(6px); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal__head h2 { margin: 0; font-size: 1.15rem; }
.modal__body { padding: 1.25rem; overflow: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--line); }

/* ---------- Piezas (render de medios) ---------- */
.media { position: relative; width: 100%; height: 100%; overflow: hidden; background: #000; container-type: size; }
.media > img, .media > video { width: 100%; height: 100%; object-fit: cover; }
.media--logo { background: transparent; }
.media--missing { display: grid; place-items: center; color: var(--text-3); font-size: .8rem; text-align: center; padding: 1rem; }

.media--demo .demo__bg { position: absolute; inset: 0; background: radial-gradient(120% 80% at 20% 10%, var(--c2), transparent 60%), linear-gradient(160deg, var(--c1), #000 120%); }
.media--demo .demo__glow { position: absolute; width: 80cqmax; height: 80cqmax; left: 50%; top: 55%; translate: -50% -50%; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c2) 55%, transparent), transparent 65%); filter: blur(4cqmin); opacity: .7; }
.media--demo .demo__content { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 3cqmin; padding: 8cqmin; }
.demo__emoji { font-size: 22cqmin; line-height: 1; filter: drop-shadow(0 2cqmin 4cqmin rgba(0, 0, 0, .5)); }
.demo__title { font-size: 11cqmin; font-weight: 900; letter-spacing: -.03em; line-height: 1; text-shadow: 0 1cqmin 4cqmin rgba(0, 0, 0, .45); }
.demo__subtitle { font-size: 4.6cqmin; font-weight: 600; color: rgba(255, 255, 255, .88); max-width: 90%; }
.demo__badge { position: absolute; top: 3cqmin; left: 3cqmin; font-size: 2.6cqmin; font-weight: 800; letter-spacing: .1em; padding: .8cqmin 2cqmin; border-radius: 99px; background: rgba(0, 0, 0, .45); color: #fff; }
.demo--promo .demo__content { justify-content: flex-end; padding-bottom: 16cqmin; }
.demo--promo .demo__title { font-size: 13cqmin; }
.demo--hero .demo__title { font-size: 15cqmin; text-transform: uppercase; }
.media--logo.media--demo .demo__bg { background: linear-gradient(135deg, var(--c1), var(--c2)); border-radius: 22%; inset: 6%; }
.media--logo.media--demo .demo__glow { display: none; }
.media--logo.media--demo .demo__content { gap: 2cqmin; }
.media--logo.media--demo .demo__emoji { font-size: 34cqmin; }
.media--logo.media--demo .demo__title { font-size: 15cqmin; }
.media--video-h.media--demo .demo__emoji { font-size: 18cqmin; }
.media--video-h.media--demo .demo__title { font-size: 12cqmin; }
.media--video-h.media--demo .demo__subtitle { font-size: 5cqmin; }

/* Hueco "pendiente de material": neutro (gris), marco discontinuo, sin marca inventada */
.media--placeholder { background: repeating-linear-gradient(135deg, #15151c 0 18px, #1b1b24 18px 36px); }
.media--placeholder .ph__frame { position: absolute; inset: 4cqmin; border: .6cqmin dashed rgba(255, 255, 255, .28); border-radius: 3cqmin; }
.media--placeholder .ph__content { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.5cqmin; text-align: center; padding: 10cqmin; color: #E6E6EE; }
.ph__name { font-size: 14cqmin; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.ph__kind { font-size: 4.2cqmin; color: #B9B9C8; font-weight: 600; }
.ph__pending { font-size: 3.6cqmin; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 1cqmin 3cqmin; border-radius: 99px; background: rgba(255, 197, 61, .14); color: #FFD36B; border: .3cqmin solid rgba(255, 197, 61, .45); }
.ph__note { font-size: 3.4cqmin; color: #A8A8B8; max-width: 85%; }
.media--placeholder.media--logo .ph__name { font-size: 20cqmin; }
.media--placeholder.media--video-h .ph__name { font-size: 11cqmin; }

/* "Vídeo" de demo: animación solo cuando se reproduce */
.media--play.demo--motion .demo__bg { animation: demo-pan 9s ease-in-out infinite alternate; background-size: 160% 160%; }
.media--play.demo--motion .demo__glow { animation: demo-orbit 6s ease-in-out infinite; }
.media--play.demo--motion .demo__emoji { animation: demo-float 3.2s ease-in-out infinite; }
.media--play .demo__title { animation: demo-rise .9s var(--ease) both .15s; }
.media--play .demo__subtitle { animation: demo-rise .9s var(--ease) both .35s; }
@keyframes demo-pan { to { background-position: 100% 100%; filter: hue-rotate(15deg); } }
@keyframes demo-orbit { 50% { translate: -30% -65%; scale: 1.2; } }
@keyframes demo-float { 50% { transform: translateY(-3cqmin) rotate(-4deg) scale(1.05); } }
@keyframes demo-rise { from { opacity: 0; transform: translateY(4cqmin); } }

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