/**
 * Program Widget Styles
 *
 * Shared styles for three Elementor widgets in the Event Program category:
 * Program Day Heading, Program Stream Heading, and Program Row.
 *
 * @package Foundry
 */

:root {
	--program-time-col: 80px;
	--program-row-gap: 16px;
	--program-stream-gap: 16px;
	--program-radius: 8px;
	--program-time-color: #1a3a5c;
}

/* ==============================
   Day Heading
   ============================== */
.program-day-heading {
	padding: 12px;
	border-radius: var(--program-radius);
}

.program-day-heading__text {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 600;
	line-height: 1.3;
	color: inherit;
}

/* ==============================
   Stream Heading
   ============================== */
.program-stream-heading {
	display: grid;
	grid-template-columns: var(--program-time-col) 1fr 1fr;
	gap: var(--program-row-gap);
}

/* Default stream colours — overridden per-widget by the admin's picker */
.program-stream-heading__cell--s1 {
	background-color: #1a3a5c;
}

.program-stream-heading__cell--s2 {
	background-color: #8b2c60;
}

.program-stream-heading--single {
	grid-template-columns: var(--program-time-col) 1fr;
}

.program-stream-heading--no-time {
	grid-template-columns: 1fr 1fr;
}

.program-stream-heading--no-time.program-stream-heading--single {
	grid-template-columns: 1fr;
}

.program-stream-heading__time-spacer {
	/* intentionally empty — reserves the time column */
}

.program-stream-heading__cell {
	color: #ffffff;
	padding: 12px;
	border-radius: var(--program-radius);
	font-weight: 600;
	font-size: 0.95rem;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	text-align: center;
}

/* ==============================
   Program Row
   ============================== */
.program-row {
	display: grid;
	grid-template-columns: var(--program-time-col) 1fr;
	gap: var(--program-row-gap);
	align-items: start;
}

.program-row__time {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 4px;
	color: var(--program-time-color);
	font-weight: 400;
	line-height: 1.3;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	padding: 12px;
}

.program-row__start {
	font-size: 0.85rem;
}

.program-row__streams {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--program-stream-gap);
	min-width: 0;
}

.program-row--two .program-row__streams {
	grid-template-columns: 1fr 1fr;
}

.program-row__stream {
	min-width: 0;
	display: flex;
	flex-direction: column;
	border-radius: var(--program-radius);
	background-color: #f6f7f8;
}

/* Plain variant — still subtle grey; just a flag the admin hasn't picked
   a colour. Any Elementor-generated background-color rule on
   .program-row__stream--sN overrides the default grey. */
.program-row__stream--plain {
	padding: 0;
}

/* Per-stream colour fallbacks (overridden by JS-propagated colour from the
   nearest Program Stream Heading). Only consumed by the mobile left-border
   treatment below — on desktop the Stream Heading columns already indicate
   which stream each session belongs to. */
.program-row--two .program-row__stream--s1 {
	--program-stream-color: #1a3a5c;
}

.program-row--two .program-row__stream--s2 {
	--program-stream-color: #8b2c60;
}

/* Accordion header (button) — colour inherits from the session card,
   which is set by JS to black or white for WCAG-compliant contrast
   when the admin selects a custom background colour. */
.program-row__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	padding: 0;
	margin: 0;
	background: none;
	border: none;
	text-align: left;
	cursor: pointer;
	color: inherit;
	font: inherit;
	font-weight: 600;
	font-size: 1.1rem;
	line-height: 1.35;
}

.program-row__header:not(.program-row__header--static):hover .program-row__title {
	text-decoration: underline;
}

/* Inline "i" info icon after the title when there's a description to open.
   Signals that the row is interactive (accordion or modal). Pure CSS so
   no icon-font dependency or extra markup is needed. */
.program-row__header:not(.program-row__header--static) .program-row__title::after {
	content: "i";
	display: inline-block;
	width: 14px;
	height: 14px;
	line-height: 12px;
	text-align: center;
	border-radius: 50%;
	border: 1.5px solid currentColor;
	font: italic 700 10px/12px Georgia, "Times New Roman", serif;
	margin-left: 6px;
	vertical-align: 1px;
	opacity: 0.55;
	transition: opacity 0.15s ease;
}

.program-row__header:not(.program-row__header--static):hover .program-row__title::after {
	opacity: 1;
}

.program-row__header:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
	border-radius: 2px;
}

.program-row__header--static {
	cursor: default;
	display: block;
	color: inherit;
	font-weight: 600;
	font-size: 1.1rem;
	line-height: 1.35;
	text-align: left;
}

.program-row__header--static:hover {
	opacity: 1;
}

.program-row__title {
	display: block;
	flex: 1;
	min-width: 0;
  padding: 12px;
}

/* Description — animated expand/collapse (grid-template-rows auto animation) */
.program-row__description {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 0.25s ease;
}

.program-row__header[aria-expanded="true"] + .program-row__description {
	grid-template-rows: 1fr;
}

.program-row__description-inner {
	overflow: hidden;
	min-height: 0;
  padding: 0 12px;
}

.program-row__description-inner > * {
	color: inherit;
	opacity: 0.85;
	font-size: 0.95rem;
	line-height: 1.55;
}

/* Time range displayed at the top of the expanded description */
.program-row__description-time {
	font-size: 0.8rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.02em;
	margin-bottom: 10px;
	padding-top: 8px;
	opacity: 0.75;
}

.program-row__description-inner p:last-child {
	margin-bottom: 16px;
}

/* Modal mode — hides the inline accordion; click opens a modal instead */
.program-row[data-description-mode="modal"] .program-row__description {
	display: none;
}

/* ==============================
   Modal
   ============================== */
.program-modal {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(15, 39, 65, 0.55);
	backdrop-filter: blur(2px);
}

.program-modal.is-open {
	display: flex;
}

.program-modal__dialog {
	position: relative;
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
	max-width: 640px;
	width: 100%;
	max-height: 85vh;
	overflow: auto;
	padding: 32px 32px 28px;
	color: #111827;
}

.program-modal__time {
	display: flex;
	gap: 6px;
	color: var(--program-time-color);
	font-size: 0.85rem;
	margin-bottom: 18px;
	font-variant-numeric: tabular-nums;
}

.program-modal__title {
	margin: 0 0 16px;
	font-size: 1.25rem;
	font-weight: 600;
	line-height: 1.3;
	padding-right: 40px;
}

.program-modal__body {
	font-size: 0.95rem;
	line-height: 1.55;
}

.program-modal__body p:last-child {
	margin-bottom: 0;
}

.program-modal__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	cursor: pointer;
	border-radius: 50%;
	color: inherit;
	font-size: 20px;
	line-height: 1;
	transition: background-color 0.15s ease;
}
 
.program-modal__close:hover {
	background: #f3f4f6;
}

.program-modal__close::before {
	content: "\00d7";
	font-weight: 300;
	font-size: 24px;
}

/* ==============================
   Mobile (< 768px)
   ============================== */
@media (max-width: 767px) {
	/* Stream heading stacks vertically on mobile (serves as the legend
	   for each session's coloured left border). Time spacer hidden. */
	.program-stream-heading,
	.program-stream-heading--single {
		grid-template-columns: 1fr;
	}

	.program-stream-heading__time-spacer {
		display: none;
	}

	.program-row,
	.program-row--two .program-row__streams {
		grid-template-columns: 1fr;
    gap: 0;
	}

	.program-row__time {
		justify-content: flex-start;
		padding: 12px;
	}

	/* Two-stream rows: colour-keyed 3px left border identifies which
	   stream each card belongs to (columns collapsed on this breakpoint). */
	.program-row--two .program-row__stream {
		border-left: 3px solid var(--program-stream-color, currentColor);
		border-top-left-radius: 0;
		border-bottom-left-radius: 0;
    margin-bottom: 12px;
	}
}
