/**
 * Therapeutic range tiles — Home + Categories (TASK-026 visual fix)
 * Isolated from .cat-card so layout.css min-height / ::after cannot leak in.
 */

.home-categories.section {
  padding-top: 80px;
  padding-bottom: 88px;
  background:
    radial-gradient(900px 280px at 8% 0%, rgba(44, 145, 219, 0.08), transparent 58%),
    radial-gradient(720px 260px at 96% 100%, rgba(99, 173, 69, 0.07), transparent 52%),
    #f4f8fc;
}

.home-cat-head {
  max-width: 680px;
}

.home-cat-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.range-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.range-tile {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: #fff;
  border: 1px solid #d5e4ef;
  border-radius: 18px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(7, 29, 56, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.range-tile:hover,
.range-tile:focus-visible {
  transform: translateY(-3px);
  border-color: #9cc3e0;
  box-shadow: 0 16px 32px rgba(7, 29, 56, 0.1);
}

/* Locked stage — images are out of flow so tall bottles cannot stretch the card */
.range-tile-media {
  position: relative;
  flex: 0 0 auto;
  aspect-ratio: 3 / 2;
  min-height: 0;
  overflow: hidden;
  background: #f6f9fc;
}

.range-tile.tone-2 .range-tile-media {
  background: #f5faf3;
}

.range-tile.tone-3 .range-tile-media {
  background: #f4f6f9;
}

.range-tile-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #8aa7c0;
  opacity: 0.22;
}

.range-tile-icon .cat-svg {
  width: 36px;
  height: 36px;
  display: block;
}

.range-tile-media img {
  position: absolute;
  inset: 10px 12px;
  z-index: 1;
  width: calc(100% - 24px);
  height: calc(100% - 20px);
  max-width: none;
  max-height: none;
  margin: auto;
  object-fit: contain;
  object-position: center;
  transition: transform 0.28s ease;
}

.range-tile:hover .range-tile-media img,
.range-tile:focus-visible .range-tile-media img {
  transform: scale(1.04);
}

.range-tile-count {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 3px 8px;
  border: 1px solid #d7e5f0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--navy);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.range-tile-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
  padding: 12px 14px 13px;
  border-top: 1px solid #eef3f8;
}

.range-tile-body h3 {
  margin: 0;
  min-height: 2.7em;
  color: var(--navy);
  font-size: 14px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.range-tile-go {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.range-tile:hover .range-tile-go,
.range-tile:focus-visible .range-tile-go {
  color: var(--blue2);
}

.range-tile.is-empty .range-tile-go {
  color: var(--muted);
}

@media (max-width: 1080px) {
  .range-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .home-categories.section {
    padding-top: 56px;
    padding-bottom: 64px;
  }

  .range-grid {
    gap: 12px;
  }

  .range-tile-body {
    padding: 10px 12px 12px;
  }

  .range-tile-body h3 {
    font-size: 13px;
  }
}
