/* BM-559 - Skin Showcase stylesheet, loaded by BOTH hosts (website <link>, client Vite import).
 *
 * Every rule is scoped to a .bm-skin-* class the renderer emits, so the file is inert until the
 * renderer mounts. Colour comes from the host: --panel / --panel-2 / --border / --accent / --muted /
 * --text are read, never redefined, so the module takes on each surface's theme unchanged. Sizing
 * is intrinsic (aspect-ratio, rem, auto-fill grids) - no pixel min-height on a panel (BM-503).
 */

.bm-skin-showcase {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

/* --- stage: large view + info ----------------------------------------- */

.bm-skin-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}

@media (max-width: 820px) {
  .bm-skin-stage { grid-template-columns: minmax(0, 1fr); }
}

.bm-skin-stage-view {
  position: relative;
  aspect-ratio: 4 / 3;
  max-height: 28rem;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background:
    radial-gradient(ellipse at 50% 38%, rgba(255, 255, 255, 0.07), transparent 65%),
    var(--panel-2, rgba(255, 255, 255, 0.03));
  overflow: hidden;
  display: grid;
  place-items: center;
}

.bm-skin-stage-poster {
  position: absolute;
  inset: 4%;
  width: 92%;
  height: 92%;
  object-fit: contain;
}

.bm-skin-stage-view.is-loading .bm-skin-stage-poster { opacity: 0.55; }

.bm-skin-3d-btn {
  position: absolute;
  bottom: 0.8rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--accent, #e8712c);
  background: rgba(0, 0, 0, 0.45);
  color: var(--text, #fff);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.bm-skin-3d-btn:hover,
.bm-skin-3d-btn:focus-visible { background: var(--accent, #e8712c); }

.bm-skin-mv {
  width: 100%;
  height: 100%;
  --poster-color: transparent;
  background: transparent;
}

.bm-skin-stage-info {
  display: grid;
  align-content: start;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.25rem 0;
}

.bm-skin-stage-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.bm-skin-stage-head h3 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--text, #fff);
}

.bm-skin-stage-item {
  color: var(--muted, #9aa3b5);
  font-size: 0.9rem;
}

/* --- unlock requirement / progress ------------------------------------ */

.bm-skin-unlock {
  display: grid;
  gap: 0.4rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: var(--panel, rgba(255, 255, 255, 0.03));
}

.bm-skin-unlock.is-unlocked { border-color: rgba(92, 196, 120, 0.45); }

.bm-skin-req {
  color: var(--text, #fff);
  font-size: 0.92rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
}

.bm-skin-req-title { font-weight: 700; color: var(--accent, #e8712c); }
.bm-skin-req-title.bm-skin-tier-bronze { color: #d08a4f; }
.bm-skin-req-title.bm-skin-tier-silver { color: #c9d1dc; }
.bm-skin-req-title.bm-skin-tier-gold { color: #f1c24b; }

.bm-skin-req-tier,
.bm-skin-req-track {
  color: var(--muted, #9aa3b5);
  font-size: 0.8rem;
}

.bm-skin-req-track::before { content: "\00B7\00a0"; }

.bm-skin-req-text {
  color: var(--muted, #9aa3b5);
  font-size: 0.82rem;
}

.bm-skin-progress {
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bm-skin-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent, #e8712c);
}

/* --- link-Steam prompt (signed in, no Steam linked) ------------------- */

.bm-skin-link-steam {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--accent, #e8712c);
  background: rgba(232, 113, 44, 0.08);
  color: var(--text, #fff);
  font-size: 0.92rem;
}

.bm-skin-link-steam-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: var(--accent, #e8712c);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.bm-skin-link-steam-btn:hover,
.bm-skin-link-steam-btn:focus-visible { filter: brightness(1.1); }

.bm-skin-unlock.is-signed-out .bm-skin-req-text { font-size: 0.9rem; }

/* --- badges ------------------------------------------------------------ */

.bm-skin-badge {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.bm-skin-badge.is-unlocked { background: rgba(92, 196, 120, 0.18); color: #7fdc97; }
.bm-skin-badge.is-locked { background: rgba(255, 255, 255, 0.08); color: var(--muted, #9aa3b5); }

/* --- gallery ----------------------------------------------------------- */

.bm-skin-gallery-head { color: var(--muted, #9aa3b5); font-size: 0.9rem; }
.bm-skin-gallery-head strong { color: var(--text, #fff); }

.bm-skin-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.7rem;
}

.bm-skin-card {
  display: grid;
  gap: 0.2rem;
  padding: 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: var(--panel, rgba(255, 255, 255, 0.03));
  color: var(--text, #fff);
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}

.bm-skin-card:hover { border-color: rgba(255, 255, 255, 0.22); }
.bm-skin-card:focus-visible { outline: 2px solid var(--accent, #e8712c); outline-offset: 2px; }
.bm-skin-card.is-selected { border-color: var(--accent, #e8712c); }

.bm-skin-card-art {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  border-radius: 8px;
  background: var(--panel-2, rgba(255, 255, 255, 0.04));
  overflow: hidden;
}

/* Pinned inside the square box: a percentage height on an in-flow child of an aspect-ratio box
   doesn't resolve, so tall posters used to spill out at their natural size. */
.bm-skin-card-art img {
  position: absolute;
  inset: 6%;
  width: 88%;
  height: 88%;
  object-fit: contain;
}
.bm-skin-card.is-locked .bm-skin-card-art img { filter: grayscale(0.85) brightness(0.7); }

.bm-skin-card-art .bm-skin-badge {
  position: absolute;
  z-index: 1;
  top: 0.35rem;
  left: 0.35rem;
}

.bm-skin-card-name {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bm-skin-card-item { color: var(--muted, #9aa3b5); font-size: 0.76rem; }

.bm-skin-empty,
.bm-skin-summary { color: var(--muted, #9aa3b5); }

/* --- home-page carousel ------------------------------------------------ */

.bm-skin-carousel {
  display: grid;
  gap: 0.6rem;
  justify-items: center;
}

.bm-skin-carousel-view {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 22rem;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 255, 255, 0.07), transparent 65%);
  overflow: hidden;
}

.bm-skin-carousel-view { position: relative; }
.bm-skin-carousel-view img { position: absolute; inset: 5% 10%; width: 80%; height: 90%; object-fit: contain; }
.bm-skin-carousel-view model-viewer { width: 100%; height: 100%; --poster-color: transparent; }

.bm-skin-carousel-caption {
  display: grid;
  justify-items: center;
  gap: 0.15rem;
  text-align: center;
}

.bm-skin-carousel-name { font-weight: 700; color: var(--text, #fff); }
.bm-skin-carousel-req { color: var(--muted, #9aa3b5); font-size: 0.85rem; }

.bm-skin-carousel-dots { display: flex; gap: 0.4rem; }

.bm-skin-carousel-dots button {
  width: 0.55rem;
  height: 0.55rem;
  padding: 0;
  border-radius: 999px;
  border: 0;
  background: rgba(255, 255, 255, 0.22);
  cursor: pointer;
}

.bm-skin-carousel-dots button.is-active { background: var(--accent, #e8712c); }

.bm-skin-carousel-link {
  color: var(--accent, #e8712c);
  font-weight: 600;
  text-decoration: none;
}

.bm-skin-carousel-link:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  .bm-skin-carousel-view img { transition: none; }
}

/* --- website home-page host (index.html #skins) ----------------------- */

.home-skins-cta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

.home-skins-cta-note { color: var(--accent, #e8712c); font-weight: 700; }

/* The sign-up hook is for visitors without an account (authBootstrap sets data-auth-state). */
html[data-auth-state="authenticated"] .home-skins-cta { display: none; }

/* Unlock requirements are for signed-in players only (owner, BM-559): the home carousel shows just
   the skin name to everyone else. Pure CSS, so it follows authBootstrap's data-auth-state without
   a flash or a script check. */
html:not([data-auth-state="authenticated"]) .home-skins-window .bm-skin-carousel-req { display: none; }

.home-skins-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 1.5rem;
  align-items: center;
}

@media (max-width: 820px) {
  .home-skins-grid { grid-template-columns: minmax(0, 1fr); }
}

.home-skins-copy h2 { margin: 0.2rem 0 0.6rem; }
.home-skins-window { min-width: 0; }
