/*
Theme Name: Fensal Schmiede
Theme URI: https://fensal-smide.de
Author: Fensal
Description: Schlichtes, modernes Theme für die Schmiede: Experimente, Apps und Bastelprojekte. Dunkles Glut-Design, Experiment-Bereich, Entwickler-Extras und Verknüpfung zur Zocker-Loge.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: fensal-smide
*/

/* ---------- Design-Tokens ---------- */
:root {
	--bg: #0e0f12;
	--bg-2: #15171c;
	--bg-3: #1c1f26;
	--line: #2a2e38;
	--text: #e8e6e1;
	--muted: #9aa0ab;
	--ember: #ff7a1a;
	--ember-2: #ffb347;
	--ok: #4ade80;
	--warn: #facc15;
	--lab: #60a5fa;
	--radius: 14px;
	--max: 1120px;
	--font: system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
	--mono: ui-monospace, "JetBrains Mono", "Fira Code", Consolas, monospace;
}

:root[data-theme="light"] {
	--bg: #f6f3ee;
	--bg-2: #ffffff;
	--bg-3: #efebe4;
	--line: #ddd6ca;
	--text: #1b1c1f;
	--muted: #5f6570;
	--ember: #e5600a;
	--ember-2: #c2410c;
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ember); text-decoration: none; }
a:hover { color: var(--ember-2); }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 .6em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
p { margin: 0 0 1.1em; }

.wrap { width: min(100% - 2.5rem, var(--max)); margin-inline: auto; }
.screen-reader-text {
	position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus {
	left: 1rem; top: 1rem; width: auto; height: auto; z-index: 100;
	background: var(--ember); color: #000; padding: .5rem 1rem; border-radius: 8px;
}
:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }

/* ---------- Header ---------- */
.site-header {
	position: sticky; top: 0; z-index: 50;
	background: color-mix(in srgb, var(--bg) 85%, transparent);
	backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--text); font-size: 1.1rem; }
.brand:hover { color: var(--text); }
.brand .spark {
	width: 12px; height: 12px; border-radius: 50%;
	background: radial-gradient(circle, var(--ember-2), var(--ember));
	box-shadow: 0 0 14px var(--ember);
	animation: glow 2.6s ease-in-out infinite;
}
@keyframes glow { 50% { box-shadow: 0 0 22px var(--ember-2); transform: scale(1.15); } }

.main-nav { margin-left: auto; }
.main-nav ul { list-style: none; display: flex; gap: .3rem; margin: 0; padding: 0; }
.main-nav a {
	display: block; padding: .45rem .85rem; border-radius: 999px;
	color: var(--muted); font-size: .95rem;
}
.main-nav a:hover, .main-nav .current-menu-item > a { color: var(--text); background: var(--bg-3); }

.header-actions { display: flex; gap: .5rem; align-items: center; }
.icon-btn {
	background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
	width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 1rem;
}
.icon-btn:hover { border-color: var(--ember); }
.nav-toggle { display: none; }

/* ---------- Buttons / Chips ---------- */
.btn {
	display: inline-flex; align-items: center; gap: .5rem;
	padding: .7rem 1.2rem; border-radius: 10px; font-weight: 600;
	background: var(--ember); color: #1a0e00; border: 1px solid var(--ember);
}
.btn:hover { background: var(--ember-2); color: #1a0e00; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ember); color: var(--ember); }

.chip {
	display: inline-flex; align-items: center; gap: .4rem;
	font-family: var(--mono); font-size: .75rem; padding: .2rem .6rem;
	border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: var(--bg-2);
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.status-laeuft  { color: var(--ok); }
.chip.status-baustelle { color: var(--warn); }
.chip.status-idee    { color: var(--lab); }
.chip.status-archiv  { color: var(--muted); }

/* ---------- Hero ---------- */
.hero { padding: clamp(3rem, 9vw, 7rem) 0 3rem; position: relative; overflow: hidden; }
.hero::before {
	content: ""; position: absolute; inset: -20% -10% auto auto; width: 520px; height: 520px;
	background: radial-gradient(circle, color-mix(in srgb, var(--ember) 28%, transparent), transparent 65%);
	pointer-events: none;
}
.hero .eyebrow { font-family: var(--mono); color: var(--ember); font-size: .85rem; margin-bottom: 1rem; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--ember), var(--ember-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { max-width: 60ch; color: var(--muted); font-size: 1.15rem; }
.hero .cta { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.6rem; }

/* ---------- Sektionen ---------- */
.section { padding: 2.5rem 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.section-head h2 { margin: 0; }
.section-head .more { font-size: .9rem; }

/* ---------- Grid & Cards ---------- */
.grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
	background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 1.2rem; display: flex; flex-direction: column; gap: .7rem;
	transition: transform .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--ember); }
.card .thumb { border-radius: 10px; overflow: hidden; aspect-ratio: 16/9; background: var(--bg-3); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card h3 { margin: 0; font-size: 1.15rem; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--ember); }
.card .excerpt { color: var(--muted); font-size: .95rem; margin: 0; }
.card .meta { margin-top: auto; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.tags { display: flex; gap: .35rem; flex-wrap: wrap; }
.tag { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.tag::before { content: "#"; color: var(--ember); }

/* ---------- Zocker-Loge Banner ---------- */
.loge-banner {
	display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
	border: 1px dashed var(--ember); border-radius: var(--radius); padding: 1.6rem;
	background: linear-gradient(135deg, color-mix(in srgb, var(--ember) 10%, var(--bg-2)), var(--bg-2));
}
.loge-banner h2 { margin-bottom: .3rem; }
.loge-banner p { margin: 0; color: var(--muted); max-width: 55ch; }

/* ---------- Inhalt (Beiträge/Seiten) ---------- */
.entry { padding: 3rem 0; }
.entry-header { margin-bottom: 1.6rem; }
.entry-header .meta { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .9rem; }
.entry-content { max-width: 74ch; }
.entry-content img { border-radius: 10px; }
.entry-content blockquote { margin: 1.4rem 0; padding: .4rem 1.2rem; border-left: 3px solid var(--ember); color: var(--muted); }
.entry-content hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

/* Code für Entwickler */
code, kbd, pre { font-family: var(--mono); font-size: .9em; }
:not(pre) > code { background: var(--bg-3); padding: .12em .4em; border-radius: 6px; border: 1px solid var(--line); }
pre {
	position: relative; background: #0a0b0e; color: #e6e1d6;
	border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.2rem; overflow-x: auto; margin: 1.4rem 0;
}
:root[data-theme="light"] pre { background: #1b1c1f; }
pre code { background: none; border: 0; padding: 0; }
.copy-btn {
	position: absolute; top: .5rem; right: .5rem; font-family: var(--mono); font-size: .7rem;
	background: var(--bg-3); color: var(--muted); border: 1px solid var(--line);
	border-radius: 6px; padding: .2rem .5rem; cursor: pointer; opacity: 0; transition: opacity .15s;
}
pre:hover .copy-btn, .copy-btn:focus { opacity: 1; }

/* Experiment-Infobox */
.lab-box {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem;
	background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 1.1rem; margin-bottom: 2rem;
}
.lab-box dt { font-family: var(--mono); font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.lab-box dd { margin: .15rem 0 0; font-weight: 600; word-break: break-word; }

/* Filter */
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.filters button {
	font: inherit; font-size: .88rem; padding: .4rem .9rem; border-radius: 999px; cursor: pointer;
	background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
}
.filters button:hover, .filters button.active { color: var(--text); border-color: var(--ember); }

/* Pagination */
.pagination { display: flex; gap: .4rem; margin-top: 2rem; flex-wrap: wrap; }
.pagination .page-numbers {
	padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 8px; color: var(--muted);
}
.pagination .current { background: var(--ember); color: #1a0e00; border-color: var(--ember); }

/* ---------- Footer ---------- */
.site-footer { margin-top: 3rem; border-top: 1px solid var(--line); padding: 2rem 0; color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }
.footer-inner ul { list-style: none; display: flex; gap: 1rem; margin: 0; padding: 0; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
	.nav-toggle { display: inline-block; }
	.main-nav {
		position: absolute; top: 64px; left: 0; right: 0; background: var(--bg);
		border-bottom: 1px solid var(--line); display: none; padding: .8rem 1.25rem;
	}
	.main-nav.open { display: block; }
	.main-nav ul { flex-direction: column; }
	.header-actions { margin-left: auto; }
	.main-nav { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
	* { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Fortschrittsbalken ---------- */
.progress { display: flex; align-items: center; gap: .7rem; }
.progress-track {
	position: relative; flex: 1; height: 8px; border-radius: 999px; overflow: hidden;
	background: var(--bg-3); border: 1px solid var(--line);
}
.progress-fill {
	position: relative; display: block; height: 100%; width: var(--p); overflow: hidden;
	border-radius: inherit; background: linear-gradient(90deg, var(--ember), var(--ember-2));
	box-shadow: 0 0 12px color-mix(in srgb, var(--ember) 55%, transparent);
	animation: fillIn 1.1s cubic-bezier(.2, .8, .2, 1) both;
}
.progress-fill::after {
	content: ""; position: absolute; inset: 0; transform: translateX(-100%);
	background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
	animation: shine 2.8s ease-in-out 1.2s infinite;
}
.progress.is-done .progress-fill {
	background: linear-gradient(90deg, #22c55e, var(--ok));
	box-shadow: 0 0 12px color-mix(in srgb, var(--ok) 50%, transparent);
}
.progress.is-done .progress-fill::after { display: none; }
.progress-label { font-family: var(--mono); font-size: .78rem; color: var(--muted); min-width: 3.5ch; text-align: right; }
@keyframes fillIn { from { width: 0; } to { width: var(--p); } }
@keyframes shine { 60%, 100% { transform: translateX(100%); } }

.progress-lg {
	flex-direction: column; align-items: stretch; gap: .7rem; margin-bottom: 2rem;
	background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem;
}
.progress-head { display: flex; align-items: baseline; gap: .8rem; }
.progress-head .progress-phase { color: var(--ember); font-family: var(--mono); font-size: .8rem; }
.progress-head .progress-label { margin-left: auto; font-size: 1.1rem; color: var(--text); font-weight: 700; }
.progress-lg .progress-track { height: 16px; flex: none; }
.progress-lg .progress-track::before {
	content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
	background:
		linear-gradient(90deg, transparent calc(25% - 1px), rgba(0, 0, 0, .35) 25%, transparent calc(25% + 1px)),
		linear-gradient(90deg, transparent calc(50% - 1px), rgba(0, 0, 0, .35) 50%, transparent calc(50% + 1px)),
		linear-gradient(90deg, transparent calc(75% - 1px), rgba(0, 0, 0, .35) 75%, transparent calc(75% + 1px));
}

/* ---------- Ideen-Briefkasten ---------- */
.idea-box {
	display: grid; gap: 2rem; grid-template-columns: 1fr 1.4fr;
	background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.8rem;
	scroll-margin-top: 90px;
}
.idea-box h2 { margin-bottom: .5rem; }
.privacy-note { font-size: .78rem; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.field label { font-size: .85rem; color: var(--muted); }
.field input, .field textarea {
	font: inherit; padding: .65rem .85rem; border-radius: 10px; width: 100%;
	border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.field input:focus, .field textarea:focus { border-color: var(--ember); outline: none; }
.field textarea { resize: vertical; min-height: 120px; }
.count { font-family: var(--mono); font-size: .72rem; color: var(--muted); text-align: right; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.idea-msg { display: none; margin-bottom: 1rem; padding: .7rem 1rem; border-radius: 10px; font-size: .92rem; }
.idea-msg.ok, .idea-msg.err { display: block; }
.idea-msg.ok { background: color-mix(in srgb, var(--ok) 14%, var(--bg-2)); border: 1px solid var(--ok); }
.idea-msg.err { background: color-mix(in srgb, #ef4444 14%, var(--bg-2)); border: 1px solid #ef4444; }
@media (max-width: 760px) { .idea-box { grid-template-columns: 1fr; padding: 1.2rem; } }

/* WordPress-Kern-Klassen */
.alignleft { float: left; margin: 0 1.2rem 1rem 0; }
.alignright { float: right; margin: 0 0 1rem 1.2rem; }
.aligncenter { margin-inline: auto; }
.wp-caption-text, figcaption { color: var(--muted); font-size: .85rem; }
