/* The store's look (crew-board #1079, the owner's review of the first live store, 2026-11-30):
   - each type has its own colour: the row header glows in it, the card's edge lights in it;
   - a row shows three and a half cards on a desktop, with a thick scrollbar and never a
     vertical one;
   - cards turn in 3D as they scroll in and out of view (scroll-driven animations, Chrome 115:
     view() down the page, view(inline) along a row); still in calm mode and for reduced motion;
   - on a desktop, hovering a card pops up a larger copy (assets/js/store/peek.js: popover,
     Chrome 114; @starting-style, Chrome 117). */

/* ---- Colours by type ---- */
:root { --type: var(--accent2); }
[data-type="audio"] { --type: #22d3ee; }
[data-type="art"] { --type: #f472b6; }
[data-type="tabletop"] { --type: #f59e0b; }
[data-type="puzzles"] { --type: #a3e635; }
[data-type="printables"] { --type: #34d399; }
[data-type="project-kits"] { --type: #60a5fa; }
[data-type="tools"] { --type: #c084fc; }
[data-type="books"] { --type: #fb7185; }
[data-type="games"] { --type: #fb923c; }
[data-type="free"] { --type: #2dd4bf; }
[data-type="featured"] { --type: #fbbf24; }
[data-type="new"] { --type: #818cf8; }
[data-type="sale"] { --type: #f87171; }

/* ---- Row headers ---- */
.store-band { margin-top: 2.8rem; }
.store-band-head {
  align-items: center;
  margin: 0 0 0.6rem;
  padding: 0.7rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--type) 60%, transparent);
  border-radius: 1rem;
  background: linear-gradient(100deg, color-mix(in srgb, var(--type) 18%, transparent), transparent 70%);
  box-shadow: 0 0 28px -8px color-mix(in srgb, var(--type) 70%, transparent), inset 0 0 22px -14px var(--type);
}
.store-band-head h2 {
  color: var(--white);
  text-shadow: 0 0 18px color-mix(in srgb, var(--type) 70%, transparent);
}
.store-band-head h2::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin: 0 0.6rem 0.18rem 0;
  border-radius: 999px;
  background: var(--type);
  box-shadow: 0 0 12px var(--type);
  vertical-align: middle;
}
.store-band-head .text-link { color: var(--type); font-weight: 600; }
.store-blurb { margin-inline: 0.2rem; }

/* ---- Rows: 3.5 cards, a thick scrollbar, no vertical scrollbar ---- */
.store-rail {
  --gap: 1.1rem;
  gap: var(--gap);
  padding: 1.1rem 0.4rem 1.3rem;
  overflow-y: hidden;
  scrollbar-width: auto;
  scrollbar-color: color-mix(in srgb, var(--accent2) 70%, transparent) rgb(255 255 255 / 0.07);
  perspective: 1400px;
}
.store-rail > .store-card { flex: 0 0 calc((100% - 3 * var(--gap)) / 3.5); }
@media (max-width: 1023px) {
  .store-rail > .store-card { flex-basis: calc((100% - 2 * var(--gap)) / 2.5); }
}
@media (max-width: 639px) {
  .store-rail > .store-card { flex-basis: calc((100% - var(--gap)) / 1.25); }
}
/* The carousel buttons sit outside the row, not on its first and last cards. */
@supports (scroll-marker-group: after) {
  .store-rail-wrap { margin-inline: -1.4rem; }
  .store-rail { margin-inline: 1.4rem; }
  .store-rail::scroll-button(inline-start) { translate: -0.2rem 0; }
  .store-rail::scroll-button(inline-end) { translate: 0.2rem 0; }
  .store-rail::scroll-button(*) {
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    box-shadow: 0 6px 18px -6px rgb(0 0 0 / 0.8);
  }
}
@media (max-width: 719px) {
  @supports (scroll-marker-group: after) {
    .store-rail-wrap { margin-inline: 0; }
    .store-rail { margin-inline: 0; }
  }
}
/* Older engines without scrollbar-color draw a thick, rounded bar. */
.store-rail::-webkit-scrollbar { height: 14px; }
.store-rail::-webkit-scrollbar-track { background: rgb(255 255 255 / 0.07); border-radius: 999px; }
.store-rail::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--accent2) 70%, transparent); border-radius: 999px; }

/* ---- Cards: taller pictures, the type's colour on the edge ---- */
.store-card-link {
  gap: 0.85rem;
  padding: 0.85rem;
  border-color: color-mix(in srgb, var(--type) 22%, var(--border));
}
.store-card-link:hover,
.store-card-link:focus-visible {
  border-color: color-mix(in srgb, var(--type) 75%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--type) 40%, transparent), 0 18px 40px -18px color-mix(in srgb, var(--type) 80%, transparent);
}
.store-card-media { aspect-ratio: 16 / 10; }
/* A free tool's picture is a screenshot of its page: keep its top-left, where the title is. */
.store-card[data-kind="tool"] .store-card-img { object-position: left top; }
.store-card-type { color: var(--type); }
.store-card-fallback {
  color: var(--type);
  background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--type) 30%, transparent), transparent 70%);
}

/* ---- 3D as cards scroll in and out of view ---- */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    html:not([data-fx="calm"]) .store-rail > .store-card {
      animation: store-turn linear both;
      animation-timeline: view(inline);
      animation-range: entry 0% exit 100%;
      transform-style: preserve-3d;
    }
    html:not([data-fx="calm"]) .store-band,
    html:not([data-fx="calm"]) .store-grid > .store-card {
      animation: store-rise linear both;
      animation-timeline: view();
      animation-range: entry 0% exit 100%;
    }
    html:not([data-fx="calm"]) .store-home,
    html:not([data-fx="calm"]) .store-grid { perspective: 1600px; }
  }
}
/* Along a row: a card turns toward the middle while it comes in and away while it leaves; a
   card wholly inside the row is flat (keyframes on the entry and exit ranges). */
@keyframes store-turn {
  entry 0% { transform: rotateY(-38deg) translateZ(-80px) scale(0.88); opacity: 0.4; }
  entry 100% { transform: none; opacity: 1; }
  exit 0% { transform: none; opacity: 1; }
  exit 100% { transform: rotateY(38deg) translateZ(-80px) scale(0.88); opacity: 0.4; }
}
/* Down the page: a row tips up into place as it comes in, and away as it leaves the top. */
@keyframes store-rise {
  entry 0% { transform: rotateX(24deg) translateY(2.5rem) scale(0.95); opacity: 0.2; }
  entry 100% { transform: none; opacity: 1; }
  exit 0% { transform: none; opacity: 1; }
  exit 100% { transform: rotateX(-16deg) translateY(-1rem) scale(0.96); opacity: 0.5; }
}

/* ---- The larger card on hover (assets/js/store/peek.js) ---- */
.store-peek {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--type) 70%, transparent);
  border-radius: 1.3rem;
  background: color-mix(in srgb, var(--bg) 92%, var(--type));
  color: var(--text);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.85), 0 0 40px -10px color-mix(in srgb, var(--type) 70%, transparent);
  overflow: hidden;
}
.store-peek:popover-open { display: block; }
.store-peek-link { display: grid; gap: 0.8rem; padding: 1rem; color: inherit; text-decoration: none; }
.store-peek-media { display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 0.95rem; background: var(--bg); }
.store-peek-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.store-peek-type { color: var(--type); font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em; }
.store-peek-title { font-family: var(--serif); font-size: 1.75rem; line-height: 1.12; letter-spacing: -0.02em; color: var(--white); }
.store-peek-summary { color: var(--text); line-height: 1.5; }
.store-peek-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.store-peek-price { font-weight: 700; font-size: 1.15rem; }
.store-peek-open { color: var(--type); font-weight: 600; }
@media (prefers-reduced-motion: no-preference) {
  html:not([data-fx="calm"]) .store-peek {
    transition: opacity 0.18s ease, scale 0.22s cubic-bezier(.2, .8, .2, 1), overlay 0.22s allow-discrete, display 0.22s allow-discrete;
    opacity: 1;
    scale: 1;
  }
  @starting-style {
    html:not([data-fx="calm"]) .store-peek:popover-open { opacity: 0; scale: 0.86; }
  }
  html:not([data-fx="calm"]) .store-peek:not(:popover-open) { opacity: 0; scale: 0.92; }
}

@media (prefers-contrast: more) {
  .store-band-head { background: none; box-shadow: none; border-color: var(--text); }
  .store-band-head h2 { text-shadow: none; }
}
