/* AMTL Event Dates 3.0 – event post & archive
 * The calendar cards (.event-card, time.icon, .add-to-calendar-buttons …)
 * are styled in the theme's custom CSS and are not touched here.
 */

.amtl-event {
  container-type: inline-size;
  width: 100%;
}

.amtl-event-table {
  border-collapse: collapse;
  width: 100%;
}

.amtl-event-table td,
.amtl-event-table th {
  vertical-align: top;
  text-align: left;
}

.amtl-event-label {
  white-space: nowrap;
}

.amtl-event-value {
  overflow-wrap: anywhere;
}

.amtl-event-variant th {
  padding-top: 1rem;
  font-weight: 700;
}

.amtl-event-table tr:first-child.amtl-event-variant th {
  padding-top: 0;
}

/* Small add-to-calendar icons next to a date (optional: a2c="yes") */
.amtl-event .amtl-event-a2c {
  display: inline-flex;
  flex-direction: row;
  gap: .6rem;
  margin: 0 0 0 .6rem;
  vertical-align: middle;
}

.amtl-event .amtl-event-a2c a {
  width: 18px;
  height: 18px;
}

/* Map: always 16:9 / at least 260px, never wider than the content */
.amtl-event-map {
  margin: 1rem 0 0;
}

.amtl-event-map iframe {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 7;
  min-height: 260px;
  border: 0;
}

.amtl-event-map-caption {
  margin: .25rem 0 0;
  font-size: .85em;
  opacity: .75;
}

/* Narrow column or phone: label above value instead of two columns */
@container (max-width: 520px) {
  .amtl-event-table,
  .amtl-event-table tbody,
  .amtl-event-table tr,
  .amtl-event-table td,
  .amtl-event-table th {
    display: block;
    width: 100%;
  }
  .amtl-event-table tr {
    padding: .35rem 0;
  }
  .amtl-event-table td {
    padding: 0;
    border: 0;
  }
  .amtl-event-label {
    white-space: normal;
  }
  .amtl-event-map iframe {
    aspect-ratio: 4 / 3;
  }
}

/* Fallback for browsers without container queries */
@supports not (container-type: inline-size) {
  @media (max-width: 600px) {
    .amtl-event-table,
    .amtl-event-table tbody,
    .amtl-event-table tr,
    .amtl-event-table td,
    .amtl-event-table th {
      display: block;
      width: 100%;
    }
    .amtl-event-table td {
      padding: 0;
    }
  }
}

/* Archive cards have no add-to-calendar column */
.amtl-event-archive .event-card {
  grid-template-columns: 90px 1fr;
}

@media (max-width: 768px) {
  .amtl-event-archive .event-card {
    grid-template-columns: 60px 1fr;
  }
}

/* Dark mode (AMTL theme switch: html[data-theme="dark"]).
 * Historical pages stay light. Uses the theme's variables, with fallbacks. */
[data-theme="dark"] body:not(.is-history) .amtl-event-map iframe {
  filter: brightness(calc(1 - var(--img-dim, .15)));
}

[data-theme="dark"] body:not(.is-history) .amtl-event-map-caption {
  color: var(--muted, #b3b9bf);
  opacity: 1;
}

[data-theme="dark"] body:not(.is-history) .amtl-event-a2c a,
[data-theme="dark"] body:not(.is-history) .add-to-calendar-buttons a {
  background-color: #fff;
  border-radius: 3px;
  box-shadow: 0 0 0 2px #fff;
}
