/* Final catalog card fixes loaded after all other catalog styles. */

/* Standard variant selector: keep the control compact and visually consistent
   with the specification table instead of stretching like a form field. */
body:not(.catalog-view-compact) .product-info .product-field-variant {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
}

body:not(.catalog-view-compact) .product-info .product-field-variant > .product-variant-control {
  display: grid !important;
  grid-template-columns: 82px max-content !important;
  align-items: center !important;
  justify-content: start !important;
  gap: 10px !important;
  width: 100% !important;
  min-width: 0 !important;
}

body:not(.catalog-view-compact) .product-info .product-field-variant select {
  display: block !important;
  box-sizing: border-box !important;
  width: auto !important;
  min-width: 104px !important;
  max-width: 190px !important;
  min-height: 30px !important;
  padding: 3px 26px 3px 8px !important;
  border: 1px solid #cfd6dc !important;
  border-radius: 5px !important;
  background-color: #fff !important;
  color: var(--catalog-ink-soft) !important;
  font-size: 13px !important;
  line-height: 1.35 !important;
  box-shadow: none !important;
}

/* Size-only variants are short values such as 3寸 / 5.5寸 / 特大. */
body:not(.catalog-view-compact) .product-info .product-field-variant select[data-variant-control="variant"] {
  width: 112px !important;
}

/* Name/combined selectors can contain longer labels, so allow a little more room. */
body:not(.catalog-view-compact) .product-info .product-field-variant select[data-variant-control="name"] {
  width: 150px !important;
}

body:not(.catalog-view-compact) .product-info .product-field-variant select[data-variant-control="combined"] {
  width: 190px !important;
}

body:not(.catalog-view-compact) .product-info .product-field-variant select:focus-visible {
  outline: 2px solid var(--catalog-ink-soft) !important;
  outline-offset: 1px !important;
}

/* Gallery thumbnails overlay the image so cards with multiple images keep the
   same information start position as single-image cards. The overlay is kept
   visually subordinate to the product image: inactive thumbnails are muted,
   while the selected image remains crisp. */
.catalog-product-media {
  position: relative !important;
}

.catalog-product-thumbnails {
  position: absolute !important;
  left: 10px !important;
  bottom: 10px !important;
  z-index: 3 !important;
  width: auto !important;
  max-width: calc(100% - 20px) !important;
  box-sizing: border-box !important;
  padding: 5px !important;
  border: 1px solid rgba(82, 95, 105, 0.16) !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.64) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.catalog-product-thumbnails .catalog-product-thumb {
  border: 1px solid rgba(90, 100, 108, 0.28) !important;
  background: rgba(255, 255, 255, 0.58) !important;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.catalog-product-thumbnails .catalog-product-thumb img {
  opacity: 0.58;
  transition: opacity 0.16s ease;
}

.catalog-product-thumbnails .catalog-product-thumb:hover {
  border-color: rgba(70, 78, 84, 0.48) !important;
  background: rgba(255, 255, 255, 0.86) !important;
}

.catalog-product-thumbnails .catalog-product-thumb:hover img {
  opacity: 0.88;
}

.catalog-product-thumbnails .catalog-product-thumb.is-active {
  border: 1px solid rgba(67, 76, 83, 0.72) !important;
  background: rgba(255, 255, 255, 0.96) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14) !important;
}

.catalog-product-thumbnails .catalog-product-thumb.is-active img {
  opacity: 1;
}

.catalog-product-thumbnails .catalog-product-thumb:focus-visible {
  outline: 2px solid var(--catalog-ink-soft) !important;
  outline-offset: 2px !important;
}

@media (max-width: 768px) {
  body:not(.catalog-view-compact) .product-info .product-field-variant > .product-variant-control {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 4px !important;
  }

  body:not(.catalog-view-compact) .product-info .product-field-variant select,
  body:not(.catalog-view-compact) .product-info .product-field-variant select[data-variant-control="variant"],
  body:not(.catalog-view-compact) .product-info .product-field-variant select[data-variant-control="name"],
  body:not(.catalog-view-compact) .product-info .product-field-variant select[data-variant-control="combined"] {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 36px !important;
  }

  .catalog-product-thumbnails {
    left: 8px !important;
    bottom: 8px !important;
    max-width: calc(100% - 16px) !important;
    padding: 4px !important;
  }
}


/* Catalog card surface hierarchy: keep product photography pure white while
   separating the B2B information area with a near-white neutral surface. */
.product {
  background: #fafaf8 !important;
  border: 1px solid rgba(0,42,65,.12) !important;
}

.catalog-product-media {
  background: #fff !important;
}

body:not(.catalog-view-compact) .product > .product-info,
body.catalog-view-compact .product > .product-info {
  background: #fafaf8 !important;
  border-top: 1px solid rgba(0,42,65,.09) !important;
}

body:not(.catalog-view-compact) .product > .product-inquiry-choice,
body.catalog-view-compact .product > .product-inquiry-choice {
  background: #fafaf8 !important;
}


/* Compact desktop/tablet price: keep tax-included amount and tax note on one line. */
@media (min-width: 769px) {
  body.catalog-view-compact .product-price-values {
    font-size: 11px;
    line-height: 1.3;
  }

  body.catalog-view-compact .product-price-in-tax {
    white-space: nowrap;
  }

  body.catalog-view-compact .product-price-in-tax::after {
    margin-left: 2px;
    font-size: 9px;
  }
}


/* Final mobile price normalization: two-column cards show tax-included price only. */
@media (max-width: 768px) {
  body:not(.catalog-view-compact) .product-info .product-field-price,
  body.catalog-view-compact .product-info .product-field-price {
    display: grid !important;
    grid-template-columns: 48px minmax(0, 1fr) !important;
    column-gap: 6px;
    align-items: baseline;
    margin-top: 5px;
  }

  body:not(.catalog-view-compact) .product-info .product-field-price > strong,
  body.catalog-view-compact .product-info .product-field-price > strong {
    display: block !important;
    font-size: 0 !important;
  }

  body:not(.catalog-view-compact) .product-info .product-field-price > strong::after,
  body.catalog-view-compact .product-info .product-field-price > strong::after {
    content: '価格';
    color: var(--catalog-muted);
    font-size: 11px !important;
    font-weight: 600;
    white-space: nowrap;
  }

  body:not(.catalog-view-compact) .product-price-values,
  body.catalog-view-compact .product-price-values {
    display: block !important;
    min-width: 0;
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
  }

  body:not(.catalog-view-compact) .product-price-ex-tax,
  body:not(.catalog-view-compact) .product-price-divider,
  body.catalog-view-compact .product-price-ex-tax,
  body.catalog-view-compact .product-price-divider {
    display: none !important;
  }

  body:not(.catalog-view-compact) .product-price-label,
  body.catalog-view-compact .product-price-label {
    display: none !important;
  }

  body:not(.catalog-view-compact) .product-price-in-tax,
  body.catalog-view-compact .product-price-in-tax {
    display: inline !important;
    white-space: nowrap;
    color: var(--catalog-ink);
    font-weight: 700;
  }

  body:not(.catalog-view-compact) .product-price-in-tax::after,
  body.catalog-view-compact .product-price-in-tax::after {
    content: '（税込）';
    margin-left: 3px;
    color: var(--catalog-muted);
    font-size: 10px;
    font-weight: 400;
  }
}

@media (max-width: 360px) {
  body:not(.catalog-view-compact) .product-info .product-field-price,
  body.catalog-view-compact .product-info .product-field-price {
    grid-template-columns: 42px minmax(0, 1fr) !important;
    column-gap: 4px;
  }

  body:not(.catalog-view-compact) .product-price-values,
  body.catalog-view-compact .product-price-values {
    font-size: 11px;
  }

  body:not(.catalog-view-compact) .product-price-in-tax::after,
  body.catalog-view-compact .product-price-in-tax::after {
    margin-left: 2px;
    font-size: 9px;
  }
}


/* Final mobile metadata alignment: one fixed label column for all product facts. */
@media (max-width: 768px) {
  body:not(.catalog-view-compact) .product-info .product-field-maker,
  body:not(.catalog-view-compact) .product-info .product-field-item,
  body:not(.catalog-view-compact) .product-info .product-field-dimension,
  body:not(.catalog-view-compact) .product-info .product-field-price,
  body:not(.catalog-view-compact) .product-info .product-field-number,
  body.catalog-view-compact .product-info .product-field-maker,
  body.catalog-view-compact .product-info .product-field-item,
  body.catalog-view-compact .product-info .product-field-dimension,
  body.catalog-view-compact .product-info .product-field-price,
  body.catalog-view-compact .product-info .product-field-number {
    display: grid !important;
    grid-template-columns: 58px minmax(0, 1fr) !important;
    column-gap: 7px;
    align-items: start;
    width: 100%;
    max-width: none;
    margin: 3px 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--catalog-ink-soft);
    font-size: 11px;
    line-height: 1.4;
  }

  body:not(.catalog-view-compact) .product-info .product-field-maker > strong,
  body:not(.catalog-view-compact) .product-info .product-field-item > strong,
  body:not(.catalog-view-compact) .product-info .product-field-dimension > strong,
  body:not(.catalog-view-compact) .product-info .product-field-price > strong,
  body:not(.catalog-view-compact) .product-info .product-field-number > strong,
  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 {
    display: block !important;
    min-width: 0;
    margin: 0;
    color: var(--catalog-muted);
    font-size: 0 !important;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
  }

  body:not(.catalog-view-compact) .product-info .product-field-maker > strong::after,
  body.catalog-view-compact .product-info .product-field-maker > strong::after {
    content: '窯元';
    font-size: 11px !important;
  }

  body:not(.catalog-view-compact) .product-info .product-field-item > strong::after,
  body.catalog-view-compact .product-info .product-field-item > strong::after {
    content: 'アイテム';
    font-size: 11px !important;
  }

  body:not(.catalog-view-compact) .product-info .product-field-dimension > strong::after,
  body.catalog-view-compact .product-info .product-field-dimension > strong::after {
    content: 'サイズ';
    font-size: 11px !important;
  }

  body:not(.catalog-view-compact) .product-info .product-field-price > strong::after,
  body.catalog-view-compact .product-info .product-field-price > strong::after {
    content: '価格';
    font-size: 11px !important;
  }

  body:not(.catalog-view-compact) .product-info .product-field-number > strong::after,
  body.catalog-view-compact .product-info .product-field-number > strong::after {
    content: '商品番号';
    font-size: 11px !important;
  }

  body:not(.catalog-view-compact) .product-field-maker span,
  body:not(.catalog-view-compact) .product-field-dimension span,
  body.catalog-view-compact .product-field-maker span,
  body.catalog-view-compact .product-field-dimension span {
    min-width: 0;
    color: var(--catalog-ink-soft);
  }

  body:not(.catalog-view-compact) .product-price-values,
  body.catalog-view-compact .product-price-values {
    min-width: 0;
    margin: 0;
    align-self: start;
  }

  body:not(.catalog-view-compact) .product-field-number,
  body.catalog-view-compact .product-field-number {
    color: var(--catalog-ink-soft) !important;
    font-size: 11px !important;
  }
}

@media (max-width: 360px) {
  body:not(.catalog-view-compact) .product-info .product-field-maker,
  body:not(.catalog-view-compact) .product-info .product-field-item,
  body:not(.catalog-view-compact) .product-info .product-field-dimension,
  body:not(.catalog-view-compact) .product-info .product-field-price,
  body:not(.catalog-view-compact) .product-info .product-field-number,
  body.catalog-view-compact .product-info .product-field-maker,
  body.catalog-view-compact .product-info .product-field-item,
  body.catalog-view-compact .product-info .product-field-dimension,
  body.catalog-view-compact .product-info .product-field-price,
  body.catalog-view-compact .product-info .product-field-number {
    grid-template-columns: 52px minmax(0, 1fr) !important;
    column-gap: 5px;
  }
}


/* Price guidance: explain tax treatment once on mobile instead of repeating it on every card. */
.catalog-price-note-mobile {
  display: none;
}

@media (max-width: 768px) {
  .catalog-price-note-desktop {
    display: none;
  }

  .catalog-price-note-mobile {
    display: inline;
  }

  body:not(.catalog-view-compact) .product-price-in-tax::after,
  body.catalog-view-compact .product-price-in-tax::after {
    content: none !important;
    margin-left: 0 !important;
  }
}


/* Final mobile variant alignment: keep the selector in the same label/value grid as product facts. */
@media (max-width: 768px) {
  body:not(.catalog-view-compact) .product-info .product-field-variant,
  body.catalog-view-compact .product-info .product-field-variant {
    display: block !important;
    width: 100% !important;
    margin: 3px 0 !important;
  }

  body:not(.catalog-view-compact) .product-info .product-field-variant > .product-variant-control,
  body.catalog-view-compact .product-info .product-field-variant > .product-variant-control {
    display: grid !important;
    grid-template-columns: 58px minmax(0, 1fr) !important;
    column-gap: 7px !important;
    align-items: center !important;
    width: 100% !important;
    margin: 3px 0 !important;
  }

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

  body:not(.catalog-view-compact) .product-info .product-field-variant select,
  body.catalog-view-compact .product-info .product-field-variant select {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 34px !important;
    margin: 0 !important;
  }
}

@media (max-width: 360px) {
  body:not(.catalog-view-compact) .product-info .product-field-variant > .product-variant-control,
  body.catalog-view-compact .product-info .product-field-variant > .product-variant-control {
    grid-template-columns: 52px minmax(0, 1fr) !important;
    column-gap: 5px !important;
  }
}


/* Legacy mobile variant pseudo-label override. */
@media (max-width: 768px) {
  .product-field-variant strong::after,
  .catalog-view-compact .product-field-variant strong::after {
    content: none !important;
    display: none !important;
  }
}


/* Compact mobile variant selector width: fit the option text instead of filling the value column. */
@media (max-width: 768px) {
  body:not(.catalog-view-compact) .product-info .product-field-variant select,
  body.catalog-view-compact .product-info .product-field-variant select {
    width: auto !important;
    min-width: 72px !important;
    max-width: 100% !important;
    justify-self: start !important;
    field-sizing: content;
    padding-right: 26px !important;
  }
}


/* Anchored custom variant dropdown: replaces the OS-native popup. */
.product-variant-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.product-variant-custom {
  position: relative;
  display: inline-block;
  max-width: 100%;
  justify-self: start;
}

.product-variant-trigger {
  position: relative;
  box-sizing: border-box;
  min-width: 72px;
  min-height: 30px;
  padding: 4px 26px 4px 9px;
  border: 1px solid #bfc8cf;
  border-radius: 5px;
  background: #fff;
  color: var(--catalog-ink-soft);
  font: inherit;
  font-size: 12px;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.product-variant-trigger::after {
  content: '▼';
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  color: var(--catalog-muted);
  font-size: 9px;
}

.product-variant-trigger:hover {
  border-color: var(--catalog-ink);
}

.product-variant-trigger:focus-visible,
.product-variant-option:focus-visible {
  outline: 2px solid var(--catalog-ink);
  outline-offset: 2px;
}

.product-variant-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 500;
  box-sizing: border-box;
  min-width: max(100%, 88px);
  max-width: min(220px, calc(100vw - 32px));
  padding: 4px;
  border: 1px solid var(--catalog-line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(0, 42, 65, .16);
}

.product-variant-menu[hidden] {
  display: none !important;
}

.product-variant-option {
  display: block;
  width: 100%;
  min-height: 30px;
  padding: 6px 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--catalog-ink);
  font: inherit;
  font-size: 12px;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.product-variant-option:hover,
.product-variant-option.is-current {
  background: var(--catalog-hover);
}

.product.is-variant-open {
  position: relative;
  z-index: 250;
  overflow: visible !important;
}

@media (max-width: 768px) {
  .product-variant-trigger {
    min-width: 72px;
    min-height: 30px;
    font-size: 12px;
  }

  .product-variant-option {
    min-height: 32px;
    font-size: 12px;
  }
}


/* Mobile variant typography normalization: match catalog metadata text size. */
@media (max-width: 768px) {
  .product-variant-trigger,
  .product-variant-option {
    font-size: 11px !important;
  }
}


/* Native variant select overflow guard: beat mobile select sizing and keep the hidden source select truly 1px wide. */
@media (max-width: 768px) {
  body:not(.catalog-view-compact) .product-info .product-field-variant select.product-variant-native,
  body.catalog-view-compact .product-info .product-field-variant select.product-variant-native {
    width: 1px !important;
    min-width: 1px !important;
    max-width: 1px !important;
    height: 1px !important;
    min-height: 1px !important;
    max-height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    field-sizing: fixed !important;
  }
}
