/*
Theme Name:   SG Theme
Theme URI:    https://saschagreiner.de
Author:       Sascha Greiner
Author URI:   https://saschagreiner.de
Description:  Block-Theme „Ein Kopf“ für saschagreiner.de. Mandarine und Aubergine, Schriften lokal (Anybody, Figtree), Scroll-Animationen nur per CSS mit Rücksicht auf „Bewegung reduzieren“.
Version:      1.0.1
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
License:      GPL-2.0-or-later
Text Domain:  sg-theme
*/

/* ---------- Grundlagen ---------- */
html { scroll-padding-top: 1rem; }
body { overflow-x: clip; -webkit-font-smoothing: antialiased; }
h1, h2, .sg-display, .sg-wide { font-stretch: 80%; letter-spacing: -0.01em; overflow-wrap: break-word; hyphens: auto; }
.wp-site-blocks > * + * { margin-block-start: 0; }
.wp-block-post-content > .alignfull, .wp-block-post-content > .sg-merge, .wp-block-post-content > .sg-band { margin-block-start: 0; margin-block-end: 0; }
h3 { font-stretch: 100%; }
:where(p, li) { max-width: 70ch; }
:focus-visible { outline: 3px solid var(--wp--preset--color--ink); outline-offset: 3px; }
.has-ink-background-color :focus-visible, .sg-dark :focus-visible { outline-color: var(--wp--preset--color--accent); }
.skip-link.screen-reader-text:focus { background: var(--wp--preset--color--ink); color: #fff; padding: .75rem 1rem; z-index: 100000; }
::selection { background: var(--wp--preset--color--accent); color: var(--wp--preset--color--ink); }

.screen-reader-text { border: 0; clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal !important; }
.sg-merge__title { font-family: var(--wp--preset--font-family--display); font-weight: 800; font-stretch: 90%; line-height: 1.05; color: #fff; }
.sg-dark a { color: #fff; }

/* ---------- Kopf ---------- */
.sg-header { background: var(--wp--preset--color--accent); color: var(--wp--preset--color--ink); }
.sg-header a { text-decoration: none; }
.sg-brand { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--wp--preset--font-family--display); font-weight: 800; font-stretch: 85%; font-size: 1.375rem; margin: 0; }
.sg-brand::before { content: "SG"; display: inline-flex; align-items: center; justify-content: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--wp--preset--color--ink); color: #fff; font-weight: 900; font-stretch: 70%; font-size: 1.2rem; }
.sg-header .wp-block-navigation__responsive-container.is-menu-open { background: var(--wp--preset--color--accent); color: var(--wp--preset--color--ink); }
.sg-header .wp-block-navigation-item__content:hover { text-decoration: underline; text-underline-offset: 4px; }
@media (max-width: 600px) { .sg-header .wp-block-buttons { display: none; } }

/* ---------- Typo-Bausteine ---------- */
.sg-display { font-size: var(--wp--preset--font-size--display) !important; font-stretch: 62% !important; line-height: .82 !important; font-weight: 900; }
.sg-lead { font-size: var(--wp--preset--font-size--large); font-weight: 500; }
.sg-kicker { font-weight: 700; font-size: 1rem; color: var(--wp--preset--color--muted); }
.sg-num { font-family: var(--wp--preset--font-family--display); font-weight: 900; font-stretch: 60%; font-size: clamp(4rem, 9vw, 6rem); line-height: .9; color: var(--wp--preset--color--ink); margin: 0; }
.sg-num::after { content: ""; display: block; width: 2.5rem; height: 6px; margin-top: .6rem; background: var(--wp--preset--color--accent); }
.sg-dark .sg-num, .has-ink-background-color .sg-num { color: var(--wp--preset--color--accent); }
.sg-price { font-family: var(--wp--preset--font-family--display); font-weight: 900; font-stretch: 70%; font-size: clamp(3.5rem, 7vw, 5.25rem); line-height: .9; margin: 0; }

/* ---------- Seitenkopf Unterseiten ---------- */
.sg-pagehead { background: var(--wp--preset--color--accent); }
.sg-pagehead h1 { font-size: clamp(3.25rem, 9vw, 8rem); font-stretch: 65%; line-height: .85; margin: 0; }

/* ---------- Ein-Kopf-Bühne (Rollen fließen zusammen) ---------- */
.sg-merge { height: 170vh; min-height: 68rem; position: relative; view-timeline-name: --sg-merge; }
.sg-merge__sticky { position: sticky; top: 0; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2rem; padding: 2rem 1rem; box-sizing: border-box; overflow: hidden; text-align: center; }
.sg-merge__stage { position: relative; width: min(980px, 100%); height: 19rem; }
.sg-merge__label { position: absolute; inset: 0 0 auto; margin: 0 auto; color: var(--wp--preset--color--line); font-size: 1rem; }
.sg-merge__chips { position: absolute; top: 2.5rem; left: 0; right: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin: 0; padding: 0; list-style: none; }
.sg-merge__chips li { padding: .75rem 1.25rem; border-radius: 999px; border: 2px solid var(--wp--preset--color--line); font-weight: 600; max-width: none; }
.sg-merge__one { position: absolute; left: 50%; top: 7rem; margin-left: -5.5rem; width: 11rem; height: 11rem; border-radius: 50%; background: var(--wp--preset--color--accent); color: var(--wp--preset--color--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.sg-merge__one strong { font-family: var(--wp--preset--font-family--display); font-weight: 900; font-stretch: 75%; font-size: 2.4rem; line-height: 1; }
.sg-merge__one span { font-size: .875rem; font-weight: 700; }
@media (max-width: 640px) {
	.sg-merge { height: auto; min-height: 0; }
	.sg-merge__sticky { position: static; min-height: 0; padding: 4rem 1rem; }
	.sg-merge__stage { height: auto; display: flex; flex-direction: column; gap: 1.5rem; align-items: center; }
	.sg-merge__label, .sg-merge__chips, .sg-merge__one { position: static; margin: 0; }
}

/* ---------- Laufband ---------- */
.sg-band { overflow: hidden; border-bottom: 3px solid var(--wp--preset--color--ink); }
.sg-band__track { display: flex; width: max-content; gap: 2.5rem; padding: 1.25rem 0; margin: 0; font-family: var(--wp--preset--font-family--display); font-weight: 800; font-stretch: 70%; font-size: clamp(2rem, 4vw, 2.75rem); white-space: nowrap; animation: sg-band 30s linear infinite; list-style: none; }
.sg-band__track li { max-width: none; }
.sg-band__track li:nth-child(even) { color: var(--wp--preset--color--accent); }
@keyframes sg-band { to { transform: translateX(-50%); } }

/* ---------- Durchstreichen ---------- */
.sg-strike-h { font-family: var(--wp--preset--font-family--display); font-weight: 800; font-stretch: 80%; font-size: clamp(2rem, 4vw, 2.6rem); line-height: 1.1; margin: 0 0 .6rem; }
.sg-strike { position: relative; display: inline-block; }
.sg-strike::after { content: ""; position: absolute; left: -4px; right: -4px; top: 52%; height: 6px; background: var(--wp--preset--color--accent); transform-origin: left center; }

/* ---------- Stapelkarten ---------- */
.sg-stack { display: flex; flex-direction: column; gap: 1.5rem; }
.sg-stack > .sg-card { position: sticky; min-height: 15rem; border-radius: var(--wp--custom--radius-large); padding: clamp(1.5rem, 4vw, 2.25rem); box-sizing: border-box; display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; align-items: flex-end; justify-content: space-between; }
.sg-stack > .sg-card:nth-child(1) { top: 1.5rem; }
.sg-stack > .sg-card:nth-child(2) { top: 2.75rem; }
.sg-stack > .sg-card:nth-child(3) { top: 4rem; }
.sg-stack > .sg-card:nth-child(4) { top: 5.25rem; }
.sg-stack > .sg-card:nth-child(5) { top: 6.5rem; }
.sg-stack > .sg-card:nth-child(6) { top: 7.75rem; }
.sg-card h3 { font-family: var(--wp--preset--font-family--display); font-weight: 900; font-stretch: 80%; font-size: clamp(2.6rem, 6vw, 5rem); line-height: .9; margin: 0; }
.sg-card h3 a { text-decoration: none; }
.sg-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.sg-card { position: relative; }
.sg-card.has-white-background-color, .sg-card.has-surface-background-color { border: 2px solid var(--wp--preset--color--ink); }
.sg-card .sg-card__price { font-family: var(--wp--preset--font-family--display); font-weight: 800; font-size: 1.6rem; margin: 0; }
.sg-card .sg-card__text { flex: 1 1 26rem; }
.sg-card .sg-card__text p { margin: .9rem 0 0; font-size: 1.2rem; }

/* ---------- Pakete ---------- */
.sg-plans { border-top: 2px solid var(--wp--preset--color--line); }
.sg-plan--featured { border-radius: 0 0 var(--wp--custom--radius-large) var(--wp--custom--radius-large); }

/* ---------- Zahlen, die hochzählen ---------- */
@property --sg-n { syntax: '<integer>'; inherits: false; initial-value: 15; }
.sg-count::before { counter-reset: sgn var(--sg-n); content: counter(sgn); }

/* ---------- FAQ ---------- */
.wp-block-details { border-top: 2px solid currentColor; padding: 1.25rem 0; }
.wp-block-details:last-of-type { border-bottom: 2px solid currentColor; }
.wp-block-details summary { cursor: pointer; font-size: 1.3rem; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.wp-block-details summary::-webkit-details-marker { display: none; }
.wp-block-details summary::after { content: "+"; font-size: 1.8rem; line-height: 1; transition: transform .2s; }
.wp-block-details[open] summary::after { transform: rotate(45deg); }

/* ---------- Tabellen ---------- */
.wp-block-table { overflow-x: auto; }
.wp-block-table table { border-collapse: collapse; min-width: 36rem; }
.wp-block-table th, .wp-block-table td { border: 0; border-bottom: 1px solid var(--wp--preset--color--line); padding: .8rem .75rem; text-align: left; vertical-align: top; }
.wp-block-table thead { border-bottom: 3px solid var(--wp--preset--color--ink); }

/* ---------- Bildplatzhalter ---------- */
.sg-shot { aspect-ratio: 4 / 3; background: var(--wp--preset--color--surface); border-radius: 24px; display: flex; align-items: center; justify-content: center; color: var(--wp--preset--color--muted); font-size: 1rem; text-align: center; padding: 1rem; margin: 0; }
.sg-shot img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

/* ---------- Fuß ---------- */
.sg-footer a { color: #fff; }
.sg-footer p { max-width: none; }

/* ---------- Scroll-Animationen (nur Browser mit Unterstützung, sonst statisch) ---------- */
@supports (animation-timeline: view()) {
	.sg-in { animation: sg-in linear both; animation-timeline: view(); animation-range: entry 0% cover 28%; }
	@keyframes sg-in { from { opacity: 0; transform: translateY(60px) rotate(1.5deg); } to { opacity: 1; transform: none; } }
	.sg-wide { animation: sg-wide linear both; animation-timeline: view(); animation-range: entry 0% cover 40%; }
	@keyframes sg-wide { from { font-stretch: 55%; opacity: .2; } to { font-stretch: 100%; opacity: 1; } }
	.sg-strike::after { animation: sg-strike linear both; animation-timeline: view(); animation-range: entry 60% cover 55%; }
	@keyframes sg-strike { from { transform: scaleX(0); } to { transform: scaleX(1); } }
	.sg-count { animation: sg-count linear both; animation-timeline: view(); animation-range: entry 20% cover 50%; }
	@keyframes sg-count { from { --sg-n: 0; } to { --sg-n: 15; } }
	.sg-merge__chips li { animation: sg-chip linear both; animation-timeline: --sg-merge; animation-range: contain 5% contain 60%; }
	@keyframes sg-chip { to { transform: translate(var(--tx, 0), 7rem) scale(.2); opacity: 0; } }
	.sg-merge__chips li:nth-child(1) { --tx: 20rem; } .sg-merge__chips li:nth-child(2) { --tx: 12rem; } .sg-merge__chips li:nth-child(3) { --tx: 4rem; }
	.sg-merge__chips li:nth-child(4) { --tx: -4rem; } .sg-merge__chips li:nth-child(5) { --tx: -11rem; } .sg-merge__chips li:nth-child(6) { --tx: -19rem; }
	.sg-merge__one { animation: sg-one linear both; animation-timeline: --sg-merge; animation-range: contain 40% contain 75%; }
	@keyframes sg-one { from { transform: scale(.2); opacity: 0; } to { transform: none; opacity: 1; } }
	.sg-merge__label { animation: sg-fade linear both; animation-timeline: --sg-merge; animation-range: contain 20% contain 45%; }
	@keyframes sg-fade { to { opacity: 0; } }
	@media (max-width: 640px) { .sg-merge__chips li, .sg-merge__one, .sg-merge__label { animation: none; } }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
	.sg-merge { height: auto; min-height: 0; }
	.sg-merge__sticky { position: static; min-height: 0; padding: 4rem 1rem; }
}

/* ---------- Formulare (SG Kontakt, Digital-Check) ---------- */
.sg-form { display: grid; gap: 1.1rem; max-width: 40rem; }
.sg-form label { display: block; font-weight: 700; margin-bottom: .35rem; }
.sg-form input[type="text"], .sg-form input[type="email"], .sg-form textarea {
	width: 100%; box-sizing: border-box; font: inherit; padding: .85rem 1rem; border: 2px solid var(--wp--preset--color--ink); border-radius: var(--wp--custom--radius); background: #fff; color: var(--wp--preset--color--ink);
}
.sg-form textarea { min-height: 9rem; }
.sg-form .sg-form__hint { font-size: .95rem; color: var(--wp--preset--color--muted); margin: .3rem 0 0; }
.sg-form button { justify-self: start; font: inherit; font-weight: 700; font-size: 1.125rem; padding: 1rem 1.5rem; border: 0; border-radius: var(--wp--custom--radius); background: var(--wp--preset--color--ink); color: #fff; cursor: pointer; }
.sg-form button:hover { background: var(--wp--preset--color--muted); }
.sg-form__error { color: #b3261e; font-weight: 700; }
.sg-form__ok { background: var(--wp--preset--color--surface); border-left: 6px solid var(--wp--preset--color--accent); padding: 1rem 1.25rem; font-weight: 600; }
.sg-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.sgdc { --sgdc-accent: var(--wp--preset--color--ink); --sgdc-on-accent: #fff; --sgdc-ink: var(--wp--preset--color--ink); --sgdc-muted: var(--wp--preset--color--muted); --sgdc-line: var(--wp--preset--color--line); }
