/* ==========================================================================
   FW Fototheme – ergänzende Styles (Farben, Schriften, Abstände: theme.json)
   ========================================================================== */

:root {
	--fw-gap: clamp(0.5rem, 1.2vw, 1rem);
	--fw-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

::selection {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--base);
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

img {
	height: auto;
}

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

/* ---------- Kopf & Fuß ---------- */

.fw-header .wp-block-site-title a {
	text-decoration: none;
}

.fw-header .wp-block-navigation a:hover,
.fw-header .wp-block-navigation .current-menu-item > a {
	color: var(--wp--preset--color--accent);
}

.fw-footer {
	border-top: 1px solid var(--wp--preset--color--line);
}

.fw-footer .wp-block-site-title a {
	color: var(--wp--preset--color--muted);
	text-decoration: none;
}

/* ---------- Kleinteile ---------- */

.fw-eyebrow,
.fw-eyebrow.wp-block-post-terms {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--wp--preset--color--accent);
}

.fw-lede,
.fw-lede p {
	max-width: 46rem;
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.45;
}

.fw-archive-head .wp-block-query-title {
	margin-top: 0.25rem;
	margin-bottom: 0;
}

/* ==========================================================================
   Masonry-Raster (Startseite, Archive, Serien)
   Ohne JavaScript: CSS-Spalten. Mit JavaScript (masonry.js): Grid mit
   Reihenfolge von links nach rechts.
   ========================================================================== */

.fw-masonry .wp-block-post-template {
	display: block;
	columns: 3 300px;
	column-gap: var(--fw-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.fw-masonry .wp-block-post-template > li {
	break-inside: avoid;
	margin: 0 0 var(--fw-gap) !important;
}

.fw-masonry.fw-masonry--js .wp-block-post-template {
	display: grid;
	columns: auto;
	grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
	grid-auto-rows: 4px;
	column-gap: var(--fw-gap);
	row-gap: 0;
	align-items: start;
}

.fw-masonry.fw-masonry--js .wp-block-post-template > li {
	margin: 0 !important;
}

@media (min-width: 1400px) {
	.fw-masonry.fw-masonry--js .wp-block-post-template {
		grid-template-columns: repeat(4, 1fr);
	}
}

/* Karte */

.fw-card {
	position: relative;
	overflow: hidden;
}

.fw-card .wp-block-post-featured-image {
	margin: 0;
}

.fw-card .wp-block-post-featured-image img {
	display: block;
	width: 100%;
	height: auto;
	transition: transform 0.9s var(--fw-ease), opacity 0.6s var(--fw-ease);
}

.fw-card:hover .wp-block-post-featured-image img {
	transform: scale(1.025);
}

.fw-card__meta {
	position: absolute;
	inset: auto 0 0 0;
	padding: 3rem 1.1rem 1rem;
	background: linear-gradient(to top, rgb(0 0 0 / 0.78), rgb(0 0 0 / 0));
	opacity: 0;
	transform: translateY(0.5rem);
	transition: opacity 0.35s var(--fw-ease), transform 0.35s var(--fw-ease);
	pointer-events: none;
}

.fw-card:hover .fw-card__meta,
.fw-card:focus-within .fw-card__meta {
	opacity: 1;
	transform: none;
}

.fw-card__meta > * {
	margin: 0;
}

.fw-card__meta .wp-block-post-title {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.1;
}

.fw-card__meta .wp-block-post-title a {
	color: #fff;
	text-decoration: none;
}

/* Ganze Karte klickbar */
.fw-card .wp-block-post-title a::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: auto;
}

.fw-card__meta .wp-block-post-terms {
	position: relative;
	z-index: 2;
	margin-top: 0.35rem;
	pointer-events: auto;
}

/* Beiträge ohne Beitragsbild: Titel direkt sichtbar */
.fw-card:not(:has(.wp-block-post-featured-image)) {
	padding: 2.5rem 1.25rem;
	background: var(--wp--preset--color--surface);
}

.fw-card:not(:has(.wp-block-post-featured-image)) .fw-card__meta {
	position: static;
	opacity: 1;
	transform: none;
	padding: 0;
	background: none;
}

/* Touch-Geräte: kein Hover → Titel dezent dauerhaft zeigen */
@media (hover: none) {
	.fw-card__meta {
		opacity: 1;
		transform: none;
		padding-top: 2rem;
	}
	.fw-card__meta .wp-block-post-title {
		font-size: 1.1rem;
	}
}

/* Seitennavigation */

.fw-pagination {
	margin-top: var(--wp--preset--spacing--50);
	gap: 0.25rem 1rem;
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.fw-pagination a,
.fw-pagination .page-numbers {
	text-decoration: none;
	color: var(--wp--preset--color--muted);
}

.fw-pagination a:hover,
.fw-pagination .page-numbers.current {
	color: var(--wp--preset--color--contrast);
}

/* ==========================================================================
   Einzelansicht
   ========================================================================== */

.fw-hero {
	margin-top: var(--wp--preset--spacing--30);
	margin-bottom: 0;
	text-align: center;
}

.fw-hero img {
	display: inline-block;
	width: auto !important;
	max-width: 100%;
	max-height: 88vh;
	max-height: 88svh;
	object-fit: contain;
}

.fw-hero--fullbleed {
	margin-top: 0 !important;
	background: #000;
}

.fw-hero--fullbleed img {
	width: 100% !important;
	height: 100vh;
	height: 100svh;
	max-height: none;
}

.fw-post-head .wp-block-post-title {
	margin: 0;
}

.fw-content {
	margin-top: var(--wp--preset--spacing--50);
}

.fw-content > .alignwide,
.fw-content > .alignfull {
	margin-top: var(--wp--preset--spacing--50);
	margin-bottom: var(--wp--preset--spacing--50);
}

.fw-content .wp-block-image figcaption,
.fw-content .wp-block-gallery figcaption {
	text-align: left;
	color: var(--wp--preset--color--muted);
}

.fw-post-nav {
	border-top: 1px solid var(--wp--preset--color--line);
	font-size: var(--wp--preset--font-size--small);
}

.fw-post-nav a {
	text-decoration: none;
	font-family: var(--wp--preset--font-family--serif);
	font-size: var(--wp--preset--font-size--large);
}

.fw-post-nav .post-navigation-link__label {
	display: block;
	font-family: var(--wp--preset--font-family--sans);
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

.fw-post-nav .post-navigation-link-next {
	margin-left: auto;
	text-align: right;
}

/* Bilder mit Lightbox */
.fw-lightbox-trigger {
	cursor: zoom-in;
}

/* ==========================================================================
   Galerie-Stil „Masonry“
   ========================================================================== */

.wp-block-gallery.is-style-fw-masonry {
	display: block !important;
	columns: 3 220px;
	column-gap: var(--fw-gap);
}

.wp-block-gallery.is-style-fw-masonry.columns-2 { columns: 2 220px; }
.wp-block-gallery.is-style-fw-masonry.columns-4 { columns: 4 200px; }
.wp-block-gallery.is-style-fw-masonry.columns-5 { columns: 5 180px; }

.wp-block-gallery.is-style-fw-masonry > .wp-block-image {
	display: block;
	width: 100% !important;
	margin: 0 0 var(--fw-gap) !important;
	break-inside: avoid;
}

.wp-block-gallery.is-style-fw-masonry > .wp-block-image img {
	height: auto !important;
	object-fit: initial !important;
}

/* ==========================================================================
   Serien-Raster
   ========================================================================== */

.fw-series-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
	gap: var(--fw-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.fw-series-card a {
	position: relative;
	display: block;
	aspect-ratio: 4 / 5;
	overflow: hidden;
	background: var(--wp--preset--color--surface);
	color: #fff;
	text-decoration: none;
}

.fw-series-card__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.9s var(--fw-ease), filter 0.6s var(--fw-ease);
	filter: brightness(0.82);
}

.fw-series-card a:hover .fw-series-card__img,
.fw-series-card a:focus-visible .fw-series-card__img {
	transform: scale(1.03);
	filter: brightness(1);
}

.fw-series-card__meta {
	position: absolute;
	inset: auto 0 0 0;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	padding: 3rem 1.25rem 1.1rem;
	background: linear-gradient(to top, rgb(0 0 0 / 0.75), rgb(0 0 0 / 0));
}

.fw-series-card__title {
	font-family: var(--wp--preset--font-family--serif);
	font-size: var(--wp--preset--font-size--x-large);
	line-height: 1;
}

.fw-series-card__count {
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: rgb(255 255 255 / 0.7);
}

/* ---------- Suche ---------- */

.fw-search .wp-block-search__input {
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--contrast);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 0;
	padding: 0.7rem 0.9rem;
}

.fw-search .wp-block-search__button {
	margin-left: 0.5rem;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.fw-lb {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: grid;
	grid-template-rows: 1fr auto;
	background: rgb(8 8 7 / 0.97);
	color: #ecebe6;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s var(--fw-ease), visibility 0s linear 0.25s;
	touch-action: pan-y;
}

.fw-lb.is-open {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.25s var(--fw-ease);
}

.fw-lb__stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 3.5rem 4.5rem 0.75rem;
}

.fw-lb__img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
	transition: opacity 0.2s ease;
}

.fw-lb__img.is-loading {
	opacity: 0.25;
}

.fw-lb__bar {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.5rem 1.5rem 1.25rem;
	font-size: 0.8125rem;
	color: #8e8b83;
}

.fw-lb__caption {
	max-width: 60rem;
	color: #ecebe6;
}

.fw-lb__count {
	flex: none;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.08em;
}

.fw-lb__btn {
	position: absolute;
	display: grid;
	place-items: center;
	width: 3rem;
	height: 3rem;
	padding: 0;
	border: 0;
	background: none;
	color: #ecebe6;
	cursor: pointer;
	opacity: 0.65;
	transition: opacity 0.2s ease;
}

.fw-lb__btn:hover,
.fw-lb__btn:focus-visible {
	opacity: 1;
}

.fw-lb__btn svg {
	width: 1.6rem;
	height: 1.6rem;
}

.fw-lb__close { top: 0.5rem; right: 0.75rem; }
.fw-lb__prev { left: 0.75rem; top: 50%; transform: translateY(-50%); }
.fw-lb__next { right: 0.75rem; top: 50%; transform: translateY(-50%); }

.fw-lb.is-single .fw-lb__prev,
.fw-lb.is-single .fw-lb__next,
.fw-lb.is-single .fw-lb__count {
	display: none;
}

@media (max-width: 700px) {
	.fw-lb__stage { padding: 3.25rem 0.5rem 0.5rem; }
	.fw-lb__prev, .fw-lb__next { display: none; }
	.fw-lb__bar { padding-inline: 1rem; }
}

html.fw-lb-lock,
html.fw-lb-lock body {
	overflow: hidden;
}

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