/*
 * MIGNO TOKYO 17.1.0
 * Product-image recovery, ranking integration, and public catalogue filters.
 * No new decorative artwork is introduced in this release.
 */

.trend-hero-v15 .hero-title-line-custom {
  white-space: normal;
}

/* Keep the preview notice and header in separate layout rows. */
.cp-demo-active .site-header {
  position: sticky;
}

/* --------------------------------------------------------------------------
 * Product media recovery.
 * Keep the card visible even when an external Amazon / official URL expires.
 * ----------------------------------------------------------------------- */
.product-card-v17 .product-image-wrap {
  position: relative;
  isolation: isolate;
}

.product-card-v17 .product-image-link {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 100%;
  opacity: 1 !important;
  visibility: visible !important;
}

.product-card-v17 .product-image-link img,
.compact-rank-image img,
.voice-product-image img,
.product-detail-media img {
  display: block;
  width: auto;
  height: auto;
  opacity: 1;
  visibility: visible;
}

.product-card-v17 .product-image-link img {
  max-width: 88%;
  max-height: 146px;
  object-fit: contain;
  object-position: center;
}

.product-card-v17 .cp-product-fallback-image {
  max-width: 90%;
  max-height: 150px;
}

.product-card-v17 .product-placeholder-image {
  width: min(82%, 150px);
  max-width: 150px;
  max-height: 126px;
  border-radius: 14px;
  box-shadow: none;
  filter: none;
}

/* --------------------------------------------------------------------------
 * Rank artwork.
 * 1-3: dedicated approved shields. 4+: one approved empty pill with live text.
 * ----------------------------------------------------------------------- */
.product-card-v17 .product-rank-art {
  position: absolute;
  z-index: 8;
  pointer-events: none;
}

.product-card-v17 .product-rank-art-1,
.product-card-v17 .product-rank-art-2,
.product-card-v17 .product-rank-art-3 {
  top: 4px;
  left: 4px;
  width: 50px;
  height: 50px;
}

.product-card-v17 .product-rank-art picture,
.product-card-v17 .product-rank-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-card-v17 .product-rank-art-generic {
  top: 9px;
  left: 7px;
  width: 68px;
  height: 45px;
  display: grid;
  place-items: center;
}

.product-card-v17 .product-rank-art-generic > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.product-card-v17 .product-rank-overlay {
  position: relative;
  z-index: 2;
  min-width: 0;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  color: #fff;
  text-shadow: 0 1px 5px rgba(50, 32, 86, .32);
  line-height: 1;
}

.product-card-v17 .product-rank-overlay b {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -.03em;
}

.product-card-v17 .product-rank-overlay small {
  font-size: 8px;
  font-weight: 800;
}

/* Keep the trend badge away from the wider 4+ rank pill. */
.product-card-v17 .product-trend-badge-v10 {
  right: 43px;
}

/* Compact list uses the same exact artwork. */
.compact-rank-art {
  position: relative;
  z-index: 2;
}

.compact-rank-art-generic {
  width: 38px;
  height: 27px;
  display: grid;
  place-items: center;
}

.compact-rank-art-generic > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.compact-rank-art-generic .compact-rank-overlay {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  color: #fff;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(50, 32, 86, .30);
}

.compact-rank-art-generic .compact-rank-overlay b {
  font-size: 10px;
  font-weight: 900;
}

.compact-rank-art-generic .compact-rank-overlay small {
  font-size: 5px;
  font-weight: 800;
}

.compact-ranking > a {
  grid-template-columns: 40px 50px minmax(0, 1fr) auto 14px;
}

/* Empty state should be visible and actionable instead of looking broken. */
.cp-product-grid > .cp-empty {
  grid-column: 1 / -1;
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 34px;
  border: 1px dashed rgba(142, 99, 221, .25);
  border-radius: 20px;
  background: rgba(255, 255, 255, .82);
  color: #776d7d;
  text-align: center;
  line-height: 1.8;
}

/* --------------------------------------------------------------------------
 * Server-side product ranking and filtering.
 * Links replace the former current-DOM-only buttons, so every interaction is
 * crawlable, keyboard accessible, and applied before pagination.
 * ----------------------------------------------------------------------- */
.segmented-tabs a {
  flex: 0 0 auto;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  border-radius: 999px;
  color: #71686e;
  font-family: var(--migno-font-body);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.segmented-tabs a.active,
.segmented-tabs a[aria-current="page"] {
  color: #fff;
  background: var(--trend-gradient);
  box-shadow: 0 8px 18px rgba(208, 75, 150, .18);
}

.segmented-tabs a:focus-visible,
.category-link:focus-visible,
.hero-trends a:focus-visible,
.cp-product-filter a:focus-visible,
.cp-product-filter button:focus-visible,
.cp-product-filter input:focus-visible,
.cp-product-filter select:focus-visible {
  outline: 3px solid rgba(138, 94, 222, .35);
  outline-offset: 2px;
}

.trend-hero-v15 .hero-trends a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 15px;
  border: 1px solid rgba(255, 93, 144, .28);
  border-radius: 999px;
  color: #e54c7d;
  background: rgba(255, 255, 255, .67);
  box-shadow: 0 8px 22px rgba(82, 56, 101, .05);
  font-family: var(--migno-font-body);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.trend-hero-v15 .hero-trends a:hover {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(120deg, #ff6798, #9a75ff);
}

.cp-ranking-status,
.cp-public-policy-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(142, 99, 221, .17);
  border-radius: 12px;
  color: #655b6c;
  background: rgba(255, 255, 255, .76);
  font-size: 10px;
  line-height: 1.7;
}

.cp-ranking-status svg,
.cp-public-policy-note svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  margin-top: 1px;
  color: #8d63d9;
}

.product-discontinued-badge {
  position: absolute;
  z-index: 4;
  right: 12px;
  bottom: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(65, 61, 68, .9);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}

.product-detail-meta .product-discontinued-label {
  background: #ece9ed;
  color: #5f5962;
}

.cp-product-filter {
  margin-bottom: 20px;
  padding: 20px;
  border: 1px solid rgba(72, 55, 85, .09);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(63, 49, 76, .06);
}

.cp-product-filter-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1.35fr) minmax(170px, .8fr) minmax(170px, .8fr) minmax(190px, .8fr);
  align-items: end;
  gap: 14px;
}

.cp-filter-field {
  min-width: 0;
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  border: 0;
}

.cp-filter-field > span:first-child,
.cp-filter-field legend {
  color: #665d6d;
  font-size: 10px;
  font-weight: 800;
}

.cp-filter-field input[type="search"],
.cp-filter-field select {
  width: 100%;
  height: 46px;
  min-width: 0;
  padding: 0 13px;
  border: 1px solid #e4dce8;
  border-radius: 12px;
  color: #433b47;
  background: #fff;
  font: inherit;
  font-size: 11px;
}

.cp-filter-input-with-icon {
  position: relative;
  display: block;
}

.cp-filter-input-with-icon svg {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 13px;
  width: 17px;
  height: 17px;
  color: #8f858c;
  pointer-events: none;
  transform: translateY(-50%);
}

.cp-filter-input-with-icon input[type="search"] {
  padding-left: 39px;
}

.cp-filter-checks {
  min-height: 46px;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px solid #e4dce8;
  border-radius: 12px;
}

.cp-filter-checks legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.cp-filter-checks label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #625967;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.cp-filter-checks input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  accent-color: #9868df;
}

.cp-product-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 15px;
}

.cp-product-filter-actions button {
  min-height: 42px;
  padding: 0 19px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--trend-gradient);
  box-shadow: 0 9px 22px rgba(208, 71, 145, .17);
  font-size: 10px;
  font-weight: 800;
}

.cp-product-filter-actions a {
  color: #716878;
  font-size: 10px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cp-archive-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 16px;
}

.cp-result-summary {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.cp-result-summary strong {
  font-size: 18px;
}

.cp-result-summary span {
  color: #837987;
  font-size: 9px;
}

.cp-public-policy-note {
  border-color: rgba(87, 143, 115, .16);
  color: #52665b;
  background: rgba(244, 251, 247, .88);
}

.cp-public-policy-note svg {
  color: #56866c;
}

.product-series-summary {
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #766b7d;
}

.product-series-summary span {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid rgba(152, 104, 223, .18);
  border-radius: 999px;
  color: #7955ac;
  background: #faf7ff;
  font-size: 8px;
  font-weight: 800;
}

.product-series-summary small {
  min-width: 0;
  overflow: hidden;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-series-variants {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #e6ddea;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff 0%, #fbf8ff 100%);
}

.product-series-variants-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.product-series-variants-head b {
  font-size: 13px;
}

.product-series-variants-head span {
  color: #837789;
  font-size: 9px;
}

.product-series-variant-list {
  margin-top: 11px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.product-series-variant-list a {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid #e2d9e7;
  border-radius: 11px;
  color: #4f4654;
  background: #fff;
  text-decoration: none;
}

.product-series-variant-list a:hover,
.product-series-variant-list a:focus-visible {
  border-color: #a878d9;
  box-shadow: 0 7px 18px rgba(126, 83, 164, .1);
}

.product-series-variant-list a.is-current {
  border-color: #9868df;
  background: #f6f0ff;
  box-shadow: inset 0 0 0 1px rgba(152, 104, 223, .12);
}

.product-series-variant-list span,
.product-series-variant-list small {
  display: block;
}

.product-series-variant-list span {
  overflow: hidden;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-series-variant-list small {
  margin-top: 3px;
  color: #817587;
  font-size: 9px;
}

.product-series-variants > p {
  margin: 10px 0 0;
  color: #7b717f;
  font-size: 9px;
  line-height: 1.7;
}

@media (max-width: 980px) {
  .cp-product-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cp-archive-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .cp-archive-toolbar .segmented-tabs {
    max-width: 100%;
  }
}

@media (max-width: 1100px) {
  .product-card-v17 .product-image-link img {
    max-height: 136px;
  }
}

@media (max-width: 760px) {
  .segmented-tabs a {
    min-height: 36px;
    padding: 0 13px;
    font-size: 9px;
  }

  .trend-hero-v15 .hero-trends a {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 12px;
    font-size: 9px;
  }

  .cp-product-filter {
    padding: 15px;
    border-radius: 16px;
  }

  .cp-product-filter-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .cp-filter-field input[type="search"],
  .cp-filter-field select {
    height: 44px;
    font-size: 11px;
  }

  .cp-filter-checks {
    min-height: 44px;
  }

  .cp-product-filter-actions {
    justify-content: space-between;
  }

  .cp-product-filter-actions button {
    min-height: 44px;
  }

  .cp-ranking-status,
  .cp-public-policy-note {
    font-size: 9px;
  }

  .cp-result-summary {
    width: 100%;
    justify-content: space-between;
  }

  .product-card-v17 .product-image-link img {
    max-width: 86%;
    max-height: 108px;
  }

  .product-card-v17 .cp-product-fallback-image {
    max-height: 110px;
  }

  .product-card-v17 .product-rank-art-1,
  .product-card-v17 .product-rank-art-2,
  .product-card-v17 .product-rank-art-3 {
    top: 2px;
    left: 2px;
    width: 39px;
    height: 39px;
  }

  .product-card-v17 .product-rank-art-generic {
    top: 6px;
    left: 4px;
    width: 55px;
    height: 36px;
  }

  .product-card-v17 .product-rank-overlay b {
    font-size: 13px;
  }

  .product-card-v17 .product-rank-overlay small {
    font-size: 6px;
  }

  .product-card-v17 .product-trend-badge-v10 {
    right: 34px;
  }

  .product-series-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .product-series-summary small {
    max-width: 100%;
  }

  .product-series-variants {
    padding: 14px;
  }

  .product-series-variants-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .product-series-variant-list {
    grid-template-columns: 1fr;
  }

  .product-series-variant-list a {
    min-height: 52px;
  }

  .compact-ranking > a {
    grid-template-columns: 36px 44px minmax(0, 1fr) auto 12px;
  }
}
