/**
 * Penta Polls - front end.
 *
 * Deliberately plain: colours and fonts come from the theme, and anything a
 * theme may want to change is a CSS variable. Override those in your theme
 * rather than editing this file, so plugin updates keep working.
 *
 *   .penta-poll { --penta-poll-accent: #d73c29; --penta-poll-fill: #f4e3e0; }
 */

.penta-poll {
	--penta-poll-accent: currentColor;
	--penta-poll-line: rgba(0, 0, 0, .12);
	--penta-poll-fill: rgba(0, 0, 0, .07);
	--penta-poll-chosen: rgba(0, 0, 0, .14);
	--penta-poll-radius: 0px;
	--penta-poll-gap: 10px;
	max-width: 34rem;
}

.penta-poll-question { margin: 0 0 .5em; }
.penta-poll-intro { margin: 0 0 1em; opacity: .8; }
.penta-poll-closed-note { font-size: .9em; opacity: .75; }

.penta-poll-options { display: grid; gap: var(--penta-poll-gap); margin: 0; }

.penta-poll-option {
	position: relative;
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	border: 1px solid var(--penta-poll-line);
	border-radius: var(--penta-poll-radius);
	cursor: pointer;
	overflow: hidden;
	transition: border-color .2s ease, background-color .2s ease;
}
.penta-poll-option:hover { border-color: var(--penta-poll-chosen); }
.penta-poll-option:focus-within { outline: 2px solid var(--penta-poll-accent); outline-offset: 2px; }
.penta-poll.is-closed .penta-poll-option,
.penta-poll-results-only .penta-poll-option { cursor: default; }

/* the radio itself is hidden but still focusable and announced */
.penta-poll-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.penta-poll-mark {
	width: 16px; height: 16px; border-radius: 50%;
	border: 1px solid var(--penta-poll-chosen);
	flex: none; position: relative; z-index: 1;
	transition: background-color .2s ease, box-shadow .2s ease;
}
.penta-poll-option.is-chosen .penta-poll-mark {
	background: var(--penta-poll-accent);
	box-shadow: inset 0 0 0 3px #fff;
}

.penta-poll-label { position: relative; z-index: 1; }

.penta-poll-percent {
	position: relative; z-index: 1;
	font-variant-numeric: tabular-nums;
	opacity: 0;
	transition: opacity .3s ease;
}

/* the result bar sits behind the answer, revealed once a vote is in */
.penta-poll-bar {
	position: absolute; inset: 0; z-index: 0;
	pointer-events: none;
	opacity: 0;
	transition: opacity .3s ease;
}
.penta-poll-fill {
	display: block; height: 100%; width: 0;
	background: var(--penta-poll-fill);
	transition: width .6s cubic-bezier(.22, 1, .36, 1);
}
.penta-poll-option.is-chosen .penta-poll-fill { background: var(--penta-poll-chosen); }

.penta-poll.has-voted .penta-poll-bar,
.penta-poll.is-closed .penta-poll-bar,
.penta-poll-results-only .penta-poll-bar { opacity: 1; }
.penta-poll.has-voted .penta-poll-percent,
.penta-poll.is-closed .penta-poll-percent,
.penta-poll-results-only .penta-poll-percent { opacity: .85; }

.penta-poll-note { min-height: 1.4em; margin: .8em 0 0; font-size: .92em; opacity: .85; }
.penta-poll-total { margin: .4em 0 0; font-size: .92em; opacity: .8; }
.penta-poll-count { font-weight: 700; }

.penta-poll.is-saving { pointer-events: none; opacity: .75; }
.penta-poll-submit { justify-self: start; margin-top: 10px; }
.penta-poll-missing { padding: 12px; border: 1px dashed currentColor; opacity: .7; }

@media (prefers-reduced-motion: reduce) {
	.penta-poll-option,
	.penta-poll-bar,
	.penta-poll-fill,
	.penta-poll-percent,
	.penta-poll-mark { transition: none; }
}

/* 1.1: tip, button and lead box after voting ----------------------------- */
.penta-poll-followup, .penta-poll-lead { margin-top: 14px; }
.penta-poll-followup.is-in, .penta-poll-lead.is-in { animation: penta-poll-in .45s cubic-bezier(.22, 1, .36, 1); }
@keyframes penta-poll-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.penta-poll-tip { margin: 0 0 10px; }
.penta-poll-cta { display: inline-block; padding: 10px 16px; border: 1px solid var(--penta-poll-accent); border-radius: var(--penta-poll-radius); color: inherit; text-decoration: none; font-weight: 600; }
.penta-poll-lead { padding-top: 14px; border-top: 1px solid var(--penta-poll-line); }
.penta-poll-lead-heading { margin: 0 0 4px; font-weight: 700; }
.penta-poll-lead-text { margin: 0 0 10px; opacity: .8; font-size: .95em; }
.penta-poll-lead-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.penta-poll-lead-field { display: grid; gap: 4px; font-size: .88em; }
.penta-poll-lead-field input { width: 100%; padding: 10px 12px; border: 1px solid var(--penta-poll-line); border-radius: var(--penta-poll-radius); font: inherit; font-size: 1rem; background: transparent; color: inherit; }
.penta-poll-lead-consent { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; font-size: .88em; }
.penta-poll-lead-consent input { margin-top: 3px; }
.penta-poll-lead-submit { padding: 11px 18px; border: 0; border-radius: var(--penta-poll-radius); background: var(--penta-poll-accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.penta-poll-lead-submit[disabled] { opacity: .6; cursor: default; }
.penta-poll-lead-status { min-height: 1.2em; margin: 8px 0 0; font-size: .88em; }
.penta-poll-lead.has-error .penta-poll-lead-status { color: #c0392b; }
.penta-poll-lead-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.penta-poll-lead-done { margin: 14px 0 0; font-weight: 600; }
.penta-poll [hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { .penta-poll-followup.is-in, .penta-poll-lead.is-in { animation: none; } }
