/* =========================================================================
   Hermann & Partner – global styles
   Design tokens live in theme.json; block-specific styles in blocks/.
   ========================================================================= */

:root {
	--hp-icon-size: 1em;
	/* Admin bar + contact bar (2.5rem) + header: anchor links land below the sticky header. */
	--hp-header-offset: calc(var(--wp-admin--admin-bar--height, 0px) + 2.5rem + var(--wp--custom--header--height));
}

html {
	-webkit-tap-highlight-color: transparent;
	scroll-padding-top: calc(var(--hp-header-offset) + 1rem);
}

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

:where(h1, h2, h3, h4, h5, h6) {
	hyphens: auto;
	text-wrap: balance;
	overflow-wrap: break-word;
}

:where(p, li) {
	text-wrap: pretty;
}

/* Text links: thin underline, green on hover. */
:where(.entry-content, .site-footer) a:where(:not(.wp-element-button, .wp-block-button__link)) {
	text-decoration-thickness: 1px;
	text-underline-offset: 0.25em;
	transition: text-decoration-color 0.2s ease;
}

:where(.entry-content, .site-footer) a:where(:not(.wp-element-button, .wp-block-button__link)):hover {
	text-decoration-color: var(--wp--preset--color--accent);
}

/* Bold text keeps the colour of its surroundings. */
:where(b, strong) {
	color: inherit;
}

/* Keyboard focus. */
:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 3px;
}

.is-style-section-dark :focus-visible,
.wp-block-cover :focus-visible {
	outline-color: currentColor;
}

/* Vorzeile ("kicker") inside headings: <span class="hp-kicker">Unsere</span> Rechtsgebiete */
.hp-kicker {
	display: block;
	font-weight: 200;
	font-size: 0.8em;
}

/* Icons via CSS mask – colour follows currentColor / background-color. */
.hp-icon::before {
	content: "";
	display: inline-block;
	flex: none;
	width: var(--hp-icon-size);
	height: var(--hp-icon-size);
	background-color: currentColor;
	mask: var(--hp-icon) center / contain no-repeat;
}

.hp-icon--mail { --hp-icon: url(../images/icons/mail.svg); }
.hp-icon--phone { --hp-icon: url(../images/icons/phone.svg); }
.hp-icon--location { --hp-icon: url(../images/icons/location.svg); }
.hp-icon--fax { --hp-icon: url(../images/icons/fax.svg); }
.hp-icon--check { --hp-icon: url(../images/icons/check.svg); }
.hp-icon--scale { --hp-icon: url(../images/icons/scale.svg); }
.hp-icon--usp-erfahrung { --hp-icon: url(../images/icons/usp-erfahrung.svg); }
.hp-icon--usp-verfahren { --hp-icon: url(../images/icons/usp-verfahren.svg); }
.hp-icon--usp-vertraege { --hp-icon: url(../images/icons/usp-vertraege.svg); }

/* Visually hidden, still read by screen readers. */
.screen-reader-text:not(:focus) {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}


/* =========================================================================
   Header
   ========================================================================= */
.site-header {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 100;
	background: var(--wp--preset--color--base) url(../images/site-bg.jpg);
	box-shadow: 0 1px 0 rgb(0 0 0 / 0.06);
}

@media (max-width: 600px) {
	/* The admin bar scrolls away on small screens. */
	.site-header {
		top: 0;
	}
}

.hp-topbar {
	background: var(--wp--preset--color--light);
	border-top: 2px solid var(--wp--preset--color--accent);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
}

.hp-topbar__links {
	display: flex;
	justify-content: flex-end;
	gap: 0.25rem 1.5rem;
	min-height: 2.5rem;
	align-items: center;
	margin: 0;
}

.hp-topbar__links a {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	text-decoration: none;
	transition: opacity 0.2s ease;
}

.hp-topbar__links a:hover {
	opacity: 0.6;
}

.hp-topbar__links a::before {
	content: "";
	width: 1.1em;
	height: 1.1em;
	background-color: currentColor;
	mask: var(--hp-icon) center / contain no-repeat;
}

.hp-topbar__links a[href^="mailto:"] { --hp-icon: url(../images/icons/mail.svg); }
.hp-topbar__links a[href^="tel:"] { --hp-icon: url(../images/icons/phone.svg); }

.hp-header__bar {
	min-height: var(--wp--custom--header--height);
}

.hp-header__bar .wp-block-site-logo img {
	width: auto;
	height: clamp(48px, 2.5rem + 1.5vw, 60px);
}

@media (max-width: 989px) {
	.hp-topbar {
		display: none;
	}

	.site-header {
		border-top: 2px solid var(--wp--preset--color--accent);
	}
}


/* =========================================================================
   Layout helpers
   ========================================================================= */

/* Full-width sections directly inside the content need no gap between them. */
.entry-content > .alignfull {
	margin-block: 0;
}

/* Page intro (cover with heading left, quote right). */
.hp-page-hero .wp-block-cover__inner-container {
	width: 100%;
}

.hp-page-hero em {
	font-size: var(--wp--preset--font-size--medium);
}

/* Narrow centred text column. */
.hp-narrow {
	max-width: 46rem;
	margin-inline: auto !important;
}


/* =========================================================================
   Home: slider
   ========================================================================= */
.hp-slider {
	position: relative;
	display: grid;
	background: var(--wp--preset--color--primary);
	border-bottom: 4px solid var(--wp--preset--color--accent);
}

.hp-slider > .wp-block-cover {
	grid-area: 1 / 1;
	margin: 0 !important; /* no block gap: all slides lie exactly on top of each other */
	min-height: clamp(375px, 40vw, 500px) !important;
	transition: opacity 0.8s ease, visibility 0.8s;
}

.hp-slider.is-ready > .wp-block-cover:not(.is-active) {
	opacity: 0;
	visibility: hidden;
}

/* Captions swap quickly so two texts never overlap. */
.hp-slider .wp-block-cover__inner-container {
	transition: opacity 0.3s ease;
}

.hp-slider.is-ready > .wp-block-cover:not(.is-active) .wp-block-cover__inner-container {
	opacity: 0;
}

/* Without JavaScript only the first slide is shown. */
.hp-slider:not(.is-ready) > .wp-block-cover ~ .wp-block-cover {
	display: none;
}

.hp-slider p {
	max-width: 40rem;
	margin-inline: auto;
	font-size: var(--wp--preset--font-size--large);
	font-weight: 500;
	text-align: center;
	text-wrap: balance;
	text-shadow: 0 1px 12px rgb(0 0 0 / 0.5);
}

.hp-slider__controls {
	position: absolute;
	inset-inline: 0;
	bottom: 1rem;
	z-index: 2;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 0.5rem;
}

.hp-slider__controls button {
	display: grid;
	place-content: center;
	width: 1.5rem;
	height: 1.5rem;
	padding: 0;
	border: 1.5px solid #fff;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	cursor: pointer;
}

.hp-slider__controls button[aria-current="true"] {
	background: #fff;
}

.hp-slider__controls .hp-slider__pause {
	margin-inline-start: 0.75rem;
	border-radius: 0.25rem;
}

/* Pause icon: two bars; play icon: triangle. */
.hp-slider__pause::before {
	content: "";
	width: 0.55rem;
	height: 0.6rem;
	background: linear-gradient(to right, currentColor 35%, transparent 35% 65%, currentColor 65%);
}

.hp-slider__pause.is-paused::before {
	width: 0.55rem;
	background: currentColor;
	clip-path: polygon(10% 0, 100% 50%, 10% 100%);
}


/* =========================================================================
   Icon list (contact data): green square with white icon, text beside it
   <div class="hp-iconlist"><div class="hp-icon--mail"><p><strong>E-Mail</strong></p><p>…</p></div>…</div>
   ========================================================================= */
.hp-iconlist {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
	gap: 1.5rem 2rem;
}

.hp-iconlist > * {
	position: relative;
	min-height: 2.75em;
	margin: 0 !important;
	padding-left: 4em;
}

.hp-iconlist > *::before,
.hp-iconlist > *::after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
}

.hp-iconlist > *::before {
	width: 2.75em;
	height: 2.75em;
	background: var(--wp--preset--color--accent);
	border-radius: 0.5em 0 0.5em 0;
}

.hp-iconlist > *::after {
	top: 0.625em;
	left: 0.625em;
	width: 1.5em;
	height: 1.5em;
	background: #fff;
	mask: var(--hp-icon) center / contain no-repeat;
}

.hp-iconlist.hp-iconlist > * > * {
	margin: 0;
}

.hp-iconlist strong {
	text-transform: uppercase;
}


/* =========================================================================
   USP figures
   ========================================================================= */
.hp-usp {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
	gap: 2rem;
	padding-block: 2rem;
}

.hp-usp > * {
	display: grid;
	grid-template-columns: auto 1fr;
	column-gap: 1rem;
	align-items: start;
	margin: 0 !important;
}

.hp-usp > *::before {
	content: "";
	grid-row: span 2;
	width: clamp(2.5rem, 2rem + 1.75vw, 3.45rem);
	aspect-ratio: 1;
	background-color: var(--wp--preset--color--accent);
	mask: var(--hp-icon) center / contain no-repeat;
}

.hp-usp.hp-usp > * > * {
	grid-column: 2;
	margin: 0;
}

.hp-usp__number {
	font-size: var(--wp--preset--font-size--xx-large);
	font-weight: 700;
	line-height: 1.2;
	font-variant-numeric: tabular-nums;
}

.hp-usp__number + p {
	opacity: 0.8;
}


/* =========================================================================
   Reference logos (marquee)
   ========================================================================= */
.hp-logos {
	position: relative;
	overflow: hidden;
	margin-block: 2rem;
}

.hp-logos__track {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hp-logos.is-running .hp-logos__track {
	flex-wrap: nowrap;
	width: max-content;
	animation: hp-marquee var(--hp-marquee-duration, 60s) linear infinite;
}

.hp-logos.is-paused .hp-logos__track,
.hp-logos.is-running:hover .hp-logos__track,
.hp-logos.is-running:focus-within .hp-logos__track {
	animation-play-state: paused;
}

@keyframes hp-marquee {
	to { transform: translateX(-50%); }
}

.hp-logos figure {
	margin: 0;
	flex: none;
}

.hp-logos img {
	display: block;
	width: clamp(140px, 12vw, 200px);
	height: 90px;
	padding: 1em;
	object-fit: contain;
	background: #fff;
	filter: grayscale(1);
	transition: filter 0.25s ease;
}

.hp-logos a:hover img,
.hp-logos a:focus-visible img {
	filter: none;
}

.hp-logos__toggle {
	margin-top: 0.75rem;
	padding: 0.35em 0.9em;
	border: 1px solid currentColor;
	border-radius: 0.25rem;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
	cursor: pointer;
}


/* =========================================================================
   Areas of law grid (Query Loop)
   ========================================================================= */
.hp-areas .wp-block-post-template {
	gap: 0.5rem;
}

.hp-areas .wp-block-post {
	position: relative;
	overflow: hidden;
	background: var(--wp--preset--color--primary);
}

.hp-areas .wp-block-post-featured-image {
	margin: 0;
}

.hp-areas .wp-block-post-featured-image img {
	aspect-ratio: 5 / 4;
	width: 100%;
	object-fit: cover;
	transition: transform 0.6s ease;
}

.hp-areas .wp-block-post:hover img,
.hp-areas .wp-block-post:focus-within img {
	transform: scale(1.04);
}

.hp-areas .wp-block-post::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(to top, rgb(0 0 0 / 0.8) 25%, rgb(19 26 43 / 0.15) 100%);
	pointer-events: none;
}

.hp-areas .wp-block-post-title {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: grid;
	place-content: center;
	margin: 0;
	padding: 1rem;
	color: #fff;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	text-align: center;
}

/* The whole tile is clickable. */
.hp-areas .wp-block-post-title a {
	color: inherit;
	text-decoration: none;
}

.hp-areas .wp-block-post-title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.hp-areas .wp-block-post-title a:focus-visible {
	outline: none;
}

.hp-areas .wp-block-post:has(a:focus-visible) {
	outline: 3px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}


/* =========================================================================
   Profile card
   ========================================================================= */
.hp-profile {
	max-width: 36rem;
}

.hp-profile > .wp-block-image {
	max-width: 20rem;
	margin: 0;
}

.hp-profile > .wp-block-image img {
	aspect-ratio: 1;
	object-fit: cover;
	border-radius: 1rem;
}

.hp-profile__card {
	position: relative;
	width: min(30rem, 90%);
	margin: -2rem 0 0 10% !important;
	padding: 1.5rem;
	background: var(--wp--preset--color--base);
	border-left: 4px solid var(--wp--preset--color--accent);
	box-shadow: var(--wp--custom--shadow);
	font-size: var(--wp--preset--font-size--small);
}

.hp-profile__card > * {
	margin-block: 0;
}

.hp-profile__card h3 {
	font-size: var(--wp--preset--font-size--small);
}

.hp-profile__areas {
	position: relative;
	padding-left: 2.5em;
	margin-top: 1rem !important;
}

.hp-profile__areas::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.1em;
	width: 1.5em;
	height: 1.5em;
	background: currentColor;
	mask: url(../images/icons/scale.svg) center / contain no-repeat;
}

.hp-profile__areas li {
	font-size: 0.75rem;
	line-height: 1.6;
}

.hp-profile__card .wp-block-buttons {
	margin-top: 1.5rem;
	gap: 0.5rem;
}

.hp-profile__card .wp-block-button__link {
	padding: 0.3em 1em;
	border: 1px solid;
	border-radius: 0.2em;
	box-shadow: none;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
}

.hp-profile__card .wp-block-button.is-style-outline .wp-block-button__link {
	color: var(--wp--preset--color--signal);
	border-color: currentColor;
	background: transparent;
}


/* =========================================================================
   Call to action box (former promobox)
   ========================================================================= */
.hp-cta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem 4rem;
}

.hp-cta > * {
	margin-block: 0 !important; /* button stays vertically centred next to the text */
}

.hp-cta > p {
	flex: 1 1 20rem;
	max-width: 45rem;
	margin: 0;
	font-size: var(--wp--preset--font-size--large);
	text-wrap: balance;
}


/* =========================================================================
   Forms (Formidable)
   ========================================================================= */
:where(.frm_forms) :is(input:not([type="checkbox"], [type="radio"], [type="submit"]), select, textarea) {
	padding: 1em !important;
	border: 1px solid currentColor !important;
	border-radius: 0.5em !important;
	font-family: inherit;
	font-size: var(--wp--preset--font-size--medium) !important;
	transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

:where(.frm_forms) :is(input:not([type="checkbox"], [type="radio"], [type="submit"]), select, textarea):focus {
	border-color: var(--wp--preset--color--accent) !important;
	box-shadow: 0 0 0 0.3em color-mix(in srgb, var(--wp--preset--color--accent) 20%, transparent) !important;
	outline: none;
}

/* Invalid fields: Formidable's error colour (Formidable → Styles), red focus ring. */
.frm_forms :is(input, select, textarea)[aria-invalid="true"] {
	border-color: var(--border-color-error, #b32d2e) !important;
}

.frm_forms :is(input, select, textarea)[aria-invalid="true"]:focus {
	box-shadow: 0 0 0 0.3em color-mix(in srgb, var(--border-color-error, #b32d2e) 20%, transparent) !important;
}

.frm_forms .frm_primary_label {
	color: inherit !important;
	font-size: var(--wp--preset--font-size--small) !important;
	font-weight: 700 !important;
}

.frm_forms .frm_required {
	color: inherit !important;
}

.frm_forms :is(.frm_description, .frm_error) {
	font-size: var(--wp--preset--font-size--small) !important;
}

.frm_forms .frm_error {
	margin-top: 0.4em !important;
	color: #b32d2e !important;
}

.frm_forms .frm_button_submit {
	/* Same look as the block buttons (core-button.css / theme.json). */
	font-family: var(--wp--preset--font-family--body) !important;
	line-height: 1.4 !important;
	padding: 1em 2em !important;
	border: 3px solid #fff !important;
	border-radius: 0 !important;
	box-shadow: 0 0 0 1px var(--wp--preset--color--primary) !important;
	background: var(--wp--preset--color--primary) !important;
	color: #fff !important;
	font-size: var(--wp--preset--font-size--x-small) !important;
	font-weight: 700 !important;
	letter-spacing: 0.35em !important;
	text-transform: uppercase;
	transition: translate 0.2s ease;
}

.frm_forms .frm_button_submit:hover {
	translate: 0 -2px;
}


/* =========================================================================
   Footer
   ========================================================================= */
.site-footer {
	background: var(--wp--preset--color--light);
	font-size: var(--wp--preset--font-size--small);
	/* Room for the floating review badge. */
	padding-bottom: 6rem;
}

.site-footer .wp-block-navigation {
	font-size: inherit;
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
}


/* =========================================================================
   Reduced motion
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}


/* =========================================================================
   Content rhythm
   ========================================================================= */
.entry-content :where(p, .wp-block-list) + h3.wp-block-heading {
	margin-top: 2em;
}

/* Legal pages: smaller type. */
:is(.page-impressum, .page-datenschutzerklaerung) .entry-content {
	font-size: var(--wp--preset--font-size--small);
}

:is(.page-impressum, .page-datenschutzerklaerung) .entry-content h1 {
	font-size: var(--wp--preset--font-size--x-large);
}

:is(.page-impressum, .page-datenschutzerklaerung) .entry-content h2 {
	font-size: var(--wp--preset--font-size--medium);
	margin-top: 2em;
}


/* No block gap between header, main and footer. */
.wp-site-blocks > * + * {
	margin-block-start: 0;
}

/* Larger building blocks inside a section get more room above them. */
.entry-content > .alignfull > * + :where(.wp-block-columns, .wp-block-query, .wp-block-buttons, .hp-faq, .hp-cta, .hp-narrow),
.entry-content > .alignfull > :where(.wp-block-columns, .wp-block-query, .hp-narrow) + *,
.wp-block-cover__inner-container > * + :where(.wp-block-columns, .hp-iconlist, .wp-block-group.alignwide),
.wp-block-cover__inner-container > :where(.wp-block-columns, .hp-iconlist) + * {
	margin-block-start: var(--wp--preset--spacing--50);
}


/* =========================================================================
   Areas grid with short description: 5 per row, title + excerpt at the bottom
   ========================================================================= */
.hp-areas.alignwide {
	max-width: min(1600px, 100%) !important;
	margin-inline: auto !important;
}

.hp-areas--excerpt .wp-block-post-template {
	grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
}

@media (max-width: 1099px) {
	.hp-areas--excerpt .wp-block-post-template {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}
}

@media (max-width: 599px) {
	.hp-areas--excerpt .wp-block-post-template {
		grid-template-columns: minmax(0, 1fr) !important;
	}

	.hp-areas--excerpt .wp-block-post-featured-image img {
		aspect-ratio: 16 / 10 !important;
	}
}

/* Stack image, title and excerpt in one cell; text sits at the bottom. */
.hp-areas--excerpt .wp-block-post {
	display: grid;
	grid-template-rows: 1fr auto auto;
}

.hp-areas--excerpt .wp-block-post > * {
	grid-column: 1;
}

.hp-areas--excerpt .wp-block-post-featured-image {
	grid-row: 1 / -1;
}

.hp-areas--excerpt .wp-block-post-featured-image img {
	height: 100%;
}

.hp-areas--excerpt .wp-block-post-title {
	position: static;
	grid-row: 2;
	display: block;
	padding: 0 1rem 0.4rem;
	align-self: end;
	hyphens: auto;
}

.hp-areas--excerpt .wp-block-post-excerpt {
	grid-row: 3;
	margin: 0;
	padding: 0 1rem 1.25rem;
	color: #fff;
	font-size: var(--wp--preset--font-size--x-small);
	line-height: 1.4;
	text-align: center;
	opacity: 0.85;
	pointer-events: none;
}

.hp-areas--excerpt .wp-block-post-excerpt__excerpt {
	margin: 0;
}

/* Darken the image towards the bottom (mask instead of an overlay, so the text stays on top). */
.hp-areas--excerpt .wp-block-post {
	background: #0b0f16;
}

.hp-areas--excerpt .wp-block-post::before {
	display: none;
}

.hp-areas--excerpt .wp-block-post-featured-image img {
	mask-image: linear-gradient(to top, rgb(0 0 0 / 0.15) 10%, rgb(0 0 0 / 0.55) 45%, #000 85%);
}

/* Notes on the private "Vorlage" page (building blocks to copy). */
.hp-vorlage-hinweis {
	padding: 0.5rem 0.75rem;
	border: 1px dashed currentColor;
	border-radius: 0.25rem;
	font-size: var(--wp--preset--font-size--small);
	opacity: 0.7;
}

/* anwalt.de review widget: no own margin, aligned with the text. */
.hp-anwalt-sterne #widgetAnwaltde {
	margin: 0 !important;
}

/* Logo marquee: soft fade at the right edge. */
.hp-logos.is-running {
	mask-image: linear-gradient(to right, #000 92%, transparent);
}
