/*
Theme Name: Vaasanilpasennus
Theme URI: https://vaasanilpasennus.fi
Author: WebAula
Author URI: https://webaula.fi
Description: Twenty Twenty-Five child theme for Vaasanilpasennus Oy. The design system lives in theme.json, generated from pipeline/design-system.json plus pipeline/theme-overrides.json.
Template: twentytwentyfive
Text Domain: vaasanilpasennus
Requires at least: 7.1
Tested up to: 7.1
Requires PHP: 8.0
Version: 0.1.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

/*
 * Kept deliberately short. Every rule here is one that theme.json cannot
 * express and is written down in the buildability report. Anything else
 * belongs in a theme.json preset or a registered block style.
 */

/* Finding 14: balanced headings, orphan control on paragraphs. */
h1, h2, h3, h4 { text-wrap: balance; }
p { text-wrap: pretty; }

/* Finding 5: sticky header. Position sticky comes from block supports on the
 * header Group. The template part wrapper would otherwise be the sticky
 * element's containing block and stop it from sticking, so the first template
 * part (always the header) gives up its box. The inner Group is the <header>
 * landmark, so nothing is lost. */
.wp-site-blocks > .wp-block-template-part:first-child { display: contents; }
.site-header {
	border-bottom: 1px solid var(--wp--preset--color--line);
}
/* The blur lives on a pseudo element. backdrop-filter on the header itself
 * would make the header the containing block of the fixed mobile menu overlay
 * and clip the menu to the header's height. */
.site-header::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: color-mix(in srgb, var(--wp--preset--color--neutral) 92%, transparent);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
}

/* Finding 12: card hover lift, registered as the "lift" block style for
 * core/group in inc/block-styles.php. */
.is-style-lift {
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.is-style-lift:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(10, 37, 49, 0.08);
}

/* Eyebrow labels: small uppercase tracking. Registered as the "eyebrow"
 * block style for core/paragraph in inc/block-styles.php. */
.is-style-eyebrow {
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.16em;
	text-transform: uppercase;
	line-height: 1.5;
}

/* Finding 7: hero eyebrow with the short rule before it. Registered as the
 * "eyebrow-rule" block style for core/paragraph. */
.is-style-eyebrow-rule {
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.2em;
	text-transform: uppercase;
	line-height: 1.5;
	display: flex;
	align-items: center;
	gap: 16px;
}
.is-style-eyebrow-rule::before {
	content: "";
	display: block;
	width: clamp(32px, 5vw, 64px);
	height: 1px;
	background: currentColor;
	opacity: 0.55;
	flex: 0 0 auto;
}

/* Product cards, as in the design: the grey image box is the card's top row
 * and the card's rounded corners clip it, the featured image is contained
 * inside the box, and the price never wraps. */
.tuote-kortti { overflow: hidden; }
.tuote-kortti .wp-block-post-featured-image img { width: 100%; display: block; }
.tuote-kortti .has-heading-font-family { white-space: nowrap; }
.tuote-kortti .wp-block-read-more { font-weight: 600; }

/* Finding 3: Gravity Forms (Orbital theme) styled like the design inputs.
 * Orbital reads CSS custom properties from the wrapper; the direct rules
 * below are the fallback for anything the variables do not reach. */
.gform_wrapper.gform-theme--orbital {
	--gf-color-primary: var(--wp--preset--color--secondary);
	--gf-color-primary-darker: var(--wp--preset--color--dark);
	--gf-ctrl-btn-bg-color-primary: var(--wp--preset--color--secondary);
	--gf-ctrl-btn-bg-color-hover-primary: var(--wp--preset--color--dark);
	--gf-ctrl-btn-border-color-primary: var(--wp--preset--color--secondary);
	--gf-ctrl-btn-border-color-hover-primary: var(--wp--preset--color--dark);
	--gf-ctrl-btn-color-primary: var(--wp--preset--color--surface);
	--gf-ctrl-btn-radius: 8px;
	--gf-ctrl-btn-font-weight: 600;
	--gf-ctrl-radius: 8px;
	--gf-ctrl-border-color: var(--wp--preset--color--line);
	--gf-ctrl-border-color-focus: var(--wp--preset--color--secondary);
	--gf-ctrl-bg-color: var(--wp--preset--color--surface);
	--gf-ctrl-color: var(--wp--preset--color--ink);
	--gf-ctrl-font-family: inherit;
	--gf-label-color-primary: var(--wp--preset--color--muted);
	--gf-label-font-size-primary: 13px;
	--gf-label-font-weight-primary: 500;
	--gf-form-gap-y: 18px;
}
.gform_wrapper.gform-theme--orbital .gfield_label {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}
.gform_wrapper.gform-theme--orbital input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
.gform_wrapper.gform-theme--orbital textarea {
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 8px;
	padding: 13px 14px;
	font: inherit;
	color: var(--wp--preset--color--ink);
	background: var(--wp--preset--color--surface);
}
.gform_wrapper.gform-theme--orbital input:focus,
.gform_wrapper.gform-theme--orbital textarea:focus {
	outline: 2px solid var(--wp--preset--color--secondary);
	outline-offset: 1px;
	border-color: var(--wp--preset--color--secondary);
}
.gform_wrapper.gform-theme--orbital .gform_footer .gform_button {
	background: var(--wp--preset--color--secondary);
	border-color: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--surface);
	border-radius: 8px;
	padding: 16px 24px;
	font-weight: 600;
	cursor: pointer;
}
.gform_wrapper.gform-theme--orbital .gform_footer .gform_button:hover {
	background: var(--wp--preset--color--dark);
	border-color: var(--wp--preset--color--dark);
}

/* Model page spec table (post content, className tuote-tiedot). Hairline rows
 * instead of the core table's cell borders, muted keys. */
.wp-block-table.tuote-tiedot table { border-collapse: collapse; }
.wp-block-table.tuote-tiedot td {
	border: 0;
	border-top: 1px solid var(--wp--preset--color--line);
	padding: 12px 0;
	vertical-align: top;
}
.wp-block-table.tuote-tiedot tr:first-child td { border-top: 0; }
.wp-block-table.tuote-tiedot td:first-child {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	width: 42%;
	padding-right: 12px;
}
.wp-block-table.tuote-tiedot td:last-child { font-weight: 500; }

/* FAQ Details blocks read as cards with a bold question. */
.wp-block-details > summary {
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 600;
	cursor: pointer;
}
.wp-block-details[open] > summary { margin-bottom: var(--wp--preset--spacing--20); }

/* Model page: category eyebrow above the h1 has no underline. */
.wp-block-post-terms a { text-decoration: none; }

/* Mobile navigation. Below 600px the Navigation block switches to its
 * overlay; this turns that overlay into a drawer from the right that slides in
 * while the links fade up one after another. The phone pill leaves the bar on
 * phones and reappears as the last item of the drawer (link .vip-nav-phone). */
/* Hidden in the desktop bar. Core navigation CSS sets its items to flex with
 * two classes, so this needs three to win. */
.site-header .wp-block-navigation .vip-nav-phone { display: none; }

/* Core block styles print after this stylesheet, so every selector here
 * carries .site-header to outrank the block's own overlay rules. */
@media (max-width: 599px) {
	.site-header .wp-block-buttons { display: none; }
	.site-header .wp-block-navigation__responsive-container-open svg { width: 28px; height: 28px; }

	.site-header .wp-block-navigation__responsive-container.is-menu-open {
		box-sizing: border-box;
		left: auto;
		width: min(86vw, 380px);
		padding: 96px 28px 40px;
		box-shadow: 0 0 0 100vmax rgba(6, 24, 32, 0.55), -24px 0 48px rgba(6, 24, 32, 0.35);
		animation: vip-drawer-in 0.34s cubic-bezier(0.22, 0.8, 0.36, 1) both;
	}
	/* Close control: a 44px bordered round button in the drawer corner, clear of
	 * the notch on phones. Tapping the dimmed page and Escape also close. */
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
		position: absolute;
		top: max(18px, env(safe-area-inset-top, 0px));
		right: 20px;
		width: 44px;
		height: 44px;
		display: grid;
		place-items: center;
		padding: 0;
		border: 1px solid rgba(255, 255, 255, 0.35);
		border-radius: 999px;
		background: rgba(255, 255, 255, 0.06);
		color: var(--wp--preset--color--surface);
		z-index: 3;
	}
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close svg {
		width: 22px;
		height: 22px;
	}
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
		padding-top: 0;
		align-items: flex-start;
	}
	/* The close button positions against the dialog wrapper by default; make
	 * the drawer itself its containing block so it sits in the corner. */
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog {
		position: static;
	}
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container {
		gap: 22px;
		align-items: flex-start;
	}
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content {
		font-family: var(--wp--preset--font-family--heading);
		font-size: 26px;
		font-weight: 600;
		letter-spacing: -0.02em;
	}
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
		animation: vip-item-in 0.5s cubic-bezier(0.22, 0.8, 0.36, 1) both;
	}
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:nth-child(1) { animation-delay: 0.10s; }
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:nth-child(2) { animation-delay: 0.16s; }
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:nth-child(3) { animation-delay: 0.22s; }
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:nth-child(4) { animation-delay: 0.28s; }
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:nth-child(5) { animation-delay: 0.36s; }

	.site-header .wp-block-navigation__responsive-container.is-menu-open .vip-nav-phone {
		display: block;
		margin-top: 14px;
	}
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .vip-nav-phone .wp-block-navigation-item__content {
		display: inline-flex;
		align-items: center;
		background: var(--wp--preset--color--primary);
		color: var(--wp--preset--color--dark);
		font-family: var(--wp--preset--font-family--body);
		font-size: 17px;
		letter-spacing: 0;
		padding: 14px 22px;
		border-radius: 999px;
	}
}

@keyframes vip-drawer-in {
	from { transform: translateX(100%); }
	to { transform: none; }
}
@keyframes vip-item-in {
	from { transform: translateX(28px); opacity: 0; }
	to { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
	.site-header .wp-block-navigation__responsive-container.is-menu-open,
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
		animation: none;
	}
}

/* Cards on the teal and navy bands: the design gives them a translucent white
 * fill. Registered as the "dark-card" block style for core/group. */
.is-style-dark-card { background: rgba(255, 255, 255, 0.08); }

/* Brand and partner logo rows: four equal cells across the row on desktop,
 * two per row on phones. Logos are 200 by 120 boxes with the image contained. */
@media (max-width: 599px) {
	.logo-grid.is-layout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.logo-grid img, .logo-row img { width: 140px !important; height: 84px !important; }
}

/* References carousel (Query Loop of referenssi posts, className
 * referenssit-slider). Runs edge to edge across the viewport. Without script
 * it is a plain scroll snap strip; assets/js/referenssit.js adds the endless
 * loop, autoplay and the previous and next buttons (.referenssit-nav). */
.referenssit-slider .wp-block-post-template {
	display: flex;
	gap: 18px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	margin: 0;
	padding: 24px 0 80px;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}
.referenssit-slider .wp-block-post-template::-webkit-scrollbar { display: none; }
.referenssit-slider .wp-block-post {
	flex: 0 0 min(290px, 78vw);
	margin: 0;
	scroll-snap-align: start;
}
.referenssit-slider .wp-block-post-featured-image img {
	display: block;
	width: 100%;
	background: var(--wp--preset--color--secondary);
}

/* Previous and next buttons, top right of the section header. */
.referenssit-nav { flex-shrink: 0; }
.referenssit-nav__btn {
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 999px;
	background: transparent;
	color: var(--wp--preset--color--surface);
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.referenssit-nav__btn:hover {
	background: var(--wp--preset--color--primary);
	border-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--dark);
}
.referenssit-nav__btn:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}
.referenssit-nav__btn svg { width: 22px; height: 22px; }
@media (max-width: 599px) {
	.referenssit-nav__btn { width: 42px; height: 42px; }
}

/* Drawer links: the current page and keyboard focus show as a slim orange
 * underline instead of the theme's solid focus rectangle. */
@media (max-width: 599px) {
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
		display: inline-block;
		border-bottom: 2px solid transparent;
		padding-bottom: 4px;
	}
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:focus {
		outline: none;
	}
	.site-header .wp-block-navigation__responsive-container.is-menu-open .current-menu-item > .wp-block-navigation-item__content,
	.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:focus-visible {
		border-bottom-color: var(--wp--preset--color--primary);
	}
	.site-header .wp-block-navigation__responsive-container.is-menu-open .vip-nav-phone .wp-block-navigation-item__content {
		border-bottom: 0;
		padding-bottom: 14px;
	}
}

/* Contact rows beside the forms (block styles contact-row and
 * contact-row-dark, built by vaasanilpasennus_yhteysrivit()). As in the
 * design: a card per row, label at a fixed minimum width, and the whole row
 * clickable through a stretched link. Light rows darken their border on
 * hover, rows on the teal band brighten their fill. */
.is-style-contact-row,
.is-style-contact-row-dark {
	position: relative;
	align-items: center;
	border-radius: 10px;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}
.is-style-contact-row {
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--line);
	color: var(--wp--preset--color--ink);
}
.is-style-contact-row:hover { border-color: var(--wp--preset--color--secondary); }
.is-style-contact-row-dark {
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.2);
	color: var(--wp--preset--color--surface);
}
.is-style-contact-row-dark:hover { background: rgba(255, 255, 255, 0.14); }
.is-style-contact-row > p:first-child,
.is-style-contact-row-dark > p:first-child {
	min-width: 84px;
	flex-shrink: 0;
}
.is-style-contact-row a,
.is-style-contact-row-dark a {
	color: inherit;
	text-decoration: none;
}
.is-style-contact-row a::after,
.is-style-contact-row-dark a::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
}
.is-style-contact-row a:focus-visible,
.is-style-contact-row-dark a:focus-visible { outline: none; }
.is-style-contact-row:focus-within,
.is-style-contact-row-dark:focus-within {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

/* Tietosuoja page: the contact card follows the reader down the long policy
 * text on desktop. Columns stack on phones, so it is static there. */
@media (min-width: 782px) {
	.tietosuoja-kortti { position: sticky; top: 96px; }
}

/* 404 page cards: the heading link covers the whole card. */
.linkkikortti { position: relative; }
.linkkikortti h3 a { color: inherit; text-decoration: none; }
.linkkikortti h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }

/* Privacy notice under the Gravity Forms. */
.gform_wrapper .lomake-tietosuoja {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
	color: var(--wp--preset--color--muted);
}

/* The Tietosuoja card is narrow: its contact rows stack the label above the
 * value so the email address never breaks mid word. */
.tietosuoja-kortti .is-style-contact-row {
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
}

/* Smooth scrolling to anchors. assets/js/site.js handles same page links
 * with the header offset; this covers arrivals from other pages and links the
 * script does not handle. Sections land below the sticky header. */
@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}
main [id] { scroll-margin-top: 88px; }
@media (max-width: 599px) {
	main [id] { scroll-margin-top: 72px; }
}
main [id]:focus { outline: none; }

/* Back to top button (created by assets/js/site.js). */
.takaisin-ylos {
	position: fixed;
	right: max(20px, env(safe-area-inset-right, 0px));
	bottom: max(20px, env(safe-area-inset-bottom, 0px));
	z-index: 90;
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 999px;
	background: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--surface);
	box-shadow: 0 8px 24px rgba(6, 24, 32, 0.25);
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s, background-color 0.15s ease, color 0.15s ease;
}
.takaisin-ylos.is-visible {
	opacity: 1;
	visibility: visible;
	transform: none;
}
.takaisin-ylos:hover {
	background: var(--wp--preset--color--primary);
	border-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--dark);
}
.takaisin-ylos:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 3px;
}
.takaisin-ylos svg { width: 22px; height: 22px; }
.has-modal-open .takaisin-ylos { display: none; }
@media (max-width: 599px) {
	.takaisin-ylos { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
	.takaisin-ylos { transition: none; }
}
