/* Catalog and product detail routes. Loaded after the shared editorial layer. */
.catalog-reference-page,
.product-reference-page {
  --subpage-ink: #171717;
  --subpage-muted: #626262;
  --subpage-line: #e4e4e1;
  background: #fff;
  color: var(--subpage-ink);
}

.catalog-reference-page .catalog-hero {
  min-height: 0;
  padding: clamp(52px, 7vw, 108px) var(--store-gutter, 32px) clamp(36px, 5vw, 68px);
  border: 0;
  background: #fff;
  text-align: center;
}

.catalog-reference-page .catalog-hero h1 {
  max-width: none;
  margin: 0;
  color: var(--subpage-ink);
  font-family: var(--sans, Pretendard, sans-serif);
  font-size: clamp(30px, 3vw, 44px);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -.045em;
}

.catalog-reference-page .catalog-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 var(--store-gutter, 32px) clamp(80px, 10vw, 144px);
}

.catalog-reference-page .catalog-toolbar {
  position: relative;
  top: auto;
  display: grid;
  grid-template-columns: auto minmax(220px, 360px) minmax(0, 1fr) auto;
  gap: 12px 20px;
  min-height: 0;
  padding: 18px 0;
  border-top: 1px solid var(--subpage-line);
  border-bottom: 1px solid var(--subpage-line);
  background: #fff;
  backdrop-filter: none;
}

.catalog-reference-page .catalog-toolbar h2 {
  display: flex;
  gap: 5px;
  align-items: center;
  margin: 0;
  color: var(--subpage-ink);
  font-size: .875rem;
  font-weight: 500;
  letter-spacing: -.02em;
  text-transform: none;
  white-space: nowrap;
}

.catalog-reference-page .catalog-toolbar h2 span { color: var(--subpage-muted); font-variant-numeric: tabular-nums; }
.catalog-reference-page [data-catalog-search] { max-width: none; min-width: 0; gap: 0; }
.catalog-reference-page [data-catalog-search] input { min-height: 44px; border-color: var(--subpage-line); border-right: 0; color: var(--subpage-ink); }
.catalog-reference-page [data-catalog-search] .catalog-search-submit { min-width: 54px; min-height: 44px; border-color: var(--subpage-ink); background: var(--subpage-ink); color: #fff; }
.catalog-reference-page [data-catalog-search] .catalog-search-submit:hover { border-color: var(--subpage-ink); background: #353535; color: #fff; }

.catalog-reference-page .filter-group {
  display: flex;
  min-width: 0;
  gap: 6px;
  justify-content: flex-end;
  overflow-x: auto;
  scrollbar-width: thin;
}

.catalog-reference-page .filter-group span {
  min-height: 44px;
  padding-inline: 12px;
  border-color: var(--subpage-line);
  color: var(--subpage-muted);
  font-size: .8125rem;
  white-space: nowrap;
}

.catalog-reference-page .filter-group input:checked + span,
.catalog-reference-page .filter-group input:focus-visible + span { border-color: var(--subpage-ink); background: var(--subpage-ink); color: #fff; }
.catalog-reference-page .sort-control { gap: 8px; color: var(--subpage-muted); font-size: .8125rem; white-space: nowrap; }
.catalog-reference-page .sort-control select { min-height: 44px; border-color: var(--subpage-line); color: var(--subpage-ink); font-size: .875rem; }

.catalog-reference-page .catalog-state:empty,
.product-reference-page [data-product-state]:empty { display: none; }
.catalog-reference-page .catalog-state { margin: 20px 0 0; color: var(--subpage-muted); font-size: .875rem; }
.catalog-reference-page .catalog-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(34px, 4vw, 64px) clamp(12px, 1.75vw, 28px);
  padding-top: clamp(32px, 4vw, 56px);
}

.catalog-reference-page .catalog-card { min-width: 0; }
.catalog-reference-page .catalog-card figure {
  display: grid;
  aspect-ratio: 1;
  margin: 0;
  overflow: hidden;
  background: #fff;
}

.catalog-reference-page .catalog-card figure > :is(img, .catalog-image-empty) {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: none;
  transition: opacity .18s ease, transform .18s ease;
}

.catalog-reference-page .catalog-card a:hover figure > img { transform: scale(1.012); }
.catalog-reference-page .catalog-card a { color: inherit; text-decoration: none; }
.catalog-reference-page .catalog-card div { display: grid; gap: 5px; padding-top: 14px; text-align: center; }
.catalog-reference-page .catalog-card h3 { margin: 0; color: var(--subpage-ink); font-family: var(--sans, Pretendard, sans-serif); font-size: .9375rem; font-weight: 500; line-height: 1.6; letter-spacing: -.025em; overflow-wrap: anywhere; }
.catalog-reference-page .catalog-card span { color: var(--subpage-ink); font-size: .875rem; font-variant-numeric: tabular-nums; line-height: 1.5; }
.catalog-reference-page .catalog-card a:focus-visible,
.catalog-reference-page :is(input, select, button, a):focus-visible,
.product-reference-page :is(input, select, button, a):focus-visible { outline: 2px solid var(--subpage-ink); outline-offset: 4px; }
.catalog-reference-page .catalog-empty { padding: clamp(72px, 12vw, 160px) 16px; background: #fff; text-align: center; }

.product-reference-page { display: flow-root; padding: clamp(24px, 4vw, 56px) var(--store-gutter, 32px) clamp(80px, 9vw, 140px); }
.product-reference-page [data-product-state] { max-width: 1360px; margin: 0 auto 16px; color: var(--subpage-muted); font-size: .875rem; }
.product-reference-page .product-detail {
  max-width: 1360px;
  margin: 0 auto;
  grid-template-columns: minmax(0, 1.16fr) minmax(380px, .84fr);
  border: 0;
  background: #fff;
}

.product-reference-page .product-gallery { padding: 0 clamp(18px, 2vw, 36px) 0 0; background: #fff; }
.product-reference-page .product-gallery-main { min-height: 0; aspect-ratio: 1; background: #fff; }
.product-reference-page .product-gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.product-reference-page .product-thumbnails { grid-template-columns: repeat(6, minmax(44px, 1fr)); gap: 8px; margin-top: 12px; }
.product-reference-page .product-thumbnails[hidden] { display: none; }
.product-reference-page .product-thumbnails button { width: 100%; background: #fff; border-color: var(--subpage-line); opacity: 1; }
.product-reference-page .product-thumbnails button:hover,
.product-reference-page .product-thumbnails button:focus-visible,
.product-reference-page .product-thumbnails button.is-active { border-color: var(--subpage-ink); }

.product-reference-page .product-buybox {
  position: sticky;
  top: calc(var(--store-header-offset, 142px) + 24px);
  min-height: 0;
  padding: clamp(20px, 3vw, 52px);
  border: 1px solid var(--subpage-line);
  background: #fff;
}

.product-reference-page .breadcrumbs { margin: 0 0 30px; color: var(--subpage-muted); font-size: .8125rem; }
.product-reference-page .product-sales-mode { margin-bottom: 16px; border-color: var(--subpage-line); color: var(--subpage-muted); letter-spacing: 0; }
.product-reference-page .product-buybox h1 { margin: 0 0 18px; color: var(--subpage-ink); font-family: var(--sans, Pretendard, sans-serif); font-size: clamp(28px, 2.6vw, 40px); font-weight: 500; line-height: 1.38; letter-spacing: -.045em; }
.product-reference-page .product-summary { color: var(--subpage-muted); font-size: .9375rem; line-height: 1.8; }
.product-reference-page .product-price { margin-top: 24px; padding-bottom: 20px; border-color: var(--subpage-line); }
.product-reference-page .product-price strong { color: var(--subpage-ink); font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.product-reference-page .product-price span { color: var(--subpage-muted); font-size: .8125rem; }
.product-reference-page .product-facts { margin-bottom: 24px; }
.product-reference-page .product-facts div { grid-template-columns: 96px minmax(0, 1fr); border-color: var(--subpage-line); }
.product-reference-page .product-facts :is(dt, dd) { font-size: .875rem; line-height: 1.65; }
.product-reference-page .product-facts dt { color: var(--subpage-muted); }
.product-reference-page .product-options .select-field > span { color: var(--subpage-ink); font-size: .9375rem; font-weight: 500; }
.product-reference-page .product-options select { width: 100%; min-height: 48px; border-color: var(--subpage-line); color: var(--subpage-ink); font-size: 1rem; }
.product-reference-page .product-total { padding: 20px 0; border-color: var(--subpage-ink); }
.product-reference-page .product-total span { font-size: .875rem; }
.product-reference-page .product-total strong { color: var(--subpage-ink); font-family: var(--sans, Pretendard, sans-serif); font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.product-reference-page .product-options :is(.product-submit, .product-add-to-cart),
.product-reference-page .product-consult { min-height: 48px; border-color: var(--subpage-ink); border-radius: 0; }
.product-reference-page .product-options .product-submit { background: var(--subpage-ink); color: #fff; }
.product-reference-page .product-options .product-add-to-cart { color: var(--subpage-ink); }
.product-reference-page .product-secondary-actions { margin-top: 16px; gap: 10px; }
.product-reference-page .product-secondary-actions > button { min-height: 44px; padding: 8px 12px; border-color: var(--subpage-line); background: #fff; color: var(--subpage-ink); font-size: .875rem; }

@media (max-width: 1060px) {
  .catalog-reference-page .catalog-toolbar { grid-template-columns: auto 1fr auto; }
  .catalog-reference-page [data-catalog-search] { grid-column: 1 / -1; grid-row: 2; }
  .catalog-reference-page .filter-group { justify-content: flex-start; }
  .product-reference-page .product-detail { grid-template-columns: minmax(0, 1fr) minmax(340px, .8fr); }
}

@media (max-width: 760px) {
  html:has(.product-reference-page) { scroll-padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
  .catalog-reference-page .catalog-hero { padding: 40px 20px 30px; }
  .catalog-reference-page .catalog-hero h1 { font-size: 28px; }
  .catalog-reference-page .catalog-shell { padding: 0 16px 72px; }
  .catalog-reference-page .catalog-toolbar { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px 0; }
  .catalog-reference-page .catalog-toolbar h2 { font-size: .8125rem; }
  .catalog-reference-page [data-catalog-search] { grid-column: 1 / -1; grid-row: 2; }
  .catalog-reference-page .filter-group { grid-column: 1 / -1; grid-row: 3; justify-content: flex-start; padding-bottom: 2px; }
  .catalog-reference-page .sort-control { grid-column: 2; grid-row: 1; }
  .catalog-reference-page .sort-control > select { max-width: 130px; }
  .catalog-reference-page .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 34px 12px; padding-top: 30px; }
  .catalog-reference-page .catalog-card h3 { font-size: .875rem; }
  .catalog-reference-page .catalog-card span { font-size: .8125rem; }

  .product-reference-page { padding: 0 0 calc(104px + env(safe-area-inset-bottom)); }
  .product-reference-page [data-product-state] { margin: 14px 16px; }
  .product-reference-page .product-detail { grid-template-columns: minmax(0, 1fr); }
  .product-reference-page .product-gallery { padding: 0; }
  .product-reference-page .product-thumbnails { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 12px 16px 0; }
  .product-reference-page .product-buybox { position: relative; top: auto; margin-top: 30px; padding: 30px 20px; border-right: 0; border-left: 0; }
  .product-reference-page .breadcrumbs { margin-bottom: 24px; }
  .product-reference-page .product-buybox h1 { font-size: clamp(26px, 8vw, 32px); }
  .mobile-purchase-bar { min-height: 76px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: #fff; }
  body:has(.product-reference-page) .mobile-purchase-bar { grid-template-columns: minmax(0, 1fr) minmax(140px, 1.2fr); gap: 12px; }
  body:has(.product-reference-page) .mobile-purchase-bar > div { min-width: 0; }
  body:has(.product-reference-page) .mobile-purchase-bar strong { white-space: nowrap; font-size: clamp(14px, 4.5vw, 18px); }
  body:has(.product-reference-page) .mobile-purchase-bar button { min-height: 48px; min-width: 0; padding-inline: 8px; white-space: nowrap; background: var(--ink); font-size: .875rem; }
}

@media (prefers-reduced-motion: reduce) {
  .catalog-reference-page .catalog-card figure > img { transition: none; }
}
:where(.catalog-reference-page, .product-reference-page) [hidden] { display: none !important; }
