/* Public store pages (/store and /store/<slug>).
 *
 * Built on the same layers as /mqllock: theme-dark.css, auth.css (buttons,
 * aurora backdrop, --auth-* tokens), contact.css (contact cards) and
 * mql-lock-page.css (container, sections, cards, steps, plans, FAQ, videos,
 * dialog and the scroll reveal). This file adds only what the store needs:
 * product cards, badges, the product hero, the screenshot gallery and
 * viewer, the description prose and the details table.
 *
 * Motion follows the /mqllock rules: only transform and opacity animate,
 * sizes are reserved up front (no layout shift), hidden start states apply
 * only after store-page.js has put `mql-reveal` on <html>, and under
 * prefers-reduced-motion nothing moves. The hero (icon, h1, short
 * description) is never animated.
 */

.store-body {
  --store-icon-size: clamp(4.5rem, 3.75rem + 2.5vw, 7rem);
  --store-card-icon: clamp(5.5rem, 5rem + 1.5vw, 7rem);
}

/* ------------------------------------------------------------------ Hero */

.store-hero__inner {
  display: grid;
  justify-items: start;
  gap: clamp(0.9rem, 0.7rem + 0.6vw, 1.4rem);
}

.store-hero__title {
  max-width: 24ch;
}

.store-hero__lead {
  max-width: 46rem;
}

.store-product-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: clamp(1rem, 0.75rem + 1.2vw, 2rem);
  width: 100%;
}

@media (min-width: 720px) {
  .store-product-hero {
    grid-template-columns: auto minmax(0, 1fr);
  }
}

.store-product-hero__icon {
  display: inline-grid;
  place-items: center;
  width: var(--store-icon-size);
  height: var(--store-icon-size);
  padding: 0.6rem;
  border: 1px solid var(--auth-line-strong);
  border-radius: 24px;
  background-color: var(--mql-surface-raised);
  box-shadow: 0 24px 50px -30px var(--auth-gold-glow);
}

.store-product-hero__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.store-product-hero__copy {
  display: grid;
  justify-items: start;
  gap: clamp(0.75rem, 0.6rem + 0.5vw, 1.15rem);
  min-width: 0;
}

.store-product-hero__title {
  max-width: 22ch;
  overflow-wrap: anywhere;
}

.store-product-hero__lead {
  max-width: 44rem;
}

.store-product-hero__meta {
  color: var(--auth-subtle);
  font-size: var(--auth-fs-small);
}

.store-product-hero__price {
  font-family: var(--font-brand);
  font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.9rem);
  font-weight: var(--font-weight-brand);
  font-variant-numeric: tabular-nums;
}

.store-product-hero__from {
  margin-inline-end: 0.35rem;
  color: var(--auth-subtle);
  font-family: var(--font-sans);
  font-size: var(--auth-fs-small);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* The zip size next to "Download". */
.store-download__size {
  color: var(--auth-subtle);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

/* ---------------------------------------------------------------- Badges */

.store-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--auth-line-strong);
  border-radius: var(--radius-pill);
  background-color: rgba(143, 180, 255, 0.08);
  color: var(--auth-text);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.02em;
}

.store-badge--gold {
  border-color: rgba(235, 196, 42, 0.45);
  background-color: var(--auth-gold-soft);
  color: var(--auth-gold);
}

.store-badge--quiet {
  background-color: transparent;
  color: var(--auth-muted);
}

/* ------------------------------------------------------- Listing toolbar */

.store-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: clamp(1.25rem, 1rem + 1vw, 2rem);
}

.store-toolbar__title {
  font-family: var(--font-brand);
  font-size: var(--mql-fs-h2);
  font-weight: var(--font-weight-brand);
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.store-toolbar__count {
  margin-top: 0.35rem;
  color: var(--auth-subtle);
  font-size: var(--auth-fs-small);
}

.store-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.store-filter[hidden] {
  display: none;
}

.store-filter__chip {
  min-height: 44px;
  padding: 0.45rem 1rem;
  border: 1px solid var(--auth-line-strong);
  border-radius: var(--radius-pill);
  background-color: transparent;
  color: var(--auth-muted);
  font: inherit;
  font-size: var(--auth-fs-small);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: background-color var(--transition-normal), color var(--transition-normal),
    border-color var(--transition-normal);
}

.store-filter__chip:hover {
  border-color: var(--auth-gold);
  color: var(--auth-text);
}

.store-filter__chip:focus-visible {
  outline: 3px solid var(--auth-gold);
  outline-offset: 2px;
}

.store-filter__chip[aria-pressed="true"] {
  border-color: var(--auth-gold);
  background-color: var(--auth-gold-soft);
  color: var(--auth-gold);
}

.store-filter__status:empty {
  display: none;
}

/* --------------------------------------------------------- Product cards */

.store-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(0.85rem, 0.7rem + 0.6vw, 1.4rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .store-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .store-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* A card hidden by the category filter. */
.store-card[hidden] {
  display: none;
}

.store-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1rem;
  min-width: 0;
  padding: var(--mql-card-pad);
  overflow: hidden;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius);
  background-color: var(--mql-surface);
  transition: transform var(--transition-normal), border-color var(--transition-normal);
}

/* The same soft gold light as the /mqllock cards (opacity only). */
.store-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0% 0%, rgba(235, 196, 42, 0.12), transparent 60%);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.store-card:hover,
.store-card:focus-within {
  border-color: var(--auth-line-strong);
}

.store-card:hover::before,
.store-card:focus-within::before {
  opacity: 1;
}

/* The icon fills its rounded box edge to edge; the whole picture stays visible. */
.store-card__icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--store-card-icon);
  height: var(--store-card-icon);
  overflow: hidden;
  border: 1px solid var(--auth-line);
  border-radius: 20px;
  background-color: var(--mql-surface-raised);
  color: var(--auth-gold);
  box-shadow: 0 18px 40px -28px var(--auth-gold-glow);
}

.store-card__icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.store-card__icon svg {
  width: 2rem;
  height: 2rem;
}

.store-card__body {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.55rem;
  min-width: 0;
}

.store-card__category {
  color: var(--auth-gold);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.store-card__title {
  font-family: var(--font-brand);
  font-size: var(--mql-fs-h3);
  font-weight: var(--font-weight-bold);
  line-height: 1.3;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.store-card__link {
  color: var(--auth-text);
  text-decoration: none;
}

/* Stretched link: the whole card is the click target of the title link. */
.store-card__link::after {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--mql-card-pad));
  z-index: 1;
  border-radius: var(--auth-radius);
}

.store-card__link:hover {
  text-decoration: none;
}

.store-card__link:focus-visible {
  outline: none;
}

.store-card:has(.store-card__link:focus-visible) {
  outline: 3px solid var(--auth-gold);
  outline-offset: 2px;
}

.store-card__text {
  color: var(--auth-muted);
  line-height: 1.6;
}

.store-card__footer {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--auth-line);
}

.store-card__price {
  font-family: var(--font-brand);
  font-size: 1.15rem;
  font-weight: var(--font-weight-brand);
  font-variant-numeric: tabular-nums;
}

.store-card__price--ask {
  color: var(--auth-gold);
  font-family: var(--font-sans);
  font-size: var(--auth-fs-small);
  font-weight: var(--font-weight-semibold);
}

.store-card__from {
  color: var(--auth-subtle);
  font-family: var(--font-sans);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.store-card__more {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--auth-gold);
  font-size: var(--auth-fs-small);
  font-weight: var(--font-weight-semibold);
}

.store-card__arrow {
  width: 1rem;
  height: 1rem;
  transition: transform var(--transition-normal);
}

/* -------------------------------------------------------------- States */

.store-state {
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  padding: clamp(2rem, 1.5rem + 2vw, 3.5rem) 1.25rem;
  border: 1px dashed var(--auth-line-strong);
  border-radius: var(--auth-radius);
  text-align: center;
}

.store-state__icon {
  display: inline-grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background-color: var(--auth-gold-soft);
  color: var(--auth-gold);
}

.store-state__icon svg {
  width: 1.4rem;
  height: 1.4rem;
}

.store-state--error .store-state__icon {
  background-color: rgba(255, 128, 128, 0.12);
  color: var(--auth-error);
}

.store-state__title {
  font-family: var(--font-brand);
  font-size: var(--mql-fs-h3);
  font-weight: var(--font-weight-bold);
}

.store-state__text {
  max-width: 34rem;
  color: var(--auth-muted);
  line-height: 1.6;
}

.store-state__text a {
  color: var(--auth-gold);
}

.store-filter__status {
  margin-top: 1rem;
  text-align: center;
}

/* --------------------------------------------------------------- Gallery */

.store-gallery {
  display: grid;
  gap: 1rem;
}

/* Native sideways scrolling with snap points: works with touch, a
   trackpad, or the arrow keys once the strip has focus. */
.store-gallery__track {
  --store-gallery-gap: clamp(0.75rem, 0.6rem + 0.6vw, 1.25rem);
  display: grid;
  /* Fixed column widths (not minmax(0, …)) so the strip overflows and scrolls. */
  grid-auto-columns: 85%;
  grid-auto-flow: column;
  align-items: start;
  gap: var(--store-gallery-gap);
  margin: 0;
  padding: 0.25rem 0.25rem 1rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  list-style: none;
  scrollbar-color: var(--auth-line-strong) transparent;
}

@media (min-width: 900px) {
  /* Two screenshots per view on wide screens. */
  .store-gallery__track {
    grid-auto-columns: calc((100% - var(--store-gallery-gap)) / 2);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .store-gallery__track {
    scroll-behavior: smooth;
  }
}

.store-gallery__track:focus-visible {
  border-radius: var(--auth-radius);
  outline: 3px solid var(--auth-gold);
  outline-offset: 2px;
}

.store-gallery__item {
  min-width: 0;
  scroll-snap-align: start;
}

.store-gallery__open {
  display: block;
  overflow: hidden;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius-sm);
  background-color: var(--mql-surface);
  transition: border-color var(--transition-normal);
}

.store-gallery__open:hover {
  border-color: var(--auth-line-strong);
}

.store-gallery__open:focus-visible {
  outline: 3px solid var(--auth-gold);
  outline-offset: 2px;
}

/* The width/height attributes reserve the box; the image scales inside it. */
.store-gallery__open img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 500ms var(--auth-ease), opacity var(--transition-normal);
}

.store-gallery__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.store-gallery__controls[hidden] {
  display: none;
}

.store-gallery__count {
  min-width: 4.5rem;
  color: var(--auth-muted);
  font-size: var(--auth-fs-small);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.store-gallery__nav {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--auth-line-strong);
  border-radius: 50%;
  background-color: var(--mql-surface-raised);
  color: var(--auth-text);
  cursor: pointer;
  transition: border-color var(--transition-normal), color var(--transition-normal), transform var(--transition-normal);
}

.store-gallery__nav svg {
  width: 1.15rem;
  height: 1.15rem;
}

.store-gallery__nav:hover {
  border-color: var(--auth-gold);
  color: var(--auth-gold);
}

.store-gallery__nav:focus-visible {
  outline: 3px solid var(--auth-gold);
  outline-offset: 2px;
}

.store-gallery__nav:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ---------------------------------------------------------------- Viewer */

.store-lightbox {
  width: min(calc(100% - 1.5rem), 76rem);
  max-height: calc(100dvh - 1.5rem);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--auth-line-strong);
  border-radius: var(--auth-radius);
  background-color: var(--auth-card-solid);
  color: var(--auth-text);
}

.store-lightbox::backdrop {
  background-color: rgba(4, 5, 8, 0.85);
}

.store-lightbox__figure {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: clamp(0.75rem, 0.5rem + 1vw, 1.25rem) clamp(0.75rem, 0.5rem + 1vw, 1.25rem) 0;
}

.store-lightbox__image {
  display: block;
  width: 100%;
  height: auto;
  /* Leaves room for the caption and the buttons, so the viewer never scrolls. */
  max-height: calc(100dvh - 12rem);
  object-fit: contain;
  border-radius: var(--auth-radius-sm);
}

.store-lightbox__caption {
  color: var(--auth-muted);
  font-size: var(--auth-fs-small);
  text-align: center;
}

.store-lightbox__bar {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.85rem;
}

@media (prefers-reduced-motion: no-preference) {
  .store-lightbox[open] {
    animation: auth-rise 260ms var(--auth-ease) both;
  }

  /* A new picture fades in (opacity only). */
  .store-lightbox__image.is-changing {
    animation: store-fade 220ms var(--auth-ease) both;
  }
}

@keyframes store-fade {
  from { opacity: 0.2; }
  to { opacity: 1; }
}

/* ----------------------------------------------------------------- Prose */

.store-prose {
  max-width: 48rem;
  margin-inline: auto;
  color: var(--auth-muted);
  font-size: var(--mql-fs-lead);
  line-height: 1.75;
}

.store-prose > * + * {
  margin-top: 1rem;
}

.store-prose h3,
.store-prose h4 {
  margin-top: 1.75rem;
  color: var(--auth-text);
  font-family: var(--font-brand);
  line-height: 1.3;
}

.store-prose h3 {
  font-size: var(--mql-fs-h3);
}

.store-prose h4 {
  font-size: 1rem;
}

.store-prose strong {
  color: var(--auth-text);
}

.store-prose a {
  color: var(--auth-gold);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.store-prose ul,
.store-prose ol {
  padding-inline-start: 1.4rem;
}

.store-prose li + li {
  margin-top: 0.35rem;
}

.store-prose table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: var(--auth-fs-small);
}

.store-prose th,
.store-prose td {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--auth-line);
  text-align: start;
  vertical-align: top;
}

.store-prose th {
  color: var(--auth-text);
}

/* --------------------------------------------------------------- Details */

.store-narrow {
  max-width: 52rem;
}

.store-details {
  overflow: hidden;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius);
  background-color: var(--mql-surface);
}

.store-details__table {
  width: 100%;
  border-collapse: collapse;
}

.store-details__table th,
.store-details__table td {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--auth-line);
  text-align: start;
  vertical-align: top;
  line-height: 1.5;
}

.store-details__table tr:last-child > * {
  border-bottom: 0;
}

.store-details__table th {
  width: 40%;
  color: var(--auth-subtle);
  font-size: var(--auth-fs-small);
  font-weight: var(--font-weight-semibold);
}

.store-details__table td {
  color: var(--auth-text);
  overflow-wrap: anywhere;
}

/* ----------------------------------------------------------- Plans, steps */

/* Any number of plans: as many columns as fit, never narrower than 14rem.
   (Loaded after mql-lock-page.css, so this replaces its fixed columns.) */
.store-plans {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}

.store-plan .mql-plan__buy {
  margin-top: auto;
}

/* Any number of steps: as many columns as fit. */
@media (min-width: 1100px) {
  .store-steps {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  }
}

.store-section--cta {
  padding-top: 0;
}

/* ---------------------------------------------------------------- Motion */

@media (prefers-reduced-motion: no-preference) {
  /* Hover lift of the product cards (transform only), like the /mqllock cards. */
  .store-card:hover {
    transform: translateY(-3px);
  }

  .store-card:hover .store-card__arrow {
    transform: translateX(3px);
  }

  .store-gallery__open:hover img {
    transform: scale(1.02);
  }
}

@media (prefers-reduced-motion: reduce) {
  .store-card,
  .store-card::before,
  .store-card__arrow,
  .store-gallery__open img,
  .store-filter__chip,
  .store-gallery__nav {
    transition: none;
  }
}
