/* Content-aware destination layouts and a shared card action contract.
 * Loaded after site.css. Native links, enquiry buttons and filtering stay intact.
 */

/* Actions reserve space in the heading row; filter tabs get a separate full row. */
:is(#trending, #destinations, #explore) .tc-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 0;
}

:is(#trending, #destinations, #explore) .tc-section-header > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

:is(#trending, #destinations, #explore) .tc-section-actions {
  position: static;
  inset: auto;
  flex: 0 0 auto;
  align-self: flex-end;
  padding-bottom: 2px;
}

:is(#trending, #destinations, #explore) .tc-tabs {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 3px 0;
  margin: 16px 0 22px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-padding-inline: 4px;
}

/* Ten featured destinations fill five columns and two rows. Filtering updates
 * these custom properties from the visible DOM cards rather than duplicating data.
 */
#explore .tc-carousel--two-rows > .tc-carousel-track {
  --tc-explore-columns: 5;
  --tc-explore-tablet-columns: 4;
  --tc-explore-rows: 2;
  --tc-explore-tablet-rows: 3;
  --tc-explore-mobile-rows: 2;
  display: grid;
  grid-auto-flow: column;
  grid-template-columns: repeat(var(--tc-explore-columns), minmax(0, 1fr));
  grid-template-rows: repeat(var(--tc-explore-rows), auto);
  grid-auto-columns: auto;
  gap: 24px;
  width: 100%;
  padding-block: 3px 8px;
  overflow: visible;
  scroll-snap-type: none;
}

#explore .tc-carousel-track > .tc-destination-card--label {
  width: 100%;
  min-width: 0;
  height: clamp(230px, 15vw, 300px);
  aspect-ratio: auto;
}

#explore .tc-carousel-track[data-tc-explore-sparse="true"] {
  max-width: var(--tc-explore-sparse-width, 664px);
  margin-inline: auto;
}

#explore .tc-carousel-track[data-tc-visible-count="0"] {
  display: none;
}

/* Card footers share the same button and secondary-link geometry everywhere. */
.tc-site .tc-package-card {
  container-type: inline-size;
  container-name: tc-package;
  display: flex;
  flex-direction: column;
}

.tc-site .tc-package-card > .tc-package-card-media {
  flex: 0 0 auto;
}

.tc-site .tc-package-card > .tc-package-card-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.tc-site .tc-package-card-body > .tc-package-card-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px 112px;
  align-items: center;
  justify-content: normal;
  gap: 8px;
  width: 100%;
  margin: auto 0 6px;
  padding: 10px 8px;
}

.tc-site .tc-package-card-body > .tc-package-card-features:last-of-type,
.tc-site .tc-package-card-body > .tc-car-specs {
  margin-bottom: 18px;
}

/* Domestic cards use compact categories; full inclusion copy stays accessible
 * and remains unchanged on the package detail page and international cards.
 */
.tc-site .tc-package-card--domestic .tc-package-card-features > li {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  gap: 5px;
  text-align: center;
}

.tc-site .tc-package-card--domestic .tc-facility-label {
  max-width: 100%;
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: normal;
}

.tc-site .tc-package-card-footer > .tc-price {
  grid-column: 1;
  min-width: 0;
  max-width: 100%;
}

.tc-site .tc-package-card-footer > .tc-price strong {
  font-size: 24px;
  line-height: 1.2;
  overflow-wrap: normal;
}

.tc-site .tc-package-card-footer > .tc-price small {
  font-size: 9px;
  line-height: 1.35;
}

.tc-site .tc-package-card-footer > :is(.tc-details-link, a[href^="tel:"]) {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  min-width: 80px;
  min-height: 42px;
  margin: 0;
  padding: 8px 2px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tc-site .tc-package-card-footer > button.tc-button[data-tc-enquiry] {
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 112px;
  min-width: 112px;
  min-height: 42px;
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.tc-site .tc-car-card .tc-package-card-footer {
  grid-template-columns: 80px 112px;
  justify-content: space-between;
}

.tc-site .tc-car-card .tc-package-card-footer > a[href^="tel:"] {
  grid-column: 1;
}

.tc-site .tc-car-card .tc-package-card-footer > button.tc-button[data-tc-enquiry] {
  grid-column: 2;
}

/* Related cards can be narrower than full-width listing cards on the same device.
 * Container queries preserve action sizes and move only the price above them.
 */
@container tc-package (max-width: 359px) {
  .tc-site .tc-package-card-body > .tc-package-card-footer {
    grid-template-columns: 80px 112px;
    justify-content: space-between;
    row-gap: 9px;
  }

  .tc-site .tc-package-card-footer > .tc-price {
    grid-column: 1 / -1;
  }

  .tc-site .tc-package-card-body > .tc-package-card-footer > .tc-details-link {
    grid-column: 1;
  }

  .tc-site .tc-package-card-footer > button.tc-button[data-tc-enquiry] {
    grid-column: 2;
  }
}

@media (min-width: 768px) {
  #explore .tc-section-actions > :is([data-tc-prev], [data-tc-next]) {
    display: none;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  #explore .tc-carousel--two-rows > .tc-carousel-track {
    grid-template-columns: repeat(var(--tc-explore-tablet-columns), minmax(0, 1fr));
    grid-template-rows: repeat(var(--tc-explore-tablet-rows), auto);
    gap: 18px;
  }
}

@media (max-width: 767px) {
  :is(#trending, #destinations, #explore) .tc-section-header {
    align-items: center;
    gap: 12px;
  }

  :is(#trending, #destinations, #explore) .tc-section-actions {
    align-self: center;
    padding: 0;
  }

  :is(#trending, #destinations, #explore) .tc-tabs {
    margin: 10px 0 15px;
  }

  #explore .tc-carousel--two-rows > .tc-carousel-track {
    grid-template-columns: none;
    grid-template-rows: repeat(var(--tc-explore-mobile-rows), auto);
    grid-auto-columns: calc((100% - 20px) / 3);
    gap: 12px 10px;
    max-width: none;
    margin-inline: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-inline: contain;
  }

  #explore .tc-carousel-track > .tc-destination-card--label {
    height: auto;
    aspect-ratio: 116 / 160;
  }
}

@supports not (container-type: inline-size) {
  .tc-site .tc-package-card-body > .tc-package-card-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .tc-site .tc-package-card-footer > .tc-price {
    flex: 1 0 100%;
  }
}
