/* ==========================================================
   KaosMC · kaos.css — estilo Kaos (como el launcher) y páginas nuevas:
   descargas, cosméticos, foro, hilo y perfil. Solo usa los tokens de tokens.css.
   ========================================================== */

/* ---------- Ambiente: brillo morado/magenta de fondo y títulos Chakra Petch ---------- */
body {
  background:
    radial-gradient(900px 500px at 12% -10%, rgb(124 58 237 / 0.22), transparent 60%),
    radial-gradient(800px 500px at 100% 10%, rgb(232 121 249 / 0.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
h1, h2, h3, .section-title { font-family: var(--font-title); letter-spacing: 0.01em; }
h1 { text-shadow: 0 0 28px rgb(168 85 247 / 0.45); }
::selection { background: #7C3AED; color: #fff; }

/* Cabecera de cristal */
.site-header { backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); }
.site-header:not(.site-header--home) { background: rgb(14 10 28 / 0.72); border-bottom: 1px solid rgb(168 85 247 / 0.18); }
.nav-link { font-family: var(--font-title); font-weight: 600; letter-spacing: 0.02em; }
.nav-link[aria-current="page"], .nav-link.is-active { color: #fff; text-shadow: 0 0 14px rgb(232 121 249 / 0.6); }

/* Paneles y botones con brillo */
.kaos-panel, .card {
  background: linear-gradient(180deg, rgb(255 255 255 / 0.035), rgb(255 255 255 / 0.01)), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: 0 0 0 1px rgb(168 85 247 / 0.06) inset, 0 10px 30px rgb(0 0 0 / 0.35);
}
.kaos-panel { padding: var(--sp-6); }
.btn--primary { background: linear-gradient(135deg, #7C3AED, #A855F7 55%, #D946EF); border-color: transparent; }
.btn--primary:hover { filter: brightness(1.1); }
.kaos-glow { box-shadow: 0 0 0 1px rgb(232 121 249 / 0.35), 0 8px 28px rgb(168 85 247 / 0.45); }
.chip.is-active, .chip[aria-pressed="true"] { background: linear-gradient(135deg, #7C3AED, #C026D3); color: #fff; border-color: transparent; }
.kaos-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--r-badge);
  font: 600 0.72rem/1.4 var(--font-title); text-transform: uppercase; letter-spacing: 0.06em;
  background: rgb(232 121 249 / 0.16); color: #F5D0FE; border: 1px solid rgb(232 121 249 / 0.35);
}
.kaos-badge--muted { background: rgb(255 255 255 / 0.06); color: var(--text-muted); border-color: var(--border); }
.section-title { font-size: var(--fs-h2); margin: var(--sp-12) 0 var(--sp-6); }
.page-hero--kaos .pixel-label { color: #F0ABFC; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.92rem; color: var(--text-muted); cursor: pointer; }
.check input { accent-color: #A855F7; }
.muted { color: var(--text-muted); }

/* ---------- Descargas ---------- */
.dl-card { display: grid; gap: var(--sp-6); grid-template-columns: 1fr auto; align-items: center; position: relative; overflow: hidden; }
.dl-card::after {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 420px; height: 420px; pointer-events: none;
  background: radial-gradient(circle, rgb(168 85 247 / 0.28), transparent 65%);
}
.dl-main { display: flex; align-items: center; gap: var(--sp-6); }
.dl-logo { width: 96px; height: 96px; filter: drop-shadow(0 0 18px rgb(168 85 247 / 0.6)); }
.dl-version { font: 700 clamp(1.6rem, 1rem + 2.2vw, 2.4rem)/1.1 var(--font-title); margin: 2px 0 6px; }
.dl-meta { color: var(--text-muted); margin: 0; }
.dl-actions { display: flex; flex-direction: column; gap: var(--sp-3); align-items: stretch; position: relative; z-index: 1; }
.dl-note { grid-column: 1 / -1; color: var(--text-muted); font-size: 0.92rem; margin: 0; }
.feature-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: var(--sp-8); }
.feature h3 { margin: 0 0 var(--sp-2); font-size: 1.05rem; color: #F5D0FE; }
.feature p { margin: 0; color: var(--text-muted); }
.changelog { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.changelog-item.is-latest { border-color: rgb(232 121 249 / 0.45); }
.changelog-head { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-2); }
.changelog-version { font: 700 1.1rem var(--font-title); }
.changelog-date { color: var(--text-muted); font-size: 0.88rem; margin-left: auto; }
.changelog-notes p { margin: 0 0 4px; color: var(--text-muted); }
.changelog-notes p::before { content: "▸ "; color: #C084FC; }
@media (max-width: 720px) {
  .dl-card { grid-template-columns: 1fr; }
  .dl-main { gap: var(--sp-4); }
  .dl-logo { width: 64px; height: 64px; }
}

/* ---------- Cosméticos ---------- */
.cos-layout { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: var(--sp-6); align-items: start; }
.cos-preview { position: sticky; top: calc(var(--header-h) + var(--sp-4)); display: grid; gap: var(--sp-3); }
.cos-skin { display: flex; gap: var(--sp-2); }
.cos-skin .input { flex: 1; min-width: 0; }
.cos-status { margin: 0; color: var(--text-muted); font-size: 0.9rem; min-height: 1.3em; }
.cos-canvas-wrap {
  border-radius: var(--r-card); overflow: hidden; display: flex; justify-content: center;
  background: radial-gradient(circle at 50% 35%, rgb(168 85 247 / 0.28), transparent 65%), #0B0816;
  border: 1px solid var(--border);
}
.cos-canvas-wrap canvas { width: 100%; max-width: 360px; height: auto; aspect-ratio: 360 / 460; display: block; }
.cos-tools { display: flex; gap: var(--sp-4); align-items: center; flex-wrap: wrap; }
.cos-tools .btn { margin-left: auto; }
.cos-selected { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.cos-chip { display: inline-flex; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); font-size: 0.85rem; }
.cos-chip-k { color: #F0ABFC; font-weight: 600; }
.cos-tabs { margin-bottom: var(--sp-3); }
.cos-hint { color: var(--text-muted); margin: 0 0 var(--sp-4); }
.cos-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.cos-card {
  position: relative; display: grid; justify-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-2) var(--sp-4);
  border-radius: var(--r-tile); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; transition: transform var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.cos-card:hover { transform: translateY(-2px); border-color: rgb(168 85 247 / 0.6); }
.cos-card.is-selected { border-color: #E879F9; box-shadow: 0 0 0 1px #E879F9, 0 0 24px rgb(232 121 249 / 0.35); }
.cos-thumb { width: 80px; height: 128px; image-rendering: pixelated; border-radius: 6px; }
.cos-thumb--icon { width: 96px; height: 96px; image-rendering: auto; }
.cos-name { font-weight: 600; text-align: center; font-size: 0.92rem; }
.cos-lock, .cos-tag {
  font: 600 0.68rem/1.3 var(--font-title); text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 6px; border-radius: 5px;
  background: rgb(255 201 60 / 0.14); color: var(--gold); border: 1px solid rgb(255 201 60 / 0.35); text-align: center;
}
.cos-tag { background: rgb(168 85 247 / 0.16); color: #E9D5FF; border-color: rgb(168 85 247 / 0.4); }
.cos-empty, .cos-foot { color: var(--text-muted); }
.cos-foot { margin-top: var(--sp-6); font-size: 0.9rem; }
@media (max-width: 880px) {
  .cos-layout { grid-template-columns: 1fr; }
  .cos-preview { position: static; }
}

/* ---------- Foro ---------- */
.forum-bar { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; margin-bottom: var(--sp-4); }
.forum-bar .chip-row { flex: 1 1 auto; }
.forum-search { flex: 0 1 240px; margin: 0; }
.forum-user { display: inline-flex; align-items: center; gap: var(--sp-2); margin-left: auto; flex-wrap: wrap; }
.forum-error { color: #FFB4B4; background: rgb(255 80 80 / 0.1); border: 1px solid rgb(255 80 80 / 0.35); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-btn); }
.forum-new { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-6); }
.forum-new h3 { margin: 0; }
.forum-new-row { display: grid; grid-template-columns: 180px 1fr; gap: var(--sp-3); }
.forum-new textarea, .forum-reply textarea, .profile-edit textarea { width: 100%; resize: vertical; font: inherit; }
.forum-new-actions { display: flex; justify-content: flex-end; align-items: center; gap: var(--sp-2); }
.forum-list, .forum-replies { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.forum-row { display: flex; gap: var(--sp-4); align-items: center; padding: var(--sp-4) var(--sp-6); }
.forum-row.is-pinned { border-color: rgb(232 121 249 / 0.45); }
.forum-row-main { flex: 1; min-width: 0; display: grid; gap: var(--sp-2); }
.forum-row-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.forum-row-title { font: 700 1.08rem var(--font-title); color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.forum-row-title:hover { color: #F0ABFC; }
.forum-cat { font-size: 0.78rem; color: #D8B4FE; background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; }
.forum-row-meta { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.forum-row-stats { display: grid; justify-items: end; text-align: right; color: var(--text-muted); font-size: 0.85rem; min-width: 110px; }
.forum-row-stats strong { font: 700 1.3rem var(--font-title); color: var(--text); }
.forum-when { color: var(--text-muted); font-size: 0.85rem; }
.forum-pages { display: flex; gap: var(--sp-2); justify-content: center; margin-top: var(--sp-6); flex-wrap: wrap; }
.forum-empty { color: var(--text-muted); justify-content: center; }
.forum-back { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin: 0 0 var(--sp-4); }
.forum-back a { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink); }
.forum-thread-page { padding-top: calc(var(--header-h) + var(--sp-8)); }
.forum-thread-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.forum-thread-title { flex-basis: 100%; margin: 0; font-size: var(--fs-h2); overflow-wrap: anywhere; }
.forum-post-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.forum-body { overflow-wrap: anywhere; line-height: 1.6; }
.forum-body p { margin: 0 0 var(--sp-3); }
.forum-body a { color: var(--accent-ink); }
.forum-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; flex-wrap: wrap; margin-top: var(--sp-2); }
.btn.is-danger { color: #FFB4B4; }
.forum-reply { display: grid; gap: var(--sp-3); margin-top: var(--sp-6); }
.forum-login-hint { color: var(--text-muted); margin-top: var(--sp-6); }

/* Autor con su rol de Discord */
.author { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text); text-decoration: none; min-width: 0; }
.author:hover .author-name { color: #F0ABFC; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); flex: none; }
.author-info { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.author-name { font-weight: 600; overflow-wrap: anywhere; }
.author--big .avatar { width: 96px; height: 96px; box-shadow: 0 0 0 3px rgb(168 85 247 / 0.5), 0 0 30px rgb(168 85 247 / 0.45); }
.author--big .author-info { flex-direction: column; align-items: flex-start; gap: 6px; }
.author--big .author-name { font: 700 1.6rem var(--font-title); }
.role-tag {
  --role: #A78BFA;
  font: 600 0.7rem/1.4 var(--font-title); text-transform: uppercase; letter-spacing: 0.05em;
  padding: 1px 7px; border-radius: 5px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
}
.role-tag.has-color { color: var(--role); border-color: color-mix(in srgb, var(--role) 55%, transparent); background: color-mix(in srgb, var(--role) 14%, transparent); }

/* Perfil */
.profile { display: grid; gap: var(--sp-6); }
.profile-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-6); flex-wrap: wrap; }
.profile-stats { display: grid; gap: 4px; color: var(--text-muted); text-align: right; }
.profile-sub { font-size: 1.1rem; margin: 0 0 var(--sp-3); color: #F5D0FE; }
.profile-edit { display: grid; gap: var(--sp-3); margin-top: var(--sp-3); }
.profile-count { color: var(--text-muted); font-size: 0.85rem; margin-right: auto; }
.profile-threads ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.profile-threads li { display: flex; justify-content: space-between; gap: var(--sp-3); border-bottom: 1px solid var(--border); padding-bottom: var(--sp-2); }
.profile-threads a { color: var(--text); }

@media (max-width: 720px) {
  .forum-row { flex-direction: column; align-items: stretch; padding: var(--sp-4); }
  .forum-row-stats { justify-items: start; text-align: left; grid-auto-flow: column; gap: 6px; align-items: baseline; }
  .forum-new-row { grid-template-columns: 1fr; }
  .forum-search { flex: 1 1 100%; }
  .forum-user { margin-left: 0; }
  .profile-stats { text-align: left; }
}

/* Portada: accesos a launcher, cosméticos y foro */
.promo-card { display: grid; gap: var(--sp-2); color: var(--text); text-decoration: none; transition: transform var(--dur-fast), border-color var(--dur-fast); }
.promo-card:hover { transform: translateY(-3px); border-color: rgb(232 121 249 / 0.5); }
.promo-card h3 { margin: 0; }

/* ==========================================================
   Kaos v2 — acabado profesional
   ========================================================== */

/* Fondo: aurora morada/magenta que se mueve muy despacio + rejilla tenue */
body::before, body::after {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
}
body::before {
  inset: -20vmax;
  background:
    radial-gradient(40vmax 30vmax at 20% 20%, rgb(124 58 237 / 0.22), transparent 70%),
    radial-gradient(35vmax 28vmax at 80% 10%, rgb(217 70 239 / 0.14), transparent 70%),
    radial-gradient(45vmax 35vmax at 60% 90%, rgb(79 70 229 / 0.14), transparent 70%);
  filter: blur(10px);
  animation: kaos-aurora 28s ease-in-out infinite alternate;
}
body::after {
  inset: 0;
  background-image:
    linear-gradient(rgb(167 139 250 / 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgb(167 139 250 / 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}
@keyframes kaos-aurora {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50% { transform: translate3d(-4vmax, 3vmax, 0) rotate(8deg); }
  100% { transform: translate3d(3vmax, -2vmax, 0) rotate(-6deg); }
}
html { scroll-behavior: smooth; }

/* Tipografía: títulos con degradado (sin brillo borroso) */
h1 { text-shadow: none; }
.page-hero h1, .forum-thread-title, .section-title, .dl-version, .author--big .author-name {
  background: linear-gradient(180deg, #FFFFFF 10%, #E9D5FF 60%, #F0ABFC 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page-hero h1 { letter-spacing: -0.01em; }
.pixel-label {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 10px; border-radius: 999px;
  background: rgb(168 85 247 / 0.12); border: 1px solid rgb(168 85 247 / 0.32); color: #F0ABFC;
}
.pixel-label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #E879F9; box-shadow: 0 0 10px #E879F9; }

/* Cabecera de cristal, una sola línea; menú lateral cuando no cabe */
.bar {
  max-width: 1200px; height: 60px;
  background: rgb(18 13 36 / 0.62);
  border: 1px solid rgb(168 85 247 / 0.22);
  box-shadow: 0 10px 40px rgb(0 0 0 / 0.35), inset 0 1px 0 rgb(255 255 255 / 0.04);
  backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  transition: height var(--dur) ease, background-color var(--dur) ease;
}
.is-scrolled .bar { height: 54px; background: rgb(14 10 28 / 0.82); }
.site-header:not(.site-header--home) { background: none; border: 0; }
.nav-link { white-space: nowrap; padding: 0 10px; font-size: 0.9rem; min-height: 36px; }
.nav-link[aria-current="page"] { background: rgb(168 85 247 / 0.16); color: #fff; box-shadow: inset 0 0 0 1px rgb(168 85 247 / 0.35); }
.main-nav ul { gap: 2px; }
@media (min-width: 860px) and (max-width: 1199px) {
  .main-nav { display: none; }
  .menu-toggle { display: inline-flex; }
}
@media (max-width: 1399px) { .bar-discord .bar-label, .bar-discord .bar-arrow { display: none; } }

/* Paneles y tarjetas: brillo que sigue al ratón + borde en degradado al pasar */
.kaos-panel, .feature, .cos-card, .forum-row, .card { position: relative; isolation: isolate; }
.kaos-panel::before, .feature::before, .cos-card::before, .forum-row::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, -20%), rgb(168 85 247 / 0.14), transparent 60%);
  opacity: 0; transition: opacity 300ms ease;
}
.kaos-panel:hover::before, .feature:hover::before, .cos-card:hover::before, .forum-row:hover::before { opacity: 1; }
.feature, .forum-row, .promo-card { transition: transform 250ms cubic-bezier(0.2, 0.8, 0.2, 1), border-color 250ms ease, box-shadow 250ms ease; }
.feature:hover, .forum-row:hover { border-color: rgb(192 132 252 / 0.5); box-shadow: 0 0 0 1px rgb(192 132 252 / 0.18), 0 18px 40px rgb(0 0 0 / 0.45); }
.feature h3 { font-size: 1.1rem; }

/* Botón principal con barrido de luz */
.btn--primary { position: relative; overflow: hidden; }
.btn--primary::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(110deg, transparent 30%, rgb(255 255 255 / 0.35) 50%, transparent 70%);
  transition: transform 700ms ease;
}
.btn--primary:hover::after { transform: translateX(120%); }

/* Aparición al hacer scroll (kaos-fx.js) */
.fx .fx-reveal { opacity: 0; transform: translate3d(0, 18px, 0); transition: opacity 600ms ease var(--fx-delay, 0ms), transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1) var(--fx-delay, 0ms); }
.fx .fx-reveal.fx-in { opacity: 1; transform: none; }

/* Cosméticos: estados que ocupan todo el ancho y esqueleto de carga */
.cos-grid > .cos-empty { grid-column: 1 / -1; padding: var(--sp-8) var(--sp-6); text-align: center; border: 1px dashed var(--border); border-radius: var(--r-card); background: rgb(255 255 255 / 0.02); }
.cos-preview { background: linear-gradient(180deg, rgb(168 85 247 / 0.08), transparent 40%), var(--surface); }
.cos-canvas-wrap { box-shadow: inset 0 0 60px rgb(0 0 0 / 0.5); }
.cos-card { background: linear-gradient(180deg, rgb(255 255 255 / 0.03), transparent), var(--surface); }
.cos-tabs .chip { padding-inline: 18px; }

/* Pie más limpio */
.site-footer { border-top: 1px solid rgb(168 85 247 / 0.18); background: linear-gradient(180deg, transparent, rgb(124 58 237 / 0.06)); }
.footer-col h2 { font: 700 0.78rem/1.2 var(--font-title); letter-spacing: 0.12em; color: #D8B4FE; margin-bottom: var(--sp-2); }
.footer-brand .logo img { height: 40px; filter: drop-shadow(0 0 12px rgb(168 85 247 / 0.5)); }

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  .btn--primary::after { display: none; }
  .fx .fx-reveal { opacity: 1; transform: none; }
}
