/* Eterlens Ranking — collection-driven tab grid, KENPOGEN style */
.etl-rk {
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
  background: rgb(var(--color-background));
  color: rgb(var(--color-text));
}
.etl-rk * { box-sizing: border-box; }
.etl-rk-inner { max-width: 1720px; margin: 0 auto; padding: 0 16px; }

/* Header */
.etl-rk-head { text-align: center; margin-bottom: 22px; }
.etl-rk-title {
  font-family: 'Playfair Display', 'Noto Serif JP', serif;
  font-size: 26px;
  font-weight: 800;
  color: #2E2A26;
  margin: 0 0 6px;
  letter-spacing: 0.06em;
  line-height: 1.1;
}
.etl-rk-subtitle {
  font-size: 13px;
  color: #6B6256;
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* Tabs nav (built by JS from panels) */
.etl-rk-tabs {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
  gap: 0 4px;
  padding: 0 16px 4px;
  margin: 0 -16px 24px;
  border-bottom: 1px solid #E0D6C8;
  scrollbar-width: thin;
  scrollbar-color: #C7A77A transparent;
  -webkit-overflow-scrolling: touch;
}
.etl-rk-tabs::-webkit-scrollbar { height: 4px; }
.etl-rk-tabs::-webkit-scrollbar-thumb { background: #C7A77A; border-radius: 4px; }
.etl-rk-tabs[hidden] { display: none; }
.etl-rk-tab {
  flex-shrink: 0;
  appearance: none;
  padding: 10px 14px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #6B6256;
  cursor: pointer;
  letter-spacing: 0.04em;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.etl-rk-tab:hover { color: #2E2A26; }
.etl-rk-tab.is-active {
  color: #2E2A26;
  border-bottom-color: #2E2A26;
  font-weight: 800;
}

/* Panels — only one visible at a time */
.etl-rk-panels { position: relative; }
.etl-rk-panel { display: none; }
.etl-rk-panel:first-child { display: block; }
.etl-rk-panel.is-active { display: block; }
.etl-rk-panel.is-inactive { display: none; }

/* Grid — minmax(0, 1fr) is critical to prevent inner text from blowing out column width */
.etl-rk-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Item card */
.etl-rk-item { list-style: none; min-width: 0; }
.etl-rk-item-link {
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid #E0D6C8;
  border-radius: 8px;
  overflow: hidden;
  height: 100%;
  min-width: 0;
  transition: transform 0.3s cubic-bezier(.2,.7,.2,1), box-shadow 0.3s ease, border-color 0.2s;
}
.etl-rk-item-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(46, 42, 38, 0.08);
  border-color: #C7A77A;
}

/* Rank circle — top-left */
.etl-rk-item-rank {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #2E2A26;
  color: #F4ECE0;
  font-family: 'Playfair Display', 'Noto Serif JP', serif;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(46, 42, 38, 0.2);
}
.etl-rk-item:nth-child(1) .etl-rk-item-rank {
  background: linear-gradient(135deg, #D9C29F 0%, #C7A77A 60%, #9C7E4F 100%);
  color: #2E2A26;
}
.etl-rk-item:nth-child(2) .etl-rk-item-rank {
  background: linear-gradient(135deg, #D8D6CF 0%, #B5B3AB 60%, #8F8B82 100%);
  color: #2E2A26;
}
.etl-rk-item:nth-child(3) .etl-rk-item-rank {
  background: linear-gradient(135deg, #D9A074 0%, #C8704F 60%, #8B4A33 100%);
  color: #F4ECE0;
}

/* Image — bullet-proof 1:1 square using padding-bottom fallback
   (aspect-ratio alone gets overridden by Shopline picture's intrinsic dims) */
.etl-rk-item-img {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  height: 0;
  overflow: hidden;
  background: #F4ECE0;
  line-height: 0;
  flex-shrink: 0;
}
.etl-rk-item-img > picture,
.etl-rk-item-img > img,
.etl-rk-item-img > * {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
}
.etl-rk-item-img picture img,
.etl-rk-item-img > img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  transition: transform 0.5s cubic-bezier(.2,.7,.2,1);
}
.etl-rk-item-link:hover .etl-rk-item-img img { transform: scale(1.04); }

/* Body */
.etl-rk-item-body { padding: 10px 10px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.etl-rk-item-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: #2E2A26;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
  overflow-wrap: anywhere;
  min-height: 36px;
  min-width: 0;
}
.etl-rk-item-prices { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 6px; margin-top: auto; }
.etl-rk-item-price {
  font-size: 16px;
  font-weight: 800;
  color: #2E2A26;
  font-family: 'Playfair Display', 'Noto Serif JP', serif;
  letter-spacing: 0.01em;
}
.etl-rk-item-prices.is-on-sale .etl-rk-item-price { color: #E60012; }
.etl-rk-item-tax { font-size: 11px; color: #6B6256; font-weight: 500; }
.etl-rk-item-compare {
  font-size: 12px;
  color: #6B6256;
  text-decoration: line-through;
  font-weight: 500;
}

/* View more button */
.etl-rk-more-wrap { text-align: center; margin-top: 28px; }
.etl-rk-more {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 36px;
  background: transparent;
  color: #2E2A26;
  text-decoration: none;
  border: 1.5px solid #2E2A26;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}
.etl-rk-more:hover {
  background: #2E2A26;
  color: #F4ECE0;
  transform: translateY(-2px);
}
.etl-rk-more-arrow {
  display: inline-block;
  transition: transform 0.3s cubic-bezier(.2,.7,.2,1);
}
.etl-rk-more:hover .etl-rk-more-arrow { transform: translateX(4px); }

/* Empty state */
.etl-rk-empty {
  padding: 40px 20px;
  text-align: center;
  color: #6B6256;
  font-size: 13px;
  background: #F4ECE0;
  border-radius: 8px;
}

/* ===== Tablet ≥ 720px ===== */
@media (min-width: 720px) {
  .etl-rk-inner { padding: 0 24px; }
  .etl-rk-head { margin-bottom: 28px; }
  .etl-rk-title { font-size: 32px; }
  .etl-rk-subtitle { font-size: 14px; }

  .etl-rk-tabs { margin: 0 0 28px; padding-inline: 0; gap: 0 8px; justify-content: center; }
  .etl-rk-tab { font-size: 14px; padding: 12px 18px; }

  .etl-rk-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }

  .etl-rk-item-rank { top: 10px; left: 10px; width: 30px; height: 30px; font-size: 15px; }
  .etl-rk-item-body { padding: 12px 14px 16px; gap: 8px; }
  .etl-rk-item-title { font-size: 13px; min-height: 36px; }
  .etl-rk-item-price { font-size: 18px; }
  .etl-rk-item-compare { font-size: 12px; }

  .etl-rk-more { font-size: 14px; padding: 14px 44px; }
  .etl-rk-more-wrap { margin-top: 36px; }
}

/* ===== Desktop ≥ 1100px ===== */
@media (min-width: 1100px) {
  .etl-rk-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 22px; }
  .etl-rk-item-rank { width: 32px; height: 32px; font-size: 16px; }
  .etl-rk-item-title { font-size: 13px; }
  .etl-rk-item-price { font-size: 19px; }
}

/* ===== Large desktop ≥ 1440px ===== */
@media (min-width: 1440px) {
  .etl-rk-grid { gap: 26px; }
}

/* Cap visible items per tab via section data attribute */
.etl-rk[data-items-per-tab="5"]  .etl-rk-item:nth-child(n+6),
.etl-rk[data-items-per-tab="8"]  .etl-rk-item:nth-child(n+9),
.etl-rk[data-items-per-tab="10"] .etl-rk-item:nth-child(n+11),
.etl-rk[data-items-per-tab="12"] .etl-rk-item:nth-child(n+13),
.etl-rk[data-items-per-tab="15"] .etl-rk-item:nth-child(n+16),
.etl-rk[data-items-per-tab="20"] .etl-rk-item:nth-child(n+21) { display: none; }

/* ===== Slider mode ===== */
.etl-rk-mode-slider .etl-rk-panel { position: relative; }
.etl-rk-mode-slider .etl-rk-grid {
  display: flex !important;
  grid-template-columns: none !important;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 8px;
}
.etl-rk-mode-slider .etl-rk-grid::-webkit-scrollbar { display: none; }
.etl-rk-mode-slider .etl-rk-item {
  flex: 0 0 auto;
  scroll-snap-align: start;
  /* width set by JS */
}
.etl-rk-mode-slider .etl-rk-nav {
  position: absolute;
  top: 38%;
  transform: translateY(-50%);
  z-index: 3;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  color: #2E2A26;
  border: 1px solid #E0D6C8;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(46, 42, 38, 0.1);
  transition: background 0.2s, color 0.2s, opacity 0.2s, transform 0.15s;
}
.etl-rk-mode-slider .etl-rk-nav:hover {
  background: #2E2A26;
  color: #F4ECE0;
  border-color: #2E2A26;
}
.etl-rk-mode-slider .etl-rk-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.etl-rk-mode-slider .etl-rk-nav-prev { left: -8px; }
.etl-rk-mode-slider .etl-rk-nav-next { right: -8px; }
.etl-rk-mode-slider .etl-rk-nav[hidden] { display: none; }

@media (min-width: 720px) {
  .etl-rk-mode-slider .etl-rk-grid { gap: 18px; }
  .etl-rk-mode-slider .etl-rk-nav { width: 44px; height: 44px; font-size: 24px; }
  .etl-rk-mode-slider .etl-rk-nav-prev { left: -22px; }
  .etl-rk-mode-slider .etl-rk-nav-next { right: -22px; }
}
