/* Final card presentation layer. Loaded last to keep standard/list layouts consistent. */

/* Standard view keeps tax-included and tax-excluded prices; list view shows tax-included only. */
body.catalog-view-compact .product-price-ex-tax,
body.catalog-view-compact .product-price-divider,
body.catalog-view-compact .product-price-label {
  display: none !important;
}

.product-price-in-tax {
  display: inline !important;
  color: var(--catalog-ink);
  font-weight: 700;
}

.product-price-in-tax::after {
  content: '（税込）';
  margin-left: 3px;
  color: var(--catalog-muted);
  font-size: 0.86em;
  font-weight: 400;
}

/* Shared image area for standard and list views. */
.product {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.catalog-product-media {
  width: 100%;
  background: #fff;
}

.catalog-product-main-image,
.product > img {
  display: block;
  width: 100%;
  height: auto !important;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 0 !important;
}

.catalog-product-thumbnails {
  display: flex;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px 2px;
  overflow-x: auto;
  scrollbar-width: thin;
  background: #fff;
}

.catalog-product-thumb {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  padding: 2px;
  border: 1px solid #d4d9dd;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
}

.catalog-product-thumb:hover {
  border-color: var(--catalog-gold);
}

.catalog-product-thumb.is-active {
  border: 2px solid var(--catalog-ink);
}

.catalog-product-thumb:focus-visible {
  outline: 2px solid var(--catalog-gold);
  outline-offset: 2px;
}

.catalog-product-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 2px;
}

/* Standard view keeps the approved B2B specification layout. */
body:not(.catalog-view-compact) .product {
  padding: 0 !important;
}

body:not(.catalog-view-compact) .product > .product-info {
  flex: 1 1 auto;
  box-sizing: border-box;
  width: 100%;
  margin-top: 0;
  padding: 14px 16px 0;
}

body:not(.catalog-view-compact) .product > .product-inquiry-choice {
  width: auto;
  margin: auto 16px 16px;
}

/* List view: same information hierarchy as standard, denser presentation. */
body.catalog-view-compact .product {
  padding: 0 !important;
}

body.catalog-view-compact .product-info {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  box-sizing: border-box;
  width: 100%;
  margin-top: 0;
  padding: 10px 10px 0;
  text-align: left;
}

body.catalog-view-compact .product-info .product-field {
  display: grid !important;
  grid-template-columns: 58px minmax(0, 1fr);
  column-gap: 7px;
  align-items: baseline;
  margin: 2px 0;
  color: var(--catalog-ink-soft);
  font-size: 12px;
  line-height: 1.4;
}

body.catalog-view-compact .product-info .product-field > strong,
body.catalog-view-compact .product-variant-control > strong {
  display: block !important;
  color: var(--catalog-muted);
  font-size: 11px !important;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

body.catalog-view-compact .product-info .product-field-name {
  order: 1;
  display: block !important;
  margin: 0 0 7px;
  color: var(--catalog-ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

/* Product name is the heading itself; no visible "商品名" label. */
body.catalog-view-compact .product-info .product-field-name > strong,
body:not(.catalog-view-compact) .product-info .product-field-name > strong {
  display: none !important;
}

body.catalog-view-compact .product-field-maker { order: 2; }
body.catalog-view-compact .product-field-item { order: 3; }
body.catalog-view-compact .product-field-variant {
  order: 4;
  display: block !important;
}
body.catalog-view-compact .product-field-dimension { order: 5; }
body.catalog-view-compact .product-field-price { order: 6; }
body.catalog-view-compact .product-field-number {
  order: 7;
  display: grid !important;
  margin-top: 4px !important;
}

/* Render concise labels while keeping original DOM text for inquiry extraction.
   Include .product-info in every selector so these rules outrank the generic
   compact-label rule above; this prevents duplicated labels such as 窯元:窯元. */
body.catalog-view-compact .product-info .product-field-maker > strong,
body.catalog-view-compact .product-info .product-field-item > strong,
body.catalog-view-compact .product-info .product-field-dimension > strong,
body.catalog-view-compact .product-info .product-field-price > strong,
body.catalog-view-compact .product-info .product-field-number > strong {
  font-size: 0 !important;
}

body.catalog-view-compact .product-info .product-field-maker > strong::after,
body.catalog-view-compact .product-info .product-field-item > strong::after,
body.catalog-view-compact .product-info .product-field-dimension > strong::after,
body.catalog-view-compact .product-info .product-field-price > strong::after,
body.catalog-view-compact .product-info .product-field-number > strong::after {
  color: var(--catalog-muted);
  font-size: 11px !important;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

body.catalog-view-compact .product-info .product-field-maker > strong::after { content: '窯元'; }
body.catalog-view-compact .product-info .product-field-item > strong::after { content: 'アイテム'; }
body.catalog-view-compact .product-info .product-field-dimension > strong::after { content: 'サイズ'; }
body.catalog-view-compact .product-info .product-field-price > strong::after { content: '価格'; }
body.catalog-view-compact .product-info .product-field-number > strong::after { content: '商品番号'; }

body.catalog-view-compact .product-variant-controls {
  gap: 5px;
}

body.catalog-view-compact .product-variant-control {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 7px;
}

body.catalog-view-compact .product-variant-control select {
  min-width: 0;
  width: 100%;
  min-height: 34px;
  font-size: 12px;
}

body.catalog-view-compact .product > .product-inquiry-choice {
  width: auto;
  margin: auto 10px 10px;
}

body.catalog-view-compact .catalog-product-thumbnails {
  padding: 6px 8px 0;
}

body.catalog-view-compact .catalog-product-thumb {
  flex-basis: 40px;
  width: 40px;
  height: 40px;
}

/* Standard variant rows contain a nested grid. The outer product-field grid
   must not constrain that nested control to the label column. */
body:not(.catalog-view-compact) .product-info .product-field-variant {
  display: block !important;
  width: 100%;
}

body:not(.catalog-view-compact) .product-info .product-field-variant .product-variant-control {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
}

body:not(.catalog-view-compact) .product-info .product-field-variant select {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

@media (max-width: 768px) {
  body:not(.catalog-view-compact) .product > .product-info,
  body.catalog-view-compact .product > .product-info {
    padding: 10px 10px 0;
  }

  body:not(.catalog-view-compact) .product > .product-inquiry-choice,
  body.catalog-view-compact .product > .product-inquiry-choice {
    width: auto;
    margin: auto 10px 10px;
  }

  body:not(.catalog-view-compact) .product-info .product-field-variant .product-variant-control {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
  }

  body.catalog-view-compact .product-info .product-field {
    grid-template-columns: 54px minmax(0, 1fr);
    column-gap: 6px;
    font-size: 12px;
  }

  body.catalog-view-compact .product-info .product-field-name {
    font-size: 13px;
  }

  body.catalog-view-compact .product-info .product-field-maker > strong::after,
  body.catalog-view-compact .product-info .product-field-item > strong::after,
  body.catalog-view-compact .product-info .product-field-dimension > strong::after,
  body.catalog-view-compact .product-info .product-field-price > strong::after,
  body.catalog-view-compact .product-info .product-field-number > strong::after,
  body.catalog-view-compact .product-variant-control > strong {
    font-size: 10px !important;
  }

  body.catalog-view-compact .product-variant-control {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }

  .catalog-product-thumb {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
  }
}

@media print {
  .catalog-product-thumbnails {
    display: none !important;
  }
}
