/* RB Anfrage – Popup mit Anfrageformular (Farben/Schriften aus dem Theme, mit Fallbacks) */

.rb-modal,
.rb-inline-form {
	--rbm-cream: var(--wp--preset--color--cream, #F6EFE6);
	--rbm-paper: var(--wp--preset--color--paper, #FBF7F1);
	--rbm-line: var(--wp--preset--color--line, #E2D3C0);
	--rbm-bronze: var(--wp--preset--color--bronze, #A6763F);
	--rbm-ink: var(--wp--preset--color--ink, #1C2A2E);
	--rbm-text: var(--wp--preset--color--text, #4A433C);
	--rbm-serif: var(--wp--preset--font-family--serif, Georgia, serif);
	--rbm-sans: var(--wp--preset--font-family--sans, system-ui, sans-serif);
	--rbm-ease: cubic-bezier(.22, .61, .36, 1);
}
.rb-modal {
	width: min(1000px, calc(100vw - 2rem));
	max-width: none;
	max-height: calc(100dvh - 2rem);
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: var(--rbm-cream);
	color: var(--rbm-text);
	font-family: var(--rbm-sans);
	box-shadow: 0 40px 90px -20px rgba(20, 12, 5, .6);
	overflow: hidden;
}
.rb-modal::backdrop {
	background: rgba(20, 14, 8, .74);
}
.rb-modal[open] { display: flex; flex-direction: column; }
.rb-modal[open] { animation: rb-modal-in .45s var(--rbm-ease); }
.rb-modal[open]::backdrop { animation: rb-backdrop-in .35s ease; }
@keyframes rb-modal-in { from { opacity: 0; transform: translateY(24px) scale(.98); } }
@keyframes rb-backdrop-in { from { opacity: 0; } }
html:has(.rb-modal[open]) { overflow: hidden; }

.rb-modal__panel {
	display: grid;
	flex: 1 1 auto;
	min-height: 0;
	grid-template-columns: 42% 1fr;
	grid-template-rows: minmax(0, 1fr);
	max-height: calc(100dvh - 2rem);
}

/* Bild links */
.rb-modal__media {
	position: relative;
	margin: 0;
	min-height: 100%;
	background: #2a1d12;
}
.rb-modal__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
/* Galerie-Projekt: Foto vollständig und mittig, Ränder mit unscharfer Kopie gefüllt */
@media (min-width: 761px) { .rb-modal.is-projekt .rb-modal__panel { grid-template-columns: 52% 1fr; } }
@media (max-width: 760px) { .rb-modal.is-projekt .rb-modal__panel { grid-template-rows: 230px 1fr; } }
.rb-modal.is-projekt .rb-modal__media { overflow: hidden; }
.rb-modal.is-projekt .rb-modal__media::before {
	content: "";
	position: absolute;
	inset: -40px;
	background: var(--rb-modal-bild) center / cover no-repeat;
	filter: blur(28px) brightness(.7) saturate(1.1);
}
/* Bild bleibt absolut positioniert → beeinflusst die Popup-Höhe nicht (sonst „wandert“ es beim Laden) */
.rb-modal.is-projekt .rb-modal__media img {
	inset: clamp(1rem, 2.5vw, 1.8rem);
	z-index: 1;
	width: calc(100% - 2 * clamp(1rem, 2.5vw, 1.8rem));
	height: calc(100% - 2 * clamp(1rem, 2.5vw, 1.8rem));
	object-fit: contain;
	object-position: center;
	filter: drop-shadow(0 16px 30px rgba(0, 0, 0, .45));
}
.rb-modal.is-projekt .rb-modal__media::after { display: none; }
.rb-modal__media img { transition: opacity .25s ease; }
.rb-modal__media img.is-switching { opacity: .35; }

/* Karussell im Popup (Galerie-Projekt) */
.rb-carousel[hidden] { display: none; }
.rb-carousel__btn {
	position: absolute;
	top: 50%;
	z-index: 3;
	width: 2.9rem;
	height: 2.9rem;
	display: grid;
	place-items: center;
	translate: 0 -50%;
	border-radius: 50%;
	border: 2px solid #C99A5C;
	background: #B98647;
	color: #fff;
	cursor: pointer;
	box-shadow: inset 3px 3px 7px #8F6331, inset -3px -3px 7px #E2B577, 0 8px 20px rgba(0, 0, 0, .35);
	transition: box-shadow .2s ease;
}
.rb-carousel__btn:hover,
.rb-carousel__btn:focus-visible { outline: none; box-shadow: inset 2px 2px 5px #8F6331, inset -2px -2px 5px #E2B577, 0 0 0 3px rgba(230, 188, 118, .45); }
.rb-carousel__btn svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rb-carousel__prev { left: .9rem; }
.rb-carousel__next { right: .9rem; }
.rb-carousel__dots {
	position: absolute;
	left: 50%;
	bottom: .55rem;
	z-index: 3;
	display: flex;
	gap: .45rem;
	translate: -50% 0;
	padding: .35rem .6rem;
	border-radius: 999px;
	background: rgba(20, 14, 8, .45);
}
.rb-carousel__dots button {
	width: .55rem;
	height: .55rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 250, 243, .55);
	cursor: pointer;
	transition: background .2s, transform .2s;
}
.rb-carousel__dots button[aria-current="true"] { background: #E2B577; transform: scale(1.3); }
.rb-modal__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(20, 14, 8, 0) 55%, rgba(20, 14, 8, .55) 100%);
}
.rb-modal__badge {
	position: absolute;
	left: 1.4rem;
	bottom: 1.4rem;
	z-index: 1;
	padding: .45rem .9rem;
	border-radius: 4px;
	background: var(--rbm-bronze);
	color: #fff;
	font-size: .78rem;
	letter-spacing: .04em;
	box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .5);
}

/* Formular rechts */
.rb-modal__body {
	min-height: 0; /* Formular scrollt in sich, Bildspalte bleibt fest */
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: clamp(1.8rem, 3.5vw, 2.8rem) clamp(1.5rem, 3.5vw, 2.8rem);
}
.rb-modal__eyebrow {
	margin: 0 0 .7rem;
	font-size: .72rem;
	font-weight: 500;
	letter-spacing: .3em;
	text-transform: uppercase;
	color: var(--rbm-bronze);
}
.rb-modal__title {
	margin: 0 0 .5rem;
	font-family: var(--rbm-serif);
	font-weight: 400;
	font-size: clamp(1.7rem, 3vw, 2.2rem);
	line-height: 1.1;
	color: var(--rbm-ink);
}
.rb-modal__intro { margin: 0 0 1.6rem; font-size: .92rem; }

.rb-modal__close {
	position: absolute;
	top: .9rem;
	right: .9rem;
	z-index: 3;
	width: 2.6rem;
	height: 2.6rem;
	display: grid;
	place-items: center;
	border: 1px solid var(--rbm-line);
	border-radius: 50%;
	background: var(--rbm-paper);
	color: var(--rbm-ink);
	cursor: pointer;
	transition: background-color .2s, color .2s, transform .2s var(--rbm-ease);
}
.rb-modal__close svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.rb-modal__close:hover { background: var(--rbm-bronze); color: #fff; transform: rotate(90deg); }

.rb-form__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem 1rem;
}
.rb-field { display: grid; gap: .4rem; margin: 0; align-content: start; }
.rb-field--full { grid-column: 1 / -1; }
.rb-field > span {
	font-size: .7rem;
	font-weight: 500;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--rbm-text);
}
.rb-field input,
.rb-field select,
.rb-field textarea {
	width: 100%;
	box-sizing: border-box;
	padding: .9rem 1.1rem;
	/* Neumorphismus in Creme: Feld wirkt in die Fläche eingedrückt */
	border: 2px solid #EFE4D6;
	border-radius: 14px;
	background-color: var(--rbm-cream);
	color: var(--rbm-ink);
	font: inherit;
	font-size: .95rem;
	box-shadow: inset 4px 4px 9px #D9CAB6, inset -4px -4px 9px #FFFFFF;
	transition: box-shadow .2s ease-in-out, border-color .2s ease-in-out;
}
.rb-field textarea { resize: vertical; min-height: 5.5rem; border-radius: 16px; }
.rb-field select {
	appearance: none;
	padding-right: 2.6rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A6763F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 1rem center;
	background-size: 1rem;
	cursor: pointer;
}
.rb-field input::placeholder,
.rb-field textarea::placeholder { color: #ADA295; }
.rb-field input:hover,
.rb-field select:hover,
.rb-field textarea:hover {
	box-shadow: inset 3px 3px 7px #D9CAB6, inset -3px -3px 7px #FFFFFF;
}
.rb-field input:focus,
.rb-field select:focus,
.rb-field textarea:focus {
	outline: none;
	border-color: rgba(166, 118, 63, .45);
	box-shadow:
		inset 2px 2px 5px #D9CAB6,
		inset -2px -2px 5px #FFFFFF,
		2px 2px 5px #D9CAB6,
		-2px -2px 5px #FFFFFF;
}
.rb-field.has-error input,
.rb-field.has-error select,
.rb-field.has-error textarea {
	border-color: rgba(180, 71, 58, .45);
	box-shadow: inset 4px 4px 9px #E3C2B8, inset -4px -4px 9px #FFFFFF;
}
.rb-field__error {
	font-style: normal;
	font-size: .75rem;
	color: #B4473A;
	min-height: 0;
}
.rb-field__error:empty { display: none; }

.rb-check {
	display: flex;
	gap: .7rem;
	align-items: flex-start;
	margin: 1.3rem 0 .3rem;
	font-size: .8rem;
	line-height: 1.5;
	cursor: pointer;
}
.rb-check input {
	flex: none;
	appearance: none;
	width: 1.35rem;
	height: 1.35rem;
	margin: 0;
	border: 2px solid #EFE4D6;
	border-radius: 7px;
	background: var(--rbm-cream);
	box-shadow: inset 3px 3px 6px #D9CAB6, inset -3px -3px 6px #FFFFFF;
	cursor: pointer;
	display: grid;
	place-items: center;
	transition: background-color .2s, box-shadow .2s;
}
.rb-check input::after {
	content: "";
	width: .7rem;
	height: .7rem;
	background: #fff;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
	transform: scale(0);
	transition: transform .15s ease-out;
}
.rb-check input:checked {
	border-color: #C99A5C;
	background: #B98647;
	box-shadow: inset 2px 2px 5px #8F6331, inset -2px -2px 5px #E2B577;
}
.rb-check input:checked::after { transform: scale(1); }
.rb-check input:focus-visible { outline: 2px solid var(--rbm-bronze); outline-offset: 2px; }
.rb-check a { color: var(--rbm-bronze); }

.rb-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

.rb-form__message {
	margin: 1rem 0 0;
	padding: .8rem 1rem;
	border-radius: 4px;
	background: rgba(180, 71, 58, .08);
	color: #9A3B30;
	font-size: .85rem;
}

/* Absende-Button im Stil des Haupt-CTA (Gold, neumorph) */
.rb-form__submit {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .7rem;
	width: 100%;
	margin-top: 1.4rem;
	padding: 1.05rem 1.5rem;
	border: 2px solid #C99A5C;
	border-radius: 999px;
	background-color: #B98647;
	color: #fff;
	font: inherit;
	font-size: .95rem;
	font-weight: 500;
	letter-spacing: .06em;
	text-transform: uppercase;
	cursor: pointer;
	box-shadow: inset 4px 4px 10px #8F6331, inset -4px -4px 10px #E2B577;
	transition: box-shadow .2s ease-in-out, opacity .2s;
}
.rb-form__submit::after {
	content: "";
	width: 1.05em;
	height: 1.05em;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h16M14 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h16M14 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.rb-form__submit:hover,
.rb-form__submit:focus-visible {
	outline: none;
	box-shadow: inset 2px 2px 5px #8F6331, inset -2px -2px 5px #E2B577, 2px 2px 5px #8F6331, -2px -2px 5px #E2B577;
}
.rb-form__submit[disabled] { opacity: .7; cursor: progress; }
.rb-form__submit[disabled]::after {
	-webkit-mask: none;
	mask: none;
	background: none;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: rb-spin .7s linear infinite;
}
@keyframes rb-spin { to { transform: rotate(360deg); } }
.rb-form__submit--ghost::after { display: none; }

/* Erfolg */
.rb-success {
	display: grid;
	align-content: center;
	justify-items: start;
	min-height: 100%;
	gap: .4rem;
}
.rb-success[hidden] { display: none; }
.rb-success__icon {
	width: 4rem;
	height: 4rem;
	display: grid;
	place-items: center;
	margin-bottom: 1rem;
	border-radius: 50%;
	background: var(--rbm-bronze);
	box-shadow: inset 3px 3px 8px #8F6331, inset -3px -3px 8px #E2B577;
}
.rb-success__icon svg { width: 1.8rem; height: 1.8rem; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.rb-success .rb-form__submit { width: auto; padding-inline: 2.2rem; }

/* Smartphone: Vollbild-Sheet, Bild als schmales Banner oben */
@media (max-width: 760px) {
	.rb-modal {
		width: 100vw;
		max-height: 100dvh;
		height: 100dvh;
		border-radius: 0;
	}
	.rb-modal__panel {
		grid-template-columns: 1fr;
		grid-template-rows: 150px 1fr;
		height: 100dvh;
		max-height: 100dvh;
	}
	.rb-modal__media { min-height: 0; }
	.rb-modal__badge { left: 1rem; bottom: 1rem; }
	.rb-form__grid { grid-template-columns: 1fr; }
	.rb-modal__close { background: rgba(251, 247, 241, .92); }
}

@media (prefers-reduced-motion: reduce) {
	.rb-modal[open], .rb-modal[open]::backdrop { animation: none; }
}

/* ---------- Auslöser-Button „Anfrage stellen“ ---------- */
.is-style-rb-anfrage .wp-block-button__link {
	padding: .8rem 1.4rem;
	border: 2px solid #C99A5C;
	border-radius: 999px;
	background-color: #B98647;
	color: #fff;
	font-size: .78rem;
	font-weight: 500;
	letter-spacing: .1em;
	text-transform: uppercase;
	box-shadow: inset 3px 3px 8px #8F6331, inset -3px -3px 8px #E2B577;
	transition: box-shadow .2s ease-in-out;
}
.is-style-rb-anfrage .wp-block-button__link::after {
	content: "";
	width: 1em;
	height: 1em;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h16M14 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h16M14 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.is-style-rb-anfrage .wp-block-button__link:hover,
.is-style-rb-anfrage .wp-block-button__link:focus-visible {
	color: #fff;
	background-color: #B98647;
	box-shadow: inset 2px 2px 5px #8F6331, inset -2px -2px 5px #E2B577, 2px 2px 5px #8F6331, -2px -2px 5px #E2B577;
}


/* ---------- Eingebettetes Formular (Shortcode [rb_anfrage_formular]) ---------- */
.rb-inline-form {
	position: relative;
	color: var(--rbm-text);
	font-family: var(--rbm-sans);
}
.rb-inline-form .rb-success { min-height: 24rem; padding: 1rem 0; }
.rb-inline-form .rb-form__submit { margin-top: 1.6rem; }
