/*
Theme Name: A. Regner Gallery
Description: Minimal gallery theme for gallery.aregner.photography. Photographs are shown whole, never cropped, on a quiet wall that follows the viewer's light/dark preference.
Version: 1.0.0
Requires at least: 7.0
Requires PHP: 8.4
Text Domain: aregner
License: Proprietary
*/

/* ---- Wall colours: light by default, dark when the viewer prefers it. ----
   theme.json defines the light palette; dark mode swaps the same tokens so
   every block using a preset follows automatically. The dark wall is a
   neutral charcoal, not black: black makes bright photographs halo. */
@media (prefers-color-scheme: dark) {
	:root {
		--wp--preset--color--wall: #18191b;
		--wp--preset--color--ink: #e6e6e4;
		--wp--preset--color--muted: #9a9da3;
		--wp--preset--color--rule: #303236;
		--wp--preset--color--shade: #222326;
		color-scheme: dark;
	}
}
:root {
	color-scheme: light dark;
	--ag-header-h: 4.5rem;
}

body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	font-feature-settings: "kern", "liga";
}

::selection {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--wall);
}

:where(a, button, input, select, summary):focus-visible {
	outline: 1.5px solid currentColor;
	outline-offset: 3px;
	border-radius: 1px;
}

/* ---- Header ---------------------------------------------------------- */
/* Template parts sit outside the constrained <main>, so they don't inherit
   the root padding; give them the same gutters and wide width explicitly. */
.ag-header,
.ag-footer {
	box-sizing: border-box;
	max-width: calc(var(--wp--style--global--wide-size) + var(--wp--style--root--padding-left) + var(--wp--style--root--padding-right));
	margin-inline: auto;
	padding-left: var(--wp--style--root--padding-left);
	padding-right: var(--wp--style--root--padding-right);
}
.ag-header {
	min-height: var(--ag-header-h);
}
.ag-wordmark {
	font-size: 1rem;
	font-weight: 500;
	letter-spacing: 0.01em;
	margin: 0;
	line-height: 1.2;
}
.ag-wordmark a { text-decoration: none; }
.ag-wordmark span {
	color: var(--wp--preset--color--muted);
	font-weight: 400;
}
.ag-header .wp-block-navigation a { text-decoration: none; }
.ag-header .wp-block-navigation .current-menu-item > a,
.ag-header .wp-block-navigation a[aria-current="page"] {
	text-decoration: underline;
	text-underline-offset: 0.35em;
	text-decoration-thickness: 1px;
}

/* ---- The mat ----------------------------------------------------------
   The one idea of the site: a photograph is shown whole, at its own
   proportions, as large as the viewport allows, with wall around it. */
.ag-mat {
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
}
.ag-print {
	display: block;
	width: auto;
	height: auto;
	max-width: min(92vw, 100%);
	object-fit: contain;
	background: var(--wp--preset--color--shade);
}
.ag-hero .ag-print { max-height: 72vh; }
.ag-photo .ag-print { max-height: calc(100vh - var(--ag-header-h) - 3rem); max-height: calc(100svh - var(--ag-header-h) - 3rem); }

.ag-print-link { display: block; }
.ag-print-button {
	all: unset;
	display: block;
	cursor: zoom-in;
}
.ag-print-button:focus-visible { outline: 1.5px solid currentColor; outline-offset: 6px; }

/* Wall label: aligned to the left edge of the print, not the page. */
.ag-label {
	align-self: stretch;
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	margin-top: 1rem;
	max-width: 40rem;
	margin-inline: auto;
	width: 100%;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}
.ag-hero .ag-label { width: auto; margin-inline: 0; align-self: center; text-align: center; }
.ag-label__title {
	font-family: var(--wp--preset--font-family--serif);
	font-weight: 300;
	font-size: 1.125rem;
	color: var(--wp--preset--color--ink);
	margin-bottom: 0.15rem;
}

/* ---- Single photograph ---------------------------------------------- */
.ag-single-meta { font-size: var(--wp--preset--font-size--small); color: var(--wp--preset--color--muted); }
.ag-single-meta a { color: var(--wp--preset--color--ink); }
.ag-single-title { margin: 0; }

.ag-details {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
	gap: 0.9rem 1.5rem;
	margin-inline: 0;
	margin-bottom: 0;
	padding-top: 1.25rem;
	border-top: 1px solid var(--wp--preset--color--rule);
	font-size: var(--wp--preset--font-size--small);
}
.ag-details dt { color: var(--wp--preset--color--muted); }
.ag-details dd { margin: 0; font-variant-numeric: tabular-nums; }

.ag-tags a {
	display: inline-block;
	margin: 0 0.9rem 0.3rem 0;
}
.ag-tags .wp-block-post-terms__separator { display: none; }
.ag-tags .wp-block-post-terms__prefix { color: var(--wp--preset--color--muted); margin-right: 0.9rem; }

.ag-pager {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}
.ag-pager a { color: var(--wp--preset--color--ink); }

/* Full-screen viewing of the 3840px image (assets/js/viewer.js). */
.ag-viewer {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	place-items: center;
	background: var(--wp--preset--color--wall);
	cursor: zoom-out;
	border: 0;
	padding: 0;
	margin: 0;
	width: 100vw;
	height: 100vh;
	max-width: none;
	max-height: none;
}
.ag-viewer[open] { display: grid; }
.ag-viewer::backdrop { background: var(--wp--preset--color--wall); }
.ag-viewer img {
	max-width: 100vw;
	max-height: 100vh;
	width: auto;
	height: auto;
	object-fit: contain;
}

/* ---- Collections: prints hung at one height, each at its own width ---- */
.ag-collections {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: clamp(2rem, 5vw, 4rem) clamp(1.5rem, 4vw, 3.5rem);
}
.ag-collection a {
	display: flex;
	flex-direction: column;
	text-decoration: none;
}
.ag-collection .ag-print {
	height: clamp(12rem, 24vw, 18rem);
	width: auto;
	max-width: 80vw;
	margin-bottom: 0.9rem;
}
@media (max-width: 600px) {
	.ag-collections { flex-direction: column; align-items: stretch; }
	.ag-collection .ag-print { width: 100%; height: auto; max-width: 100%; }
}
.ag-collection__name {
	font-family: var(--wp--preset--font-family--serif);
	font-weight: 300;
	font-size: 1.25rem;
	line-height: 1.3;
}
.ag-collection a:hover @media (max-width: 600px) {
	.ag-collections { flex-direction: column; align-items: stretch; }
	.ag-collection .ag-print { width: 100%; height: auto; max-width: 100%; }
}
.ag-collection__name { text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
.ag-collection__count {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

/* ---- Visual Portfolio grids: remove its chrome, keep its layout ------ */
.vp-portfolio {
	--vp-items__gap: 12px;
}
.vp-portfolio .vp-portfolio__item-img,
.vp-portfolio .vp-portfolio__item-img img {
	border-radius: 0 !important;
}
.vp-portfolio .vp-portfolio__item-overlay { background: transparent !important; }
.vp-portfolio__item-img img { background: var(--wp--preset--color--shade); }

/* Filter: a quiet line of text links above the grid. */
.vp-portfolio .vp-filter__style-minimal,
.vp-portfolio .vp-filter {
	justify-content: flex-start !important;
	gap: 0.25rem 1.25rem;
	margin-bottom: 1.75rem;
	font-size: var(--wp--preset--font-size--small);
}
.vp-portfolio .vp-filter__item a {
	text-transform: none !important;
	letter-spacing: normal !important;
	font-weight: 400 !important;
	color: var(--wp--preset--color--muted) !important;
	padding: 0.2rem 0 !important;
	background: none !important;
	border: 0 !important;
}
.vp-portfolio .vp-filter__item a:hover,
.vp-portfolio .vp-filter__item-active a {
	color: var(--wp--preset--color--ink) !important;
	text-decoration: underline;
	text-underline-offset: 0.35em;
	text-decoration-thickness: 1px;
}

.vp-portfolio .vp-pagination__load-more a,
.vp-portfolio .vp-pagination__load-more span {
	background: none !important;
	color: var(--wp--preset--color--ink) !important;
	border: 1px solid var(--wp--preset--color--rule) !important;
	border-radius: 0 !important;
	font-size: var(--wp--preset--font-size--small);
	padding: 0.6rem 1.4rem !important;
}
.vp-portfolio .vp-pagination__load-more a:hover { border-color: var(--wp--preset--color--ink) !important; }

/* PhotoSwipe lightbox follows the wall colour. */
.pswp { --pswp-bg: var(--wp--preset--color--wall) !important; --pswp-icon-color: var(--wp--preset--color--ink); --pswp-icon-color-secondary: var(--wp--preset--color--wall); }
.pswp__bg { background: var(--wp--preset--color--wall) !important; opacity: 1 !important; }
.pswp__button { color: var(--wp--preset--color--ink) !important; }
.pswp .vp-pswp-caption, .pswp__caption, .pswp__dynamic-caption { color: var(--wp--preset--color--muted) !important; }

/* ---- Footer ------------------------------------------------------------ */
.ag-footer { font-size: var(--wp--preset--font-size--small); color: var(--wp--preset--color--muted); }
.ag-footer a { color: var(--wp--preset--color--ink); }

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