/* ==========================================================================
   WCPA Events — frontend styles for [wcpa_events_list] and [wcpa_events_calendar].

   Token-compatible with the WCPA theme (consumes its --wcpa-* CSS variables
   where present) but has local fallbacks so the plugin renders sanely under
   any active theme. All contrast pairs are tested for WCAG 2.1 AA (4.5:1)
   against their backgrounds.
   ========================================================================== */

:root {
	--wevt-navy:    var(--wcpa-navy, #0f2144);
	--wevt-dark:    var(--wcpa-dark-navy, #0a1a33);
	--wevt-gold:    var(--wcpa-gold, #e2a83e);
	--wevt-gold2:   var(--wcpa-gold-2, #c8902f);
	--wevt-paper:   var(--wcpa-white, #ffffff);
	--wevt-mute:    var(--wcpa-off-white, #f5f3ee);
	--wevt-line:    var(--wcpa-line, #e5e7eb);
	--wevt-text:    var(--wcpa-text, #1f2937);
	--wevt-muted:   var(--wcpa-muted, #4b5563);
	--wevt-ease:    var(--wcpa-ease, cubic-bezier(.2,.7,.2,1));
	--wevt-radius:  var(--wcpa-radius-md, 12px);
	--wevt-shadow:  var(--wcpa-shadow-sm, 0 1px 2px rgba(15,33,68,0.06));
	--wevt-shadow-lg: var(--wcpa-shadow-lg, 0 12px 32px rgba(15,33,68,0.14));
}

.wcpa-evt-empty {
	background: var(--wevt-paper);
	border: 1px solid var(--wevt-line);
	border-radius: var(--wevt-radius);
	padding: 32px;
	text-align: center;
	color: var(--wevt-muted);
}

/* === LIST (cards) ======================================================== */
.wcpa-evt-list {
	list-style: none; padding: 0; margin: 0;
	display: grid; gap: 18px;
	grid-template-columns: 1fr;
}
@media (min-width: 720px)  { .wcpa-evt-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .wcpa-evt-list { grid-template-columns: repeat(3, 1fr); } }

.wcpa-evt-card {
	display: grid; grid-template-columns: 88px 1fr; gap: 18px;
	background: var(--wevt-paper);
	border: 1px solid var(--wevt-line);
	border-radius: var(--wevt-radius);
	box-shadow: var(--wevt-shadow);
	padding: 18px 20px;
	transition: border-color .2s var(--wevt-ease), box-shadow .2s var(--wevt-ease), transform .15s var(--wevt-ease);
	position: relative;
}
.wcpa-evt-card:hover, .wcpa-evt-card:focus-within {
	border-color: transparent;
	box-shadow: var(--wevt-shadow-lg);
	transform: translateY(-2px);
}
.wcpa-evt-card__datestack {
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	background: linear-gradient(135deg, var(--wevt-navy), var(--wevt-dark));
	color: var(--wevt-paper);
	border-radius: 10px;
	padding: 10px 6px;
	line-height: 1;
}
.wcpa-evt-card__month {
	font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
	color: var(--wevt-gold); font-weight: 600;
}
.wcpa-evt-card__day {
	font-size: 1.75rem; font-weight: 700; margin: 4px 0; color: var(--wevt-paper);
}
.wcpa-evt-card__weekday {
	font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
	color: rgba(255,255,255,.7);
}
.wcpa-evt-card__body { min-width: 0; }
.wcpa-evt-card__title { font-size: 1.1rem; line-height: 1.3; margin: 0 0 6px; color: var(--wevt-navy); }
.wcpa-evt-card__title a { color: inherit; }
.wcpa-evt-card__title a:hover { color: var(--wevt-gold2); }
.wcpa-evt-card__when, .wcpa-evt-card__where {
	color: var(--wevt-muted); font-size: .92rem; margin: 0 0 6px;
	display: inline-flex; align-items: center; gap: 6px;
}
.wcpa-evt-card__where a { color: var(--wevt-navy); border-bottom: 1px solid transparent; }
.wcpa-evt-card__where a:hover { border-bottom-color: var(--wevt-gold); color: var(--wevt-gold2); }
.wcpa-evt-card__icon { color: var(--wevt-navy); }
.wcpa-evt-card__excerpt { color: var(--wevt-text); margin: 8px 0; font-size: .95rem; }
.wcpa-evt-card__files {
	list-style: none; padding: 0; margin: 8px 0 0;
	display: flex; flex-wrap: wrap; gap: 6px;
}
.wcpa-evt-card__files a {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 5px 10px;
	background: var(--wevt-mute); color: var(--wevt-navy);
	border-radius: 999px; font-size: .85rem; font-weight: 500;
	border: 1px solid var(--wevt-line);
}
.wcpa-evt-card__files a:hover, .wcpa-evt-card__files a:focus-visible {
	background: var(--wevt-navy); color: var(--wevt-paper);
	border-color: var(--wevt-navy);
}

.wcpa-evt-card__actions { margin-top: 10px; }
.wcpa-evt-card__addcal { position: relative; display: inline-block; }
.wcpa-evt-card__addcal summary {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 7px 12px;
	background: var(--wevt-paper); color: var(--wevt-navy);
	border: 1px solid var(--wevt-navy); border-radius: 999px;
	font-size: .85rem; font-weight: 600; cursor: pointer;
	list-style: none;
}
.wcpa-evt-card__addcal summary::-webkit-details-marker { display: none; }
.wcpa-evt-card__addcal[open] summary { background: var(--wevt-navy); color: var(--wevt-paper); }
.wcpa-evt-card__addcal summary:hover, .wcpa-evt-card__addcal summary:focus-visible { background: var(--wevt-navy); color: var(--wevt-paper); }
.wcpa-evt-card__addcalmenu {
	list-style: none; padding: 6px 0; margin: 6px 0 0;
	position: absolute; top: 100%; left: 0; min-width: 200px;
	background: var(--wevt-paper);
	border: 1px solid var(--wevt-line);
	border-radius: var(--wevt-radius);
	box-shadow: var(--wevt-shadow-lg);
	z-index: 20;
}
.wcpa-evt-card__addcalmenu a {
	display: block; padding: 8px 16px; color: var(--wevt-text); font-size: .92rem;
}
.wcpa-evt-card__addcalmenu a:hover, .wcpa-evt-card__addcalmenu a:focus-visible {
	background: var(--wevt-mute); color: var(--wevt-navy);
}

/* === CALENDAR GRID ======================================================= */
.wcpa-evt-cal {
	background: var(--wevt-paper);
	border: 1px solid var(--wevt-line);
	border-radius: var(--wevt-radius);
	overflow: hidden;
	box-shadow: var(--wevt-shadow);
}
.wcpa-evt-cal__head {
	display: flex; align-items: center; justify-content: space-between;
	gap: 16px; flex-wrap: wrap;
	padding: 14px 18px;
	background: linear-gradient(135deg, var(--wevt-navy), var(--wevt-dark));
	color: var(--wevt-paper);
}
.wcpa-evt-cal__title { color: var(--wevt-paper); margin: 0; font-size: 1.25rem; font-weight: 700; }
.wcpa-evt-cal__nav { display: flex; gap: 6px; }
.wcpa-evt-cal__navbtn {
	display: inline-flex; align-items: center;
	padding: 7px 14px;
	background: rgba(255,255,255,.08); color: var(--wevt-paper);
	border-radius: 999px; font-size: .85rem; font-weight: 600;
	transition: background .2s var(--wevt-ease), color .2s var(--wevt-ease);
}
.wcpa-evt-cal__navbtn:hover, .wcpa-evt-cal__navbtn:focus-visible {
	background: var(--wevt-gold); color: var(--wevt-navy);
}
.wcpa-evt-cal__today { background: var(--wevt-gold); color: var(--wevt-navy); }
.wcpa-evt-cal__today:hover, .wcpa-evt-cal__today:focus-visible {
	background: var(--wevt-gold2); color: var(--wevt-navy);
}

.wcpa-evt-cal__grid { display: block; }
.wcpa-evt-cal__weekrow {
	display: grid; grid-template-columns: repeat(7, 1fr);
	background: var(--wevt-mute);
	border-bottom: 1px solid var(--wevt-line);
}
.wcpa-evt-cal__weekhead {
	padding: 10px 0;
	text-align: center; font-weight: 600; color: var(--wevt-navy);
	font-size: .82rem; letter-spacing: .06em; text-transform: uppercase;
}
.wcpa-evt-cal__row {
	display: grid; grid-template-columns: repeat(7, 1fr);
	border-bottom: 1px solid var(--wevt-line);
}
.wcpa-evt-cal__row:last-child { border-bottom: 0; }
.wcpa-evt-cal__cell {
	min-height: 96px;
	border-right: 1px solid var(--wevt-line);
	padding: 6px 8px;
	background: var(--wevt-paper);
	position: relative;
	transition: background .15s var(--wevt-ease), outline .15s var(--wevt-ease);
}
.wcpa-evt-cal__cell:last-child { border-right: 0; }
.wcpa-evt-cal__cell:hover { background: var(--wevt-mute); }
.wcpa-evt-cal__cell:focus-visible {
	outline: 3px solid var(--wevt-gold); outline-offset: -3px; background: var(--wevt-mute); z-index: 2;
}
.wcpa-evt-cal__cell.is-outmonth { background: #f9f9f7; color: #9ca3af; }
.wcpa-evt-cal__cell.is-outmonth .wcpa-evt-cal__daynum { color: #9ca3af; }
.wcpa-evt-cal__cell.is-today {
	background: rgba(226,168,62,0.08);
}
.wcpa-evt-cal__cell.is-today .wcpa-evt-cal__daynum {
	background: var(--wevt-navy); color: var(--wevt-paper);
	width: 28px; height: 28px; border-radius: 999px;
	display: inline-flex; align-items: center; justify-content: center;
}
.wcpa-evt-cal__daynum {
	font-weight: 600; color: var(--wevt-text); font-size: .92rem;
	display: inline-block;
}
.wcpa-evt-cal__events { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 3px; }
.wcpa-evt-cal__pill {
	display: block; padding: 3px 6px;
	background: var(--wevt-navy); color: var(--wevt-paper);
	border-radius: 4px; font-size: .76rem;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
	line-height: 1.3;
}
.wcpa-evt-cal__pill:hover, .wcpa-evt-cal__pill:focus-visible {
	background: var(--wevt-gold); color: var(--wevt-navy);
}
.wcpa-evt-cal__pilltime { color: var(--wevt-gold); margin-right: 4px; font-weight: 600; }
.wcpa-evt-cal__pill:hover .wcpa-evt-cal__pilltime,
.wcpa-evt-cal__pill:focus-visible .wcpa-evt-cal__pilltime { color: var(--wevt-navy); }
.wcpa-evt-cal__more { font-size: .72rem; color: var(--wevt-muted); padding-left: 6px; }

/* Mobile: stack the grid one day per row, like a list. */
@media (max-width: 640px) {
	.wcpa-evt-cal__weekrow { display: none; }
	.wcpa-evt-cal__row { display: flex; flex-direction: column; border-bottom: 0; }
	.wcpa-evt-cal__cell { min-height: 0; border-right: 0; border-bottom: 1px solid var(--wevt-line); padding: 10px 14px; }
	.wcpa-evt-cal__cell.is-outmonth { display: none; }  /* hide buffer days on mobile */
	.wcpa-evt-cal__cell:not(.has-events) { display: none; }  /* only show days that have events on mobile */
	.wcpa-evt-cal__cell::before {
		content: attr(data-date);
		display: block; font-size: .78rem; font-weight: 600;
		color: var(--wevt-gold); letter-spacing: .08em; text-transform: uppercase;
		margin-bottom: 4px;
	}
	.wcpa-evt-cal__pill { font-size: .9rem; padding: 8px 10px; }
}

/* Screen-reader-only text */
.screen-reader-text {
	border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
	height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px;
}

/* Respect user's reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
	.wcpa-evt-card { transition: none; }
	.wcpa-evt-card:hover { transform: none; }
}
