/*
 * The event card brick's own sizes (DZ2, compose_cards.go CardKindFeatured /
 * CardKindStandard / CardKindDateRow): one light, token-driven card anatomy
 * shared by a store's event list (ListOptions.Card) and a product band that
 * renders through cmsportal.RenderEventCards (the railway-ask front).
 *
 * Self-contained: a product page links this file alone (theme
 * EventCardStylesheetURL), without portal-events.css, so every rule the card
 * needs is here; on a portal page it loads after portal-events.css and its
 * [data-card] selectors outrank the base .portal-event-card rules. Colours
 * are the portal tokens, else the shared ui tokens, else a neutral literal;
 * shape and spacing are the shared DZ tokens (--ui-radius, --ui-pad,
 * --ui-gap, --ui-small). The grid around the cards is the caller's.
 */

.portal-event-card:is([data-card="featured"], [data-card="standard"], [data-card="date_row"]) {
  --ec-surface: var(--portal-surface, var(--ui-surface, #fff));
  --ec-ink: var(--portal-text, var(--ui-ink, #16181d));
  --ec-muted: var(--portal-muted, var(--ui-muted, #5f6368));
  --ec-line: var(--portal-border, var(--ui-line, #e3e5e8));
  --ec-accent: var(--portal-accent, var(--ui-accent, #c90f1a));
  --ec-alt: var(--portal-surface-alt, var(--ui-bg, #f3f4f6));
  --ec-date: var(--portal-event-card-date, var(--ec-accent));
  display: flex; flex-direction: column; width: 100%; height: 100%; overflow: hidden;
  background-color: var(--ec-surface); color: var(--ec-ink); font-family: var(--ui-font, inherit);
  border: 1px solid var(--ec-line); border-radius: var(--ui-radius, 12px); box-shadow: none;
  transition: border-color .15s ease;
}
.portal-event-card:is([data-card="featured"], [data-card="standard"], [data-card="date_row"]):hover { border-color: var(--ec-accent); }
.portal-event-card:is([data-card="featured"], [data-card="standard"], [data-card="date_row"]) .portal-event-card-link { display: flex; flex: 1; flex-direction: column; min-height: 0; color: inherit; text-decoration: none; }

/* Picture box: a reserved 16:9 box; a card without a picture keeps only a
   slim transparent row for its year and flag (never an empty grey band). */
.portal-event-card:is([data-card="featured"], [data-card="standard"]) .portal-event-card-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background-color: var(--ec-alt); }
.portal-event-card:is([data-card="featured"], [data-card="standard"]) .portal-event-card-media:not(:has(img)) { aspect-ratio: auto; min-height: 0; display: flex; align-items: center; gap: .5rem; padding: 8px 8px 0; background-color: transparent; }
.portal-event-card:is([data-card="featured"], [data-card="standard"]) .portal-event-card-media:not(:has(img)) :is(.portal-card-flag, .portal-event-card-year-wrap) { position: static; }
.portal-event-card:is([data-card="featured"], [data-card="standard"]) .portal-event-card-media:not(:has(img)) .portal-card-flag { margin-left: auto; }
.portal-event-card:is([data-card="featured"], [data-card="standard"]) .portal-event-card-media:not(:has(img, .portal-card-flag, .portal-event-card-year-wrap)) { display: none; }
.portal-event-card:is([data-card="featured"], [data-card="standard"]) .portal-event-card-image { display: block; width: 100%; height: 100%; object-fit: cover; }
.portal-event-card:is([data-card="featured"], [data-card="standard"]) .portal-card-flag { position: absolute; top: 8px; right: 8px; z-index: 2; }
.portal-event-card:is([data-card="featured"], [data-card="standard"]) .portal-event-card-flag-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; min-height: 2rem; padding-inline: .375rem; border: 0; border-radius: var(--ui-radius-sm, 8px); background-color: color-mix(in srgb, var(--ec-surface) 88%, transparent); font-size: 1rem; line-height: 1; box-shadow: none; backdrop-filter: none; }
.portal-event-card:is([data-card="featured"], [data-card="standard"]) .portal-country-flag { display: inline-block; width: 1.5em; height: 1em; vertical-align: middle; }
.portal-event-card:is([data-card="featured"], [data-card="standard"]) .portal-event-card-year-wrap { position: absolute; top: 8px; left: 8px; z-index: 2; }
.portal-event-card:is([data-card="featured"], [data-card="standard"]) .portal-event-card-year { display: inline-block; padding: 2px 10px; border: 0; border-radius: var(--ui-radius-pill, 999px); background-color: color-mix(in srgb, var(--ec-surface) 92%, transparent); color: var(--ec-ink); font-size: .75rem; font-weight: 600; letter-spacing: 0; text-transform: none; backdrop-filter: none; }
.portal-event-card:is([data-card="featured"], [data-card="standard"], [data-card="date_row"]) .portal-event-card-more-wrap { display: none; }

/* Image credit: a small mark on the picture, its text on hover/focus. */
.portal-event-card:is([data-card="featured"], [data-card="standard"]) .portal-event-card-credit { position: absolute; left: 8px; bottom: 8px; z-index: 2; display: inline-flex; align-items: center; justify-content: center; width: 1.25rem; height: 1.25rem; border-radius: var(--ui-radius-pill, 999px); background-color: color-mix(in srgb, var(--ec-ink) 60%, transparent); color: var(--ec-surface); font-size: .6875rem; font-weight: 700; line-height: 1; cursor: help; }
.portal-event-card:is([data-card="featured"], [data-card="standard"]) .portal-event-card-credit-tip { position: absolute; left: 0; bottom: calc(100% + 6px); width: max-content; max-width: 16rem; padding: 6px 8px; border-radius: var(--ui-radius-sm, 8px); background-color: var(--ec-ink); color: var(--ec-surface); font-size: .6875rem; font-weight: 500; line-height: 1.35; opacity: 0; visibility: hidden; pointer-events: none; }
.portal-event-card:is([data-card="featured"], [data-card="standard"]) .portal-event-card-credit:is(:hover, :focus) .portal-event-card-credit-tip { opacity: 1; visibility: visible; }

/* Body: title, then summary and the date and place rows. */
.portal-event-card:is([data-card="featured"], [data-card="standard"], [data-card="date_row"]) .portal-event-card-body { display: flex; flex: 1; flex-direction: column; gap: 8px; padding: var(--ui-pad, 16px); }
.portal-event-card:is([data-card="featured"], [data-card="standard"], [data-card="date_row"]) .portal-event-card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 0; margin: 0; color: var(--ec-ink); font-size: 1rem; font-weight: 700; line-height: 1.3; text-transform: none; overflow-wrap: anywhere; }
.portal-event-card[data-card="featured"] .portal-event-card-title { font-size: 1.25rem; }
.portal-event-card:is([data-card="featured"], [data-card="standard"], [data-card="date_row"]):hover .portal-event-card-title { color: var(--ec-accent); }
.portal-event-card:is([data-card="featured"], [data-card="standard"], [data-card="date_row"]) .portal-event-card-tail { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.portal-event-card:is([data-card="featured"], [data-card="standard"]) .portal-event-card-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 0; margin: 0; color: var(--ec-muted); font-size: var(--ui-small, .8125rem); line-height: 1.4; text-transform: none; }
.portal-event-card:is([data-card="featured"], [data-card="standard"], [data-card="date_row"]) .portal-event-card-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.portal-event-card:is([data-card="featured"], [data-card="standard"], [data-card="date_row"]) .portal-event-card-meta-row { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--ec-muted); font-size: var(--ui-small, .8125rem); font-weight: 600; }
.portal-event-card:is([data-card="featured"], [data-card="standard"]) .portal-event-card-meta-row--date { color: var(--ec-date); }
.portal-event-card:is([data-card="featured"], [data-card="standard"], [data-card="date_row"]) .portal-event-card-meta-icon { flex: none; width: 14px; height: 14px; color: var(--ec-accent); }
.portal-event-card:is([data-card="featured"], [data-card="standard"], [data-card="date_row"]) .portal-event-card-meta-place { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Date row: the date block (day over short month) beside the title and
   place; no picture, flag, badge or summary. */
.portal-event-card[data-card="date_row"] { height: auto; }
.portal-event-card[data-card="date_row"] .portal-event-card-link { flex-direction: row; align-items: stretch; }
.portal-event-card[data-card="date_row"] .portal-event-card-media { position: static; display: flex; flex: none; align-items: center; justify-content: center; width: 4.5rem; min-height: 4rem; aspect-ratio: auto; background-color: var(--ec-alt); }
.portal-event-card[data-card="date_row"] :is(.portal-card-flag, .portal-event-card-year-wrap, .portal-event-card-credit) { display: none; }
.portal-event-card-date { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; color: var(--ec-date); line-height: 1.1; text-align: center; }
.portal-event-card-date-day { font-size: 1.125rem; font-weight: 700; white-space: nowrap; }
.portal-event-card-date-month { color: var(--ec-muted); font-size: .75rem; font-weight: 600; text-transform: uppercase; }
.portal-event-card[data-card="date_row"] .portal-event-card-body { justify-content: center; gap: 4px; padding: 10px var(--ui-pad, 16px); }
.portal-event-card[data-card="date_row"] .portal-event-card-title { font-size: .9375rem; }
