/* WebPex Music Player — front end
   Look modelled on an episode card: big rounded artwork, uppercase category
   with arrow, bold title, black pill player with a thin pink progress bar,
   and a round share button. */

.wmp-card,
.wmp-card * {
	box-sizing: border-box;
}

.wmp-card {
	--wmp-accent: #f2782f;      /* orange accent */
	--wmp-ink: #121212;         /* near-black text */
	--wmp-muted: #3d3d3d;
	--wmp-pill: #0d0d0d;        /* player bar */
	--wmp-radius: 18px;

	display: flex;
	align-items: center;
	gap: clamp(24px, 5vw, 64px);
	max-width: 1080px;
	margin: 0 auto 40px;
	padding: 24px;
	font-family: inherit;
	color: var(--wmp-ink);
}

/* ---- Thumbnail ---- */
.wmp-thumb {
	flex: 0 0 clamp(200px, 28vw, 320px);
}
.wmp-thumb .wmp-thumb-img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: var(--wmp-radius);
	box-shadow: 0 14px 34px rgba(0, 0, 0, 0.14);
}

/* Stand-in artwork for a track with no featured image. Same box as a real
   thumbnail so a card without artwork still lines up with the rest. */
.wmp-thumb .wmp-thumb-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(140deg, #fdf1e8 0%, #f8e3d3 100%);
	color: var(--wmp-accent);
}
.wmp-thumb .wmp-thumb-placeholder svg {
	width: 56%;
	height: 56%;
}

/* ---- Text block ---- */
.wmp-body {
	flex: 1 1 auto;
	min-width: 0;
}

.wmp-category {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 18px;
	font-size: 14px;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--wmp-ink);
	cursor: default;
}
.wmp-category span {
	padding-bottom: 4px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.35);
}
.wmp-category svg {
	width: 20px;
	height: 20px;
	color: var(--wmp-accent);
	transition: transform 0.2s ease;
}
.wmp-category:hover svg {
	transform: translateX(4px);
}

.wmp-title {
	margin: 0 0 14px;
	font-size: clamp(28px, 4vw, 48px);
	font-weight: 800;
	line-height: 1.08;
	letter-spacing: -0.01em;
	color: var(--wmp-ink);
}

.wmp-datetime {
	margin: 0 0 14px;
	font-size: 15px;
	font-weight: 700;
	color: var(--wmp-muted);
}

.wmp-description {
	margin: 0 0 26px;
	max-width: 60ch;
	font-size: 15.5px;
	line-height: 1.55;
	color: #4a4a4a;
}

/* Safety clamp: even if another stylesheet or a builder preview interferes,
   icons inside the card/modal can never grow past their intended size. */
.wmp-card svg,
.wmp-modal svg {
	max-width: 24px;
	max-height: 24px;
}

/* ---- Player row ---- */
.wmp-player-row {
	display: flex;
	align-items: center;
	gap: 18px;
}

.wmp-player {
	position: relative;
	display: flex;
	align-items: center;
	gap: 6px;
	flex: 1 1 auto;
	min-width: 0;
	padding: 12px 22px 12px 14px;
	background: var(--wmp-pill);
	border-radius: 10px;
	color: #fff;
}
.wmp-player audio,
.wmp-player video {
	display: none;
}

/* SoundCloud's iframe is driven by the Widget API and never seen — kept in the
   DOM at 1px (not display:none, which stops some browsers loading it). */
.wmp-sc-frame {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
	left: -9999px;
}

/* SoundCloud needs a moment to hand over duration; dim the controls until then. */
.wmp-player--sc.is-loading .wmp-btn,
.wmp-player--sc.is-loading .wmp-time,
.wmp-player--sc.is-loading .wmp-progress {
	opacity: 0.45;
	pointer-events: none;
}
.wmp-player.is-error::after {
	content: attr(data-wmp-error);
	font-size: 13px;
	font-weight: 600;
	color: #ffb4a2;
	padding-left: 6px;
}
/* Share button: same theme-proofing as the transport controls. */
.wmp-share-btn:hover,
.wmp-share-btn:focus,
.wmp-share-btn:active {
	background: #fff;
	background-image: none;
	color: var(--wmp-ink);
	border: 0;
	outline: none;
}
.wmp-share-btn:focus-visible {
	outline: 2px solid var(--wmp-accent);
	outline-offset: 3px;
}
.wmp-player.is-error .wmp-btn,
.wmp-player.is-error .wmp-time,
.wmp-player.is-error .wmp-progress,
.wmp-player.is-error .wmp-volume {
	display: none;
}

/* Native embed (Spotify, Apple, YouTube, etc.) rendered as the platform sends it. */
.wmp-player-row--embed {
	align-items: flex-start;
}
.wmp-embed {
	flex: 1 1 auto;
	min-width: 0;
	border-radius: 12px;
	overflow: hidden;
}
.wmp-embed iframe {
	display: block;
	width: 100%;
	max-width: 100%;
	border: 0;
}

.wmp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	background-image: none;
	box-shadow: none;
	text-shadow: none;
	color: #fff;
	font: inherit;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	transition: background 0.15s ease;
}
/* Themes commonly style every <button> — pin our states down so their
   hover/focus/active colours cannot leak into the player bar. */
.wmp-btn:hover,
.wmp-btn:focus,
.wmp-btn:active,
.wmp-btn:focus-visible {
	background: rgba(255, 255, 255, 0.12);
	background-image: none;
	box-shadow: none;
	color: #fff;
	border: 0;
	outline: none;
}
.wmp-btn:focus-visible {
	outline: 2px solid var(--wmp-accent);
	outline-offset: 2px;
}
.wmp-btn svg {
	width: 22px;
	height: 22px;
	fill: currentColor;
}

.wmp-play .wmp-ico-pause { display: none; }
.wmp-player.is-playing .wmp-ico-play { display: none; }
.wmp-player.is-playing .wmp-ico-pause { display: block; }

/* Rewind icon: the "10" is SVG <text>, so without an explicit font it
   inherits the theme's typeface and lands off-centre (bottom-right of the
   circle, clipping the ring). Anchor it to the arc's true centre — (11.01,
   14.5) in the 24x24 viewBox — and pin the font so no theme can shift it. */
.wmp-rewind svg text {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 7px;
	font-weight: 700;
	font-style: normal;
	letter-spacing: 0;
	text-anchor: middle;
	stroke: none;
	fill: currentColor;
	/* markup anchor is x=8.4 y=17.6; shift to the arc centre */
	transform: translate(2.61px, -0.65px);
}

/* Volume */
.wmp-volume {
	display: flex;
	align-items: center;
}
.wmp-mute .wmp-ico-muted { display: none; }
.wmp-player.is-muted .wmp-ico-vol { display: none; }
.wmp-player.is-muted .wmp-ico-muted { display: block; }

.wmp-volume-slider {
	width: 0;
	opacity: 0;
	margin: 0;
	transition: width 0.2s ease, opacity 0.2s ease;
	accent-color: var(--wmp-accent);
	cursor: pointer;
}
.wmp-volume:hover .wmp-volume-slider,
.wmp-volume:focus-within .wmp-volume-slider {
	width: 72px;
	opacity: 1;
	margin-right: 6px;
}

/* Time */
.wmp-time {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 14px 0 6px;
	font-size: 16px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	cursor: pointer;
	user-select: none;
}
.wmp-time-sep {
	opacity: 0.7;
}

/* Thin progress bar */
.wmp-progress {
	position: relative;
	flex: 1 1 auto;
	min-width: 60px;
	height: 18px;
	cursor: pointer;
}
.wmp-progress:focus-visible {
	outline: 2px solid var(--wmp-accent);
	outline-offset: 2px;
	border-radius: 4px;
}
.wmp-progress-track,
.wmp-progress-fill {
	position: absolute;
	top: 50%;
	left: 0;
	height: 4px;
	border-radius: 2px;
	transform: translateY(-50%);
}
.wmp-progress-track {
	width: 100%;
	background: rgba(255, 255, 255, 0.28);
}
.wmp-progress-fill {
	width: 0;
	background: var(--wmp-accent);
}
.wmp-progress-fill::after {
	content: "";
	position: absolute;
	right: -3px;
	top: 50%;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--wmp-accent);
	transform: translateY(-50%) scale(0);
	transition: transform 0.15s ease;
}
.wmp-progress:hover .wmp-progress-fill::after,
.wmp-progress:focus-visible .wmp-progress-fill::after {
	transform: translateY(-50%) scale(1);
}

/* Share button */
.wmp-share-btn {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 58px;
	height: 58px;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: var(--wmp-ink);
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.wmp-share-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
}
.wmp-share-btn svg {
	width: 24px;
	height: 24px;
	fill: currentColor;
}

/* ---- Share modal ---- */
.wmp-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
}
.wmp-modal.is-open {
	display: block;
}
.wmp-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 10, 0.55);
	backdrop-filter: blur(3px);
}
.wmp-modal-dialog {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: min(480px, calc(100vw - 32px));
	padding: 26px 26px 30px;
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 30px 70px rgba(0, 0, 0, 0.3);
	animation: wmp-pop 0.22s ease;
	color: #121212;
	box-sizing: border-box;
}
@keyframes wmp-pop {
	from { opacity: 0; transform: translate(-50%, -46%); }
	to   { opacity: 1; transform: translate(-50%, -50%); }
}
@media (prefers-reduced-motion: reduce) {
	.wmp-modal-dialog { animation: none; }
	.wmp-card * { transition: none !important; }
}

.wmp-modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 4px;
}
.wmp-modal-head h3 {
	margin: 0;
	font-size: 22px;
	font-weight: 800;
}
.wmp-modal-x {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: #f1f1f1;
	color: #121212;
	cursor: pointer;
}
.wmp-modal-x:hover {
	background: #e5e5e5;
}
.wmp-modal-x svg {
	width: 18px;
	height: 18px;
}

.wmp-modal-track {
	margin: 0 0 20px;
	font-size: 14px;
	color: #666;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wmp-share-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
}
.wmp-share-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 14px 8px;
	border: 1px solid #ececec;
	border-radius: 14px;
	background: #fff;
	color: #121212;
	font-size: 13px;
	font-weight: 600;
	font-family: inherit;
	text-decoration: none;
	cursor: pointer;
	transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}
.wmp-share-item:hover {
	transform: translateY(-2px);
	border-color: #d9d9d9;
	background: #fafafa;
}
.wmp-share-ico {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	color: #fff;
}
.wmp-share-ico svg {
	width: 22px;
	height: 22px;
	fill: currentColor;
}
.wmp-s-facebook .wmp-share-ico { background: #1877f2; }
.wmp-s-linkedin .wmp-share-ico { background: #0a66c2; }
.wmp-s-x        .wmp-share-ico { background: #0f0f0f; }
.wmp-s-email    .wmp-share-ico { background: #6b7280; }
.wmp-s-whatsapp .wmp-share-ico { background: #25d366; }
.wmp-s-copy     .wmp-share-ico { background: #f2782f; }
.wmp-s-copy.is-copied .wmp-share-ico { background: #16a34a; }

/* Arrival highlight: when someone lands here from an Episode Map link, the
   whole card is filled and ringed so it is unmistakable which episode they
   came for — a thin outer ring alone is easy to miss on a white card. The
   JS waits for the scroll to settle before adding this class. */
.wmp-card {
	scroll-margin-top: 100px;
}
/* The highlight may land on the card or on the panel wrapping it, so the
   transition lives on the class itself rather than on .wmp-card. */
.wmp-is-target {
	scroll-margin-top: 100px;
	border-radius: 20px;
	transition: background-color 0.5s ease, box-shadow 0.5s ease;
}

.wmp-is-target {
	background-color: rgba(242, 120, 47, 0.13);
	box-shadow:
		0 0 0 3px var(--wmp-accent),
		0 16px 40px rgba(242, 120, 47, 0.28);
	animation: wmp-target-pulse 1.15s ease-in-out 3;
}

/* Three slow pulses, then it holds the filled state until the timer clears it. */
@keyframes wmp-target-pulse {
	0%, 100% {
		background-color: rgba(242, 120, 47, 0.13);
		box-shadow:
			0 0 0 3px var(--wmp-accent),
			0 16px 40px rgba(242, 120, 47, 0.28);
	}
	50% {
		background-color: rgba(242, 120, 47, 0.26);
		box-shadow:
			0 0 0 6px var(--wmp-accent),
			0 20px 48px rgba(242, 120, 47, 0.4);
	}
}

/* The title picks up the accent too, so the highlight reads even for someone
   who only glances at the text. */
.wmp-is-target .wmp-title {
	color: #9c4413;
	transition: color 0.4s ease;
}

@media (prefers-reduced-motion: reduce) {
	.wmp-is-target {
		animation: none;
	}
}

/* ---- Responsive ----
   On tablets and phones the card becomes a 2-column grid:

       [ thumb ]  [ category / title / date / description ]
       [ player bar ................ ][ share ]

   .wmp-body is display:contents so its children participate directly in the
   card grid, which lets the player row span the full width underneath the
   thumb+title row without changing the desktop markup. */
@media (max-width: 860px) {
	.wmp-card {
		display: grid;
		grid-template-columns: clamp(84px, 26vw, 150px) minmax(0, 1fr);
		column-gap: 16px;
		row-gap: 16px;
		align-items: start;
		padding: 18px;
		margin-bottom: 28px;
	}

	.wmp-thumb {
		grid-column: 1;
		grid-row: 1;
		flex: 0 0 auto;
		max-width: 100%;
	}
	.wmp-thumb .wmp-thumb-img {
		border-radius: 12px;
		box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
	}

	.wmp-body {
		display: contents;
	}

	.wmp-text {
		grid-column: 2;
		grid-row: 1;
		min-width: 0;
	}

	/* No artwork on this track — let the text use the full width. */
	.wmp-card--no-thumb .wmp-text {
		grid-column: 1 / -1;
	}

	.wmp-player-row,
	.wmp-player-row--embed {
		grid-column: 1 / -1;
		grid-row: 2;
		gap: 12px;
	}

	/* Typography scaled for the narrower text column. */
	.wmp-category {
		margin-bottom: 10px;
		font-size: 11px;
		letter-spacing: 0.12em;
		gap: 8px;
	}
	.wmp-category svg {
		width: 16px;
		height: 16px;
	}
	.wmp-title {
		margin-bottom: 8px;
		font-size: clamp(18px, 4.6vw, 30px);
		line-height: 1.15;
	}
	.wmp-datetime {
		margin-bottom: 8px;
		font-size: 13px;
	}
	.wmp-description {
		margin-bottom: 0;
		font-size: 14px;
		line-height: 1.5;
	}

	/* Compact player bar so it fits beside the share button. */
	.wmp-player {
		padding: 8px 14px 8px 8px;
		gap: 2px;
	}
	.wmp-btn {
		width: 36px;
		height: 36px;
	}
	.wmp-btn svg {
		width: 19px;
		height: 19px;
	}
	.wmp-time {
		margin: 0 10px 0 4px;
		font-size: 13px;
		gap: 6px;
	}
	.wmp-share-btn {
		width: 46px;
		height: 46px;
	}
	.wmp-share-btn svg {
		width: 20px;
		height: 20px;
	}

	/* Volume is hidden on touch: iOS ignores programmatic volume entirely and
	   the hardware buttons already do the job, so the control only ate space. */
	.wmp-volume {
		display: none;
	}
}

/* Phones — tighten further and keep the player + share on one line. */
@media (max-width: 480px) {
	.wmp-card {
		column-gap: 12px;
		row-gap: 14px;
		padding: 14px;
	}
	.wmp-player-row,
	.wmp-player-row--embed {
		gap: 8px;
	}
	.wmp-player {
		padding: 6px 10px 6px 6px;
	}
	.wmp-btn {
		width: 32px;
		height: 32px;
	}
	.wmp-btn svg {
		width: 17px;
		height: 17px;
	}
	.wmp-time {
		margin: 0 6px 0 2px;
		font-size: 12px;
		gap: 4px;
	}
	.wmp-progress {
		min-width: 40px;
	}
	.wmp-share-btn {
		width: 42px;
		height: 42px;
	}

	/* Rewind is the first thing to go when space runs out — play, time and
	   the scrub bar matter more on a small screen. */
	.wmp-rewind {
		display: none;
	}

	.wmp-share-grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.wmp-modal-dialog {
		padding: 20px 18px 24px;
	}
}

/* Very narrow phones: let the progress bar drop to its own line inside the
   pill rather than squeezing it to nothing. The share button stays inline. */
@media (max-width: 360px) {
	.wmp-player {
		flex-wrap: wrap;
		row-gap: 6px;
	}
	.wmp-progress {
		flex-basis: 100%;
		order: 10;
		min-width: 0;
		height: 14px;
	}
}
