/*
Theme Name: sg
Theme URI: 
Author: 
Author URI: 
Description: 
Requires at least: 6.9
Tested up to: 6.9
Requires PHP: 7.2
Version: 1.0
License: GNU General Public License v3
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Text Domain: sg
Tags: block-patterns, block-styles, custom-colors, custom-logo, custom-menu, editor-style, full-site-editing, one-column, template-editing, threaded-comments, translation-ready, wide-blocks

/* Defaults
---------------------------------------- */

/* Defaults
---------------------------------------- */

*,
*::before,
*::after {
	box-sizing: border-box;
	scroll-margin: 100px;
}

html {
	scroll-behavior: smooth;
	scrollbar-gutter: stable;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

a,
button,
input:focus,
input[type="button"],
input[type="submit"],
textarea:focus,
.wp-element-button {
	transition:
		color 0.2s ease-in-out,
		background-color 0.2s ease-in-out,
		border-color 0.2s ease-in-out,
		box-shadow 0.2s ease-in-out,
		opacity 0.2s ease-in-out;
}

a:not(.wp-element-button):not(.wp-block-navigation__label) {
	text-decoration: none;
	background-image: linear-gradient(currentColor, currentColor);
	background-position: 0 100%;
	background-repeat: no-repeat;
	background-size: 0% 1px;
	transition: background-size 0.3s ease;
}

a:not(.wp-element-button):not(.wp-block-navigation__label):hover,
a:not(.wp-element-button):not(.wp-block-navigation__label):focus {
	background-size: 100% 1px;
}

b,
strong,
th {
	font-weight: var(--wp--custom--font-weight--medium);
}

mark {
	background: linear-gradient(90deg, var(--wp--preset--color--primary) 0%, var(--wp--preset--color--primary) 100%);
	background-position: 0 85%;
	background-repeat: repeat-x;
	background-size: 100% 15%;
}

/* -- Forms -- */

input,
select,
textarea {
	background-color: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--contrast);
	border-radius: 0;
	color: var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--primary);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: var(--wp--custom--font-weight--light);
	line-height: var(--wp--custom--line-height--body);
	padding: 10px 20px;
	width: 100%;
}

input:focus,
textarea:focus {
	background-color: var(--wp--preset--color--neutral);
	border-color: var(--wp--preset--color--primary);
	outline: none;
	transition:
		border-color 0.2s ease,
		background-color 0.2s ease;
}

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

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

::placeholder {
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--small);
	opacity: 0.5;
}

/* Blocks
---------------------------------------- */

/* -- Code -- */

*:not(.wp-block-code) > code {
	background-color: var(--wp--preset--color--neutral);
	font-size: var(--wp--preset--font-size--small);
	padding: 5px 8px;
}

/* -- Navigation -- */

.wp-block-navigation__responsive-container.is-menu-open {
	padding: var(--wp--custom--spacing--gap);
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	padding-top: var(--wp--custom--spacing--gap);
}

.wp-block-navigation__responsive-container-close,
.wp-block-navigation__responsive-container-open {
	border: 1px solid currentColor;
	padding: 2px;
}

.has-background .wp-block-navigation__responsive-container-open:focus,
.has-background .wp-block-navigation__responsive-container-open:hover {
	color: var(--wp--preset--color--base);
}

/* -- Navigation Submenu -- */

.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container {
	background-color: var(--wp--preset--color--contrast);
	border: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	padding: 10px;
}

.wp-block-navigation :where(.wp-block-navigation__submenu-container) a {
	padding: 2px 10px;
}

/* Utility
---------------------------------------- */

/* -- Box Shadow -- */

.is-style-shadow-light {
	box-shadow: var(--wp--preset--shadow--light);
}

.is-style-shadow-solid {
	box-shadow: var(--wp--preset--shadow--solid);
}

/* Media Queries
---------------------------------------- */

@media only screen and (max-width: 600px) {

	/* -- Utility -- */

	.is-style-hidden-mobile {
		display: none !important;
	}

}

@media only screen and (max-width: 782px) {

	/* -- Columns -- */

	.is-style-columns-reverse {
		flex-direction: column-reverse;
	}

}

/*
 * text-wrap: balance for headings (even line lengths),
 * text-wrap: pretty for body text (avoids orphaned last words).
 * https://github.com/WordPress/gutenberg/issues/55190
 */
h1, h2, h3, h4, h5, h6 {
	text-wrap: balance;
}

blockquote, caption, figcaption, p {
	text-wrap: pretty;
}

/* Accessible focus ring for keyboard users — invisible on mouse click */
:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 3px;
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}

	html {
		scroll-behavior: auto;
	}

	li.wp-block-post:hover {
		transform: none;
	}
}

/* -- Scroll Margins -- */

#buch {
	scroll-margin-top: 160px;
}

/* -- Post Cards -- */

li.wp-block-post {
	position: relative;
	transition:
		transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
		box-shadow 0.25s ease;
}

li.wp-block-post:hover {
	transform: translateY(-5px);
	box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.12);
	cursor: pointer;
}

/* Makes the excerpt "more" link cover the entire card for full-card click */
.wp-block-post-excerpt__more-link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 10;
}

.wp-block-post-excerpt {
	position: static;
}

/* -- Read More as Outlined Button -- */

.wp-block-read-more {
	display: inline-flex;
	align-items: center;
	border: 1px solid currentColor;
	padding: 0.5em 1.25em;
	border-radius: 4px;
	background: transparent;
	text-decoration: none;
	font-size: var(--wp--preset--font-size--small);
	transition:
		color 0.2s ease-in-out,
		background-color 0.2s ease-in-out,
		border-color 0.2s ease-in-out,
		box-shadow 0.2s ease-in-out;
}

/* -- Logo Row -- */

.logo-row {
	--base-height: 3rem;
	--scale-factor-horizontal: 0.1;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-wrap: wrap;
	gap: 3rem 2rem;
}

.logo-row > figure {
	--base-ratio: calc(var(--width) / var(--height));
	aspect-ratio: var(--base-ratio);
	--factor-horizontal: min(
		var(--scale-factor-horizontal) * -1 * var(--base-ratio) + var(--scale-factor-horizontal) + 1,
		1
	);
	height: max(
		var(--base-height) / 2,
		var(--base-height) * var(--factor-horizontal)
	) !important;
	margin: 0;
}

.logo-row > figure img {
	width: 100%;
	height: auto;
	object-fit: contain;
}

/* -- Mobile Swipeable Carousel -- */

@media (max-width: 781px) {
	.your-raster-container {
		display: flex !important;
		flex-wrap: nowrap !important;
		overflow-x: auto !important;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		gap: 20px;
		padding-bottom: 15px;
	}

	.your-raster-container > * {
		flex: 0 0 70%;
		scroll-snap-align: start;
		max-width: 50vw;
	}
}

/* Performance & Rendering
---------------------------------------- */

/* GPU-composited layer hint for animated elements */
li.wp-block-post,
.wp-block-read-more {
	will-change: transform;
}

/* Contain layout/style for isolated sections to reduce repaint scope */
.wp-block-cover {
	contain: layout style;
}

/* -- Custom Scrollbar -- */

::-webkit-scrollbar {
	width: 6px;
	height: 6px;
}

::-webkit-scrollbar-track {
	background: transparent;
}

::-webkit-scrollbar-thumb {
	background-color: rgba(0, 0, 0, 0.25);
	border-radius: 3px;
}

/* Firefox */
* {
	scrollbar-width: thin;
	scrollbar-color: var(--wp--preset--color--contrast) transparent;
}

/* -- Text Selection -- */

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

/* -- Image hover zoom -- */

.wp-block-post figure,
.wp-block-image figure {
	overflow: hidden;
}

.wp-block-post figure img,
.wp-block-image img {
	transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
	display: block;
}

.wp-block-post:hover figure img {
	transform: scale(1.03);
}

/* -- Scroll-driven fade-in for content sections -- */
/* Uses @starting-style for first paint + scroll observer fallback */

@supports (animation-timeline: scroll()) {
	.wp-block-group[class*="alignwide"],
	.wp-block-columns,
	.wp-block-query {
		animation: sg-fade-up linear both;
		animation-timeline: view();
		animation-range: entry 0% entry 25%;
	}
}

@keyframes sg-fade-up {
	from {
		opacity: 0;
		translate: 0 2rem;
	}
	to {
		opacity: 1;
		translate: 0 0;
	}
}

/* -- Logo row hover -- */

.logo-row > figure {
	transition: opacity 0.2s ease, filter 0.2s ease;
}

.logo-row:hover > figure {
	opacity: 0.4;
	filter: grayscale(1);
}

.logo-row:hover > figure:hover {
	opacity: 1;
	filter: grayscale(0);
}

/* -- Navigation open/close animation -- */

.wp-block-navigation__responsive-container.is-menu-open {
	animation: sg-menu-open 0.25s cubic-bezier(0.33, 1, 0.68, 1) both;
}

@keyframes sg-menu-open {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* -- Submenu animation -- */

.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container {
	animation: sg-submenu-open 0.18s ease both;
	transform-origin: top center;
}

@keyframes sg-submenu-open {
	from {
		opacity: 0;
		transform: scaleY(0.92) translateY(-4px);
	}
	to {
		opacity: 1;
		transform: scaleY(1) translateY(0);
	}
}

/* View Transitions
---------------------------------------- */

/* Enable cross-document view transitions (Chrome 126+) */
@view-transition {
	navigation: auto;
}

/* Whole page: fade + slight upward drift */
::view-transition-old(root) {
	animation: sg-vt-out 0.25s cubic-bezier(0.4, 0, 1, 1) both;
}

::view-transition-new(root) {
	animation: sg-vt-in 0.3s cubic-bezier(0, 0, 0.2, 1) both;
}

@keyframes sg-vt-out {
	to {
		opacity: 0;
		translate: 0 -12px;
	}
}

@keyframes sg-vt-in {
	from {
		opacity: 0;
		translate: 0 12px;
	}
}

/* Named transition for the hero / featured image so it morphs between pages */
.wp-block-post-featured-image img,
.wp-block-cover {
	view-transition-name: sg-hero;
}

::view-transition-old(sg-hero) {
	animation: sg-hero-out 0.35s ease both;
}

::view-transition-new(sg-hero) {
	animation: sg-hero-in 0.35s ease both;
}

@keyframes sg-hero-out {
	to {
		opacity: 0;
		scale: 0.97;
	}
}

@keyframes sg-hero-in {
	from {
		opacity: 0;
		scale: 1.02;
	}
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
	::view-transition-old(root),
	::view-transition-new(root),
	::view-transition-old(sg-hero),
	::view-transition-new(sg-hero) {
		animation: none;
	}
}