/* Kantuta Streaming Shop — sistema base
   Noche del altiplano + los tres colores de la kantuta (pétalo, tubo, cáliz).
   La franja "aguayo" es la firma visual: tiras finas de color como un tejido andino. */

@font-face { font-family: 'Unbounded'; src: url('/fonts/unbounded.woff2') format('woff2'); font-weight: 200 900; font-display: swap; }
@font-face { font-family: 'Onest'; src: url('/fonts/onest.woff2') format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Onest'; src: url('/fonts/onest-ext.woff2') format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: dark;
  --noche: #110A24;
  --noche-2: #1A1135;
  --noche-3: #251A4A;
  --noche-4: #31245E;
  --borde: rgba(205, 190, 255, .13);
  --borde-2: rgba(205, 190, 255, .24);
  --texto: #F5F1FF;
  --texto-2: #B9AED9;
  --texto-3: #8E83B3;
  --kantuta: #FF3D6E;
  --kantuta-2: #FF7A9C;
  --polen: #FFC23D;
  --hoja: #2FE39A;
  --peligro: #FF5A5F;
  --violeta: #8B6CFF;
  --tinta: #110A24; /* texto sobre botones de color */

  --aguayo: repeating-linear-gradient(90deg,
    var(--kantuta) 0 14px, var(--polen) 14px 20px, var(--hoja) 20px 26px,
    var(--violeta) 26px 34px, var(--kantuta-2) 34px 38px, var(--noche-4) 38px 44px);

  --display: 'Unbounded', 'Segoe UI', system-ui, sans-serif;
  --body: 'Onest', 'Segoe UI', system-ui, sans-serif;

  --t-xs: .8125rem; --t-sm: .9375rem; --t-md: 1rem; --t-lg: 1.25rem; --t-xl: 1.5625rem; --t-2xl: 1.953rem; --t-3xl: 2.441rem; --t-4xl: 3.052rem;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px;
  --r-card: 22px; --r-field: 12px; --r-pill: 999px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, .7);
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0; min-height: 100dvh; background: var(--noche); color: var(--texto);
  font: 400 var(--t-md)/1.55 var(--body); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.12; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--polen); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--kantuta); color: var(--tinta); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--texto-2); }
.aguayo { height: 4px; background: var(--aguayo); }
[hidden] { display: none !important; }

/* ---------- Barra superior ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--noche); border-bottom: 1px solid var(--borde); }
@supports (backdrop-filter: blur(8px)) { @media (min-width: 900px) { .topbar { background: rgba(17, 10, 36, .72); backdrop-filter: blur(14px) saturate(140%); } } }
.topbar__in { display: flex; align-items: center; gap: var(--s-4); height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; min-width: 0; }
.brand img { width: 34px; height: 34px; flex: none; }
.brand__name { font: 700 1.05rem/1 var(--display); letter-spacing: .02em; }
.brand__sub { display: block; font: 500 .68rem/1.2 var(--body); color: var(--texto-2); letter-spacing: .02em; margin-top: 3px; }
.topnav { display: none; gap: var(--s-5); }
.topnav a { text-decoration: none; color: var(--texto-2); font-weight: 500; font-size: var(--t-sm); }
.topnav a:hover { color: var(--texto); }
@media (min-width: 900px) { .topnav { display: flex; } }
.wallet-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 8px; border-radius: var(--r-pill);
  background: var(--noche-3); border: 1px solid var(--borde-2); text-decoration: none; font-weight: 600; font-size: var(--t-sm); white-space: nowrap;
}
.wallet-chip__dot { width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(var(--kantuta), var(--polen), var(--hoja), var(--kantuta)); display: grid; place-items: center; }
.wallet-chip__dot::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--noche-3); }
@media (max-width: 400px) {
  .topbar .topbar__in { gap: 10px; }
  .topbar .brand img { width: 28px; height: 28px; }
  .topbar .brand__name { font-size: .9rem; }
  .topbar .session { gap: 6px; }
  .topbar .session .btn--sm { padding: 0 10px; }
  .topbar .wallet-chip { padding-right: 10px; }
}
.bell { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: transparent; border: 1px solid var(--borde); cursor: pointer; text-decoration: none; }
.bell svg { width: 20px; height: 20px; }
.bell__n { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--kantuta); color: var(--tinta); font: 700 11px/18px var(--body); text-align: center; }

/* ---------- Botones ---------- */
.btn {
  --bg: var(--noche-3); --fg: var(--texto); --bd: var(--borde-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 22px;
  border-radius: var(--r-pill); border: 1px solid var(--bd); background: var(--bg); color: var(--fg);
  font-weight: 650; font-size: var(--t-sm); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .18s var(--ease-out), background-color .18s, border-color .18s, box-shadow .25s, opacity .18s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { --bd: var(--texto-3); }
.btn:active { transform: scale(.97); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn--primary { --bg: var(--kantuta); --fg: var(--tinta); --bd: transparent; box-shadow: 0 10px 30px -12px rgba(255, 61, 110, .8); }
.btn--primary:hover { --bg: #ff5884; box-shadow: 0 14px 36px -12px rgba(255, 61, 110, .95); }
.btn--polen { --bg: var(--polen); --fg: var(--tinta); --bd: transparent; }
.btn--hoja { --bg: var(--hoja); --fg: var(--tinta); --bd: transparent; }
.btn--danger { --bg: transparent; --fg: var(--peligro); --bd: rgba(255, 90, 95, .45); }
.btn--ghost { --bg: transparent; --bd: transparent; }
.btn--ghost:hover { --bg: var(--noche-3); }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: var(--t-xs); }
.btn--block { width: 100%; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--fg); border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formularios ---------- */
.field { display: grid; gap: 6px; }
.field > span { font-size: var(--t-xs); font-weight: 600; color: var(--texto-2); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--r-field); border: 1px solid var(--borde-2);
  background: var(--noche); color: var(--texto); font-size: 16px; /* 16px evita zoom en iPhone */
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--polen); box-shadow: 0 0 0 3px rgba(255, 194, 61, .18); }
.input::placeholder, .textarea::placeholder { color: var(--texto-3); }
.form { display: grid; gap: var(--s-4); }
.form-error { color: var(--peligro); font-size: var(--t-sm); font-weight: 500; min-height: 1em; }
.hint { font-size: var(--t-xs); color: var(--texto-3); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--t-sm); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { width: 44px; height: 26px; border-radius: 13px; background: var(--noche-4); border: 1px solid var(--borde-2); position: relative; transition: background .2s; flex: none; }
.switch__track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--texto-2); transition: transform .25s var(--ease-spring), background .2s; }
.switch input:checked + .switch__track { background: rgba(47, 227, 154, .25); border-color: var(--hoja); }
.switch input:checked + .switch__track::after { transform: translateX(18px); background: var(--hoja); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--polen); outline-offset: 2px; }

/* ---------- Etiquetas de estado ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 600; background: var(--noche-3); color: var(--texto-2); white-space: nowrap; }
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip--ok { color: var(--hoja); background: rgba(47, 227, 154, .1); }
.chip--warn { color: var(--polen); background: rgba(255, 194, 61, .1); }
.chip--bad { color: var(--peligro); background: rgba(255, 90, 95, .12); }
.chip--info { color: #9DB4FF; background: rgba(139, 108, 255, .14); }

/* ---------- Hoja / diálogo (abajo en celular, al centro en escritorio) ---------- */
dialog.sheet {
  width: min(560px, 100%); max-width: 100%; max-height: min(92dvh, 860px); margin: auto auto 0; padding: 0;
  border: 1px solid var(--borde-2); border-bottom: 0; border-radius: 26px 26px 0 0; background: var(--noche-2); color: var(--texto);
  overflow: hidden; box-shadow: 0 -20px 60px rgba(0, 0, 0, .5);
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: sheet-up .38s var(--ease-out); }
dialog.sheet::backdrop { background: rgba(6, 3, 16, .72); animation: fade .3s ease-out; }
.sheet__head { display: flex; align-items: center; gap: var(--s-3); padding: 18px 20px 14px; border-bottom: 1px solid var(--borde); }
.sheet__head h2 { font-size: var(--t-lg); margin-right: auto; }
.sheet__close { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--borde-2); background: transparent; cursor: pointer; display: grid; place-items: center; flex: none; }
.sheet__body { padding: 20px; overflow-y: auto; overscroll-behavior: contain; }
.sheet__foot { padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--borde); display: flex; gap: var(--s-3); flex-wrap: wrap; }
.sheet__grab { width: 44px; height: 5px; border-radius: 3px; background: var(--noche-4); margin: 10px auto -4px; }
@media (min-width: 700px) {
  dialog.sheet { margin: auto; border-radius: 26px; border-bottom: 1px solid var(--borde-2); }
  dialog.sheet[open] { animation: pop .32s var(--ease-out); }
  .sheet__grab { display: none; }
}
@keyframes sheet-up { from { transform: translateY(40%); opacity: 0; } }
@keyframes pop { from { transform: translateY(14px) scale(.97); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Avisos flotantes ---------- */
.toasts { position: fixed; z-index: 200; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 13px 16px; border-radius: 16px; background: var(--noche-3); border: 1px solid var(--borde-2); box-shadow: var(--shadow); font-size: var(--t-sm); animation: toast-in .3s var(--ease-out); }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--texto-2); }
.toast--ok::before { background: var(--hoja); }
.toast--bad::before { background: var(--peligro); }
.toast--warn::before { background: var(--polen); }
.toast.is-out { animation: toast-out .22s ease-in forwards; }
@keyframes toast-in { from { transform: translateY(12px) scale(.98); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(8px); opacity: 0; } }

/* ---------- Tarjetas y secciones ---------- */
.card { background: var(--noche-2); border: 1px solid var(--borde); border-radius: var(--r-card); }
.empty { text-align: center; padding: var(--s-7) var(--s-4); color: var(--texto-2); display: grid; gap: var(--s-3); justify-items: center; }
.empty img { width: 64px; opacity: .8; }

.logo-plate { display: grid; place-items: center; border-radius: 14px; background: #160d2e; border: 1px solid var(--borde); }
.logo-plate { background: radial-gradient(120% 140% at 50% 0%, color-mix(in srgb, var(--c, #555) 42%, #0c0719) 0%, #0c0719 70%); border: 1px solid color-mix(in srgb, var(--c, #555) 40%, transparent); }
.logo-plate img { width: 76%; height: 62%; object-fit: contain; }

.footer { border-top: 1px solid var(--borde); padding: var(--s-7) 0 calc(var(--s-7) + env(safe-area-inset-bottom)); color: var(--texto-2); font-size: var(--t-sm); }
.footer__in { display: flex; flex-wrap: wrap; gap: var(--s-5); align-items: center; justify-content: space-between; }
.footer a { color: var(--texto); }

.skeleton { background: linear-gradient(90deg, var(--noche-2), var(--noche-3), var(--noche-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r-card); }
@keyframes shimmer { to { background-position: -200% 0; } }

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