/* Portal45 scalable shop library styles.
   This file supports the live shop.html and the retained shop-library-dev.html
   development copy. */

:root {
  --shop-bg: #050508;
  --shop-panel: rgba(13, 16, 24, 0.9);
  --shop-panel-strong: rgba(18, 22, 34, 0.96);
  --shop-line: rgba(240, 237, 230, 0.11);
  --shop-line-hot: rgba(0, 217, 255, 0.42);
  --shop-text: #f0ede6;
  --shop-muted: #8a8a8a;
  --shop-cyan: #00d9ff;
  --shop-red: #cc1100;
  --shop-violet: #6b2dbd;
  --shop-green: #31c48d;
}

body.shop-library-page {
  background:
    radial-gradient(circle at 20% 0%, rgba(107, 45, 189, 0.18), transparent 28rem),
    radial-gradient(circle at 80% 10%, rgba(0, 217, 255, 0.08), transparent 34rem),
    var(--shop-bg);
}

.library-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 7.5rem clamp(1rem, 3vw, 2rem) 5rem;
}

.library-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem;
  align-items: end;
  margin-bottom: 1.5rem;
}

.library-eyebrow,
.section-eyebrow,
.card-series {
  font-family: "Orbitron", monospace;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.library-eyebrow,
.section-eyebrow {
  color: var(--shop-cyan);
  margin-bottom: 0.6rem;
}

.library-hero h1 {
  margin: 0;
  font-family: "Orbitron", monospace;
  font-size: clamp(2.1rem, 6vw, 5.6rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 0.95;
}

.library-hero h1 span {
  color: var(--shop-red);
}

.library-copy {
  max-width: 760px;
  color: var(--shop-muted);
  font-size: clamp(0.95rem, 1.6vw, 1.08rem);
  line-height: 1.8;
  margin: 1rem 0 0;
}

.library-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(5rem, 1fr));
  gap: 0.75rem;
  min-width: 280px;
}

.library-stat {
  border: 1px solid var(--shop-line);
  background: rgba(255, 255, 255, 0.035);
  padding: 1rem;
}

.library-stat strong {
  display: block;
  font-family: "Orbitron", monospace;
  color: var(--shop-text);
  font-size: 1.2rem;
}

.library-stat span {
  color: var(--shop-muted);
  font-size: 0.78rem;
}

.library-tools {
  position: sticky;
  top: 72px;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(180px, 0.55fr);
  gap: 0.85rem;
  margin: 2rem 0;
  padding: 0.85rem;
  border: 1px solid var(--shop-line);
  background: rgba(5, 5, 8, 0.92);
  backdrop-filter: blur(18px);
}

.search-wrap,
.select-wrap {
  display: grid;
  gap: 0.38rem;
}

.library-tools label {
  font-family: "Orbitron", monospace;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--shop-muted);
  text-transform: uppercase;
}

.library-search,
.library-select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--shop-line);
  background: rgba(255, 255, 255, 0.055);
  color: var(--shop-text);
  padding: 0.75rem 0.9rem;
  font: inherit;
}

.library-search:focus,
.library-select:focus,
.filter-chip:focus-visible,
.filter-clear:focus-visible,
.card-action:focus-visible,
.quick-button:focus-visible,
.modal-close:focus-visible {
  outline: 2px solid var(--shop-cyan);
  outline-offset: 3px;
}

.filter-groups {
  display: grid;
  gap: 0.85rem;
  margin: 0 0 2rem;
}

.filter-group {
  display: grid;
  gap: 0.5rem;
}

.filter-label {
  font-family: "Orbitron", monospace;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--shop-muted);
  text-transform: uppercase;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.filter-chip,
.filter-clear {
  min-height: 38px;
  border: 1px solid var(--shop-line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--shop-muted);
  border-radius: 999px;
  padding: 0.6rem 0.95rem;
  font-family: "Orbitron", monospace;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.filter-clear {
  justify-self: start;
  border-color: rgba(204, 17, 0, 0.42);
  color: var(--shop-text);
}

.filter-chip.active,
.filter-chip:hover,
.filter-clear:hover {
  border-color: var(--shop-cyan);
  color: var(--shop-cyan);
  background: rgba(0, 217, 255, 0.08);
}

.claim-banner {
  display: none;
  margin: 0 0 1.5rem;
  border: 1px solid rgba(49, 196, 141, 0.34);
  background: rgba(49, 196, 141, 0.1);
  color: #d8fff0;
  padding: 1rem 1.2rem;
}

.free-claim-mode .claim-banner {
  display: block;
}

.library-section {
  margin-top: clamp(2.5rem, 5vw, 4.5rem);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.section-heading h2 {
  margin: 0;
  font-family: "Orbitron", monospace;
  font-size: clamp(1.2rem, 2.2vw, 2rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-count {
  color: var(--shop-muted);
  font-size: 0.85rem;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.catalog-shelf {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(210px, 250px);
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.8rem;
  scrollbar-color: var(--shop-cyan) rgba(255, 255, 255, 0.06);
}

.bundle-shelf {
  grid-auto-columns: minmax(240px, 320px);
}

.product-tile {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--shop-line);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
  overflow: hidden;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.product-tile:hover,
.product-tile:focus-within {
  z-index: 3;
  transform: translateY(-4px);
  border-color: var(--shop-line-hot);
  background: linear-gradient(180deg, rgba(0,217,255,0.075), rgba(255,255,255,0.02));
}

.product-tile.bundle {
  border-color: rgba(107, 45, 189, 0.46);
  background:
    linear-gradient(145deg, rgba(107,45,189,0.18), rgba(0,217,255,0.08)),
    rgba(255,255,255,0.025);
}

.product-tile.bundle:hover,
.product-tile.bundle:focus-within {
  transform: none;
}

.bundle-shelf .product-tile {
  min-width: 0;
}

.art-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #09090d;
  overflow: hidden;
}

.product-art {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 220ms ease, filter 220ms ease;
}

.product-tile:hover .product-art,
.product-tile:focus-within .product-art {
  transform: scale(1.04);
  filter: saturate(1.12);
}

.product-main {
  display: grid;
  gap: 0.55rem;
  padding: 0.95rem;
  flex: 1;
  background: rgba(5, 5, 8, 0.82);
}

.card-series {
  color: var(--shop-cyan);
  min-height: 1.8em;
}

.product-title {
  margin: 0;
  font-family: "Orbitron", monospace;
  font-size: 0.84rem;
  letter-spacing: 0.04em;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bundle .product-title {
  -webkit-line-clamp: 3;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
}

.product-price {
  font-family: "Orbitron", monospace;
  font-weight: 900;
  color: var(--shop-text);
  letter-spacing: 0.07em;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card-action,
.quick-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--shop-line);
  background: rgba(255,255,255,0.05);
  color: var(--shop-text);
  padding: 0.55rem 0.75rem;
  font-family: "Orbitron", monospace;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.buy-action {
  border-color: var(--shop-red);
  background: var(--shop-red);
}

.claim-action {
  border-color: var(--shop-green);
  background: var(--shop-green);
  color: #04100b;
}

.quick-action {
  color: var(--shop-cyan);
}

.quick-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  align-content: end;
  gap: 0.75rem;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(5,5,8,0.42), rgba(5,5,8,0.98) 34%);
  border: 1px solid var(--shop-line-hot);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.55);
  transform: translateY(100%);
  opacity: 0;
  transition: transform 180ms ease;
  pointer-events: none;
}

.product-tile:hover .quick-layer,
.product-tile:focus-within .quick-layer {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.quick-layer p {
  margin: 0;
  color: var(--shop-text);
  font-size: 0.8rem;
  line-height: 1.55;
}

.quick-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.quick-facts span {
  border: 1px solid var(--shop-line);
  color: var(--shop-muted);
  padding: 0.25rem 0.42rem;
  font-size: 0.68rem;
}

.empty-state {
  display: none;
  border: 1px solid var(--shop-line);
  color: var(--shop-muted);
  padding: 2rem;
  text-align: center;
}

.empty-state.visible {
  display: block;
}

.quick-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.74);
}

.quick-modal.open {
  display: flex;
}

.modal-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  border: 1px solid var(--shop-line-hot);
  background: var(--shop-panel-strong);
  box-shadow: 0 24px 80px rgba(0,0,0,0.55);
}

.modal-body {
  display: grid;
  grid-template-columns: minmax(180px, 0.44fr) minmax(0, 0.56fr);
  gap: 1.25rem;
  padding: 1.25rem;
}

.modal-body img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.modal-copy {
  display: grid;
  align-content: start;
  gap: 0.9rem;
}

.modal-copy h3 {
  margin: 0;
  font-family: "Orbitron", monospace;
  font-size: clamp(1.25rem, 3vw, 2rem);
}

.modal-copy p {
  margin: 0;
  color: var(--shop-muted);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 42px;
  height: 42px;
  border: 1px solid var(--shop-line);
  background: rgba(0,0,0,0.55);
  color: var(--shop-text);
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 2;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (hover: none) {
  .quick-layer {
    display: none;
  }
}

@media (max-width: 980px) {
  .library-hero {
    grid-template-columns: 1fr;
  }

  .library-stats {
    min-width: 0;
  }

  .library-tools {
    grid-template-columns: 1fr;
    position: static;
  }

}

@media (min-width: 720px) {
  .catalog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 980px) {
  .catalog-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .catalog-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 1560px) {
  .catalog-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .library-shell {
    padding-inline: 0.9rem;
  }

  .library-stats {
    grid-template-columns: 1fr;
  }

  .catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .bundle-shelf .product-tile,
  .modal-body {
    grid-template-columns: 1fr;
  }

  .card-actions {
    display: grid;
  }

  .card-action,
  .quick-button {
    width: 100%;
  }
}

@media (max-width: 359px) {
  .catalog-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
