/*
 * Deals rows (deals-sliders.php, and the Deals tabs on the Tours and Hotels & Resorts pages): one
 * row of cards per tab, 4 on a desktop, 3 on a laptop, 2 and a peek on a tablet, 1 and a peek on a phone. The
 * row scrolls sideways and snaps to a card; on tablets and phones the next card peeks in. The arrows and
 * count sit beside the tabs, never on the cards (deal-rows.js). Everything is under .deal-rows, so
 * the older carousel's rules (deals-sliders.css) keep styling the markup not yet copied.
 */

/*
 * Production's look (owner's design): white space under the slider, then the light-blue band
 * (#d0e8ff, full width). The three large tabs sit centered across the band's top edge, half in the
 * white and half in the blue, each with its round icon rising above it.
 */
.deal-rows-section {
  padding-top: 40px;
  background: #fff;
}

.deal-rows {
  --deal-tab-h: 73px;
  --deal-rise: 33px;
  --deal-circle: 70px;
  --deal-gap: 16px;
  --deal-per-view: 4;
}

.deal-rows-band {
  margin-top: calc(var(--deal-rise) + var(--deal-tab-h) / 2);
  padding-bottom: 36px;
  background: #d0e8ff;
}

/*
 * On the home page the deals keep to the search band's and featured offers' column (home-hero.css,
 * 1040px with 16px sides), so the page reads as one column, the heading starting at its left edge.
 */
.deal-rows-section.is-home {
  padding-top: 56px;
}

.deal-rows-section.is-home .page_max_width {
  box-sizing: border-box;
  max-width: 1072px;
  padding: 0 16px;
}

/* Inside a page's own Deals tab (Tours, Hotels & Resorts): no band; the tab's box frames the row. */
.deal-rows-section.is-in-tab {
  padding: 0;
}

.deal-rows-section.is-in-tab .deal-rows-band {
  margin: 0;
  padding: 0;
  background: none;
}

/* Centered with a line under it, as the home page's other section headings are (home-sections.css). */
.deal-rows-heading {
  padding-bottom: 26px;
  text-align: center;
}

.deal-rows .deal-rows-title {
  margin: 0;
  font-size: 24px;
  font-weight: bold;
  line-height: 1.25;
  color: #004a83;
  text-wrap: balance;
}

.deal-rows .deal-rows-sub {
  margin: 6px 0 0;
  color: #4b5b6b;
  font-size: 15px;
}

.deal-rows-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

/* Lifted so the band's edge runs through the middle of the tabs; the count and arrows sit below, in the blue. */
.deal-rows-band > .deal-rows-inner > .deal-rows-head {
  position: relative;
  top: calc(-1 * (var(--deal-rise) + var(--deal-tab-h) / 2));
  margin-bottom: calc(16px - var(--deal-rise) - var(--deal-tab-h) / 2);
}

.deal-rows-section.is-in-tab .deal-rows-head {
  top: 0;
  margin-bottom: 16px;
}

.deal-rows-tabs {
  display: flex;
  flex: 1 0 100%;
  box-sizing: border-box;
  justify-content: center;
  gap: 9px;
  padding-top: var(--deal-rise);
}

/*
 * Wider than a tablet, the count and arrows sit at the right of the tab row, fully in the blue; the
 * tabs keep clear of them by the same space on each side, so they stay centered.
 */
@media (width > 820px) {
  .deal-rows-band .deal-rows-tabs {
    padding-right: 170px;
    padding-left: 170px;
  }

  .deal-rows-band .deal-rows-controls {
    position: absolute;
    right: 0;
    bottom: -8px;
  }
}

.deal-rows-tab {
  display: flex;
  position: relative;
  flex: 0 1 298px;
  box-sizing: border-box;
  align-items: flex-end;
  justify-content: center;
  height: var(--deal-tab-h);
  padding: 0 10px 7px;
  border: 1px solid #b9d6f2;
  border-radius: 4px 4px 0 0;
  background: #e8f2fc;
  color: #004a83;
  font: inherit;
  font-size: 17px;
  font-weight: bold;
  line-height: 1.1;
  cursor: pointer;
}

/* The round icon, half above the tab, as production's: white ring, navy disc, white icon. */
.deal-rows-tab-circle {
  display: flex;
  position: absolute;
  top: calc(-1 * var(--deal-rise));
  left: 50%;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  width: var(--deal-circle);
  height: var(--deal-circle);
  border: 5px solid #fff;
  border-radius: 50%;
  background: #004a83;
  transform: translateX(-50%);
}

/* The tab's border carried around the ring, inside the tab only (clipped above the tab's top edge). */
.deal-rows-tab-circle::after {
  position: absolute;
  inset: -6px;
  border: 1px solid #b9d6f2;
  border-radius: 50%;
  content: "";
  clip-path: inset(calc(var(--deal-rise) + 1px) 0 0 0);
}

.deal-rows-tab.is-active .deal-rows-tab-circle::after {
  display: none;
}

.deal-rows-tab-circle img {
  max-width: 62%;
  max-height: 62%;
}

.deal-rows-tab:focus-visible {
  outline: 2px solid #1e88e5;
  outline-offset: 2px;
}

/* A light-blue tint, not white, so the icon's white ring shows as it does on production's tabs. */
.deal-rows-tab:hover {
  background: #d9e9fa;
}

.deal-rows-tab.is-active {
  border-color: #1a7dde;
  background: #1a7dde;
  color: #fff;
}

.deal-rows-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.deal-rows-controls[hidden] {
  display: none;
}

/* In a page's Deals tab there are no tab buttons, so with every card in view the head is empty. */
.deal-rows-head:has(> .deal-rows-controls[hidden]:only-child) {
  display: none;
}

.deal-rows-count {
  font-size: 13px;
  color: #5b6b78;
  white-space: nowrap;
}

.deal-rows-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #c9d8e6;
  border-radius: 50%;
  background: #fff;
  color: #004a83;
  cursor: pointer;
}

.deal-rows-arrow:focus-visible {
  outline: 2px solid #1e88e5;
  outline-offset: 2px;
}

.deal-rows-arrow:disabled {
  border-color: #e3ebf3;
  color: #b8c6d3;
  cursor: default;
}

.deal-rows-arrow:hover:not(:disabled) {
  background: #f6faff;
}

/* The track stays in the page column, so the row is centered with the rest of the page. */
.deal-rows-track {
  display: flex;
  gap: var(--deal-gap);
  margin: 0;
  padding: 2px 0 6px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.deal-rows-track::-webkit-scrollbar {
  display: none;
}

.deal-row-card {
  display: flex;
  flex: 0 0 calc((100% - (var(--deal-per-view) - 1) * var(--deal-gap)) / var(--deal-per-view));
  flex-direction: column;
  box-sizing: border-box;
  min-width: 0;
  margin: 0;
  border: 1px solid #b9d6f2;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 74 131 / 8%);
  scroll-snap-align: start;
}

/*
 * A row with fewer cards than fit is centered, under the centered tabs. Auto margins on the end cards
 * do this and fall back to 0 once the row overflows, so a long row still starts at its first card.
 */
.deal-row-card:first-child {
  margin-left: auto;
}

.deal-row-card:last-child {
  margin-right: auto;
}

.deal-row-image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 96px;
  padding: 10px 20px;
  box-sizing: border-box;
}

.deal-row-image img {
  max-width: 100%;
  max-height: 72px;
  object-fit: contain;
}

.deal-row-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 4px 14px 16px;
  text-align: center;
}

.deal-row-title {
  margin: 0;
  font-size: 15px;
  font-weight: bold;
  line-height: 1.3;
  color: #1f2a37;
}

/* The Tours and Hotels & Resorts tab boxes color every h3 white (cubeportfolio_cruiselines.css). */
#tabs_section .content .deal-row-title {
  font-size: 15px;
  color: #1f2a37;
}

/*
 * Four lines of the description. A longer one fades out over its last line, where deal-rows.js adds
 * a "Read more" button that opens the whole of it, rather than ending in an ellipsis.
 */
.deal-row-text {
  max-height: calc(1.45em * 4);
  margin-top: 6px;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.45;
  color: #5b6b78;
}

.deal-row-text.is-clamped {
  mask-image: linear-gradient(to bottom, #000 calc(100% - 1.45em), transparent);
}

.deal-row-text.is-open {
  max-height: none;
}

.deal-row-more {
  align-self: center;
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: #004a83;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
}

.deal-row-more:hover,
.deal-row-more:focus-visible {
  color: #003563;
  text-decoration: underline;
}

.deal-row-more[hidden] {
  display: none;
}

/* The pop-up "Read more" opens: the card in full, centered as the card is. */
.deal-row-details {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.deal-row-details-logo {
  max-width: 220px;
  max-height: 90px;
  margin-bottom: 12px;
  object-fit: contain;
}

.deal-row-details-note {
  margin: 4px 0 14px;
  color: #5b6b78;
  font-size: 12px;
}

.deal-row-details-title {
  margin: 0 0 10px;
  color: #004a83;
  font-size: 20px;
  line-height: 1.3;
}

.deal-row-details-text {
  color: #1f2a37;
  font-size: 15px;
  line-height: 1.6;
}

.deal-row-details-text p {
  margin: 0 0 10px;
}

.deal-row-text p {
  margin: 0;
}

.deal-row-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
}

/* The fine print gets its own line, above the button, so a longer note wraps instead of crowding it. */
.deal-row-note {
  font-size: 11px;
  line-height: 1.4;
  color: #8a99a6;
}

.deal-row-note:empty {
  display: none;
}

.deal-row-btn {
  display: inline-block;
  align-self: center;
  padding: 7px 14px;
  border-radius: 999px;
  background: #e8283f;
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.deal-row-btn:focus-visible {
  outline: 2px solid #1e88e5;
  outline-offset: 2px;
}

.deal-row-btn:hover,
.deal-row-btn:focus {
  background: #c81e33;
  color: #fff;
  text-decoration: none;
}

.deal-row-btn.is-secondary {
  background: #004a83;
}

.deal-row-btn.is-secondary:hover,
.deal-row-btn.is-secondary:focus {
  background: #00335c;
}

.deal-row-btn.is-call {
  background: #eef4fa;
  color: #5b6b78;
}

/* The qualifying lists open in a fancybox and stay hidden in the card. */
.deal-row-card .ros_cruiselines_fancycontent {
  display: none;
}

@media (width <= 1100px) {
  .deal-rows {
    --deal-per-view: 3;
  }
}

/* Touch-first widths: the next card peeks in inside the column, the strongest cue to swipe. */
@media (width <= 820px) {
  .deal-rows {
    --deal-per-view: 2.2;
  }
}

/* A phone: one card and a peek of the next, swipe first; the arrows stay as a backup. */
@media (width <= 560px) {
  .deal-rows {
    --deal-gap: 12px;
    --deal-per-view: 1.15;

    /* The same tabs as equal thirds, smaller; "Cruise", "Resort" and "Tour", since the heading says Deals. */
    --deal-tab-h: 54px;
    --deal-rise: 22px;
    --deal-circle: 46px;
  }

  .deal-rows-tabs {
    gap: 6px;
  }

  .deal-rows-tab {
    flex: 1 1 0;
    padding: 0 4px 6px;
    font-size: 15px;
  }

  .deal-rows-tab-circle {
    border-width: 4px;
  }

  .deal-rows-tab-circle::after {
    inset: -5px;
  }

  .deal-rows-tab-suffix {
    display: none;
  }

  .deal-rows .deal-rows-title {
    font-size: 20px;
  }
}

/*
 * Touch: on tablets and phones, and on any touch screen (an iPad held sideways shows 3 cards), the
 * button spans the card and is 44px tall, Apple's minimum for something tapped with a finger.
 */
@media (width <= 820px), (pointer: coarse) {
  .deal-row-btn {
    display: flex;
    align-self: stretch;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 44px;
    padding: 10px 14px;
    font-size: 14px;
  }
}
