/* ============================================================
   Hausundtier – Basis (Tokens, Typografie, Layout, Header/Footer)
   Farbwerte kommen aus der theme.json (Presets) und werden hier
   auf --ht-* gemappt: eine Quelle, zentral steuerbar.
   ============================================================ */

/*
 * Luckiest Guy mit korrigierten Metriken.
 * Der Font liefert ascent 1440 / descent -608 (bei 2048 upm) – 30 % der
 * Zeilenhöhe liegen unter der Grundlinie, obwohl der Caps-Font dort kaum
 * etwas zeichnet. Die Overrides zentrieren die Glyphen im Geviert, damit
 * Sticker-Boxen, Badges und Chips überall sauber sitzen.
 * (Deshalb liegt diese @font-face hier statt in der theme.json –
 * theme.json kennt keine ascent-/descent-Overrides.)
 */
@font-face {
	font-family: "Luckiest Guy";
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	src: url("../fonts/luckiest-guy-400.woff2") format("woff2");
	ascent-override: 74%;
	descent-override: 10%;
	line-gap-override: 0%;
}

:root {
	--ht-ink: var(--wp--preset--color--ink);
	--ht-ink-soft: var(--wp--preset--color--ink-soft);
	--ht-cream: var(--wp--preset--color--cream);
	--ht-white: var(--wp--preset--color--white);
	--ht-yellow: var(--wp--preset--color--yellow);
	--ht-yellow-soft: var(--wp--preset--color--yellow-soft);
	--ht-orange: var(--wp--preset--color--orange);
	--ht-orange-soft: var(--wp--preset--color--orange-soft);
	--ht-blue: var(--wp--preset--color--blue);
	--ht-blue-soft: var(--wp--preset--color--blue-soft);
	--ht-green: var(--wp--preset--color--green);
	--ht-green-soft: var(--wp--preset--color--green-soft);
	--ht-red: var(--wp--preset--color--red);
	--ht-red-soft: var(--wp--preset--color--red-soft);

	--ht-radius: 16px;
	--ht-radius-sm: 12px;
	--ht-border: 2px solid var(--ht-ink);
	--ht-hard: 3px 3px 0 var(--ht-ink);
	--ht-hard-sm: 2px 2px 0 var(--ht-ink);

	--ht-grid-paper: linear-gradient(rgba(36, 27, 18, 0.06) 1px, transparent 1px),
		linear-gradient(90deg, rgba(36, 27, 18, 0.06) 1px, transparent 1px);
}

/* ---------- Header ---------- */
.ht-header { padding: 18px 0 6px; }
.ht-topbar {
	background: var(--ht-white);
	border: var(--ht-border);
	border-radius: 999px;
	padding: 10px 14px 10px 24px;
	box-shadow: var(--ht-hard);
	align-items: center;
	gap: 16px;
}
.ht-logo a {
	font-family: var(--wp--preset--font-family--display);
	font-size: 22px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	text-decoration: none;
	color: var(--ht-ink);
}
.ht-logo a::before { content: "🐾 "; }
.ht-logo-invert a::before { content: "🐾 "; }
.ht-nav a { font-weight: 600; font-size: 14px; padding: 8px 14px; border-radius: 999px; }
.ht-nav a:hover { background: var(--ht-yellow-soft); }

/* Suche als Pill – Button sauber IM Pill halten (kein Überstehen) */
.ht-search .wp-block-search__inside-wrapper {
	background: var(--ht-white);
	border: var(--ht-border) !important;
	border-radius: 999px;
	box-shadow: var(--ht-hard-sm);
	padding: 4px 4px 4px 16px;
	display: flex;
	align-items: center;
	gap: 8px;
}
.ht-search input.wp-block-search__input {
	border: none; background: none; outline: none;
	font-size: 14px;
	min-width: 0;
	flex: 1;
	padding: 8px 0;
}
.ht-search button.wp-block-search__button {
	background: var(--ht-yellow);
	border: 1.5px solid var(--ht-ink);
	border-radius: 999px;
	font-weight: 700;
	cursor: pointer;
	margin: 0;
	padding: 8px 18px;
	flex-shrink: 0;
	box-shadow: none;
	line-height: 1.2;
	font-family: inherit;
}
.ht-search button.wp-block-search__button:hover { background: var(--ht-orange); color: #fff; }

/* ---------- Layout ---------- */
.ht-main { min-height: 60vh; }
.ht-breadcrumb { color: var(--ht-ink-soft); padding-top: 6px; }
.ht-breadcrumb-nav {
	display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
	font-size: 15px; color: var(--ht-ink-soft);
	padding: 4px 0;
}
.ht-breadcrumb-nav a { color: var(--ht-ink-soft); text-decoration: none; }
.ht-breadcrumb-nav a:hover { color: var(--ht-ink); border-bottom: 2px solid var(--ht-yellow); }
.ht-breadcrumb-home { font-size: 19px; line-height: 1; }
/* Breadcrumb dicht unters Menü: Root-Block-Gap zwischen Header und Main kappen */
main.ht-main { margin-block-start: 10px !important; }
.ht-main > .ht-breadcrumb-slot { margin-top: 0 !important; }
.ht-breadcrumb-sep { color: #C9BCAE; }
.ht-breadcrumb-aktuell { font-weight: 600; color: var(--ht-ink); }
/* Zweispalten-Layout als EIGENES Grid (statt wp:columns – deren
 * Kern-CSS hat position:sticky zuverlässig ausgehebelt).
 * Grid streckt die Sidebar-Zelle automatisch auf Zeilenhöhe,
 * der innere Wrapper klebt darin. */
.ht-layout {
	display: grid !important;
	grid-template-columns: minmax(0, 1fr) 340px;
	gap: 48px;
	padding: 24px 0 56px;
	align-items: start;
}
.ht-sidebar-col { align-self: stretch; min-width: 0; }
.ht-content-col { min-width: 0; }
/* Sticky MUSS auf dem direkten Grid-Kind sitzen: WordPress wickelt den
 * Template-Part in einen div.wp-block-template-part mit reiner Inhaltshöhe –
 * ein sticky-Element DARIN hat keinen Raum zum Kleben. Deshalb griff
 * position:sticky auf .ht-sidebar nie. */
.ht-sidebar-col > * { position: sticky; top: 40px; }
.ht-sidebar { position: static; }
.ht-sidebar > * + * { margin-top: 24px; }
.ht-meta { align-items: center; gap: 12px; font-size: 13px; color: var(--ht-ink-soft); }
.ht-avatar img { border-radius: 50%; border: 2px solid var(--ht-ink); }
.ht-featured img { border: var(--ht-border); border-radius: var(--ht-radius); }

/* ---------- Beitragskopf V3: vollbreites Bild + Overlap-Panel ---------- */
.ht-bild-voll { margin: 14px 0 0; }
.ht-bild-voll img {
	width: 100%;
	height: clamp(280px, 42vw, 480px);
	object-fit: cover;
	border: var(--ht-border);
	border-radius: 20px;
	display: block;
}
.ht-kopf-overlap {
	position: relative;
	max-width: 900px;
	margin: -90px auto 0 !important;
	background: var(--ht-white);
	border: var(--ht-border);
	border-radius: 20px;
	box-shadow: var(--ht-hard);
	padding: 28px 38px 24px;
	z-index: 2;
}
.ht-kopf-overlap::after {
	content: "";
	position: absolute; inset: 0;
	background: var(--ht-grid-paper);
	background-size: 24px 24px;
	mask-image: radial-gradient(ellipse at 85% 20%, black 0%, transparent 55%);
	border-radius: 20px;
	pointer-events: none;
}
.ht-kopf-overlap > * { position: relative; z-index: 1; }
.ht-kopf-overlap h1 { margin: 12px 0 14px !important; }
.ht-chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ht-autor-link { border-bottom: 2px solid var(--ht-yellow); }
.ht-autor-link:hover { background: var(--ht-yellow-soft); }
.ht-meta-date time { font-weight: 600; color: var(--ht-ink); }

/* Autorenbox am Beitragsende (Sprungziel #autor) */
.ht-autorbox {
	background: var(--ht-white);
	border: var(--ht-border);
	border-radius: var(--ht-radius);
	box-shadow: var(--ht-hard);
	padding: 24px 28px;
	margin: 40px 0 8px !important;
	gap: 20px;
	scroll-margin-top: 24px;
}
.ht-autorbox-label {
	font-size: 11px; font-weight: 800;
	text-transform: uppercase; letter-spacing: 0.12em;
	color: var(--ht-ink-soft);
	margin: 0 0 2px !important;
}
.ht-autorbox-name { font-weight: 800; font-size: 17px; margin: 0 0 6px !important; }
.ht-autorbox .wp-block-post-author-biography { color: #4A4038; font-size: 14px; }
/* Beitrag ohne Titelbild: Panel ohne Overlap */
.ht-bild-voll:empty { display: none; }
.ht-bild-voll:empty + .ht-kopf-overlap,
.ht-breadcrumb-slot + .ht-kopf-overlap { margin-top: 20px !important; }

/* Fließtext-Links im Inhalt – Frontend UND Editor sofort sichtbar
 * (.is-root-container = Editor-Canvas; wird via add_editor_style geladen). */
.wp-block-post-content a:not(.wp-element-button),
.is-root-container a:not(.wp-element-button):not(.components-button) {
	font-weight: 700;
	border-bottom: 2px solid var(--ht-yellow);
	text-decoration: none;
}

/* ---------- Footer ---------- */
.ht-footer { margin-top: 48px; border-top: var(--ht-border); }
.ht-footer a { color: inherit; text-decoration: none; }
.ht-logo-invert a { color: var(--ht-cream); }
.ht-footer-head {
	color: var(--ht-yellow);
	font-size: 15px !important;
}
.ht-footer-nav a { font-size: 14px; padding: 3px 0; opacity: 0.85; }
.ht-footer-nav a:hover { opacity: 1; }
.ht-footer-fine {
	border-top: 1px solid rgba(255, 255, 255, 0.12);
	padding-top: 20px;
	margin-top: 28px;
	opacity: 0.7;
}

/* ---------- Mobile UX ---------- */
/* Sticky-CTA-Leiste (Testseiten): Standard versteckt, JS blendet mobil ein */
.ht-sticky-cta {
	display: none;
	position: fixed;
	left: 0; right: 0; bottom: 0;
	z-index: 60;
	background: var(--ht-white);
	border-top: var(--ht-border);
	padding: 10px 16px;
	align-items: center;
}
body.ht-show-sticky-cta .ht-sticky-cta { display: flex; }
.ht-sticky-cta-label { font-size: 14px; margin: 0; }

/* Schwebender ToC-Knopf (per JS erzeugt) */
.ht-toc-fab {
	position: fixed;
	right: 16px; bottom: 16px;
	z-index: 70;
	background: var(--ht-yellow);
	border: var(--ht-border);
	border-radius: 999px;
	box-shadow: var(--ht-hard);
	font-weight: 700;
	font-size: 14px;
	padding: 12px 18px;
	cursor: pointer;
	display: none;
}
body.ht-show-sticky-cta .ht-toc-fab { bottom: 76px; }
.ht-toc-fab-panel {
	position: fixed;
	right: 16px; bottom: 72px;
	z-index: 71;
	background: var(--ht-white);
	border: var(--ht-border);
	border-radius: var(--ht-radius);
	box-shadow: var(--ht-hard);
	padding: 18px 22px;
	max-width: min(320px, calc(100vw - 32px));
	max-height: 50vh;
	overflow: auto;
	display: none;
}
body.ht-show-sticky-cta .ht-toc-fab-panel { bottom: 132px; }
.ht-toc-fab-panel.open { display: block; }

@media (max-width: 960px) {
	.ht-layout { display: block !important; }
	.ht-sidebar-col > * { position: static; }
	.ht-kopf-overlap { margin-top: -40px !important; padding: 20px 22px 18px; }
	/* Sidebar-Werbung wird per JS ans Artikelende bewegt – kein column-reverse! */
	.ht-toc-fab { display: block; }
	.ht-sidebar .ht-toc { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
}
