/*
Theme Name: Gen Theme
Author: Sitegen
Description: Lean block theme for generated local-business sites. Every colour, font, spacing, radius and shadow comes from design tokens (global styles); the sections come from the gen-core plugin.
Requires at least: 7.0
Tested up to: 7.1
Requires PHP: 8.1
Version: 0.1.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: gen-theme

Derived from Ollie (https://olliewp.com), (C) Mike McAlister and Patrick Posner, distributed under the GNU GPL.
Fonts: SIL Open Font License 1.1 (see assets/fonts). Gen Theme is distributed under the terms of the GNU GPL.
*/

/* CSS Reset
---------------------------------------------------------------------------- */

*,
*::before,
*::after {
	box-sizing: inherit;
}

html {
	box-sizing: border-box;
	-moz-osx-font-smoothing: grayscale;
	-webkit-font-smoothing: antialiased;
}

b,
strong {
	font-weight: var(--wp--custom--font-weight--semi-bold);
}

ol,
ul {
	padding: 0;
}

ol:where(:not([class*="wp-block"])),
ol:where(.wp-block-list),
ul:where(:not([class*="wp-block"])),
ul:where(.wp-block-list) {
	padding-inline-start: var(--wp--preset--spacing--medium);
}

div[class*="wp-block-"] figcaption {
	color: var(--wp--preset--color--secondary);
	font-size: var(--wp--preset--font-size--x-small);
	margin-bottom: 0;
	margin-top: 20px;
	text-align: center;
}

img,
figure {
	max-width: 100%;
	height: auto;
}

/* Temporary fix for text-decoration-thickness in Firefox */
@-moz-document url-prefix() {
	a {
		text-decoration-thickness: .1rem !important;
	}
}

/* Standardize form styling
--------------------------------------------- */

input,
button,
textarea,
select {
	font: inherit;
}

input[type="button"],
input[type="email"],
input[type="search"],
input[type="submit"],
input[type="text"],
textarea {
	-webkit-appearance: none;
	appearance: none;
}

input:not([type="submit"]):not([type="radio"]),
select,
textarea,
.wp-block-post-comments-form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
.wp-block-post-comments-form textarea {
	color: var(--wp--preset--color--main);
	border-radius: var(--wp--custom--radius--field, 5px);
	border: solid 1px var(--wp--preset--color--border-dark);
	padding: .5em 1em;
	font-size: var(--wp--preset--font-size--small);
	background-color: var(--wp--preset--color--base);
	box-shadow: 
		0 1px 2px rgba(0, 0, 0, 0.02),
		0 0.5px 1px rgba(0, 0, 0, 0.04);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
	outline-color: var(--wp--preset--color--main);
	outline-offset: 1px;
}

input[type="checkbox"],
input[type="image"],
input[type="radio"] {
	width: auto;
}

select {
	-webkit-appearance: none;
	appearance: none;
	background: var(--wp--preset--color--base) url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItY2hldnJvbi1kb3duIj48cG9seWxpbmUgcG9pbnRzPSI2IDkgMTIgMTUgMTggOSI+PC9wb2x5bGluZT48L3N2Zz4=) no-repeat;
    background-size: 16px;
    background-position: calc(100% - 12px) 50%;
	padding-right: 2.2em;
}

label {
	width: 100%;
	display: block;
}

::placeholder {
	color: var(--wp--preset--color--secondary);
	opacity: 0.75;
}

/* Helper styles
---------------------------------------------------------------------------- */

a.more-link {
	display: block;
}

/* Inline code */
*:not(.wp-block-code) > code {
	background-color: var(--wp--preset--color--tertiary);
	padding: 3px 5px;
	position: relative;
	border-radius: 3px;
}

.wp-block-categories {
	position: relative;
}

/* Remove margin on term description on archive pages */
.wp-block-term-description p:last-child {
	margin-bottom: 0;
}

/* Remove last separator on post list */
.remove-border-and-padding .wp-block-post-template li:last-child .wp-block-separator {
	display: none;
}

/* Hide post meta div if no tags assigned */
.single .wp-block-group:has(> .post-meta:empty) {
	display: none;
}

.wp-block-group:empty:has(+ .comment-respond) {
	display: none;
}

.row-logos > figure {
	flex-shrink: 1 !important;
}

/* Sticky header */

body:not(.wp-admin) header:has(>.is-position-sticky) {
	position: sticky;
	top: calc( 0px + var( --wp-admin--admin-bar--height, 0px ) );
	z-index: 100;
}

/* Account for admin bar on mobile */

@media (max-width: 600px) {
	header:has(>.is-position-sticky) {
		top: 0;
	}
}

/* Partial sticky header: when one row inside the header is sticky, dissolve
   the header wrappers so that row can stick on its own while rows above
   scroll away. Wrapper styling won't render while dissolved. */

body:not(.wp-admin) header.wp-block-template-part:has(> .wp-block-group > .is-position-sticky):not(:has(> .is-position-sticky)),
body:not(.wp-admin) header.wp-block-template-part:has(> .wp-block-group > .is-position-sticky):not(:has(> .is-position-sticky)) > .wp-block-group {
	display: contents;
}

/* Cancel alignfull negative margins — the dissolved wrapper's compensating
   padding no longer renders. */

body:not(.wp-admin) header.wp-block-template-part:has(> .wp-block-group > .is-position-sticky):not(:has(> .is-position-sticky)) > .wp-block-group > .alignfull {
	margin-left: 0;
	margin-right: 0;
}

body:not(.wp-admin) header.wp-block-template-part:has(> .wp-block-group > .is-position-sticky) .is-position-sticky {
	z-index: 100;
}

/* Mobile helper classes */

@media (max-width: 781px) {
	.gen-hide-on-mobile {
		display: none;
	}

	.gen-unstick-mobile {
		position: static;
	}

	header:has(>.gen-unstick-mobile) {
		position: static;
	}
}

/* Table
--------------------------------------------- */

.wp-block-table table {
	background: var(--wp--preset--color--base);
	border-radius: var(--wp--custom--radius--box, 5px);
	border: solid 1px var(--wp--preset--color--border-light);
	font-size: var(--wp--preset--font-size--x-small);
}
.wp-block-table.is-style-stripes {
	border-bottom: none;
}

.wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background-color: var(--wp--preset--color--tertiary);
}

.wp-block-table td, 
.wp-block-table th,
.wp-block-table thead {
	border: none;
	border-bottom: solid 1px color-mix(in srgb, var(--wp--preset--color--border-light) 50%, var(--wp--preset--color--base) 5%);
}

.wp-block-table th,
.wp-block-table tfoot {
	text-align: left;
	background-color: color-mix(in srgb, var(--wp--preset--color--tertiary) 75%, var(--wp--preset--color--base) 5%);
}

.wp-block-table td, 
.wp-block-table th {
	padding: .8em 1em;
}

.wp-block-table tfoot {
	border-top: solid 1px var(--wp--preset--color--border-light);
}

.wp-block-table tfoot td {
	border-bottom: none;
}


/* Gen Theme: tokens used by the section patterns
---------------------------------------------------------------------------- */

/* Visible focus for keyboard users, in the brand colour, on every interactive element. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

/* Never scroll sideways on phones. */
html, body {
	overflow-x: clip;
}

/* Cards, panels and boxed sections. */
.is-style-gen-card {
	background-color: var(--wp--preset--color--tertiary);
	border-radius: var(--wp--custom--radius--box);
	box-shadow: var(--wp--custom--shadow--box);
}

.is-style-gen-card-outline {
	border: 1px solid var(--wp--preset--color--border-light);
	border-radius: var(--wp--custom--radius--box);
}

/* Images and covers follow the media radius of the variant. */
.wp-block-image.is-style-gen-media img,
.wp-block-cover.is-style-gen-media,
.wp-block-media-text.is-style-gen-media .wp-block-media-text__media img {
	border-radius: var(--wp--custom--radius--media);
}

/* Buttons: same radius as fields; the outline style uses the brand colour. */
.wp-block-button .wp-block-button__link {
	border-radius: var(--wp--custom--radius--field);
}

.wp-block-button.is-style-outline .wp-block-button__link {
	color: var(--wp--preset--color--primary);
}

/* Large tap targets on phones. */
@media (max-width: 781px) {
	.wp-block-button .wp-block-button__link {
		min-height: 44px;
		display: inline-flex;
		align-items: center;
	}
}

/* FAQ (core/details): one bordered row per question. */
.wp-block-details {
	border-bottom: 1px solid var(--wp--preset--color--border-light);
	padding-block: var(--wp--preset--spacing--small);
}

.wp-block-details summary {
	cursor: pointer;
	font-weight: 600;
	font-size: var(--wp--preset--font-size--medium);
}

.wp-block-details > :not(summary) {
	color: var(--wp--preset--color--secondary);
	margin-block-start: .75em;
}

/* Links and outline buttons on dark or brand backgrounds take the text colour (brand links would not read there). */
:is(.has-main-background-color, .has-primary-background-color, .wp-block-cover) a:not(.wp-element-button) {
	color: inherit;
}

.wp-block-cover .wp-block-button.is-style-outline .wp-block-button__link,
.has-main-background-color .wp-block-button.is-style-outline .wp-block-button__link,
.has-primary-background-color .wp-block-button.is-style-outline .wp-block-button__link {
	color: inherit;
}
