/*
 * FQW Gallery: styles that theme.json can't express.
 * Colors and type come from theme.json presets.
 */

/* ---------- Header (stays at the top while scrolling) ---------- */

header.wp-block-template-part {
	position: sticky;
	top: 0;
	/* Above the images' "enlarge" buttons (z-index 100), below the full-screen viewer. */
	z-index: 1000;
	background-color: var(--wp--preset--color--base);
}

/* When logged in, sit below the black WordPress toolbar. */
.admin-bar header.wp-block-template-part {
	top: var(--wp-admin--admin-bar--height, 32px);
}

/* On small phones the WordPress toolbar scrolls away, so stick to the very top. */
@media (max-width: 600px) {
	.admin-bar header.wp-block-template-part {
		top: 0;
	}
}

/* Links to a section (like Work) stop below the header instead of under it. */
[id] {
	scroll-margin-top: 6rem;
}

.fqw-header {
	padding-top: 1.25rem;
	padding-bottom: 1.25rem;
	border-bottom: 1px solid #222224;
}

.fqw-header__inner {
	align-items: center;
}

.fqw-brand {
	gap: 0.25rem !important;
}

.fqw-header .wp-block-site-title {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	line-height: 1.2;
}

.fqw-header .wp-block-site-title a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.fqw-byline {
	margin: 0;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.75rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

.fqw-header .wp-block-navigation a {
	text-decoration: none;
}

.fqw-header .wp-block-navigation .wp-block-navigation__submenu-container {
	background-color: var(--wp--preset--color--surface) !important;
	border-color: var(--wp--preset--color--line) !important;
	color: var(--wp--preset--color--contrast) !important;
	padding: 0.5rem 0;
}

.fqw-header .wp-block-navigation .wp-block-navigation__submenu-container a {
	padding: 0.5rem 1rem;
}

.wp-block-navigation__responsive-container.is-menu-open {
	background-color: var(--wp--preset--color--base) !important;
	color: var(--wp--preset--color--contrast) !important;
}

/* ---------- Page frame ---------- */

.fqw-main {
	padding-top: var(--wp--preset--spacing--60);
	padding-bottom: var(--wp--preset--spacing--60);
}

.fqw-main--flush {
	padding-top: 0;
	padding-bottom: 0;
}

.fqw-main > .wp-block-post-title {
	margin-bottom: var(--wp--preset--spacing--40);
}

/* ---------- Text styles ---------- */

.is-style-label,
.fqw-label {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

.fqw-lead {
	max-width: 44rem;
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.65;
	color: var(--wp--preset--color--soft);
}

.fqw-more a {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--wp--preset--color--accent);
}

.fqw-more a:hover,
.fqw-more a:focus-visible {
	color: var(--wp--preset--color--contrast);
}

.fqw-prose p {
	max-width: 44rem;
}

.fqw-prose h2 {
	margin-top: var(--wp--preset--spacing--60);
	margin-bottom: var(--wp--preset--spacing--30);
	padding-top: 1.5rem;
	border-top: 1px solid var(--wp--preset--color--line);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

.fqw-item {
	margin-top: 0.5rem !important;
	margin-bottom: 0.5rem !important;
	color: #dddbd5;
}

/* ---------- Home: hero ---------- */

.fqw-hero {
	position: relative;
	margin-top: 0 !important;
	margin-bottom: 0 !important;
}

.fqw-hero img {
	display: block;
	width: 100%;
	max-height: 88vh;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.fqw-hero figcaption {
	position: absolute;
	left: clamp(1.25rem, 4vw, 3rem);
	bottom: clamp(1rem, 3vw, 2rem);
	margin: 0;
	padding: 0.5rem 0.75rem;
	background: rgba(12, 12, 13, 0.72);
	color: var(--wp--preset--color--contrast);
}

/* ---------- Home: intro ---------- */

.fqw-intro {
	padding-top: var(--wp--preset--spacing--70);
	padding-bottom: var(--wp--preset--spacing--70);
	column-gap: clamp(2.5rem, 6vw, 6rem) !important;
	row-gap: 2rem !important;
	align-items: start;
}

.fqw-intro h1 {
	margin: 0;
}

.fqw-intro .fqw-lead {
	margin-top: 0;
}

/* ---------- Home: series grid ---------- */

.fqw-series-section {
	padding-bottom: var(--wp--preset--spacing--70);
}

.fqw-section-head {
	margin-bottom: 2.5rem !important;
	padding-top: 1.5rem;
	border-top: 1px solid var(--wp--preset--color--line);
}

.fqw-series-grid {
	column-gap: 3rem !important;
	row-gap: 4.5rem !important;
}

.fqw-tile > * {
	margin-top: 0;
}

.fqw-tile .wp-block-image {
	margin: 0 0 1.25rem;
	background: var(--wp--preset--color--surface);
}

.fqw-tile .wp-block-image img {
	display: block;
	width: 100%;
	aspect-ratio: 5 / 4;
	object-fit: cover;
	transition: opacity 0.2s ease;
}

.fqw-tile .wp-block-image a:hover img {
	opacity: 0.88;
}

.fqw-tile h3 {
	margin: 0 0 0.5rem;
}

.fqw-tile h3 a {
	text-decoration: none;
}

.fqw-tile p {
	margin: 0;
	font-size: 1rem;
	color: #b9b7b1;
}

/* ---------- Home: credits band ---------- */

.fqw-credits {
	padding-top: var(--wp--preset--spacing--60);
	padding-bottom: var(--wp--preset--spacing--60);
	background-color: var(--wp--preset--color--band);
	border-top: 1px solid #222224;
	border-bottom: 1px solid #222224;
}

.fqw-credits .wp-block-group > p {
	margin-top: 0.5rem;
	margin-bottom: 0.5rem;
	color: #dddbd5;
}

.fqw-credits .is-style-label {
	margin-bottom: 1rem;
}

/* ---------- Home: call to action ---------- */

.fqw-cta {
	padding-top: var(--wp--preset--spacing--70);
	padding-bottom: var(--wp--preset--spacing--60);
	gap: 2rem !important;
}

.fqw-cta h2 {
	max-width: 40rem;
	margin: 0;
}

/* ---------- Series pages ---------- */

.fqw-series > .wp-block-heading {
	margin-top: var(--wp--preset--spacing--60);
	padding-top: 1.5rem;
	border-top: 1px solid var(--wp--preset--color--line);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

.fqw-series .fqw-lead {
	margin-bottom: var(--wp--preset--spacing--50);
}

.fqw-note {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
}

/* ---------- Gallery: Masonry style ---------- */

.wp-block-gallery.is-style-masonry {
	display: block !important;
	column-width: 22rem;
	column-gap: 1.5rem;
}

.wp-block-gallery.is-style-masonry > .wp-block-image {
	display: block !important;
	width: 100% !important;
	margin: 0 0 2rem !important;
	break-inside: avoid;
}

.wp-block-gallery.is-style-masonry > .wp-block-image img {
	display: block;
	width: 100% !important;
	height: auto !important;
	object-fit: contain !important;
	background: var(--wp--preset--color--surface);
}

.wp-block-gallery.is-style-masonry > .wp-block-image figcaption {
	position: static !important;
	margin: 0 !important;
	padding: 0.75rem 0 0 !important;
	max-height: none !important;
	overflow: visible !important;
	background: none !important;
	text-align: left !important;
	text-shadow: none !important;
	color: var(--wp--preset--color--soft) !important;
	font-family: var(--wp--preset--font-family--archivo);
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0;
}

/* ---------- Videos (Vimeo embeds in a grid) ---------- */

/* Masonry columns, like the image galleries, so tall and wide videos leave no gaps. */
.fqw-videos {
	display: block !important;
	column-width: 22rem;
	column-gap: 1.5rem;
	margin-bottom: var(--wp--preset--spacing--50);
}

.fqw-videos > .wp-block-embed {
	break-inside: avoid;
	margin: 0 0 2.5rem !important;
}

/* Portrait videos (2:3): size the player to the video, so no grey bands. */
.fqw-videos .wp-block-embed:not(.wp-has-aspect-ratio) iframe {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 2 / 3;
}

.fqw-videos .wp-block-embed .wp-element-caption {
	margin: 0.75rem 0 0;
	text-align: left;
	color: var(--wp--preset--color--soft);
	font-family: var(--wp--preset--font-family--archivo);
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0;
}

/* ---------- Tiles that open the full-screen viewer ---------- */

.fqw-view {
	display: block;
	position: relative;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: var(--wp--preset--color--surface);
	color: inherit;
	font: inherit;
	line-height: 0;
	text-align: left;
	cursor: zoom-in;
	scroll-margin: 7rem 0 2rem;
}

.wp-block-gallery figure.wp-block-image > .fqw-view {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
}

.fqw-view img {
	display: block;
	width: 100%;
	height: auto;
	transition: opacity 0.2s ease;
}

.fqw-view:hover img {
	opacity: 0.88;
}

.fqw-view--animation,
.fqw-view--video {
	cursor: pointer;
}

.fqw-view--video {
	overflow: hidden;
}

.fqw-view--video img {
	height: 100%;
	object-fit: cover;
}

.fqw-view__play {
	position: absolute;
	top: 50%;
	left: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	margin: -32px 0 0 -32px;
	border: 1px solid rgba(236, 235, 230, 0.35);
	border-radius: 50%;
	background: rgba(12, 12, 13, 0.62);
	color: var(--wp--preset--color--contrast);
	pointer-events: none;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.fqw-view__play svg {
	margin-left: 3px;
}

.fqw-view:hover .fqw-view__play,
.fqw-view:focus-visible .fqw-view__play {
	border-color: var(--wp--preset--color--accent);
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--base);
}

/* A Vimeo embed showing a preview tile instead of a player. */
.wp-block-embed.fqw-has-poster .wp-block-embed__wrapper {
	position: static;
}

.wp-block-embed.fqw-has-poster .wp-block-embed__wrapper::before {
	content: none;
	display: none;
}

/* ---------- Full-screen viewer ---------- */

html.fqw-viewer-open {
	overflow: hidden;
}

.fqw-viewer {
	position: fixed;
	inset: 0;
	box-sizing: border-box;
	width: 100vw;
	height: 100vh;
	height: 100dvh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: #060607;
	color: var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--archivo);
	overflow: hidden;
}

.fqw-viewer[open] {
	display: grid;
	grid-template-rows: auto minmax(0, 1fr) auto;
}

.fqw-viewer::backdrop {
	background: #060607;
}

.fqw-viewer__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	min-height: 56px;
	padding: 0.25rem clamp(0.5rem, 2vw, 1.5rem) 0.25rem clamp(1rem, 3vw, 2rem);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

.fqw-viewer__series,
.fqw-viewer__count {
	margin: 0;
}

.fqw-viewer__series {
	flex: 1 1 0;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fqw-viewer__count {
	flex: none;
}

.fqw-viewer__tools {
	flex: 1 1 0;
	display: flex;
	justify-content: flex-end;
	gap: 0.25rem;
}

.fqw-viewer__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--wp--preset--color--contrast);
	cursor: pointer;
}

.fqw-viewer__btn:hover {
	color: var(--wp--preset--color--accent);
}

.fqw-viewer__btn[hidden] {
	display: none;
}

.fqw-viewer__stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 0 clamp(0px, 6vw, 96px);
	touch-action: pan-y pinch-zoom;
}

.fqw-viewer__media {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

.fqw-viewer__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.fqw-viewer__media iframe {
	display: block;
	border: 0;
	background: #000;
}

.fqw-viewer__nav {
	position: absolute;
	top: 50%;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	margin-top: -28px;
	padding: 0;
	border: 1px solid #2a2a2d;
	border-radius: 50%;
	background: rgba(12, 12, 13, 0.6);
	color: var(--wp--preset--color--contrast);
	cursor: pointer;
}

.fqw-viewer__nav:hover {
	border-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent);
}

.fqw-viewer__nav[hidden] {
	display: none;
}

.fqw-viewer__prev {
	left: clamp(0.5rem, 2vw, 1.5rem);
}

.fqw-viewer__next {
	right: clamp(0.5rem, 2vw, 1.5rem);
}

.fqw-viewer__loading {
	position: absolute;
	bottom: 1rem;
	left: 50%;
	margin: 0;
	padding: 0.375rem 0.75rem;
	transform: translateX(-50%);
	background: rgba(12, 12, 13, 0.75);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--soft);
	pointer-events: none;
}

.fqw-viewer__loading[hidden] {
	display: none;
}

.fqw-viewer__caption {
	min-height: 1.6em;
	margin: 0;
	padding: 0.875rem clamp(1rem, 4vw, 3rem) 1.125rem;
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.5;
	text-align: center;
	color: var(--wp--preset--color--soft);
}

@media (max-width: 700px) {
	.fqw-viewer__stage {
		padding: 0;
	}

	.fqw-viewer__nav {
		width: 44px;
		height: 44px;
		margin-top: -22px;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.fqw-viewer[open] {
		animation: fqw-viewer-in 0.18s ease-out;
	}

	@keyframes fqw-viewer-in {
		from {
			opacity: 0;
		}

		to {
			opacity: 1;
		}
	}
}

/* ---------- Lightbox ---------- */

.wp-lightbox-overlay .scrim {
	background-color: #060607 !important;
}

.wp-lightbox-overlay .close-button,
.wp-lightbox-overlay button {
	color: var(--wp--preset--color--contrast) !important;
}

/* ---------- Contact: email link ---------- */

.fqw-email {
	margin-top: var(--wp--preset--spacing--40);
}

.fqw-email a {
	font-family: var(--wp--preset--font-family--mono);
	font-size: clamp(1.125rem, 2.4vw, 1.5rem);
	letter-spacing: 0.02em;
	text-decoration: none;
	color: var(--wp--preset--color--accent);
	overflow-wrap: anywhere;
}

.fqw-email a:hover,
.fqw-email a:focus-visible {
	color: var(--wp--preset--color--contrast);
}

/* ---------- Contact Form 7 (only used if that plugin is ever added) ---------- */

.wpcf7 form p {
	max-width: 44rem;
}

.wpcf7 label {
	display: block;
	color: var(--wp--preset--color--soft);
}

.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 input[type="url"],
.wpcf7 input[type="tel"],
.wpcf7 textarea {
	box-sizing: border-box;
	width: 100%;
	margin-top: 0.5rem;
	padding: 0.75rem 0.875rem;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 0;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--contrast);
	font: inherit;
}

.wpcf7 input[type="submit"] {
	min-height: 44px;
	padding: 0.75rem 1.5rem;
	border: 0;
	border-radius: 0;
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
}

.wpcf7 input[type="submit"]:hover {
	background: var(--wp--preset--color--accent);
}

/* ---------- Footer ---------- */

.fqw-footer {
	padding-top: 2rem;
	padding-bottom: 2.5rem;
	border-top: 1px solid #222224;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	letter-spacing: 0.04em;
	color: var(--wp--preset--color--muted);
}

.fqw-footer p {
	margin: 0;
}

/* ---------- Accessibility ---------- */

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

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