/* =============================================================================
   Interactive Accordion (acf/interactive-accordion) — Figma "RDV Updates",
   "Interactive Accordion" (106:2–106:48, under the Forms specimen).
   Full-bleed section, no inner box: the section itself carries the background.
   Phones: copy → image → list. From 992: copy + list on the left (447 of the
   Figma's 447 + 828), the image on the right, the left column centered on it.
   Measured from the Figma: rows 59px apart with a 1px rule above the first
   and under every item, a thin +/− 2px in from the rule's end, markers 5.64%
   of the image width tall, the open one 1.735x (81 / 46.67).
   Type is the site's: the headline is H4 (Oxanium), titles are H7-sized
   Roboto 500, the copy is Body. The Figma mixes in Roboto Medium and
   Titillium, which the site dropped on 2026-10-21.
   ============================================================================= */

.interactive-accordion--block {
	--ia-gutter: clamp(40px, 8vw, 148px);    /* Figma: 148 between list and image */
	--ia-title-size: var(--wp--preset--font-size--h-7, 25px);
	--ia-title-lh: 1.12;                      /* 28px at 25px, the Figma's title box */
	--ia-lane: 1.2;                           /* "1." lane, × the title size: copy hangs from it */
	--ia-rule: color-mix(in srgb, currentColor 20%, transparent);
	--ia-dim: 0.5;
	--ia-row-pad: 15px;                       /* (59 − 1 − 28) / 2 */
	--ia-speed: 300ms;
	--ia-marker-speed: 250ms;

	/* Marker width as a share of the image's width; height follows (87:100):
	   the Figma's 46.67 tall on its 828 image box. */
	--ia-marker: max(30px, 4.9%);
	--ia-marker-active: 1.735;
	/* Half an open marker's width: how far one reaches past its center. */
	--ia-marker-reach: calc(var(--ia-marker) * var(--ia-marker-active) / 2);

	padding-top: 60px;
	padding-bottom: 60px;
	/* A marker placed at the image's very edge must not scroll the page
	   sideways on phones. clip, unlike hidden, makes no scroll container. */
	overflow-x: clip;
}

@media (min-width: 992px) {
	.interactive-accordion--block {
		padding-top: 90px;
		padding-bottom: 90px;
	}
}

/* --- grid ------------------------------------------------------------------ */
.interactive-accordion--grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas:
		"copy"
		"media"
		"list";
}

/* ACF wraps InnerBlocks in an .acf-innerblocks-container div on the front end
   too; without display:contents the copy group is not a grid item. */
.interactive-accordion--grid > .acf-innerblocks-container {
	display: contents;
}

.interactive-accordion--grid .interactive-accordion--copy  { grid-area: copy;  min-width: 0; }
.interactive-accordion--grid .interactive-accordion--media { grid-area: media; min-width: 0; }
.interactive-accordion--grid .interactive-accordion--list  { grid-area: list;  min-width: 0; }

.interactive-accordion--copy > :last-child {
	margin-bottom: 0;
}

.interactive-accordion--media {
	margin-top: 32px;
}

/* Figma: 36px from the headline to the first rule. */
.interactive-accordion--list {
	margin-top: 36px;
}

@media (min-width: 992px) {
	/* The outer 1fr rows center the copy + list on the image when the image
	   is the taller; when the list is taller they collapse to 0 and the
	   image centers on it instead. */
	/* The Figma's 447 : 828, nudged to 460 : 815: Oxanium runs wider than the
	   Figma's Roboto, and at 447 "Mass-Manufacturable" (430px) missed the
	   1400 container's list column by 9px. */
	.interactive-accordion--grid {
		grid-template-columns: minmax(0, 460fr) minmax(0, 815fr);
		grid-template-rows: 1fr auto auto 1fr;
		grid-template-areas:
			".    media"
			"copy media"
			"list media"
			".    media";
		column-gap: var(--ia-gutter);
	}

	.interactive-accordion--media {
		align-self: center;
		margin-top: 0;
	}
}

/* --- image + markers -------------------------------------------------------
   The frame is exactly the image's box, so a marker's left/top percentages
   are percentages of the image. */
.interactive-accordion--frame {
	position: relative;
}
.interactive-accordion--frame > img {
	display: block;
	width: 100%;
	height: auto;
}

.interactive-accordion--media-empty {
	display: grid;
	place-items: center;
	aspect-ratio: 4 / 3;
	margin: 0;
	padding: 24px;
	background-color: color-mix(in srgb, currentColor 6%, transparent);
	opacity: 0.7;
	font-style: italic;
	text-align: center;
}

.interactive-accordion--marker {
	--marker-scale: 1;

	position: absolute;
	/* A marker may hang past the image's side (the Figma's 7 sits on its
	   right edge), but an open one stops at the container's padding: on a
	   phone that is the screen edge, and the section would clip it. Only
	   the last few % at either edge are affected. */
	left: clamp(
		calc(var(--ia-marker-reach) - var(--theme-content-padding, 15px)),
		var(--marker-x, 50%),
		calc(100% + var(--theme-content-padding, 15px) - var(--ia-marker-reach))
	);
	top: var(--marker-y, 50%);
	z-index: 1;
	width: var(--ia-marker);
	aspect-ratio: 87 / 100;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%; /* shapes the focus ring only */
	background: none;
	color: var(--wp--preset--color--cream, #efede6);
	cursor: pointer;
	transform: translate(-50%, -50%) scale(var(--marker-scale));
	transition: transform var(--ia-marker-speed) ease;
	-webkit-tap-highlight-color: transparent;
}

.interactive-accordion--marker svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
	filter: drop-shadow(1px 3px 4px rgba(0, 0, 0, 0.35));
}

/* Stroke in the fill color with round joins = a hexagon with soft corners. */
.interactive-accordion--marker-hex {
	fill: var(--rdv-red, #bf4042);
	stroke: var(--rdv-red, #bf4042);
	stroke-width: 6;
	stroke-linejoin: round;
}

.interactive-accordion--marker-number {
	fill: currentColor;
	font-family: var(--wp--preset--font-family--oxanium, "Oxanium", sans-serif);
	font-size: 46px; /* user units: 46% of the marker's height */
	font-weight: 500;
	text-anchor: middle;
	dominant-baseline: central;
}

.interactive-accordion--marker.is-active {
	--marker-scale: var(--ia-marker-active);
	z-index: 2;
}

@media (hover: hover) {
	.interactive-accordion--marker:not(.is-active):hover,
	.interactive-accordion--marker.is-hover:not(.is-active) {
		--marker-scale: 1.15;
		z-index: 3;
	}
}

/* reset.min.css carries normalize's `button:focus{outline:… auto 5px}`; the
   :focus reset comes first so the :focus-visible ring can win. */
.interactive-accordion--marker:focus {
	outline: none;
}
.interactive-accordion--marker:focus-visible {
	z-index: 3;
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* --- list ------------------------------------------------------------------ */
.interactive-accordion--list {
	border-top: 1px solid var(--ia-rule);
}

/* The item's own 8px bottom padding plus the trigger's 7px make the 15px
   under a closed title; open, the copy sits in between. */
.interactive-accordion--item {
	position: relative;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--ia-rule);
	scroll-margin-top: var(--theme-menu-height, 105px);
	scroll-margin-bottom: 24px;
}

.interactive-accordion--item-title {
	margin: 0;
}

.interactive-accordion--trigger {
	display: flex;
	align-items: flex-start;
	width: 100%;
	margin: 0;
	padding: var(--ia-row-pad) 40px 7px 0;
	border: 0;
	background: none;
	color: inherit;
	font-family: var(--wp--preset--font-family--roboto, "Roboto", sans-serif);
	font-size: var(--ia-title-size);
	font-weight: 500;
	line-height: var(--ia-title-lh);
	letter-spacing: 0.03em;
	text-align: left;
	cursor: pointer;
}

.interactive-accordion--number {
	flex: none;
	width: calc(var(--ia-lane) * 1em);
}

.interactive-accordion--number,
.interactive-accordion--trigger-text {
	transition: opacity 200ms ease;
}

.interactive-accordion--trigger-text {
	flex: 1;
	min-width: 0;
}

/* While an item is open the others step back (Figma), and come up again
   under keyboard focus, the pointer, or the pointer on their marker. With
   everything closed nothing is selected, so nothing dims. :hover only where
   there is a real pointer: a phone keeps a tapped title :hover, which would
   leave it lit after another item opens. */
.interactive-accordion--list:has(.is-open) .interactive-accordion--item:not(.is-open, .is-hover) .interactive-accordion--trigger:not(:focus-visible) :is(.interactive-accordion--number, .interactive-accordion--trigger-text) {
	opacity: var(--ia-dim);
}
@media (hover: hover) {
	.interactive-accordion--list:has(.is-open) .interactive-accordion--item:not(.is-open, .is-hover) .interactive-accordion--trigger:hover :is(.interactive-accordion--number, .interactive-accordion--trigger-text) {
		opacity: 1;
	}
}

/* The +/− is centered on the whole item, open or closed (Figma), so it rides
   down as a panel opens. */
.interactive-accordion--toggle {
	position: absolute;
	top: 50%;
	right: 2px;
	display: block;
	width: 15px;
	height: 15px;
	margin-top: -7.5px;
	opacity: 0.6;
}
.interactive-accordion--toggle svg {
	display: block;
	fill: currentColor;
}

/* The vertical bar rotates onto the horizontal one, so + becomes −. */
.interactive-accordion--toggle-bar-v {
	transform-box: fill-box;
	transform-origin: center;
	transition: transform 200ms ease;
}
.interactive-accordion--item.is-open .interactive-accordion--toggle-bar-v {
	transform: rotate(90deg);
}

.interactive-accordion--trigger:focus {
	outline: none;
}
.interactive-accordion--trigger:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* --- panel -----------------------------------------------------------------
   As on the Accordion: 0fr → 1fr animates to auto height, and the closed state
   is `hidden="until-found"`, restored from reset.min.css's
   `[hidden]{display:none!important}` so find-in-page can still reach it. */
.interactive-accordion--panel {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows var(--ia-speed) ease;
}
.interactive-accordion--panel > .interactive-accordion--panel-inner {
	overflow: hidden;
	min-height: 0;
}
.interactive-accordion--item.is-open .interactive-accordion--panel {
	grid-template-rows: 1fr;
}

@supports (content-visibility: hidden) {
	.interactive-accordion--panel[hidden="until-found"] {
		display: grid !important;
		content-visibility: hidden;
	}
}

/* The copy hangs from the title, clear of the number lane, and keeps clear
   of the +/− on the right. Body: Roboto 18/23. */
.interactive-accordion--panel-inner {
	padding-right: 40px;
	padding-left: calc(var(--ia-lane) * var(--ia-title-size));
	font-size: var(--wp--preset--font-size--body, 18px);
	line-height: 1.28;
	letter-spacing: 0.03em;
}
.interactive-accordion--panel-inner > *:first-child {
	margin-top: 0;
}
.interactive-accordion--panel-inner > *:last-child {
	margin-bottom: 0;
	padding-bottom: 4px;
}

.interactive-accordion--empty {
	margin: 0;
	opacity: 0.7;
	font-style: italic;
}

/* --- background and text color ---------------------------------------------
   Both classes come from the PHP, which reads the block's Color settings, so
   they are right in the editor canvas too (where ACF puts the has-* classes
   on its own wrapper, not on this section). default-background-mod: nothing
   picked, so the Figma's black. dark-background-mod: the background is dark
   (palette, custom hex or gradient) and no text color was picked. */
.interactive-accordion--block.default-background-mod {
	background-color: var(--wp--preset--color--black, #000);
}
.interactive-accordion--block.dark-background-mod {
	color: var(--wp--preset--color--cream, #efede6);
}

/* --- motion ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.interactive-accordion--panel,
	.interactive-accordion--marker,
	.interactive-accordion--toggle-bar-v,
	.interactive-accordion--number,
	.interactive-accordion--trigger-text {
		transition: none;
	}
}

/* --- editor canvas ---------------------------------------------------------
   interactive-accordion.js bails inside .editor-styles-wrapper: panels render
   expanded, no marker is enlarged, and clicks select the block. A 10% grid
   over the selected block's image helps read off the Across / Down values. */
.editor-styles-wrapper .interactive-accordion--trigger,
.editor-styles-wrapper .interactive-accordion--marker {
	pointer-events: none;
}
.editor-styles-wrapper .is-selected .interactive-accordion--frame::after {
	content: "";
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(to right, rgba(255, 255, 255, 0.25) 1px, transparent 1px),
		linear-gradient(to bottom, rgba(255, 255, 255, 0.25) 1px, transparent 1px);
	background-size: 10% 10%;
	box-shadow: inset -1px -1px 0 rgba(255, 255, 255, 0.25);
	pointer-events: none;
}
