/* sst-consent-all r1 — the "Agree to all" row and the folded state.
 *
 * DESIGN RULE: this file adds as little as it can get away with. The row itself is built
 * from `p.sst-check > label.sst-check__label > .sst-check__input + .sst-check__box +
 * .sst-check__text`, the anatomy `sst-checkout-ab/templates/checkout/terms.php` ships, so
 * variant A (variant-a.css:966-1014, 3599-3625), variant B (variant-b.css:2456-2552) and
 * variant C (variant-c.css:2725-2848) all draw it in their own skin for free. What is left
 * here is: the fold, the disclosure button, one weight bump, and two repairs to variant A.
 *
 * Enqueued after `sst-co-ab-variant` (dependency declared in PHP when that handle exists),
 * so a plain tie on specificity resolves in this file's favour — but nothing here relies on
 * that; every rule that has to beat a skin says so and out-specifies it.
 */

/* ---------------------------------------------------------------- 1. the fold
 *
 * `!important` is load-bearing and is the only one in the file. The skins set
 * `display:block` on consent rows at (0,4,1) — `variant-a.css:3452`,
 * `variant-b.css:2456`, `variant-c.css:2725` — which beats the UA sheet's
 * `[hidden]{display:none}` at (0,0,0). Only variant A ships a scope-wide
 * `[hidden]{display:none!important}` (variant-a.css:281); B and C do not, so without this
 * rule a folded row would still be on screen in two arms out of three.
 *
 * The `hidden` ATTRIBUTE is set as well as this class, deliberately:
 * `checkout-ab.js:79-86` `isBlocking()` reads `hidden`, and `sst-paypal-buttons-r4.js:119`
 * `isVisible()` reads geometry. Both must agree with the screen, and they only ever see a
 * folded row when it is already ticked (see the invariant in the JS header). */
.sst-cnsa-hidden[hidden] {
	display: none !important;
}

/* ---------------------------------------------------------------- 2. the master row */

/* The row is the summary of everything under it, so it carries a little more weight than a
 * normal consent line. Specificity arithmetic: variant A's `.sst-check__text` rule
 * (variant-a.css:3618) is `body.sst-co-ab.sst-co-v-a .sst-consent__boxes .sst-check__text`
 * = (0,4,1) and variant B's (2501) is (0,3,1). The selector below is (0,5,1), so it wins in
 * every arm without an `!important`. The bare rule after it covers the no-A/B fallback. */
.sst-cnsa__text {
	font-weight: 650;
}
body .sst-consent .sst-consent__boxes .sst-cnsa .sst-check__text.sst-cnsa__text {
	font-weight: 650;
}

/* The disclosure. A real <button type=button> so Enter and Space work and nothing submits.
 * Block-level so it clears variant B's floated `.sst-check__box`, which is contained by the
 * label's `display:flow-root` (variant-b.css:2491) and would otherwise sit beside it. */
.sst-cnsa__toggle {
	display: inline-block;
	/* Measured at 390px: the theme's `button` rule applies `min-height:40px` and
	 * `border-radius:6px` to this element and outranks a single class. Rather than fight it,
	 * both are restated here so the touch target is a decision and not an accident — 40px is
	 * comfortably above the 24px minimum (WCAG 2.5.8) and the underlined 13px label centres
	 * inside it. The top margin is 2px, not 10px, because 11px of that 40 is already blank
	 * space above the text. */
	min-height: 40px;
	margin: 2px 0 0;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: none;
	font: inherit;
	font-size: 13px;
	line-height: 1.4;
	color: var( --co-mute, #5f6570 );
	text-decoration: underline;
	text-underline-offset: 3px;
	text-align: left;
	cursor: pointer;
}
.sst-cnsa__toggle:hover {
	color: var( --co-ink, #121212 );
}
/* The skins put their focus ring on `.sst-check__box`, which this button does not have. */
.sst-cnsa__toggle:focus-visible {
	outline: 2px solid var( --co-ink, #121212 );
	outline-offset: 2px;
}
.sst-cnsa__toggle[hidden] {
	display: none !important;
}

/* ---------------------------------------------------------------- 3. variant A repairs
 *
 * Variant A draws the consent list as hairline-separated bands and resets the FIRST band:
 *
 *   variant-a.css:3448  .sst-consent__boxes > * + *            { padding-top: 14px }
 *   variant-a.css:3452  .sst-consent__boxes > .form-row, > .sst-check, > .sst-preorder-…,
 *                       > .sst-discounted-…, > .sst-forecast-…,
 *                       .sst-consent__terms > .form-row        { border-top: 1px solid … }
 *   variant-a.css:3467  .sst-consent__boxes > *:first-child,
 *                       .sst-consent__terms:first-child > .form-row:first-of-type
 *                                                              { border-top:0; padding-top:0 }
 *
 * Inserting the master row as the first child moves `:first-child` onto it (correct — it
 * should have no rule above it) but breaks the terms block two ways:
 *   (a) `.sst-consent__terms` gains `padding-top:14px` from :3448 and is NOT in the type
 *       list at :3452, so it gets a 14px gap with no hairline in it;
 *   (b) `.sst-consent__terms:first-child > …` stops matching, so the terms tick row falls
 *       through to `.sst-consent__terms > .form-row` (:3457) and gains a SECOND 14px gap
 *       plus a second hairline, indented one level in.
 * Both are repaired here, only for the adjacency the master row actually creates.
 * (0,5,1) and (0,7,1) respectively, against the skin's (0,3,1)/(0,4,1). */
body.sst-co-ab.sst-co-v-a .sst-consent__boxes > .sst-cnsa + .sst-consent__terms {
	border-top: 1px solid var( --co-rule );
}
body.sst-co-ab.sst-co-v-a .sst-consent__boxes > .sst-cnsa + .sst-consent__terms > .form-row:first-of-type {
	border-top: 0;
	padding-top: 0;
}
/* Variant A's `> .sst-check` band rule (:3453) matches the master row too; `:first-child`
 * (:3467) already zeroes its border and padding, so nothing more is needed there. */

/* ---------------------------------------------------------------- 4. variant B / C nudges
 *
 * B draws every consent row as a soft card (`variant-b.css:2456`, matched via the bare
 * `.sst-check` selector, so the master row gets it at any depth) and C as a soft box
 * (`variant-c.css:2725`, matched by `p.sst-check`). Both already look right. The only
 * adjustment is the gap under the master row: B's own `margin:0 0 10px` and C's
 * `margin:12px 0 0` on the FOLLOWING row are enough, so nothing is set here — deliberately.
 *
 * C's first row would otherwise sit 12px below the title; with the master row in front the
 * spacing is unchanged, because C spaces rows by top margin. */

/* ---------------------------------------------------------------- 5. no-A/B fallback
 * If `sst-checkout-ab` is not rendering (control arm, plugin disabled, preview off) there is
 * no `.sst-consent__boxes` and no skin CSS at all; the JS falls back to the stock
 * `.form-row.place-order` container. Give the row the bare minimum so it is legible. */
body:not( .sst-co-ab ) .sst-cnsa {
	margin: 0 0 12px;
}
body:not( .sst-co-ab ) .sst-cnsa__label {
	display: block;
	position: relative;
	padding-left: 32px;
	cursor: pointer;
	line-height: 1.5;
}
body:not( .sst-co-ab ) .sst-cnsa .sst-check__input {
	position: absolute;
	left: 0;
	top: 2px;
	width: 20px;
	height: 20px;
	margin: 0;
	opacity: 1;
}
body:not( .sst-co-ab ) .sst-cnsa .sst-check__box {
	display: none;
}

/* ---------------------------------------------------------------- 6. reduced motion
 * There is no animation to disable — the fold is instantaneous by design, so a screen
 * reader's virtual buffer and the two visibility guards always agree with what is painted.
 * This block exists only to say so, and to keep future contributors from adding one. */
