/* =====================================================================
   EM Pelis · Base compartida (tokens, tipografía, botones, formularios)
   Paleta "sala oscura": índigo de cine apagado + luz ámbar de proyector.
   ===================================================================== */

@font-face { font-family: "Onest"; src: url("../fonts/onest-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Onest"; src: url("../fonts/onest-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Onest"; src: url("../fonts/onest-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Onest"; src: url("../fonts/onest-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Marquesina"; src: url("../fonts/big-shoulders-display-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-style: normal; font-display: swap; }

:root {
  --sala: #13122a;
  --sala-2: #1b1938;
  --sala-3: #252249;
  --sala-4: #322e60;
  --texto: #efecf8;
  --tenue: #aba7cb;
  --tenue-2: #7f7ba3;
  --linea: rgba(239, 236, 248, .12);
  --linea-2: rgba(239, 236, 248, .22);
  --luz: #ffbf47;
  --luz-2: #ffd583;
  --luz-ink: #2a1b00;
  --ok: #4fd1a5;
  --warn: #ff9f43;
  --danger: #ff6b7d;
  --info: #8ea6ff;

  --f-body: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-display: "Marquesina", "Onest", "Arial Narrow", sans-serif;

  --gutter: clamp(16px, 4vw, 56px);
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 18px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --foco: 0 0 0 3px var(--sala), 0 0 0 6px var(--luz);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--sala);
  color: var(--texto);
  font-family: var(--f-body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, video, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 700; }
p { margin: 0; }
[hidden] { display: none !important; }

.display { font-family: var(--f-display); font-weight: 800; letter-spacing: .005em; line-height: .95; }
.muted { color: var(--tenue); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--foco); border-radius: var(--r-sm); }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: .5em; text-decoration: none; color: var(--texto); }
.logo-mark { width: 1.6em; height: 1.6em; flex: none; }
.logo-text { font-family: var(--f-display); font-weight: 800; font-size: 1.55em; letter-spacing: .01em; line-height: 1; }

/* ---------- Botones ---------- */
.btn {
  --bg: var(--sala-3); --fg: var(--texto); --bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-height: 2.75rem; padding: .6em 1.25em;
  border: 1px solid var(--bd); border-radius: var(--r-sm);
  background: var(--bg); color: var(--fg);
  font-weight: 600; font-size: 1rem; line-height: 1.1; text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: background-color .15s, transform .15s var(--ease), box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { --bg: var(--sala-4); }
.btn:active { transform: scale(.97); }
.btn svg { width: 1.25em; height: 1.25em; flex: none; }
.btn-luz { --bg: var(--luz); --fg: var(--luz-ink); }
.btn-luz:hover { --bg: var(--luz-2); }
.btn-velo { --bg: rgba(239, 236, 248, .16); --fg: var(--texto); backdrop-filter: blur(6px); }
.btn-velo:hover { --bg: rgba(239, 236, 248, .26); }
.btn-borde { --bg: transparent; --bd: var(--linea-2); }
.btn-borde:hover { --bg: rgba(239, 236, 248, .08); }
.btn-peligro { --bg: transparent; --fg: var(--danger); --bd: rgba(255, 107, 125, .45); }
.btn-peligro:hover { --bg: rgba(255, 107, 125, .12); }
.btn-lg { min-height: 3.25rem; padding: .75em 1.6em; font-size: 1.1rem; }
.btn-sm { min-height: 2.25rem; padding: .4em .85em; font-size: .9rem; }
.btn-icon { padding: 0; width: 2.75rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Utilidades comunes ---------- */
.icon-btn {
  display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem;
  border-radius: 50%; border: 0; background: transparent; color: var(--texto); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: rgba(239, 236, 248, .1); }
.icon-btn svg { width: 1.4rem; height: 1.4rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--linea-2); text-decoration: none; font-size: .88rem; }
.chip:hover { border-color: var(--luz); color: var(--luz); }
.stack { display: grid; gap: .9rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: .6rem; }

/* ---------- Formularios ---------- */
.field { display: grid; gap: .4rem; align-content: start; }
.field > label, .label { font-weight: 600; font-size: .92rem; }
.hint { color: var(--tenue); font-size: .85rem; }
.input, .select, .textarea {
  width: 100%; min-height: 2.9rem; padding: .65em .9em;
  background: var(--sala); border: 1px solid var(--linea-2); border-radius: var(--r-sm);
  color: var(--texto); font-size: 1rem;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 7rem; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 2.4em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23aba7cb' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .9em center; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--luz); box-shadow: 0 0 0 3px rgba(255, 191, 71, .25); }
.input::placeholder, .textarea::placeholder { color: var(--tenue-2); }
.check { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-weight: 500; }
.check input { width: 1.2rem; height: 1.2rem; accent-color: var(--luz); flex: none; }

/* ---------- Mensajes ---------- */
.flash-stack { display: grid; gap: .6rem; }
.flash {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .85rem 1rem; border-radius: var(--r-md);
  background: var(--sala-2); border: 1px solid var(--linea); border-left: 4px solid var(--info);
}
.flash-ok { border-left-color: var(--ok); }
.flash-error { border-left-color: var(--danger); }
.flash-warn { border-left-color: var(--warn); }
.flash p { flex: 1; }

/* ---------- Insignias ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .35em;
  padding: .15em .55em; border-radius: 999px;
  font-size: .8rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
  background: rgba(239, 236, 248, .1); color: var(--texto);
}
.badge::before { content: ""; width: .5em; height: .5em; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge-ok { color: var(--ok); background: rgba(79, 209, 165, .12); }
.badge-warn { color: var(--warn); background: rgba(255, 159, 67, .13); }
.badge-danger { color: var(--danger); background: rgba(255, 107, 125, .13); }
.badge-info { color: var(--info); background: rgba(142, 166, 255, .14); }
.badge-muted { color: var(--tenue); background: rgba(171, 167, 203, .12); }

.rating {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.2em; padding: .05em .4em; border: 1px solid var(--linea-2); border-radius: 4px;
  font-size: .8em; font-weight: 700; letter-spacing: .02em;
}

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