/*
Theme Name: Stuttgart Workshop
Theme URI: https://stw.lv
Author: error404.lv
Author URI: https://error404.lv
Description: Block theme for Stuttgart Workshop (stw.lv). Full Site Editing, theme.json driven.
Requires at least: 6.5
Tested up to: 6.8
Requires PHP: 8.1
Version: 0.1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: stuttgart-workshop
Tags: block-theme, full-site-editing, one-column, wide-blocks, editor-style, block-patterns
*/

/*
 * Almost everything is configured in theme.json.
 * Only put here what theme.json genuinely cannot express.
 */

/* WordPress has no global box model rule; every component that sets a width
   and a padding would otherwise be that padding too wide. */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

::selection {
	background-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--base);
}

.skip-link:focus {
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--contrast);
	left: 1rem;
	padding: 0.75rem 1.25rem;
	top: 1rem;
	z-index: 100000;
}

/* Sticky footer on short pages. */
.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

.wp-site-blocks > main {
	flex-grow: 1;
}

/* Block style variations registered in functions.php. */
.wp-block-group.is-style-stw-card {
	background-color: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--custom--line);
	border-radius: var(--wp--custom--radius-lg);
	padding: var(--wp--preset--spacing--40);
}

/* DS `.eyebrow`: mono caps with a short accent rule in front. */
.is-style-stw-eyebrow {
	align-items: center;
	color: var(--wp--preset--color--accent);
	display: flex;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 500;
	gap: 14px;
	letter-spacing: 0.2em;
	line-height: 1.4;
	text-transform: uppercase;
}

.is-style-stw-eyebrow::before {
	background-color: currentColor;
	content: "";
	flex: 0 0 auto;
	height: 1px;
	opacity: 0.7;
	width: 28px;
}

.is-style-stw-eyebrow.has-text-align-center {
	justify-content: center;
}

.is-style-stw-eyebrow.has-text-align-center::after {
	background-color: currentColor;
	content: "";
	flex: 0 0 auto;
	height: 1px;
	opacity: 0.7;
	width: 28px;
}

/* ---------------------------------------------------------------------------
 * Site shell: the fixed header bar and the footer grid.
 *
 * The blocks inside them (navigation, language switcher, contact details) carry
 * their own CSS from the plugin. What is left here is the frame those blocks
 * sit in - which is a theme's business, and disappears with the theme.
 * ------------------------------------------------------------------------- */

.stw-site-header {
	inset: 0 0 auto;
	padding: 0;
	position: fixed;
	transition:
		background-color 0.35s var(--wp--custom--ease),
		border-color 0.35s var(--wp--custom--ease);
	z-index: 90;
}

/* Transparent over the hero, solid once the page has moved under it. */
.stw-site-header.is-solid {
	backdrop-filter: blur(14px) saturate(1.2);
	background-color: rgba(8, 8, 9, 0.86);
	border-bottom: 1px solid var(--wp--custom--line);
}

.stw-site-header .stw-site-header__inner {
	align-items: center;
	gap: 30px;
	margin-inline: auto;
	max-width: var(--wp--style--global--wide-size);
	min-height: var(--wp--custom--header-height);
	padding-inline: var(--wp--custom--gutter);
}

.stw-site-header .stw-header-actions {
	gap: 16px;
	margin-left: auto;
}

/* `.wp-site-blocks` gives every child a block-gap top margin. Its children are
   the page frame - bar, content, footer - not blocks stacked inside a column,
   so none of them wants that gap. On `main` it showed as a strip of page
   background above a hero that is supposed to start at the very top. */
.wp-site-blocks > header,
.wp-site-blocks > main,
.wp-site-blocks > footer {
	margin-block-start: 0;
}

.stw-brand img {
	height: 34px;
	max-width: none;
	width: auto;
}

/* The header is out of flow, so every page has to start below it. A hero that
   wants to run under the bar opts out with its own negative margin. */
.wp-site-blocks > main {
	padding-top: var(--wp--custom--header-height);
}

/* ...and it has to win against the layout rule core writes for the first child
   of a constrained container, which is the same specificity as the block's own
   class and can land after it in the cascade. */
.wp-site-blocks > main > .stw-hero:first-child,
.wp-site-blocks > main > .entry-content > .stw-hero:first-child,
.wp-site-blocks > main > .wp-block-post-content > .stw-hero:first-child {
	margin-top: calc(-1 * var(--wp--custom--header-height));
}

.stw-site-footer {
	background-color: var(--wp--custom--footer-bg);
	border-top: 1px solid var(--wp--custom--line);
	padding-top: var(--wp--preset--spacing--60);
}

.stw-footer-grid {
	border-bottom: 1px solid var(--wp--custom--line);
	display: grid;
	gap: 48px;
	grid-template-columns: 1.6fr 1fr 1fr 1.4fr;
	padding-bottom: 64px;
}

.stw-footer-col__title {
	color: var(--wp--preset--color--muted-2);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 10.5px;
	font-weight: 500;
	letter-spacing: 0.16em;
	margin: 0 0 22px;
	text-transform: uppercase;
}

.stw-footer-about__text {
	color: var(--wp--preset--color--muted);
	font-size: 14px;
	margin: 18px 0 26px;
	max-width: 34ch;
}

.stw-footer-col .stw-menu-list,
.stw-requisites {
	font-size: 14px;
}

.stw-requisites {
	color: var(--wp--preset--color--muted);
	line-height: 1.8;
}

/* The requisites are an address block, not a stack of paragraphs: the default
   24px block gap between them reads as six unrelated lines. */
.stw-requisites .stw-contact-link,
.stw-footer-col .wp-block-stw-menu-list,
.stw-footer-col .wp-block-stw-social-links {
	margin-block-start: 0;
}

.stw-footer-bottom {
	gap: 24px;
	padding: 26px 0 40px;
}

.stw-footer-bottom__legal {
	gap: 24px;
}

.stw-footer-bottom__copy,
.stw-footer-bottom .stw-menu-list a,
.stw-footer-bottom .stw-consent-link {
	color: var(--wp--preset--color--muted-2);
	font-size: 12.5px;
	margin: 0;
}

/* The cookie control is a button because it opens the notice rather than going
   anywhere, but in this row it has to read as one more legal link. */
.stw-consent-link {
	background: none;
	border: 0;
	cursor: pointer;
	font-family: inherit;
	letter-spacing: inherit;
	padding: 0;
}

.stw-consent-link:hover,
.stw-consent-link:focus-visible {
	color: var(--wp--preset--color--accent);
}

/* Below the navigation breakpoint the bar is logo · language · burger. The
   phone number is not lost - it is the call button inside the overlay. */
@media (max-width: 1100px) {
	.stw-site-header .stw-header-actions .stw-contact-link {
		display: none;
	}
}

@media (max-width: 480px) {
	.stw-site-header .stw-header-actions {
		display: none;
	}
}

@media (max-width: 860px) {
	.stw-footer-grid {
		grid-template-columns: 1fr 1fr;
	}
}

@media (max-width: 560px) {
	.stw-footer-grid {
		grid-template-columns: 1fr;
	}
}

/* DS `.lede`: the intro paragraph next to a section heading. */
.is-style-stw-lede {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--lede);
	line-height: 1.6;
	max-width: 56ch;
}

/* The car page's two columns. The offer panel is sticky, and a sticky element
   can only travel inside its own parent: the short column has to stretch to the
   height of the gallery beside it, otherwise there is nowhere to travel and the
   panel scrolls away like any static block. */
.stw-model-layout > .wp-block-column {
	align-self: stretch;
	min-width: 0;
}

@media (max-width: 1000px) {
	.stw-model-layout > .wp-block-column {
		flex-basis: 100% !important;
	}
}

/* A full-width band inside a constrained main: the section colours its own
   background edge to edge while its content keeps the page's measure. */
.stw-section-alt {
	border-top: 1px solid var(--wp--custom--line);
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
}
