/* Steam-style library grid. Builds on the tokens in /styles.css. */

.back {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s;
}

.back:hover { color: var(--text); }

.lib-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 64px 0 32px;
}

.lib-title {
  font: 700 clamp(36px, 6vw, 56px)/1 "Space Grotesk", sans-serif;
  letter-spacing: -0.03em;
  color: var(--text);
}

.lib-count { color: var(--dim); font-size: 14px; font-weight: 500; }

.library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 28px 20px;
  padding-bottom: 96px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  outline: none;
}

/* The 2:3 cover, like a Steam library capsule */
.capsule {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border), 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s cubic-bezier(.2,.8,.2,1), box-shadow 0.25s;
}

.capsule img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Glossy sheen that sweeps across on hover */
.capsule::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,0.18) 50%, transparent 65%);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
  pointer-events: none;
}

.tile:hover .capsule,
.tile:focus-visible .capsule {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 70%, transparent), 0 20px 40px rgba(0, 0, 0, 0.45);
}

.tile:hover .capsule::after,
.tile:focus-visible .capsule::after { transform: translateX(120%); }

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background:
    radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--c2) 35%, transparent), transparent 60%),
    radial-gradient(100% 60% at 50% 100%, color-mix(in srgb, var(--c3) 30%, transparent), transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--c1) 85%, #000), color-mix(in srgb, var(--c1) 40%, #05070a));
}

.ph-letter {
  display: grid;
  place-items: center;
  width: 38%;
  aspect-ratio: 1;
  border-radius: 24%;
  font: 700 clamp(32px, 5vw, 48px)/1 "Space Grotesk", sans-serif;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(6px);
}

.ph-icon { width: 38% !important; height: auto !important; border-radius: 22%; }

.ph-name {
  font: 700 18px/1.1 "Space Grotesk", sans-serif;
  color: #fff;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.tile-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tile-name { font-weight: 600; font-size: 15px; color: var(--text); }

.tile-platform {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--dim);
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.tile-desc { color: var(--muted); font-size: 13px; line-height: 1.45; margin-top: -4px; }

/* Hover preview, like a Steam store capsule turning into a details card.
   Only on devices that can hover; touch devices show the description under the tile instead. */
.preview {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--tint) 45%, #0b0e14);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}

.pv-shot {
  flex: 0 0 auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}

.pv-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* A cover used as stand-in screenshot: show its upper part */
.pv-shot img.from-cover { object-position: center 25%; }

.pv-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  min-height: 0;
}

.pv-name {
  font: 700 17px/1.15 "Space Grotesk", sans-serif;
  color: #fff;
}

.pv-desc {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12.5px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  flex-shrink: 0;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pv-tags { display: flex; flex-wrap: wrap; gap: 5px; }

.tag {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.1);
  padding: 3px 7px;
  border-radius: 4px;
}

.pv-open {
  margin-top: auto;
  align-self: flex-start;
  font-size: 13px;
  font-weight: 600;
  color: #0b0e14;
  background: var(--accent);
  padding: 7px 14px;
  border-radius: 6px;
}

.pv-open::after { content: " →"; }

@media (hover: hover) {
  .tile:hover .preview,
  .tile:focus-visible .preview { opacity: 1; transform: none; }

  /* The preview carries the description, so don't repeat it under the tile */
  .tile-desc { display: none; }
}

@media (max-width: 560px) {
  .library { grid-template-columns: repeat(2, 1fr); gap: 22px 14px; }
  .lib-head { padding: 40px 0 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .capsule, .capsule::after { transition: none; }
}
