/* ToolHub – öffentliches Stylesheet */
:root {
  --accent: #2563eb;
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #1c1917;
  --muted: #6b6560;
  --border: #e7e5e4;
  --radius: 8px;
  --max: 1120px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
/* Dark Mode: automatisch per System, oder manuell über data-theme am <html> */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161514; --surface: #1f1e1c; --text: #ecebe9; --muted: #a29e99; --border: #33312e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161514; --surface: #1f1e1c; --text: #ecebe9; --muted: #a29e99; --border: #33312e;
  color-scheme: dark;
}

/* Theme-Umschalter */
.theme-toggle {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; padding: 0; flex-shrink: 0;
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--text); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.header-actions { display: flex; align-items: center; gap: 8px; order: 2; }
.brand { margin-right: auto; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.75rem, 3.5vw, 2.4rem); font-weight: 700; }
h2 { font-size: 1.35rem; font-weight: 650; }
h3 { font-size: 1.1rem; font-weight: 650; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 760px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.brand { display: flex; align-items: center; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.15rem; }
.brand img { max-height: 40px; width: auto; }
.main-nav { display: flex; gap: 4px; }
.main-nav a {
  color: var(--text); text-decoration: none; font-size: .95rem;
  padding: 8px 12px; border-radius: 6px;
}
.main-nav a:hover { background: var(--bg); }
.main-nav .nav-admin { color: var(--muted); }
.nav-toggle { display: none; }

@media (max-width: 680px) {
  .nav-toggle {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 40px; height: 40px; padding: 0 9px;
    background: none; border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
  }
  .nav-toggle span { display: block; height: 2px; background: var(--text); border-radius: 1px; transition: transform .2s, opacity .2s; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .main-nav {
    display: none;
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 8px 12px 12px;
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 12px; }
}

/* Intro */
.intro { padding: 56px 0 32px; }
.intro h1 { max-width: 760px; }
.intro-text { max-width: 680px; color: var(--muted); font-size: 1.08rem; }

/* Tool-Übersicht */
.tools { padding: 16px 0 72px; }
.section-head { display: flex; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 24px; }
.section-head h2 { margin: 0; }
.count { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.tool-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: border-color .15s;
}
.tool-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.tool-card-media { display: block; aspect-ratio: 16 / 10; background: var(--bg); border-bottom: 1px solid var(--border); overflow: hidden; }
.tool-card-media img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.placeholder { display: grid; place-items: center; height: 100%; font-size: 2.5rem; font-weight: 700; color: var(--muted); }
.tool-card-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; }
.tool-card-body h3 { margin-bottom: 4px; }
.tool-card-body h3 a { color: var(--text); text-decoration: none; }
.tool-card-desc { color: var(--muted); font-size: .95rem; margin: 6px 0 16px; flex: 1; }
.tool-card-body .btn { align-self: flex-start; margin-top: auto; }
.platform-tag { margin: 0; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.empty { color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 6px; border: 1px solid transparent;
  font: inherit; font-size: .95rem; font-weight: 550; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--text); }
.btn-sm { padding: 7px 14px; font-size: .88rem; }

/* Detailseite */
.detail { padding: 32px 20px 80px; }
.back-link { display: inline-block; color: var(--muted); text-decoration: none; font-size: .92rem; margin-bottom: 24px; }
.back-link:hover { color: var(--text); }
.notice { background: color-mix(in srgb, #f59e0b 15%, var(--surface)); border: 1px solid color-mix(in srgb, #f59e0b 40%, var(--border)); padding: 10px 14px; border-radius: 6px; font-size: .92rem; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  grid-template-areas: "head media" "body media";
  grid-template-rows: auto 1fr;
  column-gap: 48px;
}
.detail-grid.no-image { grid-template-columns: minmax(0, 760px); grid-template-areas: "head" "body"; }
.detail-head { grid-area: head; }
.detail-media { grid-area: media; margin: 0; align-self: start; position: sticky; top: 88px; }
.detail-body { grid-area: body; }
.detail-media img { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); width: 100%; cursor: zoom-in; }
.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 24px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 0; margin: 10px 0 28px; font-size: .84rem; color: var(--muted); }
.meta span + span::before { content: "·"; margin: 0 8px; }
.actions + .prose { margin-top: 28px; }

@media (max-width: 860px) {
  .detail-grid, .detail-grid.no-image {
    grid-template-columns: 1fr;
    grid-template-areas: "head" "media" "body";
  }
  .detail-media { position: static; margin-bottom: 24px; }
}

/* Fließtext */
.prose > :first-child { margin-top: 0; }
.prose h2 { margin-top: 1.6em; font-size: 1.2rem; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose code { background: var(--bg); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.prose pre { background: var(--bg); border: 1px solid var(--border); padding: 14px; border-radius: 6px; overflow-x: auto; }
.prose pre code { border: 0; padding: 0; }
.prose img { border-radius: 6px; border: 1px solid var(--border); }
.prose blockquote { margin: 0; padding-left: 16px; border-left: 3px solid var(--border); color: var(--muted); }

.page { padding: 48px 20px 80px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.85); display: grid; place-items: center; padding: 24px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-height: 90vh; max-width: 95vw; width: auto; border-radius: 4px; }
.lightbox button { position: absolute; top: 14px; right: 18px; background: none; border: 0; color: #fff; font-size: 2rem; cursor: pointer; line-height: 1; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); font-size: .9rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: center; padding-top: 22px; padding-bottom: 22px; }
.footer-note { margin: 0; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.footer-nav a { color: var(--muted); text-decoration: none; }
.footer-nav a:hover { color: var(--text); text-decoration: underline; }
@media (max-width: 680px) {
  .footer-inner { flex-direction: column-reverse; align-items: flex-start; }
}
