/* ACTRA Accordions & Tables — light styling for plain WordPress Details and Table blocks.
   Theme override points: --aat-accent, --aat-accent-ink, --aat-line, --aat-soft, --aat-radius. */
:where(:root) {
	--aat-accent: #004265;
	--aat-accent-ink: #fff;
	--aat-line: #d6dbe0;
	--aat-soft: #f3f5f7;
	--aat-radius: 6px;
}

/* Details = accordion item */
.wp-block-details {
	margin: 0 0 .5rem;
	border: 1px solid var(--aat-line);
	border-radius: var(--aat-radius);
	background: #fff;
	overflow: hidden;
}
.wp-block-details > summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: .8rem 1rem;
	font-weight: 700;
	line-height: 1.35;
	cursor: pointer;
	list-style: none;
}
.wp-block-details > summary::-webkit-details-marker { display: none; }
.wp-block-details > summary::after {
	content: "";
	flex: none;
	width: .55rem;
	height: .55rem;
	margin: 0 .25rem .2rem 0;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
}
.wp-block-details[open] > summary::after { margin-bottom: -.2rem; transform: rotate(-135deg); }
.wp-block-details > summary:hover { background: var(--aat-soft); }
.wp-block-details > summary:focus-visible { outline: 2px solid var(--aat-accent); outline-offset: -2px; }
.wp-block-details[open] > summary { border-bottom: 1px solid var(--aat-line); }
.wp-block-details > :not(summary) { margin-left: 1rem; margin-right: 1rem; }
.wp-block-details > summary + * { margin-top: 1rem; }
.wp-block-details > :last-child:not(summary) { margin-bottom: 1rem; }
.wp-block-details .wp-block-details { margin-top: .5rem; }
.wp-block-details > summary > :is(h1, h2, h3, h4, h5, h6) { margin: 0; font-size: inherit; }
@media (prefers-reduced-motion: no-preference) {
	.wp-block-details > summary::after { transition: transform .2s ease; }
}

/* Top-level sections get a coloured title bar; nested sections stay light */
.wp-block-details:not(.wp-block-details .wp-block-details) > summary { background: var(--aat-accent); color: var(--aat-accent-ink); }
.wp-block-details:not(.wp-block-details .wp-block-details) > summary:hover { background: var(--aat-accent); filter: brightness(1.12); }
.wp-block-details:not(.wp-block-details .wp-block-details) > summary a { color: inherit; }
.wp-block-details:not(.wp-block-details .wp-block-details)[open] > summary { border-bottom-color: var(--aat-accent); }
.wp-block-details:not(.wp-block-details .wp-block-details) { border-color: var(--aat-accent); }

/* Tables: readable cells and images that fit their column */
.wp-block-table td, .wp-block-table th { vertical-align: top; }
.wp-block-table td img, .wp-block-table th img { max-width: 100%; height: auto; }
.wp-block-table.actra-fit-images td img, .wp-block-table.actra-fit-images th img { display: block; width: 100%; margin: 0 auto .35rem; }
.wp-block-table.actra-borderless :is(table, thead, tbody, tfoot, tr, td, th) { border: 0; }

@media print {
	.wp-block-details > summary::after { display: none; }
}
