/* PIX Theme base styles. Brand values arrive as CSS custom properties from inc/customizer.php. */
:root {
	--pix-bg: #f6f4f0;
	--pix-surface: #fff;
	--pix-text: #1b1a18;
	--pix-muted: color-mix(in srgb, var(--pix-text) 62%, var(--pix-bg));
	--pix-line: color-mix(in srgb, var(--pix-text) 14%, var(--pix-bg));
	--pix-accent: #2e2a26;
	--pix-accent-text: #fff;
	--pix-font-heading: Charter, Georgia, serif;
	--pix-font-body: system-ui, sans-serif;
	--pix-sponsor-max: 200px;
	--pix-radius: 6px;
	--pix-gutter: clamp(16px, 4vw, 48px);
	--pix-focus: 0 0 0 3px color-mix(in srgb, var(--pix-accent) 55%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--pix-bg);
	color: var(--pix-text);
	font: 16px/1.6 var(--pix-font-body);
	min-width: 320px;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--pix-font-heading); font-weight: 500; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.75rem, 2.2vw + 1rem, 3rem); }
h2 { font-size: 1.25rem; }
:focus-visible { outline: none; box-shadow: var(--pix-focus); border-radius: var(--pix-radius); }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.pix-skip { position: absolute; left: 8px; top: -100px; background: var(--pix-accent); color: var(--pix-accent-text); padding: 8px 14px; border-radius: var(--pix-radius); z-index: 100; }
.pix-skip:focus { top: 8px; }

.pix-wrap { width: min(1200px, 100% - 2 * var(--pix-gutter)); margin-inline: auto; }
.pix-main { flex: 1; }

.pix-header { border-bottom: 1px solid var(--pix-line); background: var(--pix-surface); }
.pix-header__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; padding: 8px 0; flex-wrap: wrap; }
.pix-logo { text-decoration: none; display: inline-flex; align-items: center; }
.pix-logo--text { font-family: var(--pix-font-heading); font-size: 1.35rem; letter-spacing: .02em; }
.pix-logo__img { max-height: 44px; width: auto; }
.pix-header__nav { display: flex; gap: 4px; }
.pix-header__nav a { text-decoration: none; padding: 8px 12px; border-radius: var(--pix-radius); color: var(--pix-muted); }
.pix-header__nav a[aria-current="page"] { color: var(--pix-text); background: color-mix(in srgb, var(--pix-text) 6%, transparent); }
.pix-fav-count { display: inline-block; min-width: 1.4em; padding: 0 .35em; border-radius: 999px; background: var(--pix-accent); color: var(--pix-accent-text); font-size: .75em; text-align: center; vertical-align: middle; }

.pix-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: var(--pix-radius); border: 1px solid var(--pix-accent); background: var(--pix-accent); color: var(--pix-accent-text); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; }
.pix-btn--ghost { background: transparent; color: var(--pix-text); border-color: var(--pix-line); }
.pix-btn:hover { filter: brightness(1.05); }
.pix-btn[disabled] { opacity: .5; cursor: not-allowed; }
.pix-input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--pix-line); border-radius: var(--pix-radius); background: var(--pix-surface); color: inherit; font: inherit; }
.pix-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0; }

.pix-index { padding: clamp(24px, 5vw, 56px) 0; }
.pix-index__head { display: grid; gap: 16px; margin-bottom: 28px; }
.pix-index__title { margin: 0; }
.pix-search__label { display: block; font-size: .875rem; color: var(--pix-muted); margin-bottom: 6px; }
.pix-search__row { display: flex; gap: 8px; flex-wrap: wrap; }
.pix-search__input { flex: 1 1 220px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--pix-line); border-radius: var(--pix-radius); background: var(--pix-surface); color: inherit; font: inherit; }
.pix-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.pix-chip { text-decoration: none; padding: 6px 12px; border: 1px solid var(--pix-line); border-radius: 999px; font-size: .9rem; color: var(--pix-muted); }
.pix-chip[aria-current="true"] { border-color: var(--pix-accent); color: var(--pix-text); }

.pix-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 24px; }
.pix-card { background: var(--pix-surface); border: 1px solid var(--pix-line); border-radius: var(--pix-radius); overflow: hidden; }
.pix-card__link { display: block; text-decoration: none; color: inherit; height: 100%; }
.pix-card__media { aspect-ratio: 3 / 2; background: var(--pix-line); overflow: hidden; }
.pix-card__media img { width: 100%; height: 100%; object-fit: cover; }
.pix-card__placeholder { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, color-mix(in srgb, var(--pix-accent) 18%, var(--pix-bg)), color-mix(in srgb, var(--pix-accent) 40%, var(--pix-bg))); }
.pix-card__body { padding: 16px 18px 20px; }
.pix-card__title { margin: 0 0 4px; font-size: 1.15rem; }
.pix-card__date { color: var(--pix-muted); font-size: .9rem; }
.pix-card__desc { margin: 10px 0 0; color: var(--pix-muted); font-size: .95rem; }
.pix-pagination ul { list-style: none; display: flex; gap: 6px; justify-content: center; padding: 0; margin: 32px 0 0; flex-wrap: wrap; }
.pix-pagination a, .pix-pagination span { display: inline-block; min-width: 40px; padding: 8px 10px; text-align: center; border: 1px solid var(--pix-line); border-radius: var(--pix-radius); text-decoration: none; }
.pix-pagination .current { background: var(--pix-accent); color: var(--pix-accent-text); border-color: var(--pix-accent); }
.pix-empty { color: var(--pix-muted); }

.pix-landing { padding: clamp(48px, 12vw, 160px) 0; text-align: center; }
.pix-landing__text { color: var(--pix-muted); }

.pix-cover__media { aspect-ratio: 21 / 9; max-height: 70vh; background: var(--pix-line); overflow: hidden; }
.pix-cover__media[data-pix-placeholder] { background: linear-gradient(160deg, color-mix(in srgb, var(--pix-accent) 22%, var(--pix-bg)), color-mix(in srgb, var(--pix-accent) 55%, var(--pix-bg))); }
.pix-cover__media img { width: 100%; height: 100%; object-fit: cover; }
.pix-cover__body { padding: clamp(24px, 5vw, 56px) 0; max-width: 760px; }
.pix-cover__meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--pix-muted); margin: 0 0 16px; }
.pix-cover__desc { font-size: 1.05rem; }
.pix-cover__credit { color: var(--pix-muted); font-size: .9rem; }

.pix-sponsor { display: grid; gap: 6px; margin: 16px 0 24px; }
.pix-sponsor__label { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--pix-muted); }
.pix-sponsor__logo { max-width: var(--pix-sponsor-max); }
.pix-sponsor__link { text-decoration: none; display: inline-block; }

.pix-photos, .pix-favorites { padding: clamp(24px, 5vw, 56px) 0; }
.pix-photos__meta { color: var(--pix-muted); margin: 0; }
.pix-grid__loading { color: var(--pix-muted); grid-column: 1 / -1; }

.pix-status, .pix-gate { padding: clamp(48px, 10vw, 120px) 0; max-width: 560px; text-align: left; }
.pix-status__text, .pix-gate__text { color: var(--pix-muted); font-size: 1.05rem; }
.pix-gate__form { display: grid; gap: 10px; max-width: 360px; margin-top: 20px; }
.pix-gate__form label { font-size: .9rem; }
.pix-gate__error { color: #9b1c1c; margin: 0; }

.pix-footer { border-top: 1px solid var(--pix-line); background: var(--pix-surface); margin-top: 48px; }
.pix-footer__grid { display: grid; gap: 16px; padding: 28px 0 32px; font-size: .9rem; color: var(--pix-muted); }
.pix-footer__text p { margin: 0 0 8px; }
.pix-footer__nav ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.pix-footer__nav a { text-decoration: none; }
.pix-footer__copyright { margin: 0; }
.pix-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.pix-toast { position: fixed; inset: auto 16px 16px auto; background: var(--pix-text); color: var(--pix-bg); padding: 10px 14px; border-radius: var(--pix-radius); font-size: .9rem; z-index: 50; }

/* Photo grid */
.pix-actions--compact { margin: 0; align-items: center; }
.pix-photos__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; margin-bottom: 20px; }
.pix-selection-count:empty { display: none; }
.pix-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.pix-tab { border: 1px solid var(--pix-line); background: var(--pix-surface); color: var(--pix-muted); border-radius: 999px; padding: 6px 14px; font: inherit; cursor: pointer; min-height: 40px; }
.pix-tab[aria-selected="true"] { border-color: var(--pix-accent); color: var(--pix-text); }
.pix-tab__count { opacity: .7; font-size: .85em; }
.pix-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 8px; list-style: none; margin: 0; padding: 0; }
.pix-grid__item { position: relative; margin: 0; background: var(--pix-line); border-radius: var(--pix-radius); overflow: hidden; aspect-ratio: var(--pix-ar, 3 / 2); }
.pix-grid__open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.pix-grid__open img { width: 100%; height: 100%; object-fit: cover; }
.pix-grid__fav { position: absolute; right: 8px; bottom: 8px; min-width: 40px; min-height: 40px; border-radius: 999px; border: 0; background: rgb(0 0 0 / 45%); color: #fff; font-size: 18px; cursor: pointer; opacity: .85; }
.pix-grid__fav[aria-pressed="true"] { background: var(--pix-accent); color: var(--pix-accent-text); opacity: 1; }
.pix-grid__fav:focus-visible { opacity: 1; }
.pix-grid__check { position: absolute; left: 8px; top: 8px; z-index: 2; background: var(--pix-surface); border-radius: 4px; padding: 6px; display: flex; }
.pix-grid__check input { width: 22px; height: 22px; margin: 0; }
.pix-grid__item.is-selected { outline: 3px solid var(--pix-accent); outline-offset: -3px; }
.pix-grid__empty, .pix-grid__loading { grid-column: 1 / -1; color: var(--pix-muted); list-style: none; }

/* Lightbox */
.pix-lb { position: fixed; inset: 0; z-index: 200; display: grid; grid-template-rows: auto 1fr auto; color: #fff; }
.pix-lb[hidden] { display: none; }
.pix-lb__backdrop { position: absolute; inset: 0; background: #0b0b0b; }
.pix-lb__bar, .pix-lb__stage, .pix-lb__caption { position: relative; }
.pix-lb__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px max(12px, env(safe-area-inset-left)); }
.pix-lb__tools { display: flex; gap: 6px; align-items: center; }
.pix-lb__btn { min-width: 44px; min-height: 44px; padding: 8px 12px; border: 1px solid rgb(255 255 255 / 25%); border-radius: var(--pix-radius); background: rgb(255 255 255 / 8%); color: #fff; font: inherit; cursor: pointer; }
.pix-lb__btn[aria-pressed="true"] { background: var(--pix-accent); color: var(--pix-accent-text); border-color: var(--pix-accent); }
.pix-lb__btn:focus-visible { box-shadow: 0 0 0 3px #fff; }
.pix-lb__dl { position: relative; }
.pix-lb__menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: #fff; color: #111; border-radius: var(--pix-radius); padding: 6px; display: grid; gap: 2px; z-index: 2; }
.pix-lb__menu[hidden] { display: none; }
.pix-lb__menu-item { text-align: left; padding: 10px 12px; border: 0; background: none; font: inherit; cursor: pointer; border-radius: 4px; min-height: 44px; }
.pix-lb__menu-item:hover, .pix-lb__menu-item:focus-visible { background: #eee; }
.pix-lb__stage { display: grid; grid-template-columns: auto 1fr auto; align-items: center; min-height: 0; touch-action: pan-y; }
.pix-lb__img { max-width: 100%; max-height: calc(100vh - 140px); margin: 0 auto; object-fit: contain; transition: transform .15s ease; user-select: none; -webkit-user-drag: none; }
.pix-lb--reduced .pix-lb__img { transition: none; }
.pix-lb__nav { min-width: 48px; min-height: 48px; margin: 0 6px; border: 0; border-radius: 999px; background: rgb(255 255 255 / 12%); color: #fff; font-size: 28px; cursor: pointer; }
.pix-lb__nav:disabled { opacity: .3; cursor: default; }
.pix-lb__nav:focus-visible { box-shadow: 0 0 0 3px #fff; }
.pix-lb__caption { margin: 0; padding: 10px 16px 16px; text-align: center; font-size: .95rem; min-height: 1.5em; }
body.pix-lb-open { overflow: hidden; }

/* Download panel */
.pix-download { position: relative; margin-top: 24px; padding: 16px 18px; border: 1px solid var(--pix-line); border-radius: var(--pix-radius); background: var(--pix-surface); }
.pix-download[hidden],
.pix-download [hidden] { display: none; }
.pix-download__title { font-size: 1.1rem; margin: 0 0 6px; }
.pix-download__parts { padding-left: 20px; }
.pix-download__note { color: var(--pix-muted); font-size: .9rem; }

@media (min-width: 720px) {
	.pix-footer__grid { grid-template-columns: 1fr auto; align-items: start; }
	.pix-footer__copyright { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (max-width: 480px) {
	.pix-lb__bar { flex-wrap: wrap; }
	.pix-lb__nav { min-width: 40px; min-height: 40px; margin: 0 2px; }
}

/* Download panel states (M4) */
.pix-download__dismiss { position: absolute; top: 8px; right: 10px; border: 0; background: transparent; color: var(--pix-muted); font-size: 1.4rem; line-height: 1; cursor: pointer; min-width: 44px; min-height: 44px; }
.pix-download__dismiss:focus-visible { box-shadow: var(--pix-focus); }
.pix-download__state { margin: 0 0 8px; font-weight: 600; }
.pix-download[data-status="failed"] .pix-download__state,
.pix-download[data-status="error"] .pix-download__state,
.pix-download[data-status="expired"] .pix-download__state { color: var(--pix-danger, #b3261e); }
.pix-download__variants { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.pix-download__ask { margin: 0; flex: 1 0 100%; }
.pix-download__part { margin: 6px 0; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.pix-download__part.is-pending { color: var(--pix-muted); }
.pix-download__size { color: var(--pix-muted); font-size: .9rem; }
.pix-btn--small { padding: 8px 14px; font-size: .95rem; }
