/* ─── Image Gallery ─────────────────────────────────────────────────────── */

.app-gallery {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  /* Align scroll-start with the text content inside the centered page-root */
  scroll-padding-inline-start: max(var(--page-inline-padding), calc((100vw - var(--content-max-width)) / 2));
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  /* Gallery sits directly in content-area (full viewport width).
     First image aligns with the text inside .page's centered max-width. */
  padding-inline-start: max(var(--page-inline-padding), calc((100vw - var(--content-max-width)) / 2));
  /* End padding = (viewport) − (start padding) − (item width), so the last image
     can scroll all the way until its left edge aligns with the text. */
  padding-inline-end: max(
    var(--page-inline-padding),
    calc(
      100vw
      - max(var(--page-inline-padding), calc((100vw - var(--content-max-width)) / 2))
      - clamp(16rem, 55vw, 28rem)
    )
  );
}

.app-gallery::-webkit-scrollbar {
  display: none;
}

/* ─── Gallery Dots ───────────────────────────────────────────────────────── */

.app-gallery-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  margin-top: calc(-1 * var(--space-5));
  margin-bottom: var(--space-8);
}

.app-gallery-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.3);
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.2s ease;
}

.app-gallery-dot:hover {
  background: rgb(255 255 255 / 0.55);
}

.app-gallery-dot--active {
  background: rgb(255 255 255 / 0.9);
  transform: scale(1.4);
}

.app-gallery__item {
  flex: 0 0 auto;
  scroll-snap-align: start;
  width: clamp(16rem, 55vw, 28rem);
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-4);
  overflow: hidden;
  border: var(--material-card-border);
  cursor: pointer;
  padding: 0;
  background: none;
  transition: opacity 0.15s;
}

.app-gallery__item:hover {
  opacity: 0.85;
}

.app-gallery__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* ─── Gallery Lightbox ───────────────────────────────────────────────────── */

.app-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
}

.app-gallery-lightbox[hidden] {
  display: none;
}

.app-gallery-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
}

.app-gallery-lightbox__img {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 72rem);
  max-height: 84vh;
  object-fit: contain;
  border-radius: var(--radius-4);
  box-shadow: 0 32px 96px rgb(0 0 0 / 0.7);
}

.app-gallery-lightbox__btn {
  position: absolute;
  z-index: 2;
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(255 255 255 / 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s;
}

.app-gallery-lightbox__btn:hover {
  background: rgb(255 255 255 / 0.25);
}

.app-gallery-lightbox__btn--prev { left: var(--space-5); }
.app-gallery-lightbox__btn--next { right: var(--space-5); }

.app-gallery-lightbox__btn img {
  filter: invert(1);
  display: block;
}

/* ─── App Detail Body (2-col) ────────────────────────────────────────────── */

.detail-body {
  display: grid;
  gap: var(--space-8);
}

@media (min-width: 70rem) {
  .detail-body {
    grid-template-columns: 1fr minmax(14rem, 20rem);
    align-items: start;
  }
}

/* The left column in the two-column detail layout. Holds the
   description text block + reviews section, stacked vertically. */
.detail-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
}

.detail-description {
  color: rgb(255 255 255 / 0.82);
  font-size: var(--font-size-300);
  line-height: var(--line-height-normal);
}

.detail-description h1,
.detail-description h2,
.detail-description h3,
.detail-description h4,
.detail-description h5,
.detail-description h6 {
  color: rgb(255 255 255 / 0.96);
  font-weight: 600;
  line-height: var(--line-height-tight);
  margin-block-start: var(--space-5);
  margin-block-end: var(--space-2);
}

.detail-description h1 { font-size: var(--font-size-700); }
.detail-description h2 { font-size: var(--font-size-600); }
.detail-description h3 { font-size: var(--font-size-500); }
.detail-description h4,
.detail-description h5,
.detail-description h6 { font-size: var(--font-size-400); }

.detail-description p {
  margin-block-end: var(--space-4);
}

.detail-description p:last-child {
  margin-block-end: 0;
}

.detail-description ul,
.detail-description ol {
  padding-inline-start: var(--space-5);
  margin-block-end: var(--space-4);
}

.detail-description ul {
  list-style-type: disc;
}

.detail-description ol {
  list-style-type: decimal;
}

.detail-description li {
  margin-block-end: var(--space-1);
}

.detail-description li:last-child {
  margin-block-end: 0;
}

.detail-description strong,
.detail-description b {
  color: rgb(255 255 255 / 0.96);
  font-weight: 600;
}

.detail-description em,
.detail-description i {
  font-style: italic;
}

.detail-description a {
  color: rgb(255 255 255 / 0.82);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.detail-description a:hover {
  color: rgb(255 255 255 / 0.96);
}

.detail-description code {
  font-family: monospace;
  font-size: 0.875em;
  background: rgb(255 255 255 / 0.08);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.detail-description pre {
  background: rgb(255 255 255 / 0.06);
  border-radius: 8px;
  padding: var(--space-4);
  overflow-x: auto;
  margin-block-end: var(--space-4);
}

.detail-description pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: var(--font-size-300);
}

.detail-description blockquote {
  border-inline-start: 3px solid rgb(255 255 255 / 0.25);
  padding-inline-start: var(--space-4);
  margin-inline: 0;
  margin-block-end: var(--space-4);
  color: rgb(255 255 255 / 0.6);
  font-style: italic;
}

.detail-description hr {
  border: none;
  border-block-start: 1px solid rgb(255 255 255 / 0.12);
  margin-block: var(--space-5);
}

.detail-facets {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.detail-facets__section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.detail-facets__label {
  font-size: var(--font-size-100);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 0.45);
}

.detail-facets__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.detail-facets__tag {
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-2);
  background: rgb(255 255 255 / 0.12);
  color: rgb(255 255 255 / 0.82);
  font-size: var(--font-size-200);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
}

a.detail-facets__tag:hover {
  background: rgb(255 255 255 / 0.2);
}

.detail-facets__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: rgb(255 255 255 / 0.82);
  font-size: var(--font-size-300);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
}

.detail-facets__link:hover {
  color: rgb(255 255 255 / 1);
}

.detail-prices {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.detail-price {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--font-size-300);
  color: rgb(255 255 255 / 0.82);
}

.detail-price__platform {
  color: rgb(255 255 255 / 0.55);
  font-size: var(--font-size-200);
}

.detail-price__amount {
  font-weight: var(--font-weight-semibold);
  color: rgb(255 255 255 / 0.96);
}
