/**
 * Time Events Shortcode — [time_events]
 *
 * All colors via var(--tc-*) from design-system.css.
 * Dark mode is activated automatically via .tc-dark on .tc-events-wrap.
 *
 * Layouts:  .tc-events-layout--grid | --list | --cards
 * Columns:  .tc-events-cols--1 | --2 | --3
 */

/* ── Wrapper ───────────────────────────────────────────────────────────────── */
.tc-events-wrap {
  box-sizing: border-box;
  color: var(--tc-text);
  font-family: inherit;
}

/* ── Grid ───────────────────────────────────────────────────────────────── */
.tc-events-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(3, 1fr); /* default */
}

/* Column overrides */
.tc-events-cols--1 .tc-events-grid { grid-template-columns: 1fr; }
.tc-events-cols--2 .tc-events-grid { grid-template-columns: repeat(2, 1fr); }
.tc-events-cols--3 .tc-events-grid { grid-template-columns: repeat(3, 1fr); }

/* List layout overrides the grid */
.tc-events-layout--list .tc-events-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Month grouping ─────────────────────────────────────────────────────── */
.tc-events-group + .tc-events-group {
  margin-top: 40px;
}

.tc-events-month-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--tc-text-muted);
  letter-spacing: .03em;
  text-transform: uppercase;
}

.tc-events-month-heading::before,
.tc-events-month-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--tc-border);
}

/* ── Month inline grouping (Monate nebeneinander) ───────────────────────── */
.tc-events-months-grid {
  display: grid;
  grid-template-columns: repeat(var(--tc-month-cols, 3), 1fr);
  gap: 24px;
  align-items: start;
}

.tc-events-month-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tc-events-month-header {
  font-size: 1rem;
  font-weight: 700;
  color: var(--tc-primary);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--tc-primary);
  margin-bottom: 4px;
}

.tc-events-month-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 900px) {
  .tc-events-months-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .tc-events-months-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Card (base — all layouts) ──────────────────────────────────────────── */
.tc-events-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--tc-bg);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
  overflow: hidden;
  box-shadow: var(--tc-shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.tc-events-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--tc-shadow-lg);
}

.tc-events-card--full {
  opacity: 0.72;
}

.tc-events-card--full:hover {
  transform: none;
  box-shadow: var(--tc-shadow-sm);
}

/* Full-card clickable overlay */
.tc-events-card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* Keep inner links above the overlay */
.tc-events-card-title a,
.tc-events-meta a {
  position: relative;
  z-index: 2;
}

/* ── Accent stripe (cards layout) ───────────────────────────────────────── */
.tc-events-stripe {
  height: 4px;
  flex-shrink: 0;
}

/* ── Image section ──────────────────────────────────────────────────────── */
.tc-events-card-img {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--tc-surface);
  flex-shrink: 0;
}

.tc-events-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tc-events-img-placeholder {
  width: 100%;
  height: 100%;
  opacity: 0.18;
}

/* Sold-out badge (overlays image) */
.tc-events-sold-out {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--tc-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  line-height: 1.4;
  z-index: 2;
}

/* Inline sold-out (when image is hidden) */
.tc-events-sold-out--inline {
  position: static;
  display: inline-block;
  margin-bottom: 8px;
}

/* ── Card body ──────────────────────────────────────────────────────────── */
.tc-events-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 16px;
  gap: 6px;
}

.tc-events-layout--cards .tc-events-card-body {
  padding: 20px;
  gap: 8px;
}

/* ── Badge ──────────────────────────────────────────────────────────────── */
/* Styling is now provided by the shared .tc-badge class in design-system.css. */

/* ── Title ──────────────────────────────────────────────────────────────── */
.tc-events-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--tc-text);
}

.tc-events-layout--cards .tc-events-card-title {
  font-size: 17px;
}

.tc-events-card-title a {
  color: inherit;
  text-decoration: none;
}

.tc-events-card-title a:hover {
  text-decoration: underline;
}

/* ── Excerpt ────────────────────────────────────────────────────────────── */
.tc-events-card-excerpt {
  margin: 0;
  font-size: 13px;
  color: var(--tc-text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Inline date list ───────────────────────────────────────────────────── */
.tc-dates-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
  z-index: 2;
}

.tc-dates-list__item {
  font-size: 12px;
  font-weight: 600;
  color: var(--tc-text);
  line-height: 1.45;
}

/* All dates except the first (nearest) are visually subdued */
.tc-dates-list__item--muted {
  color: var(--tc-text-muted);
}

/* "+N weitere Termine" hint — static, not a link */
.tc-dates-list__more {
  margin: 3px 0 0;
  padding: 0;
  font-size: 11px;
  color: var(--tc-text-muted);
  line-height: 1.4;
}

/* "Keine Termine" hint — matches date row font, muted color */
.tc-no-dates {
  margin: 2px 0 0;
  padding: 0;
  font-size: 13px;
  color: #ff3434;
  line-height: 1.4;
}

/* ── Meta list ──────────────────────────────────────────────────────────── */
.tc-events-meta {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tc-events-meta-item {
  display: flex !important;
  align-items: flex-start;
  gap: 7px;
  font-size: 12px;
  color: var(--tc-text-muted);
  line-height: 1.45;
}

.tc-events-meta-item svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  margin-top: 1px;
  fill: currentColor;
}

/* ── List layout ────────────────────────────────────────────────────────── */
.tc-events-layout--list .tc-events-card {
  flex-direction: row;
  min-height: 130px;
}

.tc-events-layout--list .tc-events-card-img {
  width: 200px;
  min-width: 200px;
  aspect-ratio: unset;
  height: auto;
  align-self: stretch;
  flex-shrink: 0;
  border-radius: 0;
}

/* Stripe at the left edge in list layout */
.tc-events-layout--list .tc-events-stripe {
  width: 4px;
  height: auto;
  align-self: stretch;
  flex-shrink: 0;
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.tc-events-empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--tc-text-muted);
  font-size: 15px;
  border: 1px dashed var(--tc-border);
  border-radius: var(--tc-radius);
}

.tc-events-empty p {
  margin: 0;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .tc-events-cols--3 .tc-events-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .tc-events-cols--2 .tc-events-grid,
  .tc-events-cols--3 .tc-events-grid {
    grid-template-columns: 1fr;
  }

  .tc-events-layout--list .tc-events-card {
    flex-direction: column;
    min-height: unset;
  }

  .tc-events-layout--list .tc-events-card-img {
    width: 100%;
    min-width: unset;
    aspect-ratio: 16 / 9;
    height: auto;
  }

  .tc-events-layout--list .tc-events-stripe {
    width: 100%;
    height: 4px;
  }

  .tc-events-month-heading {
    font-size: 13px;
  }
}
