/*======================================
  *** Time Slot Table ***
======================================*/

/*
 * Columns: days | one column per boat | duration | price.
 * An empty first cell continues the days cell of the row above.
 */

/* Only horizontal lines (Blocksy table variables) */
.wp-block-table.is-style-bve-time-slots {
  --theme-table-border-width: 0;
  --theme-table-border-color: var(--light-grey);
}

/* Ignore "Fixed width table cells" (core .has-fixed-layout) */
/* Separate borders: each cell paints its own, so the shifted days cell can't drag a line along */
.wp-block-table.is-style-bve-time-slots table {
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

.wp-block-table.is-style-bve-time-slots thead {
  border: 0;
}

.wp-block-table.is-style-bve-time-slots :is(th, td) {
  padding: 12px;
  border: 0 solid var(--light-grey);
  border-bottom-width: 1px;
  font-size: var(--small-text);
  text-align: start;
}

/*--- Header ---*/

.wp-block-table.is-style-bve-time-slots th {
  padding-block: 10px;
  background: var(--light-grey);
  color: var(--dark-grey);
  font-size: 0.75em;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/*--- Columns ---*/

/* Days */
.wp-block-table.is-style-bve-time-slots td:first-child {
  font-weight: 500;
}

/* Duration */
.wp-block-table.is-style-bve-time-slots td:nth-last-child(2) {
  color: var(--dark-grey);
}

/* Price */
.wp-block-table.is-style-bve-time-slots :is(th, td):last-child {
  text-align: end;
}

.wp-block-table.is-style-bve-time-slots td:last-child {
  color: var(--dark-red);
  font-weight: 500;
}

/* Merge an empty days cell with the one above */
.wp-block-table.is-style-bve-time-slots
  tr:has(+ tr > td:first-child:empty)
  > td:first-child {
  border-bottom-color: transparent;
  /* Center across both rows: works because both rows have the same height (no wrapping) */
  transform: translateY(50%);
}

/*--- Mobile: Duration Below Price ---*/

@media (max-width: 689.98px) {
  .wp-block-table.is-style-bve-time-slots :is(table, thead, tbody) {
    display: block;
  }

  /* Fixed tracks keep the columns aligned across rows */
  .wp-block-table.is-style-bve-time-slots tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr);
  }

  /* Two boat columns */
  .wp-block-table.is-style-bve-time-slots tr:has(> :nth-child(5)) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1.5fr) minmax(0, 1fr);
  }

  .wp-block-table.is-style-bve-time-slots :is(th, td) {
    padding: 10px 6px;
    white-space: nowrap;
  }

  .wp-block-table.is-style-bve-time-slots th {
    padding-block: 8px;
  }

  .wp-block-table.is-style-bve-time-slots th:nth-last-child(2) {
    display: none;
  }

  .wp-block-table.is-style-bve-time-slots td:not(:last-child, :nth-last-child(2)) {
    grid-row: span 2;
  }

  /* Center the merged days cell's text in its cell before the shift */
  .wp-block-table.is-style-bve-time-slots
    tr:has(+ tr > td:first-child:empty)
    > td:first-child {
    align-content: center;
  }

  .wp-block-table.is-style-bve-time-slots td:last-child {
    grid-area: 1 / -2;
    padding-bottom: 0;
    border-bottom: 0;
  }

  .wp-block-table.is-style-bve-time-slots td:nth-last-child(2) {
    grid-area: 2 / -2;
    padding-top: 0;
    font-size: calc(var(--small-text) * 0.85);
    text-align: end;
  }
}

/*======================================
  *** Small Heading ***
======================================*/

/* Same look as the booking form labels (booking-page.css) */
/* Doubled class (0,3,0) beats Blocksy's editor rule "body .editor-styles-wrapper h3.wp-block-heading" (0,2,2) */
.wp-block-heading.is-style-bve-small.is-style-bve-small {
  font: var(--h5);
  text-transform: uppercase;
  margin-top: 0;
}
