/* Catalog Trung Thu 2026 — full official catalogue viewer (TASK-1074) */

.sf-catalog-page {
  --sf-cat-ratio: 2000 / 1414;
  --sf-cat-bg: color-mix(in srgb, var(--palette-cream) 92%, white);
}

.sf-catalog-page__main {
  padding-block: 1rem 2.5rem;
  background: var(--sf-cat-bg);
  min-height: 60vh;
}

.sf-catalog-page__intro {
  text-align: center;
  max-width: 36rem;
  margin: 0 auto 1rem;
  padding-inline: 1rem;
}

.sf-catalog-page__intro h1 {
  margin: 0;
  font-family: Literata, Georgia, serif;
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  font-weight: 700;
  color: var(--palette-brown);
  line-height: 1.25;
}

.sf-catalog-page__count {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--palette-brown) 65%, transparent);
}

.sf-catalog-page__lead {
  margin: 0.55rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: color-mix(in srgb, var(--palette-brown) 78%, transparent);
}

.sf-catalog-page__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.sf-catalog-page__actions .btn {
  min-height: 2.4rem;
  padding-inline: 1.1rem;
  font-size: 0.875rem;
}

/* —— Mobile: vertical stack of all pages —— */
.sf-cat-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-inline: 0.75rem;
  max-width: 42rem;
  margin: 0 auto;
}

.sf-cat-stack__page {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  width: 100%;
}

.sf-cat-stack__btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  line-height: 0;
}

.sf-cat-stack__btn:focus-visible {
  outline: 2px solid var(--palette-gold);
  outline-offset: 3px;
}

.sf-cat-stack__img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--sf-cat-ratio);
  object-fit: contain;
  background: color-mix(in srgb, var(--palette-cream) 70%, #ddd);
}

.sf-cat-stack__label {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  text-align: center;
  color: color-mix(in srgb, var(--palette-brown) 55%, transparent);
}

/* —— Desktop viewer —— */
.sf-cat-viewer {
  display: none;
  flex-direction: column;
  align-items: center;
  width: min(100%, 68rem);
  margin: 0 auto;
  padding-inline: 1rem;
}

.sf-cat-viewer__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: calc(100dvh - 13.5rem);
}

.sf-cat-viewer__frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, calc((100dvh - 13.5rem) * (2000 / 1414)));
  max-height: calc(100dvh - 13.5rem);
  aspect-ratio: var(--sf-cat-ratio);
  background: color-mix(in srgb, var(--palette-cream) 80%, #e8e0d4);
}

.sf-cat-viewer__open {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  line-height: 0;
}

.sf-cat-viewer__open:focus-visible {
  outline: 2px solid var(--palette-gold);
  outline-offset: 2px;
}

.sf-cat-viewer__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sf-cat-viewer__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--palette-brown) 18%, transparent);
  background: color-mix(in srgb, white 88%, var(--palette-cream));
  color: var(--palette-brown);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 4px color-mix(in srgb, var(--palette-brown) 12%, transparent);
}

.sf-cat-viewer__nav:hover,
.sf-cat-viewer__nav:focus-visible {
  background: #fff;
  border-color: var(--palette-gold);
}

.sf-cat-viewer__nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.sf-cat-viewer__nav--prev {
  left: 0.35rem;
}

.sf-cat-viewer__nav--next {
  right: 0.35rem;
}

.sf-cat-viewer__counter {
  margin: 0.65rem 0 0.45rem;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--palette-brown);
  font-variant-numeric: tabular-nums;
}

.sf-cat-viewer__thumbs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  max-width: 100%;
  overflow-x: auto;
  padding: 0.15rem 0.25rem 0.35rem;
  scrollbar-width: thin;
  justify-content: flex-start;
}

.sf-cat-viewer__thumb {
  flex: 0 0 auto;
  width: 4.25rem;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 2px;
  background: transparent;
  cursor: pointer;
  line-height: 0;
  opacity: 0.72;
}

.sf-cat-viewer__thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--sf-cat-ratio);
  object-fit: contain;
  background: #e8e0d4;
}

.sf-cat-viewer__thumb.is-active {
  border-color: var(--palette-gold);
  opacity: 1;
}

.sf-cat-viewer__thumb:focus-visible {
  outline: 2px solid var(--palette-brown);
  outline-offset: 1px;
}

/* —— Fullscreen —— */
.sf-cat-fs {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  background: rgba(12, 10, 8, 0.94);
  color: #f5f0e8;
}

.sf-cat-fs[hidden] {
  display: none !important;
}

.sf-cat-fs__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1rem;
  flex: 0 0 auto;
}

.sf-cat-fs__counter {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.sf-cat-fs__close {
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.sf-cat-fs__close:hover,
.sf-cat-fs__close:focus-visible {
  background: rgba(255, 255, 255, 0.1);
}

.sf-cat-fs__stage {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0.5rem 3.25rem 1.25rem;
}

.sf-cat-fs__img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.sf-cat-fs__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.sf-cat-fs__nav:hover,
.sf-cat-fs__nav:focus-visible {
  background: rgba(255, 255, 255, 0.16);
}

.sf-cat-fs__nav--prev {
  left: 0.5rem;
}

.sf-cat-fs__nav--next {
  right: 0.5rem;
}

body.sf-cat-fs-open {
  overflow: hidden;
}

/* —— Homepage compact entry —— */
.sf-catalog-link {
  padding-block: 1.15rem 1.35rem;
}

.sf-catalog-link__inner {
  display: grid;
  gap: 1rem;
  align-items: center;
  max-width: 40rem;
  margin-inline: auto;
  text-align: center;
}

.sf-catalog-link__title {
  margin: 0.25rem 0 0.65rem;
  font-family: Literata, Georgia, serif;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  font-weight: 600;
  color: var(--palette-brown);
  line-height: 1.35;
}

.sf-catalog-link__cta {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--palette-brown);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--palette-gold) 55%, transparent);
}

.sf-catalog-link__cta:hover,
.sf-catalog-link__cta:focus-visible {
  color: var(--palette-red);
  border-bottom-color: var(--palette-red);
}

.sf-catalog-link__preview {
  display: block;
  max-width: 16rem;
  margin-inline: auto;
  line-height: 0;
  text-decoration: none;
}

.sf-catalog-link__preview img {
  width: 100%;
  height: auto;
  aspect-ratio: var(--sf-cat-ratio, 2000 / 1414);
  object-fit: contain;
  background: color-mix(in srgb, var(--palette-cream) 80%, #ddd);
}

@media (min-width: 720px) {
  .sf-catalog-link__inner {
    grid-template-columns: 1fr min(14rem, 32%);
    text-align: left;
    max-width: 44rem;
  }

  .sf-catalog-link__preview {
    margin-inline: 0;
    max-width: none;
  }
}

/* Desktop shows viewer; mobile shows stack */
@media (min-width: 1024px) {
  .sf-cat-stack {
    display: none;
  }

  .sf-cat-viewer {
    display: flex;
  }

  .sf-catalog-page__main {
    padding-block: 0.75rem 1.75rem;
  }

  .sf-catalog-page__intro {
    margin-bottom: 0.65rem;
  }

  .sf-catalog-page__lead {
    max-width: 28rem;
    margin-inline: auto;
  }
}

/* Fit taller viewports — keep stage inside first screen */
@media (min-width: 1024px) and (max-height: 820px) {
  .sf-cat-viewer__stage,
  .sf-cat-viewer__frame {
    max-height: calc(100dvh - 12rem);
  }

  .sf-cat-viewer__frame {
    width: min(100%, calc((100dvh - 12rem) * (2000 / 1414)));
  }

  .sf-cat-viewer__thumb {
    width: 3.6rem;
  }
}

/* Slightly tighter header nav when Catalog is present */
@media (min-width: 1024px) {
  .storefront-2026 .sf-nav-desktop {
    gap: 0.72rem;
  }

  .storefront-2026 .sf-nav-desktop a {
    font-size: 0.76rem;
    letter-spacing: 0.01em;
  }
}

@media (min-width: 1280px) {
  .storefront-2026 .sf-nav-desktop {
    gap: 0.9rem;
  }

  .storefront-2026 .sf-nav-desktop a {
    font-size: 0.8125rem;
  }
}
