/* ==========================================================================
   TEC-10 · Event Timeline (.sentio-tet)
   ==========================================================================
   10 differentiators: scroll-triggered animations, auto month grouping,
   alternating left-right, current date marker, expandable cards, category
   spine coloring, milestone events, bidirectional display, image lightbox,
   year jump navigation.

   Extracted from frontend.css:35964-36307 during the Batch 2
   tec-event-timeline port (2026-04-18). Unlike the other TEC widgets, the
   legacy CSS block targeted OUTDATED class names that the current PHP
   render no longer emits (the render was rewritten without updating CSS):
     - .sentio-tet__year-btn          → .sentio-tet__year-link
     - .sentio-tet__expand            → .sentio-tet__card-toggle
     - .sentio-tet__card-details      → .sentio-tet__card-detail
     - .sentio-tet__item--visible     → .sentio-tet__card--animate-in
     - .sentio-tet__today             → .sentio-tet__today-marker
     - .sentio-tet__title             → .sentio-tet__card-title
     - .sentio-tet__date              → .sentio-tet__card-date
     - .sentio-tet__excerpt           → .sentio-tet__card-excerpt
     - .sentio-tet__venue             → .sentio-tet__card-venue
     - .sentio-tet__cost              → .sentio-tet__card-cost
     - .sentio-tet__organizer         → .sentio-tet__card-organizer
     - .sentio-tet__lightbox-inner    → .sentio-tet__lightbox-content
     - .sentio-tet__spine (as pseudo) → .sentio-tet__spine (as direct line
                                        inside .sentio-tet__spine-wrap)
     - :target-based lightbox open   → [hidden]-gated lightbox
   This file is the mapped/updated version. Appended below: a11y block
   (sr-only announcer, :focus-visible ring, prefers-reduced-motion).
   ========================================================================== */

.sentio-tet {
	position: relative;
	display: flex;
	gap: 24px;
}

/* ── Year Navigation ── */
.sentio-tet__year-nav {
	position: sticky;
	top: 100px;
	flex: 0 0 60px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-self: flex-start;
}

.sentio-tet__year-link {
	padding: 8px 4px;
	font-size: 13px;
	font-weight: 600;
	background: transparent;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	cursor: pointer;
	color: #6b7280;
	text-decoration: none;
	transition: all 0.2s ease;
	text-align: center;
}

.sentio-tet__year-link:hover { border-color: #6366f1; color: #6366f1; }
.sentio-tet__year-link--active { background: var(--tet-year-active-bg, #6366f1); color: #ffffff; border-color: var(--tet-year-active-bg, #6366f1); }

/* ── Spine (line is the element itself, not a pseudo) ── */
.sentio-tet__spine-wrap {
	flex: 1;
	position: relative;
	padding: 0 20px;
}

.sentio-tet__spine {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 3px;
	background: #e5e7eb;
	transform: translateX(-50%);
	pointer-events: none;
}

/* ── Month Group Headers ── */
.sentio-tet__month-group {
	position: relative;
}

.sentio-tet__month-header {
	position: sticky;
	top: 0;
	z-index: 10;
	text-align: center;
	margin: 32px 0 24px;
}

.sentio-tet__month-label {
	display: inline-block;
	padding: 8px 20px;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 100px;
	font-size: 14px;
	font-weight: 600;
	color: #374151;
}

/* ── Today Marker ── */
.sentio-tet__today-marker {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin: 24px 0;
	position: relative;
}

.sentio-tet__today-dot {
	--tet-today-pulse-color: rgba(239, 68, 68, 0.2);
	width: 16px;
	height: 16px;
	background: #ef4444;
	border-radius: 50%;
	box-shadow: 0 0 0 4px var(--tet-today-pulse-color);
	animation: sentio-tet-pulse 2s infinite;
}

@keyframes sentio-tet-pulse {
	0%, 100% { box-shadow: 0 0 0 4px var(--tet-today-pulse-color, rgba(239, 68, 68, 0.2)); }
	50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--tet-today-pulse-color, rgba(239, 68, 68, 0.2)) 50%, transparent); }
}

.sentio-tet__today-label {
	padding: 4px 12px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	background: #ef4444;
	color: #ffffff;
	border-radius: 4px;
}

/* ── Timeline Items ── */
.sentio-tet__item {
	position: relative;
	display: flex;
	margin-bottom: 24px;
	opacity: 0;
	transform: translateY(30px);
	transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Visible state — JS adds this class via IntersectionObserver (or immediately
 * when prefers-reduced-motion is set, or when animation is 'none'). */
.sentio-tet__card--animate-in {
	opacity: 1;
	transform: translateY(0);
}

/* Animation variants — initial off-state + visible override */
.sentio-tet__item[data-animation="slide"] { transform: translateX(-30px); }
.sentio-tet__item[data-animation="slide"].sentio-tet__card--animate-in { transform: translateX(0); }
.sentio-tet__item[data-animation="scale"] { transform: scale(0.8); }
.sentio-tet__item[data-animation="scale"].sentio-tet__card--animate-in { transform: scale(1); }
.sentio-tet__item[data-animation="flip"] { transform: perspective(600px) rotateY(-30deg); }
.sentio-tet__item[data-animation="flip"].sentio-tet__card--animate-in { transform: perspective(600px) rotateY(0); }

/* Alternating layout */
.sentio-tet__item--left {
	flex-direction: row;
	padding-right: calc(50% + 20px);
}

.sentio-tet__item--right {
	flex-direction: row-reverse;
	padding-left: calc(50% + 20px);
}

/* ── Dot ── */
.sentio-tet__dot {
	position: absolute;
	left: 50%;
	top: 20px;
	width: 16px;
	height: 16px;
	background: var(--dot-color, #6366f1);
	border: 3px solid #ffffff;
	border-radius: 50%;
	transform: translateX(-50%);
	z-index: 5;
	box-shadow: 0 0 0 2px var(--dot-color, #6366f1);
}

.sentio-tet__dot--milestone {
	width: 28px;
	height: 28px;
}

/* ── Connector (small horizontal line from dot to card, if desired) ── */
.sentio-tet__connector {
	/* Optional visual — currently transparent/invisible. Add styling here if
	 * a connector line between dot and card is desired per-design. */
	display: none;
}

/* ── Card ── */
.sentio-tet__card {
	flex: 1;
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
	overflow: hidden;
	transition: box-shadow 0.3s ease;
}

.sentio-tet__card:hover { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); }

/* Milestone highlight — P1 polish 2026-04-21.
 * Gated by the `show_milestone_highlight` switcher's prefix_class
 * (`.sentio-tet--milestone-enabled-yes`) so users who disable it get NO
 * highlight (fixes pre-existing bug where the switcher was ignored).
 * Variant driven by the `milestone_highlight_style` SELECT's prefix_class:
 *   --style-border (default)  → 2px border in dot color
 *   --style-glow              → soft box-shadow glow, no border
 *   --style-border-glow       → border + outer glow
 */
.sentio-tet--milestone-enabled-yes.sentio-tet--milestone-style-border .sentio-tet__item--milestone .sentio-tet__card {
	border: 2px solid var(--dot-color, #6366f1);
}

.sentio-tet--milestone-enabled-yes.sentio-tet--milestone-style-glow .sentio-tet__item--milestone .sentio-tet__card {
	box-shadow: 0 0 24px var(--dot-color, #6366f1), 0 1px 4px rgba(0, 0, 0, 0.08);
}

.sentio-tet--milestone-enabled-yes.sentio-tet--milestone-style-border-glow .sentio-tet__item--milestone .sentio-tet__card {
	border: 2px solid var(--dot-color, #6366f1);
	box-shadow: 0 0 18px rgba(99, 102, 241, 0.4);
}

.sentio-tet__card-image-link,
.sentio-tet__card-image-wrap {
	display: block;
	line-height: 0;
}

.sentio-tet__card-image-link img,
.sentio-tet__card-image-wrap img {
	width: 100%;
	height: auto;
	display: block;
}

.sentio-tet__card-body {
	padding: 16px;
}

.sentio-tet__card-date {
	display: block;
	font-size: 13px;
	color: #6b7280;
	margin-bottom: 6px;
}

.sentio-tet__card-cat {
	display: inline-block;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 4px;
}

.sentio-tet__card-title {
	font-size: 16px;
	font-weight: 600;
	margin: 0 0 8px;
	line-height: 1.3;
}

.sentio-tet__card-title a { color: inherit; text-decoration: none; }
.sentio-tet__card-title a:hover { color: #6366f1; }

.sentio-tet__card-venue,
.sentio-tet__card-cost {
	display: inline-block;
	font-size: 13px;
	color: #6b7280;
	margin-right: 12px;
	margin-bottom: 4px;
}

.sentio-tet__card-cost { font-weight: 600; color: #059669; }
.sentio-tet__card-cost--free { color: #059669; }

.sentio-tet__card-excerpt {
	font-size: 14px;
	color: #6b7280;
	line-height: 1.5;
	margin: 8px 0;
}

/* ── Expandable Details (disclosure) ── */
.sentio-tet__card-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	padding: 10px 12px;
	margin-top: 8px;
	font-size: 13px;
	font-weight: 500;
	background: #f9fafb;
	border: none;
	border-top: 1px solid #f3f4f6;
	cursor: pointer;
	color: #6366f1;
	transition: background var(--tet-toggle-duration, 0.2s) ease, color var(--tet-toggle-duration, 0.2s) ease;
}

.sentio-tet__card-toggle:hover { background: #f3f4f6; }

.sentio-tet__card-toggle-icon {
	font-size: 10px;
	line-height: 1;
}

.sentio-tet__card-detail {
	padding: 12px 16px 16px;
	border-top: 1px solid #f3f4f6;
}

.sentio-tet__card-desc {
	font-size: 14px;
	color: #374151;
	line-height: 1.6;
	margin-bottom: 8px;
}

.sentio-tet__card-organizer {
	display: block;
	font-size: 13px;
	color: #9ca3af;
}

/* ── Lightbox (role=dialog, [hidden]-gated) ── */
/* Default HIDDEN — no visible overlay on page load. Uses :not([hidden])
 * to activate only when JS removes the attribute. Inverted from the more
 * common `display: flex` + `[hidden] { display: none }` pattern because
 * that pattern was causing multiple visible overlays on pages with
 * several timeline widgets (attribute-selector specificity was being
 * out-prioritized in some contexts). */
.sentio-tet__lightbox {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: none;
	align-items: center;
	justify-content: center;
}

.sentio-tet__lightbox:not([hidden]) {
	display: flex;
}

.sentio-tet__lightbox-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.85);
	cursor: pointer;
}

.sentio-tet__lightbox-content {
	position: relative;
	max-width: 90%;
	max-height: 90vh;
	z-index: 1;
}

.sentio-tet__lightbox-img {
	max-width: 100%;
	max-height: 80vh;
	border-radius: 8px;
	display: block;
}

.sentio-tet__lightbox-caption {
	margin-top: 12px;
	padding: 8px 12px;
	color: #ffffff;
	font-size: 14px;
	text-align: center;
}

.sentio-tet__lightbox-close {
	position: absolute;
	top: -12px;
	right: -12px;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #ffffff;
	border: none;
	border-radius: 50%;
	color: #111827;
	font-size: 20px;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sentio-tet__lightbox-prev,
.sentio-tet__lightbox-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.9);
	border: none;
	border-radius: 50%;
	color: #111827;
	font-size: 24px;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sentio-tet__lightbox-prev { left: -60px; }
.sentio-tet__lightbox-next { right: -60px; }

/* ── Empty ── */
.sentio-tet__empty {
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	min-height: 200px; padding: 40px; text-align: center; color: #9ca3af;
	border: 2px dashed #e5e7eb; border-radius: 12px;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
	.sentio-tet__year-nav { display: none; }
}

@media (max-width: 767px) {
	.sentio-tet__spine { left: 20px; }
	.sentio-tet__item--left,
	.sentio-tet__item--right {
		flex-direction: row;
		padding-right: 0;
		padding-left: 50px;
	}
	.sentio-tet__dot { left: 20px; }
	.sentio-tet__month-header { text-align: left; padding-left: 50px; }
	.sentio-tet__today-marker { justify-content: flex-start; padding-left: 40px; }
	.sentio-tet__lightbox-prev { left: 10px; }
	.sentio-tet__lightbox-next { right: 10px; }
}

/* ----------------------------------------------------------------
   Accessibility (standard per docs/widget-authoring-guide.md §8)
   ---------------------------------------------------------------- */

/* Screen-reader-only live region for lightbox + year-nav announcements. */
.sentio-tet__sr-announce {
	position: absolute;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* :focus-visible ring on every interactive element. */
.sentio-tet__year-link:focus-visible,
.sentio-tet__card-title a:focus-visible,
.sentio-tet__card-image-link:focus-visible,
.sentio-tet__card-toggle:focus-visible,
.sentio-tet__lightbox-close:focus-visible,
.sentio-tet__lightbox-prev:focus-visible,
.sentio-tet__lightbox-next:focus-visible {
	outline: 3px solid var(--tet-focus-ring, #6366f1);
	outline-offset: 2px;
	border-radius: 6px;
}

/* WCAG 2.3.3 — respect prefers-reduced-motion. Zeros entrance transitions,
 * the today-marker pulse animation, and card hover transitions. JS also
 * short-circuits the IntersectionObserver-based entrance-animation path
 * (reveals all items immediately). */
@media (prefers-reduced-motion: reduce) {
	.sentio-tet,
	.sentio-tet * {
		transition-duration: 0s !important;
		animation-duration: 0s !important;
		animation-iteration-count: 1 !important;
	}
	/* Items arrive in their visible state immediately */
	.sentio-tet__item {
		opacity: 1 !important;
		transform: none !important;
	}
}
