/*
 * Event HTML stylesheet (pattern contract 4.3 to 4.6, rule L18; portable set 5.9).
 *
 * Styles the classes of contract 4.3 wherever they appear, and the plain elements of an event description
 * (iframe, table, hr) inside `.tribe-events-content` and the classic editor's body (`.mce-content-body`).
 * The classic editor's iframe has no global styles, so every colour is written as
 * var(--wp--preset--color--<slug>, <the preset's own value>): the fallback is the one place a colour literal is
 * allowed (test S10). Spacing and type presets carry their values as fallbacks too.
 *
 * Focus rings come from blocks.css (contract 1.7); this file only keeps them from being clipped.
 */

/* Anchor offset (contract 1.7): a link to #id lands below the sticky header. The same declaration as the
   header stylesheet's, so it never adds up with it. */
html {
	scroll-padding-top: calc(var(--wp--custom--header--height-shrunk, 4rem) + var(--wp-admin--admin-bar--height, 0px));
}

/* 1 and 2. Button link: the primary button of 2.5. There is one look.
   The class is tripled on purpose: The Events Calendar colours every link of a single event with
   `.single-tribe_events .tribe-events-single-event-description a` (0,2,1), whatever its load order. */
a.caw-button.caw-button.caw-button {
	display: inline-block;
	box-sizing: border-box;
	padding: 0.625rem 1.875rem;
	border: 2px solid var(--wp--preset--color--teal-strong, #007f8a);
	border-radius: 999px;
	background-color: var(--wp--preset--color--teal-strong, #007f8a);
	color: var(--wp--preset--color--white, #ffffff);
	font-family: var(--wp--preset--font-family--montserrat, Montserrat, "Helvetica Neue", Arial, sans-serif);
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: 0.1875rem;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

a.caw-button.caw-button.caw-button:is(:hover, :focus-visible) {
	background-color: var(--wp--preset--color--white, #ffffff);
	color: var(--wp--preset--color--teal-strong, #007f8a);
	border-color: var(--wp--preset--color--teal-strong, #007f8a);
	text-decoration: none;
}

/* 3. Speaker row: the picture at the left, the name and the text at its right; one column on a phone. */
.caw-speaker {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 0 1.5rem;
	margin: var(--wp--preset--spacing--50, 1.5rem) 0;
}

.caw-speaker > * {
	grid-column: 1;
	margin-top: 0;
	margin-bottom: 0.75rem;
}

.caw-speaker > :first-child {
	margin-bottom: 1rem;
}

.caw-speaker > :last-child {
	margin-bottom: 0;
}

.caw-speaker img {
	display: block;
	width: 9rem;
	max-width: 100%;
	height: 9rem;
	aspect-ratio: 1;
	border-radius: 50%;
	object-fit: cover;
}

/* A logo or any picture that must not be cropped: shown whole. */
.caw-speaker--logo img {
	height: auto;
	aspect-ratio: auto;
	max-height: 9rem;
	border-radius: 0;
	object-fit: contain;
}

/* The first text paragraph that opens with <strong> (the picture's paragraph comes first) has the look of the
   name heading. */
.caw-speaker > p:has(img) + p > strong:first-child {
	color: var(--wp--preset--color--heading-grey, #54585a);
	font-family: var(--wp--preset--font-family--montserrat, Montserrat, "Helvetica Neue", Arial, sans-serif);
	font-size: var(--wp--preset--font-size--large, 1.125rem);
	font-weight: 900;
	line-height: 1.19;
	letter-spacing: 0.03125rem;
}

@media (min-width: 600px) {
	.caw-speaker {
		grid-template-columns: 9rem minmax(0, 1fr);
	}

	.caw-speaker > * {
		grid-column: 2;
	}

	.caw-speaker > :first-child {
		grid-column: 1;
		grid-row: 1 / span 20;
		margin-bottom: 0;
	}
}

/* 4. Notice: the look of the Group style notice-info; with --warning, notice-warning. */
.caw-notice {
	margin: var(--wp--preset--spacing--50, 1.5rem) 0;
	padding: var(--wp--preset--spacing--50, 1.5rem);
	border-left: 4px solid var(--wp--preset--color--deep-teal, #006778);
	background-color: var(--wp--preset--color--panel, #f9f9f9);
	color: var(--wp--preset--color--ink, #333333);
}

.caw-notice > :first-child {
	margin-top: 0;
}

.caw-notice > :last-child {
	margin-bottom: 0;
}

.caw-notice :is(h2, h3, h4, h5, h6) {
	color: var(--wp--preset--color--heading-grey, #54585a);
}

/* Written as div.caw-notice (0,2,2) so a theme or plugin link rule at (0,2,1) loses. */
div.caw-notice a:not(.caw-button) {
	color: var(--wp--preset--color--deep-teal, #006778);
	text-decoration: underline;
}

div.caw-notice a:not(.caw-button):is(:hover, :focus-visible) {
	text-decoration: none;
}

.caw-notice.caw-notice--warning {
	border-left: 0;
	background-color: var(--wp--preset--color--sun, #fcd201);
}

.caw-notice.caw-notice--warning :is(h2, h3, h4, h5, h6) {
	color: var(--wp--preset--color--ink, #333333);
}

div.caw-notice.caw-notice--warning a:not(.caw-button) {
	color: var(--wp--preset--color--ink, #333333);
}

/* 5. Accordion (rule L18): a row on the panel colour, rows 0.3125rem apart; the icon stands in a cell 3.75rem
   wide at the left with a 1px mist rule at its right; the title is Roboto 500, ink closed and deep-teal open.
   No overflow here: the focus ring of summary must not be cut off. */
details.caw-accordion {
	margin: 0.3125rem 0;
	background-color: var(--wp--preset--color--panel, #f9f9f9);
	color: var(--wp--preset--color--ink, #333333);
}

details.caw-accordion > summary {
	display: flex;
	align-items: center;
	gap: 1.25rem;
	min-height: 3.25rem;
	padding: 0.5rem 1.25rem 0.5rem 0;
	color: var(--wp--preset--color--ink, #333333);
	font-family: var(--wp--preset--font-family--roboto, Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif);
	font-weight: 500;
	list-style: none;
	cursor: pointer;
}

details.caw-accordion > summary::-webkit-details-marker {
	display: none;
}

details.caw-accordion > summary::before {
	content: "+";
	display: flex;
	flex: 0 0 3.75rem;
	align-items: center;
	justify-content: center;
	align-self: stretch;
	box-sizing: border-box;
	margin-block: -0.5rem;
	border-right: 1px solid var(--wp--preset--color--mist, #e0e4e8);
	color: var(--wp--preset--color--deep-teal, #006778);
	font-size: 1.5rem;
	font-weight: 400;
	line-height: 1;
}

details.caw-accordion[open] > summary {
	color: var(--wp--preset--color--deep-teal, #006778);
}

details.caw-accordion[open] > summary::before {
	content: "\2212";
}

/* The panel's text lines up with the title. */
details.caw-accordion > :not(summary) {
	margin-left: 5rem;
	margin-right: 1.25rem;
}

/* Below 600px the panel's content uses the panel's width, as the block Accordion's does (ruling 87). */
@media (max-width: 599.98px) {
	details.caw-accordion > :not(summary) {
		margin-left: 1.25rem;
		margin-right: 1.25rem;
	}
}

details.caw-accordion > summary + * {
	margin-top: 0.25rem;
}

details.caw-accordion > :last-child {
	margin-bottom: 1.25rem;
}

/* 6. Embedded video. Vimeo and YouTube players printed in classic content (outside a core embed block) are
   16:9 and as wide as the column; 9:16 in a portrait wrapper. */
iframe[src^="https://player.vimeo.com/video/"]:not(.wp-block-embed__wrapper *),
iframe[src^="https://www.youtube.com/embed/"]:not(.wp-block-embed__wrapper *) {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	border: 0;
}

.caw-video--portrait iframe[src^="https://player.vimeo.com/video/"]:not(.wp-block-embed__wrapper *),
.caw-video--portrait iframe[src^="https://www.youtube.com/embed/"]:not(.wp-block-embed__wrapper *) {
	aspect-ratio: 9 / 16;
}

/* Every other iframe stays inside the column and keeps its own height. Its border counts in the 100%: a frame printed
   without `frameborder="0"` has the browser's 2px border, which made a full-width frame 4px wider than the column. */
:is(.tribe-events-content, .mce-content-body) iframe {
	box-sizing: border-box;
	max-width: 100%;
}

/* 8. Images in a description never leave the column. */
:is(.tribe-events-content, .mce-content-body) img {
	max-width: 100%;
	height: auto;
}

/* 9. Logo row: in a row, contained and never cropped. */
.caw-logos > p {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem 2rem;
	margin: var(--wp--preset--spacing--50, 1.5rem) 0;
}

.caw-logos img {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 5.75rem;
	object-fit: contain;
}

/* 10. Rule: the Separator style rule, 3px, teal on the white page. */
:is(.tribe-events-content, .mce-content-body) hr {
	height: 0;
	margin: var(--wp--preset--spacing--60, 2rem) 0;
	border: 0;
	border-bottom: 3px solid var(--wp--preset--color--teal, #009aa6);
	background: none;
	color: var(--wp--preset--color--teal, #009aa6);
	overflow: visible;
}

/* 11. Table: a wide table scrolls inside the description, the page does not. */
:is(.tribe-events-content, .mce-content-body) table {
	display: block;
	max-width: 100%;
	margin: var(--wp--preset--spacing--50, 1.5rem) 0;
	overflow-x: auto;
	border-collapse: collapse;
}

:is(.tribe-events-content, .mce-content-body) :is(th, td) {
	padding: 0.625rem 1rem;
	border-bottom: 1px solid var(--wp--preset--color--mist, #e0e4e8);
	text-align: left;
	vertical-align: top;
}

:is(.tribe-events-content, .mce-content-body) th {
	background-color: var(--wp--preset--color--panel, #f9f9f9);
	color: var(--wp--preset--color--heading-grey, #54585a);
	font-family: var(--wp--preset--font-family--montserrat, Montserrat, "Helvetica Neue", Arial, sans-serif);
	font-weight: 700;
}
