/**
 * Dilverse block styles: loaded on the front end AND inside the editor.
 *
 * Colors, sizes and spacing come from theme.json tokens
 * (--wp--preset--*, --wp--custom--*). Change a token there, not here.
 *
 * Sections:
 *  1. Utilities
 *  2. Carousel and slides (hero)
 *  3. Buttons
 *  4. Cards, badges, steps
 *  5. Text styles
 *  6. Lists, FAQ, galleries
 *  7. Query loop cards
 *  8. Lead form
 */

:root {
	--dv-brand: var(--wp--preset--color--brand);
	--dv-brand-dark: var(--wp--preset--color--brand-dark);
	--dv-accent: var(--wp--preset--color--accent);
	--dv-tint: var(--wp--preset--color--tint);
	--dv-line: var(--wp--preset--color--line);
	--dv-ink: var(--wp--preset--color--ink);
	--dv-field-border: rgba(109, 30, 37, 0.25);
	--dv-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ==========================================================================
   1. Utilities
   ========================================================================== */

/* Anchored sections land below the sticky header. */
[id] {
	scroll-margin-top: 110px;
}

/* Whole card is clickable through its main link (title or button). */
.dv-stretched-link {
	position: relative;
}

.dv-stretched-link :is(.wp-block-post-title a, .wp-block-button__link)::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.editor-styles-wrapper .dv-stretched-link :is(.wp-block-post-title a, .wp-block-button__link)::before {
	display: none; /* Keep inner blocks selectable in the editor. */
}

/* Astra underlines every content link. Keep that for links inside text,
   drop it where the link is the component itself (titles, tags, lists). */
.entry-content :is(.wp-block-post-title, .wp-block-post-terms, .is-style-links, .wp-block-social-links) a,
.entry-content a.wp-block-button__link,
.dv-lead-form a.wp-element-button {
	text-decoration: none;
}

/* Linked titles keep the heading color (Astra paints every link brand red). */
.wp-block-post-title a:not(:hover) {
	color: inherit;
}

.entry-content :is(.wp-block-post-title, .is-style-links) a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Astra indents every list; styled lists align with the text instead. */
:is(.is-style-checklist, .is-style-links) {
	margin-left: 0;
	margin-right: 0;
}

/* Centered eyebrow with a brand underline. */
.dv-underline {
	width: fit-content;
	margin-inline: auto;
	padding-bottom: 8px;
	border-bottom: 3px solid var(--dv-brand);
}

/* ==========================================================================
   2. Carousel and slides
   ========================================================================== */

.is-style-carousel {
	--dv-carousel-gap: 16px;
	--dv-carousel-per-view: 2;
	display: flex;
	flex-wrap: nowrap !important;
	gap: var(--dv-carousel-gap) !important;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.is-style-carousel::-webkit-scrollbar {
	display: none;
}

.is-style-carousel > * {
	flex: 0 0 calc((100% - (var(--dv-carousel-per-view) - 1) * var(--dv-carousel-gap)) / var(--dv-carousel-per-view));
	margin: 0 !important;
	scroll-snap-align: start;
}

@media (max-width: 781px) {
	.is-style-carousel {
		--dv-carousel-per-view: 1.15; /* Peek of the next card signals "swipe". */
	}
}

/* In the editor show every slide so each one can be edited. */
.editor-styles-wrapper .is-style-carousel {
	flex-wrap: wrap !important;
	overflow: visible;
}

.dv-carousel {
	position: relative;
}

.dv-carousel__btn {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: var(--dv-brand-dark);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
	cursor: pointer;
	transform: translateY(-50%);
	transition: transform 0.2s var(--dv-ease), background 0.2s;
}

.dv-carousel__btn:hover {
	background: var(--dv-tint);
}

.dv-carousel__btn:focus-visible {
	outline: 2px solid var(--dv-accent);
	outline-offset: 2px;
}

.dv-carousel__btn--prev {
	left: -16px;
}

.dv-carousel__btn--next {
	right: -16px;
}

.dv-carousel.is-static .dv-carousel__btn {
	display: none;
}

@media (max-width: 781px) {
	.dv-carousel__btn--prev {
		left: 4px;
	}

	.dv-carousel__btn--next {
		right: 4px;
	}
}

.is-style-slide {
	gap: 12px !important;
	min-height: 460px;
	padding-top: 30px;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--xl);
	transition: transform 0.25s var(--dv-ease), box-shadow 0.25s var(--dv-ease);
}

.is-style-slide > :not(.wp-block-image) {
	margin: 0 !important;
	padding-inline: 28px;
}

.is-style-slide > .wp-block-image {
	align-self: stretch;
	margin: auto 0 0 !important;
}

.is-style-slide > .wp-block-image img {
	display: block;
	width: 100%;
	transition: transform 0.4s var(--dv-ease);
}

.is-style-slide:hover {
	transform: translateY(-3px);
	box-shadow: var(--wp--preset--shadow--lift);
}

.is-style-slide:hover > .wp-block-image img {
	transform: scale(1.03);
}

/* ==========================================================================
   3. Buttons
   ========================================================================== */

/*
 * Single source of truth for Button blocks. Astra prints its Customizer
 * button CSS at the same specificity; this file loads after it, so these
 * rules win. Colors picked in the editor (has-*-color classes or inline
 * styles) still override everything here.
 */
.wp-block-button .wp-block-button__link {
	padding: 14px 24px;
	border: 0;
	border-radius: var(--wp--custom--radius--md);
	background-color: var(--dv-brand);
	color: #fff;
	font-family: inherit;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	letter-spacing: 0.04em;
	line-height: 1.4;
	text-decoration: none;
	transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.2s var(--dv-ease);
}

.wp-block-button .wp-block-button__link:hover,
.wp-block-button .wp-block-button__link:focus {
	background-color: var(--dv-brand-dark);
	color: #fff;
}

.wp-block-button .wp-block-button__link:focus-visible {
	outline: 2px solid var(--dv-accent);
	outline-offset: 2px;
}

.wp-block-button.is-style-dark .wp-block-button__link {
	background-color: var(--dv-brand-dark);
}

.wp-block-button.is-style-dark .wp-block-button__link:hover {
	background-color: var(--dv-brand);
}

.wp-block-button.is-style-light .wp-block-button__link {
	background-color: #fff;
	color: var(--dv-brand);
}

.wp-block-button.is-style-light .wp-block-button__link:hover {
	background-color: var(--dv-brand-dark);
	color: #fff;
}

/* Matches Astra's outline selector so this one wins. */
.wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link.wp-element-button {
	padding: 12px 22px;
	border: 2px solid currentColor;
	background-color: transparent;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
}

.wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link.wp-element-button:not(.has-text-color) {
	color: var(--dv-brand-dark);
}

.wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link.wp-element-button:hover {
	border-color: var(--dv-brand-dark);
	background-color: var(--dv-brand-dark);
	color: #fff;
}

/* Default buttons on colored sections flip to stay visible. */
.is-style-section-brand .wp-block-button:not([class*="is-style-"]) > .wp-block-button__link {
	background-color: #fff;
	color: var(--dv-brand);
}

.is-style-section-brand .wp-block-button:not([class*="is-style-"]) > .wp-block-button__link:hover {
	background-color: var(--dv-brand-dark);
	color: #fff;
}

.is-style-section-brand .wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link.wp-element-button:not(.has-text-color),
.is-style-section-dark .wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link.wp-element-button:not(.has-text-color) {
	color: #fff;
}

.is-style-section-brand .wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link.wp-element-button:hover,
.is-style-section-dark .wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link.wp-element-button:hover {
	border-color: #fff;
	background-color: #fff;
	color: var(--dv-brand-dark);
}

/* Cards are white islands: their links and buttons use the normal palette
   even when the card sits on a colored section. */
:is(.is-style-card, .is-style-card-outline, .is-style-card-tint, .is-style-form-card) a:not(.wp-element-button) {
	color: var(--dv-brand);
}

:is(.is-style-card, .is-style-form-card) .wp-block-button:not([class*="is-style-"]) > .wp-block-button__link,
.dv-lead-form .wp-element-button {
	background-color: var(--dv-brand);
	color: #fff;
}

/* Text link with an arrow. */
.wp-block-button.is-style-arrow .wp-block-button__link,
.wp-block-button.is-style-plain .wp-block-button__link {
	padding: 0;
	border-radius: 0;
	background: none;
	color: inherit;
	letter-spacing: 0;
}

.wp-block-button.is-style-arrow .wp-block-button__link::after {
	content: "→";
	display: inline-block;
	margin-left: 0.45em;
	transition: transform 0.2s var(--dv-ease);
}

.wp-block-button.is-style-arrow .wp-block-button__link:hover,
.dv-stretched-link:hover .is-style-arrow .wp-block-button__link {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.wp-block-button.is-style-arrow .wp-block-button__link:hover::after,
.dv-stretched-link:hover .is-style-arrow .wp-block-button__link::after {
	transform: translateX(4px);
}

.wp-block-button.is-style-plain .wp-block-button__link:hover {
	background: none;
	color: inherit;
	text-decoration: underline;
}

.dv-phone .wp-block-button__link {
	font-size: 20px;
	font-weight: 700;
	line-height: 1.15;
}

/* Round "play video" button. */
.wp-block-button.is-style-play .wp-block-button__link {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 120px;
	height: 120px;
	padding: 0 14px;
	border-radius: 50%;
	font-size: 11px;
	line-height: 1.25;
	text-align: center;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.wp-block-button.is-style-play .wp-block-button__link::before {
	content: "";
	width: 28px;
	height: 28px;
	background: currentColor;
	clip-path: polygon(22% 12%, 88% 50%, 22% 88%);
}

.wp-block-button.is-style-play .wp-block-button__link:hover {
	transform: scale(1.05);
}

/* Small tag-like buttons. */
.dv-tags {
	gap: 8px !important;
}

.dv-tags .wp-block-button__link {
	padding: 6px 12px;
	border-radius: var(--wp--custom--radius--sm);
	font-size: var(--wp--preset--font-size--x-small);
	letter-spacing: 0;
}

/* Full-width stacked pill buttons. */
.dv-stack {
	gap: 10px !important;
}

.dv-stack .wp-block-button__link {
	padding-block: 11px;
	border-radius: var(--wp--custom--radius--pill);
	font-size: 13px;
}

/* ==========================================================================
   4. Cards, badges, steps
   ========================================================================== */

/* Hero form card with a label sitting on its top border. */
.is-style-form-card {
	position: relative;
	height: 100%;
	padding: 34px 22px 22px;
	border: 3px solid var(--dv-brand);
	border-radius: var(--wp--custom--radius--xl);
	background: #fff;
	color: var(--dv-ink);
}

.is-style-form-card > p:first-child {
	position: absolute;
	top: 0;
	left: 50%;
	width: max-content;
	max-width: calc(100% - 24px);
	margin: 0;
	padding: 4px 12px;
	border-radius: var(--wp--custom--radius--sm);
	background: var(--dv-brand);
	color: #fff;
	font-size: 14px;
	line-height: 1.5;
	text-align: center;
	transform: translate(-50%, -50%);
}

.dv-hero > .wp-block-column:last-child {
	display: flex;
	flex-direction: column;
	padding-top: 14px; /* Room for the form card label. */
}

/* Circle badge with an inner white ring. */
.is-style-stat-circle {
	gap: 2px !important;
	width: 170px;
	height: 170px;
	border-radius: 50%;
	outline: 2px solid #fff;
	outline-offset: -10px;
	text-align: center;
}

.is-style-stat-circle > p {
	margin: 0 !important;
	color: inherit;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	line-height: 1.2;
}

.is-style-stat-circle > p:nth-child(2) {
	font-size: 44px;
	font-weight: 900;
	letter-spacing: 0;
	line-height: 1;
}

/* Auto-numbered step tiles: the number comes from the tile's position. */
.is-style-steps {
	counter-reset: dv-step;
}

.is-style-steps > * {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	gap: 6px;
	min-height: 170px;
	margin: 0 !important;
	padding: 18px;
	overflow: hidden;
	background: var(--dv-tint);
	counter-increment: dv-step;
	transition: background-color 0.25s, color 0.25s;
}

.is-style-steps > *::before {
	content: counter(dv-step);
	position: absolute;
	top: -14px;
	left: 10px;
	color: rgba(42, 20, 22, 0.07);
	font-size: 120px;
	font-weight: 900;
	line-height: 1;
	pointer-events: none;
	transition: color 0.25s;
}

.is-style-steps > * > * {
	position: relative;
	margin: 0 !important;
}

.is-style-steps > *:hover {
	background: var(--dv-brand);
	color: #fff;
}

.is-style-steps > *:hover::before {
	color: rgba(255, 255, 255, 0.2);
}

.is-style-steps > *:hover :is(h2, h3, h4) {
	color: #fff;
}

/* Level cards stretch to equal height. */
.dv-levels > * {
	height: 100%;
}

/* Image mosaic next to the lead form. */
.dv-mosaic {
	height: 100%;
	grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.dv-mosaic > * {
	min-height: 220px;
	margin: 0 !important;
}

.dv-mosaic > .wp-block-image img {
	width: 100%;
	height: 100%;
}

.dv-split > .wp-block-column {
	margin: 0 !important;
}

/* ==========================================================================
   5. Text styles
   ========================================================================== */

/* Highlight: bold words in the heading get an orange marker. */
.is-style-marker strong {
	padding: 0 4px;
	background: linear-gradient(transparent 60%, var(--dv-accent) 60%);
	font-weight: 700;
}

/* Orange square bullet before a line. */
.is-style-bullet {
	display: flex;
	align-items: center;
	gap: 10px;
}

.is-style-bullet::before {
	content: "";
	flex: none;
	width: 16px;
	height: 16px;
	background: var(--dv-accent);
}

/* Initial letter in a circle. */
p.is-style-avatar {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0 !important;
	border-radius: 50%;
	font-weight: 700;
	line-height: 1;
}

/* Five stars; the text stays readable for screen readers. */
p.is-style-stars {
	margin: 0;
	font-size: 0;
	line-height: 1;
}

p.is-style-stars::before {
	content: "★★★★★";
	content: "★★★★★" / "";
	color: var(--dv-accent);
	font-size: 16px;
	letter-spacing: 2px;
}

/* ==========================================================================
   6. Lists, FAQ, galleries, icons
   ========================================================================== */

.is-style-checklist {
	display: grid;
	gap: 8px;
	padding-left: 0 !important;
	list-style: none;
}

.is-style-checklist li {
	position: relative;
	padding-left: 30px;
}

.is-style-checklist li::before {
	content: "";
	position: absolute;
	top: 0.2em;
	left: 0;
	width: 20px;
	height: 20px;
	background: var(--dv-brand);
	-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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7'/%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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7'/%3E%3C/svg%3E") center / contain no-repeat;
}

.is-style-links {
	display: grid;
	gap: 10px;
	padding-left: 0 !important;
	list-style: none;
}

.is-style-links a {
	color: inherit;
}

.wp-block-image.is-style-icon {
	flex: none;
	margin: 0;
	line-height: 0;
}

.wp-block-image.is-style-icon img {
	display: block;
	height: auto;
}

/* Logo wall: calm grayscale until hover. */
.wp-block-gallery.is-style-logos .wp-block-image img {
	height: 80px !important;
	object-fit: contain !important;
	filter: grayscale(1);
	opacity: 0.75;
	transition: filter 0.25s, opacity 0.25s;
}

.wp-block-gallery.is-style-logos .wp-block-image:hover img {
	filter: none;
	opacity: 1;
}

/* FAQ accordion. */
.wp-block-details.is-style-faq {
	overflow: hidden;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.wp-block-details.is-style-faq[open] {
	border-color: var(--dv-brand);
	box-shadow: var(--wp--preset--shadow--soft);
}

.wp-block-details.is-style-faq > summary {
	position: relative;
	padding: 18px 56px 18px 22px;
	color: var(--dv-brand-dark);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.45;
	list-style: none;
	cursor: pointer;
}

.wp-block-details.is-style-faq > summary::-webkit-details-marker {
	display: none;
}

.wp-block-details.is-style-faq > summary::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 24px;
	width: 10px;
	height: 10px;
	border-right: 2.5px solid var(--dv-brand);
	border-bottom: 2.5px solid var(--dv-brand);
	transform: translateY(-70%) rotate(45deg);
	transition: transform 0.2s var(--dv-ease);
}

.wp-block-details.is-style-faq[open] > summary::after {
	transform: translateY(-30%) rotate(-135deg);
}

.wp-block-details.is-style-faq > summary:focus-visible {
	outline: 2px solid var(--dv-accent);
	outline-offset: -2px;
}

.wp-block-details.is-style-faq > :not(summary) {
	margin: 0 !important;
	padding: 0 22px 20px;
	line-height: 1.65;
}

/* ==========================================================================
   7. Query loop cards
   ========================================================================== */

.dv-program-card {
	height: 100%;
	overflow: hidden;
	transition: transform 0.25s var(--dv-ease), box-shadow 0.25s var(--dv-ease);
}

.dv-program-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--wp--preset--shadow--lift);
}

.dv-program-card .wp-block-post-title {
	margin: 0;
}

.dv-program-card .wp-block-post-excerpt {
	margin: 0;
}

.dv-program-card .wp-block-post-excerpt__more-link {
	color: var(--dv-brand);
	font-weight: 700;
}

.dv-program-card .wp-block-post-featured-image {
	width: 100%;
	margin: auto 0 0 !important;
}

.dv-program-card .wp-block-post-featured-image img {
	display: block;
}

.wp-block-post-template.is-layout-grid > li {
	margin: 0;
}

.dv-post-card__media {
	position: relative;
}

.dv-post-card__media .wp-block-post-featured-image {
	margin: 0;
	overflow: hidden;
	border-radius: 16px;
}

.dv-post-card__media .wp-block-post-featured-image img {
	transition: transform 0.4s var(--dv-ease);
}

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

.dv-post-card__media .wp-block-post-date {
	position: absolute;
	right: 14px;
	bottom: -14px;
	z-index: 2;
	margin: 0;
	padding: 6px 10px;
	border-radius: 8px;
	background: var(--dv-brand);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
}

/* Posts without a featured image: the date sits inline instead of floating. */
.dv-post-card__media:not(:has(.wp-block-post-featured-image)) .wp-block-post-date {
	position: static;
	display: inline-block;
}

.wp-block-post:nth-child(even) .dv-post-card__media .wp-block-post-date {
	background: var(--dv-brand-dark);
}

.dv-post-card .wp-block-post-terms {
	margin-top: 8px;
}

.dv-post-card .wp-block-post-title {
	margin: 0;
	line-height: 1.4;
}

/* ==========================================================================
   8. Lead form (works with Fluent Forms, Contact Form 7 or plain HTML forms)
   ========================================================================== */

.dv-lead-form :is(input[type="text"], input[type="email"], input[type="tel"], input[type="number"], select, textarea) {
	box-sizing: border-box;
	width: 100%;
	min-height: var(--wp--custom--control-height);
	padding: 0 14px;
	border: 1.5px solid var(--dv-field-border);
	border-radius: var(--wp--custom--radius--md);
	background: #fff;
	color: var(--dv-ink);
	font: inherit;
	font-size: 15px;
	box-shadow: none;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.dv-lead-form textarea {
	min-height: 96px;
	padding-block: 12px;
}

.dv-lead-form :is(input, select, textarea):focus {
	border-color: var(--dv-brand);
	outline: none;
	box-shadow: 0 0 0 3px rgba(202, 47, 51, 0.15);
}

.dv-lead-form label {
	color: var(--dv-brand-dark);
	font-size: 13px;
	font-weight: 700;
}

.dv-lead-form :is(input[type="checkbox"] + label, input[type="checkbox"] + span, .ff-el-form-check-label) {
	font-size: 12px;
	font-weight: 400;
	line-height: 1.45;
}

.dv-lead-form :is(button[type="submit"], input[type="submit"], .ff-btn-submit, .wpcf7-submit) {
	width: 100%;
	min-height: 52px;
	border: 0;
	border-radius: var(--wp--custom--radius--md);
	background: var(--dv-brand) !important;
	color: #fff !important;
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.06em;
	cursor: pointer;
	transition: background-color 0.2s;
}

.dv-lead-form--compact :is(button[type="submit"], input[type="submit"], .ff-btn-submit, .wpcf7-submit) {
	background: var(--dv-brand-dark) !important;
}

.dv-lead-form :is(button[type="submit"], input[type="submit"], .ff-btn-submit, .wpcf7-submit):hover {
	background: var(--dv-brand-dark) !important;
}

.dv-lead-form--compact :is(button[type="submit"], input[type="submit"], .ff-btn-submit, .wpcf7-submit):hover {
	background: var(--dv-brand) !important;
}

.dv-lead-form__notice {
	margin: 0 0 12px;
	padding: 10px 12px;
	border: 1px dashed var(--dv-accent);
	border-radius: 8px;
	background: #fff8ec;
	font-size: 13px;
	line-height: 1.5;
}

.dv-lead-form__fallback {
	display: grid;
	gap: 10px;
	text-align: center;
}

.dv-lead-form__fallback p {
	margin: 0 0 4px;
}

.dv-lead-form__fallback .wp-element-button {
	display: block;
}

.dv-lead-form__fallback .is-whatsapp {
	background: var(--dv-brand-dark);
}
