/* ── Eventcard — one component, two sizes ────────────────────────────────────
 *
 * Replaces eventcard-small.css and eventcard-medium.css, which had grown into
 * two namespaces (.ecs-*, .ecm-*) for what is one card: .ecm used CSS Grid while
 * .ecs used flex, and every rule existed twice. Shared visuals (typography,
 * badges, buttons, category tints) live in eventcard-base.css — this is layout.
 *
 *   .ec[data-size]           card shell
 *     ├─ .ec-media           image area          (absent at size=small)
 *     └─ .ec-body
 *         ├─ .ec-main        title / desc / meta
 *         └─ .ec-aside       social proof / actions
 *
 * The size axis is a DELTA on that structure, nothing more:
 *
 *   small    flex column   no media                  (the base)
 *   medium   flex row      media left, fixed 253px
 *
 * NOT the large card. It shares the `.nc-*` namespace with three other card
 * builders and with rules in index.css, so folding it in here would reach far
 * beyond the eventcards. It keeps eventcard-large.css and carries only
 * `data-size="large"` so the sync sees the axis.
 *
 * `data-size` rather than a modifier class because penpot-sync reads it as a
 * variant axis: `.ec[data-size="medium"]` ⇄ Penpot `Size=medium`.
 * ─────────────────────────────────────────────────────────────────────────── */

/* @penpot cmp.eventcard */
.ec {
  display: flex;
  flex-direction: column;
  /* 688px-Cap (Penpot-Referenzartboard) ist entfernt — alle Feed-Eventcards
   * füllen die volle Containerbreite; der Cap machte die Karte schmaler als
   * die Large-Karte. */
  max-width: 100%;
  background: var(--ec-card-bg);
  --ec-card-bg: var(--cat-default);
}

/* Category tint in a variable so the card and any child inheriting --ec-card-bg
 * (the badge) stay in step. */
.ec.cat-music     { --ec-card-bg: var(--cat-music); }
.ec.cat-film      { --ec-card-bg: var(--cat-film); }
.ec.cat-community { --ec-card-bg: var(--cat-community); }
.ec.cat-arts      { --ec-card-bg: var(--cat-arts); }
.ec.cat-tech      { --ec-card-bg: var(--cat-tech); }
.ec.cat-nightlife  { --ec-card-bg: var(--cat-nightlife); }
.ec.cat-food       { --ec-card-bg: var(--cat-food); }
.ec.cat-kinder     { --ec-card-bg: var(--cat-kinder); }
.ec.cat-education  { --ec-card-bg: var(--cat-education); }
.ec.cat-sports     { --ec-card-bg: var(--cat-sports); }

/* ── Media ── */
.ec-media {
  position: relative;
  overflow: hidden;
}

.ec-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Body ──
 * space-between pushes the aside to the bottom when the card is taller than its
 * content — the behaviour .ecs-body had, now expressed once. */
.ec-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: var(--ec-pad);
  min-width: 0;
}

.ec-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.ec-aside {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Social proof ── */
.ec-social {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ec-avatars {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.ec-av {
  width: 32px;
  height: 32px;
  margin-left: -12px;
  font-size: 13px;
}

.ec-av:first-child {
  margin-left: 0;
}

/* ── Bottom row: ticket CTA + actions ── */
.ec-bottom-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.ec-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  /* The attend + bookmark pills are nowrap; without wrapping they pushed the
   * card past its column in the calendar's narrower content area and put the
   * whole page into horizontal scroll. */
  flex-wrap: wrap;
  min-width: 0;
}

/* ════════════════════════════════════════════════════════════════════════════
 * size=medium — image left, content right
 * ══════════════════════════════════════════════════════════════════════════ */
.ec[data-size="medium"] {
  flex-direction: row;
  min-height: 300px;
}

.ec[data-size="medium"] .ec-media {
  flex: 0 0 253px;
  /* Round the corners meeting the card edge; the card is overflow:visible so
   * the attendance dropdown can escape. */
  border-radius: var(--ec-radius) 0 0 var(--ec-radius);
}

.ec[data-size="medium"] .ec-poster {
  position: absolute;
  inset: 0;
}

.ec[data-size="medium"] .ec-body {
  flex: 1;
}

/* Avatars stacked ABOVE the text, and breathing room before the aside. */
.ec[data-size="medium"] .ec-social {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.ec[data-size="medium"] .ec-aside {
  margin-top: 24px;
}

.ec[data-size="medium"] .ec-av {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

/* ════════════════════════════════════════════════════════════════════════════
 * Responsive
 * ══════════════════════════════════════════════════════════════════════════ */

/* Container query for the medium card: its media column is a fixed 253px, and a
 * viewport rule holds in the full-width feed but not in the calendar, where the
 * card sits in a column narrowed by the time gutter. At a 1000px viewport the
 * body was left with 135px and the title broke one word per line. */
/* The hosts. `.ec-host` is the explicit opt-in for any new container; `.tl-day`
 * (feed + calendar timeline) is the one that exists today. Without a host on the
 * actual ancestor the @container block below never matches anything — which is
 * what had been happening: the rule was written, the host class never emitted.
 *
 * Safe against the card's escaping overlays: `container-type: inline-size` adds
 * layout+style containment, not paint containment, so nothing is clipped. The
 * attendance dropdown is positioned against `.att-dropdown` INSIDE the card, so
 * its containing block does not move either. */
.ec-host,
.tl-day {
  container-type: inline-size;
}

@container (max-width: 560px) {
  .ec[data-size="medium"] {
    flex-direction: column;
    max-width: 100%;
  }
  .ec[data-size="medium"] .ec-media {
    flex: 0 0 200px;
    border-radius: var(--ec-radius) var(--ec-radius) 0 0;
  }
  .ec[data-size="medium"] .ec-body {
    gap: 16px;
    padding: 12px;
  }
}

@media (max-width: 768px) {
  .ec {
    max-width: 100%;
  }
  .ec[data-size="small"] .ec-body {
    padding: 12px;
  }
  /* Kein eigener Typ für die kleine Karte mehr: Titel/Description laufen in
   * allen drei Größen auf dem Base-Typ (24/16 aus eventcard-base.css). */
}

@media (max-width: 600px) {
  .ec[data-size="medium"] {
    flex-direction: column;
    max-width: 100%;
  }
  .ec[data-size="medium"] .ec-media {
    flex: 0 0 200px;
    border-radius: var(--ec-radius) var(--ec-radius) 0 0;
  }
  .ec[data-size="medium"] .ec-body {
    gap: 16px;
    padding: 12px;
  }
  .ec[data-size="medium"] .ec-av {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 480px) {
  /* No full-bleed here. The former `border-radius: 0; margin: 0 -16px` assumed a
   * parent with exactly 16px of padding; inside the feed the chain is
   * .page (8px) + .tl-day (26px left / 0 right), so the card missed the edge on
   * the left and overshot it on the right — square-cornered and lopsided. */
  .ec {
    margin-bottom: 16px;
  }
  .ec[data-size="small"] .ec-av {
    width: 24px;
    height: 24px;
    margin-left: -10px;
  }
  .ec[data-size="medium"] .ec-media {
    border-radius: var(--ec-radius) var(--ec-radius) 0 0;
  }
  /* .ec-social-txt behaelt die 12px aus eventcard-base.css — der alte 14px-Aus-
   * reisser galt nur der kleinen Karte und machte sie auch hier inkonsistent. */
  .ec-actions {
    flex: 1;
    justify-content: flex-end;
  }
}
