/* Alberich Blog — dark default, light alternate, Alberich slate/amber */

:root {
  color-scheme: dark;
  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-850: #131c2e;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --red-400: #f87171;

  --bg: #0b1220;
  --bg-elevated: #111827;
  --bg-card: linear-gradient(165deg, #1a2436 0%, #0b1220 100%);
  --bg-header: rgba(15, 23, 42, 0.92);
  --border: #334155;
  --border-subtle: rgba(148, 163, 184, 0.16);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --accent: #fbbf24;
  --accent-soft: rgba(251, 191, 36, 0.14);
  --accent-hover: #fcd34d;
  --link: #4ade80;
  --link-hover: #86efac;
  --focus: rgba(251, 191, 36, 0.45);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --prose-width: 42rem;
  --content-width: 72rem;
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --leading: 1.7;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f9;
  --bg-elevated: #ffffff;
  --bg-card: linear-gradient(165deg, #ffffff 0%, #f1f5f9 100%);
  --bg-header: rgba(255, 255, 255, 0.94);
  --border: #d1d9e6;
  --border-subtle: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --text-muted: #475569;
  --text-faint: #64748b;
  --accent: #b45309;
  --accent-soft: rgba(217, 119, 6, 0.12);
  --accent-hover: #92400e;
  --link: #047857;
  --link-hover: #065f46;
  --focus: rgba(180, 83, 9, 0.35);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(251, 191, 36, 0.07), transparent 55%),
    linear-gradient(180deg, #1e2937 0%, var(--slate-950) 55%);
}

html[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 70% 40% at 50% -10%, rgba(251, 191, 36, 0.12), transparent 50%),
    linear-gradient(180deg, #eef2f7 0%, #f6f7f9 45%);
}

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

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

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

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* —— Header —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.site-header__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand:hover {
  color: inherit;
}

.brand__mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border-subtle);
}

.brand__text h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand__text p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-primary {
  display: none;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-primary a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}

.nav-primary a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-primary a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.icon-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.icon-btn svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn .icon-sun { display: none; }
.icon-btn .icon-moon { display: block; }

html[data-theme="light"] .icon-btn .icon-sun { display: block; }
html[data-theme="light"] .icon-btn .icon-moon { display: none; }

.nav-toggle {
  display: inline-flex;
}

@media (min-width: 900px) {
  .nav-primary {
    display: flex;
    flex: 1;
    justify-content: center;
  }

  .nav-toggle {
    display: none;
  }
}

/* Mobile nav drawer */
.nav-drawer {
  display: none;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  padding: 0.5rem 1.25rem 1rem;
}

.nav-drawer.is-open {
  display: block;
}

.nav-drawer a {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 0.7rem 0.5rem;
  border-radius: 8px;
  font-weight: 500;
}

.nav-drawer a:hover,
.nav-drawer a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

@media (min-width: 900px) {
  .nav-drawer {
    display: none !important;
  }
}

/* —— Layout —— */
.site-main {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.page-hero {
  margin-bottom: 1.75rem;
  max-width: 40rem;
}

.page-hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

/* —— Toolbar: search + filters —— */
.blog-toolbar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.search-field {
  position: relative;
  max-width: 28rem;
}

.search-field input {
  width: 100%;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  padding: 0.7rem 1rem 0.7rem 2.5rem;
  border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-field input::placeholder {
  color: var(--text-faint);
}

.search-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus);
}

.search-field__icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
  width: 1.1rem;
  height: 1.1rem;
}

.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cat-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 550;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.cat-chip:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.cat-chip.is-active,
.cat-chip[aria-current="true"] {
  color: var(--accent);
  border-color: transparent;
  background: var(--accent-soft);
}

/* —— Post grid —— */
.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Ensure filter hide works inside CSS Grid (UA [hidden] can be overridden) */
.post-grid > [hidden] {
  display: none !important;
}

@media (min-width: 640px) {
  .post-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1000px) {
  .post-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.post-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.3rem 1.35rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.15s;
}

a.post-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  color: inherit;
}

.post-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  margin-bottom: 0.65rem;
  font-size: 0.78rem;
  color: var(--text-faint);
}

.post-card__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.post-card__cat {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.post-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.post-card__excerpt {
  margin: 0;
  flex: 1;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.post-card__more {
  margin-top: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

/* —— Article page —— */
.article-layout {
  display: grid;
  gap: 2rem;
}

@media (min-width: 960px) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr) 15rem;
    align-items: start;
  }
}

.article-header {
  margin-bottom: 1.75rem;
  max-width: var(--prose-width);
}

.article-header h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.article-header__lead {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--text-faint);
}

.article-meta time,
.post-card__meta time {
  font-variant-numeric: tabular-nums;
}

.date-updated {
  color: var(--accent);
  font-weight: 600;
}

/* Prose */
.prose {
  max-width: var(--prose-width);
  font-size: 1.05rem;
  line-height: var(--leading);
  color: var(--text);
}

.prose > *:first-child {
  margin-top: 0;
}

.prose h2 {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.prose h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 650;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.prose p {
  margin: 0 0 1.1rem;
}

.prose ul,
.prose ol {
  margin: 0 0 1.1rem;
  padding-left: 1.35rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.prose li::marker {
  color: var(--text-faint);
}

.prose blockquote {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.12em 0.4em;
  border-radius: 5px;
}

.prose pre {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.5;
}

.prose pre code {
  background: none;
  color: var(--text);
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 2rem 0;
}

.prose figure {
  margin: 0 0 1.5rem;
}

.prose figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-faint);
  text-align: center;
}

.prose img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.prose .video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0 0 1.5rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.prose .video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}

.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.prose th {
  background: var(--bg-elevated);
  font-weight: 650;
}

.callout {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.callout--tip {
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.08);
}

html[data-theme="light"] .callout--tip {
  background: rgba(4, 120, 87, 0.06);
}

.callout--warn {
  border-color: rgba(251, 191, 36, 0.4);
  background: var(--accent-soft);
}

.callout strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--accent);
}

/* Article sidebar */
.article-aside {
  font-size: 0.875rem;
}

.aside-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.aside-card h2 {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.aside-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.aside-card li {
  margin-bottom: 0.4rem;
}

.aside-card a {
  text-decoration: none;
  color: var(--text-muted);
}

.aside-card a:hover {
  color: var(--accent);
}

.toc a {
  display: block;
  padding: 0.2rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.6rem;
  margin-left: -0.1rem;
}

.toc a:hover {
  border-left-color: var(--accent);
}

@media (max-width: 959px) {
  .article-aside .toc-card {
    display: none;
  }
}

/* Related */
.related {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  max-width: var(--prose-width);
}

.related h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

/* —— Footer —— */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
  padding: 2rem 1.25rem 2.5rem;
  background: var(--bg-elevated);
}

.site-footer__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 720px) {
  .site-footer__inner {
    grid-template-columns: 1.4fr 1fr 1fr;
  }
}

.site-footer h2 {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.site-footer p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer li {
  margin-bottom: 0.4rem;
}

.site-footer a {
  color: var(--link);
  text-decoration: none;
  font-weight: 550;
  font-size: 0.9rem;
}

.site-footer a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.site-footer__copy {
  max-width: var(--content-width);
  margin: 1.5rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-faint);
  text-align: center;
}

.community-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.community-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted) !important;
  text-decoration: none !important;
  font-size: 0.85rem;
}

.community-links a:hover {
  border-color: var(--accent);
  color: var(--accent) !important;
  background: var(--accent-soft);
}

/* Legal / Impressum */
.legal-page {
  max-width: var(--prose-width);
}

.legal-prose .legal-address {
  line-height: 1.65;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-faint);
  margin-bottom: 1rem;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb span[aria-hidden] {
  opacity: 0.5;
}

/* Category landing */
.category-list .post-card {
  box-shadow: none;
}

/* Print */
@media print {
  .site-header,
  .site-footer,
  .article-aside,
  .nav-drawer,
  .header-tools {
    display: none !important;
  }

  body::before {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  .prose {
    max-width: none;
  }
}
)
