/**
 * Entry-point finder — W2 / P-23. Plugin v0.3.2.
 *
 * Tokens only: every colour here is a var(--esls-*) from esls-tokens.css. No hex, no
 * external URL, no font family beyond the three already loaded.
 *
 * THIS FILE CONTAINS NO PERCENT CHARACTER, ANYWHERE. That is not a style preference:
 * §0.2 makes D-8 a payload constraint and §3.12 turns it into a grep — zero percent
 * characters in the rendered output and in every enqueued W2 asset. A stylesheet full
 * of percentage widths makes that check unrunnable, so the widget is laid out with
 * flex, grid, rem, ch and px instead. Where a full-width box is wanted, it is a grid
 * or flex child that stretches, which is what those defaults already do.
 *
 * Section background is cream by convention (C-3). This widget must never sit on
 * blue-800/900: plugin CSS survives deactivation while the widget's markup does not,
 * and a dark section with a vanished widget is a navy void.
 *
 * 320px floor, not 360.
 */

.esls-entry-finder {
	--esls-ef-gap: 24px;
	display: block;
	max-width: var(--esls-container-inner, 1080px);
	margin-inline: auto;
	color: var(--esls-text-primary);
	font-family: "Source Sans 3", system-ui, sans-serif;
}

.esls-entry-finder [hidden] {
	display: none;
}

/* -------------------------------------------------------------------------
   Heading and intro
   ------------------------------------------------------------------------- */

.esls-entry-finder__heading {
	font-family: Fraunces, Georgia, serif;
	font-weight: 600;
	font-size: clamp(1.5rem, 1.15rem + 1.6vw, 2.25rem);
	line-height: 1.2;
	margin: 0 0 12px;
	color: var(--esls-blue-900);
}

.esls-entry-finder__intro {
	font-size: 1.0625rem;
	line-height: 1.6;
	margin: 0 0 var(--esls-ef-gap);
	max-width: 60ch;
	color: var(--esls-text-secondary);
}

/* -------------------------------------------------------------------------
   The question — hidden until the script reveals it (§3.6)
   ------------------------------------------------------------------------- */

.esls-entry-finder__form {
	margin: 0 0 var(--esls-ef-gap);
}

.esls-entry-finder__fieldset {
	display: grid;
	gap: 10px;
	margin: 0;
	padding: 0;
	border: 0;
}

.esls-entry-finder__question {
	font-family: Fraunces, Georgia, serif;
	font-weight: 600;
	font-size: 1.1875rem;
	line-height: 1.3;
	color: var(--esls-blue-900);
	margin: 0 0 6px;
	padding: 0;
}

.esls-entry-finder__question:focus-visible {
	outline: 2px solid var(--esls-blue-600);
	outline-offset: 3px;
}

/* Full-width option cards. The label carries the padding and the border, so the whole
   card is the hit target; the radio is positioned over it rather than beside it. */

.esls-entry-finder__option {
	position: relative;
	display: block;
}

.esls-entry-finder__option input[type="radio"] {
	position: absolute;
	inset-inline-start: 16px;
	inset-block-start: 19px;
	z-index: 1;
	margin: 0;
	inline-size: 18px;
	block-size: 18px;
	accent-color: var(--esls-orange-600);
}

.esls-entry-finder__option label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-height: 44px;
	padding: 14px 16px 14px 46px;
	border: 1px solid var(--esls-border-warm);
	border-radius: 10px;
	background-color: var(--esls-cream-primary);
	cursor: pointer;
}

.esls-entry-finder__option label:hover {
	border-color: var(--esls-blue-300);
}

/* Selection is signalled by the border and an inset rule, never by a background swap:
   the examples line is measured for contrast against cream, and recolouring the card
   underneath it would quietly invalidate that measurement. */
.esls-entry-finder__option input[type="radio"]:checked + label {
	border-color: var(--esls-orange-400);
	box-shadow: inset 3px 0 0 0 var(--esls-orange-400);
}

.esls-entry-finder__option input[type="radio"]:focus-visible + label {
	outline: 2px solid var(--esls-blue-600);
	outline-offset: 2px;
}

.esls-entry-finder__option-label {
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1.35;
	color: var(--esls-text-primary);
}

/* 13px on cream measures 4.96:1 against cream-primary and 4.50:1 against cream-alt.
   Do not add an opacity here — opacity is part of the measured contrast, and these
   two figures have no headroom left to spend. */
.esls-entry-finder__option-examples {
	font-size: 0.8125rem;
	line-height: 1.5;
	color: var(--esls-text-tertiary);
}

/* -------------------------------------------------------------------------
   Outcome

   The live region itself carries no box. Before an answer it is empty, and an empty
   bordered card sitting under the question would be a promise the page has not kept
   yet. The card is on the outcome, which only exists once there is one.
   ------------------------------------------------------------------------- */

.esls-entry-finder__result {
	display: block;
	margin: 0 0 var(--esls-ef-gap);
}

.esls-entry-finder__result:focus-visible {
	outline: 2px solid var(--esls-blue-600);
	outline-offset: 4px;
}

.esls-entry-finder__outcome {
	display: block;
	padding: 24px;
	border: 1px solid var(--esls-border-warm);
	border-radius: 10px;
	background-color: var(--esls-cream-alt);
}

.esls-entry-finder__result-start {
	font-family: Fraunces, Georgia, serif;
	font-weight: 600;
	font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.75rem);
	line-height: 1.25;
	margin: 0;
	color: var(--esls-blue-900);
}

.esls-entry-finder__result-credential,
.esls-entry-finder__result-time {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 10px;
	margin: 12px 0 0;
}

.esls-entry-finder__result-credential-label,
.esls-entry-finder__result-time-label {
	font-size: 0.8125rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--esls-text-tertiary);
}

.esls-entry-finder__result-credential-value {
	font-size: 0.9375rem;
	line-height: 1.45;
	color: var(--esls-text-secondary);
}

.esls-entry-finder__result-time-value {
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.4;
	color: var(--esls-text-primary);
}

.esls-entry-finder__result-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	margin-top: 20px;
	padding: 10px 22px;
	border-radius: 8px;
	background-color: var(--esls-orange-400);
	color: var(--esls-blue-900);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
}

.esls-entry-finder__result-cta:hover,
.esls-entry-finder__result-cta:focus {
	background-color: var(--esls-orange-300);
	color: var(--esls-blue-900);
}

.esls-entry-finder__result-cta:focus-visible {
	outline: 2px solid var(--esls-blue-600);
	outline-offset: 2px;
}

.esls-entry-finder__restart {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	margin-top: 14px;
	padding: 8px 16px;
	border: 1px solid var(--esls-border-warm);
	border-radius: 8px;
	background-color: transparent;
	color: var(--esls-text-secondary);
	font-family: inherit;
	font-size: 0.9375rem;
	cursor: pointer;
}

.esls-entry-finder__restart:hover {
	border-color: var(--esls-blue-300);
	color: var(--esls-text-primary);
}

.esls-entry-finder__restart:focus-visible {
	outline: 2px solid var(--esls-blue-600);
	outline-offset: 2px;
}

/* -------------------------------------------------------------------------
   The matrix
   ------------------------------------------------------------------------- */

.esls-entry-finder__matrix-wrap {
	border-top: 1px solid var(--esls-border-warm);
	padding-top: 16px;
}

.esls-entry-finder__matrix-wrap > summary {
	display: list-item;
	min-height: 44px;
	padding: 10px 0;
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--esls-blue-600);
	cursor: pointer;
}

.esls-entry-finder__matrix-wrap > summary:focus-visible {
	outline: 2px solid var(--esls-blue-600);
	outline-offset: 2px;
}

/* One rule for table overflow across the phase: a horizontal scroll region, never a
   CSS-only stack. The grid display is what stretches the table to the region width
   without a percentage. */
.esls-entry-finder__scroll {
	display: grid;
	overflow-x: auto;
	margin-top: 8px;
	-webkit-overflow-scrolling: touch;
}

.esls-entry-finder__scroll:focus-visible {
	outline: 2px solid var(--esls-blue-600);
	outline-offset: 2px;
}

.esls-entry-finder__matrix {
	border-collapse: collapse;
	min-width: 640px;
	font-size: 0.9375rem;
	line-height: 1.5;
	text-align: start;
}

.esls-entry-finder__matrix caption {
	margin-bottom: 10px;
	color: var(--esls-text-secondary);
	font-size: 0.875rem;
	line-height: 1.5;
	text-align: start;
}

.esls-entry-finder__matrix th,
.esls-entry-finder__matrix td {
	padding: 12px 16px 12px 0;
	border-bottom: 1px solid var(--esls-border-warm);
	text-align: start;
	vertical-align: top;
}

.esls-entry-finder__matrix thead th {
	font-size: 0.8125rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--esls-text-tertiary);
	white-space: nowrap;
}

.esls-entry-finder__matrix tbody th {
	font-weight: 400;
	color: var(--esls-text-secondary);
	max-width: 46ch;
}

.esls-entry-finder__matrix tbody td {
	font-weight: 600;
	color: var(--esls-text-primary);
}

/* Only the duration column resists wrapping. Row 5's "Start at" cell is a whole
   sentence, and holding that on one line pushed the table wider than the region it
   sits in — a three-pixel scrollbar at desktop that reads as a defect. */
.esls-entry-finder__matrix tbody td:last-child {
	white-space: nowrap;
}

.esls-entry-finder__matrix tbody td:first-of-type {
	max-width: 24ch;
}

/* -------------------------------------------------------------------------
   Motion
   ------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.esls-entry-finder * {
		transition: none;
		animation: none;
	}
}
