/*
Theme Name: Eluvia
Description: Block theme for a ledger-style news and register site: term sheets, dated rows and compact tables.
Text Domain: eluvia
Requires at least: 7.0
Requires PHP: 8.1
Version: 0.1.12
Update URI: false
*/

:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 3px solid var(--wp--preset--color--beacon);
	outline-offset: 2px;
}

:where(.wp-block-post-date, .wp-block-post-terms, td, th) {
	font-variant-numeric: tabular-nums;
}

a {
	text-decoration-thickness: var(--wp--custom--rule--hair);
	text-underline-offset: 0.2em;
}

.wp-block-separator {
	border-style: solid;
	border-width: 0 0 var(--wp--custom--rule--hair);
	color: var(--wp--preset--color--rule);
}

/* Masthead: title and tools on one line, the five sections under a firm rule. */
.masthead {
	padding-top: var(--wp--preset--spacing--clause);
}

.masthead-top {
	padding-bottom: var(--wp--preset--spacing--clause);
}

.rubric-bar,
.filter-strip {
	gap: var(--wp--preset--spacing--tab) var(--wp--preset--spacing--margin);
	padding: var(--wp--preset--spacing--tab) 0;
	border-top: var(--wp--custom--rule--firm) solid var(--wp--preset--color--slate);
	border-bottom: var(--wp--custom--rule--hair) solid var(--wp--preset--color--hairline);
}

.filter-strip {
	margin-bottom: var(--wp--preset--spacing--section);
}

/* The class lands on the nav and on its list: one pair of rules, not two. The five sections span the whole frame (no empty right half). */
@media (min-width: 37.5rem) {
	.rubric-bar .wp-block-navigation__container {
		flex: 1 1 auto;
		justify-content: space-between;
		padding: 0;
		border: 0;
	}
}

/* Phone masthead: the title, the search and the menu button share one row of at most 64px; a single firm rule closes it.
   The section list sits behind the menu button below 37.5rem, so the nav is a button-sized item next to the search. */
@media (max-width: 37.4375rem) {
	.masthead {
		display: flex;
		flex-wrap: nowrap;
		align-items: center;
		gap: var(--wp--preset--spacing--tab);
		padding-top: 0.375rem;
		padding-bottom: 0.75rem;
		border-bottom: var(--wp--custom--rule--firm) solid var(--wp--preset--color--slate);
	}

	.masthead-top {
		flex: 1 1 auto;
		flex-wrap: nowrap;
		min-width: 0;
		padding-bottom: 0;
	}

	nav.rubric-bar {
		flex: none;
		margin-block: 0;
		padding: 0;
		border: 0;
	}

	.masthead .wp-block-search__button {
		padding: 0;
	}
}

/* Colophon: the five service pages are numbered clauses of an ordered list. */
.colophon {
	margin-top: var(--wp--preset--spacing--part);
	padding-top: var(--wp--preset--spacing--section);
	padding-bottom: var(--wp--preset--spacing--section);
}

.clause-list {
	font-family: var(--wp--preset--font-family--headline-sans);
	font-size: var(--wp--preset--font-size--label);
	font-weight: 600;
}

.clause-list a {
	text-decoration: none;
}

/* Front matter of every page. */
.front {
	padding-top: var(--wp--preset--spacing--section);
}

.standfirst {
	margin-left: 0;
	margin-bottom: var(--wp--preset--spacing--section);
	max-width: 32ch;
}

.front > * + .wp-block-group.alignwide,
.lead-pair {
	margin-top: var(--wp--preset--spacing--part);
}

.lead-pair {
	gap: var(--wp--preset--spacing--section);
}

.lead-pair .wp-block-post-template > li {
	padding: var(--wp--preset--spacing--clause) 0;
	border-top: var(--wp--custom--rule--hair) solid var(--wp--preset--color--hairline);
}

.term-lead > * + * {
	margin-top: var(--wp--preset--spacing--clause);
}

/* One deal per line: date, headline, sector, subject. */
.deal-line {
	display: grid;
	grid-template-columns: var(--wp--custom--terms-row);
	gap: var(--wp--preset--spacing--tab) var(--wp--preset--spacing--clause);
	padding: var(--wp--preset--spacing--clause) 0;
	border-top: var(--wp--custom--rule--hair) solid var(--wp--preset--color--hairline);
}

.deal-line {
	grid-template-columns: 1fr;
	align-items: start;
}

.deal-line:has(.wp-block-post-featured-image) {
	grid-template-columns: 8rem minmax(0, 1fr);
}

.deal-line > * {
	grid-column: 1 / -1;
	min-width: 0;
}

.deal-line:has(.wp-block-post-featured-image) > :not(.wp-block-post-featured-image) {
	grid-column: 2;
}

.deal-line .wp-block-post-featured-image {
	grid-column: 1;
	grid-row: 1 / span 4;
	width: 100%;
	max-width: 8rem;
}

.wp-block-post-featured-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.deal-line > *,
.consolidator-card > * {
	margin: 0;
}

.consolidator-card {
	display: grid;
	gap: var(--wp--preset--spacing--tab);
	padding: var(--wp--preset--spacing--clause);
	background: var(--wp--preset--color--vellum);
}

.field-label {
	margin: 0;
	color: var(--wp--preset--color--pencil);
	font-family: var(--wp--preset--font-family--headline-sans);
	font-size: var(--wp--preset--font-size--footnote);
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.stake-ai-note {
	margin: var(--wp--preset--spacing--tab) 0 0;
	color: var(--wp--preset--color--pencil);
	font-size: var(--wp--preset--font-size--footnote);
}

.tally-box {
	padding: var(--wp--preset--spacing--section);
}

.deal-file {
	display: grid;
	gap: var(--wp--preset--spacing--tab);
	padding: var(--wp--preset--spacing--clause) 0;
	border-top: var(--wp--custom--rule--firm) solid var(--wp--preset--color--slate);
}

.term-note {
	gap: var(--wp--preset--spacing--section);
	margin-top: var(--wp--preset--spacing--section);
}

.term-lead {
	padding-top: var(--wp--preset--spacing--clause);
	border-top: var(--wp--custom--rule--firm) solid var(--wp--preset--color--slate);
}

.deal-line:hover,
.deal-line:focus-within {
	background: var(--wp--preset--color--vellum);
}

.deal-line .wp-block-post-terms {
	align-self: start;
	padding-top: var(--wp--preset--spacing--tick);
}

.consolidator-card {
	border-top: var(--wp--custom--rule--firm) solid var(--wp--preset--color--slate);
}

.tally-box {
	border-left: var(--wp--preset--spacing--tab) solid var(--wp--preset--color--slate);
}

.tally-box .wp-block-post-title {
	margin: var(--wp--preset--spacing--tab) 0 var(--wp--preset--spacing--clause);
	font-variant-numeric: lining-nums tabular-nums;
}

.tally-box .wp-block-buttons {
	margin-top: var(--wp--preset--spacing--margin);
}

.deal-file > .wp-block-group {
	padding-bottom: var(--wp--preset--spacing--tab);
	border-bottom: var(--wp--custom--rule--hair) solid var(--wp--preset--color--hairline);
}

/* A meta row whose value is empty (no sector, no subject, no byline) is not shown with a bare label. */
.deal-file > .wp-block-group:not(:has(.wp-block-post-terms a, .wp-block-post-author-name)) {
	display: none;
}

@media (max-width: 781px) {
	.term-note {
		flex-direction: column-reverse;
	}

	.term-note--natural {
		flex-direction: column;
	}

	.term-note > .wp-block-column {
		min-width: 0;
		max-width: 100%;
	}
}

/* Targets of at least 2.75rem in the side column. */
.deal-file a {
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
}

/* Deal line below 40rem: date and headline take a full row, the terms follow in one line. */
@media (max-width: 40rem) {
	.deal-line {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
	}

	.deal-line > .wp-block-post-date,
	.deal-line > .wp-block-post-title {
		flex-basis: 100%;
	}

	.deal-line .wp-block-post-featured-image {
		flex-basis: 100%;
		max-width: none;
	}
}

@media (forced-colors: active) {
	.tally-box,
	.term-lead,
	.deal-file,
	.consolidator-card {
		border-color: CanvasText;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition: none !important;
		animation: none !important;
	}
}

.wp-block-post-author__byline { font-size: 0.8125rem; }

/* Short pages: the footer sits at the bottom of the viewport. */
.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

.wp-site-blocks > main {
	flex: 1 0 auto;
}

/* Search button: the palette colour, not the core default grey. */
.wp-block-search .wp-block-search__button {
	background: var(--wp--preset--color--slate);
	color: var(--wp--preset--color--paper);
}

.wp-block-search .wp-block-search__button.has-icon {
	background: transparent;
	color: var(--wp--preset--color--slate);
}
