/*
 * Events & Calls page, single event, search results and 404.
 *
 * From the Round 2 comps (docs repo, docs/design-round-2/): the ruled event
 * rows are Home's events panel (build-r2-home.py EVENTS_CSS) in the
 * Events & Calls page's headless form (templates/events-calls); the page
 * head, crumb, stacked meta and section bands are the single exhibition's
 * (components.py TEMPLATE_CSS); the archive handoff is the Exhibitions
 * hub's red archive band. Search results and the 404 follow the signed
 * wireframes (sheets 10 and the 404 in M4c), built from those pieces.
 *
 * The markup of the listing, the event head, the access section and the
 * archive band comes from grunt-core (includes/events.php, search.php).
 */

/* ---- Template frame ------------------------------------------------------ */

.grunt-tpl {
	padding: 0 var(--g) 23px;
}

.grunt-tpl > * {
	margin-block: 0;
}

/* Page head: 16px under the title (comp .tpl-head); the top measured
   against the R2 Events & Calls comp at 1440. */
.grunt-tpl .grunt-tpl-head {
	padding: 16px 0 0;
	margin: 0 0 16px;
}

/* fs-xl, no tracking (Alanna, 2026-09-11); 37px on a phone (mobile comps). */
.grunt-tpl .grunt-tpl-title {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--xl);
	font-weight: 700;
	line-height: 0.94;
	letter-spacing: 0;
	margin: 0;
	text-wrap: balance;
	overflow-wrap: break-word;
}

@media (max-width: 640px) {
	.grunt-tpl .grunt-tpl-title {
		font-size: var(--wp--preset--font-size--h-3);
		line-height: 1;
	}
}

/* Breadcrumb: 16px muted, 40px over the title (comp .tpl-crumb). */
.grunt-tpl .grunt-crumb ol {
	list-style: none;
	margin: 0 0 40px;
	padding: 0;
	font-size: var(--wp--preset--font-size--body-s);
	color: var(--wp--preset--color--text-muted);
}

.grunt-tpl .grunt-crumb li {
	display: inline;
}

.grunt-tpl .grunt-crumb li + li::before {
	content: "\203A";
	padding: 0 0.3em;
}

.grunt-tpl .grunt-crumb a {
	color: var(--wp--preset--color--text-muted);
}

/* Stacked values under the title, the first a step up (comp .tpl-meta). */
.grunt-tpl .grunt-tpl-meta {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin: 22px 0 0;
}

.grunt-tpl .grunt-tpl-meta .grunt-tpl-val {
	font-size: var(--wp--preset--font-size--body);
	font-weight: 600;
	margin: 0;
}

.grunt-tpl .grunt-tpl-meta .grunt-tpl-val-lg {
	font-size: var(--wp--preset--font-size--lead-lg);
	font-weight: 700;
}

/* Reading column (comp .tpl-prose): 18px, 66ch, never wider than the
   column itself: 66ch is 745px, wider than a phone, and this rule outranks
   core's max-width: 100% on a fixed-width player (style.css, Media). */
.grunt-tpl .grunt-prose > * {
	max-width: min(66ch, 100%);
}

.grunt-tpl .grunt-prose p,
.grunt-tpl .grunt-prose li {
	font-size: var(--wp--preset--font-size--body);
	line-height: 1.62;
}

.grunt-tpl .grunt-prose p {
	margin: 0 0 16px;
}

.grunt-tpl .grunt-prose > :last-child {
	margin-bottom: 0;
}

/* Single event Accessibility: the event's own access text when set, under
   its "Accessibility for this event" h2 (Alanna, 2026-11-09), drawn as a
   page section heading with its rule (pages.css), then the Visit page's tile to the general
   access info (pages.css Tiles), no heading or rule over it (Alanna,
   2026-10-28). The tile list spans the column as
   on Visit & Access, so the tile is a third of the row on a wide screen and
   the whole row on a phone. The 48px above is the old band's. */
.grunt-tpl .grunt-event-access {
	margin-top: 48px;
}

.grunt-tpl .grunt-event-access > .grunt-hub-list {
	margin: 0;
}

.grunt-tpl .grunt-event-access > .grunt-prose + .grunt-hub-list {
	margin-top: var(--tpy);
}

/* ---- Events list (Home's ruled rows; headless on Events & Calls) --------- */

/* One line above the listing: the 2px section rule sits on the list and the
   first row drops its own 1px rule (Alanna, 2026-09-11). */
/* The band's pad plus the comp grid's gap above the list. */
.grunt-events {
	padding: calc(var(--tpy) + var(--g)) 0 0;
}

.grunt-events .evlist {
	list-style: none;
	margin: 0;
	padding: 0;
	border-top: 2px solid var(--wp--preset--color--text);
	border-bottom: 1px solid var(--wp--preset--color--text);
}

/* The date column is at least as wide as the longest single date with its
   weekday, "WEDNESDAY, SEPTEMBER 30, 2026" (262.5px in the 14px label at
   0.05em tracking), so a dated row's date keeps to one line; a recurring
   series may still take two (Alanna, 2026-11-09). Before, 128px: the
   comp's 1.5fr. An exhibition's typed programming rows (exhibitions.css
   .grunt-progrow) keep the same columns. */
.grunt-events .evrow {
	display: grid;
	grid-template-columns: minmax(268px, 1.5fr) minmax(78px, 1fr) 5.4fr 28px;
	gap: 0 24px;
	align-items: baseline;
	padding: 18px var(--evrow-inset);
	margin: 0;
	border-top: 1px solid var(--wp--preset--color--text);
}

/* The row's text sits --evrow-inset in from the ends of its rules, always,
   so the hover grey (below) can stop at the rules without the text touching
   its edge, and nothing moves on hover (Alanna, 2026-10-08). Half the
   gutter: 12px at every width (8px on a phone before 2026-10-29). Set on the list's wrappers so an
   exhibition's typed programming rows (programming.css) take the same. */
.grunt-events,
.grunt-programming {
	--evrow-inset: calc(var(--g) / 2);
}

/* The title comes first in the source; the grid puts it third. */
.grunt-events .evwhen {
	grid-column: 1;
	grid-row: 1;
}

.grunt-events .evtime {
	grid-column: 2;
	grid-row: 1;
}

.grunt-events .evmain {
	grid-column: 3;
	grid-row: 1;
}

.grunt-events .evarrow {
	grid-column: 4;
	grid-row: 1;
}

.grunt-events .evrow:first-child {
	border-top: 0;
}

/* Sentence case in the markup, capitals here (Kay's screen-reader note). */
.grunt-events .evwhen,
.grunt-events .evtime {
	font-size: var(--wp--preset--font-size--label);
	font-weight: 400;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--wp--preset--color--text-muted);
}

.grunt-events .evmain {
	min-width: 0;
}

.grunt-events .evtitle {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--body);
	font-weight: 700;
	letter-spacing: -0.015em;
	line-height: 1.2;
	margin: 0;
	text-wrap: pretty;
}

/* The title is the row's only link, and the whole row is its target
   (Katrina's R2 feedback #9): the link's ::after covers the row, so a
   screen reader still meets one link per row, named by the title. Hover
   anywhere on the row underlines the title; keyboard focus rings the row.

   Hover or keyboard focus also lays a very light grey (the surface token)
   behind the whole row (Alanna, 2026-10-07): the row's ::before (a click
   or tap that focuses the link does not). It never reaches
   beyond the row (Alanna, 2026-10-08): its left and right edges are the
   ends of the row's rules, and the text keeps off its edge by the row's
   own --evrow-inset. The link's ::after is the same box, so the grey and
   the clickable area match. Every list of these rows gets it: Home's
   panel, the Events & Calls page and an exhibition's Programming & events
   band. */
.grunt-events .evrow {
	--evrow-hover-bg: var(--wp--preset--color--surface);
	position: relative;
	isolation: isolate;
}

.grunt-events .evrow::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: transparent;
}

/* Hover only where a pointer hovers: iOS keeps :hover after a tap, which
   would leave the row grey on coming back from the event page. */
@media (hover: hover) {
	.grunt-events .evrow:hover::before {
		background: var(--evrow-hover-bg);
	}
}

.grunt-events .evtitle a {
	color: var(--wp--preset--color--text);
	text-decoration: none;
}

.grunt-events .evtitle a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.grunt-events .evrow:hover .evtitle a,
.grunt-events .evtitle a:focus-visible {
	color: var(--wp--preset--color--accent);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Only where :has() works; elsewhere the link keeps its own focus ring.
   The ring is drawn just inside the grey's edge (offset minus its width),
   so it marks the whole clickable area and stays within the row's rules
   and the column. */
@supports selector(:has(*)) {
	.grunt-events .evtitle a:focus-visible {
		outline: none;
	}

	.grunt-events .evrow:has(.evtitle a:focus-visible)::before {
		background: var(--evrow-hover-bg);
		outline: 3px solid var(--wp--preset--color--accent);
		outline-offset: -3px;
	}
}

.grunt-events .evnote {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--body-s);
	font-weight: 400;
	line-height: 1.5;
	color: var(--wp--preset--color--text-muted);
	margin: 8px 0 0;
	max-width: 70ch;
	letter-spacing: 0;
}

/* 16px (GRUNT_EVENT_ARROW: the comps' 12px scaled up, Alanna 2026-10-07);
   the 28px column holds it. */
.grunt-events .evarrow {
	color: var(--wp--preset--color--accent);
	justify-self: end;
	align-self: center;
}

/* Between the phone layout and 900px the one-line date would leave the
   title too little room (123px at 641), so the date wraps there, as it
   did before (the comp's 128px minimum). */
@media (max-width: 899px) {
	.grunt-events .evrow {
		grid-template-columns: minmax(128px, 1.5fr) minmax(78px, 1fr) 5.4fr 28px;
	}
}

/* Narrow: the text columns stack, the arrow keeps its column beside the
   date (comp). */
@media (max-width: 640px) {
	.grunt-events .evrow {
		grid-template-columns: 1fr 28px;
	}

	.grunt-events .evwhen {
		grid-column: 1;
		grid-row: 1;
	}

	.grunt-events .evtime {
		grid-column: 1;
		grid-row: 2;
	}

	.grunt-events .evtime:empty {
		display: none;
	}

	.grunt-events .evmain {
		grid-column: 1;
		grid-row: 3;
		margin-top: 8px;
	}

	.grunt-events .evarrow {
		grid-column: 2;
		grid-row: 1;
		align-self: start;
	}
}

/* The page's own text under the list (the body staff edit in the page
   editor; on live, the Vimeo and social media lines). Reading column and
   18px body from .grunt-prose; 20px under the list. An empty body draws no
   block, so no gap. */
.grunt-tpl .grunt-ec-body {
	margin: 20px 0 0;
}

/* Then the Submissions band, last before the footer (Alanna, 2026-10-19):
   the archive band's red band (exhibitions.css .grunt-archive), with the
   Past exhibitions page's spacing: one gutter above it, and the mosaic's
   one gutter under it in place of this frame's 23px. */
.grunt-tpl.grunt-ec {
	padding-bottom: var(--g);
}

.grunt-tpl .grunt-archive {
	margin-top: var(--g);
}

/* ---- Single event --------------------------------------------------------- */

/* Registration: the design system's black button. */
.grunt-event-register {
	margin: 28px 0 0;
}

.grunt-event-register__link {
	display: inline-block;
	background: var(--wp--preset--color--button-ink);
	color: #fff;
	padding: 12px 26px;
	font-size: var(--wp--preset--font-size--body);
	font-weight: 700;
	text-decoration: none;
}

.grunt-event-register__link:hover {
	background: var(--wp--preset--color--accent);
	color: #fff;
}

.grunt-event-register__link:hover .grunt-ext {
	color: #fff;
}

/* The picture itself (never cropped, never stretched; beside the text
   from 800px, the full content width below) shares the single project's
   rule in pages.css (Alanna, 2026-10-21 and 2026-10-28). */
.grunt-tpl .grunt-event-image {
	margin-top: 32px;
}

.grunt-tpl .grunt-event-body {
	margin-top: 32px;
}

/* Headings in the event body: the reading column's heading spacing (pages
   .grunt-pg-prose h3; comp .tpl-access h3), room above and 9px below, so a
   heading never sits flush on the paragraph under it. An h2 is a section
   heading instead, with the page h2's rule and spacing, also first in the
   text (pages.css; Alanna, 2026-11-10): the first-child rule below then
   applies to h3 to h6 only. Beside a featured picture, from 800px, a
   leading h2's rule runs over picture and text, as on a project (pages.css,
   "Single project and event: the featured picture"). */
.grunt-tpl .grunt-event-body > :is(h2, h3, h4, h5, h6) {
	margin: var(--tpy) 0 9px;
}

.grunt-tpl .grunt-event-body > :is(h2, h3, h4, h5, h6):first-child {
	margin-top: 0;
}

/* ---- Search results and 404 ---------------------------------------------- */

.grunt-tpl .grunt-page-search {
	margin: 24px 0 0;
	max-width: 640px;
}

.grunt-page-search .wp-block-search__inside-wrapper {
	display: flex;
	padding: 0;
	border: 0;
}

.grunt-page-search .wp-block-search__input {
	-webkit-appearance: none;
	appearance: none;
	flex: 1 1 auto;
	min-width: 0;
	border: 2px solid var(--wp--preset--color--text);
	border-right: 0;
	border-radius: 0;
	padding: 10px 14px;
	font-size: var(--wp--preset--font-size--body);
	color: var(--wp--preset--color--text);
	background: var(--wp--preset--color--bg);
}

/* No native clear button (Safari draws one in the field once it has a
   value, crowding the text); the comp's field is plain. */
.grunt-page-search .wp-block-search__input::-webkit-search-cancel-button,
.grunt-page-search .wp-block-search__input::-webkit-search-decoration {
	-webkit-appearance: none;
	appearance: none;
	display: none;
}

.grunt-page-search .wp-block-search__button {
	margin: 0;
	border: 0;
	border-radius: 0;
	background: var(--wp--preset--color--button-ink);
	color: #fff;
	padding: 0 22px;
	font-size: var(--wp--preset--font-size--body);
	font-weight: 700;
}

.grunt-page-search .wp-block-search__button:hover {
	background: var(--wp--preset--color--accent);
}

.grunt-tpl .grunt-results {
	margin-top: 32px;
}

.grunt-results__list {
	list-style: none;
	margin: 0;
	padding: 0;
	border-top: 2px solid var(--wp--preset--color--text);
	border-bottom: 1px solid var(--wp--preset--color--text);
}

.grunt-results__list > li {
	padding: 18px 0;
	margin: 0;
	border-top: 1px solid var(--wp--preset--color--text);
}

.grunt-results__list > li:first-child {
	border-top: 0;
}

.grunt-results__list > li > * {
	margin: 0;
}

.grunt-result-type {
	font-size: var(--wp--preset--font-size--label);
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--wp--preset--color--text-muted);
}

.grunt-results__list .grunt-result-title {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--lead);
	font-weight: 700;
	letter-spacing: -0.015em;
	line-height: 1.2;
	margin-top: 6px;
}

.grunt-results__list .grunt-result-title a {
	color: var(--wp--preset--color--text);
	text-decoration: none;
}

.grunt-results__list .grunt-result-title a:hover {
	color: var(--wp--preset--color--accent);
	text-decoration: underline;
}

.grunt-results__none {
	font-size: var(--wp--preset--font-size--body);
	margin: 0;
}

.grunt-results__pages {
	margin-top: 24px;
	font-weight: 700;
}

/* The archive handoff: the hub's red band (comp .tpl-archive with .red and
   .dlink). All of it is 21px bold; white on this red is
   5.06:1. */
.grunt-tpl .grunt-archive-handoff {
	margin-top: 48px;
	background: var(--wp--preset--color--accent);
	color: #fff;
	padding: var(--tpy) var(--tp) calc(var(--tpy) + 6px);
}

.grunt-archive-handoff .grunt-archive-handoff__head,
.grunt-archive-handoff .grunt-archive-handoff__line {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--lead);
	font-weight: 700;
	line-height: 1.35;
	letter-spacing: 0;
	margin: 0;
}

.grunt-archive-handoff .grunt-archive-handoff__line {
	margin-top: 8px;
}

.grunt-archive-handoff a {
	color: #fff;
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
	overflow-wrap: anywhere;
}

.grunt-archive-handoff a:hover,
.grunt-archive-handoff a:hover .grunt-ext {
	color: var(--wp--preset--color--button-ink);
}

.grunt-archive-handoff .grunt-ext {
	color: #fff;
}

.grunt-archive-handoff :focus-visible {
	outline-color: var(--wp--preset--color--button-ink);
}

.grunt-tpl .grunt-404__line {
	margin: 24px 0 0;
	font-size: var(--wp--preset--font-size--body);
	max-width: 66ch;
}

/* ---- Body copy on phones (see style.css) ---------------------------------- */

@media (max-width: 599px) {
	.grunt-tpl .grunt-prose p,
	.grunt-tpl .grunt-prose li,
	.grunt-results__none,
	.grunt-tpl .grunt-404__line {
		font-size: var(--wp--preset--font-size--body-s);
	}
}
