/* Games shelf + 90s box art */


:root {
  --parchment: #efe2bf;
  --parchment-edge: #c9ae74;
  --gold: #d9ad55;
  /* Faint globe-grid lines over a pale cover, after the Renaissance box */
  --globe-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cg fill='none' stroke='%23c4bfae' stroke-width='1' opacity='0.6'%3E%3Ccircle cx='100' cy='100' r='90'/%3E%3Cellipse cx='100' cy='100' rx='45' ry='90'/%3E%3Cline x1='10' y1='100' x2='190' y2='100'/%3E%3Cline x1='100' y1='10' x2='100' y2='190'/%3E%3C/g%3E%3C/svg%3E") center / 60% no-repeat;
}

/* Shelf */
.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 28px;
  justify-items: center;
}

.shelf-item {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  width: 100%;
}

/* styles.css gives every button an orange hover; keep the shelf items plain */
.shelf-item:hover,
.shelf-item:focus,
.shelf-item:active {
  background: none;
  color: inherit;
}

.shelf-item:hover .box,
.shelf-item:focus-visible .box {
  translate: 0 -6px;
}

.shelf-item:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 8px;
}

.shelf-caption {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  letter-spacing: 0.08em;
  font-size: 0.95rem;
}

.shelf-empty {
  color: #aaa;
}

/* Box: a tall, 5:7 retail box. Sized with container units so it scales. */
.box {
  --box-main: #3b2a1a;
  --box-accent: #d9ad55;
  --box-ink: #1a1009;
  position: relative;
  width: min(200px, 100%);
  aspect-ratio: 5 / 7;
  container-type: inline-size;
  /* A real box: front cover, spine, top and bottom share one 3D space.
     Rest at a three-quarter angle; --rx/--ry are set from the cursor. */
  --depth: 7cqw;
  --rx: 0deg;
  --ry: 0deg;
  transform-style: preserve-3d;
  transform: perspective(1100px) rotateX(var(--rx)) rotateY(calc(-14deg + var(--ry)));
  transition: transform 0.35s ease, translate 0.35s ease;
}

/* Top and bottom faces give the box its thickness */
.box::before,
.box::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: var(--depth);
  background: linear-gradient(90deg, var(--box-main), var(--box-ink));
  border: 0.4cqw solid var(--box-accent);
  box-sizing: border-box;
}
.box::before { top: 0; transform-origin: top; transform: rotateX(90deg); }
.box::after { bottom: 0; transform-origin: bottom; transform: rotateX(-90deg); }

.box-large {
  width: min(300px, 74vw);
  transform-style: preserve-3d;
  cursor: pointer;
}

.box-spine {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--depth);
  height: 100%;
  transform-origin: left center;
  transform: rotateY(-90deg);
  border: 0.4cqw solid var(--gold);
  box-sizing: border-box;
  background: linear-gradient(90deg, #000 0%, var(--box-main) 60%, #000 100%);
  border-radius: 2px 0 0 2px;
  z-index: 0;
}

/* Cover: the part that opens. Hinge on the left edge. */
.box-front {
  position: absolute;
  inset: 0;
  transform-origin: 0 50%;
  transform: translateZ(var(--depth));
  transition: transform 0.9s cubic-bezier(0.3, 0.7, 0.2, 1);
  backface-visibility: hidden;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7cqw 6cqw 5cqw;
  background: var(--globe-bg), linear-gradient(170deg, #fbfaf4, #ecebe3);
  border: 0.5cqw solid #b9b4a4;
  box-shadow:
    inset 0 0 0 0.3cqw #fff,
    inset 0 0 5cqw rgba(120, 110, 80, 0.25);
  color: #2a2a2e;
  text-align: center;
  overflow: hidden;
}

.box-large.is-open .box-front {
  transform: translateZ(var(--depth)) rotateY(-112deg);
}

/* Ornate corners, gilded like a Renaissance-era frame */
.box-front::before,
.box-front::after {
  content: '';
  position: absolute;
  width: 16cqw;
  height: 16cqw;
  border: 0.8cqw solid var(--gold);
  border-radius: 50%;
  opacity: 0.65;
  pointer-events: none;
}
.box-front::before { top: 3cqw; right: 3cqw; border-left-color: transparent; border-bottom-color: transparent; }
.box-front::after { bottom: 3cqw; left: 3cqw; border-right-color: transparent; border-top-color: transparent; }

.box-band {
  width: 100%;
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 4.2cqw;
  color: #3a3a40;
}

/* Silver ring with a gold inner ring, like the reference emblem */
.box-crest {
  margin: 5cqw 0 3cqw;
  width: 56cqw;
  height: 56cqw;
  border-radius: 50%;
  padding: 2.5cqw;
  background: conic-gradient(from 210deg, #f4f4f6, #8d9099, #e9e9ee, #6d7079, #f4f4f6);
  box-shadow: 0 1cqw 3cqw rgba(0, 0, 0, 0.35);
}

.box-crest span {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 26cqw;
  line-height: 1;
  color: #f1d58a;
  background: radial-gradient(circle at 40% 35%, var(--box-main), var(--box-ink));
  border: 1.2cqw solid #c9a24f;
  box-sizing: border-box;
}

.box-title {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 9cqw;
  letter-spacing: 0.12em;
  line-height: 1.1;
  text-transform: uppercase;
  color: #7a5414;
}

.box-foot {
  margin-top: auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 4.2cqw;
  color: #3a3a40;
  border-top: 0.5cqw solid #b9b4a4;
  padding-top: 2.5cqw;
}

.box-stamp {
  font-family: 'Cinzel', serif;
  font-style: normal;
  font-weight: 700;
  font-size: 3.6cqw;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6a4a12;
  border: 0.5cqw solid #9a6d1f;
  padding: 0.6cqw 1.6cqw;
  transform: rotate(-4deg);
}

/* Inside panel: revealed when the cover opens */
.box-inside {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--globe-bg), #fbfaf4;
  color: #2a2a2e;
  padding: 7cqw 6cqw;
  display: flex;
  flex-direction: column;
  gap: 2.5cqw;
  font-family: 'IM Fell English', serif;
  font-size: 4.6cqw;
  overflow: hidden;
  border: 1.2cqw solid var(--parchment-edge);
  box-shadow: inset 0 0 8cqw rgba(120, 80, 20, 0.35);
}

.box-inside h4 {
  font-family: 'Cinzel', serif;
  font-size: 7.5cqw;
  font-weight: 900;
  color: var(--box-main);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 0.5cqw solid var(--parchment-edge);
  padding-bottom: 2cqw;
}

.box-inside h5 {
  font-family: 'Cinzel', serif;
  font-size: 4.4cqw;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--box-main);
  margin-top: 1cqw;
}

.box-inside-status {
  font-style: italic;
  color: var(--box-main);
}

.box-specs {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1cqw 3cqw;
}
.box-specs dt { font-weight: 700; }
.box-specs dd { margin: 0; }

.box-inside ul {
  padding-left: 5cqw;
}
.box-inside li { margin-bottom: 1.2cqw; }

.box-inside-desc {
  font-size: 4cqw;
  line-height: 1.4;
}

.box-cta {
  margin-top: auto;
  align-self: flex-start;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 4cqw;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--parchment);
  background: var(--box-main);
  padding: 2cqw 4cqw;
  border: 0.5cqw solid var(--gold);
  text-decoration: none;
}

/* Viewer overlay */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(8, 8, 12, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.viewer[hidden] {
  display: none;
}

body.viewer-open {
  overflow: hidden;
}

.viewer-panel {
  width: min(560px, 100%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.viewer-title {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  color: var(--gold);
  font-size: 2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.viewer-stage {
  perspective: 1400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 24px 0;
}

.viewer-hint {
  color: #bbb;
  font-style: italic;
}

.viewer-close {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 8px 20px;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.1em;
}

.viewer-close:hover,
.viewer-close:focus-visible {
  background: var(--gold);
  color: #1a1009;
}

.viewer-stage .box {
  transform-style: preserve-3d;
}

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