/* ============ Arcadia ============ */
:root {
  --bg: #F3EEE5;
  --bg-glow: #FBF6EC;
  --surface: #FFFCF7;
  --chip: #EAE3D6;
  --ink: #1F1C2C;
  --ink-soft: #5E586E;
  --line: rgba(31, 28, 44, .1);
  --shadow: 0 1px 0 rgba(31, 28, 44, .05), 0 14px 32px -16px rgba(31, 28, 44, .28);
  --shadow-up: 0 1px 0 rgba(31, 28, 44, .05), 0 24px 44px -18px rgba(31, 28, 44, .36);
  --arc-1: #E2643F;
  --arc-2: #EDA93A;
  --arc-3: #7BAE84;
  --arc-4: #6FA8D8;
  --live: #1E8A55;
  --live-bg: #DDF3E5;
  --focus: #2F6FED;
  --hl-alpha: .55;
  --radius: 26px;
  --display: 'Bricolage Grotesque', ui-rounded, system-ui, sans-serif;
  --body: 'Figtree', system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15131D;
    --bg-glow: #1E1B2A;
    --surface: #211E2D;
    --chip: #2E2A3D;
    --ink: #F4EFE6;
    --ink-soft: #B4AEC2;
    --line: rgba(244, 239, 230, .1);
    --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 16px 34px -18px rgba(0, 0, 0, .7);
    --shadow-up: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 26px 46px -18px rgba(0, 0, 0, .8);
    --live: #7FE0A8;
    --live-bg: #1D3A2B;
    --focus: #8DB3FF;
    --hl-alpha: .9;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15131D;
  --bg-glow: #1E1B2A;
  --surface: #211E2D;
  --chip: #2E2A3D;
  --ink: #F4EFE6;
  --ink-soft: #B4AEC2;
  --line: rgba(244, 239, 230, .1);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 16px 34px -18px rgba(0, 0, 0, .7);
  --shadow-up: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 26px 46px -18px rgba(0, 0, 0, .8);
  --live: #7FE0A8;
  --live-bg: #1D3A2B;
  --focus: #8DB3FF;
  --hl-alpha: .9;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(60rem 30rem at 85% -8rem, var(--bg-glow), transparent 70%),
    var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.wrap {
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right));
}
@media (min-width: 720px) { .wrap { padding-inline: 32px; } }

/* ---------- barra superior ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: max(18px, env(safe-area-inset-top));
  padding-bottom: 8px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -.02em;
  border-radius: 12px;
}
.mark { width: 36px; height: 36px; flex: none; }
.mark path { fill: none; stroke-width: 5; stroke-linecap: round; }

.theme {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  transition: transform .2s ease;
}
.theme:hover { transform: rotate(-12deg); }
.theme svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme .i-moon { fill: currentColor; stroke: none; }
.theme .i-sun { display: none; }
.theme[aria-pressed="true"] .i-moon { display: none; }
.theme[aria-pressed="true"] .i-sun { display: block; }

/* ---------- portada ---------- */
.hero {
  display: grid;
  gap: 24px;
  align-items: end;
  padding-top: clamp(20px, 5vw, 56px);
  padding-bottom: clamp(24px, 4vw, 40px);
}
@media (min-width: 860px) {
  .hero { grid-template-columns: 1fr 340px; }
}
.eyebrow {
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.hero h1 {
  margin-top: 10px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.7rem, 9vw, 5.6rem);
  line-height: .95;
  letter-spacing: -.035em;
  isolation: isolate;
}
.hl {
  position: relative;
  white-space: nowrap;
}
.hl::after {
  content: "";
  position: absolute;
  left: -.04em;
  right: -.04em;
  bottom: .02em;
  height: .2em;
  border-radius: 99px;
  background: var(--arc-2);
  opacity: var(--hl-alpha);
  z-index: -1;
  transform-origin: left;
  animation: swipe .7s .35s cubic-bezier(.2, .8, .2, 1) both;
}
.lede {
  margin-top: 16px;
  max-width: 34rem;
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
  color: var(--ink-soft);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}
.filters button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.filters button:hover { transform: translateY(-1px); }
.filters button span {
  min-width: 22px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--chip);
  font-size: .78rem;
  line-height: 22px;
  text-align: center;
}
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filters button[aria-pressed="true"] span { background: rgba(127, 127, 127, .28); }

.stacker { display: none; width: 100%; height: auto; overflow: visible; }
@media (min-width: 860px) { .stacker { display: block; } }
.stacker path { fill: none; stroke-width: 28; animation: stack .8s cubic-bezier(.2, .9, .25, 1.2) both; animation-delay: calc(var(--d) * 110ms + 150ms); }
.stacker circle { fill: var(--ink); animation: drop .7s cubic-bezier(.3, 1.4, .5, 1) both; animation-delay: 650ms; }

/* ---------- estantes ---------- */
.shelf { padding-top: clamp(24px, 4vw, 40px); }
.shelf[hidden] { display: none; }
.shelf-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.shelf-head h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: -.025em;
  line-height: 1.1;
}
.shelf-head p { margin-top: 4px; color: var(--ink-soft); font-weight: 500; }
.more {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 10px;
}
.more svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.more:hover svg { transform: translateX(3px); }

.grid { display: grid; gap: 18px; }
.grid-learn { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-ball { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 960px) { .grid-learn { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid-ball { grid-template-columns: 1fr; } }
.grid-solo { grid-template-columns: 1fr; }
.grid > li { display: flex; animation: rise .6s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 55ms + 200ms); }

/* ---------- tarjetas ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s ease;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-up); }
.card:active { transform: translateY(-1px) scale(.99); }

.frame { position: relative; }
.art {
  overflow: hidden;
  aspect-ratio: 16 / 10;
  /* arco arriba, como la ventana de un fichín */
  border-radius: 50% 50% 18px 18px / 30% 30% 18px 18px;
  isolation: isolate;
}
.card-wide .art { aspect-ratio: 16 / 9; border-radius: 50% 50% 18px 18px / 26% 26% 18px 18px; }
.art svg {
  display: block;
  width: 100%;
  height: 100%;
  transition: transform .5s cubic-bezier(.2, .8, .2, 1);
}
.art img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.card:hover .art svg, .card:hover .art img { transform: scale(1.04); }
.sy { font-family: 'Baloo 2', var(--display); font-weight: 800; text-anchor: middle; }
.bs { font-family: 'Big Shoulders Display', var(--display); font-weight: 900; text-anchor: middle; }

.play {
  position: absolute;
  right: 12px;
  bottom: -20px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--surface);
  box-shadow: 0 0 0 5px var(--surface);
  transition: transform .3s cubic-bezier(.3, 1.4, .5, 1);
}
.play svg { width: 20px; height: 20px; fill: currentColor; margin-left: 2px; }
.card:hover .play { transform: scale(1.12) rotate(-8deg); }

.body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  padding: 16px 64px 6px 8px;
}
.body h3 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.22rem;
  line-height: 1.12;
  letter-spacing: -.015em;
}
.card-wide .body h3 { font-size: clamp(1.3rem, 2.4vw, 1.55rem); }
.body p { color: var(--ink-soft); font-size: .95rem; line-height: 1.4; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.tag, .prog {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 600;
}
.tag { background: var(--chip); }
.prog { background: var(--live-bg); color: var(--live); }
.prog[hidden] { display: none; }
.prog::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.prog.is-live::before { animation: pulse 1.6s ease-in-out infinite; }

/* Tarjeta única de su estante: en pantallas anchas, imagen y texto lado a lado */
@media (min-width: 720px) {
  .card-feature { flex-direction: row; align-items: stretch; gap: 8px; }
  .card-feature .frame { flex: 1.35; }
  .card-feature .body { flex: 1; justify-content: center; padding: 18px 22px 14px 18px; }
  .card-feature .body h3 { font-size: clamp(1.5rem, 2.8vw, 2rem); }
  .card-feature .body p { font-size: 1rem; }
  .card-feature .meta { margin-top: 10px; }
  .card-feature .play { bottom: 14px; right: 14px; }
}

/* Celulares: dos columnas de juegos para chicos, todo un poco más compacto */
@media (max-width: 560px) {
  /* los filtros quedan en una sola fila; si no entran, se deslizan */
  .filters { flex-wrap: nowrap; gap: 6px; overflow-x: auto; margin-inline: -16px; padding-inline: 16px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filters button { flex: none; padding: 0 12px; gap: 6px; font-size: .94rem; }
  .grid { gap: 12px; }
  .card { padding: 7px; border-radius: 22px; }
  .play { width: 38px; height: 38px; right: 8px; bottom: -16px; box-shadow: 0 0 0 4px var(--surface); }
  .play svg { width: 16px; height: 16px; }
  .grid-learn .body { padding: 14px 6px 4px; }
  .grid-learn .body h3 { font-size: 1.02rem; padding-right: 26px; }
  .grid-learn .body p { font-size: .85rem; }
  .grid-learn .tag { display: none; }
  .grid-learn .meta { padding-top: 2px; }
  .grid-learn .meta:not(:has(.prog:not([hidden]))) { display: none; }
  .card-wide .body { padding-right: 8px; }
  .card-wide .body h3 { padding-right: 40px; }
}

/* ---------- pie ---------- */
.foot {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: clamp(48px, 8vw, 88px);
  padding-top: 28px;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--ink-soft);
  font-size: .92rem;
}
.foot strong { color: var(--ink); }
.foot .mark { width: 30px; height: 30px; }
.fine { font-size: .8rem; max-width: 36rem; }

/* ---------- movimiento ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes swipe { from { transform: scaleX(0); } }
@keyframes stack { from { opacity: 0; transform: translateY(-46px); } }
@keyframes drop { from { opacity: 0; transform: translateY(-120px); } }
@keyframes pulse { 50% { opacity: .35; } }
.stacker path, .stacker circle { transform-box: fill-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
