/*
 * AISA Site Kit - flyer and download components.
 * Loaded on the live site and in the block editor, after components.css.
 *
 *   Columns -> Numbered rules
 *   Group   -> Flyer grid, Flyer card, Poster: navy / blue / teal / light
 *   Buttons -> Downloads (equal-width buttons with a download icon;
 *              a button set to open in a new tab gets an arrow instead)
 */

/* ── Numbered rules ─────────────────────────────────────────────
   Columns, each with a heading + short text. Numbers are automatic. */
.wp-block-columns.is-style-aisa-rules {
	counter-reset: aisa-rule;
	border-top: 1px solid var(--wp--preset--color--line);
	border-bottom: 1px solid var(--wp--preset--color--line);
	margin: 0;
	gap: 0;
}
.wp-block-columns.is-style-aisa-rules > .wp-block-column {
	counter-increment: aisa-rule;
	padding: 2rem 0;
}
.wp-block-columns.is-style-aisa-rules > .wp-block-column > * { margin-top: 0; }
.wp-block-columns.is-style-aisa-rules > .wp-block-column::before {
	content: counter(aisa-rule, decimal-leading-zero);
	display: block;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.6875rem;
	letter-spacing: 0.15em;
	color: var(--wp--preset--color--teal);
	margin-bottom: 1rem;
}
.is-style-aisa-rules h3 {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 700;
	font-size: 1.25rem;
	line-height: 1.2;
	letter-spacing: -0.02em;
	color: var(--wp--preset--color--ink);
	margin: 0 0 0.75rem;
}
.is-style-aisa-rules p {
	font-family: var(--wp--preset--font-family--sans);
	font-size: 0.9375rem;
	line-height: 1.65;
	color: var(--wp--preset--color--muted);
	margin: 0;
}
@media (min-width: 782px) {
	.wp-block-columns.is-style-aisa-rules > .wp-block-column {
		padding: 2rem 2rem 2.25rem;
		border-left: 1px solid var(--wp--preset--color--line);
	}
	.wp-block-columns.is-style-aisa-rules > .wp-block-column:first-child {
		padding-left: 0;
		border-left: 0;
	}
	.wp-block-columns.is-style-aisa-rules > .wp-block-column:last-child { padding-right: 0; }
}
@media (max-width: 781px) {
	.wp-block-columns.is-style-aisa-rules > .wp-block-column + .wp-block-column {
		border-top: 1px solid var(--wp--preset--color--line);
	}
}

/* ── Flyer grid ─────────────────────────────────────────────────
   Holds Flyer cards. Three across on desktop, wraps on its own. */
.wp-block-group.is-style-aisa-flyer-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr));
	gap: 3.5rem 2.5rem;
	margin: 0;
}
.wp-block-group.is-style-aisa-flyer-grid > * {
	margin: 0;
	max-width: none;
}

/* ── Flyer card ─────────────────────────────────────────────────
   Poster preview, title, blurb, Downloads buttons, small text link. */
.wp-block-group.is-style-aisa-flyer-card {
	display: flex;
	flex-direction: column;
	margin: 0;
}
.wp-block-group.is-style-aisa-flyer-card > * {
	margin-top: 0;
	margin-bottom: 0;
	max-width: none;
}
.is-style-aisa-flyer-card > h3,
.is-style-aisa-flyer-card > .wp-block-heading {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 700;
	font-size: 1.375rem;
	line-height: 1.2;
	letter-spacing: -0.02em;
	color: var(--wp--preset--color--ink);
	margin: 1.5rem 0 0.5rem;
}
.is-style-aisa-flyer-card > p {
	font-family: var(--wp--preset--font-family--sans);
	font-size: 0.9375rem;
	line-height: 1.6;
	color: var(--wp--preset--color--muted);
	margin: 0 0 1.5rem;
}
.is-style-aisa-flyer-card > .wp-block-buttons { margin-top: auto; }
.is-style-aisa-flyer-card > .wp-block-buttons ~ p {
	font-size: 0.875rem;
	margin: 1.25rem 0 0;
}
.is-style-aisa-flyer-card > .wp-block-buttons ~ p a {
	color: var(--wp--preset--color--muted);
	border-bottom: 0;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	transition: color 0.2s;
}
.is-style-aisa-flyer-card > .wp-block-buttons ~ p a:hover,
.is-style-aisa-flyer-card > .wp-block-buttons ~ p a:focus-visible {
	color: var(--wp--preset--color--teal);
}

/* ── Poster preview ─────────────────────────────────────────────
   A group holding three paragraphs: small label, big line, web address.
   Pick the colour under Styles. Swap the paragraphs for an Image block
   to show a picture of the real flyer instead. */
.wp-block-group.is-style-aisa-poster-navy,
.wp-block-group.is-style-aisa-poster-blue,
.wp-block-group.is-style-aisa-poster-teal,
.wp-block-group.is-style-aisa-poster-light {
	position: relative;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	aspect-ratio: 1 / 1.414;
	margin: 0;
	padding: 1.75rem 1.5rem;
	border: 1px solid transparent;
	border-radius: 2px;
	overflow: hidden;
}
.wp-block-group[class*="is-style-aisa-poster-"] > * {
	margin: 0;
	max-width: none;
	color: inherit;
}
/* Small label */
.wp-block-group[class*="is-style-aisa-poster-"] > p:first-child {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.625rem;
	font-weight: 500;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	line-height: 1.6;
	margin-bottom: 1.25rem;
}
/* Big line */
.wp-block-group[class*="is-style-aisa-poster-"] > p:nth-child(2) {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 800;
	font-size: clamp(1.625rem, 2.5vw, 2rem);
	line-height: 1.05;
	letter-spacing: -0.035em;
}
/* Web address, pinned to the bottom */
.wp-block-group[class*="is-style-aisa-poster-"] > p:last-child:not(:nth-child(-n+2)) {
	margin-top: auto;
	padding-right: 4.5rem;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.6875rem;
	letter-spacing: 0.02em;
	opacity: 0.75;
}
/* QR placeholder */
.wp-block-group[class*="is-style-aisa-poster-"]::after {
	content: "QR";
	position: absolute;
	right: 1.5rem;
	bottom: 1.5rem;
	width: 3.25rem;
	height: 3.25rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px dashed currentColor;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.5625rem;
	letter-spacing: 0.1em;
	opacity: 0.5;
}
/* Real flyer image instead of the styled preview */
.wp-block-group[class*="is-style-aisa-poster-"]:has(> .wp-block-image) {
	padding: 0;
}
.wp-block-group[class*="is-style-aisa-poster-"]:has(> .wp-block-image)::after { display: none; }
.wp-block-group[class*="is-style-aisa-poster-"] > .wp-block-image {
	height: 100%;
	margin: 0;
}
.wp-block-group[class*="is-style-aisa-poster-"] > .wp-block-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Colours */
.wp-block-group.is-style-aisa-poster-navy {
	background: #0e1634;
	border-color: var(--wp--preset--color--line-mid);
	color: var(--wp--preset--color--ink);
}
.wp-block-group.is-style-aisa-poster-navy > p:first-child { color: var(--wp--preset--color--teal); }

.wp-block-group.is-style-aisa-poster-blue {
	background: #17215a;
	border-color: #27347a;
	color: var(--wp--preset--color--ink);
}
.wp-block-group.is-style-aisa-poster-blue > p:first-child { color: var(--wp--preset--color--teal); }

.wp-block-group.is-style-aisa-poster-teal {
	background: var(--wp--preset--color--teal);
	color: var(--wp--preset--color--bg);
}

.wp-block-group.is-style-aisa-poster-light {
	background: #eef1fb;
	color: var(--wp--preset--color--bg);
}
.wp-block-group.is-style-aisa-poster-light > p:first-child { color: #0f8f7c; }

/* ── Downloads buttons ──────────────────────────────────────────
   Equal-width buttons with a download icon. Turn on "Open in new tab"
   for a button that opens a folder or page rather than a file, and it
   shows an arrow instead. */
.wp-block-buttons.is-style-aisa-download {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 1fr;
	gap: 0.75rem;
	width: fit-content;
	max-width: 100%;
}
.wp-block-buttons.is-style-aisa-download.is-content-justification-right { margin-left: auto; }
.wp-block-buttons.is-style-aisa-download.is-content-justification-center { margin-left: auto; margin-right: auto; }
.is-style-aisa-flyer-card > .wp-block-buttons.is-style-aisa-download { width: auto; }
.wp-block-buttons.is-style-aisa-download > .wp-block-button {
	width: 100%;
	margin: 0;
}
.wp-block-buttons.is-style-aisa-download .wp-block-button__link {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.55rem;
	width: 100%;
	height: 100%;
	padding: 0.8rem 1.1rem;
	font-size: 0.875rem;
	font-weight: 600;
	white-space: nowrap;
	text-decoration: none;
}
.wp-block-buttons.is-style-aisa-download .wp-block-button__link:not([target="_blank"])::before {
	content: "";
	flex: 0 0 auto;
	width: 0.95rem;
	height: 0.95rem;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15V3'/%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15V3'/%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.wp-block-buttons.is-style-aisa-download .wp-block-button__link[target="_blank"]::after {
	content: "\2197";
	font-weight: 400;
}
/* Solid */
.wp-block-buttons.is-style-aisa-download > .wp-block-button:not(.is-style-outline) > .wp-block-button__link {
	background: var(--wp--preset--color--teal);
	color: var(--wp--preset--color--bg);
	border: 1px solid var(--wp--preset--color--teal);
}
.wp-block-buttons.is-style-aisa-download > .wp-block-button:not(.is-style-outline) > .wp-block-button__link:hover {
	background: var(--wp--preset--color--teal-hover);
	border-color: var(--wp--preset--color--teal-hover);
	color: var(--wp--preset--color--bg);
}
/* Outline */
.wp-block-buttons.is-style-aisa-download > .is-style-outline > .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--ink);
	border: 1px solid var(--wp--preset--color--line-mid);
}
.wp-block-buttons.is-style-aisa-download > .is-style-outline > .wp-block-button__link:hover {
	background: transparent;
	color: var(--wp--preset--color--teal);
	border-color: var(--wp--preset--color--teal);
}
@media (max-width: 480px) {
	.wp-block-buttons.is-style-aisa-download:not(.is-style-aisa-flyer-card *) { grid-auto-flow: row; width: 100%; }
}
@media (max-width: 781px) {
	.wp-block-buttons.is-style-aisa-download.is-content-justification-right { margin-left: 0; }
}

/* Plain buttons row inside an Ask row keeps a tidy gap */
.is-style-aisa-ask .wp-block-buttons { gap: 0.75rem; margin-top: 1.75rem; }
.is-style-aisa-ask .wp-block-button__link { font-size: 0.9375rem; padding: 0.95rem 1.5rem; }
