/**
 * Bako Boat Tickets — Park Entry island styles.
 *
 * Target: the Stitch `booking_checkout` mockup (`stitch_bako_boat_tickets_home/
 * booking_checkout/{code.html,screen.png}`) — white rounded cards, chip-style choices,
 * a soft-yellow warning banner, and a divided breakdown panel echoing its Booking Summary.
 *
 * SCOPING RULE (spec §8): every selector begins with `.bbt-pe-`. Nothing here may leak into
 * the rest of the Gravity Form. Enforced by `tools/tests/test-assets.php`.
 *
 * NO-JS RULE (spec §6.7): `.bbt-qty-field` is deliberately NOT styled. The island adds
 * `.bbt-pe-hidden-product` at runtime, so without JavaScript the eight product quantity
 * boxes stay visible and the form still prices correctly.
 *
 * CONTRAST (spec §8 requires WCAG AA). The mockup's primary `#2b9dee` reaches only
 * **2.93:1** against white — it fails AA for text and fails the 3:1 minimum for focus
 * indicators. It is therefore used as an accent (chip borders, card accents) and never
 * behind white text. Filled buttons and focus rings use `--bbt-pe-primary-strong` #1273b8
 * (5.04:1). `#94a3b8` (2.56:1) is restricted to borders and placeholders; secondary text
 * uses `#64748b` (4.76:1). Measured pairs:
 *
 *   #fff on #1273b8 ......... 5.04:1  buttons
 *   #101a22 on #fff ........ 17.60:1  body text
 *   #64748b on #fff ......... 4.76:1  notes, secondary labels
 *   #b42318 on #fff ......... 6.57:1  error text
 *   #b54708 on #fffaeb ...... 5.20:1  warning banner
 *
 * @package BakoBoatTickets
 */

/* ================================================================
 * Plus Jakarta Sans — self-hosted (spec §8: no Google Fonts CDN).
 * Applied inside the island only; falls back to the theme's sans stack.
 * ================================================================ */

@font-face {
	font-family: 'Plus Jakarta Sans';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('../fonts/plus-jakarta-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
	font-family: 'Plus Jakarta Sans';
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url('../fonts/plus-jakarta-sans-latin-500-normal.woff2') format('woff2');
}
@font-face {
	font-family: 'Plus Jakarta Sans';
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url('../fonts/plus-jakarta-sans-latin-600-normal.woff2') format('woff2');
}
@font-face {
	font-family: 'Plus Jakarta Sans';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('../fonts/plus-jakarta-sans-latin-700-normal.woff2') format('woff2');
}

/* ================================================================
 * The eight park-entry products: present in the DOM (they are the pricing engine),
 * removed from view. The class is added by hideProductFields() at runtime.
 *
 * **NEVER `display: none`** (drift D-4). Gravity Forms decides whether a product counts
 * towards the total with:
 *
 *     gformIsHidden( el ) => el.parents('.gfield').not('.gfield_hidden_product').css('display') == 'none'
 *
 * and `gformGetProductQuantity()` returns **0** for a hidden product. A `display:none`
 * wrapper would therefore zero every park-entry quantity in the on-screen Payable Amount,
 * while the server still charged the customer correctly — they would see one number and be
 * billed another.
 *
 * So we hide exactly the way GF hides its own `visibility: hidden` fields: parked offscreen,
 * `display` untouched. The island additionally adds GF's `gfield_hidden_product` class, which
 * `gformIsHidden()` explicitly excludes. Belt and braces.
 * ================================================================ */

.bbt-pe-hidden-product {
	left: -9999px !important;
	position: absolute !important;
	visibility: hidden !important;
}

/* ================================================================
 * Island root
 * ================================================================ */

.bbt-pe-app {
	--bbt-pe-primary: #2b9dee;
	--bbt-pe-primary-strong: #1273b8;
	--bbt-pe-primary-soft: #eaf5fd;
	--bbt-pe-ink: #101a22;
	--bbt-pe-secondary: #64748b;
	--bbt-pe-muted: #94a3b8;
	--bbt-pe-border: #cbd5e1;
	--bbt-pe-surface: #f6f7f8;
	--bbt-pe-error: #b42318;
	--bbt-pe-error-soft: #fef3f2;
	--bbt-pe-warn: #b54708;
	--bbt-pe-warn-soft: #fffaeb;
	--bbt-pe-warn-border: #f0d98c;
	--bbt-pe-radius: 12px;

	box-sizing: border-box;
	color: var(--bbt-pe-ink);
	font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	margin: 20px 0;
}

.bbt-pe-app *,
.bbt-pe-app *::before,
.bbt-pe-app *::after {
	box-sizing: inherit;
}

.bbt-pe-shell {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* A single, consistent focus treatment. 2px of #1273b8 clears the 3:1 that WCAG 2.2
 * SC 1.4.11 asks of a focus indicator; the mockup's #2b9dee would not. */
.bbt-pe-app :focus-visible {
	outline: 2px solid var(--bbt-pe-primary-strong);
	outline-offset: 2px;
	border-radius: 4px;
}

/* ================================================================
 * Visitor card
 * ================================================================ */

.bbt-pe-card {
	background: #fff;
	border: 1px solid var(--bbt-pe-border);
	border-radius: var(--bbt-pe-radius);
	box-shadow: 0 1px 2px rgba(16, 26, 34, 0.04);
	margin: 0;
	padding: 16px 18px 18px;
	min-width: 0; /* let a fieldset shrink inside a flex column */
}

/* The card is a role="group" labelled by this heading, so assistive tech announces it as
 * "Visitor 2 — Malaysian Adult" rather than a pile of unrelated inputs. (A <fieldset> with
 * a <legend> would say the same thing, but a legend punches a gap through the fieldset's
 * top border, and the usual `float` workaround collapses the card body on narrow
 * viewports.) */
.bbt-pe-card-head {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	width: 100%;
}

.bbt-pe-card-title {
	flex: 1 1 auto;
	font-size: 16px;
	font-weight: 700;
	min-width: 0;
}

.bbt-pe-chip {
	background: var(--bbt-pe-primary-soft);
	border-radius: 999px;
	color: var(--bbt-pe-primary-strong);
	font-size: 13px;
	font-weight: 600;
	padding: 4px 12px;
	white-space: nowrap;
}

.bbt-pe-remove {
	align-items: center;
	background: transparent;
	border: 1px solid var(--bbt-pe-border);
	border-radius: 8px;
	color: var(--bbt-pe-secondary);
	cursor: pointer;
	display: inline-flex;
	font-size: 16px;
	height: 44px;
	justify-content: center;
	line-height: 1;
	width: 44px;
}

.bbt-pe-remove:hover {
	background: var(--bbt-pe-error-soft);
	border-color: var(--bbt-pe-error);
	color: var(--bbt-pe-error);
}

/* ================================================================
 * Fields
 * ================================================================ */

.bbt-pe-grid {
	display: grid;
	gap: 14px 16px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin-top: 14px;
}

.bbt-pe-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.bbt-pe-field label,
.bbt-pe-label {
	color: var(--bbt-pe-secondary);
	font-size: 13px;
	font-weight: 500;
}

.bbt-pe-field input[type='text'],
.bbt-pe-field input[type='tel'],
.bbt-pe-field input[type='number'],
.bbt-pe-field select {
	background: #fff;
	border: 1px solid var(--bbt-pe-border);
	border-radius: 8px;
	color: var(--bbt-pe-ink);
	font: inherit;
	min-height: 44px; /* touch target */
	padding: 10px 12px;
	width: 100%;
}

.bbt-pe-field input::placeholder {
	color: var(--bbt-pe-muted);
}

.bbt-pe-field input:focus,
.bbt-pe-field select:focus {
	border-color: var(--bbt-pe-primary);
}

.bbt-pe-field input[aria-invalid='true'],
.bbt-pe-field select[aria-invalid='true'] {
	background: var(--bbt-pe-error-soft);
	border-color: var(--bbt-pe-error);
}

.bbt-pe-error {
	color: var(--bbt-pe-error);
	font-size: 13px;
	font-weight: 500;
}

/* Gender: chip-style radios, per the mockup's departure-time chips. */
.bbt-pe-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.bbt-pe-chip-radio {
	cursor: pointer;
	position: relative;
}

.bbt-pe-chip-radio input {
	position: absolute;
	opacity: 0;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: pointer;
}

.bbt-pe-chip-radio span {
	align-items: center;
	background: #fff;
	border: 1px solid var(--bbt-pe-border);
	border-radius: 8px;
	color: var(--bbt-pe-ink);
	display: inline-flex;
	font-size: 14px;
	font-weight: 500;
	justify-content: center;
	min-height: 44px;
	min-width: 84px;
	padding: 0 16px;
}

.bbt-pe-chip-radio input:checked + span {
	background: var(--bbt-pe-primary-soft);
	border-color: var(--bbt-pe-primary);
	color: var(--bbt-pe-primary-strong);
	font-weight: 600;
}

.bbt-pe-chip-radio input:focus-visible + span {
	outline: 2px solid var(--bbt-pe-primary-strong);
	outline-offset: 2px;
}

/* Checkboxes */
.bbt-pe-checks {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 14px;
}

.bbt-pe-check {
	align-items: center;
	cursor: pointer;
	display: flex;
	gap: 10px;
	min-height: 44px;
}

.bbt-pe-check input {
	accent-color: var(--bbt-pe-primary-strong);
	height: 20px;
	margin: 0;
	width: 20px;
}

.bbt-pe-check span {
	font-size: 14px;
}

/* ================================================================
 * Actions and breakdown
 * ================================================================ */

.bbt-pe-add {
	align-self: flex-start;
	background: var(--bbt-pe-primary-strong);
	border: 0;
	border-radius: 8px;
	color: #fff;
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	min-height: 44px;
	padding: 10px 20px;
}

.bbt-pe-add:hover:not(:disabled) {
	background: #0f6199;
}

.bbt-pe-add:disabled {
	background: var(--bbt-pe-muted);
	cursor: not-allowed;
}

/* §6.8: the two add buttons sit side by side, wrapping on narrow widths. */
.bbt-pe-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

/* Secondary action — outline style. #1273b8 on white measures 5.04:1 (AA). */
.bbt-pe-add-lead {
	background: #fff;
	border: 1px solid var(--bbt-pe-primary-strong);
	border-radius: 8px;
	color: var(--bbt-pe-primary-strong);
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	min-height: 44px;
	padding: 10px 20px;
}

.bbt-pe-add-lead:hover:not(:disabled) {
	background: var(--bbt-pe-primary-soft);
}

.bbt-pe-add-lead:disabled {
	border-color: var(--bbt-pe-border);
	color: var(--bbt-pe-muted);
	cursor: not-allowed;
}

.bbt-pe-note {
	color: var(--bbt-pe-secondary);
	font-size: 13px;
	margin: 0;
}

.bbt-pe-breakdown {
	background: #fff;
	border: 1px solid var(--bbt-pe-border);
	border-radius: var(--bbt-pe-radius);
	box-shadow: 0 1px 2px rgba(16, 26, 34, 0.04);
	padding: 6px 18px 16px;
}

.bbt-pe-breakdown-row {
	border-bottom: 1px solid var(--bbt-pe-surface);
	display: flex;
	gap: 16px;
	justify-content: space-between;
	padding: 12px 0;
}

/* The left cell is the product label, which an admin can rename to anything (§2.2). Let it wrap
 * rather than force the row wider than the card — a flex item's default minimum size is its
 * longest word, so one long unbreakable word would otherwise overflow the card on a phone. The
 * amount on the right keeps its single line. */
.bbt-pe-breakdown-row > span:first-child {
	min-width: 0;
	overflow-wrap: anywhere;
}

.bbt-pe-breakdown-total {
	border-bottom: 0;
	font-size: 17px;
	font-weight: 700;
	padding-bottom: 6px;
}

.bbt-pe-breakdown-total span:last-child {
	color: var(--bbt-pe-primary-strong);
}

.bbt-pe-breakdown .bbt-pe-note {
	margin-top: 6px;
}

/* ================================================================
 * Banners
 * ================================================================ */

.bbt-pe-banner {
	border-radius: var(--bbt-pe-radius);
	padding: 14px 16px;
}

.bbt-pe-banner p {
	margin: 0;
}

.bbt-pe-banner ul {
	margin: 8px 0 0;
	padding-left: 20px;
}

.bbt-pe-banner-error {
	background: var(--bbt-pe-error-soft);
	border: 1px solid var(--bbt-pe-error);
	color: var(--bbt-pe-error);
	font-weight: 500;
}

/* The mockup's Low Tide Warning, reused for the seat/visitor mismatch (D9). */
.bbt-pe-banner-warning {
	background: var(--bbt-pe-warn-soft);
	border: 1px solid var(--bbt-pe-warn-border);
	color: var(--bbt-pe-warn);
}

.bbt-pe-continue {
	background: transparent;
	border: 1px solid var(--bbt-pe-warn);
	border-radius: 8px;
	color: var(--bbt-pe-warn);
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	margin-top: 10px;
	min-height: 44px;
	padding: 8px 18px;
}

.bbt-pe-continue:hover {
	background: var(--bbt-pe-warn);
	color: #fff;
}

/* ================================================================
 * Responsive: two-column rows collapse below ~640px (spec §8)
 * ================================================================ */

@media (max-width: 640px) {
	.bbt-pe-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.bbt-pe-card {
		padding: 14px;
	}

	.bbt-pe-card-title {
		flex-basis: 100%;
		order: -1;
	}

	.bbt-pe-chip-radio span {
		min-width: 0;
		width: 100%;
	}

	.bbt-pe-chip-radio {
		flex: 1 1 0;
	}

	.bbt-pe-add {
		align-self: stretch;
		text-align: center;
	}

	.bbt-pe-actions {
		flex-direction: column;
	}

	.bbt-pe-actions .bbt-pe-add,
	.bbt-pe-actions .bbt-pe-add-lead {
		text-align: center;
		width: 100%;
	}
}

/* Respect a user's motion preference — the island scrolls to the first error. */
@media (prefers-reduced-motion: reduce) {
	.bbt-pe-app * {
		scroll-behavior: auto !important;
	}
}

/* ================================================================
 * Gravity Forms 3.0 + dark-container (UAGB) compatibility
 *
 * The live booking page (GF upgraded 2.10.5 -> 3.0.2) wraps the form in a dark
 * Ultimate-Addons container whose `.wp-block-uagb-container....container *` rule
 * (specificity 0,3,0) paints `color: #fff` onto every descendant; GF 3.0 also
 * turned `.gform_fields` into a 12-column grid and forces `opacity: 1` on inputs.
 * None of this existed under 2.10.5, so the light-card island rendered
 * white-on-white and at a fraction of its width.
 *
 * These rules re-assert the island's own palette and layout. They win by
 * SPECIFICITY alone (`.bbt-pe-app` repeated to clear the 0,3,0 container rule),
 * so the `!important` budget stays at four (test-assets.php pins it).
 * ================================================================ */

/* The injected island div is not a `.gfield`; give it the full grid row. */
.bbt-pe-app.bbt-pe-app {
	grid-column: 1 / -1;
}

/* Re-assert the text colours the dark container washed to white. */
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-card-title,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-field input,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-field select,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-chip-radio span,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-check span,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-breakdown,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-breakdown span {
	color: var(--bbt-pe-ink);
}
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-field label,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-label,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-note,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-remove {
	color: var(--bbt-pe-secondary);
}
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-chip,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-chip-radio input:checked + span,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-breakdown-total span:last-child {
	color: var(--bbt-pe-primary-strong);
}
/* Banner text sits in child <p>/<li> elements, which the dark container's `*` rule
 * colours white DIRECTLY — beating anything the banner itself inherits down. So the
 * children need their own rules; the Continue button is deliberately excluded (it
 * carries its own colours, including a white :hover). */
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-error,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-banner-error,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-banner-error p,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-banner-error li {
	color: var(--bbt-pe-error);
}
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-banner-warning,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-banner-warning p,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-continue {
	color: var(--bbt-pe-warn);
}

/* GF 3.0 forces `opacity: 1` on form inputs; re-hide the chip-radio's native
 * control so its pill <span> stays the only visible affordance. */
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-chip-radio input {
	opacity: 0;
}

/* Native <select> options: the dark container whitens them too, so the open
 * dropdown list renders white-on-white. Force the island's ink on white. */
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-field option {
	background-color: #fff;
	color: var(--bbt-pe-ink);
}

/* GF 3.x swaps the select caret per state (base/hover/focus) with image-only rules.
 * Our `background: #fff` shorthand beats the base rule (killing repeat/size/position),
 * but the state rules' lone background-image slips past it — and the 10x6 chevron then
 * TILES into a woven zig-zag across the whole control. Pin every background longhand in
 * every state and draw our own caret (the shorthand had left selects caret-less anyway).
 * The caret is decorative, drawn in --bbt-pe-secondary to match the labels. */
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-field select,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-field select:hover,
.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-field select:focus {
	appearance: none;
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
	background-position: right 12px center;
	background-repeat: no-repeat;
	background-size: 16px 16px;
	padding-right: 36px;
}

/* GF 3.x's theme framework styles EVERY <button> inside .gform_wrapper —
 * `.gform-theme.gform-theme--framework.gform_wrapper :where(…)>button:not([id*=mceu_]):not(.mce-open)`,
 * specificity (0,5,1) — and pins a 38px block-size with zero block padding. Measured live on
 * GF 3.1.1 at 390px: every island button 38px, under the 44px touch target (runbook 04 Q2).
 * Six classes (0,6,0) out-specify it. Both the physical and the logical properties are set
 * because GF writes the logical ones, and the later declaration of an alias pair wins. */
.bbt-pe-app.bbt-pe-app.bbt-pe-app.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-add,
.bbt-pe-app.bbt-pe-app.bbt-pe-app.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-add-lead,
.bbt-pe-app.bbt-pe-app.bbt-pe-app.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-continue {
	block-size: auto;
	height: auto;
	line-height: 1.3;
	min-block-size: 44px;
	min-height: 44px;
	padding-block: 10px;
}
.bbt-pe-app.bbt-pe-app.bbt-pe-app.bbt-pe-app.bbt-pe-app.bbt-pe-app .bbt-pe-remove {
	block-size: 44px;
	height: 44px;
	inline-size: 44px;
	min-block-size: 44px;
	min-height: 44px;
	padding: 0;
	width: 44px;
}
