/**
 * Episode player. Every tunable is a custom property so the widget's Elementor
 * style controls only ever have to set a variable — no per-control selectors,
 * no specificity fights with the theme.
 *
 * Defaults below are the design's values (card 1722358d in template 1081).
 */

.mc-player {
	--mcp-btn-bg: #2A231E;
	--mcp-btn-fg: #FDF9F4;
	--mcp-icon: 24px;
	--mcp-btn-pad: 24px;
	--mcp-track: rgba(138, 106, 82, .2);
	--mcp-fill: #CB6C4D;
	--mcp-track-h: 6px;
	--mcp-gap: 28px;
	--mcp-stack: 12px;
	/* 100%, not the design's 70%: the body shrinks to whatever the play button
	   leaves, so the bar spans the whole card. At 70% the leftover 30% used to
	   trail off the end of the row — once the button moved left that slack
	   became a hole at the left edge of the card. */
	--mcp-body: 100%;
	--mcp-ctrl: #2A231E;
	--mcp-ctrl-size: 28px;
	--mcp-ctrl-gap: 6px;
	--mcp-speed-border: rgba(138, 106, 82, .45);
	--mcp-epno: #CB6C4D;
	/* 1 = play button after the text in flex order, which on this RTL site puts
	   it on the LEFT. -1 puts it back on the right. Done with `order` rather
	   than row-reverse or a direction flip so the Hebrew label and the LTR
	   timeline are both left completely alone. */
	--mcp-btn-order: 1;

	display: flex;
	align-items: center;
	gap: var(--mcp-gap);
	width: 100%;
}

/* The widget is a flex ITEM of the card container, which is a row. Without
   this it shrinks to its content (328px in an 899px card) instead of filling
   the row. `_flex_size` doesn't exist as a widget control in this Elementor
   build — only `_element_width` — so it has to be done here. */
.elementor-widget-mc-episode-player { flex-grow: 1; }

/* ---------- play / pause ---------- */

/* DOUBLE-CLASS ON PURPOSE. Kit 6 styles every button on the site:
     .elementor-kit-6 button { background-color:#000; padding:14px 36px;
                               font-size:17px; color:#FBF6EE; }
   That is specificity (0,1,1), so a lone `.mc-player__toggle` (0,1,0) loses and
   the play button renders black and pill-shaped. `.mc-player .mc-player__toggle`
   is (0,2,0) and wins. Every property the kit sets is restated here — inheriting
   half of a global button style is what produced the 96x52 black pill. */
.mc-player .mc-player__toggle {
	order: var(--mcp-btn-order);
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background-color: var(--mcp-btn-bg);
	background-image: none;
	color: var(--mcp-btn-fg);
	border: 0;
	border-radius: 50%;
	padding: var(--mcp-btn-pad);
	font-size: 0;
	line-height: 0;
	width: auto;
	height: auto;
	cursor: pointer;
	transition: transform .15s ease, opacity .15s ease;
	-webkit-appearance: none;
	appearance: none;
}

/* the kit's button:hover repaints the background mocha — (0,2,1). These are
   (0,3,0), so the disc keeps its colour and only the scale animates. */
.mc-player .mc-player__toggle:hover,
.mc-player .mc-player__toggle:focus {
	background-color: var(--mcp-btn-bg);
	color: var(--mcp-btn-fg);
}

.mc-player .mc-player__toggle:hover { transform: scale(1.04); }
.mc-player .mc-player__toggle:active { transform: scale(.98); }

.mc-player .mc-player__toggle:focus-visible {
	outline: 2px solid var(--mcp-fill);
	outline-offset: 3px;
}

.mc-player__icon { display: inline-flex; }

.mc-player .mc-player__toggle i,
.mc-player .mc-player__toggle svg {
	font-size: var(--mcp-icon);
	width: var(--mcp-icon);
	height: var(--mcp-icon);
	line-height: 1;
	fill: currentColor;
	display: block;
}

/* the two glyphs swap on .is-playing rather than being rewritten in JS, so the
   markup stays static and there is nothing to re-render */
.mc-player__icon--pause { display: none; }
.mc-player.is-playing .mc-player__icon--play { display: none; }
.mc-player.is-playing .mc-player__icon--pause { display: inline-flex; }

.mc-player.is-loading .mc-player__toggle { opacity: .55; cursor: progress; }

/* ---------- label / track / times ---------- */

.mc-player__body {
	flex: 0 1 var(--mcp-body);
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: var(--mcp-stack);
}

/* One line, never wrapped — a long episode title would otherwise push the bar
   and times down and change the card's height per episode. When the title is
   too wide the JS measures the overflow and switches on the marquee below. */
.mc-player__label {
	color: #2A231E;
	font-size: 15px;
	overflow: hidden;
	white-space: nowrap;
}

/* the episode number inside the title, same treatment as the episode-list rows
   (MC_Dynamic_Tags::list_title emits <strong class="mc-ep-no">) */
.mc-player__label .mc-ep-no {
	color: var(--mcp-epno, #CB6C4D);
	font-weight: 700;
	/* the label is inline-flex, which drops the bare whitespace text node
	   after </strong> — restore the gap explicitly */
	margin-inline-end: .35em;
}

.mc-player__label-inner {
	display: inline-flex;
	white-space: nowrap;
	will-change: transform;
}

/* Marquee = a conveyor loop: the JS duplicates the title into two copies with
   a fixed gap and slides exactly one copy-width per cycle, so the restart is
   seamless. --mcp-loop is that distance in px (sign = reading direction) and
   --mcp-marquee the duration, both set by the JS so speed stays constant
   regardless of title length. */
.mc-player__label-copy {
	white-space: nowrap;
	padding-inline-end: 48px;   /* the gap between the looping copies */
}

.mc-player.has-marquee .mc-player__label-inner {
	animation: mc-marquee var(--mcp-marquee, 12s) linear infinite;
}

/* Pause to read — but ONLY while actually over the title, and only on devices
   with a real hover. On touch, tap makes :hover STICK on whatever was tapped
   (pressing play froze the marquee until a tap elsewhere — Roee's bug), and a
   root-level :hover also froze it whenever the mouse rested on the player. */
@media (hover: hover) {
	.mc-player.has-marquee .mc-player__label:hover .mc-player__label-inner {
		animation-play-state: paused;
	}
}
.mc-player .mc-player__label-inner:focus-visible {
	animation-play-state: paused;
}

@keyframes mc-marquee {
	from { transform: translateX(0); }
	to   { transform: translateX(var(--mcp-loop, -100%)); }
}

@media (prefers-reduced-motion: reduce) {
	.mc-player.has-marquee .mc-player__label-inner { animation: none; }
	.mc-player__label { text-overflow: ellipsis; }
}

/* The timeline is LTR even though the site is RTL — time runs left-to-right in
   every media player people already use, and mirroring it reads as broken. */
.mc-player__track {
	position: relative;
	direction: ltr;
	width: 100%;
	height: var(--mcp-track-h);
	background: var(--mcp-track);
	border-radius: 999px;
	overflow: hidden;
	cursor: pointer;
	touch-action: none; /* let us own the drag instead of the page scrolling */
}

.mc-player__track:focus-visible {
	outline: 2px solid var(--mcp-fill);
	outline-offset: 4px;
}

/* `left`, not inset-inline-start: the fill must grow rightward regardless of
   the page direction, to match the LTR timeline above. */
.mc-player__fill {
	position: absolute;
	inset-block: 0;
	left: 0;
	width: 0;
	background: var(--mcp-fill);
	border-radius: 999px;
}

.mc-player:not(.is-seeking) .mc-player__fill { transition: width .1s linear; }

/* elapsed | transport | total — LTR so elapsed sits under the start of the bar
   and total under its end, matching the timeline */
.mc-player__times {
	display: flex;
	direction: ltr;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	color: #8A6A52;
	font-size: 13px;
	font-variant-numeric: tabular-nums; /* stops the row jittering as digits change */
}

.mc-player__times > span { unicode-bidi: isolate; }

/* ---------- transport: skip back / skip forward / speed ---------- */

.mc-player__controls {
	display: flex;
	align-items: center;
	gap: var(--mcp-ctrl-gap);
}

/* double class again — Kit 6's global button style would otherwise paint these
   black pills too (see .mc-player__toggle above) */
.mc-player .mc-player__skip,
.mc-player .mc-player__speed {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: none;
	background-color: transparent;
	color: var(--mcp-ctrl);
	border: 0;
	padding: 4px;
	margin: 0;
	line-height: 1;
	cursor: pointer;
	transition: opacity .15s ease, transform .15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.mc-player .mc-player__skip:hover,
.mc-player .mc-player__speed:hover {
	background-color: transparent;
	color: var(--mcp-ctrl);
	opacity: .65;
}

.mc-player .mc-player__skip:active { transform: scale(.92); }

.mc-player .mc-player__skip:focus-visible,
.mc-player .mc-player__speed:focus-visible {
	outline: 2px solid var(--mcp-fill);
	outline-offset: 2px;
}

/* NO `fill` here. The ring is stroked and each shape carries its own fill
   attribute; a CSS `fill` would beat those presentation attributes and flood
   the thin ring back into a solid blob. */
.mc-player__skip svg {
	width: var(--mcp-ctrl-size);
	height: var(--mcp-ctrl-size);
	display: block;
}

/* the digits inside the circular arrows */
.mc-player__skip text {
	font-family: inherit;
	font-weight: 600;
}

/* `height` + the inherited inline-flex centring is what actually vertically
   centres the number in the pill — padding alone left it sitting high, because
   the font's ascent/descent are not symmetric. Matching the skip icon height
   also lines all three controls up on one baseline. */
.mc-player .mc-player__speed {
	direction: ltr;
	min-width: 40px;
	height: var(--mcp-ctrl-size);
	/* asymmetric top padding is an OPTICAL correction, not a mistake: flex
	   centring centres the line BOX, and this font's ascent exceeds its descent,
	   so digits (which have no descenders) land ~1.5px high. */
	padding: 2px 8px 0;
	border: 1px solid var(--mcp-speed-border);
	border-radius: 999px;
	font-size: .92em;
	font-weight: 600;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

.mc-player__audio { display: none; }

.mc-player.has-error .mc-player__track { opacity: .4; }

/* ---------- responsive: mirrors the card's own breakpoints ---------- */

@media (max-width: 767px) {
	/* Stays a ROW on mobile — the play button keeps its position on the left
	   rather than jumping above the bar.

	   ⚠️ DO NOT put --mcp-gap / --mcp-btn-pad / --mcp-icon / --mcp-ctrl-size
	   here. Elementor emits those from the widget's controls as
	   `.elementor-element-<id> .mc-player{…}` — specificity (0,2,0) against this
	   rule's (0,1,0) — and SPECIFICITY BEATS A MEDIA QUERY, so anything set here
	   is silently dead. Responsive values for controlled variables belong on the
	   widget's own _tablet/_mobile controls. Only --mcp-ctrl-gap works here,
	   because no control owns it. */
	.mc-player {
		--mcp-ctrl-gap: 3px;
	}

	/* The card switches to column + align-items:center on mobile, which makes
	   every child shrink-to-fit — the widget wrapper came out 198px inside a
	   291px card. align-self overrides the card's align-items for this child
	   only, without touching the card's own settings. */
	.elementor-widget-mc-episode-player { align-self: stretch; width: 100%; }

	/* the times row gets very tight at 375px — let it breathe */
	.mc-player__times { gap: 6px; font-size: 12px; }

	.mc-player .mc-player__speed { min-width: 36px; padding: 2px 6px 0; }
}

/* ---------- fallback embed (episodes with no audio URL yet) ---------- */

.mc-player-embed { width: 100%; }
.mc-player-embed iframe { width: 100%; border: 0; }

.mc-player-notice {
	padding: 14px 18px;
	border: 1px dashed rgba(138, 106, 82, .5);
	border-radius: 12px;
	color: #8A6A52;
	font-size: 14px;
}
