/**
 * custom.css
 *
 * Hand-maintained overrides, loaded AFTER assets/css/style.css.
 * Not compiled from assets/scss/ — edit this file directly.
 */

/* ==========================================================================
   Editor content tables
   --------------------------------------------------------------------------
   The Meyer reset in 1-base/_reset.scss strips padding, borders and font
   from every table element, and the only table rule in the theme
   (1-base/_global.scss `table.table`) needs a .table class the WP editor
   never outputs. Tables pasted into the editor therefore render as loose
   columns of text. These rules restyle bare tables inside editor content
   only, so The Events Calendar's own calendar grids are left alone.
   ========================================================================== */

.tribe-events-content table:not(.tribe-events-calendar),
.tribe-events-single-event-description table:not(.tribe-events-calendar),
.entry-content table:not(.tribe-events-calendar),
.wp-block-table table {
  width: 100%;
  margin: 1.5em 0 2em;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.45;
}

/* Cells. Inline width="x%" from the editor still wins, which is fine. */
.tribe-events-content table:not(.tribe-events-calendar) td,
.tribe-events-content table:not(.tribe-events-calendar) th,
.tribe-events-single-event-description table:not(.tribe-events-calendar) td,
.tribe-events-single-event-description table:not(.tribe-events-calendar) th,
.entry-content table:not(.tribe-events-calendar) td,
.entry-content table:not(.tribe-events-calendar) th,
.wp-block-table table td,
.wp-block-table table th {
  padding: 0.75em 1em;
  border: 1px solid #c9d4ea;
  text-align: left;
  vertical-align: top;
}

/* Header row. The editor emits <tr><td><strong> rather than <thead><th>,
   so the first body row is treated as the header. */
.tribe-events-content table:not(.tribe-events-calendar) thead th,
.tribe-events-content table:not(.tribe-events-calendar) tbody tr:first-child td,
.tribe-events-single-event-description table:not(.tribe-events-calendar) thead th,
.tribe-events-single-event-description table:not(.tribe-events-calendar) tbody tr:first-child td,
.entry-content table:not(.tribe-events-calendar) thead th,
.entry-content table:not(.tribe-events-calendar) tbody tr:first-child td,
.wp-block-table table thead th,
.wp-block-table table tbody tr:first-child td {
  background: #0F2355;
  color: #ffffff;
  font-weight: 700;
  border-color: #0F2355;
}

/* style.css sets `.tribe-events-single-event-description strong { color: #0f2355 }`,
   which would leave the header row invisible on its dark background. Force every
   child of a header cell to take the cell's own colour. */
.tribe-events-content table:not(.tribe-events-calendar) thead th *,
.tribe-events-content table:not(.tribe-events-calendar) tbody tr:first-child td *,
.tribe-events-single-event-description table:not(.tribe-events-calendar) thead th *,
.tribe-events-single-event-description table:not(.tribe-events-calendar) tbody tr:first-child td *,
.entry-content table:not(.tribe-events-calendar) thead th *,
.entry-content table:not(.tribe-events-calendar) tbody tr:first-child td *,
.wp-block-table table thead th *,
.wp-block-table table tbody tr:first-child td * {
  color: inherit;
}

/* Body rows: white base with a light-blue zebra stripe. */
.tribe-events-content table:not(.tribe-events-calendar) tbody tr,
.tribe-events-single-event-description table:not(.tribe-events-calendar) tbody tr,
.entry-content table:not(.tribe-events-calendar) tbody tr,
.wp-block-table table tbody tr {
  background: #ffffff;
}

.tribe-events-content table:not(.tribe-events-calendar) tbody tr:nth-child(even),
.tribe-events-single-event-description table:not(.tribe-events-calendar) tbody tr:nth-child(even),
.entry-content table:not(.tribe-events-calendar) tbody tr:nth-child(even),
.wp-block-table table tbody tr:nth-child(even) {
  background: #f4f7fc;
}

/* Links inside body cells keep the theme's blue. */
.tribe-events-content table:not(.tribe-events-calendar) tbody td a,
.tribe-events-single-event-description table:not(.tribe-events-calendar) tbody td a,
.entry-content table:not(.tribe-events-calendar) tbody td a,
.wp-block-table table tbody td a {
  color: #0F2355;
  text-decoration: underline;
}

.tribe-events-content table:not(.tribe-events-calendar) tbody td a:hover,
.tribe-events-single-event-description table:not(.tribe-events-calendar) tbody td a:hover,
.entry-content table:not(.tribe-events-calendar) tbody td a:hover,
.wp-block-table table tbody td a:hover {
  color: #E55238;
}

/* Mobile: the editor's percentage widths crush 4+ columns, so let the
   table scroll sideways instead of wrapping every word.
   display:block is what makes overflow work without a wrapper element. */
@media (max-width: 767px) {
  .tribe-events-content table:not(.tribe-events-calendar),
  .tribe-events-single-event-description table:not(.tribe-events-calendar),
  .entry-content table:not(.tribe-events-calendar),
  .wp-block-table table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tribe-events-content table:not(.tribe-events-calendar) td,
  .tribe-events-single-event-description table:not(.tribe-events-calendar) td,
  .entry-content table:not(.tribe-events-calendar) td,
  .wp-block-table table td {
    min-width: 10em;
  }
}
