/* Cruise pages (and /price_history's example): the itinerary
   calendar, cruise details, price history chart and its window. */


/* Sailing image on cruise pages: shrink to fit, keeping its shape */
.cruise-image {
  max-width: 100%;
  height: auto;
}
.cruise-description {
  margin-top: 1rem;
  text-align: left;
  line-height: 1.5;
  font-size: 1.05em;
}

/* Cruise page price history */
.price-history .price-chart {
  width: 100%;
  max-width: 640px;
  height: auto;
  display: block;
  margin: 0 auto 1em;
  background: #fff;
  border: 1px solid #e4e3df;
  border-radius: 8px;
  font: 11px Arial, Helvetica, sans-serif;
}
/* The wide chart labels its lines; phones get the compact one, whose
   text stays readable at their width */
.price-history .price-chart-compact {
  display: none;
}
@media (max-width: 600px) {
  .price-history .price-chart-wide {
    display: none;
  }
  .price-history .price-chart-compact {
    display: block;
  }}

/* The chart is a button that opens the full history, enlarged */
.price-history .price-chart-open {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.price-history .price-chart-open:focus-visible {
  outline: 3px solid #2a78d6;
  outline-offset: 2px;
  border-radius: 8px;
}
.price-history .chart-note {
  margin-top: -0.5em;
  text-align: center;
}
.price-chart-dialog {
  width: 98vw;
  max-width: none;
  max-height: 96vh;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #fafdff;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
}
/* While the window is open, the page behind it doesn't scroll, and
   scrolling inside the window doesn't pass through to the page */
html.modal-open,
html.modal-open body {
  overflow: hidden;
}
.price-chart-dialog {
  overscroll-behavior: contain;
}
.price-chart-dialog::backdrop {
  background: rgba(20, 20, 30, 0.6);
}
.price-chart-dialog-body {
  position: relative;
  padding: 1em 1.2em 1.2em;
}
.price-chart-dialog h3 {
  margin: 0 2em 0.6em 0;
  text-align: left;
}
.price-chart-close {
  position: absolute;
  top: 0.4em;
  right: 0.5em;
  font-size: 1.8em;
  line-height: 1;
  padding: 0.1em 0.35em;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #1f1f1d;
  cursor: pointer;
}
.price-chart-close:hover,
.price-chart-close:focus-visible {
  background: #e4e3df;
}
.price-history .price-chart-dialog .price-chart {
  max-width: none;
  margin: 0;
  /* As wide as the window allows, but never taller than the screen
     (less the title and legend); the chart keeps its shape */
  max-height: calc(96vh - 7em);
}
/* Wide screens get the extra-wide drawing, laptops the medium one */
.price-history .price-chart-dialog .price-chart-xl {
  display: none;
}
@media (min-width: 1500px) {
  .price-history .price-chart-dialog .price-chart-wide.price-chart-large:not(.price-chart-xl) {
    display: none;
  }
  .price-history .price-chart-dialog .price-chart-xl {
    display: block;
  }}


/* One entry per line: its color, dashed for accessible cabins */
.price-history .chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4em 1.2em;
  list-style: none;
  margin: 0 0 0.6em;
  padding: 0;
  font-size: 0.9em;
}
.price-history .chart-legend .swatch {
  display: inline-block;
  width: 22px;
  margin-right: 0.4em;
  vertical-align: middle;
}
.price-chart .point:hover .dot { r: 6; }
/* Tooltip with a dot's date and price, placed by script above the dot
   (relative to the page, or to the open window's body) */
.chart-tip {
  display: none;
  position: absolute;
  z-index: 1000;
  padding: 0.3em 0.6em;
  border-radius: 6px;
  background: #1f1f1d;
  color: #fff;
  font: 13px/1.3 Arial, Helvetica, sans-serif;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.price-chart .point {
  cursor: default;
}
.price-up { color: #b42318; font-weight: bold; }
/* "Only 3" cabins left: the same red as a price rise, readable on white */
.low-availability { color: #b42318; font-weight: bold; }

/* Sailing calendar on cruise pages */
.itinerary-calendar {
    max-width: 900px;
    margin: 24px auto;
    padding: 12px;
    background-color: #ffffff;
    border-radius: 8px;
}
.itinerary-calendar h3 {
    margin: 0 0 12px;
}
.itinerary-calendar table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}
.itinerary-calendar th,
.itinerary-calendar td {
    border: 1px solid #ddd;
    padding: 6px;
    vertical-align: top;
    font-size: 0.85em;
    overflow-wrap: anywhere;
}
.itinerary-calendar td.off {
    color: #888;
}
.itinerary-calendar td.sailing {
    background-color: #e8f1fb;
}
.itinerary-calendar td.sailing a {
    color: inherit;
}
.itinerary-calendar time {
    display: block;
    font-weight: bold;
    margin-bottom: 4px;
}
.itinerary-calendar .dow {
    display: none;
}
@media (max-width: 600px) {
    /* One line per sailing day */
    .itinerary-calendar thead,
    .itinerary-calendar td.off {
        display: none;
    }
    .itinerary-calendar tr,
    .itinerary-calendar td {
        display: block;
    }
    .itinerary-calendar .dow {
        display: inline;
    }}


/* Cabin tables have few columns, so between phones and desktops they
   stay full-width tables rather than becoming scrolling boxes */
@media (min-width: 601px) and (max-width: 1020px) {
  .cruise-list.cabin-table {
    display: table;
    width: 100%;
    overflow-x: visible;
  }}

/* Cabin tables (cabin prices, price history) on phones: one card per
   cabin, each value labeled */
@media (max-width: 600px) {
  .cruise-list.cabin-table,
  .cabin-table tbody,
  .cabin-table tr,
  .cabin-table td {
    display: block;
    width: auto;
    min-width: 0;
  }
  .cruise-list.cabin-table {
    overflow-x: visible;
    box-shadow: none;
  }
  .cabin-table thead {
    display: none;
  }
  .cabin-table tr {
    margin-bottom: 0.75em;
    border: 1px solid #ccd6e6;
    border-radius: 8px;
    background: #fff;
  }
  .cabin-table td {
    text-align: right;
  }
  .cabin-table td::before {
    content: attr(data-label);
    float: left;
    margin-right: 1em;
    font-weight: bold;
  }
  .cabin-table td.cabin {
    font-weight: bold;
    text-align: left;
  }}


/* Questions on /price_history, each opening to its answer */
.faq details {
  border-bottom: 1px solid #ddd;
  padding: 0.5em 0;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
}
/* Paragraphs of running text read better left-aligned than centered */
.prose p,
.prose summary {
  text-align: left;
}
