/* ==========================================================================
   ebg faq - ebg h04: legacy front page FAQ (ebg tj-info-box style-4
   beside tj-faq style-2), Greek copy.
   Left, an image panel (559px of 1296) with the heading on it and an accent
   call box in the bottom corner (phone bound to ebg/site). Right, core Details
   (one open at a time, name="ebg-fqb") on white cards; the open card turns
   accent with white text and a dashed rule under the question. Height
   animates natively (_core/elements/disclosure.css: ::details-content grid
   rows, works in Firefox too) instead of Bootstrap's JS collapse; the
   plus / minus ring is drawn in CSS instead of the ebg-icons glyphs, the
   phone with a Lucide mask. Cards rise in one after another
   (.ebg-reveal-children, ebg fadeInUp).
   ========================================================================== */

@layer components {

	.ebg-fqb {
		--ebg-fqb-band: var(--ebg-surface-0);
		--ebg-fqb-dur: 0.35s;
		--ebg-fqb-phone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z'/%3E%3C/svg%3E");

		inline-size: 100%;
		margin-block: 0;
		padding-block: var(--section-py);
		background-color: var(--ebg-fqb-band);

		& > .ebg-shell {
			margin-block: 0; /* Blocksy flow spacing */
		}

		& :where(p, h2, h3, figure) { margin: 0; }
	}

	/* Darker band, for pages where the section above uses surface-0. */
	.ebg-fqb.ebg-fqb--alt { --ebg-fqb-band: var(--ebg-surface-3); }

	.ebg-fqb__grid {
		display: grid;
		grid-template-columns: minmax(0, 559fr) minmax(0, 710fr);
		gap: 26px;
		align-items: start;

		& > * { margin-block: 0; }
	}

	/* ---- image panel ---- */

	.ebg-fqb__media {
		position: relative;
		isolation: isolate;
		min-block-size: 598px;
		padding: 40px 30px;
		overflow: hidden;

		& > * { margin-block: 0; }
	}

	.ebg-fqb .ebg-fqb__img {
		position: absolute;
		inset: 0;
		z-index: -1;

		& img {
			inline-size: 100%;
			block-size: 100%;
			object-fit: cover;
			object-position: left top;
		}
	}

	.ebg-fqb .ebg-fqb__title {
		max-inline-size: 400px;
		color: var(--ebg-on-accent);
		font-family: var(--font-display);
		font-size: 3rem;
		font-weight: 500;
		line-height: 1.125;
		/* Readable on any photo: a tight dark edge plus a soft wide glow. */
		text-shadow:
			0 1px 2px rgb(12 30 33 / 0.55),
			0 2px 18px rgb(12 30 33 / 0.45);
	}

	.ebg-fqb__call {
		position: absolute;
		inset-block-end: 0;
		inset-inline-end: 0;
		box-sizing: border-box;
		inline-size: 224px;
		padding: 25px 20px 30px;
		border-radius: 10px;
		background-color: var(--ebg-accent);

		& > * { margin-block: 0; }

		/* The notch it cuts into the photo (ebg .box-area.style-4): a 15px
		   frame in the band colour on the top and left, rounded 12px where it
		   turns, and a 13px concave fillet where it meets the photo's right
		   and bottom edges. One layer, outlined by clip-path: shape(), which
		   sizes from the box (Chromium and Firefox; corner-shape and
		   border-shape are Chromium-only). Without shape(): the frame only. */
		&::before {
			--f: var(--ebg-fqb-fillet, 13px);
			--w: var(--ebg-fqb-frame, 15px);
			--r: var(--ebg-fqb-frame-r, 12px);

			content: "";
			position: absolute;
			inset: calc(-1 * var(--w)) 0 0 calc(-1 * var(--w));
			z-index: -1;
			border-start-start-radius: var(--r);
			background-color: var(--ebg-fqb-band);
		}
	}

	@supports (clip-path: shape(from 0 0, line to 1px 1px)) {
		.ebg-fqb__call::before {
			inset: calc(-1 * (var(--w) + var(--f))) 0 0 calc(-1 * (var(--w) + var(--f)));
			border-radius: 0;
			clip-path: shape(
				from 100% 0,
				line to 100% 100%,
				line to 0 100%,
				arc to var(--f) calc(100% - var(--f)) of var(--f) ccw small,
				line to var(--f) calc(var(--f) + var(--r)),
				arc to calc(var(--f) + var(--r)) var(--f) of var(--r) cw small,
				line to calc(100% - var(--f)) var(--f),
				arc to 100% 0 of var(--f) ccw small,
				close
			);
		}
	}

	.ebg-fqb .ebg-fqb__call-title {
		margin-block-end: 28px;
		color: var(--ebg-on-accent);
		font-family: var(--font-display);
		font-size: 1.5rem;
		font-weight: 600;
		line-height: 1.333;
	}

	.ebg-fqb__call-actions { margin: 0; }

	/* The phone link: a 52px dark disc with the handset, then the number.
	   ::before is Blocksy's button shadow layer (display from
	   --theme-button-shadow, absolute, z-index -1, blur): reset all of it. */
	.ebg-fqb .ebg-fqb__phone {
		margin: 0;

		& .wp-block-button__link {
			display: grid;
			grid-template-columns: 52px auto;
			align-items: center;
			column-gap: 5px;
			min-block-size: 0;
			padding: 0;
			border: 0;
			border-radius: 0;
			background: none;
			box-shadow: none;
			color: var(--ebg-on-accent);
			font-family: var(--font-display);
			font-size: 1.25rem;
			font-weight: 600;
			line-height: 1;
			text-decoration: none;

			&::before,
			&::after {
				content: "";
				display: block;
				grid-area: 1 / 1;
				position: static;
				inset: auto;
				z-index: auto;
				opacity: 1;
				filter: none;
				transform: none;
			}

			&::before {
				inline-size: 52px;
				block-size: 52px;
				border-radius: 50%;
				background: var(--ebg-heading-ink);
				transition: background-color 0.3s ease;
			}

			&::after {
				justify-self: center;
				inline-size: 20px;
				block-size: 20px;
				background-color: var(--ebg-on-accent);
				mask: var(--ebg-fqb-phone) center / contain no-repeat;
				transition: background-color 0.3s ease;
			}

			&:is(:hover, :focus-visible)::before { background-color: var(--ebg-on-accent); }
			&:is(:hover, :focus-visible)::after { background-color: var(--ebg-accent); }
		}
	}

	/* ---- accordion ---- */

	.ebg-fqb__list {
		display: grid;
		gap: 20px;

		& > * { margin-block: 0; }
	}

	.ebg-fqb .ebg-fqb__item {
		--ebg-disclosure-dur: 0.4s;

		box-sizing: border-box;
		padding: 0 30px;
		border: 0;
		border-radius: 8px;
		background-color: #FFFFFF;
		transition: background-color var(--ebg-disclosure-dur) cubic-bezier(0.16, 1, 0.3, 1);

		&[open] { background-color: var(--ebg-accent); }

		& > summary {
			position: relative;
			margin: 0; /* core / Blocksy details CSS gives the summary a bottom margin */
			padding: 27px 60px 27px 0;
			border-block-end: 1px dashed transparent;
			color: var(--ebg-heading-ink);
			font-family: var(--font-display);
			font-size: 1.125rem;
			font-weight: 600;
			line-height: 1.45;
			transition:
				color var(--ebg-disclosure-dur) cubic-bezier(0.16, 1, 0.3, 1),
				border-color var(--ebg-disclosure-dur) cubic-bezier(0.16, 1, 0.3, 1);

			/* the ring */
			&::after,
			&::before {
				content: "";
				position: absolute;
				inset-inline-end: 0;
				top: 50%;
				box-sizing: border-box;
				inline-size: 34px;
				block-size: 34px;
				translate: 0 -50%;
			}

			&::after {
				border: 2px solid var(--ebg-accent);
				border-radius: 50%;
				transition: border-color var(--ebg-disclosure-dur) cubic-bezier(0.16, 1, 0.3, 1);
			}

			/* the plus: two bars; the upright one folds away when open */
			&::before {
				background-color: var(--ebg-accent);
				mask:
					linear-gradient(#000 0 0) center / 12px 2px no-repeat,
					linear-gradient(#000 0 0) center / 2px 12px no-repeat;
				transition:
					background-color var(--ebg-disclosure-dur) cubic-bezier(0.16, 1, 0.3, 1),
					mask-size var(--ebg-disclosure-dur) cubic-bezier(0.16, 1, 0.3, 1),
					transform var(--ebg-disclosure-dur) cubic-bezier(0.16, 1, 0.3, 1);
			}

			&:focus-visible {
				outline: 2px solid var(--ebg-accent);
				outline-offset: 4px;
			}
		}

		&[open] > summary {
			border-block-end-color: rgb(255 255 255 / 0.15);
			color: var(--ebg-on-accent);

			&::after { border-color: rgb(255 255 255 / 0.1); }

			&::before {
				background-color: var(--ebg-on-accent);
				mask-size: 12px 2px, 2px 0;
				transform: rotate(90deg);
			}
		}

		& .ebg-disclosure__body {
			color: var(--ebg-ink-2);
			font-size: var(--text-base);
			line-height: var(--lh-body);
			opacity: 0;
			transform: translateY(-4px);
			transition:
				color var(--ebg-disclosure-dur) cubic-bezier(0.16, 1, 0.3, 1),
				opacity var(--ebg-disclosure-dur) cubic-bezier(0.16, 1, 0.3, 1),
				transform var(--ebg-disclosure-dur) cubic-bezier(0.16, 1, 0.3, 1);

			& > * { margin: 0; }
			& > * + * { margin-block-start: 12px; }
			& > :first-child { padding-block-start: 15px; }
			& > :last-child { padding-block-end: 27px; }
		}

		&[open] .ebg-disclosure__body {
			color: var(--ebg-on-accent);
			opacity: 1;
			transform: translateY(0);
		}
	}

	@media (max-width: 1200px) {
		.ebg-fqb .ebg-fqb__title { font-size: 2.5rem; }
		.ebg-fqb__grid { gap: 24px; }

		.ebg-fqb .ebg-fqb__item {
			padding-inline: 20px;

			& > summary { padding: 20px 40px 20px 0; }
			& .ebg-disclosure__body > :last-child { padding-block-end: 20px; }
		}
	}

	@media (max-width: 767px) {
		.ebg-fqb__grid {
			grid-template-columns: minmax(0, 1fr);
			row-gap: 64px;
		}

		.ebg-fqb__media { padding: 20px; }
		.ebg-fqb .ebg-fqb__title { font-size: 1.875rem; }

		.ebg-fqb__call {
			inline-size: 200px;
			padding: 20px 18px 25px;
		}

		.ebg-fqb .ebg-fqb__call-title { font-size: 1.375rem; }
	}

	@media (prefers-reduced-motion: reduce) {
		.ebg-fqb .ebg-fqb__item,
		.ebg-fqb .ebg-fqb__item > summary,
		.ebg-fqb .ebg-fqb__item > summary::before,
		.ebg-fqb .ebg-fqb__item > summary::after,
		.ebg-fqb .ebg-fqb__item .ebg-disclosure__body { transition: none; }
	}
}
