/**
 * OptConnect product spec panels (PR 3.8) — `optconnect/product-specs`.
 *
 * Short because `<details>` / `<summary>` already is the disclosure control; nothing here
 * reimplements behaviour. The one-panel-at-a-time behaviour is the shared HTML `name`
 * attribute in the pattern markup, not a rule in this file.
 *
 * Same no-margins convention as the other family stylesheets: nothing gets a `margin`
 * declaration, because core's flow layout emits `.wp-container-… > * + *
 * { margin-block-start: … }` at one-class specificity and this file loads after it. The
 * rail's zero gap is `blockGap: 0` in the markup; space under an open panel is padding.
 */

/* --------------------------------------------------------------------------
 * The rail
 * ---------------------------------------------------------------------- */

/* `border-top` on each panel plus `border-bottom` on the last survives an editor deleting
   a panel, which an `+ *` rule would not. `rgba()` on the brand ink because there is no
   hairline token — adding one is a palette decision, not a pattern's. */
.oc-specs__panel {
	border-top: 1px solid rgba(29, 44, 56, 0.14);
}

.oc-specs__panel:last-child {
	border-bottom: 1px solid rgba(29, 44, 56, 0.14);
}

/* --------------------------------------------------------------------------
 * The summary row
 * ---------------------------------------------------------------------- */

/* `list-style: none` kills Firefox's default triangle, the `::-webkit-details-marker`
   rule below kills Safari's — neither browser honours the other's.
   The label takes `contrast` (14.29:1) rather than the source's `#0081C2` active colour,
   which is 4.27:1 and misses the 4.5:1 floor for body-sized text; the blue stays on the
   chevron, where it is decorative and the 3:1 non-text floor applies.
   `min-height` is the 48px WCAG 2.5.8 target, which the padding alone would not reach on
   the shortest label. */
.oc-specs__panel > summary {
	align-items: center;
	color: var(--wp--preset--color--contrast, #1d2c38);
	display: flex;
	font-family: var(--wp--preset--font-family--nunito, Nunito, sans-serif);
	font-size: var(--wp--preset--font-size--large, 1.38rem);
	font-weight: 700;
	gap: 1rem;
	justify-content: space-between;
	list-style: none;
	min-height: 3rem;
	padding-block: 0.75rem;
}

.oc-specs__panel > summary::-webkit-details-marker {
	display: none;
}

/* `accent-2` (5.77:1), not `accent-1` (4.27:1) — a hover colour clears the same floor the
   resting one does. */
.oc-specs__panel > summary:hover {
	color: var(--wp--preset--color--accent-2, #006ba4);
}

/* Scoped to `> summary` so it cannot reach a `.wp-element-button` inside a panel: a
   descendant `:focus-visible` rule is (0,2,0) and would silently beat `theme.json`'s own
   `:root :where(.wp-element-button:focus-visible)` at (0,1,0), giving the same control a
   different ring depending on its container. */
.oc-specs__panel > summary:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent-1, #0081c2);
	outline-offset: 2px;
}

/* --------------------------------------------------------------------------
 * The chevron
 * ---------------------------------------------------------------------- */

/* Two borders on a square, rotated — not one of `assets/images/icons/`, which are
   blue-filled SVGs meant for `core/image` and would need a second white copy or a
   `mask-image` per state to work as a marker.
   `flex: 0 0 auto` keeps it from being squeezed by a long label, and `translate` precedes
   `rotate` so the glyph lands on the label's optical centre in both states. */
.oc-specs__panel > summary::after {
	border-bottom: 2px solid var(--wp--preset--color--accent-1, #0081c2);
	border-right: 2px solid var(--wp--preset--color--accent-1, #0081c2);
	content: "";
	flex: 0 0 auto;
	height: 0.5em;
	transform: translateY(-0.15em) rotate(45deg);
	transition: transform 150ms ease;
	width: 0.5em;
}

.oc-specs__panel[open] > summary::after {
	transform: translateY(0.1em) rotate(225deg);
}

@media (prefers-reduced-motion: reduce) {
	.oc-specs__panel > summary::after {
		transition: none;
	}
}

/* --------------------------------------------------------------------------
 * The open panel
 * ---------------------------------------------------------------------- */

/* A measure on the prose, and the one place this file sets a width instead of expressing
   it in markup: `core/details` declares `layout: { allowEditing: false }`, so it has no
   `contentSize` to set. The rail itself stays full width — only the copy is capped. */
.oc-specs__panel > :not(summary) {
	max-width: 68ch;
}

/* On `[open]` so a closed panel adds no height. Padding rather than margin, per the
   convention above. */
.oc-specs__panel[open] {
	padding-bottom: var(--wp--preset--spacing--40, 30px);
}
