/* =============================================
   Rainer's Blogseiten – Zola Theme
   ============================================= */

/* --- Variablen --- */
:root {
  --accent:        #EF9F27;
  --accent-dark:   #BA7517;
  --header-bg:     #1D2B3A;
  --header-text:   #ffffff;

  --body-bg:       #f7f5f0;
  --surface:       #ffffff;
  --border:        rgba(0,0,0,0.1);
  --text:          #1a1a1a;
  --text-muted:    #5a5a5a;
  --text-faint:    #888;

  --tag-xmpp-bg:   #E6F1FB; --tag-xmpp-text:   #0C447C; --tag-xmpp-border: #85B7EB;
  --tag-elektronik-bg: #EAF3DE; --tag-elektronik-text: #27500A; --tag-elektronik-border: #97C459;
  --tag-fhem-bg:   #EEEDFE; --tag-fhem-text:   #3C3489; --tag-fhem-border: #AFA9EC;
  --tag-asterisk-bg: #FAEEDA; --tag-asterisk-text: #633806; --tag-asterisk-border: #EF9F27;
  --tag-solar-bg:  #FAECE7; --tag-solar-text:  #712B13; --tag-solar-border: #F0997B;
  --tag-rasppi-bg: #EAF3DE; --tag-rasppi-text: #27500A; --tag-rasppi-border: #97C459;
  --tag-debian-bg: #FBEAF0; --tag-debian-text: #4B1528; --tag-debian-border: #ED93B1;

  --radius:    8px;
  --radius-lg: 12px;
  --max-w:     900px;
  --sidebar-w: 210px;
  --gap:       2rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --body-bg:    #13191f;
    --surface:    #1e2730;
    --border:     rgba(255,255,255,0.1);
    --text:       #e8e4dc;
    --text-muted: #9a9a9a;
    --text-faint: #666;
    --header-bg:  #0d1318;
  }
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--body-bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }

/* --- Layout --- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.page-wrap {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  gap: var(--gap);
  padding-top: 2rem;
  padding-bottom: 3rem;
  flex: 1;
}

@media (max-width: 700px) {
  .page-wrap {
    grid-template-columns: 1fr;
  }
  .sidebar { order: 2; }
}

/* --- Header --- */
.site-header {
  background: var(--header-bg);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.05);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 0;
  gap: 1rem;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-mark {
  width: 42px;
  height: 42px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Eigenes Logo: ersetze .logo-mark durch <img class="logo-img" src="/img/logo.png"> */
.logo-img {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  object-fit: cover;
}

.site-name {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--header-text);
  line-height: 1.2;
}

.site-tagline {
  display: block;
  font-size: 0.7rem;
  color: #85B7EB;
  margin-top: 2px;
  letter-spacing: 0.03em;
}

/* --- Nav --- */
.main-nav {
  display: flex;
  gap: 0;
  padding: 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overflow: visible;
}
.main-nav::-webkit-scrollbar { display: none; }

.main-content {
  min-width: 0;    /* verhindert dass Grid-Zelle über den Container wächst */
  overflow: hidden;
}

.nav-link {
  display: block;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  padding: 0.65rem 1rem 0.65rem 0;
  margin-right: 1.25rem;
  white-space: nowrap;
  border-top: 2px solid transparent;
  margin-top: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.nav-link:hover { color: rgba(255,255,255,0.9); }
.nav-link.active { color: var(--accent); border-top-color: var(--accent); }

.nav-link.nav-sub {
  padding-left: 1rem;
  font-size: 0.74rem;
  opacity: 0.8;
}

/* Burger Button */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,0.7);
  border-radius: 2px;
  transition: all 0.2s;
}

@media (max-width: 600px) {
  .nav-toggle { display: flex; }
  .main-nav {
    flex-direction: column;
    border-top: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .main-nav.open { max-height: 300px; }
  .nav-link {
    padding: 0.6rem 0;
    border-top: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin: 0;
  }
  .nav-link.active { color: var(--accent); border-top: none; }
  .site-tagline { display: none; }
}

/* --- Tag Filter Strip --- */
.tag-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 1.5rem;
  align-items: center;
}
.filter-label {
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-right: 2px;
}

/* --- Tags --- */
.tag {
  display: inline-block;
  font-size: 0.68rem;
  padding: 2px 9px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.12s;
  white-space: nowrap;
}
.tag:hover { background: var(--surface); }

.tag-xmpp        { background: var(--tag-xmpp-bg);        color: var(--tag-xmpp-text);        border-color: var(--tag-xmpp-border); }
.tag-elektronik  { background: var(--tag-elektronik-bg);   color: var(--tag-elektronik-text);   border-color: var(--tag-elektronik-border); }
.tag-fhem        { background: var(--tag-fhem-bg);         color: var(--tag-fhem-text);         border-color: var(--tag-fhem-border); }
.tag-asterisk    { background: var(--tag-asterisk-bg);     color: var(--tag-asterisk-text);     border-color: var(--tag-asterisk-border); }
.tag-solar       { background: var(--tag-solar-bg);        color: var(--tag-solar-text);        border-color: var(--tag-solar-border); }
.tag-rasppi      { background: var(--tag-rasppi-bg);       color: var(--tag-rasppi-text);       border-color: var(--tag-rasppi-border); }
.tag-debian      { background: var(--tag-debian-bg);       color: var(--tag-debian-text);       border-color: var(--tag-debian-border); }

/* --- Artikel-Liste --- */
.article-list { }

.post-card {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 1rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
}
.post-card:last-child { border-bottom: none; }

.post-icon {
  width: 80px;
  height: 64px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.post-icon img { width: 100%; height: 100%; object-fit: cover; }

.icon-placeholder {
  font-size: 1.6rem;
  color: var(--text-faint);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.post-cat {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  color: #185FA5;
  text-transform: uppercase;
}

.post-date {
  font-size: 0.68rem;
  color: var(--text-faint);
}

.post-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 4px;
}
.post-title a {
  text-decoration: none;
  color: var(--text);
}
.post-title a:hover { text-decoration: underline; text-underline-offset: 3px; }

.post-summary {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 6px;
}

.post-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

@media (max-width: 480px) {
  .post-card { grid-template-columns: 64px 1fr; }
    .post-icon { width: 64px; height: 52px;
  }
}

/* --- Einzelartikel --- */
.single-article { max-width: 100%; }

.article-header {
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.article-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0.4rem 0 0.6rem;
}

.article-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.breadcrumb {
  font-size: 0.75rem;
  color: var(--text-faint);
  text-decoration: none;
}
.breadcrumb:hover { color: var(--text-muted); }

.article-hero {
  width: 100%;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}

.article-footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.82rem;
}

/* --- Prose (Artikelinhalt) --- */
.prose {
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text);
}
.prose h2 { font-size: 1.2rem; font-weight: 600; margin: 2rem 0 0.5rem; }
.prose h3 { font-size: 1rem;   font-weight: 600; margin: 1.5rem 0 0.4rem; }
.prose h4 { font-size: 0.9rem; font-weight: 600; margin: 1.2rem 0 0.3rem; }
.prose p  { margin-bottom: 1rem; }
.prose ul, .prose ol { margin: 0.75rem 0 1rem 1.4rem; }
.prose li { margin-bottom: 0.3rem; }
.prose a  { color: #185FA5; text-underline-offset: 3px; }
.prose a:hover { color: var(--accent-dark); }
.prose img {
  border-radius: var(--radius);
  margin: 1rem 0;
  border: 1px solid var(--border);
  max-width: 400px;
  width: 100%; 
}
.prose pre {
  background: #1a2535;
  color: #d0d8e8;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  max-width: 100%;       /* nie breiter als der Container */
  white-space: pre;      /* Zeilenumbrüche nur wo im Code angegeben */
  word-break: normal;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 1rem 0;
}
.prose code {
  background: rgba(0,0,0,0.07);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: "JetBrains Mono", "Fira Code", monospace;
}
.prose pre code { background: none; padding: 0; font-size: 1em; }
.prose blockquote:not([class]) {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--text-muted);
  margin: 1rem 0;
}
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.85rem; }
.prose th { background: var(--surface); border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.prose td { border: 1px solid var(--border); padding: 6px 10px; }

/* --- Sections Header --- */
.section-header { margin-bottom: 1.5rem; }
.section-header h1 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.3rem; }
.section-desc { font-size: 0.85rem; color: var(--text-muted); }

.section-intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.5rem;
}

/* --- Sidebar --- */
.sidebar { }

.sb-heading {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.7rem;
}

.sb-block { margin-bottom: 1.75rem; }

.sb-list {
  list-style: none;
  font-size: 0.82rem;
}
.sb-list li {
  border-bottom: 1px solid var(--border);
}
.sb-list li:last-child { border-bottom: none; }
.sb-list a {
  display: block;
  padding: 5px 0;
  color: var(--text-muted);
  text-decoration: none;
}
.sb-list a:hover { color: var(--text); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 5px; }

/* --- Footer --- */
.site-footer {
  background: var(--header-bg);
  padding: 1rem 0;
  margin-top: auto;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.45);
}
.footer-inner a {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
}
.footer-inner a:hover { color: rgba(255,255,255,0.8); }

/* --- Utility --- */
.prose .article-meta, .article-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-faint);
}
.nav-prev, .nav-next {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
}
.nav-prev:hover, .nav-next:hover { color: var(--text); }

.xmpp-chat-wrap {
  padding: 2rem 0;
}
.xmpp-chat-wrap h2 {
  margin-bottom: 1rem;
}
.chat-close {
  margin-top: 1rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.chat-close:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.home-intro img {
  max-width: 200px;   /* nur auf der Startseite kleiner */
  width: 100%;
}

.prose .markdown-alert-note      { border-left: 3px solid #3b82f6; background: #eff6ff; padding: 0.75rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1rem 0; }
.prose .markdown-alert-tip       { border-left: 3px solid #22c55e; background: #f0fdf4; padding: 0.75rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1rem 0; }
.prose .markdown-alert-warning   { border-left: 3px solid #f59e0b; background: #fffbeb; padding: 0.75rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1rem 0; }
.prose .markdown-alert-caution   { border-left: 3px solid #ef4444; background: #fef2f2; padding: 0.75rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1rem 0; }
.prose .markdown-alert-important { border-left: 3px solid #a855f7; background: #faf5ff; padding: 0.75rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1rem 0; }

@media (prefers-color-scheme: dark) {
  .prose .markdown-alert-note      { background: #1e3a5f; }
  .prose .markdown-alert-tip       { background: #14532d; }
  .prose .markdown-alert-warning   { background: #451a03; }
  .prose .markdown-alert-caution   { background: #450a0a; }
  .prose .markdown-alert-important { background: #3b0764; }
}

/* Dropdown Desktop */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--header-bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0 0 var(--radius) var(--radius);
  min-width: 180px;
  z-index: 200;
  padding: 0.4rem 0;
}

.nav-dropdown:hover .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  white-space: nowrap;
}

.nav-dropdown-menu a:hover {
  color: var(--accent);
  background: rgba(255,255,255,0.05);
}

/* Mobile: Dropdown flach darstellen, kein Hover */
@media (max-width: 600px) {
  .main-nav {
    overflow: hidden;  /* auf Mobile wieder verstecken */
  }
  .main-nav.open {
    overflow: visible;
  }
  .nav-dropdown-menu {
    display: block;
    position: static;
    border: none;
    padding: 0;
    background: none;
  }
  .nav-dropdown-menu a {
    padding-left: 1.5rem;
    font-size: 0.74rem;
    opacity: 0.8;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
}
