/* ============================================================
   Catppuccin Latte (light) + Frappe (dark)
   ============================================================ */

:root,
[data-theme="light"] {
  --bg:          #eff1f5;
  --surface0:    #ccd0da;
  --surface1:    #bcc0cc;
  --surface2:    #acb0be;
  --overlay0:    #9ca0b0;
  --text:        #4c4f69;
  --subtext0:    #6c6f85;
  --subtext1:    #5c5f77;
  --blue:        #1e66f5;
  --lavender:    #7287fd;
  --sapphire:    #209fb5;
  --teal:        #179299;
  --green:       #40a02b;
  --yellow:      #df8e1d;
  --red:         #d20f39;
  --mauve:       #8839ef;
  --peach:       #fe640b;
  --mantle:      #e6e9ef;
  --crust:       #dce0e8;
  --sidebar-bg:  #e6e9ef;
  --border:      #ccd0da;
  --link:        #1e66f5;
  --link-hover:  #7287fd;
  --tag-bg:      #ccd0da;
  --tag-text:    #4c4f69;
  --code-bg:     #dce0e8;
  --shadow:      rgba(76, 79, 105, 0.08);
}

[data-theme="dark"] {
  --bg:          #303446;
  --surface0:    #414559;
  --surface1:    #51576d;
  --surface2:    #626880;
  --overlay0:    #737994;
  --text:        #c6d0f5;
  --subtext0:    #a5adce;
  --subtext1:    #b5bfe2;
  --blue:        #8caaee;
  --lavender:    #babbf1;
  --sapphire:    #85c1dc;
  --teal:        #81c8be;
  --green:       #a6d189;
  --yellow:      #e5c890;
  --red:         #e78284;
  --mauve:       #ca9ee6;
  --peach:       #ef9f76;
  --mantle:      #292c3c;
  --crust:       #232634;
  --sidebar-bg:  #292c3c;
  --border:      #414559;
  --link:        #8caaee;
  --link-hover:  #babbf1;
  --tag-bg:      #414559;
  --tag-text:    #c6d0f5;
  --code-bg:     #232634;
  --shadow:      rgba(0, 0, 0, 0.25);
}

/* ============================================================
   Reset & base
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.7;
  transition: background 0.2s, color 0.2s;
}

a {
  color: var(--link);
  text-decoration: none;
}
a:hover { color: var(--link-hover); text-decoration: underline; }

/* ============================================================
   Layout: drie kolommen
   ============================================================ */

.layout {
  display: grid;
  grid-template-columns: 260px 1fr 220px;
  grid-template-rows: 1fr;
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
}

/* ============================================================
   Linker sidebar
   ============================================================ */

.sidebar-left {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0;
}
.site-title:hover { color: var(--blue); text-decoration: none; }
.site-title i { color: var(--mauve); }

/* Search in sidebar */
.search-form .search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
}
.search-form .search-input-wrap i { color: var(--subtext0); font-size: 0.85rem; }
.search-form input {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  width: 100%;
  outline: none;
}
.search-form input::placeholder { color: var(--subtext0); }

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  color: var(--subtext0);
  font-size: 0.8rem;
  transition: background 0.2s;
  width: fit-content;
}
.theme-toggle:hover { background: var(--surface0); color: var(--text); }
.theme-toggle i { font-size: 0.8rem; }
#icon-light { color: var(--yellow); }
#icon-dark  { color: var(--lavender); }

/* Explorer nav */
.explorer {
  flex: 1;
  overflow-y: auto;
}

.explorer ul { list-style: none; padding-left: 0; }
.nav-folder-contents { padding-left: 0.6rem; margin-left: 0.85rem; border-left: 1px solid var(--border); margin-top: 0.1rem; }

.nav-folder > summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--subtext1);
  list-style: none;
  user-select: none;
}
.nav-folder > summary::-webkit-details-marker { display: none; }
.nav-folder > summary:hover { background: var(--surface0); color: var(--text); }

/* folder icon toggle */
.nav-folder > summary .fa-folder-open { display: none; }
.nav-folder[open] > summary .fa-folder { display: none; }
.nav-folder[open] > summary .fa-folder-open { display: inline; }

.explorer li a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--subtext1);
  text-decoration: none;
  transition: background 0.15s;
}
.explorer li a:hover { background: var(--surface0); color: var(--text); }
.explorer li a i { font-size: 0.8rem; color: var(--subtext0); }
.explorer li a.nav-active { font-weight: 700; color: var(--text); background: var(--surface0); }
.explorer li a.nav-active i { color: var(--blue); }

/* ============================================================
   Main content
   ============================================================ */

.main-content {
  padding: 2rem 2.5rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.page-content {
  flex: 1;
  max-width: 750px;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--subtext0);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.breadcrumbs a { color: var(--subtext0); }
.breadcrumbs a:hover { color: var(--link); }
.breadcrumbs .sep { font-size: 0.7rem; color: var(--surface2); }
.breadcrumbs .current { color: var(--text); }

/* Article */
.article-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--subtext0);
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.article-meta i { margin-right: 0.25rem; }

/* Prose */
.prose { line-height: 1.75; }
.prose h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
  color: var(--text);
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}
.prose h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  color: var(--text);
}
.prose h4 { font-size: 1rem; font-weight: 600; margin: 1.25rem 0 0.4rem; }
.prose p { margin-bottom: 1rem; }
.prose ul, .prose ol { margin: 0.5rem 0 1rem 1.5rem; }
.prose li { margin-bottom: 0.25rem; }
.prose strong { color: var(--text); font-weight: 600; }
.prose em { font-style: italic; }

.prose a { color: var(--link); }
.prose a:hover { color: var(--link-hover); }

.prose blockquote {
  border-left: 3px solid var(--lavender);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  background: var(--mantle);
  border-radius: 0 6px 6px 0;
  color: var(--subtext1);
  font-style: italic;
}

.prose code {
  background: var(--code-bg);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-family: "Fira Code", "IBM Plex Mono", monospace;
  font-size: 0.875em;
}
.prose pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1rem 0;
}
.prose pre code {
  background: transparent;
  padding: 0;
  font-size: 0.875rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}
.prose th {
  background: var(--mantle);
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 600;
  border: 1px solid var(--border);
}
.prose td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
}
.prose tr:nth-child(even) td { background: var(--mantle); }

/* Recent posts section */
.recent-posts {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.recent-posts h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--subtext1);
}
.recent-posts h2 i { color: var(--teal); margin-right: 0.3rem; }

.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.post-list li {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.post-list li a {
  font-size: 0.95rem;
  color: var(--link);
}
.post-list li a:hover { color: var(--link-hover); }
.post-date {
  font-size: 0.8rem;
  color: var(--subtext0);
  white-space: nowrap;
}

.post-list-full li {
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.post-list-full li:last-child { border-bottom: none; }

/* Tags */
.tag-list { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 999px;
  padding: 0.15em 0.65em;
  font-size: 0.78rem;
  text-decoration: none;
  transition: background 0.15s;
}
.tag:hover { background: var(--surface1); text-decoration: none; }
.tag-active { background: var(--blue); color: #fff; }

.tag-large {
  font-size: 0.95rem;
  padding: 0.3em 0.9em;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.tag-count-badge {
  background: var(--surface0);
  border-radius: 999px;
  padding: 0.05em 0.5em;
  font-size: 0.75rem;
}

.tags-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.tag-count {
  color: var(--subtext0);
  font-size: 0.9rem;
  margin-top: 0.25rem;
  margin-bottom: 1.25rem;
}

/* Search page */
.search-form-full {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: center;
}
.search-form-full .search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--mantle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  flex: 1;
}
.search-form-full input {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  width: 100%;
  outline: none;
}
.search-form-full button {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: opacity 0.15s;
}
.search-form-full button:hover { opacity: 0.85; }

.search-count { font-size: 0.9rem; color: var(--subtext0); margin-bottom: 1rem; }
.search-snippet {
  font-size: 0.85rem;
  color: var(--subtext0);
  margin: 0;
}

.empty { color: var(--subtext0); font-style: italic; }
.all-tags-link { font-size: 0.85rem; color: var(--link); }

/* ============================================================
   Rechter sidebar
   ============================================================ */

.sidebar-right {
  border-left: 1px solid var(--border);
  padding: 2rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--subtext0);
  margin-bottom: 0.75rem;
}
.sidebar-section h3 i { margin-right: 0.3rem; }

/* Table of contents */
.toc { font-size: 0.875rem; }
.toc ul { list-style: none; padding-left: 0; }
.toc ul ul { padding-left: 1rem; }
.toc li { margin: 0.2rem 0; }
.toc a {
  color: var(--subtext0);
  text-decoration: none;
  display: block;
  padding: 0.1rem 0;
  border-radius: 4px;
  transition: color 0.15s;
}
.toc a:hover { color: var(--link); }

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
  margin-top: auto;
  padding-top: 2rem;
  font-size: 0.8rem;
  color: var(--subtext0);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}
.site-footer a { color: var(--subtext0); }
.site-footer a:hover { color: var(--link); }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1100px) {
  .layout { grid-template-columns: 240px 1fr; }
  .sidebar-right { display: none; }
}

@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar-left {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .main-content { padding: 1.25rem; }
  .article-title { font-size: 1.5rem; }
}
