/*
Theme Name: PV Theme
Theme URI: https://pvparking.sk
Author: Mathias Matejcik
Description: Block theme for PV AirPort Parking and PV Autoservis, built from the approved prototype. The site profile (parking / autoservis) picks the stylesheet, header and footer; the "Autoservis" style variation switches colours and fonts in the editor.
Requires at least: 7.1
Tested up to: 7.1
Requires PHP: 8.3
Version: 0.4.38
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: pv-theme
*/

/* Shared by both sites. The look itself is in assets/css/<site>.css (prototype styles) and
   assets/css/<site>-pages.css (generated from the prototype pages). This file only bridges
   WordPress' markup to them and styles ordinary content (blog posts, legal pages). */

/* Template parts and main follow each other without WordPress' block gap. */
.wp-site-blocks > * {
	margin-block-start: 0;
}

/* Header part: the wrapper sticks, the header inside it is as tall as the wrapper. */
header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 30;
}

@media (max-width: 600px) {
	.admin-bar header.wp-block-template-part {
		top: 0;
	}
}

header.wp-block-template-part .hdr {
	position: relative;
	top: 0;
}

:target {
	scroll-margin-top: calc(var(--wp--custom--header-height) + 16px);
}

/* ---- Designed pages (content generated from the prototype) ---- */

/* The prototype's classes set every margin and gap themselves; elements without one keep the
   browser's default (a paragraph's 1em), as in the prototype. */
.pvd :where(.is-layout-flow, .is-layout-constrained) > * {
	margin-block-start: revert;
	margin-block-end: revert;
}

.pvd :where(.is-layout-flex, .is-layout-grid) {
	gap: 0;
}

/* Image block: a former bare <img> keeps its place (the figure adds no box). */
figure.wp-block-image {
	margin: 0;
}

figure.wp-block-image.pvi {
	display: contents;
}

/* Buttons block: the wrapper carries the prototype's button classes and is the button;
   the link inside stretches over it. */
.wp-block-buttons > .wp-block-button.btn {
	display: inline-flex;
	position: relative;
}

.wp-block-button.btn > .wp-block-button__link,
.wp-block-button.btn > .wp-block-button__link:hover,
.wp-block-button.btn > .wp-block-button__link:focus {
	display: inline;
	width: auto;
	height: auto;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	text-decoration: none;
}

.wp-block-button.btn > .wp-block-button__link::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
}

.wp-block-button.btn > .wp-block-button__link:focus-visible {
	outline: none;
}

.wp-block-button.btn:has(> .wp-block-button__link:focus-visible) {
	outline: 2px solid var(--red);
	outline-offset: 3px;
}

.wp-block-buttons.pvb1 {
	display: contents;
}

.wp-block-buttons:has(> .btn-full) {
	display: flex;
}

.wp-block-buttons > .wp-block-button.btn-full {
	flex: 1 1 100%;
}

/* Arrow after the label (was an inline SVG in the prototype). */
.btn.has-arr::after {
	content: "";
	flex: none;
	width: 18px;
	height: 18px;
	background: currentColor;
	-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='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%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='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
	transition: transform 260ms var(--ease);
}

@media (hover: hover) {
	.btn.has-arr:hover::after {
		transform: translateX(4px);
	}
}

/* Parallax photo inside an image block: the img moves, its frame clips. */
.gs .pvi.par > img {
	animation: none !important;
}

@supports (animation-timeline: view()) {
	.pvi.par > img {
		animation: par linear both;
		animation-timeline: view();
		animation-range: cover 0% cover 100%;
	}
}

/* Quote and table blocks styled by the prototype's classes. */
.wp-block-quote.rq {
	margin: 0;
	padding: 0;
	border: 0;
}

/* Table blocks: none of WordPress' borders or padding; the prototype's table class (or the prose
   rules below) decides. Same specificity as WordPress' rules, loaded after them. */
.wp-block-table {
	margin: 0;
	overflow: visible;
}

.wp-block-table > table {
	width: 100%;
	border-collapse: collapse;
}

.wp-block-table thead,
.wp-block-table tfoot {
	border: 0;
}

.wp-block-table :is(td, th) {
	border: 0;
	padding: 0;
}

/* Accordions (<details>) in the prototype's look. */
details.acc > summary {
	display: flex;
	align-items: center;
	gap: 16px;
	min-height: 60px;
	padding: 14px 24px;
	cursor: pointer;
	list-style: none;
	font-weight: 500;
	font-size: 16px;
	color: var(--ink);
}

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

details.acc > summary::before {
	content: "";
	flex: none;
	width: 18px;
	height: 18px;
	background:
		linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
		linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat;
	transition: transform 300ms var(--ease), background-size 300ms var(--ease);
}

details.acc[open] > summary::before {
	transform: rotate(180deg);
	background-size: 100% 2px, 2px 0;
}

details.acc > :not(summary) {
	margin: 0;
}

@supports selector(::details-content) {
	:root {
		interpolate-size: allow-keywords;
	}

	details.acc::details-content {
		block-size: 0;
		overflow: hidden;
		transition: block-size 420ms var(--ease), content-visibility 420ms allow-discrete;
	}

	details.acc[open]::details-content {
		block-size: auto;
	}
}

/* ---- Ordinary content (posts, legal pages, pages not designed in the theme) ---- */

.pv-prose {
	font-size: 17px;
	line-height: 1.75;
}

.pv-prose > * + * {
	margin-block-start: 1.1em;
}

.pv-prose :is(h2, h3, h4) {
	margin-block-start: 1.8em;
	line-height: 1.1;
	letter-spacing: -0.02em;
	font-weight: 600;
}

.pv-autoservis .pv-prose :is(h2, h3, h4) {
	font-family: var(--cond);
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0;
}

.pv-prose :is(p, li) {
	color: var(--muted);
}

.pv-prose a {
	color: var(--red);
}

.pv-prose img {
	height: auto;
}

/* Block styles kept for content converted from the old site. */
.is-style-pv-card {
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: var(--wp--custom--radius--card);
	padding: 24px;
}

.is-style-pv-check {
	list-style: none;
	padding-left: 0;
}

.is-style-pv-check li {
	position: relative;
	padding-left: 1.75em;
}

.is-style-pv-check li + li {
	margin-top: 0.4em;
}

.is-style-pv-check li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.55em;
	width: 14px;
	height: 6px;
	background: var(--red);
	transform: skewX(-20deg);
}

.is-style-pv-step-number {
	display: inline-grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--red);
	color: var(--white);
	font-weight: 700;
}

.is-style-pv-eyebrow {
	color: var(--red);
	font-size: 14px;
	font-weight: 600;
}

.is-style-pv-price {
	font-size: 40px;
	font-weight: 700;
	line-height: 1.1;
}

.wp-block-details:not(.acc) summary {
	cursor: pointer;
	font-weight: 600;
}

.pv-prose .wp-block-table {
	overflow-x: auto;
}

.pv-prose .wp-block-table :is(td, th) {
	border: 1px solid var(--line);
	padding: 0.6em 0.8em;
}

.pv-map iframe {
	display: block;
	width: 100%;
	min-height: 360px;
	border: 0;
}

/* Visually hidden, still read out. */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ---- Date fields and our calendar (assets/js/pv.js) ---- */

.dfield .dshow {
	appearance: none;
	-webkit-appearance: none;
	text-align: left;
	color: inherit;
	background: transparent;
	cursor: pointer;
}

.dfield input {
	pointer-events: none;
}

.pvcal {
	position: absolute;
	z-index: 1000;
	width: 324px;
	padding: 18px;
	border-radius: calc(var(--wp--custom--radius--small) + 10px);
	background: var(--white);
	color: var(--ink);
	box-shadow: 0 2px 0 rgba(29, 29, 27, .04), 0 30px 70px -24px rgba(29, 29, 27, .45);
	border: 1px solid var(--line2, var(--line));
	animation: pvcalIn 220ms var(--ease) both;
}

@keyframes pvcalIn {
	from { opacity: 0; transform: translateY(8px); }
}

.pvcal-h {
	display: grid;
	grid-template-columns: 40px minmax(0, 1fr) 40px;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
}

.pvcal-m {
	text-align: center;
	font-size: 17px;
	font-weight: 600;
	letter-spacing: -.01em;
	line-height: 1.2;
	text-transform: capitalize;
}

.pvcal-m small {
	display: block;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--red);
}

.pvcal-nav {
	width: 40px;
	height: 40px;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--grey);
	color: var(--ink);
	cursor: pointer;
	transition: background-color 200ms ease, color 200ms ease;
}

.pvcal-nav:hover:not(:disabled) {
	background: var(--ink);
	color: var(--white);
}

.pvcal-nav:disabled {
	opacity: .35;
	cursor: default;
}

.pvcal-w,
.pvcal-g {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
}

.pvcal-w span {
	padding: 6px 0;
	text-align: center;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--sub);
}

.pvcal-g {
	row-gap: 2px;
}

.pvcal-d {
	position: relative;
	height: 40px;
	border: 0;
	border-radius: var(--wp--custom--radius--small);
	background: transparent;
	color: var(--ink);
	font: inherit;
	font-size: 15px;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	cursor: pointer;
	transition: background-color 160ms ease, color 160ms ease;
}

.pvcal-d:hover:not(:disabled) {
	background: var(--grey);
}

.pvcal-d:disabled {
	color: #C9CACF;
	cursor: default;
}

.pvcal-d.is-today::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 5px;
	width: 4px;
	height: 4px;
	margin-left: -2px;
	border-radius: 50%;
	background: var(--red);
}

.pvcal-d.is-in {
	border-radius: 0;
	background: #FDECEA;
}

.pvcal-d.is-start,
.pvcal-d.is-end,
.pvcal-d.is-sel,
.pvcal-d.is-start:hover,
.pvcal-d.is-end:hover,
.pvcal-d.is-sel:hover {
	background: var(--red);
	color: var(--white);
}

.pvcal-d.is-start {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}

.pvcal-d.is-end {
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
}

.pvcal-d.is-start.is-today::after,
.pvcal-d.is-end.is-today::after,
.pvcal-d.is-sel.is-today::after {
	background: var(--white);
}

.pvcal-d:focus-visible {
	outline: 2px solid var(--ink);
	outline-offset: 1px;
	z-index: 1;
}

.pvcal-close {
	display: none;
}

/* Phones: a sheet from the bottom of the screen. */
.pvcal-back {
	position: fixed;
	inset: 0;
	z-index: 999;
	background: rgba(29, 29, 27, .45);
	animation: pvcalFade 200ms ease both;
}

@keyframes pvcalFade {
	from { opacity: 0; }
}

.pvcal.is-sheet {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	top: auto;
	width: auto;
	padding: 20px 16px calc(16px + env(safe-area-inset-bottom, 0px));
	border-radius: calc(var(--wp--custom--radius--small) + 10px) calc(var(--wp--custom--radius--small) + 10px) 0 0;
	animation-name: pvcalUp;
	animation-duration: 320ms;
}

@keyframes pvcalUp {
	from { transform: translateY(100%); }
}

.pvcal.is-sheet .pvcal-d {
	height: 46px;
	font-size: 16px;
}

.pvcal.is-sheet .pvcal-close {
	display: block;
	width: 100%;
	min-height: 50px;
	margin-top: 14px;
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--grey);
	color: var(--ink);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
	.pvcal,
	.pvcal-back {
		animation: none;
	}
}

/* Buttons inside articles are links too: keep their own colours, not the red link text. */
.pv-prose .wp-block-button__link,
.pv-prose .wp-block-button__link:hover,
.pv-prose .wp-block-button__link:focus {
	background: var(--red);
	color: #fff;
	text-decoration: none;
}

.pv-prose .is-style-outline > .wp-block-button__link,
.pv-prose .is-style-outline > .wp-block-button__link:hover,
.pv-prose .is-style-outline > .wp-block-button__link:focus {
	background: transparent;
	border: 2px solid currentColor;
	color: var(--red);
}

/* Legal pages bring their own section inside the page body: drop the second padding and margins,
   so the text starts right under the heading and in line with it. */
.phero:has(+ .pv-page-body .legal) { padding-bottom: 32px; border-bottom: 0; }
.pv-page-body:has(.legal) { padding-block: 0 64px; }
.pv-page-body:has(.legal) > .wrap { max-width: 1320px; }
.pv-page-body .pv-prose:has(> .sec > .wrap > .legal) { max-width: none; margin-inline: 0; }
.pv-prose > .sec:has(> .wrap > .legal) { padding-block: 0; }
.pv-prose > .sec > .wrap:has(> .legal) { max-width: none; padding-inline: 0; }
.pv-prose .legal > :first-child { margin-top: 0; }
