/* Shell (header, nav, footer, toast) + composición bento del inicio. Estilo plano/cómic; usa variables de tokens.css. */

body { display: flex; flex-direction: column; overflow-x: hidden; }
[hidden] { display: none !important; } /* .btn, .carousel-nav... fijan display y anularían el atributo */
main { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 22px clamp(16px, 2.5vw, 32px) 36px; outline: none; }

:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }
main:focus-visible { outline: none; } /* foco programático del router tras navegar */
.btn:focus-visible { outline-offset: 4px; border-radius: var(--r-pill); }

.skip { position: absolute; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: var(--r-pill); background: var(--amber); color: var(--ink); border: 2.5px solid var(--ink); font-weight: 800; }
.skip:focus { top: 12px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg-2);
  border-bottom: 3px solid var(--ink);
  box-shadow: 0 4px 0 var(--amber-lo);
}
.header-inner { max-width: 1440px; margin: 0 auto; padding: 10px clamp(16px, 2.5vw, 32px); display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; letter-spacing: .02em; }
.brand img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; object-position: 62% 30%; border: 2.5px solid var(--ink); box-shadow: 0 0 0 2px var(--amber), 3px 3px 0 2px var(--amber-lo); }
.brand .display { text-shadow: 2px 2px 0 var(--ink); }
.brand-l1 { color: var(--amber); }

.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a {
  position: relative; padding: 8px 13px; border-radius: var(--r-pill); border: 2px solid transparent;
  font: 800 .74rem var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: #d8d1c2;
  transition: color .15s, background .15s;
}
.site-nav a:hover { color: var(--text); background: var(--panel-hi); border-color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--amber); border-color: var(--ink); box-shadow: 3px 3px 0 var(--amber-lo); }
.header-login { padding: 9px 20px; }

/* Sesión: menú Entrar / avatar + Salir */
.session { position: relative; display: flex; align-items: center; gap: 8px; }
.login-menu {
  position: absolute; right: 0; top: calc(100% + 14px); z-index: 60; width: 230px;
  display: grid; gap: 10px; padding: 16px; border-radius: var(--r-md);
  background: linear-gradient(155deg, var(--panel-hi) 0 34%, var(--panel) 34%);
  border: 3px solid var(--ink); box-shadow: var(--shadow);
}
.login-menu .card-title { margin: 0 0 2px; }
.session-user { display: flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: var(--r-pill); font-weight: 800; font-size: .85rem; background: var(--panel-hi); border: 2.5px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); max-width: 200px; }
.session-user:hover { background: #20304a; }
.session-user img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid var(--amber); }
.session-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-out { padding: 8px 14px; }
[data-auth="in"] [data-login] { display: none; }
@media (max-width: 520px) {
  .session-user span { display: none; }
  .session-user { padding: 3px; }
  .brand { font-size: 1.1rem; } /* Orbitron/Anallop son más anchas */
}

.nav-toggle { display: none; margin-left: auto; width: 46px; height: 46px; border: 2.5px solid var(--ink); border-radius: 15px; background: var(--panel-hi); box-shadow: 3px 3px 0 var(--amber-lo); cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.nav-toggle span { width: 20px; height: 3px; border-radius: 2px; background: var(--amber); transition: transform .2s, opacity .2s; }
.menu-open .nav-toggle span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-open .nav-toggle span:nth-child(2) { opacity: 0; }
.menu-open .nav-toggle span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 1180px) { /* con sesión (avatar + Salir) la nav no cabe por debajo */
  .nav-toggle { display: flex; }
  .header-login { padding: 9px 16px; }
  .site-nav {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; margin: 0;
    flex-direction: column; gap: 4px; padding: 14px 16px 18px;
    background: var(--bg-2); border-bottom: 3px solid var(--ink); box-shadow: 0 4px 0 var(--amber-lo);
    display: none;
  }
  .menu-open .site-nav { display: flex; }
  .site-nav a { padding: 13px 16px; font-size: .85rem; }
}

/* ---------- Footer ---------- */
.site-footer { margin-top: 12px; background: var(--bg-2); border-top: 3px solid var(--ink); box-shadow: 0 -4px 0 var(--amber-lo); }
.footer-inner { max-width: 1440px; margin: 0 auto; padding: 22px clamp(16px, 2.5vw, 32px); display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; }
.footer-brand { display: flex; align-items: baseline; gap: 10px; }
.footer-brand .display { font-size: 1.1rem; text-shadow: 2px 2px 0 var(--ink); }
.footer-brand .script { font-size: 1.5rem; }
.footer-social { display: flex; gap: 12px; padding: 0; list-style: none; }
.footer-social .btn { padding: 8px 18px; }
.footer-legal { flex: 1 1 320px; font-size: .8rem; line-height: 1.5; text-align: right; }
.footer-legal a { color: var(--text); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--amber-lo); }
.footer-legal a:hover { color: var(--amber); }
@media (max-width: 700px) { .footer-legal { text-align: left; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translate(-50%, 20px);
  padding: 12px 20px; border-radius: var(--r-md); max-width: calc(100vw - 32px);
  background: var(--amber); color: var(--ink); border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink);
  font-weight: 800; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Inicio: bento ---------- */
.bento { display: grid; gap: 22px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.bento > * { min-width: 0; }
.bento h2, .bento h3 { font-weight: 800; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.block-head .card-title { margin: 0; }
.more { font: 800 .7rem var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid transparent; transition: color .15s, border-color .15s; }
.more:hover { color: var(--amber); border-color: var(--amber); }

/* Héroe: foto ciudad.webp a sangre + rata en viñeta, sin tocar las imágenes */
.hero {
  grid-column: 1 / 8; grid-row: 1 / 3;
  min-height: 460px; padding: clamp(24px, 3vw, 44px);
  display: flex; align-items: flex-end;
}
.hero-scene { position: absolute; inset: 3px; z-index: -1; border-radius: inherit; overflow: hidden; background: var(--bg); }
.hero-scene img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 78% 35%; }
.hero-scene::after { /* degradado para leer el texto sobre la foto */
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(5, 6, 10, .9) 0%, rgba(5, 6, 10, .7) 38%, rgba(5, 6, 10, 0) 68%),
              linear-gradient(0deg, rgba(5, 6, 10, .75) 0%, rgba(5, 6, 10, 0) 40%);
}
.hero.card::after { display: none; }
.hero-art {
  position: absolute; right: clamp(18px, 3vw, 40px); top: clamp(18px, 3vw, 40px); width: min(34%, 290px); aspect-ratio: 1;
  pointer-events: none; border-radius: var(--r-lg); overflow: hidden;
  border: 3px solid var(--ink); box-shadow: 0 0 0 3px var(--amber), 7px 7px 0 3px var(--ink);
}
.hero-art img { width: 100%; height: 100%; object-fit: cover; }
.hero-copy { position: relative; z-index: 1; max-width: min(540px, 100%); }
.hero-title {
  font-size: clamp(3.2rem, 7vw, 6.4rem); letter-spacing: -.01em;
  color: var(--amber);
  -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  text-shadow: 6px 6px 0 var(--amber-lo), 9px 9px 0 var(--ink);
}
.hero-sub { font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.05; margin: -.05em 0 14px .2em; color: var(--amber-hi); text-shadow: 2px 2px 0 var(--ink); }
.hero-text { color: #e4ddcf; line-height: 1.55; max-width: 44ch; margin-bottom: 22px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.hero-goal { max-width: 420px; padding: 14px 16px; border-radius: var(--r-md); background: var(--panel); border: 3px solid var(--ink); box-shadow: var(--shadow-sm); }
.hero-goal-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; font-size: .85rem; color: var(--muted); }
.hero-goal-head .card-title { margin: 0; }
.hero-goal-head b { color: var(--text); }

/* Canal */
.channel { grid-column: 8 / 13; grid-row: 1; display: flex; flex-direction: column; gap: 14px; }
.channel-head { display: flex; align-items: center; gap: 14px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: 62% 30%; border: 3px solid var(--ink); box-shadow: 0 0 0 3px var(--amber), 4px 4px 0 3px var(--ink); }
.channel-name { font: 400 1.5rem var(--font-display); text-transform: uppercase; margin-bottom: 6px; text-shadow: 2px 2px 0 var(--ink); }
.channel-live { font-size: .88rem; line-height: 1.4; }
.channel-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.channel-actions .btn { flex: 1 1 150px; padding: 10px 14px; font-size: .72rem; }
.channel-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: auto; }
.channel-stats .stat { display: flex; flex-direction: column-reverse; padding: 10px 6px; text-align: center; border-radius: var(--r-md); background: var(--panel-lo); border: 2.5px solid var(--ink); }
.channel-stats dd { margin: 0; }
.channel-stats .stat b { font-size: clamp(1.1rem, 1.6vw, 1.5rem); }

/* Premios */
.prizes { grid-column: 8 / 13; grid-row: 2; display: flex; flex-direction: column; }
.carousel-nav { display: flex; gap: 8px; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 2.5px solid var(--ink); border-radius: 50%; cursor: pointer; color: var(--ink); background: var(--amber); box-shadow: 3px 3px 0 var(--amber-lo); transition: transform .12s, box-shadow .12s; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--amber-hi); }
.icon-btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--amber-lo); }
.carousel { display: grid; grid-auto-flow: column; grid-auto-columns: calc(50% - 8px); gap: 14px; padding: 2px 6px 8px 2px; list-style: none; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.prize {
  scroll-snap-align: start; padding: 16px; border-radius: var(--r-md); display: flex; flex-direction: column; gap: 6px;
  background: var(--halftone), linear-gradient(160deg, var(--rock) 0 30%, #2a2219 30%);
  border: 2.5px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
}
.prize-img { width: 52px; height: 52px; object-fit: cover; border-radius: 15px; background: var(--panel-lo); border: 2.5px solid var(--ink); box-shadow: 2px 2px 0 var(--amber-lo); margin-bottom: 4px; }
.prize-img.is-rata { object-position: 62% 30%; }
.home-slot { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.home-slot > .carousel { flex: 1; }
.prize h3 { font-size: .98rem; }
.prize p { font-size: .8rem; line-height: 1.4; flex: 1; color: #c9c0ad; }
.prize-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .72rem; margin-top: 6px; }
.prizes > .more { margin-top: 12px; align-self: flex-end; }

/* Clips: miniatura = viñeta plana de ciudad (SVG en CSS) */
.clips { grid-column: 1 / 8; grid-row: 3; }
.clip-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 0; list-style: none; }
.clip { display: flex; flex-direction: column; gap: 6px; border-radius: var(--r-md); }
.clip-thumb, .p-thumb {
  --city: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 180' preserveAspectRatio='xMidYMax slice'%3E%3Cpath d='M0 120 50 96 92 112 150 88 210 110 262 92 320 108V180H0Z' fill='%230f1b29' stroke='%23000' stroke-width='2'/%3E%3Cg fill='%230d1621' stroke='%23000' stroke-width='2'%3E%3Crect x='150' y='40' width='26' height='100'/%3E%3Crect x='180' y='16' width='30' height='124'/%3E%3Crect x='214' y='56' width='22' height='84'/%3E%3Crect x='240' y='30' width='28' height='110'/%3E%3Crect x='272' y='70' width='24' height='70'/%3E%3Crect x='100' y='78' width='22' height='62'/%3E%3Crect x='124' y='64' width='22' height='76'/%3E%3C/g%3E%3Cg fill='%23ffc400'%3E%3Crect x='186' y='26' width='4' height='60'/%3E%3Crect x='246' y='40' width='4' height='50'/%3E%3Crect x='156' y='50' width='5' height='6'/%3E%3Crect x='166' y='66' width='5' height='6'/%3E%3Crect x='198' y='40' width='5' height='6'/%3E%3Crect x='198' y='96' width='5' height='6'/%3E%3Crect x='220' y='70' width='5' height='6'/%3E%3Crect x='256' y='60' width='5' height='6'/%3E%3Crect x='256' y='100' width='5' height='6'/%3E%3Crect x='106' y='90' width='5' height='6'/%3E%3Crect x='130' y='80' width='5' height='6'/%3E%3Crect x='278' y='86' width='5' height='6'/%3E%3C/g%3E%3Cpath d='M0 140H320V180H0Z' fill='%233a2f22' stroke='%23000' stroke-width='2'/%3E%3Cpath d='M0 140 320 136' stroke='%23ffc400' stroke-width='3'/%3E%3C/svg%3E");
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden;
  border: 2.5px solid var(--ink); box-shadow: 4px 4px 0 var(--amber-lo); transition: transform .15s, box-shadow .15s;
  background: var(--city) center bottom / cover no-repeat, linear-gradient(180deg, #05060a, #173252);
}
.clip-thumb.t1, .p-clip:nth-child(3n+2) .p-thumb { background: var(--city) 30% bottom / 140% auto no-repeat, linear-gradient(180deg, #05060a, #1b2a3f); }
.clip-thumb.t2, .p-clip:nth-child(3n) .p-thumb { background: var(--city) 80% bottom / 120% auto no-repeat, linear-gradient(180deg, #0b1118, #3a2f22); }
.clip:hover .clip-thumb { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--amber-lo); }
.clip-play { position: absolute; inset: 0; margin: auto; width: 44px; height: 44px; border-radius: 50%; background: var(--amber); border: 2.5px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.clip-play::after { content: ''; position: absolute; left: 15px; top: 10px; border: 9px solid transparent; border-left: 13px solid var(--ink); border-right: 0; }
.clip-dur { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--panel-lo); border: 2px solid var(--ink); font-size: .7rem; font-weight: 800; }
.clip-title { font-weight: 600; font-size: .88rem; line-height: 1.3; }
.clip-meta { font-size: .74rem; }

/* Top */
.top { grid-column: 8 / 13; grid-row: 3; }
.top-list { display: flex; flex-direction: column; gap: 10px; padding: 0; list-style: none; }
.top-row { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r-md); background: var(--panel-lo); border: 2.5px solid var(--ink); }
.top-pos { font-size: 1.5rem; text-align: center; text-shadow: 2px 2px 0 var(--ink); }
.top-name, .top-pts { display: flex; flex-direction: column; font-weight: 800; }
.top-pts { text-align: right; color: var(--text); }
.top-name small, .top-pts small { font-size: .7rem; font-weight: 600; }
.r1 { background: var(--halftone), linear-gradient(90deg, var(--rock) 0 40%, var(--panel-lo) 40%); box-shadow: 4px 4px 0 var(--amber-lo); }
.r1 .top-pos { color: var(--amber); }
.r2 .top-pos { color: var(--cyan); }
.r3 .top-pos { color: #d9a46c; }

/* Escritorio grande: el bento cabe en una pantalla */
@media (min-width: 1100px) {
  .bento .card { padding: 18px 20px; }
  .bento .hero { padding: clamp(24px, 3vw, 44px); min-height: 0; } /* su min-height inflaba la fila 1fr al abarcar 2 filas */
  .prize { padding: 12px 14px; }
  .prize-img { width: 40px; height: 40px; }
  .clip-thumb { aspect-ratio: 16 / 7; }
  .top-row { padding: 6px 14px; }
}
@media (min-width: 1100px) and (min-height: 820px) {
  .bento { min-height: calc(100vh - 68px - 58px); grid-template-rows: auto 1fr auto; } /* header + padding de main */
  .carousel { flex: 1; contain: size; min-height: 190px; } /* evita que el % de columna infle la fila en el cálculo intrínseco */
}

/* Tableta: 2 columnas */
@media (max-width: 1099px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-column: 1 / -1; grid-row: auto; min-height: 520px; }
  .channel, .prizes, .clips, .top { grid-column: auto; grid-row: auto; }
  .clips, .top { grid-column: 1 / -1; }
}

/* Móvil: una columna, la viñeta de la rata arriba */
@media (max-width: 700px) {
  .bento { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .hero { flex-direction: column; align-items: stretch; min-height: 0; padding-top: 24px; }
  .hero-art { position: relative; right: auto; top: auto; width: min(62%, 240px); margin: 0 auto 22px; }
  .hero-scene::after { background: linear-gradient(0deg, rgba(5, 6, 10, .94) 0%, rgba(5, 6, 10, .82) 50%, rgba(5, 6, 10, .25) 100%); }
  .clip-list { grid-template-columns: 1fr; }
  .clip { display: grid; grid-template-columns: 120px 1fr; grid-template-rows: auto 1fr; column-gap: 12px; }
  .clip-thumb { grid-row: 1 / 3; }
  .clip-title { align-self: end; }
  .carousel { grid-auto-columns: 78%; }
  .card { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .btn:hover, .btn:active, .icon-btn:active, .clip:hover .clip-thumb { transform: none; }
}
