/*
 * AYHL styles for core WordPress block content.
 *
 * Maps editor-created content (tables, buttons, files, quotes, groups…)
 * onto the AYHL design system so editors never need custom markup.
 * Scoped to .ayhl-entry (front end) and .editor-styles-wrapper (editor).
 */

/* ---------- Tables (core/table) — match .ayhl-table ---------- */
:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-table {
	margin-inline: 0;
	overflow-x: auto;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-table table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	border: 1px solid var(--ayhl-color-border-subtle);
	border-radius: var(--ayhl-radius-md);
	background: var(--ayhl-color-surface);
	font-family: var(--ayhl-font-body);
	font-size: var(--ayhl-table-font-size);
	font-variant-numeric: tabular-nums;
	line-height: 1.4;
	overflow: hidden;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-table :is(th, td) {
	padding: var(--ayhl-table-cell-y) var(--ayhl-table-cell-x);
	border: 0;
	border-bottom: 1px solid var(--ayhl-table-row-rule);
	text-align: left;
	vertical-align: top;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-table thead {
	border: 0;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-table thead th,
:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-table thead td {
	border-bottom: 2px solid var(--ayhl-table-head-rule);
	background: var(--ayhl-table-head-bg);
	color: var(--ayhl-table-head-color);
	font-family: var(--ayhl-font-display);
	font-size: 0.875rem;
	font-weight: 700;
	letter-spacing: var(--ayhl-tracking-caps);
	text-transform: uppercase;
	white-space: nowrap;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-table tbody tr:last-child > * {
	border-bottom: 0;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-table tbody tr:hover {
	background: var(--ayhl-table-row-hover);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-table tfoot {
	border: 0;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-table tfoot td {
	border-top: 2px solid var(--ayhl-color-border);
	font-weight: 600;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-table.is-style-stripes {
	border-bottom: 0;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background: transparent;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-table.is-style-stripes tbody tr:nth-child(even) {
	background: var(--ayhl-table-stripe);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-table figcaption {
	margin-top: 0.6em;
	color: var(--ayhl-color-text-subtle);
	font-size: var(--ayhl-text-sm);
	text-align: left;
}

/* Block style: "AYHL Dark header" */
:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-table.is-style-ayhl-dark-head thead :is(th, td) {
	border-bottom-color: var(--ayhl-color-accent);
	background: var(--ayhl-navy-900);
	color: rgba(255, 255, 255, 0.9);
}

/* ---------- Buttons (core/button) ---------- */
:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-buttons {
	gap: var(--ayhl-space-3);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--ayhl-control-height);
	padding: 0.6rem 1.3rem 0.55rem;
	border: 2px solid transparent;
	border-radius: var(--ayhl-radius-sm);
	background-color: var(--ayhl-color-primary);
	color: #fff;
	font-family: var(--ayhl-font-display);
	font-size: 1.0625rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: var(--ayhl-tracking-caps);
	text-decoration: none;
	text-transform: uppercase;
	transition: background-color var(--ayhl-duration) var(--ayhl-ease), transform var(--ayhl-duration) var(--ayhl-ease);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-button__link:hover {
	background-color: var(--ayhl-color-primary-hover);
	color: #fff;
	transform: translateY(-1px);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-button.is-style-outline .wp-block-button__link {
	border-color: var(--ayhl-color-border-strong);
	background: transparent;
	color: var(--ayhl-navy-900);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-button.is-style-outline .wp-block-button__link:hover {
	border-color: var(--ayhl-color-primary);
	background: var(--ayhl-color-primary-tint);
}

/* ---------- Files / documents (core/file) ---------- */
:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-file {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--ayhl-space-3) var(--ayhl-space-4);
	padding: var(--ayhl-space-4) var(--ayhl-space-5);
	border: 1px solid var(--ayhl-color-border-subtle);
	border-radius: var(--ayhl-radius-md);
	background: var(--ayhl-color-surface);
	font-size: var(--ayhl-text-base);
	transition: border-color var(--ayhl-duration-fast) var(--ayhl-ease), box-shadow var(--ayhl-duration-fast) var(--ayhl-ease);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-file:hover {
	border-color: var(--ayhl-color-border);
	box-shadow: var(--ayhl-shadow-sm);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-file::before {
	content: "";
	flex-shrink: 0;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: var(--ayhl-radius-sm);
	background:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e41a37' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5M9 13h6M9 17h4'/%3E%3C/svg%3E") center / 1.35rem no-repeat,
		var(--ayhl-color-accent-tint);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-file > a:not(.wp-block-file__button) {
	flex: 1;
	min-width: 12rem;
	color: var(--ayhl-color-heading);
	font-weight: 600;
	text-decoration: none;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-file > a:not(.wp-block-file__button):hover {
	color: var(--ayhl-color-primary);
	text-decoration: underline;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-file .wp-block-file__button {
	margin-left: auto;
	padding: 0.5rem 1rem 0.45rem;
	border-radius: var(--ayhl-radius-sm);
	background: var(--ayhl-navy-900);
	color: #fff;
	font-family: var(--ayhl-font-display);
	font-size: 0.9375rem;
	font-weight: 700;
	letter-spacing: var(--ayhl-tracking-caps);
	text-decoration: none;
	text-transform: uppercase;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-file .wp-block-file__button:hover {
	background: var(--ayhl-color-primary);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-file + .wp-block-file {
	margin-top: var(--ayhl-space-2);
}

/* Block style for lists of document links: "AYHL Document list" */
:is(.ayhl-entry, .editor-styles-wrapper) ul.is-style-ayhl-documents {
	padding: 0;
	list-style: none;
	border: 1px solid var(--ayhl-color-border-subtle);
	border-radius: var(--ayhl-radius-md);
	background: var(--ayhl-color-surface);
	overflow: hidden;
}

:is(.ayhl-entry, .editor-styles-wrapper) ul.is-style-ayhl-documents li {
	margin: 0;
	border-bottom: 1px solid var(--ayhl-color-border-subtle);
}

:is(.ayhl-entry, .editor-styles-wrapper) ul.is-style-ayhl-documents li:last-child {
	border-bottom: 0;
}

:is(.ayhl-entry, .editor-styles-wrapper) ul.is-style-ayhl-documents a {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	padding: 0.85rem 1.1rem;
	color: var(--ayhl-color-heading);
	font-weight: 600;
	text-decoration: none;
}

:is(.ayhl-entry, .editor-styles-wrapper) ul.is-style-ayhl-documents a::before {
	content: "";
	flex-shrink: 0;
	width: 1.25rem;
	height: 1.25rem;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230055a4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5M12 12v6m-3-3 3 3 3-3'/%3E%3C/svg%3E") center / contain no-repeat;
}

:is(.ayhl-entry, .editor-styles-wrapper) ul.is-style-ayhl-documents a:hover {
	background: var(--ayhl-color-primary-tint);
	color: var(--ayhl-color-primary);
}

/* ---------- Group block styles ---------- */
/* "AYHL Card" */
:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-group.is-style-ayhl-card {
	padding: var(--ayhl-space-6);
	border: 1px solid var(--ayhl-color-border-subtle);
	border-radius: var(--ayhl-radius-md);
	background: var(--ayhl-color-surface);
	box-shadow: var(--ayhl-shadow-sm);
}

/* "AYHL Callout" — info row with brand left rule (legacy event-row idea) */
:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-group.is-style-ayhl-callout {
	padding: var(--ayhl-space-5) var(--ayhl-space-6);
	border-left: 4px solid var(--ayhl-color-primary);
	border-radius: 0 var(--ayhl-radius-md) var(--ayhl-radius-md) 0;
	background: var(--ayhl-color-surface-sunken);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-group:is(.is-style-ayhl-card, .is-style-ayhl-callout) > :first-child {
	margin-top: 0;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-group:is(.is-style-ayhl-card, .is-style-ayhl-callout) > :last-child {
	margin-bottom: 0;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-group:is(.is-style-ayhl-card, .is-style-ayhl-callout) > * + * {
	margin-top: 0.85em;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-group:is(.is-style-ayhl-card, .is-style-ayhl-callout) :is(h2, h3, h4) {
	font-size: var(--ayhl-text-xl);
	text-transform: uppercase;
}

/* "AYHL Dark panel" */
:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-group.is-style-ayhl-dark {
	padding: var(--ayhl-space-8);
	border-radius: var(--ayhl-radius-md);
	background:
		url("../img/rink-lines.svg") right -6rem center / 40rem auto no-repeat,
		var(--ayhl-navy-900);
	color: var(--ayhl-color-text-on-dark-muted);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-group.is-style-ayhl-dark :is(h1, h2, h3, h4, h5, h6, strong) {
	color: #fff;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-group.is-style-ayhl-dark a:not(.wp-block-button__link) {
	color: #fff;
}

/* ---------- Other core blocks ---------- */
:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-separator {
	height: 1px;
	border: 0;
	background: var(--ayhl-color-border);
	opacity: 1;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-separator.is-style-wide {
	height: 3px;
	background: linear-gradient(90deg, var(--ayhl-color-primary) 0 70%, var(--ayhl-color-accent) 70%);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-pullquote {
	padding: var(--ayhl-space-8) 0;
	border-top: 3px solid var(--ayhl-navy-900);
	border-bottom: 1px solid var(--ayhl-color-border);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-pullquote blockquote {
	border: 0;
	padding: 0;
	font-size: var(--ayhl-text-2xl);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-image img {
	border-radius: var(--ayhl-radius-md);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-embed iframe {
	border-radius: var(--ayhl-radius-md);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-columns {
	gap: var(--ayhl-space-8);
}

/* Details (accordion) — good for FAQs, rules, document groups */
:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-details {
	border: 1px solid var(--ayhl-color-border-subtle);
	border-radius: var(--ayhl-radius-md);
	background: var(--ayhl-color-surface);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-details + .wp-block-details {
	margin-top: var(--ayhl-space-2);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-details summary {
	position: relative;
	padding: var(--ayhl-space-4) 3rem var(--ayhl-space-4) var(--ayhl-space-5);
	color: var(--ayhl-color-heading);
	font-family: var(--ayhl-font-display);
	font-size: 1.25rem;
	font-weight: 700;
	list-style: none;
	cursor: pointer;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-details summary::-webkit-details-marker {
	display: none;
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-details summary::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 1.25rem;
	width: 0.6rem;
	height: 0.6rem;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-70%) rotate(45deg);
	transition: transform var(--ayhl-duration) var(--ayhl-ease);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-details[open] summary::after {
	transform: translateY(-30%) rotate(-135deg);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-details > :not(summary) {
	margin: 0;
	padding: 0 var(--ayhl-space-5) var(--ayhl-space-5);
}

/* Core search block inside content */
:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-search__input {
	min-height: var(--ayhl-control-height);
	padding: 0.55rem 0.85rem;
	border: 1px solid var(--ayhl-color-border-strong);
	border-radius: var(--ayhl-radius-sm);
}

:is(.ayhl-entry, .editor-styles-wrapper) .wp-block-search__button {
	border: 0;
	border-radius: var(--ayhl-radius-sm);
	background: var(--ayhl-color-primary);
	color: #fff;
	font-family: var(--ayhl-font-display);
	font-weight: 700;
	text-transform: uppercase;
}

/* Alignment helpers for classic content */
.alignleft {
	float: left;
	margin: 0.3em 1.5em 1em 0;
}

.alignright {
	float: right;
	margin: 0.3em 0 1em 1.5em;
}

.aligncenter {
	margin-inline: auto;
}

.wp-caption-text {
	color: var(--ayhl-color-text-subtle);
	font-size: var(--ayhl-text-sm);
}

.sticky,
.gallery-caption,
.bypostauthor {
	/* WordPress core classes — intentionally unstyled */
}
