/**
 * Pro's element types, on the classic look.
 *
 * A slider, an image answer, a media answer and a dropdown are all Pro element
 * types. Their classic-look styling lived in Core until 2026-09, which meant
 * every Free visitor downloaded 6.3 KB of CSS for markup a Free site cannot
 * produce — Core's four renderers emit none of these classes.
 *
 * It arrived byte-identical to what Core had, deliberately: not scoped to
 * `[data-template="classic"]`, not reordered, not tidied. Scoping would raise
 * every selector's specificity and quietly change which rule wins against the
 * `:has()` state rules in `assets/style.css` — `.yop-poll-media-caption` is
 * the one that showed it, and it is left out of this file entirely because
 * `assets/style.css` already owns it. That still holds for every selector
 * here; `.yop-poll-dropdown` is the one rule that has since been changed on
 * purpose, and it says why in place.
 *
 * Loaded wherever the classic sheet is loaded, which is what makes scoping
 * unnecessary: a material or bootstrap poll never sees it, exactly as it never
 * saw Core's copy. It is a dependency of `yop-poll-pro-addon-style` so it
 * prints first, keeping the order Core's sheet and this addon's have always
 * had.
 */

/* The Answers group styles answer text, and a dropdown's answers are its
   options. Hard-coding the size here meant Size, Weight and Colour moved every
   other answer type and silently did nothing to a dropdown. Same variables and
   same defaults as Core's .yop-poll-answer-text, because it is the same
   setting. */
.yop-poll-dropdown {
	width: 100%;

	/* The box is a field, so it takes the field's own tokens — the same ones
	   `.yop-poll .yop-poll-text-input` reads. It used to carry its own
	   `6px 10px`, `1px solid #999` and `3px`, which is 14px shorter than the
	   write-in box that sits directly under it on a dropdown that takes one,
	   with a sharper corner and a darker edge. Two controls in one column,
	   neither lining up with the other. */
	box-sizing: border-box;
	padding: var(--yop-fld-pt, 13px) var(--yop-fld-pr, 12px) var(--yop-fld-pb, 13px) var(--yop-fld-pl, 12px);
	border-width: var(--yop-fld-bw, 1px);
	border-style: solid;

	/* ...and Answer boxes names the dropdown among the four boxes it styles,
	   so the edge and the corner come from there first and fall back to the
	   field's own. The alignment above is what an author gets by setting
	   neither, which is every poll saved before the part existed; setting
	   Answer boxes alone is them saying the box is a box before it is a
	   field, and the write-in row keeps the field's corner. */
	border-color: var(--yop-box-edge, var(--yop-fld-bc, #8a96a4));
	border-radius: var(--yop-box-radius, var(--yop-fld-br, 8px));
	background: var(--yop-fld-bg, #fff);
	line-height: 1.35;

	/* The theme's font, which a `<select>` no more inherits than an `<input>`
	   does — Core's sheet says the same thing over the field rule this one
	   mirrors, and for the same reason: unsaid means the browser's choice, not
	   the page's. */
	font-family: inherit;

	/* The text is answer text, though: a dropdown's options are its answers,
	   and the Answers group's Size, Weight and Colour are meant to move them
	   the way they move every other answer type. That is why the two halves
	   read from different groups. */
	font-size: var(--yop-ans-ts, 14px);
	color: var(--yop-ans-tc, inherit);
	font-weight: var(--yop-ans-tw, normal);

	/* Which leaves one gap: the field's default text is 15px and an answer's
	   is 14px, so equal padding still lands the two controls a pixel and a
	   half apart. This is the write-in box's own height, written out — the
	   line, the padding and the borders `box-sizing` folds in — so the two
	   are level whatever the field settings say. `min-height`, never
	   `height`: bigger answer text is allowed to grow the control rather than
	   be clipped by it, which is also what 1.4.4 asks for. */
	min-height: calc(
		var(--yop-fld-ts, 15px) * 1.35 + var(--yop-fld-pt, 13px) +
			var(--yop-fld-pb, 13px) + 2 * var(--yop-fld-bw, 1px)
	);

	/* Not `appearance: none`, unlike the text input: the disclosure arrow is
	   the only thing that says this control opens, and nothing here draws a
	   replacement. */
	cursor: pointer;
	outline: none;
}

/* The cards' own grid.

   It was the author's: Arrangement "In columns" with a column count, the same
   rows every other question type offers. Those rows are gone from this type,
   because a card is a picture with two lines of prose under it and that has
   one right width -- which is not a thing to ask an author to pick, and not a
   thing they could have got right at every screen size anyway.

   `auto-fit` with a floor is what the column count could not be: four across
   on a wide poll, two in a 380px one, one when there is not room for two. It
   needs no container query and no breakpoint, and nothing overflows at 320px
   because the track floor is a minimum for the track, not for the grid.

   150px is the floor because two of these side by side is what a poll in a
   post column should show, and that column is often 380px. A higher floor
   reads better in isolation and gives that poll a single column of enormous
   pictures, which is the shape this design is not.

   More specific than `.yop-poll-answers--columns-3` on purpose: a poll that
   set a column count before these rows were withdrawn is laid out by the type
   now, like every other poll of this type. Leaving the old count honoured
   would have two polls differ for a reason nobody can see or change. */
.yop-poll .yop-poll-media-tiles {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 150px, 1fr ) );
	gap: var(--yop-media-gap, 12px);
	align-items: stretch;
}

/* Per row: the author's ceiling on that, for a poll whose width gave a count
   they did not want -- three across with one left over, where two rows of two
   was the point.

   Still `auto-fit`, so it is a ceiling and not a count. Each track's floor is
   its share of the row at N across, which stops an N+1th fitting; the 120px
   under that is a tile's narrowest, so a phone still drops to fewer rather
   than drawing four slivers. Lower than the auto floor on purpose: an author
   who asked for four in a 560px poll gets four. */
.yop-poll .yop-poll-media-tiles--per-row-2 {
	grid-template-columns: repeat( auto-fit, minmax( max( 120px, calc( ( 100% - var(--yop-media-gap, 12px) ) / 2 ) ), 1fr ) );
}

.yop-poll .yop-poll-media-tiles--per-row-3 {
	grid-template-columns: repeat( auto-fit, minmax( max( 120px, calc( ( 100% - 2 * var(--yop-media-gap, 12px) ) / 3 ) ), 1fr ) );
}

.yop-poll .yop-poll-media-tiles--per-row-4 {
	grid-template-columns: repeat( auto-fit, minmax( max( 120px, calc( ( 100% - 3 * var(--yop-media-gap, 12px) ) / 4 ) ), 1fr ) );
}

/* Label alignment: where the caption and its note line up inside the tile.
   Left is the start edge every rule above already draws, so it has no class.
   Logical values, so a right-to-left poll mirrors the author's pick. The
   overlay is listed too: it sets its own `start`, and a caption over the
   picture is still the caption. */
.yop-poll .yop-poll-media-tiles--caption-center .yop-poll-media-tile__body,
.yop-poll .yop-poll-media-tiles--caption-center .yop-poll-media-tile__overlay,
.yop-poll .yop-poll-media-tiles--caption-center .yop-poll-media-caption {
	text-align: center;
}

.yop-poll .yop-poll-media-tiles--caption-right .yop-poll-media-tile__body,
.yop-poll .yop-poll-media-tiles--caption-right .yop-poll-media-tile__overlay,
.yop-poll .yop-poll-media-tiles--caption-right .yop-poll-media-caption {
	text-align: end;
}

/* Image answers, drawn as cards.

   A picture, a word over it, and the answer's name and note beneath, in a
   frame that says where one answer ends and the next begins. It used to be an
   `<img>` at its natural size with a caption under it and a radio under that:
   three loose pieces that a row of differently-proportioned photographs left
   ragged, and a 16px circle doing the work of saying which one was picked.

   The grid is the author's, not this file's -- Arrangement "In columns" with
   `answersColumns`, the same rows every other question type uses. What is here
   is what one card looks like however many of them are in a row. */
.yop-poll .yop-poll-media-tile {
	position: relative;
	display: flex;
	flex-direction: column;
	/* Not `align-self: flex-start`: a card stretches to its grid track so a
	   row of them shares one height, which is the whole reason for the frame. */
	align-self: stretch;
	min-width: 0;
	/* The picture sits inside the card rather than bleeding to its edge, so
	   the card reads as a card holding a picture rather than as a picture with
	   a caption stuck underneath. */
	padding: 10px;
	cursor: pointer;
	border: 1px solid var(--yop-ans-cbc, #dcdcde);

	/* The poll's Media tiles part first, then the vote button's corner, which
	   is what this drew before the part existed. One tile serves every image,
	   video and audio choice, so a corner set once reaches all of them. */
	border-radius: var(--yop-media-radius, var(--yop-btn-br, 8px));
	background: var(--yop-ans-bg, transparent);
	transition: transform 0.15s ease, box-shadow 0.15s ease,
		border-color 0.15s ease, background-color 0.15s ease;
}

/* The picture's own box.

   `aspect-ratio` and `object-fit` are what make four photographs of four
   shapes line up; without them the tallest one sets the row height and the
   rest float in it. 4:3 rather than widescreen, because an answer's picture is
   as often a product, a cover or a face as it is a landscape, and 16:9 crops
   all three badly.

   Its own border and radius, so an answer whose picture has not loaded -- or
   has not been chosen yet -- is still a box where a picture goes rather than a
   gap in the list. */
.yop-poll .yop-poll-media-tile__frame {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: 4 / 3;
	border: 1px solid var(--yop-ans-cbc, #dcdcde);
	border-radius: 6px;
	background: var(--yop-ans-cbg, #eceff1);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.yop-poll .yop-poll-media-tile img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 0;
}

/* The words. Their own box, so the picked state can tint the card without
   tinting the photograph -- painting the whole label would put a wash over
   the one thing the answer is actually about. */
.yop-poll .yop-poll-media-tile__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 3px;
	padding: 10px 2px 2px;
	text-align: start;
}

/* The answer's name: the line a voter reads to choose, so it carries the
   Answers settings the way every other answer's text does. */
.yop-poll .yop-poll-media-caption {
	display: block;
	margin-block-start: 0;
	font-size: var(--yop-ans-ts, 15px);
	font-weight: var(--yop-ans-tw, 600);
	color: var(--yop-ans-tc, inherit);
	text-align: start;
}

/* The note under it. Quieter, and `0.9em` rather than a size of its own so it
   stays a step below whatever the author set the answer text to. */
.yop-poll .yop-poll-media-tile__note {
	display: block;
	font-size: 0.9em;
	font-weight: normal;
	opacity: 0.75;
	color: var(--yop-ans-tc, inherit);
}

/* A link inside a tile, whichever medium the tile holds. Grouped rather than
   renamed: both classes are already in the wild on saved polls, and the rule
   is one line either way. */
.yop-poll .yop-poll-image-link,
.yop-poll .yop-poll-video-link {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
}

/* Picked: the card's own border and a wash behind the words, and the mark
   moves onto the picture as a filled badge.

   Colour is not doing this alone. The border thickens and changes, the body
   is tinted, and the badge appears with a tick in it -- so the picked card is
   different in shape as well as in hue, which is 1.4.1. */
.yop-poll .yop-poll-media-tile:has( .yop-poll-tap-input:checked ) {
	border-color: var(--yop-media-acc, var(--yop-btn-bg, #2271b1));

	/* The ring, whose thickness is the part's. It falls back to the hairline
	   this drew before the control existed rather than to the control's own
	   floor, so an untouched poll is unchanged -- and the tile is tinted and
	   badged as well, so the ring is never the only thing saying which one is
	   picked. */
	box-shadow: inset 0 0 0 var(--yop-media-ring, 1px)
		var(--yop-media-acc, var(--yop-btn-bg, #2271b1));
	background: color-mix(
		in srgb,
		var(--yop-media-acc, var(--yop-btn-bg, #2271b1)) 8%,
		transparent
	);
}

/* The mark. A badge on the picture rather than a circle below the words: it
   is where a voter's eye already is, and it is the top-right corner of the
   thing they just pressed.

   Absolutely positioned against the label, which is the card -- so this needs
   no change to `Media_Answers::render()`, whose fixed
   label/input/media/indicator order the video and audio answers share. */
.yop-poll .yop-poll-media-tile__indicator {
	position: absolute;
	inset-block-start: 10px;
	inset-inline-end: 10px;
	display: block;
	width: 22px;
	height: 22px;
	box-sizing: border-box;
	margin: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.3 );

	/* Nothing until it is picked. A ring on every card is a white circle
	   floating over four photographs, and the card is already obviously
	   pressable -- it is the whole target, with a pointer cursor on it. The
	   state a voter needs to see is which one they chose, and that is said
	   three ways below: the border, the tint, and the tick appearing.

	   `opacity`, not `display`, so the badge can be given a transition later
	   and so its box is already reserved -- appearing from nothing moves
	   nothing, which is the point. */
	opacity: 0;
	background: transparent;
}

.yop-poll .yop-poll-media-tile__indicator--checkbox {
	border-radius: 6px;
}

.yop-poll .yop-poll-media-tile:has( .yop-poll-tap-input:checked ) .yop-poll-media-tile__indicator {
	opacity: 1;
	background: var(--yop-btn-bg, #2271b1);
}

/* The tick, drawn as two borders on a rotated box -- the same mark the other
   card types use, so one answer style does not disagree with another about
   what "picked" looks like. */
.yop-poll .yop-poll-media-tile:has( .yop-poll-tap-input:checked ) .yop-poll-media-tile__indicator::after {
	content: "";
	position: absolute;
	inset-block-start: 50%;
	inset-inline-start: 50%;
	width: 5px;
	height: 9px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	border-radius: 0;
	background: transparent;
	transform: translate( -50%, -60% ) rotate( 45deg );
}

/* An answer whose author gave it no picture: the badge would otherwise sit in
   the corner of a box that is not there. */
.yop-poll .yop-poll-media-tile:not( :has( .yop-poll-media-tile__frame ) )
	.yop-poll-media-tile__indicator {
	inset-block-start: 10px;
	border-color: var(--yop-btn-bg, #2271b1);
	box-shadow: none;
}

/* ── The three layouts ─────────────────────────────────────────────────────

   One set of parts -- a frame, a caption, a note -- arranged three ways. The
   rules above are what they have in common; these are the differences, and
   they are differences of box rather than of markup, which is why one renderer
   draws all three.
   ───────────────────────────────────────────────────────────────────────── */

/* A tile: the picture and its caption, with nothing drawn round them at rest.

   No border and no fill -- a border on a grid of photographs is a grid of
   boxes, and the pictures are already rectangles that say where one answer
   ends. But it keeps the card's padding, invisible while the tile is
   transparent, and that padding is doing two jobs.

   It is the room the picked state and the hover need. A ring drawn tight
   against a photograph reads as a blue box crushing the picture rather than a
   frame round the answer, and a shadow with nothing between it and the image
   is a smudge at the edge of the photo. Both want white space to sit in, and
   the only way to have it on hover without the tile changing size -- which
   would shove the whole grid two pixels sideways every time a pointer crossed
   it -- is to have it at rest.

   Scoped to the tile that is not picked, so that the picked rule's own fill is
   not undone by a rule about the resting look. A tile with no border and no
   fill is what a tile looks like; it is not what a chosen one looks like. */
.yop-poll
	.yop-poll-media-tiles--grid
	.yop-poll-media-tile:not(
		:has( .yop-poll-tap-input:checked )
	) {
	border-color: transparent;
	background: none;
}

/* Flush with the picture above it: the tile's own padding already holds the
   caption off the edge, and a second inset would step it in from the photo. */
.yop-poll .yop-poll-media-tiles--grid .yop-poll-media-tile__body {
	padding: 8px 0 0;
}

/* A tile's caption is the answer, so it takes the Answers settings whole
   rather than the card's heavier weight: on a card the name is a heading over
   a note, and here it is the only line there is. */
.yop-poll .yop-poll-media-tiles--grid .yop-poll-media-caption {
	font-weight: var(--yop-ans-tw, normal);
}

/* Beside: the picture next to the words instead of above them. A row, so the
   list is a column of rows rather than a grid -- the whole point of the layout
   is that a narrow poll can still show a picture with each answer. */
.yop-poll .yop-poll-image-answers--beside {
	display: flex;
	flex-direction: column;
}

.yop-poll .yop-poll-image-answers--beside .yop-poll-media-tile {
	flex-direction: row;
	align-items: center;
	gap: 12px;
	padding: 10px;
}

.yop-poll .yop-poll-image-answers--beside .yop-poll-media-tile__frame {
	flex: 0 0 auto;
	width: 44px;
	aspect-ratio: 1;
	border-radius: 4px;
}

.yop-poll .yop-poll-image-answers--beside .yop-poll-media-tile__body {
	flex: 1 1 auto;
	padding: 0;
}

/* The badge goes back into the flow on this one: there is no picture filling
   the row for it to sit on top of, and a mark floating over an 84px thumbnail
   in a row of them is harder to read than one at the end of the row. */
/* The badge goes back into the flow on this one: there is no picture filling
   the row for it to sit on top of, and a mark over a 44px thumbnail would be
   most of the thumbnail. It still appears only once there is something to
   mark, the same as the other two -- a column of empty circles is what the
   rest of this design was drawn to avoid. */
.yop-poll .yop-poll-image-answers--beside .yop-poll-media-tile__indicator {
	/* `relative`, not `static`: the tick inside is absolutely positioned, and
	   with nothing positioned to hold it, it resolves against the row instead
	   and lands beside the badge rather than in it. */
	position: relative;
	inset: auto;
	flex: 0 0 auto;
	order: 1;
	box-shadow: none;
}

/* ── A pointer over an answer ──────────────────────────────────────────────

   The tile lifts. Not the border -- and that is the whole of the reasoning,
   because the border is what picked uses: an accent border on hover would
   leave the answer under the pointer wearing half of the chosen state for as
   long as the pointer sat there, which is the 1.4.1 failure the picked rule
   exists to avoid. Motion says "pressable", colour says "pressed", and the two
   never have to be told apart.

   It also answers the thing a border cannot. An accent outline round a
   photograph is a thin line at the edge of a busy rectangle; a lift moves the
   picture itself, which is what a visitor is actually looking at.

   One rule for all three layouts rather than three. A card, a tile and a row
   are different boxes but the same answer, and the lift is about the answer --
   so a fourth layout gets it without being remembered.

   `@media ( hover: hover )` because a finger has no hover: on a phone the rule
   latches after a tap and leaves the last-touched answer raised.

   Nothing excludes a results row, unlike the tap stylings, and that is not an
   oversight: an image question's results are drawn as `.yop-poll-media-answer`
   rows by `result_content()`, not as `.yop-poll-media-tile`, so this selector
   cannot reach them. A test holds that apart.
   ───────────────────────────────────────────────────────────────────────── */
@media ( hover: hover ) {

	.yop-poll .yop-poll-media-tiles--lift
		.yop-poll-media-tile:not(
			:has( .yop-poll-tap-input:checked )
		):hover {
		transform: translateY( -2px );
		box-shadow: 0 4px 12px -6px rgba( 20, 25, 30, 0.35 );
	}
}

/* The movement is the decoration and the shadow is the message, so a visitor
   who asked for less of the first keeps the second. A tile that only deepens
   its shadow still says it is pressable; one that only moves says it to
   somebody who did not want to be moved at. */
@media ( prefers-reduced-motion: reduce ) {

	.yop-poll .yop-poll-media-tile,
	.yop-poll .yop-poll-media-tile__frame {
		transition: none;
	}

	.yop-poll .yop-poll-media-tiles--lift .yop-poll-media-tile:hover {
		transform: none;
	}
}

/* ── Where the caption sits ────────────────────────────────────────────────

   "Below" and "above" are DOM order and need no rule; the renderer emits the
   words before the picture for one and after it for the other, so they are
   read in the order they are seen. Only "over" is positioned, because there is
   no document order that means on top of.
   ───────────────────────────────────────────────────────────────────────── */
.yop-poll .yop-poll-media-tile__overlay {
	position: absolute;
	inset-inline-start: 0;
	inset-block-end: 0;
	width: 100%;
	box-sizing: border-box;
	padding: 8px 12px;
	/* Flat behind the words. White text on a photograph is white text on
	   whatever is underneath it, and the worst case is a white sky: over
	   white, black at 0.6 leaves an effective #666, and white on that is
	   5.7:1. A gradient that thins through the line measured 3.35:1, under
	   the 4.5:1 this text needs -- so the opacity behind the glyphs is not a
	   number to taste, and it does not move.

	   What did move is how much of the picture it covers. The fade used to be
	   part of this box, so the box had to be tall enough to hold both the
	   text and the fade above it -- about a third of the tile, which over a
	   pale picture reads as a heavy black band rather than a caption. The
	   feather is its own layer now (below), so this box is only as tall as
	   the words in it and stays that way for a caption that wraps to two
	   lines. */
	background: rgba( 0, 0, 0, 0.6 );
	color: #fff;
	font-size: var(--yop-ans-ts, 15px);
	font-weight: 600;
	text-align: start;
}

/* The soft edge, sitting on top of the scrim rather than inside it.

   Measured in pixels because it is an optical join, not a share of the tile:
   a tall card and a small thumbnail want the same short feather, and a
   percentage gives the tall one a band you can see the shape of. */
.yop-poll .yop-poll-media-tile__overlay::before {
	content: "";
	position: absolute;
	inset-inline: 0;
	inset-block-end: 100%;
	height: 18px;
	background: linear-gradient(
		to top,
		rgba( 0, 0, 0, 0.6 ) 0,
		rgba( 0, 0, 0, 0 ) 100%
	);
}

/* Above: the words come first in the markup, so the only thing left is to
   stop the card's body padding putting a gap where the picture's top edge
   should be. */
.yop-poll .yop-poll-media-tiles--label-above .yop-poll-media-tile__body {
	padding-block-end: 10px;
}

.yop-poll .yop-poll-media-tiles--grid.yop-poll-media-tiles--label-above
	.yop-poll-media-tile__body {
	padding: 0 0 8px;
}

/* ── A video tile ──────────────────────────────────────────────────────────

   Everything about the tile itself -- the frame, the body, the caption, the
   picked state, the hover lift -- is the shared `yop-poll-media-tile` block
   above. What is left here is the two things that are true of a video and not
   of a picture.

   The frame is 16:9 rather than 4:3. Every provider hands out a widescreen
   player, and cropping one into a 4:3 box either letterboxes it or cuts the
   sides off a picture the poll is asking a visitor to judge.
   ───────────────────────────────────────────────────────────────────────── */
.yop-poll .yop-poll-video-answer .yop-poll-media-tile__frame {
	aspect-ratio: 16 / 9;
}

/* And the embed fills it.

   `.yop-poll-video-embed` is shared with the `standard-video` content block,
   where it is a figure in the page and carries `width: 560px` -- the size a
   provider's markup asks for, which is right for a block of content and wrong
   for a tile in a grid, where it overflows the answer. Scoped to a video
   answer so the content block keeps its own size. */
.yop-poll .yop-poll-video-answer .yop-poll-video-embed {
	position: absolute;
	inset: 0;
	width: 100%;
	max-width: none;
	height: 100%;
	aspect-ratio: auto;
}

.yop-poll .yop-poll-video-answer .yop-poll-video-embed iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

/* The mark, shown and in the flow at the foot of the card (QA M13).

   The rule above that hides it rests on the whole card being the target, and
   a video's card is not: the player takes every click on it, to play. That
   left the caption strip as the only way to choose, with nothing saying so --
   and with captions turned off, no way at all. So on a video the ring is
   always there, under the caption, where a click reaches the label rather
   than the player: the radio the audio answers beside it already show, and
   the one place on the card that says "choose here".

   `.yop-poll-media-tile` in the selector for the weight to outrank the
   no-frame rule above, which would otherwise push it 10px down. */
.yop-poll .yop-poll-media-tile.yop-poll-video-answer .yop-poll-media-tile__indicator {
	position: relative;
	inset: auto;
	flex: 0 0 auto;
	align-self: flex-start;
	margin-block-start: 8px;
	border-color: var(--yop-btn-bg, #2271b1);
	box-shadow: none;
	opacity: 1;
}

/* Media answers (video/audio) */
.yop-poll .yop-poll-media-answer {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	align-self: flex-start;
	min-width: 0;
	padding: 8px;
	border: 1px solid transparent;
	border-radius: 3px;
}

.yop-poll .yop-poll-media-answer iframe {
	width: 100%;
	max-width: 100%;
	aspect-ratio: 16 / 9;
	height: auto;
}

.yop-poll .yop-poll-media-answer video {
	width: 100%;
	max-width: 100%;
	height: auto;
}

.yop-poll .yop-poll-media-answer audio {
	width: 100%;
	max-width: 100%;
}

/* <audio> has no intrinsic width, so the shrink-to-fit answer box would
   collapse it to the overflow button. Size the box, not the player. */
.yop-poll .yop-poll-media-answer--audio {
	width: min(320px, 100%);
}

.yop-poll-answers--horizontal .yop-poll-media-answer {
	flex: 1 1 0;
}

/* A medium naming its answer in the results view.

   `yop-poll-media-result` is what image, video and audio each hand to Core's
   `yop_poll_result_answer_content`, and it was styled nowhere: it fell through
   to `.yop-poll-media-answer`, which is a ballot answer -- a centred column
   with padding, sized by its contents. In a results row that is a picture at
   its own natural width inside a flex line, so a 1200px photograph took the
   line and pushed the figures into a column three words tall, or off the poll
   entirely.

   It sits below the ballot rules on purpose. Every selector here ties with the
   `.yop-poll-media-answer` one it has to beat, so the cascade decides on order
   alone -- moved above them, this block silently stops applying.

   A results row is a bar with one line above it. The medium on that line is
   there to say which answer the bar belongs to, so it is a thumbnail beside
   the name rather than the answer drawn again: a row, not a column, and
   capped.
   ───────────────────────────────────────────────────────────────────────── */
.yop-poll .yop-poll-media-result {
	flex: 1 1 auto;
	flex-direction: row;
	/* The name drops under the medium on a narrow poll rather than being
	   squeezed beside it a letter wide. */
	flex-wrap: wrap;
	/* Bottom, not middle. The medium is the tall thing on this line and the
	   name beside it is text, so centring set the words halfway up a 68px
	   frame -- a long way from the bar they belong to, and nowhere near where
	   a text question puts them. */
	align-items: flex-end;
	gap: 8px;
	min-width: 0;
	padding: 0;
}

.yop-poll .yop-poll-media-result img {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	object-fit: cover;
	border: 1px solid var(--yop-ans-cbc, #dcdcde);
	border-radius: 4px;
}

/* An embed keeps its shape, because a square crop of a widescreen frame is a
   thumbnail of nothing.

   Big enough to tell two clips apart, which is the whole job the frame is here
   to do: at the 80px it started out, a provider's thumbnail is the play badge
   with a few pixels of video around it and every answer looks the same.

   Sized on the wrapper rather than on the iframe, which is the half that was
   missing. `.yop-poll-video-embed` is shared with the `standard-video` content
   block and carries `width: 560px; aspect-ratio: 16 / 9` for it; the iframe
   inside is absolutely positioned to fill that box. Capping only the iframe
   therefore shrank the picture and left the 560px box holding the line open,
   so the figures still had nowhere to go.

   It holds a still, not the player: a live player this small is one a
   provider draws broken, the title over the picture and the controls cut off
   (QA M14). `Element_Video_Question::still()` draws YouTube's own picture,
   or a play mark on a dark frame for anything else. */
.yop-poll .yop-poll-media-result .yop-poll-video-embed {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	flex: 0 0 auto;
	width: 120px;
	max-width: none;
	aspect-ratio: 16 / 9;
}

.yop-poll .yop-poll-media-result iframe {
	flex: 0 0 auto;
	width: 100%;
	height: 100%;
}

/* The still fills its frame. After the 48px picture rule above, which it
   would otherwise take: that one is an image answer's thumbnail. */
.yop-poll .yop-poll-media-result .yop-poll-video-still {
	border-radius: 4px;
	background: #1d2327;
}

.yop-poll .yop-poll-media-result .yop-poll-video-still img {
	width: 100%;
	height: 100%;
	border: 0;
	border-radius: 0;
}

.yop-poll .yop-poll-media-result .yop-poll-video-still__mark {
	font-size: 22px;
	line-height: 1;
	color: #fff;
}

/* A clip has no picture to show, so what it gets is a player on one line --
   wide enough to keep its progress bar, which a browser drops first when the
   player is narrow, leaving a play button and a time that cannot be scrubbed
   (QA M14). On a narrow poll the name wraps beneath it instead, and only a
   poll narrower than the player narrows it. */
.yop-poll .yop-poll-media-result audio {
	flex: 0 0 auto;
	width: 300px;
	max-width: 100%;
	height: 32px;
}

.yop-poll .yop-poll-media-result .yop-poll-media-caption {
	min-width: 0;
	margin: 0;
	overflow-wrap: anywhere;
	text-align: start;
}

/* And the figures stay whole. They are the one thing on the line that cannot
   usefully be narrowed -- "100% (2 votes)" broken over three lines is the
   state the row was in -- so the name gives way and they do not.

   Scoped to a row that holds one of these, because every other type's label is
   text and shrinks sensibly on its own. */
.yop-poll .yop-poll-result-text:has( .yop-poll-media-result ) > span:last-child {
	flex: 0 0 auto;
	/* On the bar, level with the answer's name, exactly as a text question
	   draws them -- and not halfway up the frame, which is where centring put
	   them once the frame grew tall enough for the difference to show. */
	align-self: flex-end;
	white-space: nowrap;
}

/* Media answer indicator */
.yop-poll-media-indicator {
	display: block;
	width: 16px;
	height: 16px;
	border: 2px solid #757575;
	border-radius: 50%;
	margin: 6px auto 0;
	box-sizing: border-box;
	position: relative;
}

.yop-poll-media-indicator--checkbox {
	border-radius: 3px;
}

/* Sliders */
.yop-poll-slider-pips {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 9px;   /* thumb_width / 2 = 18 / 2 */
	right: 9px;
	pointer-events: none;
}

.yop-poll-slider-pip {
	position: absolute;
	top: 50%;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	border: 2px solid;
	transform: translate(-50%, -50%);
	box-sizing: border-box;
}

.yop-poll-slider-wrap {
	display: flex;
	flex-direction: column;
	gap: 4px;
	/* A number line, low to high, in every language. The value above the
	   handle, the step dots and the labels are each placed by a percentage
	   from the left; a browser mirrors only the range itself in a
	   right-to-left page, which left the value sitting at the far end of the
	   track from the handle it names. */
	direction: ltr;
}

/* Their own words still read their own way. */
.yop-poll-slider-label,
.yop-poll-slider-value {
	unicode-bidi: plaintext;
}

/*
 * Twice: bare for the builder's preview, which is not inside `.yop-poll`, and
 * under it on the site, where a theme's own input rules -- `input[type=range]`
 * and the like, one class and an element -- outrank a single class. Losing to
 * one drew the track as the theme's white text box with padding inside it,
 * and the padding moved the handle in from both ends, away from the value
 * placed over it. Padding and border are stated for that reason.
 */
.yop-poll-slider,
.yop-poll .yop-poll-slider {
	-webkit-appearance: none;
	appearance: none;
	display: block;
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	border: 0;
	width: 100%;
	height: var(--yop-slider-height, 6px);
	border-radius: 3px;
	background: var(--yop-slider-track, #434d5a);
	outline: none;
	cursor: pointer;
}

.yop-poll-slider::-webkit-slider-thumb,
.yop-poll .yop-poll-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--yop-slider-thumb, #337ab7);
	cursor: pointer;
	border: none;
	margin-top: -6px;
}

.yop-poll-slider::-moz-range-thumb,
.yop-poll .yop-poll-slider::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--yop-slider-thumb, #337ab7);
	cursor: pointer;
	border: none;
}

.yop-poll-slider::-moz-range-track {
	background: var(--yop-slider-track, #434d5a);
	height: var(--yop-slider-height, 6px);
	border-radius: 3px;
}

.yop-poll-slider-labels {
	position: relative;
	height: 1.5em;
	margin-top: 8px;
}

.yop-poll-slider-label {
	position: absolute;
	transform: translateX(-50%);
	font-size: 11px;
	color: #666;
	white-space: nowrap;
}

.yop-poll-slider-inner {
	position: relative;
	margin-top: 30px;
}

/*
 * Over the handle, and inside the track at both ends.
 *
 * `--yop-slider-pos` is the value as a fraction of the range. The handle's
 * centre is not that fraction of the track: at the minimum it sits half its
 * own width in from the edge, so a bubble centred on 0% hung half off the
 * poll. `left` puts the bubble's anchor on the handle's centre, and the
 * translate moves the bubble by the same share of its own width -- starting at
 * the handle at the minimum, ending at it at the maximum, centred between --
 * so its edge never passes the track's. The arrow below moves the same way and
 * keeps pointing at the handle.
 *
 * The border is named because the two percentages disagree about it: the
 * translate's 100% is the bubble's border box, the arrow's is its padding box.
 */
.yop-poll-slider-value {
	--yop-slider-thumb-half: 9px;
	--yop-slider-bubble-border: 2px;
	position: absolute;
	bottom: calc(100% + 12px);
	left: calc(var(--yop-slider-thumb-half) + (100% - 2 * var(--yop-slider-thumb-half)) * var(--yop-slider-pos, 0.5));
	transform: translateX(calc(-1 * (var(--yop-slider-thumb-half) + (100% - 2 * var(--yop-slider-thumb-half)) * var(--yop-slider-pos, 0.5))));
	background: #fff;
	color: #333;
	border: var(--yop-slider-bubble-border) solid var(--yop-slider-thumb, #337ab7);
	padding: 4px 10px;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	line-height: 1.4;
	z-index: 10;
	pointer-events: none;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.yop-poll-slider-value::after {
	content: "";
	position: absolute;
	top: 100%;
	left: calc(var(--yop-slider-thumb-half) - var(--yop-slider-bubble-border) + (100% + 2 * var(--yop-slider-bubble-border) - 2 * var(--yop-slider-thumb-half)) * var(--yop-slider-pos, 0.5));
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-left: 6px solid transparent;
	border-right: 6px solid transparent;
	border-top: 6px solid var(--yop-slider-thumb, #337ab7);
}

/* Slider size */
.yop-poll-slider-wrap--small {
	max-width: 200px;
}

.yop-poll-slider-wrap--medium {
	max-width: 300px;
}

.yop-poll-slider-wrap--large {
	width: 100%;
}

/* A slider's results: the average, then where the answers fell.
 *
 * The average is the headline because it is the one number people quote, and
 * the median sits with it rather than under it -- they answer different
 * questions and a slider is where they part company most often, so showing
 * one without the other hides exactly the case worth seeing. */
.yop-poll-slider-summary__value {
	margin: 0;
	font-size: 2em;
	font-weight: 700;
	line-height: 1.1;
}

.yop-poll-slider-summary__note {
	margin: 2px 0 10px;
	font-size: 0.85em;
	opacity: 0.8;
}

/* Track thickness, which is a different thing from the wrap's width.
 *
 * `--small`/`--medium`/`--large` above cap how wide the whole control is;
 * these set how thick the bar is inside it. The design asks for the second
 * and the first is what was there, so both exist -- and a poll saved before
 * this gets a thickness derived from its size rather than a flat default. */
.yop-poll-slider-wrap--track-thin .yop-poll-slider {
	--yop-slider-height: 4px;
}

.yop-poll-slider-wrap--track-medium .yop-poll-slider {
	--yop-slider-height: 6px;
}

.yop-poll-slider-wrap--track-thick .yop-poll-slider {
	--yop-slider-height: 10px;
}

/* Where the value is shown.
 *
 * Hidden is rendered as nothing at all rather than hidden with CSS: the
 * bubble is positioned over the track and would keep reserving its own space.
 * Under the slider, it stops floating and sits in normal flow, so the row
 * below it moves down once rather than the bubble overlapping the anchors. */
.yop-poll-slider-wrap--value-under .yop-poll-slider-value {
	position: static;
	display: block;
	margin-top: 6px;
	text-align: center;
	transform: none;
}

/* The three anchors under a slider are the rating scales' row, so the rules
   that lay that out reach this too; this only puts it under the track. */
.yop-poll-slider-wrap .yop-poll-scale__ends {
	margin-top: 6px;
}

/* Slider align */
.yop-poll-slider-wrap--left {
	margin-left: 0;
	margin-right: auto;
}

.yop-poll-slider-wrap--center {
	margin-left: auto;
	margin-right: auto;
}

.yop-poll-slider-wrap--right {
	margin-left: auto;
	margin-right: 0;
}

/* Dropdown size/align.

   The same three widths Core's classic sheet gives `.yop-poll-text-input`,
   stated the same way, because Small has to mean one thing: the write-in box
   sits directly under this control and carries a Small of its own. These were
   `200px` and `400px` — a share of the poll against a fixed cap, so a 600px
   poll drew a 200px dropdown over a 300px field and the author had set both
   to Small.

   That is the mistake Core already fixed on its own side, in as many words:
   "They were pixel caps — 160px and 260px against the site's 50% and 75% — so
   a Small write-in previewed at one width and rendered at another." The
   dropdown's copy of it was left standing.

   The character floor is what makes Small usable on a phone and is Core's
   reasoning verbatim; here `ch` is the select's own zero-width, which follows
   the Answers text size the way the rest of this control does. */
.yop-poll-answers--size-small .yop-poll-dropdown {
	width: min(100%, max(50%, 22ch));
}

.yop-poll-answers--size-medium .yop-poll-dropdown {
	width: min(100%, max(75%, 34ch));
}

.yop-poll-answers--size-large .yop-poll-dropdown {
	width: 100%;
}

/* And the narrow half of it, matching the query Core's sheet already runs on
   the field: below 400px of poll every width becomes full width, so the two
   controls do not part company exactly where there is least room for them to.
   `--large` is already full width and needs no saying. */
@container yop-poll (max-width: 400px) {

	.yop-poll-answers--size-small .yop-poll-dropdown,
	.yop-poll-answers--size-medium .yop-poll-dropdown {
		width: 100%;
	}
}

/* Dropdown "other" input: 5px gap (gap: 8px − 3px = 5px) */
.yop-poll-dropdown ~ .yop-poll-other-wrap {
	margin-top: -3px;
}

/* Core's focus ring lists the controls Core owns. The dropdown stops being one
   of them when Core drops its copy of this file's rules, so its ring lives
   here. Same 2px, same offset, same `--yop-focus` Core still emits — and the
   same selector, so while both files carry it the declarations are identical
   and nothing depends on which wins. */
.yop-poll .yop-poll-dropdown:focus-visible {
	outline: 2px solid var(--yop-focus, #0073aa);
	outline-offset: 2px;
}
