/**
 * STU Timeline Audio — front-end styles.
 *
 * Every selector is scoped to .stu-timeline. No font-family is declared anywhere:
 * the component inherits the active theme's typography on purpose. Colours resolve
 * through custom properties so a child theme can retune them without touching this
 * file, and the accent can also be set from PHP via stu_timeline_accent_color.
 */

.stu-timeline-container {
	box-sizing: border-box;
	margin: 0 auto;
	max-width: 1100px;
	padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2rem);
	width: 100%;
}

/* The custom properties live on the entry itself, not on a page wrapper, so a
   shortcode dropped into any page carries its own values with it. The accent
   default is the STU navy from the site's design tokens; PHP appends an override
   for this same selector when stu_timeline_accent_color returns a value. */
.stu-timeline-entry {
	--stu-timeline-accent: #08244f;
	--stu-timeline-accent-contrast: #ffffff;
	--stu-timeline-ink: #1b1b1b;
	--stu-timeline-muted: #5a6373;
	--stu-timeline-rule: #d9dee6;
	--stu-timeline-surface: #f4f6f9;
	--stu-timeline-radius: 6px;
	--stu-timeline-measure: 68ch;
	--stu-timeline-gap: clamp(1.5rem, 4vw, 2.75rem);

	color: var(--stu-timeline-ink);
	display: flex;
	flex-direction: column;
	gap: var(--stu-timeline-gap);
}

.stu-timeline-entry *,
.stu-timeline-entry *::before,
.stu-timeline-entry *::after {
	box-sizing: border-box;
}

.stu-timeline-title {
	color: var(--stu-timeline-accent);
	line-height: 1.15;
	margin: 0;
	max-width: var(--stu-timeline-measure);
}

.stu-timeline-section-title {
	margin: 0 0 0.75em;
}

/* Images ------------------------------------------------------------------ */

.stu-timeline-featured {
	margin: 0;
}

.stu-timeline-featured-image,
.stu-timeline-gallery-image {
	border-radius: var(--stu-timeline-radius);
	display: block;
	height: auto;
	max-width: 100%;
}

.stu-timeline-figcaption {
	color: var(--stu-timeline-muted);
	font-size: 0.875em;
	line-height: 1.5;
	margin-top: 0.5rem;
}

/* Description ------------------------------------------------------------- */

.stu-timeline-description {
	font-size: clamp(1.0625rem, 0.5vw + 1rem, 1.25rem);
	line-height: 1.6;
	max-width: var(--stu-timeline-measure);
}

.stu-timeline-description > :first-child {
	margin-top: 0;
}

.stu-timeline-description > :last-child {
	margin-bottom: 0;
}

/* Player ------------------------------------------------------------------ */

.stu-timeline-player {
	background: var(--stu-timeline-surface);
	border: 1px solid var(--stu-timeline-rule);
	border-radius: var(--stu-timeline-radius);
	padding: clamp(1.25rem, 3vw, 2rem);
}

.stu-timeline-player-label {
	align-items: baseline;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	justify-content: space-between;
	margin: 0 0 1rem;
}

.stu-timeline-player-duration {
	color: var(--stu-timeline-muted);
	font-size: 0.8em;
	font-weight: 400;
}

.stu-timeline-audio {
	display: block;
	width: 100%;
}

/* Once the enhanced controls exist the native bar would be a second copy of the
   same thing. The script drops its controls attribute; this keeps the element from
   reserving any space in browsers that still give it an intrinsic height. */
.stu-timeline-player--enhanced .stu-timeline-audio {
	display: none;
}

.stu-timeline-audio-fallback {
	margin: 0.75rem 0 0;
}

/* Enhanced controls. These are built by frontend.js and only exist once the
   script has confirmed it can drive the audio element. */

.stu-timeline-controls {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: clamp(0.75rem, 2vw, 1.25rem);
}

.stu-timeline-play {
	align-items: center;
	background: var(--stu-timeline-accent);
	border: 2px solid transparent;
	border-radius: 50%;
	color: var(--stu-timeline-accent-contrast);
	cursor: pointer;
	display: flex;
	flex: 0 0 auto;
	height: 4rem;
	justify-content: center;
	padding: 0;
	transition: transform 120ms ease, background-color 120ms ease;
	width: 4rem;
}

.stu-timeline-play:hover {
	background: color-mix(in srgb, var(--stu-timeline-accent) 85%, #000000);
}

.stu-timeline-play:focus-visible {
	outline: 3px solid var(--stu-timeline-accent);
	outline-offset: 3px;
}

.stu-timeline-play:active {
	transform: scale(0.96);
}

.stu-timeline-play-icon {
	height: 1.75rem;
	width: 1.75rem;
}

.stu-timeline-play-icon path {
	fill: currentColor;
}

.stu-timeline-progress-group {
	display: flex;
	flex: 1 1 14rem;
	flex-direction: column;
	gap: 0.375rem;
	min-width: 0;
}

.stu-timeline-seek {
	accent-color: var(--stu-timeline-accent);
	cursor: pointer;
	margin: 0;
	width: 100%;
}

.stu-timeline-seek:focus-visible {
	outline: 3px solid var(--stu-timeline-accent);
	outline-offset: 4px;
}

.stu-timeline-times {
	color: var(--stu-timeline-muted);
	display: flex;
	font-size: 0.875rem;
	font-variant-numeric: tabular-nums;
	justify-content: space-between;
}

/* Transcript -------------------------------------------------------------- */

.stu-timeline-transcript-body {
	line-height: 1.7;
	max-width: var(--stu-timeline-measure);
}

.stu-timeline-transcript-body > :first-child {
	margin-top: 0;
}

.stu-timeline-transcript-body > :last-child {
	margin-bottom: 0;
}

.stu-timeline-transcript-body img {
	height: auto;
	max-width: 100%;
}

.stu-timeline-transcript-body blockquote {
	border-left: 4px solid var(--stu-timeline-accent);
	margin-left: 0;
	padding-left: 1.25rem;
}

/* Gallery ----------------------------------------------------------------- */

.stu-timeline-gallery-grid {
	display: grid;
	gap: clamp(1rem, 2.5vw, 1.75rem);
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
}

.stu-timeline-gallery-item {
	margin: 0;
}

.stu-timeline-gallery-link {
	display: block;
	border-radius: var(--stu-timeline-radius);
}

.stu-timeline-gallery-link:focus-visible {
	outline: 3px solid var(--stu-timeline-accent);
	outline-offset: 3px;
}

/* Editor-facing notice ---------------------------------------------------- */

.stu-timeline-notice {
	background: var(--stu-timeline-surface);
	border-left: 4px solid var(--stu-timeline-accent);
	color: var(--stu-timeline-muted);
	padding: 0.75rem 1rem;
}

@media (prefers-reduced-motion: reduce) {
	.stu-timeline-play {
		transition: none;
	}

	.stu-timeline-play:active {
		transform: none;
	}
}
