/*
 * Mauna theme styles that theme.json can't express: header, block style variations,
 * FAQ, form, focus rings. Tokens come from theme.json custom properties.
 * Spacing values stay on an 8 px grid (0.5rem steps).
 */

:root {
	--mauna-radius-card: 1.5rem;
	--mauna-radius-small: 1rem;
	--mauna-card-pad: clamp(1.5rem, 1rem + 2vw, 2.5rem);
}

/* ---------- Page rhythm ---------- */

/* Coloured bands sit flush against each other and against the footer. */
.wp-site-blocks > main,
.wp-site-blocks > footer,
main > .wp-block-post-content,
.wp-block-post-content > .alignfull + .alignfull,
.wp-block-post-content > .alignfull:first-child {
	margin-block-start: 0;
}

/* Readable line length for running text inside wide sections. Groups with their own
   content width (constrained layout) already limit it, so leave those alone. */
.alignwide:not(.is-layout-constrained) > p:not(.mauna-statement),
.wp-block-column > p {
	max-width: 65ch;
}

.alignwide > p.has-text-align-center {
	margin-inline: auto;
}

/* Two plain (cream) sections in a row would stack 2 x 112 px of padding; keep one. */
.wp-block-post-content > section.alignfull:not(.has-background) + section.alignfull:not(.has-background) {
	padding-top: 0 !important;
}

/* The same for two blue bands in a row (Eragruppidele, Töötoad). */
.wp-block-post-content > section.alignfull.has-blue-background-color + section.alignfull.has-blue-background-color {
	padding-top: 0 !important;
}

/* ---------- Header ---------- */

.mauna-header {
	border-bottom: 1px solid var(--wp--preset--color--contrast);
	padding-block: 0.75rem;
}

.mauna-header__row {
	gap: var(--wp--preset--spacing--30);
	min-height: 3.5rem;
}

.mauna-wordmark {
	display: inline-flex;
	flex-direction: column;
	align-items: flex-end;
	line-height: 1;
	text-decoration: none;
	flex-shrink: 0;
}

.mauna-wordmark__name {
	font-family: var(--wp--preset--font-family--body);
	font-size: 1.625rem;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--wp--preset--color--accent-bright);
	margin-right: -0.14em;
}

.mauna-wordmark__sub {
	font-family: var(--wp--preset--font-family--heading);
	font-size: 1.0625rem;
	color: var(--wp--preset--color--accent);
	margin-top: 0.25rem;
}

.mauna-header .wp-block-navigation a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.mauna-header .wp-block-navigation a:hover {
	text-decoration: underline;
	text-underline-offset: 0.3em;
}

.mauna-header .wp-block-navigation__responsive-container-open {
	width: 2.75rem;
	height: 2.75rem;
	border: 1px solid var(--wp--preset--color--contrast);
	border-radius: 999px;
	align-items: center;
	justify-content: center;
}

.mauna-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--x-large);
}

/*
 * Core switches the menu to a toggle only below 600 px. Six items plus the logo and
 * button don't fit on one line until about 1100 px, so keep the toggle up to there.
 */
@media (min-width: 600px) and (max-width: 1099px) {
	.mauna-header .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}

	.mauna-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}
}

/* Below 1100 px: logo left, then Broneeri and the menu button together on the right. */
@media (max-width: 1099px) {
	.mauna-header .mauna-header__row > .mauna-nav {
		order: 3;
	}

	.mauna-header .mauna-header__row > .mauna-header__cta {
		order: 2;
		margin-left: auto;
	}
}

/* ---------- Buttons ---------- */

.wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 3rem;
}

.wp-block-button.is-style-outline > .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--contrast);
	border: 1px solid var(--wp--preset--color--contrast);
	padding: calc(0.75rem - 1px) calc(1.5rem - 1px);
}

.wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
}

/* ---------- Focus ---------- */

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

.has-contrast-background-color :where(a, button, summary):focus-visible {
	outline-color: var(--wp--preset--color--base);
}

/* ---------- Text on the blue bands ---------- */

.has-blue-background-color a:where(:not(.wp-element-button)) {
	color: var(--wp--preset--color--contrast);
}

/* ---------- Cards (group styles) ---------- */

.wp-block-group.is-style-card,
.wp-block-group.is-style-card-pink {
	border-radius: var(--mauna-radius-card);
	padding: var(--mauna-card-pad);
}

.wp-block-group.is-style-card {
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--line);
}

.wp-block-group.is-style-card-pink {
	background: var(--wp--preset--color--pink);
}

.wp-block-column > .wp-block-group.is-style-card:only-child,
.wp-block-column > .wp-block-group.is-style-card-pink:only-child {
	height: 100%;
}

/* ---------- Lists ---------- */

.wp-block-list.is-style-lines {
	list-style: none;
	padding: 0;
}

.wp-block-list.is-style-lines > li {
	padding-block: 1rem;
	border-top: 1px solid var(--wp--preset--color--line);
}

.wp-block-list.is-style-lines > li:first-child {
	border-top: 0;
	padding-top: 0;
}

.wp-block-list.is-style-lines > li:last-child {
	padding-bottom: 0;
}

.wp-block-list.is-style-steps {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
	gap: 1.5rem;
	padding: 0;
	list-style: decimal inside;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.3;
}

.wp-block-list.is-style-steps > li {
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--mauna-radius-card);
	padding: 1.5rem 2rem;
	margin: 0;
}

.wp-block-list.is-style-pills {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
	gap: 1rem;
	padding: 0;
	list-style: none;
}

.wp-block-list.is-style-pills > li {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 3rem;
	box-sizing: border-box;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 999px;
	padding: 0.75rem 1.5rem;
	margin: 0;
	text-align: center;
}

.wp-block-list.is-style-tiles {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
	gap: 1rem;
	padding: 0;
	list-style: none;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
}

.wp-block-list.is-style-tiles > li {
	background: var(--wp--preset--color--beige);
	border-radius: var(--mauna-radius-small);
	padding: 1.5rem 2rem;
	margin: 0;
}

/* ---------- Heading chip ---------- */

.wp-block-heading.is-style-chip {
	width: fit-content;
	border-radius: 999px;
	padding: 0.5rem 1rem;
	font-size: var(--wp--preset--font-size--large);
}

/* ---------- Testimonials (quote block) ---------- */

.wp-block-quote {
	background: var(--wp--preset--color--pink);
	border: 0;
	border-radius: var(--mauna-radius-card);
	padding: 1.5rem 2rem;
	margin: 0;
}

.wp-block-quote > p {
	font-size: var(--wp--preset--font-size--medium);
	margin: 0;
}

/* ---------- FAQ (details block) ---------- */

.mauna-faq {
	align-items: start;
}

.wp-block-details {
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--mauna-radius-small);
}

.wp-block-details > summary {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	padding: 1rem 1.5rem;
	min-height: 3rem;
	cursor: pointer;
	list-style: none;
	font-weight: 500;
}

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

.wp-block-details > summary::after {
	content: "+";
	content: "+" / "";
	font-size: 1.5rem;
	line-height: 1;
}

.wp-block-details[open] > summary::after {
	content: "\2212";
	content: "\2212" / "";
}

.wp-block-details > :not(summary) {
	margin: 0;
	padding: 0 1.5rem 1rem;
}

/* ---------- Footer ---------- */

.mauna-footer a {
	color: inherit;
}

.mauna-footer strong {
	font-weight: 500;
}

.mauna-footer__legal {
	margin-top: var(--wp--preset--spacing--50);
	padding-top: var(--wp--preset--spacing--30);
	border-top: 1px solid rgb(250 247 242 / 0.35);
}

/* ---------- Inquiry form (Contact Form 7) ---------- */

.wpcf7-form > p {
	margin: 0 0 1.5rem;
}

.wpcf7-form label {
	display: block;
	font-weight: 500;
}

.wpcf7-form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
.wpcf7-form select,
.wpcf7-form textarea {
	box-sizing: border-box;
	width: 100%;
	margin-top: 0.5rem;
	padding: 0.75rem 1rem;
	min-height: 3rem;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 0.75rem;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--contrast);
	font: inherit;
	font-weight: 400;
}

.wpcf7-form textarea {
	min-height: 10rem;
	resize: vertical;
}

/* Fields show the ring on any focus: the date field's calendar button is a second Tab stop
   where only :focus-within matches (measured in Edge 157). */
.wpcf7-form :where(input, select, textarea):focus,
.wpcf7-form input:focus-within {
	outline: 2px solid var(--wp--preset--color--contrast);
	outline-offset: 3px;
}

/* CF7 swaps its spinner for a blink under reduced motion; stop it entirely. */
@media (prefers-reduced-motion: reduce) {
	.wpcf7-spinner::before {
		animation: none;
	}
}

.wpcf7-form .wpcf7-submit {
	min-height: 3rem;
	padding: 0.75rem 1.5rem;
	border: 0;
	border-radius: 999px;
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--surface);
	font-family: var(--wp--preset--font-family--body);
	font-size: 1rem;
	font-weight: 500;
	line-height: 1.5;
	cursor: pointer;
}

.wpcf7-form .wpcf7-submit:hover {
	background: var(--wp--preset--color--accent-dark);
}

.wpcf7-form .wpcf7-not-valid-tip {
	color: var(--wp--preset--color--accent);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 400;
	margin-top: 0.5rem;
}

.wpcf7 form .wpcf7-response-output {
	margin: 1.5rem 0 0;
	padding: 1rem 1.5rem;
	border-radius: 0.75rem;
}

.mauna-form-note {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
}

/* ---------- Photo cards in a row ("Mis töötoas juhtub") ---------- */

/* Five cards side by side from 1100 px; below that they scroll sideways with the next
   card peeking in, so phones get a swipeable strip instead of five photos stacked. */
.wp-block-columns.mauna-photo-strip {
	gap: 1.5rem;
}

.mauna-photo-strip .wp-block-image img {
	border-radius: var(--mauna-radius-small);
}

@media (max-width: 1099px) {
	.wp-block-columns.mauna-photo-strip {
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		padding-bottom: 1rem;
		/* Kept visible: with a mouse it's the only way to scroll the row. */
		scrollbar-width: thin;
		scrollbar-color: var(--wp--preset--color--contrast) transparent;
	}

	.wp-block-columns.mauna-photo-strip.is-not-stacked-on-mobile > .wp-block-column {
		flex: 0 0 min(17rem, 78%);
		scroll-snap-align: start;
	}
}

/* ---------- Steps with icons ("Kuidas see käib") ---------- */

.wp-block-columns.mauna-icon-steps {
	--mauna-step-icon: 4.5rem;
	--mauna-step-gap: 2rem;
	gap: var(--mauna-step-gap);
}

.wp-block-image.mauna-step-icon img {
	display: block;
	width: var(--mauna-step-icon);
	height: var(--mauna-step-icon);
	padding: 1rem;
	box-sizing: border-box;
	background: var(--wp--preset--color--surface);
	border-radius: 50%;
	object-fit: contain;
}

/* Side by side (core stacks columns below 782 px): a line runs from each icon towards
   the next, stopping 1rem short of both. */
@media (min-width: 782px) {
	.mauna-icon-steps > .wp-block-column {
		position: relative;
	}

	.mauna-icon-steps > .wp-block-column:not(:last-child)::after {
		content: "";
		position: absolute;
		top: calc(var(--mauna-step-icon) / 2 - 1px);
		left: calc(var(--mauna-step-icon) + 1rem);
		width: calc(100% + var(--mauna-step-gap) - var(--mauna-step-icon) - 2rem);
		border-top: 2px solid var(--wp--preset--color--contrast);
	}
}

/* ---------- Images and statement text ---------- */

.wp-block-image img[style*="aspect-ratio"] {
	width: 100%;
}

.mauna-statement {
	max-width: 24em;
	line-height: 1.25;
}
