@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Newsreader:opsz,wght@6..72,600;6..72,700&display=swap');

:root {
  /* Editorial palette (light) — warm, ruhig, hochwertig */
  --color-bg: #FFFCF6;          /* off-white paper */
  --color-surface: #FFFFFF;     /* cards */
  --color-elevated: #FFFFFF;    /* elevated surfaces */
  --color-text: #1E2125;        /* ink */
  --color-muted: #6B7280;       /* muted grey */
  --color-border: #E6E0D6;      /* warm border */
  --color-accent: #3A5A40;      /* sage green */
  --color-accent-2: #D4A373;    /* ochre accent */
  --color-accent-contrast: #0E1A13;
  --color-success: #2F7D4E;
  --color-warning: #B7791F;
  --color-danger: #B5483F;
  --color-info: #7C8A6A;        /* desaturated green */
  --color-pinned-bg: #f6efe5;
  --color-pinned-border: #e4d3b8;
  --color-pinned-text: #7a5a2a;
  --color-chip-bg: color-mix(in srgb, var(--color-accent-2), transparent 94%);
  --color-chip-border: color-mix(in srgb, var(--color-accent-2), var(--color-border) 55%);

  /* Typography */
  --font-sans: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --font-serif: Newsreader, Georgia, "Times New Roman", Times, serif;

  /* Radii & shadows */
  --radius-sm: .5rem;
  --radius-md: .8rem;
  --radius-lg: 1.1rem;
  --shadow-xs: 0 1px 1px rgba(0,0,0,.04);
  --shadow-sm: 0 6px 18px rgba(0,0,0,.06);
  --shadow-md: 0 14px 36px rgba(0,0,0,.08);

  /* Focus */
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--color-accent), transparent 70%);

  /* Bootstrap mapping */
  --bs-body-bg: var(--color-bg);
  --bs-body-color: var(--color-text);
  --bs-border-color: var(--color-border);
  --bs-link-color: var(--color-accent);
  --bs-link-hover-color: color-mix(in srgb, var(--color-accent), #000 10%);
  --bs-card-bg: var(--color-surface);
  --bs-card-color: var(--color-text);
  --bs-heading-color: var(--color-text);
  --bs-secondary-color: color-mix(in srgb, var(--color-muted), #000 0%);
  --bs-primary: var(--color-accent);
  --bs-primary-rgb: 58, 90, 64;
}

:root[data-theme="dark"] {
  --color-bg: #0C1014;
  --color-surface: #10161C;
  --color-elevated: #121A22;
  --color-text: #E9EEF3;
  --color-muted: #A7B0BA;
  --color-border: #1D2630;
  --color-accent: #4C8060;
  --color-accent-2: #C89B6D;
  --color-accent-contrast: #0E1A13;
  --color-success: #3E9A6A;
  --color-warning: #D39C56;
  --color-danger: #D0645B;
  --color-info: #91A187;

  --color-pinned-bg: color-mix(in srgb, var(--color-accent-2), transparent 82%);
  --color-pinned-border: color-mix(in srgb, var(--color-accent-2), #000 55%);
  --color-pinned-text: color-mix(in srgb, var(--color-accent-2), #fff 25%);
  --color-chip-bg: color-mix(in srgb, var(--color-accent-2), transparent 88%);
  --color-chip-border: color-mix(in srgb, var(--color-accent-2), #000 60%);

  --bs-link-hover-color: color-mix(in srgb, var(--color-accent), #fff 10%);
  --bs-primary: var(--color-accent);
  --bs-primary-rgb: 76, 128, 96;
}

/* Global */
html, body { background: var(--color-bg); color: var(--color-text); text-rendering: optimizeLegibility; }
body { font-feature-settings: "liga" 1, "kern" 1; font-family: var(--font-sans); letter-spacing: 0.01em; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-serif); letter-spacing: 0; }
.lead { font-weight: 500; color: color-mix(in srgb, var(--color-text), #000 0%); }

/* Helpers */
.text-muted-80 { color: color-mix(in srgb, var(--color-muted), var(--color-text) 35%); }

/* Skip link */
.skip-link { position: fixed; left: .75rem; top: .5rem; transform: translateY(-150%); background: var(--color-elevated); color: var(--color-text); border: 2px solid var(--color-border); border-radius: .5rem; padding: .5rem .75rem; z-index: 1100; box-shadow: var(--shadow-sm); }
.skip-link:focus { transform: translateY(0); outline: none; box-shadow: var(--focus-ring); }

/* Focus styles */
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: .25rem; }

/* Navbar — quiet, content-first */
.navbar { background: color-mix(in srgb, var(--color-surface), transparent 0%); border-bottom: 1px solid color-mix(in srgb, var(--color-border), transparent 20%); }
.navbar .navbar-brand { font-family: var(--font-serif); font-weight: 700; letter-spacing: .2px; }
.navbar .nav-link { font-weight: 500; color: color-mix(in srgb, var(--color-text), #000 0%); }
.navbar .nav-link.active { color: var(--color-accent); }
.navbar-sticky { position: sticky; top: 0; z-index: 1030; backdrop-filter: saturate(130%) blur(6px); }

/* Masthead (hero) */
.masthead { padding: 2.5rem 0 1rem; border-bottom: 1px solid color-mix(in srgb, var(--color-border), transparent 30%); }
.eyebrow { display: inline-block; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: color-mix(in srgb, var(--color-text), #000 25%); }

.feature { position: relative; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); height: 100%; background: var(--color-surface); border: 1px solid color-mix(in srgb, var(--color-border), transparent 20%); }
.feature .feature-media { width: 100%; height: 100%; object-fit: cover; display: block; }
.feature .feature-body { position: absolute; inset: auto 0 0 0; padding: 1.25rem 1.25rem 1.5rem; background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.55) 75%); color: #fff; }
.feature .feature-body .eyebrow { color: color-mix(in srgb, #fff, #000 0%); opacity: .9; }
.feature .feature-title { font-family: var(--font-serif); font-weight: 700; }
.feature.secondary { min-height: 240px; }

/* Topic chips */
.topic-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid var(--color-chip-border);
  border-radius: 999px;
  padding: .18rem .5rem;
  background: var(--color-chip-bg);
  color: color-mix(in srgb, var(--color-text), #000 0%);
  font-size: .74rem;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: .02em;
  cursor: pointer;
  user-select: none;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.topic-chip i { color: var(--color-accent-2); font-size: .85rem; }
.topic-chip:hover, .topic-chip:focus-visible, .topic-chip.is-active {
  background: color-mix(in srgb, var(--color-accent-2), transparent 80%);
  border-color: color-mix(in srgb, var(--color-accent-2), var(--color-border) 40%);
  color: color-mix(in srgb, var(--color-text), #000 0%);
}
.topic-chip:focus-visible { box-shadow: var(--focus-ring); }
/* Cards - restrained */
.card { background: var(--color-surface); border: 1px solid color-mix(in srgb, var(--color-border), transparent 20%); box-shadow: var(--shadow-xs); border-radius: var(--radius-md); }
.card-hover { transition: transform .18s ease, box-shadow .2s ease, border-color .2s ease; }
/* Pinned highlight */
.card[data-pinned="true"] {
  position: relative;
  background: var(--color-pinned-bg);
  border-color: var(--color-pinned-border);
  box-shadow: 0 12px 28px rgba(0,0,0,.08);
}
:root[data-theme="dark"] .card[data-pinned="true"] {
  box-shadow: 0 12px 28px rgba(0,0,0,.38);
}
.card[data-pinned="true"]::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(140deg, rgba(255,255,255,.38) 0%, rgba(255,255,255,.12) 45%, transparent 80%);
  pointer-events: none;
  opacity: .7;
}
.card[data-pinned="true"] .badge-pinned {
  background: color-mix(in srgb, var(--color-pinned-border), transparent 35%);
  color: var(--color-pinned-text);
  border-color: var(--color-pinned-border);
}
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: color-mix(in srgb, var(--color-accent), var(--color-border) 70%); }
.card .card-img-top { transition: transform .4s ease, filter .4s ease; }
.card-hover:hover .card-img-top { transform: scale(1.02); filter: saturate(102%) contrast(101%); }

/* Badges / tags */
.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: color-mix(in srgb, var(--color-chip-bg), transparent 8%);
  color: color-mix(in srgb, var(--color-accent), #000 0%);
  border: 1px solid color-mix(in srgb, var(--color-chip-border), transparent 10%);
  padding: .15rem .45rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .02em;
  line-height: 1.1;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.tag-badge:hover, .tag-badge:focus-visible {
  background: color-mix(in srgb, var(--color-accent), transparent 82%);
  border-color: color-mix(in srgb, var(--color-accent), var(--color-border) 40%);
  color: color-mix(in srgb, var(--color-accent-contrast), #fff 0%);
}
.tag-badge:focus-visible { box-shadow: var(--focus-ring); }
.tag-badge.is-active {
  background: color-mix(in srgb, var(--color-pinned-bg), transparent 10%);
  border-color: var(--color-pinned-border);
  color: var(--color-pinned-text);
}
/* Newsletter */
.newsletter-cta { position: relative; border-radius: var(--radius-lg); padding: 2rem; overflow: hidden; border: 1px solid color-mix(in srgb, var(--color-border), transparent 10%); background: linear-gradient(180deg, color-mix(in srgb, var(--color-surface), transparent 0%), color-mix(in srgb, var(--color-accent), transparent 94%)); box-shadow: var(--shadow-sm); }
.newsletter-cta .form-control { background: color-mix(in srgb, var(--color-elevated), transparent 8%); border: 1px solid color-mix(in srgb, var(--color-border), var(--color-text) 10%); }
.newsletter-cta .form-control:focus { box-shadow: var(--focus-ring); border-color: color-mix(in srgb, var(--color-accent), var(--color-border) 50%); }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(10px); }
.reveal.reveal-in { opacity: 1; transform: none; transition: opacity .5s ease, transform .5s ease; }

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Footer */
footer.bg-body-tertiary-subtle { background: color-mix(in srgb, var(--color-bg), #000 2%); }

/* Clickable tag badges */
/* Ensure tag badges stay clickable above stretched-link overlays */
.card .tag-badge, .card [data-filter] { position: relative; z-index: 3; }

/* Reading progress bar */
.reading-progress { position: fixed; top: 0; left: 0; height: 4px; width: 0; background: linear-gradient(90deg, var(--color-accent), color-mix(in srgb, var(--color-accent-2), #fff 0%)); z-index: 1100; box-shadow: 0 1px 0 rgba(0,0,0,.05); }

/* Sticky aside spacing (below sticky navbar) */
.sticky-top-custom { position: sticky; top: 5.25rem; z-index: 2; }

/* Post content typography */
.post-content { font-size: 1.05rem; line-height: 1.75; }
.post-content p { margin-bottom: 1rem; hyphens: auto; }
.post-content h2, .post-content h3, .post-content h4 { scroll-margin-top: 5.5rem; margin-top: 2rem; }
.post-content .lead { font-size: 1.15rem; color: color-mix(in srgb, var(--color-text), #000 0%); }
.post-content img { max-width: 100%; height: auto; }
.post-content figure img { width: 100%; height: auto; }

/* Lightbox */
.lightbox-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: none; z-index: 1200; align-items: center; justify-content: center; }
.lightbox-overlay.is-open { display: flex; }
.lightbox-img { max-width: 92vw; max-height: 92vh; box-shadow: var(--shadow-md); border-radius: var(--radius-md); }
.lightbox-prev, .lightbox-next, .lightbox-close { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); width: 42px; height: 42px; border-radius: 999px; display: grid; place-items: center; backdrop-filter: blur(4px); cursor: pointer; }
.lightbox-close { top: 2rem; right: 2rem; font-size: 1.4rem; line-height: 1; }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-prev, .lightbox-next { font-size: 1.8rem; top: 50%; transform: translateY(-50%); }

/* Callout */
.callout { border: 1px solid color-mix(in srgb, var(--color-info), var(--color-border) 65%); background: color-mix(in srgb, var(--color-info), transparent 94%); border-radius: var(--radius-md); padding: .9rem 1rem; }
.callout-title { font-weight: 600; margin-bottom: .35rem; color: color-mix(in srgb, var(--color-text), #000 0%); }

/* Buy box */
.buy-box .card-header { background: color-mix(in srgb, var(--color-accent), transparent 94%); border-bottom-color: color-mix(in srgb, var(--color-accent), var(--color-border) 60%); }
.buy-box .product-item { padding: .25rem 0; }
.rounded-clip { border-radius: var(--radius-md); }

/* TOC */
#toc { font-size: .95rem; }
.toc-list { list-style: none; padding-left: 0; margin: 0; display: grid; gap: .35rem; }
.toc-list a { text-decoration: none; color: var(--bs-link-color); }
.toc-list a:hover { text-decoration: underline; }
.toc-level-2 { margin-left: 0; }
.toc-level-3 { margin-left: .75rem; font-size: .95em; }
.toc-level-4 { margin-left: 1.25rem; font-size: .9em; }
.toc-active > a { color: var(--color-accent-2); text-decoration: underline; }

/* Utilities extracted from inline styles */
.max-w-240 { max-width: 240px; }
.border-bottom-soft { border-color: color-mix(in srgb, var(--color-border), transparent 40%) !important; }

/* Business CTA banner */
.business-cta { border: 1px solid color-mix(in srgb, var(--color-accent), var(--color-border) 55%); background: linear-gradient(90deg, color-mix(in srgb, var(--color-accent), transparent 94%), color-mix(in srgb, var(--color-accent-2), transparent 96%)); border-left: 4px solid var(--color-accent); border-radius: var(--radius-md); padding: 1rem; box-shadow: var(--shadow-xs); }
.business-cta .inner { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; }
.business-cta .icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px; background: color-mix(in srgb, var(--color-accent), #fff 20%); color: var(--color-accent-contrast); box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.business-cta .icon i { font-size: 1.1rem; }
.business-cta .kicker { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .55rem; border-radius: 999px; background: color-mix(in srgb, var(--color-accent), #fff 85%); color: var(--color-accent-contrast); font-weight: 700; font-size: .72rem; letter-spacing: .03em; text-transform: uppercase; }
.business-cta h2 { font-size: 1.05rem; margin: 0; font-weight: 800; }
.business-cta p { margin: 0; color: var(--bs-secondary-color); }
.business-cta .actions { margin-left: auto; display: inline-flex; gap: .5rem; }
.business-cta .btn { white-space: nowrap; }
.business-cta:hover { border-color: color-mix(in srgb, var(--color-accent), var(--color-border) 40%); }

/* Optional: hide banner via attribute */
html[data-biz-banner="false"] .business-cta { display: none; }

/* --- Blog cards: consistent sizes --- */
.post-card-media { aspect-ratio: 16 / 9; background: color-mix(in srgb, var(--color-surface), #000 6%); display: grid; place-items: center; overflow: hidden; }
.post-card-media.square { aspect-ratio: 1 / 1; }
.card .post-card-media { border-top-left-radius: var(--radius-md); border-top-right-radius: var(--radius-md); }
.post-card-media img.post-card-img { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; display: block; background: transparent; }
.post-card-media img.post-card-img-square { width: 100%; height: 100%; object-fit: fill; display: block; }
.card.card-hover { display: flex; flex-direction: column; }
.card.card-hover .card-body { display: flex; flex-direction: column; flex: 1 1 auto; }
.card.card-hover .card-body .d-flex.flex-wrap { margin-top: auto; }

/* --- Tag chips slider --- */
.chips-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: .2rem;
  flex-wrap: nowrap;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  cursor: grab;
}
.chips-toolbar .chips-scroll { min-width: 0; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chips-scroll::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--color-border), #000 6%); border-radius: 4px; }
.chips-scroll:active { cursor: grabbing; }
