/* Rothic Shop — catalog grid and detail view. Shared tokens, header, buttons and footer come from site.css. */

main { padding: 3rem 0 4rem; }

.shop-title {
  font-family: "Cinzel", serif;
  font-size: 1.875rem;
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.alert { color: var(--danger); }

/* Catalog grid */
.grid {
  --gap: 1.25rem;
  --card-pad: 0.75rem;
  --pair-inner: 0.2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr));
  grid-auto-flow: dense;
  gap: var(--gap);
}

/* Connecting covers: one joined unit, two columns wide, covers facing each other */
.pair {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  animation: floatY var(--float-dur, 12s) ease-in-out var(--float-delay, 0s) infinite alternate;
}
/* Each pair card is half a gap wider than a normal card; the outer padding absorbs that
   plus the reduced inner padding, so the cover ends up exactly the same width as every other. */
.pair .card.left  { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none; padding-right: var(--pair-inner); padding-left: calc(var(--card-pad) * 2 - var(--pair-inner) + var(--gap) / 2); }
.pair .card.right { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: none; padding-left: var(--pair-inner); padding-right: calc(var(--card-pad) * 2 - var(--pair-inner) + var(--gap) / 2); }
.pair .card.left .body { padding-right: 0.55rem; }
.pair .card.right .body { padding-left: 0.55rem; }
.pair:hover .card { border-color: var(--gold); box-shadow: none; }
.pair:hover { box-shadow: 0 10px 30px rgba(59, 36, 41, 0.08); border-radius: 0.5rem; }

/* Same drift and hover motion as the front page cards */
.card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: var(--card-pad, 0.75rem);
  transition: border-color 200ms ease, box-shadow 200ms ease;
  animation: floatY var(--float-dur, 12s) ease-in-out var(--float-delay, 0s) infinite alternate;
}
.card:hover {
  border-color: var(--gold);
  box-shadow: 0 10px 30px rgba(59, 36, 41, 0.08);
}

/* Every cover fills the same box, sized to the narrowest cover in the catalog (879 x 1380). */
.card .cover {
  position: relative;
  aspect-ratio: 879 / 1380;
  border-radius: 0.25rem;
  overflow: hidden;
  background: var(--bg-soft);
  animation: hover var(--hover-dur, 7s) ease-in-out var(--hover-delay, 0s) infinite;
  will-change: transform;
}

.card img, .ph {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: var(--bg-soft);
  border-radius: 0.25rem;
}

/* Cover zooms slightly on hover and opens the detail view on click */
.card .cover { cursor: zoom-in; }
.card .cover img { transition: transform 450ms cubic-bezier(0.2, 0.7, 0.2, 1); }
.card .cover:hover img, .card .cover:focus-visible img { transform: scale(1.06); }
.card .cover:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.card h2 { cursor: pointer; }
.card h2:hover { color: var(--gold); }

/* Card body */
.card .body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0 0.25rem 0.25rem;
  flex: 1;
}

.series {
  font-family: "Cinzel", serif;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
  min-height: 1em;
}

.card h2 {
  font-family: "Cinzel", serif;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
  color: var(--ink);
}

.card p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price {
  margin-top: auto;
  padding-top: 0.5rem;
  font-family: "Cinzel", serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

/* Sparkles sit inside the cover; the twinkle itself is defined in site.css */
.fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
}

/* Metal editions — a slow light sweep across the brushed steel */
@keyframes sheen {
  0% { transform: translateX(-130%) skewX(-18deg); }
  38% { transform: translateX(130%) skewX(-18deg); }
  100% { transform: translateX(130%) skewX(-18deg); }
}
.fx.metal::after {
  content: "";
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: 0;
  width: 55%;
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.10) 30%,
    rgba(255, 255, 255, 0.42) 50%,
    rgba(255, 255, 255, 0.10) 70%,
    rgba(255, 255, 255, 0) 100%);
  mix-blend-mode: screen;
  animation: sheen var(--sheen-d, 7s) cubic-bezier(0.4, 0, 0.2, 1) var(--sheen-o, 0s) infinite;
  will-change: transform;
}
.card .cover:hover .fx.metal::after { animation-duration: 2.4s; }

.detail .art .artwrap { position: relative; display: inline-block; border-radius: 0.25rem; overflow: hidden; line-height: 0; }

@media (prefers-reduced-motion: reduce) {
  .card, .pair, .card .cover, .fx.metal::after { animation: none; }
}

/* Detail view (lightbox) */
.detail {
  --pad: 2rem;
  --frame-h: min(calc(100vh - 3rem), 54rem);
  border: none;
  padding: 0;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);
  width: fit-content;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}
.detail::backdrop {
  background: rgba(59, 36, 41, 0.55);
  backdrop-filter: blur(8px);
}
.detail[open] { animation: detailIn 320ms cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes detailIn { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: none; } }

.detail .frame {
  display: grid;
  /* cover column = cover height × its aspect ratio, plus the padding on both sides */
  grid-template-columns: calc((var(--frame-h) - var(--pad) * 2) * var(--art-ratio, 0.667) + var(--pad) * 2) minmax(18rem, 30rem);
  height: var(--frame-h);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(59, 36, 41, 0.35);
}

/* The cover column sizes itself to the image, so every edge sits exactly --pad from the frame */
.detail .art {
  background: #1c1418;
  padding: var(--pad);
}
.detail .art img {
  display: block;
  height: calc(var(--frame-h) - var(--pad) * 2);
  width: 100%;
  object-fit: contain;
  border-radius: 0.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.detail .info {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: var(--pad);
  min-height: 0;
  overflow: auto;
  background:
    radial-gradient(ellipse at 100% 0%, rgba(247, 201, 209, 0.55) 0%, rgba(247, 201, 209, 0) 55%),
    var(--bg);
}
.detail .info .series {
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  line-height: 1;
  color: var(--red);
  padding-right: 3rem;
}
.detail .info h2 {
  font-family: "Cinzel", serif;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
  padding-right: 3rem;
  color: var(--ink);
}
.detail .info .rule {
  width: 3.5rem;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), rgba(168, 132, 42, 0));
  margin: 0.25rem 0 0.5rem;
}
.detail .info p {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink-soft);
}
.detail .info dl {
  margin: 0.75rem 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1.25rem;
  font-size: 0.9375rem;
}
.detail .info dt {
  font-family: "Cinzel", serif;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  align-self: baseline;
}
.detail .info dd { margin: 0; color: var(--ink); }
.detail .info .cart-quantity {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
}
.detail .info .price {
  margin-top: auto;
  padding-top: 1.5rem;
  font-size: 1.75rem;
  line-height: 1.1;
  font-weight: 700;
}
.detail .info .actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.detail .info .actions button { height: 2.75rem; padding: 0 1rem; margin-top: 0; }
.detail .info .actions .ghost { background: transparent; border-color: var(--line-strong); }
.detail .info .actions .ghost:hover { background: var(--bg-soft); border-color: var(--gold); }

.detail .close {
  position: absolute;
  top: calc(var(--pad) - 0.5rem);
  right: calc(var(--pad) - 0.5rem);
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 249, 249, 0.92);
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
  z-index: 2;
}
.detail .close:hover { border-color: var(--gold); background: var(--bg); }

body.detail-open { overflow: hidden; }

@media (max-width: 800px) {
  .detail { --pad: 1.25rem; max-width: calc(100vw - 1rem); max-height: calc(100vh - 1rem); width: 100%; }
  .detail .frame { grid-template-columns: 1fr; height: auto; max-height: calc(100vh - 1rem); overflow: auto; }
  .detail .art { display: grid; place-items: center; }
  .detail .art img { height: auto; width: auto; max-height: 60vh; max-width: 100%; }
  .detail .info { overflow: visible; }
  .detail .info h2 { font-size: 1.375rem; }
  .detail .info .price { font-size: 1.5rem; padding-top: 1rem; }
  .detail .info .actions { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .grid { --gap: 0.875rem; --card-pad: 0.5rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: var(--card-pad); }
  .shop-title { font-size: 1.5rem; }
}
