/*
 * Site-plugin output and automatic cards (pattern contract 5.5 to 5.7; portable set 5.9).
 *
 * The card look of 5.6, for the cards of `caw/upcoming-events` and the theme's listings; the two displays of
 * `caw/menu`; the empty message of `caw/upcoming-events`; the log-in and join boxes of 5.7.
 * Colours only through preset variables; the colours of a context follow 2.6.
 */

/* 5.6 The card grid: one column below 600px, two from 600px, three from 768px. */
.caw-cards {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--wp--preset--spacing--60);
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 600px) {
	.caw-cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 768px) {
	.caw-cards {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* 5.6 The card: no border, no background, no padding, square corners. The title link covers the card, except the
   category links of a post card's meta line, which lie above it. */
.caw-card {
	position: relative;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
}

/* The image is 16:9 and as wide as the card. */
.caw-card__media {
	display: block;
}

.caw-card__media img {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.caw-card__media + .caw-card__body {
	margin-block-start: 0.75rem;
}

.caw-card__body > * {
	margin-block: 0;
}

.caw-card__body > * + * {
	margin-block-start: 0.375rem;
}

/* The meta line: size small, meta-grey. It holds no publication date (pattern contract 1.0.13): an event's start; the
   category links of a post or a webinar (1.0.9, 1.0.13); on a search card the type label first; and the "Members"
   label last, alone where the line holds nothing else. */
.caw-card__meta {
	color: var(--wp--preset--color--meta-grey);
	font-size: var(--wp--preset--font-size--small);
}

/* A category link: deep-teal, bold, never underlined; under the pointer and with keyboard focus ink (5.6, 1.4; pattern
   contract 1.0.11), and in a dark section the line's colour (below). It is lifted above the stretched title link
   (`.caw-card__title a::after`), which otherwise takes every click on the line; a click between the links still
   follows the title. */
.caw-card__meta a {
	position: relative;
	z-index: 1;
	color: var(--wp--preset--color--deep-teal);
	font-weight: 700;
	text-decoration: none;
}

.caw-card__meta a:is(:hover, :focus-visible) {
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.caw-card__type {
	font-weight: 700;
}

/* The "Members" label of a members-only item (decision 5 of 18 November, master rulings 95 and 138): a small outlined
   tag at the end of the card's small print, so that it reads as a label and not as part of what stands before it (an
   event's start, the category links, a search card's type label). On both card paths: the theme's meta line and the
   Date block of a Query Loop card, which holds the label alone (1.0.13). Its text and its border take the line's own
   colour (meta-grey on white 6.05:1, on mist 4.73:1; white in the dark sections), so it has no colour of its own.
   Upper case by style only: the page's text stays "Members". Never under 12 pixels. */
.caw-members-label {
	display: inline-block;
	margin-inline-start: 0.35em;
	padding: 0.1em 0.55em;
	border: 1px solid currentColor;
	font-size: max(0.8em, 0.75rem);
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1.35;
	text-transform: uppercase;
	vertical-align: 0.08em;
}

/* A label that opens its line (the line holds nothing else: a members-only webinar without a category, a members-only
   related post, the Date block of a members-only Query Loop item; 1.0.13) has no start margin: it stands on the line's
   edge. After a category link, a type label or an event's start it keeps the margin above. */
.caw-members-label:first-child {
	margin-inline-start: 0;
}

/* The title: deep-teal, Montserrat 900, size large (1.4 card title). Never underlined; under the pointer and with
   keyboard focus it takes the colour of 1.4 (pattern contract 1.0.11; below). Written
   with the card's class: a section style variation colours its headings with `:root :where(.is-style-… h3)`, of the
   same weight as one class and printed after this file, and the card keeps its own colour in every section style. */
.caw-card .caw-card__title {
	border: 0;
	color: var(--wp--preset--color--deep-teal);
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 900;
	line-height: 1.19;
	letter-spacing: 0.03125rem;
}

.caw-card__title a {
	color: inherit;
	text-decoration: none;
}

/* Under the pointer (on the title or the picture, the stretched link) and with keyboard focus: ink on a light ground;
   in a section-deep-teal nav.panelHover; on slate, teal-strong, sun and a Cover's photo the title's own colour; in a
   box (card, title panel, notice-info) inside a dark section or a Cover, ink again: a box sets its own colours. Each
   state rule says `text-decoration: none` itself, so that a plugin's `a:hover` underline cannot win over the rest rule
   (pattern contract 1.0.12). */
.caw-card__title a:is(:hover, :focus-visible) {
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.is-style-section-deep-teal .caw-card__title a:is(:hover, :focus-visible) {
	color: var(--wp--custom--nav--panel-hover);
	text-decoration: none;
}

:is(.is-style-section-slate, .is-style-section-teal-band, .is-style-notice-warning, .wp-block-cover) .caw-card__title a:is(:hover, :focus-visible) {
	color: inherit;
	text-decoration: none;
}

:is(.is-style-section-slate, .is-style-section-deep-teal, .is-style-section-teal-band, .wp-block-cover) :is(.is-style-card, .is-style-title-panel, .is-style-notice-info) .caw-card__title a:is(:hover, :focus-visible) {
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

/* The stretched link: a click anywhere on the card, the image included, follows the title, except a click on a
   category link of the meta line, which lies above it. */
.caw-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

/* Dark contexts (2.6): the meta line and the title are white; a category link takes the line's colour. Not inside a
   white box (card, title panel, notice-info) that stands in a dark section: there the card list has the colours it has
   on white (pattern contract 1.0.12; it had stood white on white at rest). The exclusion is in :where(), so the weight
   of both rules is as before. */
:is(.is-style-section-slate, .is-style-section-deep-teal, .is-style-section-teal-band) :is(.caw-card__meta, .caw-card__title):where(:not(:is(.is-style-card, .is-style-title-panel, .is-style-notice-info) *)) {
	color: var(--wp--preset--color--white);
}

:is(.is-style-section-slate, .is-style-section-deep-teal, .is-style-section-teal-band) .caw-card__meta a:where(:not(:is(.is-style-card, .is-style-title-panel, .is-style-notice-info) *)) {
	color: inherit;
}

/* 5.5 caw/menu: no bullets; a list item whose URL is "#" is a group title. */
.caw-menu__list,
.caw-menu__sub {
	margin: 0;
	padding: 0;
	list-style: none;
}

.caw-menu__heading {
	font-weight: 700;
}

/* Display "list": one link per line, children indented. */
.caw-menu--list .caw-menu__item {
	margin-block: 0.375rem;
}

.caw-menu--list .caw-menu__sub {
	padding-inline-start: var(--wp--preset--spacing--50);
}

/* Display "pills": the chapter pill menu. Top-level links are slate pills, children sun pills, shown in rows
   at every width. Hover and focus fill deep-teal. */
.caw-menu--pills .caw-menu__list,
.caw-menu--pills .caw-menu__sub {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.caw-menu--pills .caw-menu__item:has(> .caw-menu__sub) {
	flex-basis: 100%;
}

.caw-menu--pills .caw-menu__heading {
	display: block;
	margin-block-end: 0.5rem;
	color: var(--wp--preset--color--slate);
	font-family: var(--wp--preset--font-family--montserrat);
	text-transform: uppercase;
	letter-spacing: 0.0625rem;
}

.caw-menu--pills .caw-menu__link + .caw-menu__sub {
	margin-block-start: 0.5rem;
}

.caw-menu--pills .caw-menu__link {
	display: inline-block;
	padding: 0.4em 1.1em;
	border-radius: 999px;
	background-color: var(--wp--preset--color--slate);
	color: var(--wp--preset--color--white);
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.01em;
	text-transform: uppercase;
	text-decoration: none;
}

.caw-menu--pills .caw-menu__sub .caw-menu__link {
	background-color: var(--wp--preset--color--sun);
	color: var(--wp--preset--color--ink);
}

.caw-menu--pills .caw-menu__link:is(:hover, :focus-visible),
.caw-menu--pills .caw-menu__sub .caw-menu__link:is(:hover, :focus-visible) {
	background-color: var(--wp--preset--color--deep-teal);
	color: var(--wp--preset--color--white);
}

:is(.is-style-section-slate, .is-style-section-deep-teal, .is-style-section-teal-band) .caw-menu--pills .caw-menu__heading {
	color: var(--wp--preset--color--white);
}

/* 5.5 caw/upcoming-events with no event to show: a sentence on a panel. */
.caw-upcoming-events__empty {
	margin: 0;
	padding: var(--wp--preset--spacing--50);
	background-color: var(--wp--preset--color--panel);
	color: var(--wp--preset--color--ink);
}

/* 5.7 The log-in box and the join box: a 2px deep-teal frame. */
.caw-login-box,
.caw-join-box {
	box-sizing: border-box;
	margin-block: 0 var(--wp--preset--spacing--50);
	padding: var(--wp--preset--spacing--50);
	border: 2px solid var(--wp--preset--color--deep-teal);
	color: var(--wp--preset--color--ink);
}

.caw-join-box {
	background-color: var(--wp--preset--color--panel);
}

.caw-login-box__title {
	margin-block: 0 var(--wp--preset--spacing--40);
	color: var(--wp--preset--color--heading-grey);
}

.caw-join-box__text {
	margin-block: 0 var(--wp--preset--spacing--40);
}

/* The log-in form: label above field. */
.caw-login-box form p {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.375rem;
	margin-block: 0 var(--wp--preset--spacing--40);
}

.caw-login-box form p:last-child {
	margin-block-end: 0;
}

.caw-login-box label {
	color: var(--wp--preset--color--heading-grey);
	font-weight: 700;
}

.caw-login-box .login-remember label {
	font-weight: 400;
}

.caw-login-box :is(input[type="text"], input[type="password"]) {
	box-sizing: border-box;
	width: 100%;
	max-width: 24rem;
	min-height: 2.75rem;
	padding: 0 var(--wp--preset--spacing--30);
	border: 1px solid var(--wp--preset--color--meta-grey);
	border-radius: 0;
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--ink);
	font-size: 1rem;
}

/* The log-in button is the primary button of 2.5. The join box's link is `caw-button`, which the event HTML
   stylesheet already makes the primary button. */
.caw-login-box input[type="submit"] {
	box-sizing: border-box;
	min-height: 2.625rem;
	padding: 0.625rem 1.875rem;
	border: 2px solid var(--wp--preset--color--teal-strong);
	border-radius: 999px;
	background-color: var(--wp--preset--color--teal-strong);
	color: var(--wp--preset--color--white);
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: 0.1875rem;
	text-transform: uppercase;
	cursor: pointer;
}

.caw-login-box input[type="submit"]:is(:hover, :focus-visible) {
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--teal-strong);
}
