/*
 * SDAweb Calendar Sync — Upcoming view.
 *
 * Compact vertical event list designed for sidebars and widgets. Sits on
 * ANY background (light, dark, branded). Uses currentColor and transparent
 * backgrounds so the surrounding theme's text and background cascade
 * through. The single brand-color use is the date column accent (weekday
 * + month abbreviations) — the day-of-month number itself uses inherited
 * text color so the most prominent glyph stays readable.
 *
 * Specificity strategy: every theme-vulnerable rule is scoped under
 * `.sdaweb-gcal.sdaweb-gcal--upcoming` (0-3-0). The wrapper carries both
 * classes, so doubling them is a valid CSS technique that wins against
 * common theme compound selectors like `.footer .widget a` (0-2-1) or
 * `aside.widget_block a` (0-2-1) without resorting to !important.
 *
 * Borders pick a neutral `rgba(128,128,128,…)` baseline as the universal
 * fallback (legacy Safari < 15.4 lacks `color-mix()`). On modern browsers a
 * `@supports (color: color-mix(...))` block at the bottom of this file swaps
 * borders to `color-mix(in srgb, currentColor X%, transparent)` so dividers
 * stay visible on saturated brand backgrounds (gray-on-red is invisible).
 *
 * Acknowledged limitations (not solvable at CSS level):
 *   - brand event-color colliding with surrounding background (user-side
 *     color choice problem, document in help text)
 *   - busy image/pattern backgrounds may obscure thin neutral borders
 *   - themes that use `!important` on link styling defeat any non-important
 *     plugin rule by design
 */

.sdaweb-gcal--upcoming {
	background: transparent;
	color: inherit;
	font-size: 14px;
	line-height: 1.4;
}

.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__title {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 8px;
	padding-bottom: 8px;
	margin-bottom: 4px;
	border-bottom: 1px solid rgba( 128, 128, 128, 0.2 );
	font-size: var( --sdaweb-gcal-title-size, 15px );
	font-weight: var( --sdaweb-gcal-title-weight, 500 );
	text-transform: var( --sdaweb-gcal-title-transform, none );
}

.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__title-text {
	text-transform: var( --sdaweb-gcal-title-transform, none );
}

/* Standalone "Above the list" link row (placement=top with no title row).
   Mirrors the title row's spacing/divider so it reads as intentional. */
.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__toplink {
	display: flex;
	justify-content: flex-end;
	padding-bottom: 8px;
	margin-bottom: 4px;
	border-bottom: 1px solid rgba( 128, 128, 128, 0.2 );
}

.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__link {
	font-size: 13px;
	font-weight: 400;
	text-decoration: none;
	color: var( --sdaweb-gcal-event-color, var( --sdaweb-gcal-color-primary, currentColor ) );
	flex-shrink: 0;
}

.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__link:hover,
.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__link:focus-visible {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__list,
.sdaweb-gcal.sdaweb-gcal--upcoming li.sdaweb-gcal-upcoming__row {
	list-style: none;
	padding-left: 0;
	margin-left: 0;
	margin-block: 0;
}

.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__row {
	display: flex;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid;
	border-bottom-color: rgba( 128, 128, 128, 0.18 );
}

.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__row:last-child {
	border-bottom: 0;
}

.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__date {
	flex: 0 0 44px;
	text-align: center;
	line-height: 1.1;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var( --sdaweb-gcal-event-color, var( --sdaweb-gcal-color-primary ) );
	font-weight: 500;
	padding-top: 1px;
}

.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__date-weekday,
.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__date-month {
	display: block;
}

/*
 * Day-of-month number uses inherited text color, not the brand accent —
 * it's the most prominent glyph in the row and needs to read cleanly
 * against any background.
 */
.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__date-day {
	display: block;
	font-size: 22px;
	font-weight: 500;
	color: inherit;
	margin: 1px 0 1px;
	line-height: 1;
}

.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__content {
	flex: 1;
	min-width: 0;
}

.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__name {
	color: inherit;
	text-decoration: none;
	/* Admin-controlled event-text size/weight (list_text_size / list_text_weight,
	   v0.16.4). Fallbacks 13px / 400 reproduce the prior fixed styling, so a
	   display that never sets them is unchanged. */
	font-size: var( --sdaweb-gcal-list-text-size, 13px );
	font-weight: var( --sdaweb-gcal-list-text-weight, 400 );
	line-height: 1.35;
	display: block;
	word-wrap: break-word;
}

.sdaweb-gcal.sdaweb-gcal--upcoming a.sdaweb-gcal-upcoming__name:hover,
.sdaweb-gcal.sdaweb-gcal--upcoming a.sdaweb-gcal-upcoming__name:focus-visible {
	text-decoration: underline;
	text-underline-offset: 3px;
	color: inherit;
}

/*
 * Meta + empty states intentionally do NOT dim via opacity. On dark / saturated
 * surfaces (e.g. branded footers) opacity blends fg toward bg and sinks contrast
 * below WCAG AA — incompatible with this view's "sits on ANY background"
 * promise. Hierarchy comes from the smaller font-size alone; full inherited
 * color keeps contrast equal to the title on every background.
 */
.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__meta {
	margin-top: 2px;
	/* Admin-controlled meta/time size (list_meta_size, v0.18.0). The 11px
	   fallback reproduces the prior fixed size, so an untouched display is
	   unchanged. */
	font-size: var( --sdaweb-gcal-meta-size, 11px );
	color: inherit;
}

.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__empty {
	padding: 12px 0;
	margin: 0;
	color: inherit;
	font-size: 13px;
	text-align: center;
}

@supports ( border-color: color-mix( in srgb, currentColor 50%, transparent ) ) {
	.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__title {
		border-bottom-color: color-mix( in srgb, currentColor 20%, transparent );
	}

	.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__row {
		border-bottom-color: color-mix( in srgb, currentColor 18%, transparent );
	}
}

/*
 * Optional filled "date badge" style (per-display list_date_style=badge, v0.14.4).
 * All rules scoped to .is-date-badge so the default 'plain' look is untouched.
 * Colors arrive precomputed from PHP as CSS variables (no color-mix needed):
 *   --sdaweb-gcal-badge-bg / --sdaweb-gcal-badge-bg2  filled badge gradient stops
 *   --sdaweb-gcal-badge-fg                            badge text (white)
 *   --sdaweb-gcal-accent-rgb                          "r,g,b" for rgba() tints
 * The triple-class selectors give 0-4-0 specificity to beat host-theme widget
 * and footer rules (e.g. The7) without resorting to !important.
 */
.sdaweb-gcal.sdaweb-gcal--upcoming.is-date-badge .sdaweb-gcal-upcoming__row {
	align-items: center;
	padding: 10px 8px;
	border-radius: 8px;
	border-bottom: 1px solid rgba( var( --sdaweb-gcal-accent-rgb ), .12 );
	transition: background .15s ease;
}

.sdaweb-gcal.sdaweb-gcal--upcoming.is-date-badge .sdaweb-gcal-upcoming__row:hover {
	background: rgba( var( --sdaweb-gcal-accent-rgb ), .07 );
}

.sdaweb-gcal.sdaweb-gcal--upcoming.is-date-badge .sdaweb-gcal-upcoming__date {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 56px;
	padding: 7px 6px;
	border-radius: 10px;
	background: linear-gradient( 160deg, var( --sdaweb-gcal-badge-bg ), var( --sdaweb-gcal-badge-bg2 ) );
	box-shadow: 0 2px 6px rgba( var( --sdaweb-gcal-accent-rgb ), .28 );
}

.sdaweb-gcal.sdaweb-gcal--upcoming.is-date-badge .sdaweb-gcal-upcoming__date-weekday,
.sdaweb-gcal.sdaweb-gcal--upcoming.is-date-badge .sdaweb-gcal-upcoming__date-month {
	color: var( --sdaweb-gcal-badge-fg );
	text-transform: uppercase;
	letter-spacing: .5px;
	font-size: 10px;
	line-height: 1.3;
}

.sdaweb-gcal.sdaweb-gcal--upcoming.is-date-badge .sdaweb-gcal-upcoming__date-day {
	color: var( --sdaweb-gcal-badge-fg );
	font-weight: 700;
	font-size: 22px;
	line-height: 1.1;
}

.sdaweb-gcal.sdaweb-gcal--upcoming.is-date-badge .sdaweb-gcal-upcoming__name {
	font-weight: 600;
	transition: color .15s ease;
}

.sdaweb-gcal.sdaweb-gcal--upcoming.is-date-badge .sdaweb-gcal-upcoming__name:hover {
	color: rgb( var( --sdaweb-gcal-accent-rgb ) );
}

/*
 * Date-badge size (per-display date_badge_size, v0.17.0). Only meaningful in
 * badge mode; the wrapper carries is-badge-compact / is-badge-large alongside
 * is-date-badge. 'standard' emits no modifier so the base badge is untouched.
 * Scales box / day-number / labels ~0.8x (compact) and ~1.3x (large) from the
 * base; the weekday/month labels are floored at 9px for legibility (a clean
 * 0.8x of the 10px base would be 8px). Triple+ class specificity beats the base
 * is-date-badge rules without !important.
 */
.sdaweb-gcal.sdaweb-gcal--upcoming.is-date-badge.is-badge-compact .sdaweb-gcal-upcoming__date {
	min-width: 45px;
	padding: 6px 5px;
	border-radius: 8px;
}

.sdaweb-gcal.sdaweb-gcal--upcoming.is-date-badge.is-badge-compact .sdaweb-gcal-upcoming__date-weekday,
.sdaweb-gcal.sdaweb-gcal--upcoming.is-date-badge.is-badge-compact .sdaweb-gcal-upcoming__date-month {
	font-size: 9px;
}

.sdaweb-gcal.sdaweb-gcal--upcoming.is-date-badge.is-badge-compact .sdaweb-gcal-upcoming__date-day {
	font-size: 18px;
}

.sdaweb-gcal.sdaweb-gcal--upcoming.is-date-badge.is-badge-large .sdaweb-gcal-upcoming__date {
	min-width: 73px;
	padding: 9px 8px;
	border-radius: 13px;
}

.sdaweb-gcal.sdaweb-gcal--upcoming.is-date-badge.is-badge-large .sdaweb-gcal-upcoming__date-weekday,
.sdaweb-gcal.sdaweb-gcal--upcoming.is-date-badge.is-badge-large .sdaweb-gcal-upcoming__date-month {
	font-size: 13px;
}

.sdaweb-gcal.sdaweb-gcal--upcoming.is-date-badge.is-badge-large .sdaweb-gcal-upcoming__date-day {
	font-size: 29px;
}

/*
 * Relative-date pill (per-display relative_dates, v0.17.0). White text on the
 * event accent (reuses --sdaweb-gcal-event-color set per row; fallback #005480
 * = 8.14:1 with white). Sits below the block-level name on its own line.
 */
.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__rel {
	display: inline-block;
	margin-top: 3px;
	padding: 1px 7px;
	border-radius: 10px;
	font-size: 10px;
	font-weight: 600;
	line-height: 1.5;
	letter-spacing: 0.02em;
	color: #fff;
	background: var( --sdaweb-gcal-event-color, #005480 );
}

/*
 * Day/week group headers (per-display upcoming_grouping, v0.17.0). A non-event
 * <li role="presentation"> carrying a real <h3> heading for screen readers.
 * No list bullet; a hairline divider under a muted uppercase label.
 */
.sdaweb-gcal.sdaweb-gcal--upcoming li.sdaweb-gcal-upcoming__group {
	list-style: none;
	padding: 0;
	margin: 0;
	border: 0;
}

.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__group-label {
	margin: 14px 0 2px;
	padding-bottom: 4px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: inherit;
	border-bottom: 1px solid rgba( 128, 128, 128, 0.2 );
}

.sdaweb-gcal.sdaweb-gcal--upcoming li.sdaweb-gcal-upcoming__group:first-child .sdaweb-gcal-upcoming__group-label {
	margin-top: 0;
}

@supports ( border-color: color-mix( in srgb, currentColor 50%, transparent ) ) {
	.sdaweb-gcal.sdaweb-gcal--upcoming .sdaweb-gcal-upcoming__group-label {
		border-bottom-color: color-mix( in srgb, currentColor 20%, transparent );
	}
}
