/* Art Spiel site styles, on top of theme.json */

/*
 * Dark mode. Colors live in theme.json (palette and settings.custom); this only swaps
 * their values. It follows the device unless the visitor chose with the toggle, which
 * sets data-theme on <html> before the page paints. Artwork is never filtered.
 */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		color-scheme: dark;
		--wp--preset--color--base: #121212;
		--wp--preset--color--contrast: #ededed;
		--wp--preset--color--muted: #b8b8b8;
		--wp--preset--color--accent: #ff6b6b;
		--wp--preset--color--surface: #1e1e1e;
		--wp--custom--color--subtle: #9a9a9a;
		--wp--custom--color--line: #2e2e2e;
		--wp--custom--color--line-strong: #5c5c5c;
		--wp--custom--color--surface-alt: #2a2a2a;
		--wp--custom--color--faint: #5c5c5c;
		--wp--custom--color--panel: #262626;
		--as-shadow: rgba(0, 0, 0, .5);
		--as-old-highlight: transparent;
		--as-old-white: transparent;
	}
}
:root[data-theme="dark"] {
	color-scheme: dark;
	--wp--preset--color--base: #121212;
	--wp--preset--color--contrast: #ededed;
	--wp--preset--color--muted: #b8b8b8;
	--wp--preset--color--accent: #ff6b6b;
	--wp--preset--color--surface: #1e1e1e;
	--wp--custom--color--subtle: #9a9a9a;
	--wp--custom--color--line: #2e2e2e;
	--wp--custom--color--line-strong: #5c5c5c;
	--wp--custom--color--surface-alt: #2a2a2a;
	--wp--custom--color--faint: #5c5c5c;
	--wp--custom--color--panel: #262626;
	--as-shadow: rgba(0, 0, 0, .5);
	--as-old-highlight: transparent;
	--as-old-white: transparent;
}

/*
 * Older articles have colors typed into them. Their dark grays and reds follow the
 * theme, and pale backgrounds drop out in dark mode. The red donate buttons stay.
 * The editor no longer offers these colors, so new posts can't add more.
 */
.wp-block-post-content :is([style*="color:#000000" i],[style*="color: #000000" i],[style*="color:#000" i],[style*="color: #000" i],[style*="color:#333333" i],[style*="color: #333333" i],[style*="color:#333" i],[style*="color: #333" i],[style*="color:#222222" i],[style*="color: #222222" i],[style*="color:#222" i],[style*="color: #222" i],[style*="color:#444444" i],[style*="color: #444444" i],[style*="color:#444" i],[style*="color: #444" i],[style*="color:#202020" i],[style*="color: #202020" i],[style*="color:#3b3838" i],[style*="color: #3b3838" i]) { color: var(--wp--preset--color--contrast) !important; }
.wp-block-post-content :is([style*="color:#666666" i],[style*="color: #666666" i],[style*="color:#666" i],[style*="color: #666" i],[style*="color:#808080" i],[style*="color: #808080" i]) { color: var(--wp--preset--color--muted) !important; }
.wp-block-post-content :is([style*="color:#e41212" i],[style*="color: #e41212" i],[style*="color:#ed1d1d" i],[style*="color: #ed1d1d" i],[style*="color:#e03a3a" i],[style*="color: #e03a3a" i],[style*="color:#ec1111" i],[style*="color: #ec1111" i],[style*="color:#ed1a1a" i],[style*="color: #ed1a1a" i]) { color: var(--wp--preset--color--accent) !important; }
.wp-block-post-content .has-black-color { color: var(--wp--preset--color--contrast) !important; }
.wp-block-post-content :is(.has-vivid-red-color, .has-vivid-red-color a) { color: var(--wp--preset--color--accent) !important; }
.wp-block-post-content .has-white-color { color: #fff !important; }
.wp-block-post-content [style*="background-color:#e5ebf1" i] { background-color: var(--as-old-highlight, #e5ebf1) !important; }
.wp-block-post-content [style*="background-color:#ffffff" i] { background-color: var(--as-old-white, #fff) !important; }
.wp-block-post-content .has-white-background-color { background-color: var(--as-old-white, #fff) !important; }
.wp-block-post-content [style*="background-color:#cf2e2e" i] { background-color: #cf2e2e !important; }

/* Dark mode toggle */
.artspiel-masthead-links { display: flex; align-items: center; gap: .75rem; }
.artspiel-theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -.75rem -.75rem -.75rem 0; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.artspiel-theme-toggle[hidden] { display: none; }
.artspiel-theme-toggle svg { width: 18px; height: 18px; fill: currentColor; }
.artspiel-theme-toggle .is-sun, .artspiel-theme-toggle[aria-pressed="true"] .is-moon { display: none; }
.artspiel-theme-toggle[aria-pressed="true"] .is-sun { display: block; }

/* Article: one centered block, with the text column and images sharing its left edge */
.artspiel-article { --as-measure: 43.75rem; --as-wide: 62.5rem; width: 100%; max-width: var(--as-wide); margin-inline: auto !important; }
.artspiel-article > * { max-width: var(--as-wide); }
.artspiel-article > .wp-block-post-title,
.artspiel-article > .artspiel-meta,
.artspiel-article > .wp-block-artspiel-share { max-width: var(--as-measure); }
.artspiel-article .wp-block-post-content > * { max-width: var(--as-measure); }
.artspiel-article .wp-block-post-content > :is(figure, .wp-block-gallery, .wp-block-embed, .wp-block-video, .wp-block-table, .wp-block-columns, .wp-block-media-text, .wp-caption) { max-width: var(--as-wide); margin-inline: 0 !important; }
.artspiel-article .wp-block-post-content figcaption { text-align: left; }
/* Classic [caption] figures carry an inline width (e.g. 500px): never wider than the screen */
.artspiel-article .wp-block-post-content .wp-caption { max-width: 100% !important; }
.artspiel-article .wp-block-post-content img { max-width: 100%; height: auto; }
/* Embedded players with a fixed width (old oEmbeds, e.g. 500px YouTube) fit the screen too */
.artspiel-article .wp-block-post-content iframe { max-width: 100%; }
/* Long emails/URLs/names wrap instead of widening the page; padded full-width boxes count their padding */
.artspiel-article .wp-block-post-content, .artspiel-article .wp-block-post-terms { overflow-wrap: anywhere; }
.wp-block-post-terms { overflow-wrap: anywhere; min-width: 0; max-width: 100%; }
.wp-block-post-terms a { white-space: normal; }
.artspiel-article .artspiel-meta > * { min-width: 0; max-width: 100%; }
.artspiel-article .wp-block-post-content div[style*="width: 100%"] { box-sizing: border-box; }
.artspiel-article .wp-block-post-content iframe:is([src*="youtube"], [src*="vimeo"]) { width: 100%; height: auto; aspect-ratio: 16 / 9; }

/* Pages with a short column */
.artspiel-narrow > * { max-width: 46rem; }

/* Page heads line up with everything below them */
.artspiel-archive-head .wp-block-avatar:empty { display: none; }
.artspiel-archive-head .has-global-padding { padding-inline: 0; }

/* Lead story: room between the byline and the lede */
.artspiel-hero .artspiel-meta { margin-bottom: 1rem; }

/* Motion: same easing as the header search */
:root { --as-ease: cubic-bezier(.2, .8, .2, 1); }

/* Links fade. Underlines stay in place and fade through their color, so nothing jumps. */
a { transition: color .2s var(--as-ease), text-decoration-color .2s var(--as-ease); }
a:where(:not(.wp-element-button)):hover { text-decoration-line: underline; }
.wp-block-post-title a, .wp-block-site-title a, .wp-block-post-author-name a, .wp-block-post-date a,
footer .wp-block-navigation a, .artspiel-event-title a, .artspiel-artist-list a, .artspiel-writer-list a,
.artspiel-az a, .artspiel-contributor h3 a, .artspiel-review-link, .wp-block-artspiel-event-nav a {
	text-decoration-line: underline;
	text-decoration-color: transparent;
	text-underline-offset: .15em;
}
:is(.wp-block-post-title, .wp-block-site-title, .wp-block-post-author-name, .wp-block-post-date, footer .wp-block-navigation, .artspiel-event-title, .artspiel-artist-list, .artspiel-writer-list, .artspiel-az, .artspiel-contributor h3, .wp-block-artspiel-event-nav) a:hover,
.artspiel-review-link:hover { text-decoration-color: currentColor; }

/* Back to the directory, above artist and venue names */
.artspiel-kicker a { display: inline-block; padding-block: 1rem; margin-block: -1rem; color: inherit; text-decoration-line: underline; text-decoration-color: transparent; text-underline-offset: .2em; }
.artspiel-kicker a:hover { color: var(--wp--preset--color--contrast); text-decoration-color: currentColor; }

/* Section menu: a red line slides in on hover and marks the current section */
.site-nav .wp-block-navigation-item__content { position: relative; text-decoration: none !important; }
.site-nav .wp-block-navigation-item__content::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -.25rem;
	height: 2px;
	background: var(--wp--custom--color--brand);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform .3s var(--as-ease);
}
@media (hover: hover) {
	.site-nav .wp-block-navigation-item__content:hover::after { transform: scaleX(1); }
}
.site-nav .is-current-section > .wp-block-navigation-item__content::after { transform: scaleX(1); }

/* Top links: the same line, thinner and grey. Subscribe keeps its red. */
.utility-nav .wp-block-navigation-item__content { position: relative; text-decoration: none !important; }
.utility-nav .wp-block-navigation-item__content::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -.2rem;
	height: 1px;
	background: var(--wp--custom--color--subtle);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform .3s var(--as-ease);
}
.utility-nav .subscribe-link .wp-block-navigation-item__content::after { background: var(--wp--preset--color--accent); }
@media (hover: hover) {
	.utility-nav .wp-block-navigation-item__content:hover::after { transform: scaleX(1); }
}
.utility-nav .is-current-section > .wp-block-navigation-item__content::after { transform: scaleX(1); }

/* Home and list pages only: images dim slightly on hover. Never on artwork pages. */
:is(.artspiel-grid, .artspiel-hero) .wp-block-post-featured-image img { transition: opacity .3s var(--as-ease); }
@media (hover: hover) {
	:is(.artspiel-grid, .artspiel-hero) .wp-block-post-featured-image a:hover img { opacity: .88; }
}

/* Sticky menu: a soft shadow once it is stuck */
.site-nav { transition: box-shadow .25s var(--as-ease); }
.site-nav.is-stuck { box-shadow: 0 2px 12px var(--as-shadow, rgba(0, 0, 0, .08)); }

/* Very narrow screens and 400% zoom: keep the masthead row inside the page */
@media (max-width: 359px) {
	.site-masthead > .wp-block-group { gap: .5rem; }
	.site-masthead .wp-block-site-title { font-size: 7vw !important; }
}

/* Article images: left on the text edge, never taller than the screen, whole captions */
.artspiel-article .wp-block-post-content figure.wp-block-image { display: block; }
.artspiel-article .wp-block-post-content figure.wp-block-image img { width: auto; height: auto; max-width: 100%; max-height: 85vh; display: block; }
.artspiel-article .wp-block-post-content figcaption { display: block; max-width: var(--as-measure); }

/* Tags at the end of articles: plain sentence case */
.wp-block-post-terms.artspiel-tags, .wp-block-post-terms.artspiel-tags a { font-size: .875rem; font-weight: 400; text-transform: none; letter-spacing: 0; }
.wp-block-post-terms.artspiel-tags .wp-block-post-terms__prefix { font-weight: 600; }

/* Buttons: one square shape with the same hover and focus */
.wp-block-search__input, .wp-element-button, .wp-block-button__link, .wp-block-search__button { border-radius: 0; }
.wp-block-search__button { transition: background-color .2s var(--as-ease), color .2s var(--as-ease); }

/* Focus: one on-brand outline */
:focus-visible { outline: 2px solid var(--wp--preset--color--accent); outline-offset: 2px; }
.site-nav .is-menu-open a:focus:not(:focus-visible) { outline: none; }
.wp-block-artspiel-newsletter :focus-visible, .artspiel-slidein :focus-visible { outline-color: #fff; }

/* Footer */
.artspiel-footer-about { max-width: 24rem; }
.artspiel-footer-about p { margin: 0; }

/* Secondary links appear only in the phone menu */
.site-nav .artspiel-menu-only { display: none; }
.site-nav .is-menu-open .artspiel-menu-only { display: block; }
.site-nav .is-menu-open .artspiel-menu-only .wp-block-navigation-item__content { font-weight: 400; }
.site-nav .is-menu-open .artspiel-menu-subscribe .wp-block-navigation-item__content { font-weight: 700; color: var(--wp--preset--color--accent); }

/* Phones: logo, Subscribe, menu and search */
@media (max-width: 599px) {
	.site-masthead { padding-top: 1rem !important; padding-bottom: .75rem !important; }
	.site-masthead > .wp-block-group { flex-wrap: nowrap; align-items: flex-start; }
	.site-masthead .wp-block-site-title { font-size: 8vw; white-space: nowrap; }
	.site-masthead .wp-block-site-tagline { font-size: .875rem; }
	.artspiel-masthead-links { gap: .25rem; flex-shrink: 0; }
	/* the masthead keeps only the dark mode switch; Subscribe and Donate live in the menu */
	.utility-nav { display: none !important; }
	footer .wp-block-navigation-item__content { display: inline-flex; align-items: center; min-height: 44px; }
	/* Directories: rows you can tap */
	.artspiel-artist-list li, .artspiel-writer-list li { padding: 0; }
	.artspiel-artist-list a, .artspiel-writer-list a { display: inline-block; padding: .5rem 0; }
}

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

/* About page: dek, text column and two cards (content arranged by `wp artspiel about-page apply`) */
.artspiel-about .artspiel-about-dek { max-width: 24ch; margin-block: 0 var(--wp--preset--spacing--50); font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem); line-height: 1.15; }
.artspiel-about .wp-block-columns.artspiel-about-columns { gap: var(--wp--preset--spacing--50) clamp(2rem, 10vw, 10rem); align-items: flex-start; }
.artspiel-about-columns > .wp-block-column:first-child > * { max-width: 46rem; }
.artspiel-about-card { padding: 1.5rem; background: var(--wp--preset--color--surface); font-size: 1rem; line-height: 1.55; }
.artspiel-about-card + .artspiel-about-card { margin-top: 1rem; }
.artspiel-about-card > * { margin-block: 0 .75em; }
.artspiel-about-card > :last-child { margin-bottom: 0; }
.artspiel-about-card h3 { margin-bottom: .25rem; font-size: .75rem; font-weight: 800; line-height: 1.6; text-transform: uppercase; letter-spacing: .12em; color: var(--wp--custom--color--subtle); }
.artspiel-about-card .wp-block-social-links { margin-top: 1rem; }
@media (min-width: 782px) {
	.artspiel-about-columns > .wp-block-column:last-child { flex: 0 0 21rem; }
}

/*
 * Sticky menu: once the masthead is out of view (site.js sets .is-stuck), a small
 * wordmark slides in at the left and Subscribe beside search. Both stay hidden
 * without JavaScript; with reduced motion they just appear.
 */
.site-nav-row { column-gap: 1.5rem; justify-content: flex-start !important; }
.site-nav-row > :is(.artspiel-nav-brand, .artspiel-nav-subscribe) {
	flex-shrink: 0;
	max-width: 0;
	overflow: hidden;
	white-space: nowrap;
	opacity: 0;
	visibility: hidden;
	transition: max-width .35s var(--as-ease), margin .35s var(--as-ease), opacity .25s var(--as-ease), visibility 0s linear .35s;
}
.site-nav-row > .artspiel-nav-brand {
	margin: 0 -1.5rem 0 0;
	font-size: 1.125rem;
	font-weight: 800;
	line-height: 1;
	letter-spacing: .08em;
	text-transform: uppercase;
}
.site-nav-row > .artspiel-nav-brand a { display: inline-block; padding-block: .25rem; color: var(--wp--preset--color--accent); text-decoration: none; }
.site-nav-row > .artspiel-nav-subscribe { margin-left: auto; font-size: .875rem; font-weight: 700; color: var(--wp--preset--color--accent); text-decoration: none; }
.site-nav-row > .artspiel-nav-subscribe:hover { text-decoration: underline; }
.site-nav.is-stuck .site-nav-row > :is(.artspiel-nav-brand, .artspiel-nav-subscribe) {
	max-width: 12rem;
	opacity: 1;
	visibility: visible;
	transition-delay: 0s;
}
.site-nav.is-stuck .site-nav-row > .artspiel-nav-brand { margin-right: .5rem; }
/* Phones: menu button, wordmark, Subscribe, search */
@media (max-width: 599px) {
	.site-nav-row { column-gap: 1rem; }
	.site-nav-row > .artspiel-nav-brand { order: 1; margin: 0 auto 0 0 !important; font-size: 1rem; }
	.site-nav-row > .artspiel-nav-subscribe { display: none; }
	.site-nav-row > .wp-block-search { order: 3; }
}

/* Back to top: appears after two screens of scrolling, steps aside for the newsletter box */
.artspiel-to-top {
	position: fixed;
	right: 1.5rem;
	bottom: 1.5rem;
	z-index: 40;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--wp--custom--color--line-strong);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	box-shadow: 0 2px 12px var(--as-shadow, rgba(0, 0, 0, .08));
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transform: translateY(.5rem);
	transition: opacity .25s var(--as-ease), transform .25s var(--as-ease), visibility 0s linear .25s, border-color .2s var(--as-ease);
}
.artspiel-to-top.is-shown { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.artspiel-to-top:hover { border-color: var(--wp--preset--color--contrast); }
.artspiel-to-top svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
body:has(.artspiel-slidein.is-open:not([hidden]), .wp-block-navigation__responsive-container.is-menu-open) .artspiel-to-top { opacity: 0; visibility: hidden; }
@media (max-width: 599px) {
	.artspiel-to-top { right: 1rem; bottom: 1rem; }
}
