/* Anti-FOUC: page is hidden until this stylesheet loads */
html {
  visibility: visible;
}

[x-cloak] {
  display: none !important;
}

.range-container {
  --thumbnail-size: clamp(70px, 12vw, 150px);
  --thumbnail-gap: var(--spacing-sm);
  --description-lines: 4;
  --info-section-gap: 1.25rem;
  --viewport-height: calc(var(--thumbnail-size) * 4 + var(--thumbnail-gap) * 3);

  width: var(--content-width);
  max-width: 100%;
  margin: 0 auto;
  padding-top: var(--spacing-xl);
  padding-bottom: var(--spacing-3xl);
  display: grid;
  grid-template-columns: var(--thumbnail-size) var(--viewport-height) minmax(0, 1fr);
  gap: var(--spacing-sm);
  align-items: start;
  box-sizing: border-box;
}

/* ===== Thumbnail column ===== */
.thumbnail-gallery {
  width: var(--thumbnail-size);
  height: var(--viewport-height);
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.thumbnail-gallery::-webkit-scrollbar {
  display: none;
}

.thumbnail-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--thumbnail-gap);
}

.thumbnail {
  width: var(--thumbnail-size);
  height: var(--thumbnail-size);
  border: none;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  background: none;
  flex-shrink: 0;
  position: relative;
  display: block;
}

.thumbnail img,
.thumbnail video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  image-rendering: high-quality;
  image-rendering: -webkit-optimize-contrast;
}

.thumbnail-play-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 1;
}

.thumbnail-play-icon svg {
  width: 2rem;
  height: 2rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--off-white);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.thumbnail.is-active {
  position: relative;
}

.thumbnail.is-active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(250, 247, 242, 0.6);
  pointer-events: none;
}

.thumbnail--placeholder {
  visibility: hidden;
  pointer-events: none;
}

/* ===== Main viewport column ===== */
.main-viewport {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.main-viewport-item {
  width: 100%;
  height: 100%;
  min-width: 0;
}

.main-viewport-item img,
.main-viewport-item video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.swiper-button-prev, .swiper-button-next {
  color: var(--black);
  --swiper-navigation-size: 24px;
  width: 44px;
  height: 44px;
}

/* ===== Info panel column ===== */
.info-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  min-height: var(--viewport-height);
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
  padding-left: var(--spacing-md);
}

.info-panel.is-collapsed {
  overflow: visible;
}

.info-title {
  font-weight: 800;
  text-transform: uppercase;
  flex-shrink: 0;
  margin-bottom: 1rem;
}

.info-description {
  line-height: 1.3;
  margin-bottom: 0.5rem;
  min-width: 0;
  max-width: 100%;
  max-height: 48rem;
  flex-shrink: 0;
  overflow: hidden;
  overflow-wrap: break-word;
  hyphens: auto;
  transition: max-height 900ms ease;
}

.info-panel.is-collapsed .info-description,
.info-description.line-clamp {
  max-height: calc(1.3em * var(--description-lines));
}

.info-expand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  margin-bottom: 0;
  color: inherit;
}

.info-expand .chevron-icon {
  transition: transform 0.3s ease;
}

.info-expand .chevron-icon.is-expanded {
  transform: rotate(180deg);
}

.info-expand:hover {
  opacity: 0.7;
}

.info-panel .features-section {
  margin-top: auto;
}

.sku-section {
  margin: var(--info-section-gap) 0;
}

.info-description :where(p, ul, ol, blockquote) {
  max-width: 100%;
  margin-top: 0;
  margin-bottom: var(--info-section-gap);
}

.info-description :where(p, ul, ol, blockquote):last-child {
  margin-bottom: 0;
}

.info-description :where(img, video, iframe) {
  max-width: 100%;
}

/* Size grid */
.sku-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 0;
}

.sku-option {
  border: 1px solid #000;
  min-height: 4.5rem;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.03em;
  padding: 0.5rem;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.2s ease, color 0.2s ease;
  gap: 0.25rem;
  min-width: 0;
  overflow: hidden;
}

.sku-option:hover {
  background-color: var(--black);
  color: var(--off-white);
  cursor: pointer;
}

.sku-option-name,
.sku-option-capacity {
  overflow-wrap: break-word;
  max-width: 100%;
}

.sku-option-name {
  text-transform: uppercase;
}

.sku-option-capacity {
  word-break: break-word;
}

/* Features */
.features-title {
  font-weight: 700;
  text-transform: uppercase;
}

.features-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.features-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--black);
  min-width: 0;
  flex: 0 1 auto;
}

.features-list img {
  height: 4rem;
  width: auto;
  object-fit: contain;
}

/* ===== Custom feature tooltip ===== */
.feature-tooltip {
  position: relative;
  display: inline-flex;
  cursor: help;
}

.feature-tooltip img {
  display: block;
}

.feature-tooltip__bubble {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  width: max-content;
  max-width: 240px;
  padding: 0.7rem 1rem;
  background-color: var(--black);
  color: var(--off-white);
  line-height: 1.5;
  text-align: center;
  white-space: normal;
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.feature-tooltip__bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: var(--black);
}

.feature-tooltip__bubble.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Tooltips are a hover interaction — keep them off touch devices */


.btn-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-quote,
.btn-pdf {
  text-align: center;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-quote {
  background-color: var(--black);
  color: var(--off-white);
  padding: 0.50rem 1rem;
  text-align: center;
  font-weight: 500;
  border: 1px solid var(--black);
}

.btn-quote:hover {
  background-color: var(--off-white);
  color: var(--black);
  cursor: pointer;
}

.btn-pdf {
  background-color: var(--off-white);
  color: var(--black);
  padding: 0.75rem 1rem;
  text-align: center;
  border: 1px solid var(--black);
}

.btn-pdf:hover {
  background-color: var(--black);
  color: var(--off-white);
}

/* Similar ranges section */
.similar-ranges-section {
  width: var(--content-width);
  margin: 0 auto;
}

.similar-ranges-title {
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: var(--spacing-sm);
  border-bottom: 3px solid var(--black);
}

.similar-ranges-wrapper {
  overflow: hidden;
  padding-top: var(--spacing-md);
}

.similar-range-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s;
}

.similar-range-card {
  position: relative;
}

.similar-range-card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: background 0.3s ease;
}

.similar-range-card:hover::after {
  background: rgba(250, 247, 242, 0.6);
}

.similar-range-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  margin-bottom: var(--spacing-xs);
}

.similar-range-name {
  text-transform: uppercase;
}


/* For smaller laptops */
@media (min-width: 1025px) and (max-width: 1399px) {
  .range-container {
    --thumbnail-size: clamp(60px, 8vw, 110px);
    --thumbnail-gap: var(--spacing-xs);
    --description-lines: 2;
    --info-section-gap: 0.85rem;
  }

  .info-title {
    margin-bottom: 0.65rem;
  }

  .info-description {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .info-panel.is-collapsed .info-description,
  .info-description.line-clamp {
    max-height: calc(1.5em * var(--description-lines));
  }

  .sku-grid {
    gap: 0.45rem;
  }

  .sku-option {
    min-height: 2.4rem;
  }

}

/* For larger laptops */
@media (min-width: 1400px) and (max-width: 1800px) {
  .range-container {
    --thumbnail-size: clamp(70px, 10vw, 130px);
    --thumbnail-gap: var(--spacing-xs);
    --description-lines: 3;
    --info-section-gap: 1rem;
  }
}


/* For tablet and mobile devices */
@media (max-width: 1024px) {
  .range-container {
    --thumbnail-size: calc((min(90vw, 1600px) - 3 * var(--thumbnail-gap) - var(--spacing-sm)) / 5);
    --thumbnail-gap: 12px;
    --description-lines: 4;
    --info-section-gap: 1rem;

    grid-template-columns: var(--thumbnail-size) var(--viewport-height);
    grid-template-areas:
      "thumbs viewport"
      "info info";
  }

  .thumbnail-gallery {
    grid-area: thumbs;
  }

  .main-viewport {
    grid-area: viewport;
  }

  .info-panel {
    grid-area: info;
    margin-top: 2rem;
    min-height: 0;
    padding-left: 0;
  }

  .info-panel.is-collapsed {
    overflow: visible;
  }

  .info-panel .features-section {
    margin-top: 0;
  }

  /* Below 1025px the first feature icon hugs the left edge of the screen, so a
     centered tooltip on it would clip off-screen. Show that one tooltip to the
     right of the icon instead; all other icons keep the normal top-center look. */
  .features-list .feature-tooltip:first-child .feature-tooltip__bubble {
    bottom: auto;
    top: 50%;
    left: calc(100% + 14px);
    transform: translateY(-50%) translateX(6px);
  }

  .features-list .feature-tooltip:first-child .feature-tooltip__bubble.is-visible {
    transform: translateY(-50%) translateX(0);
  }

  .features-list .feature-tooltip:first-child .feature-tooltip__bubble::after {
    top: 50%;
    left: 0;
    transform: translate(-100%, -50%);
    border: 7px solid transparent;
    border-right-color: var(--black);
  }
}

/* For mobile devices */
@media (max-width: 768px) {
  .range-container {
    gap: var(--spacing-xs);
    --thumbnail-size: 72px;
    --thumbnail-gap: 8px;

    grid-template-columns: 1fr;
    grid-template-areas:
      "viewport"
      "thumbs"
      "info";
  }

  .thumbnail-gallery {
    width: 100%;
    height: auto;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .thumbnail-wrapper {
    flex-direction: row;
    gap: 0;
  }

  .thumbnail-gallery .thumbnail {
    height: auto;
    aspect-ratio: 1;
  }

  .main-viewport {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .info-panel {
    padding-left: 0;
  }

  .sku-grid {
    gap: 0.45rem;
    grid-template-columns: repeat(2, 1fr);
  }

  .sku-option {
    min-height: 3rem;
  }

  /* On mobile, center every tooltip on the screen so none can clip off-screen.
     (Also overrides the below-1025px first-icon rule, which is higher specificity.) */
  .features-list .feature-tooltip .feature-tooltip__bubble,
  .features-list .feature-tooltip:first-child .feature-tooltip__bubble {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%) scale(0.95);
  }

  .features-list .feature-tooltip .feature-tooltip__bubble.is-visible,
  .features-list .feature-tooltip:first-child .feature-tooltip__bubble.is-visible {
    transform: translate(-50%, -50%) scale(1);
  }

  .features-list .feature-tooltip .feature-tooltip__bubble::after,
  .features-list .feature-tooltip:first-child .feature-tooltip__bubble::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .info-description {
    transition: none;
  }
}
