/* El gran mosaico: franja en movimiento en el inicio y mural completo. Siempre de noche, como el hero. */

.mosaic-home { display: grid; gap: 14px; min-width: 0; }
.mosaic-home__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; }
.mosaic-home__title { display: grid; gap: 2px; min-width: 0; }
.mosaic-home__title h2 { font: 800 clamp(24px, 6vw, 30px)/1.1 var(--font-display); }

/* ---------- Franja ---------- */

.mosaic-band {
  position: relative; overflow: hidden; isolation: isolate;
  margin-inline: calc(-1 * var(--gutter));
  padding-block: 30px 84px;
  color: #f3eee5;
  background:
    radial-gradient(70% 55% at 50% 108%, rgba(232, 184, 101, .28), transparent 70%),
    radial-gradient(55% 45% at 0% 0%, rgba(63, 169, 184, .14), transparent 70%),
    radial-gradient(50% 40% at 100% 10%, rgba(224, 119, 95, .10), transparent 70%),
    linear-gradient(180deg, #0d0f13 0%, #07080a 100%);
}
.mosaic-band::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image:
    radial-gradient(1px 1px at 8% 30%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 82%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 51% 12%, #fff9 50%, transparent 51%),
    radial-gradient(1px 1px at 73% 64%, #fff5 50%, transparent 51%),
    radial-gradient(1px 1px at 91% 22%, #fff7 50%, transparent 51%);
}
/* Bordes que se funden con la noche */
.mosaic-band::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(90deg, #07080a 0%, transparent 14%, transparent 86%, #07080a 100%),
    linear-gradient(180deg, #0d0f13 0%, transparent 16%, transparent 62%, #07080a 100%);
}
@media (min-width: 700px) {
  .mosaic-band { margin-inline: 0; border-radius: 26px; padding-block: 44px 96px; }
}

.mosaic-tilt { display: grid; gap: 12px; transform: rotate(-6deg) scale(1.14); transform-origin: 50% 50%; }
.mrow { min-width: 0; }
.mrow--1 { margin-left: -46px; }
.mrow--2 { margin-left: -18px; }
.mrow--3 { margin-left: -70px; }
@media (max-width: 699px) { .mrow--3 { display: none; } }

.mtrack {
  display: flex; gap: 12px; width: max-content; padding-right: 12px;   /* el hueco final hace que -50% cuadre exacto */
  animation: mosaic-scroll var(--dur, 140s) linear infinite;
}
.mtrack--rev { animation-direction: reverse; }
.mtrack--still { animation: none; }
.mrow:hover .mtrack { animation-play-state: paused; }
@keyframes mosaic-scroll { to { transform: translateX(-50%); } }

/* ---------- Pieza ---------- */

.mtile, .mt {
  position: relative; display: block; padding: 0; border: 0; overflow: hidden; cursor: pointer;
  background: #1a1d22; color: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .06);
  transition: transform .4s cubic-bezier(.2, .8, .2, 1), box-shadow .4s, opacity .4s, filter .4s;
}
.mtile { flex: none; width: 70px; aspect-ratio: 2 / 3; border-radius: 11px; }
@media (min-width: 700px) { .mtile { width: 92px; border-radius: 13px; } }
@media (min-width: 1200px) { .mtile { width: 100px; } }

.mtile > img[data-fade], .mt > img[data-fade] { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s; }
.mtile > img.is-in, .mt > img.is-in { opacity: 1; }
/* Hilo de color del coleccionista */
.mtile::after, .mt::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--oc); opacity: .85; }
.mtile__shade { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(5, 6, 8, .9)); opacity: 0; transition: opacity .3s; }
.mtile__name {
  position: absolute; left: 8px; right: 8px; bottom: 9px; text-align: left;
  font: 700 12.5px/1.2 var(--font-display); color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .7);
  opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mtile__owner {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; object-fit: cover; background: #222;
  box-shadow: 0 0 0 2px var(--oc), 0 2px 6px rgba(0, 0, 0, .5);
}
.mtile__paper {
  display: grid; place-items: center; width: 100%; height: 100%; padding: 8px; text-align: center;
  background: radial-gradient(90% 70% at 50% 0%, rgba(232, 184, 101, .18), transparent 70%), linear-gradient(160deg, #262119, #121110);
  color: #e8b865; font: 700 12px/1.25 var(--font-display); overflow-wrap: anywhere;
}
.mtile--ghost, .mt--ghost {
  cursor: default; box-shadow: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .1), rgba(255, 255, 255, .04));
  background-size: 200% 100%; animation: mosaic-shimmer 1.4s ease-in-out infinite;
}
@keyframes mosaic-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

@media (hover: hover) {
  .mtile:hover { z-index: 3; transform: translateY(-8px) scale(1.16); box-shadow: 0 20px 44px rgba(0, 0, 0, .6), 0 0 0 2px var(--oc), 0 0 34px color-mix(in srgb, var(--oc) 45%, transparent); }
  .mtile:hover .mtile__shade, .mt:hover .mtile__shade { opacity: 1; }
  .mtile:hover .mtile__name, .mt:hover .mtile__name { opacity: 1; transform: none; }
}
.mtile:focus-visible, .mt:focus-visible { outline: 2px solid var(--oc); outline-offset: 3px; }

/* Botón flotante */
.mosaic-cta {
  position: absolute; left: 50%; bottom: 20px; z-index: 4; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px);
  padding: 6px 6px 6px 16px; border-radius: 999px; white-space: nowrap; font-size: 13px; color: #f3eee5;
  background: rgba(12, 14, 18, .64); border: 1px solid rgba(232, 184, 101, .35);
  -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
}
.mosaic-cta b { font: 700 16px/1 var(--font-display); color: #e8b865; font-variant-numeric: tabular-nums; }
.mosaic-cta__go { display: inline-flex; align-items: center; gap: 2px; height: 34px; padding: 0 10px 0 14px; border-radius: 999px; background: #e8b865; color: #17120a; font-weight: 700; transition: filter .15s; }
.mosaic-cta__go svg { width: 16px; height: 16px; }
.mosaic-cta:hover .mosaic-cta__go { filter: brightness(1.08); }
@media (max-width: 380px) { .mosaic-cta > span:first-child { display: none; } }

.mosaic-empty { position: relative; z-index: 3; padding: 48px 16px; text-align: center; color: #a9a49b; }

/* ---------- Mural completo ---------- */

.mural-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; }
.mural-head h1 { margin: 4px 0 6px; font: 800 clamp(30px, 8vw, 44px)/1.05 var(--font-display); }
.mural-tools { display: grid; gap: 10px; min-width: 0; }
.mural-owner img { width: 22px; height: 22px; border-radius: 50%; box-shadow: 0 0 0 2px var(--oc); }
.mural-owner.is-on { border-color: var(--oc); background: color-mix(in srgb, var(--oc) 16%, var(--surface)); color: var(--text); }

.mural {
  position: relative; isolation: isolate; min-height: 50vh;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); grid-auto-rows: 34px; grid-auto-flow: dense;
  gap: 12px 10px; padding: 28px 18px 40px; margin-inline: calc(-1 * var(--gutter));
  background:
    radial-gradient(60% 30% at 50% 0%, rgba(232, 184, 101, .16), transparent 70%),
    radial-gradient(50% 30% at 0% 100%, rgba(63, 169, 184, .12), transparent 70%),
    linear-gradient(180deg, #0d0f13, #07080a);
}
.mural::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .45; pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 10% 8%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 64% 3%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 88% 14%, #fff9 50%, transparent 51%);
  background-size: 100% 900px;
}
@media (min-width: 700px) {
  .mural { margin-inline: 0; border-radius: 26px; padding: 40px 36px 48px; gap: 16px 14px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); grid-auto-rows: 46px; }
}
.mt { grid-row: span 3; border-radius: 10px; transform: translateY(var(--y, 0px)) rotate(var(--r, 0deg)); content-visibility: auto; contain-intrinsic-size: auto 150px; }
.mt--big { grid-column: span 2; grid-row: span 6; border-radius: 16px; }
.mt--big .mtile__owner { width: 28px; height: 28px; top: 8px; right: 8px; }
.mt--big .mtile__name { font-size: 15px; opacity: 1; transform: none; }
.mt--big .mtile__shade { opacity: 1; }
.mt .mtile__owner { width: 18px; height: 18px; top: 5px; right: 5px; }
@media (hover: hover) {
  .mt:hover { z-index: 3; transform: translateY(var(--y, 0px)) rotate(0deg) scale(1.1); box-shadow: 0 18px 40px rgba(0, 0, 0, .6), 0 0 0 2px var(--oc), 0 0 28px color-mix(in srgb, var(--oc) 40%, transparent); }
}
.mural.is-filter .mt:not(.is-hit) { opacity: .1; filter: grayscale(1); transform: translateY(var(--y, 0px)) rotate(var(--r, 0deg)) scale(.9); }
.mural.is-filter .mt.is-hit { order: -1; z-index: 2; box-shadow: 0 0 0 2px var(--oc), 0 0 26px color-mix(in srgb, var(--oc) 45%, transparent); }

/* ---------- Ficha rápida ---------- */

.mosaic-sheet { display: grid; gap: 18px; }
@media (min-width: 560px) { .mosaic-sheet { grid-template-columns: 180px minmax(0, 1fr); align-items: start; } }
.mosaic-sheet__art {
  width: 100%; max-width: 190px; margin-inline: auto; aspect-ratio: 2 / 3; border-radius: 16px; overflow: hidden; background: var(--stage);
  box-shadow: 0 0 0 2px var(--oc), 0 20px 50px rgba(0, 0, 0, .35);
}
.mosaic-sheet__art img { width: 100%; height: 100%; object-fit: cover; }
.mosaic-sheet__text { display: grid; gap: 8px; align-content: start; justify-items: start; min-width: 0; }
.mosaic-sheet__text h2 { font: 800 26px/1.15 var(--font-display); overflow-wrap: anywhere; }
.mosaic-sheet__owner { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px; background: var(--raised); border-left: 3px solid var(--oc); }

@media (prefers-reduced-motion: reduce) {
  .mtrack { animation: none; }
  .mrow { overflow-x: auto; scrollbar-width: none; }
  .mtile, .mt { transition: none; }
}

@media (max-width: 699px) {
  .mtile__owner { width: 17px; height: 17px; top: 4px; right: 4px; box-shadow: 0 0 0 1.5px var(--oc), 0 2px 6px rgba(0, 0, 0, .5); }
  .mt .mtile__owner { width: 15px; height: 15px; }
  .mtile::after, .mt::after { height: 2px; }
}
