/* ============================================================
   ZEITRECHNER — Vanilla CSS
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* ---------- Design Tokens ---------- */
:root {
  --color-bg: hsl(40, 33%, 96%);
  --color-surface: hsl(40, 29%, 97%);
  --color-surface-2: hsl(40, 20%, 98%);
  --color-surface-offset: hsl(30, 22%, 94%);
  --color-border: hsl(36, 10%, 81%);
  --color-divider: hsl(30, 8%, 85%);
  --color-text: hsl(40, 24%, 14%);
  --color-text-muted: hsl(40, 2%, 47%);
  --color-text-faint: hsl(40, 2%, 72%);
  --color-primary: hsl(183, 97%, 22%);
  --color-primary-hover: hsl(185, 70%, 19%);
  --color-primary-light: hsl(160, 16%, 83%);
  --color-primary-foreground: #ffffff;
  --color-destructive: hsl(0, 84%, 60%);
  --color-shadow: hsl(0, 0%, 20%, 0.08);

  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Plus Jakarta Sans', 'Helvetica Neue', sans-serif;

  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
}

[data-theme="dark"] {
  --color-bg: hsl(30, 7%, 8%);
  --color-surface: hsl(30, 7%, 10%);
  --color-surface-2: hsl(30, 5%, 12%);
  --color-surface-offset: hsl(30, 5%, 10%);
  --color-border: hsl(30, 2%, 22%);
  --color-divider: hsl(30, 3%, 15%);
  --color-text: hsl(30, 2%, 80%);
  --color-text-muted: hsl(30, 1%, 47%);
  --color-text-faint: hsl(30, 1%, 35%);
  --color-primary: hsl(190, 35%, 47%);
  --color-primary-hover: hsl(190, 60%, 34%);
  --color-primary-light: hsl(180, 10%, 23%);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; border: 0 solid var(--color-border); }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  background-color: var(--color-bg);
  color: var(--color-text);
  /* Sticky-footer: body fills the full viewport height as a flex column */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* Main content grows to push the footer to the bottom */
main { flex: 1 1 auto; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

/* ---------- Fluid type utilities ---------- */
.text-xs  { font-size: var(--text-xs); }
.text-sm  { font-size: var(--text-sm); }
.text-base{ font-size: var(--text-base); }
.text-lg  { font-size: var(--text-lg); }
.text-xl  { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }

/* ---------- Layout utilities ---------- */
.container { width: 100%; max-width: 960px; margin-inline: auto; padding-inline: 1rem; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none !important; }
.block { display: block; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }
.gap-1  { gap: 0.25rem; }
.gap-2  { gap: 0.5rem; }
.gap-3  { gap: 0.75rem; }
.gap-4  { gap: 1rem; }
.gap-6  { gap: 1.5rem; }
.gap-8  { gap: 2rem; }
.gap-10 { gap: 2.5rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-8 > * + * { margin-top: 2rem; }
.space-x-1 > * + * { margin-left: 0.25rem; }
.w-full { width: 100%; }
.w-fit { width: fit-content; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }
.w-5  { width: 1.25rem; }
.h-5  { height: 1.25rem; }
.w-4  { width: 1rem; }
.h-4  { height: 1rem; }
.min-h-screen { min-height: 100vh; }
.max-w-prose { max-width: 72ch; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; }
.inset-0  { inset: 0; }
.top-0    { top: 0; }
.top-full { top: 100%; }
.top-20   { top: 5rem; }
.bottom-6 { bottom: 1.5rem; }
.bottom-20{ bottom: 5rem; }
.right-6  { right: 1.5rem; }
.left-0   { left: 0; }
.left-4   { left: 1rem; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
.min-w-0 { min-width: 0; }

/* ---------- Spacing utilities ---------- */
.p-1   { padding: 0.25rem; }
.p-2   { padding: 0.5rem; }
.p-3   { padding: 0.75rem; }
.p-4   { padding: 1rem; }
.p-5   { padding: 1.25rem; }
.px-2  { padding-inline: 0.5rem; }
.px-3  { padding-inline: 0.75rem; }
.px-4  { padding-inline: 1rem; }
.px-5  { padding-inline: 1.25rem; }
.py-1  { padding-block: 0.25rem; }
.py-2  { padding-block: 0.5rem; }
.py-3  { padding-block: 0.75rem; }
.py-4  { padding-block: 1rem; }
.py-8  { padding-block: 2rem; }
.py-12 { padding-block: 3rem; }
.pb-4  { padding-bottom: 1rem; }
.pb-0  { padding-bottom: 0; }
.pt-2  { padding-top: 0.5rem; }
.pt-6  { padding-top: 1.5rem; }
.mb-1  { margin-bottom: 0.25rem; }
.mb-2  { margin-bottom: 0.5rem; }
.mb-3  { margin-bottom: 0.75rem; }
.mb-4  { margin-bottom: 1rem; }
.mb-6  { margin-bottom: 1.5rem; }
.mb-8  { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mb-12 { margin-bottom: 3rem; }
.mt-3  { margin-top: 0.75rem; }
.mt-4  { margin-top: 1rem; }
.mt-6  { margin-top: 1.5rem; }
.mt-8  { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-16 { margin-top: 4rem; }
.ml-2  { margin-left: 0.5rem; }
.mx-auto { margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- Typography utilities ---------- */
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.font-normal   { font-weight: 400; }
.font-mono     { font-family: ui-monospace, monospace; }
.font-display  { font-family: var(--font-display); }
.font-body     { font-family: var(--font-body); }
.text-left     { text-align: left; }
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.tracking-tight  { letter-spacing: -0.025em; }
.tracking-wider  { letter-spacing: 0.05em; }
.uppercase       { text-transform: uppercase; }
.leading-snug    { line-height: 1.375; }
.leading-relaxed { line-height: 1.625; }
.underline       { text-decoration: underline; }
.whitespace-nowrap{ white-space: nowrap; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Color utilities ---------- */
.text-primary          { color: var(--color-primary); }
.text-muted            { color: var(--color-text-muted); }
.text-faint            { color: var(--color-text-faint); }
.text-destructive      { color: var(--color-destructive); }
.text-primary-fg       { color: var(--color-primary-foreground); }
.bg-bg                 { background-color: var(--color-bg); }
.bg-surface            { background-color: var(--color-surface); }
.bg-surface-2          { background-color: var(--color-surface-2); }
.bg-surface-offset     { background-color: var(--color-surface-offset); }
.bg-card               { background-color: var(--color-surface); }
.bg-primary            { background-color: var(--color-primary); }
.bg-primary-light      { background-color: var(--color-primary-light); }
.bg-muted              { background-color: var(--color-surface-offset); }
.border-border         { border-color: var(--color-border); }
.border-divider        { border-color: var(--color-divider); }

/* ---------- Border radius utilities ---------- */
.rounded    { border-radius: 0.25rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }

/* ---------- Border utilities ---------- */
.border   { border-width: 1px; border-style: solid; }
.border-t { border-top-width: 1px; border-top-style: solid; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; }
.border-l { border-left-width: 1px; border-left-style: solid; }
.border-b-2{ border-bottom-width: 2px; border-bottom-style: solid; }

/* ---------- Shadow ---------- */
.shadow-lg { box-shadow: 0 10px 30px var(--color-shadow); }

/* ---------- Opacity ---------- */
.opacity-0   { opacity: 0; }
.opacity-100 { opacity: 1; }
.pointer-events-none { pointer-events: none; }

/* ---------- Transition ---------- */
.transition-all    { transition: all 200ms ease; }
.transition-colors { transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease; }
.transition-opacity{ transition: opacity 300ms ease; }
.transition-transform { transition: transform 200ms ease; }
.duration-200 { transition-duration: 200ms; }
.duration-300 { transition-duration: 300ms; }

/* ---------- Transform utilities ---------- */
.rotate-180 { transform: rotate(180deg); }
.translate-y-0 { transform: translateY(0); }

/* ---------- Input styles ---------- */
.input {
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid var(--color-border);
  background-color: var(--color-bg);
  padding: 0.625rem 0.75rem;
  font-size: var(--text-sm);
  color: var(--color-text);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 20%, transparent); }

/* ---------- Button styles ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
  border: 1px solid transparent;
}
.btn-primary { background-color: var(--color-primary); color: var(--color-primary-foreground); }
.btn-primary:hover { background-color: var(--color-primary-hover); }
.btn-outline { background-color: var(--color-surface); border-color: var(--color-border); color: var(--color-text); }
.btn-outline:hover { background-color: var(--color-primary-light); }
.btn-ghost  { background-color: transparent; color: var(--color-text); }
.btn-ghost:hover { background-color: var(--color-primary-light); }

/* ---------- Card styles ---------- */
.card {
  border-radius: 0.75rem;
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  padding: 1.25rem;
}
.card-hover { transition: transform 180ms ease, box-shadow 180ms ease; }
.card-hover:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--color-shadow); }

/* ---------- Result stat box ---------- */
.stat-box {
  background-color: var(--color-surface-2);
  border-radius: 0.5rem;
  padding: 0.75rem;
  text-align: center;
}
.stat-box .stat-label { font-size: var(--text-xs); color: var(--color-text-muted); }
.stat-box .stat-value { font-weight: 600; font-size: var(--text-sm); margin-top: 0.125rem; }

/* ---------- Result panel ---------- */
.result-panel {
  border-radius: 0.75rem;
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  padding: 1.25rem;
}

/* ---------- Grid system (limited) ---------- */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (min-width: 640px) {
  .sm\:grid-cols-2  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:grid-cols-3  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm\:grid-cols-4  { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sm\:flex-row     { flex-direction: row; }
  .sm\:p-6          { padding: 1.5rem; }
  .sm\:w-auto       { width: auto; }
  .sm\:inline       { display: inline; }
  .sm\:hidden       { display: none !important; }
}
@media (min-width: 768px) {
  .md\:flex         { display: flex; }
  .md\:hidden       { display: none !important; }
  .md\:grid-cols-3  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .lg\:block        { display: block; }
  .lg\:hidden       { display: none !important; }
  .lg\:grid-cols-3  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-article { grid-template-columns: 1fr 200px; }
}

/* ---------- Scrollbar hide ---------- */
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }

/* ---------- Prose / Article styles ---------- */
.prose-article { line-height: 1.75; }
.prose-article p + p { margin-top: 1.25em; }
.prose-article h2 { margin-top: 2em; margin-bottom: 0.75em; }
.prose-article h3 { margin-top: 1.5em; margin-bottom: 0.5em; }
.prose-article ul, .prose-article ol { margin-top: 0.75em; margin-bottom: 0.75em; padding-left: 1.5em; }
.prose-article li { margin-top: 0.25em; }
.prose-article ul li { list-style-type: disc; }
.prose-article ol li { list-style-type: decimal; }
.prose-article a { color: var(--color-primary); text-decoration: underline; text-underline-offset: 2px; }
.prose-article a:hover { color: var(--color-primary-hover); }
.prose-article blockquote { border-left: 3px solid var(--color-primary); padding-left: 1em; margin: 1em 0; color: var(--color-text-muted); }
.prose-article table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.prose-article th, .prose-article td { border: 1px solid var(--color-border); padding: 0.5em 0.75em; text-align: left; }
.prose-article th { background: var(--color-surface-offset); font-weight: 600; }

/* ---------- Table (global) ---------- */
.table-auto { width: 100%; border-collapse: collapse; }
.table-auto th, .table-auto td { padding: 0.5em 0.75em; text-align: left; border-bottom: 1px solid var(--color-border); }
.table-auto th { background: var(--color-surface-offset); font-weight: 600; }
.table-auto tr:last-child td { border-bottom: none; }

/* ---------- Animations ---------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-in-up { animation: fadeInUp 200ms ease forwards; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.animate-fade-in { animation: fadeIn 150ms ease forwards; }

/* ---------- Focus styles ---------- */
*:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  background: var(--color-primary);
  color: var(--color-primary-foreground);
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  font-size: var(--text-sm);
}
.skip-link:focus { top: 1rem; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Content visibility ---------- */
.content-auto { content-visibility: auto; contain-intrinsic-size: auto 500px; }

/* ============================================================
   COMPONENT STYLES
   ============================================================ */

/* --- Header --- */
#site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background-color: color-mix(in srgb, var(--color-bg) 70%, transparent);
  transition: border-bottom 200ms ease, background-color 200ms ease;
}
#site-header.scrolled {
  border-bottom: 1px solid var(--color-border);
  background-color: color-mix(in srgb, var(--color-bg) 90%, transparent);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 400;
  letter-spacing: -0.025em;
}
.logo svg { color: var(--color-primary); }
.logo:hover { color: var(--color-primary); }

/* Desktop nav */
.desktop-nav { display: none; }
@media (min-width: 768px) { .desktop-nav { display: flex; align-items: center; gap: 0.25rem; } }
.nav-link {
  padding: 0.5rem 0.75rem;
  font-size: var(--text-sm);
  color: var(--color-text);
  border-radius: 0.375rem;
  transition: color 150ms ease;
}
.nav-link:hover { color: var(--color-primary); }
.nav-link.active { color: var(--color-primary); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  font-size: var(--text-sm);
  color: var(--color-text);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 0.375rem;
  transition: color 150ms ease;
}
.dropdown-toggle:hover { color: var(--color-primary); }
.dropdown-toggle .chevron { width: 1rem; height: 1rem; transition: transform 200ms ease; }
.dropdown-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 14rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  box-shadow: 0 10px 30px var(--color-shadow);
  padding: 0.5rem;
  display: none;
  z-index: 50;
}
.dropdown-menu.open { display: block; animation: fadeIn 100ms ease; }
.dropdown-menu a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: var(--text-sm);
  color: var(--color-text);
  border-radius: 0.375rem;
  transition: background-color 150ms ease;
}
.dropdown-menu a:hover { background-color: var(--color-primary-light); }

/* Header actions */
.header-actions { display: flex; align-items: center; gap: 0.5rem; }
.icon-btn {
  padding: 0.5rem;
  border-radius: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 150ms ease;
}
.icon-btn:hover { background-color: var(--color-primary-light); }
.hamburger { display: flex; }
@media (min-width: 768px) { .hamburger { display: none; } }

/* Mobile nav */
#mobile-nav {
  display: none;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  padding: 1rem;
}
#mobile-nav.open { display: block; }
.mobile-nav-section-label {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0 0.25rem;
}
.mobile-nav a {
  display: block;
  padding: 0.75rem 0.5rem;
  font-size: var(--text-sm);
  color: var(--color-text);
  border-radius: 0.375rem;
}
.mobile-nav a:hover { color: var(--color-primary); }
.mobile-nav a.active { color: var(--color-primary); }

/* --- Tab Navigation --- */
.tab-list {
  display: flex;
  overflow-x: auto;
  gap: 0.25rem;
  border-bottom: 1px solid var(--color-border);
  margin-inline: -1rem;
  padding-inline: 1rem;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.tab-list::-webkit-scrollbar { display: none; }
.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.75rem 1rem;
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  color: var(--color-text-muted);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn[aria-selected="true"] { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-btn .tab-label { display: none; }
@media (min-width: 640px) { .tab-btn .tab-label { display: inline; } }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- Mode toggle (add/subtract) --- */
.mode-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.mode-btn {
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  transition: background-color 150ms ease, color 150ms ease;
}
.mode-btn.active { background: var(--color-primary); color: var(--color-primary-foreground); border-color: var(--color-primary); }

/* Sub-mode toggle (pill) */
.pill-toggle { display: flex; gap: 0.25rem; padding: 0.25rem; background: var(--color-surface-offset); border-radius: 0.5rem; width: fit-content; }
.pill-btn {
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--color-text-muted);
  transition: background-color 150ms ease, color 150ms ease;
}
.pill-btn.active { background: var(--color-surface); box-shadow: 0 1px 4px var(--color-shadow); color: var(--color-text); }

/* --- FAQ Accordion --- */
.faq-list { display: flex; flex-direction: column; gap: 0.5rem; }
.faq-item { border: 1px solid var(--color-border); border-radius: 0.5rem; overflow: hidden; }
.faq-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  text-align: left;
  font-weight: 500;
  font-size: var(--text-sm);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text);
  transition: background-color 150ms ease;
  gap: 0.5rem;
}
.faq-btn:hover { background-color: color-mix(in srgb, var(--color-primary-light) 50%, transparent); }
.faq-chevron { width: 1rem; height: 1rem; flex-shrink: 0; transition: transform 200ms ease; }
.faq-btn[aria-expanded="true"] .faq-chevron { transform: rotate(180deg); }
.faq-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 200ms ease;
}
.faq-body.open { max-height: 500px; }
.faq-body p { padding: 0 1.25rem 1rem; font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.625; }


/* --- Back to top --- */
#back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 50;
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  background: var(--color-primary);
  color: var(--color-primary-foreground);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px var(--color-shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}
#back-to-top.visible { opacity: 1; pointer-events: auto; }
#back-to-top:hover { background: var(--color-primary-hover); }

/* --- ToolCard / ArticleCard --- */
.tool-card {
  display: block;
  padding: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: transform 180ms ease, box-shadow 180ms ease;
  color: var(--color-text);
}
.tool-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--color-shadow); }
.tool-card .tool-icon { width: 1.5rem; height: 1.5rem; color: var(--color-primary); margin-bottom: 0.75rem; }
.tool-card .tool-title { font-weight: 600; font-size: var(--text-sm); margin-bottom: 0.25rem; font-family: var(--font-body); }
.tool-card .tool-desc  { font-size: var(--text-xs); color: var(--color-text-muted); margin-bottom: 0.75rem; }
.tool-card .tool-link  { display: inline-flex; align-items: center; gap: 0.25rem; font-size: var(--text-xs); color: var(--color-primary); font-weight: 500; transition: gap 150ms ease; }
.tool-card:hover .tool-link { gap: 0.5rem; }

/* --- Breadcrumb --- */
.breadcrumb { display: flex; align-items: center; gap: 0.5rem; font-size: var(--text-xs); color: var(--color-text-muted); margin-bottom: 1.5rem; flex-wrap: wrap; }
.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb .sep { opacity: 0.4; }
.breadcrumb .current { color: var(--color-text); }

/* --- Footer --- */
#site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  margin-top: 4rem;
}
.footer-inner { padding-block: 3rem; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: repeat(3, 1fr); } }
.footer-links li { margin-top: 0.5rem; }
.footer-links a { font-size: var(--text-sm); color: var(--color-text-muted); transition: color 150ms ease; }
.footer-links a:hover { color: var(--color-primary); }
.footer-bottom {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-divider);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
@media (min-width: 640px) { .footer-bottom { flex-direction: row; } }

/* --- Inline badge / tag --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 0.375rem;
  font-size: var(--text-xs);
  background: var(--color-primary-light);
  color: var(--color-text);
}

/* --- Info/error inline message --- */
.msg-error { display: flex; align-items: center; gap: 0.5rem; color: var(--color-destructive); font-size: var(--text-sm); }
.msg-info  { display: flex; align-items: center; gap: 0.5rem; color: var(--color-text-muted); font-size: var(--text-sm); }

/* --- Copy button state --- */
.copy-btn { transition: all 150ms ease; }
.copy-btn.copied svg.icon-copy { display: none; }
.copy-btn:not(.copied) svg.icon-check { display: none; }

/* --- Zeiten-addieren rows --- */
.time-row { display: flex; align-items: center; gap: 0.5rem; }
.time-row .remove-row-btn {
  padding: 0.5rem;
  color: var(--color-destructive);
  background: none;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 1.1em;
  line-height: 1;
  transition: background-color 150ms ease;
}
.time-row .remove-row-btn:hover { background: color-mix(in srgb, var(--color-destructive) 10%, transparent); }
.add-row-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 500;
  transition: text-decoration 150ms ease;
}
.add-row-btn:hover { text-decoration: underline; }

/* --- Impressum highlight box --- */
.info-box {
  background: var(--color-surface-offset);
  border-radius: 0.5rem;
  padding: 1rem;
  font-size: var(--text-sm);
}
.warn-box {
  background: color-mix(in srgb, var(--color-primary-light) 50%, transparent);
  border-radius: 0.5rem;
  padding: 1rem;
  font-size: var(--text-sm);
  margin-top: 2rem;
}

/* --- 404 page --- */
.not-found-wrap { display: flex; min-height: 100vh; align-items: center; justify-content: center; background: var(--color-surface-offset); }
.not-found-box  { text-align: center; padding: 2rem; }
.not-found-box h1 { font-size: 4rem; margin-bottom: 1rem; }
.not-found-box p  { font-size: var(--text-xl); color: var(--color-text-muted); margin-bottom: 1rem; }

/* --- Misc helpers --- */
.hint { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 0.75rem; }
.text-link { color: var(--color-primary); }
.text-link:hover { text-decoration: underline; }
.pl-3 { padding-left: 0.75rem; }
.pl-4 { padding-left: 1rem; }

/* --- Dropdown Table of Contents --- */
.toc-inline {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: 0.5rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  font-size: var(--text-sm);
  transition: all 200ms ease;
}
.toc-inline .toc-title {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0;
  list-style: none; /* Hide default dropdown arrow */
}
.toc-inline .toc-title::-webkit-details-marker {
  display: none;
}
.toc-inline .toc-title .chevron {
  transition: transform 200ms ease;
}
.toc-inline[open] .toc-title .chevron {
  transform: rotate(180deg);
}
.toc-inline ol {
  list-style: decimal;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.toc-inline ol li { list-style-type: decimal; margin-top: 0; }
.toc-inline ol li a {
  color: var(--color-primary);
  text-decoration: none;
  transition: text-decoration 150ms ease;
}
.toc-inline ol li a:hover { text-decoration: underline; }

/* --- Callout / Highlight box --- */
.callout {
  display: flex;
  gap: 0.75rem;
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin: 1.25em 0;
  font-size: var(--text-sm);
  line-height: 1.65;
}
.callout-icon { flex-shrink: 0; font-size: 1.1rem; margin-top: 0.1rem; }
.callout-tip {
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-primary) 25%, transparent);
  color: var(--color-text);
}
.callout-warn {
  background: color-mix(in srgb, hsl(40,95%,50%) 8%, transparent);
  border: 1px solid color-mix(in srgb, hsl(40,95%,50%) 30%, transparent);
  color: var(--color-text);
}
.callout-body strong { font-weight: 600; display: block; margin-bottom: 0.25rem; }

/* --- Article styled blockquote --- */
.prose-article blockquote.article-quote {
  position: relative;
  border-left: 4px solid var(--color-primary);
  background: var(--color-surface);
  border-radius: 0 0.5rem 0.5rem 0;
  padding: 1rem 1.25rem;
  margin: 1.5em 0;
  color: var(--color-text-muted);
  font-style: italic;
  font-size: var(--text-sm);
  line-height: 1.75;
}
.prose-article blockquote.article-quote cite {
  display: block;
  margin-top: 0.5rem;
  font-style: normal;
  font-weight: 600;
  font-size: var(--text-xs);
  color: var(--color-primary);
}

/* --- Sources / Quellen list --- */
.sources-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.sources-list li {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--color-text-muted);
  margin-top: 0;
}
.sources-list li::before {
  content: counter(source-counter);
  counter-increment: source-counter;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.1rem;
}
.sources-list { counter-reset: source-counter; }
.sources-list a { color: var(--color-primary); text-decoration: underline; text-underline-offset: 2px; }
.sources-list a:hover { color: var(--color-primary-hover); }
