/* Binate Thoughts — CSS that theme.json can't express.
 *
 * Every rule here is here because theme.json has no equivalent:
 *   - pseudo-elements (::before / ::after)
 *   - attribute selectors (e.g. [aria-pressed="true"])
 *   - runtime CSS-var overrides driven by a <html data-theme> attribute
 *   - line-clamp + overflow utilities
 *   - grid-template-columns and other layout properties
 *   - @media (prefers-reduced-motion / print) rules
 *   - container max-width on top-level template-part wrappers
 *
 * Anything else lives in theme.json. Do not duplicate tokens or per-block
 * typography/color/spacing here.
 */

/* --- 1. Visitor light/dark toggle: per-visitor CSS-var override --------- *
 * theme.json's style variations can swap palettes for the Site Editor, but
 * the front-end <html data-theme=light|dark> attribute is a runtime switch
 * — neither variation file nor a per-block style can react to it. Override
 * the preset color custom properties here. */
[data-theme="light"] {
	--wp--preset--color--bg:        oklch(0.972 0.006 80);
	--wp--preset--color--bg-edge:   oklch(0.945 0.006 80);
	--wp--preset--color--ink:       oklch(0.18 0.006 60);
	--wp--preset--color--ink-soft:  oklch(0.38 0.006 60);
	--wp--preset--color--ink-faint: oklch(0.48 0.006 60);
	--wp--preset--color--rule:      oklch(0.85 0.006 60);
	--wp--preset--color--rule-soft: oklch(0.91 0.006 60);
}

/* --- 2. Container width: top-level wrappers cap at 1240px --------------- *
 * theme.json's wideSize / contentSize constrain DIRECT CHILDREN of a
 * layout-constrained group. Top-level <header>/<footer> template-parts
 * are not in such a group, so we constrain them with CSS to match <main>.
 * The padding-left/right uses WP's root padding custom properties so it
 * stays in sync with theme.json's spacing.padding. */
.wp-site-blocks > .wp-block-template-part,
.wp-site-blocks > main {
	max-width: 1240px;
	margin-left: auto !important;
	margin-right: auto !important;
}
.wp-site-blocks > .wp-block-template-part {
	padding-left: var(--wp--style--root--padding-left);
	padding-right: var(--wp--style--root--padding-right);
	box-sizing: border-box;
}

/* --- 3. Theme toggle: container + aria-pressed state -------------------- *
 * The container is a wp:html block so it can't get typography from
 * theme.json. Its child <button>s inherit from it. */
.bt-theme-toggle {
	display: inline-flex;
	align-items: baseline;
	gap: var(--wp--preset--spacing--xs);
	margin-left: var(--wp--preset--spacing--md);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--meta);
	letter-spacing: 0.08em;
	text-transform: uppercase;
}
.bt-theme-toggle__btn {
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	color: var(--wp--preset--color--ink);
	line-height: 1.4;
	border-bottom: 1px solid transparent;
}
.bt-theme-toggle__btn[aria-pressed="true"] {
	color: var(--wp--preset--color--accent);
	border-bottom-color: currentColor;
}
.bt-theme-toggle__btn:hover { color: var(--wp--preset--color--accent); }
.bt-theme-toggle__sep { color: var(--wp--preset--color--rule); }

/* --- 4. Archive list: borders + hover wash + grid ------------------------ *
 * Per-block styles in theme.json can't address pseudo-elements, list-item
 * borders, grid-template-columns, or :hover transforms. */
.bt-archive .wp-block-post-template,
.bt-archive ul.wp-block-post-template {
	margin: 0;
	padding: 0;
	list-style: none;
}
.bt-archive .wp-block-post {
	margin: 0;
	padding: 0;
	border-top: 1px solid var(--wp--preset--color--rule-soft);
	list-style: none;
}
.bt-archive .wp-block-post:last-child {
	border-bottom: 1px solid var(--wp--preset--color--rule-soft);
}
.bt-archive-row {
	position: relative;
	z-index: 0;
	isolation: isolate;
	display: grid;
	grid-template-columns: 36px 56px minmax(0, 1fr) auto;
	gap: clamp(16px, 3vw, 40px);
	align-items: center;
	padding: 22px 12px;
	margin: 0 -12px;
	color: inherit;
	text-decoration: none;
}
.bt-archive-row::before {
	content: "";
	position: absolute;
	inset: -1px 0;
	background: var(--wp--preset--color--bg-edge);
	opacity: 0;
	z-index: -1;
	transition: opacity .25s ease;
}
.bt-archive-row:hover::before,
.bt-archive-row:focus-within::before { opacity: 1; }
.bt-archive-row__main {
	display: grid;
	gap: 4px;
	min-width: 0;
	transition: transform .25s cubic-bezier(.2,.6,.2,1);
}
.bt-archive-row__main > *,
.bt-archive-row__main .wp-block-post-title,
.bt-archive-row__main .wp-block-post-excerpt,
.bt-archive-row__main .wp-block-post-excerpt p { margin: 0; }
.bt-archive-row:hover .bt-archive-row__main { transform: translateX(6px); }
.bt-archive-row:hover .bt-archive-row__title,
.bt-archive-row:hover .bt-archive-row__index,
.bt-archive-row:hover .bt-archive-row__drawing { color: var(--wp--preset--color--accent); }

/* Excerpt one-line clamp — `display: -webkit-box` + `-webkit-line-clamp`
 * has no theme.json equivalent. Type tokens come from theme.json. */
.bt-archive-row__excerpt {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 1;
	overflow: hidden;
}

@media (max-width: 720px) {
	.bt-archive-row { grid-template-columns: 36px minmax(0, 1fr); }
	.bt-archive-row__drawing { display: none; }
	.bt-archive-row__date {
		grid-column: 2;
		font-size: 10.5px;
		color: var(--wp--preset--color--ink-faint);
	}
}

/* --- 5. Lead post grid + layout ----------------------------------------- *
 * grid-template-columns + clamp() aren't in theme.json. Vertical padding
 * (80px 0 120px) is set as an inline block attribute on the .bt-lead
 * group in patterns/lead-post.php. */
.bt-lead {
	display: grid;
	grid-template-columns: minmax(0, 1fr) clamp(280px, 36%, 460px);
	gap: clamp(32px, 6vw, 96px);
	align-items: start;
}
@media (max-width: 880px) {
	.bt-lead { grid-template-columns: 1fr; }
	.bt-lead__art { order: 2; }
	.bt-lead__art .wp-block-binate-molnar-drawing { width: 100%; }
}
.bt-lead__excerpt { max-width: 58ch; }

/* SERIES <-> QUADRILATERALS caption row: flex justify (the layout attr in
 * the lead-post pattern doesn't reliably apply, hence the override). */
.bt-series-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: var(--wp--preset--spacing--md);
}

/* --- 6. Epigraph: cite element styling ---------------------------------- *
 * theme.json can style core/quote at the block level (already in theme.json
 * with border-left accent + italic serif), but the inner <cite> element
 * doesn't have a per-block selector. */
.wp-block-quote.is-style-epigraph {
	max-width: 56ch;
	margin-inline: auto;
}
.wp-block-quote.is-style-epigraph cite {
	display: block;
	margin-top: var(--wp--preset--spacing--sm);
	font-style: normal;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--meta);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--wp--preset--color--ink-faint);
}

/* --- 7. Tag list separator ---------------------------------------------- *
 * The "/" between tags is a pseudo-element — theme.json can't do it.
 * Type tokens for the tags come from theme.json's core/post-terms style. */
.bt-tags a + a::before {
	content: " / ";
	color: var(--wp--preset--color--rule);
}

/* --- 8. Featured drawing figcaption -------------------------------------- *
 * The figure's max-width and margins are set as inline block attributes
 * on the wrapping group in templates/single.html. theme.json elements
 * doesn't include `figcaption`, so its typography stays here. */
.bt-featured-drawing figcaption {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--meta);
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--wp--preset--color--ink-faint);
	margin-top: var(--wp--preset--spacing--sm);
	text-align: right;
}

/* --- 9. Pager: hairline rule between current page and next number ------- *
 * Pure pseudo-element. Type/color tokens come from theme.json's
 * core/query-pagination block style. */
.bt-pager .wp-block-query-pagination-numbers {
	display: inline-flex;
	align-items: center;
	gap: 18px;
}
.bt-pager .page-numbers { font-variant-numeric: tabular-nums; }
.bt-pager .page-numbers.current { color: var(--wp--preset--color--ink); }
.bt-pager .page-numbers.dots { color: var(--wp--preset--color--rule); letter-spacing: 0; }
.bt-pager .wp-block-query-pagination-numbers .page-numbers.current + .page-numbers::before {
	content: "";
	display: inline-block;
	width: 64px;
	height: 1px;
	background: var(--wp--preset--color--rule);
	margin-right: 18px;
	vertical-align: middle;
}
.bt-pager .wp-block-query-pagination-next,
.bt-pager .wp-block-query-pagination-previous {
	text-transform: uppercase;
	color: var(--wp--preset--color--ink);
	margin-left: auto;
}

/* --- 10. Focus ring ------------------------------------------------------ *
 * Global :focus-visible — theme.json's elements.link:focus is link-only. */
:focus-visible {
	outline: 1px solid var(--wp--preset--color--accent);
	outline-offset: 4px;
}

/* --- 11. Reduced motion -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.bt-archive-row__main { transition: none; }
	.bt-archive-row:hover .bt-archive-row__main { transform: none; }
	.bt-theme-toggle__btn { transition: none; }
}

/* --- 12. Print ----------------------------------------------------------- */
@media print {
	.masthead,
	.bt-theme-toggle,
	.wp-block-binate-molnar-drawing { display: none !important; }
}
