:root {
  --zw-red: #FF2D2D;
  --zw-red-dark: #DC2626;
  --zw-red-hover: #B91C1C;
  --zw-black: #050507;
  --zw-text: #111827;
  --zw-body: #374151;
  --zw-muted: #6B7280;
  --zw-border: #E5E7EB;
  --md-primary-fg-color: var(--zw-black);
  --md-primary-fg-color--light: #1a1a1a;
  --md-primary-fg-color--dark: #000000;
  --md-accent-fg-color: var(--zw-red);
  --zw-prose-measure: 74ch;
  accent-color: var(--zw-text);
}

[data-md-color-scheme="default"] {
  --md-primary-fg-color: var(--zw-black);
  --md-accent-fg-color: var(--zw-red);
}

/* =========================
   Header â€” pixel copy of zwischen.ai .topbar
   Swap: nav pill buttons â†' MkDocs search bar
   ========================= */

.md-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 73px;
  background: rgba(5, 5, 7, 0.9);
  backdrop-filter: blur(20px);
  box-shadow: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.md-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  max-width: none !important;
  margin: 0 !important;
  height: 100%;
  box-sizing: border-box;
}

@media screen and (max-width: 76.24em) {
  .md-header__inner {
    padding: 12px 16px;
  }

  .md-header__title {
    flex: 1 1 0 !important;
    min-width: 0;
  }

  .md-header [for="__search"] {
    order: 2;
  }

  .md-header [for="__drawer"] {
    order: 3;
  }
}

.md-header .md-logo {
  display: flex;
  align-items: center;
  padding: 0;
  margin: 0;
  order: 0;
}

.md-header .md-logo img {
  height: 16px;
  width: auto;
  object-fit: contain;
  margin-top: -1px;
  margin-bottom: 1px;
}

.md-header__title {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 1);
  text-shadow: rgba(255, 255, 255, 0.06) 0px 0px 30px;
  margin: 0 0 0 8px !important;
  flex: none;
  order: 1;
}

.md-header__ellipsis {
  display: flex;
  align-items: center;
  line-height: normal;
}

.md-header__topic {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
  line-height: normal;
  transform: none !important;
  opacity: 1 !important;
  transition: none !important;
  position: static !important;
}

.md-header__topic + .md-header__topic {
  display: none;
}

.md-search {
  order: 2;
  margin-left: auto;
  padding: 0 !important;
}

.md-container {
  padding-top: 73px;
}

/* =========================
   Search â€” clean pill
   ========================= */

.md-search__form {
  border-radius: 20px;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: background-color 0.15s, border-color 0.15s;
}

.md-search__form:hover,
.md-search__form:focus-within {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
}

.md-search__input {
  font-size: 13px;
}

.md-search__suggest {
  font-size: 13px;
}

.md-search__icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.md-search__icon svg {
  width: 18px;
  height: 18px;
}

.md-search__input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* =========================
   Layout
   ========================= */

.md-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.md-main {
  flex: 1;
}

@media screen and (min-width: 76.25em) {
  .md-grid {
    max-width: 82rem;
  }

  .md-sidebar--primary,
  .md-sidebar--primary .md-sidebar__scrollwrap {
    width: 10.5rem;
  }

  .md-sidebar--secondary {
    width: 9rem;
  }

  /* Sidebar — fixed frame (desktop only) */

  .md-main__inner {
    margin-top: 0 !important;
  }

  .md-content {
    padding-top: 33px;
  }

  .md-sidebar--primary {
    position: static !important;
    height: auto !important;
    align-self: stretch !important;
    flex: 0 0 10.5rem !important;
    padding: 0 !important;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap {
    position: fixed;
    top: 73px;
    width: 10.5rem;
    height: auto !important;
    max-height: calc(100vh - 73px);
    padding: 16px 0;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .md-nav--primary .md-nav__title {
    display: none;
  }

  .md-nav--primary > .md-nav__list {
    padding-bottom: 0;
  }

  .md-nav--primary {
    margin-bottom: 0 !important;
  }
}

/* =========================
   Scrollbar
   ========================= */

.md-sidebar__scrollwrap {
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.md-sidebar__scrollwrap:hover {
  scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
}

/* =========================
   Typography â€” px sizes to avoid rem scaling trap
   ========================= */

.md-typeset {
  font-size: 15px;
  line-height: 1.7;
  color: var(--zw-body);
}

.md-typeset h1 {
  font-size: 28px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--zw-text);
  margin: 0 0 16px;
}

.md-typeset h2 {
  font-size: 20px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--zw-text);
  margin: 40px 0 12px;
  padding-top: 8px;
  border-top: 1px solid #eceff3;
}

.md-typeset h2:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.md-typeset h3 {
  font-size: 15px;
  line-height: 1.35;
  font-weight: 600;
  color: var(--zw-text);
  margin: 24px 0 8px;
}

.md-typeset h2 code,
.md-typeset h3 code {
  font-size: 0.9em;
  font-weight: 600;
  background: #f3f4f6;
  border: 1px solid var(--zw-border);
  border-radius: 5px;
  padding: 0.1em 0.35em;
  color: #1f2937;
}

.md-typeset :where(p, ul, ol, dl, blockquote) {
  max-width: var(--zw-prose-measure);
}

.md-typeset p {
  margin: 0 0 12px;
}

.md-typeset > p:first-of-type {
  font-size: 16px;
  line-height: 1.65;
  color: #1f2937;
  margin-bottom: 20px;
}

.md-typeset strong {
  font-weight: 600;
  color: var(--zw-text);
}

/* =========================
   Links
   ========================= */

.md-content a {
  color: var(--zw-red-dark);
}

.md-content a:hover {
  color: var(--zw-red-hover);
}

/* =========================
   Inline code
   ========================= */

.md-typeset code {
  font-size: 0.85em;
  background: #f3f4f6;
  color: #1f2937;
  border: 1px solid var(--zw-border);
  border-radius: 3px;
  padding: 0.1em 0.3em;
}

/* =========================
   Code blocks
   ========================= */

.md-typeset pre,
.md-typeset .highlight pre {
  background: #f6f8fa;
  border: 1px solid var(--zw-border);
  border-radius: 8px;
  padding: 12px 14px;
  padding-right: 36px;
}

.md-typeset pre code,
.md-typeset .highlight code {
  font-size: 13px;
  line-height: 1.55;
  color: #1f2937;
  background: transparent;
  border: none;
  padding: 0;
}

.md-typeset .highlight .c,
.md-typeset .highlight .c1 {
  color: var(--zw-muted);
  font-style: normal;
}

.md-clipboard {
  color: #9ca3af;
}

.md-clipboard:hover {
  color: #4b5563;
}

/* =========================
   Tables
   ========================= */

.md-typeset table:not([class]) {
  font-size: 13px;
  line-height: 1.45;
  border: 1px solid var(--zw-border);
  border-radius: 6px;
  overflow: hidden;
  display: table;
  width: 100%;
  background: #fff;
}

.md-typeset table:not([class]) th,
.md-typeset table:not([class]) td {
  padding: 8px 12px;
  border-bottom: 1px solid #eef0f3;
  vertical-align: top;
}

.md-typeset table:not([class]) th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--zw-muted);
  background: #f9fafb;
  text-align: left;
}

@media screen and (min-width: 48em) {
  .md-typeset table td:first-child {
    white-space: nowrap;
  }
}

.md-typeset table:not([class]) tbody tr:nth-child(even) {
  background: #fcfcfd;
}

/* =========================
   Sidebar back link
   ========================= */

.zw-back-link {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--zw-red);
  text-decoration: none;
  padding: 8px 10px 12px;
  border-bottom: 1px solid var(--zw-border);
  margin-bottom: 4px;
  transition: color 0.15s;
}

.zw-back-link:hover {
  color: var(--zw-red-hover);
}

/* =========================
   Sidebar navigation
   ========================= */

.md-nav--primary > .md-nav__list > .md-nav__item--section > .md-nav__link,
.md-nav--primary > .md-nav__list > .md-nav__item--nested > .md-nav__link {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  margin-top: 12px;
  margin-bottom: 2px;
}

.md-nav--primary .md-nav__item .md-nav__link {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  color: #6b7280;
  border-left: none;
  padding: 4px 10px;
  border-radius: 5px;
  transition: color 0.15s, background-color 0.15s;
}

.md-nav--primary .md-nav__item .md-nav__link:hover {
  color: var(--zw-text);
  background-color: #f3f4f6;
}

.md-nav--primary .md-nav__item .md-nav__link--active {
  color: var(--zw-text) !important;
  font-weight: 600;
  background-color: #f3f4f6;
}

.md-nav--primary .md-nav__list .md-nav__list {
  margin-left: 2px;
  padding-left: 10px;
  border-left: 1px solid #e5e7eb;
}

/* =========================
   Secondary sidebar (TOC)
   ========================= */

.md-sidebar--secondary .md-nav__title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9ca3af;
}

.md-sidebar--secondary .md-nav__link {
  font-size: 12px;
  line-height: 1.35;
  color: #9ca3af;
}

.md-sidebar--secondary .md-nav__link:hover {
  color: var(--zw-text);
}

.md-sidebar--secondary .md-nav__link--active {
  color: var(--zw-text);
  font-weight: 500;
}

/* =========================
   Cards
   ========================= */

.grid.cards > ul > li {
  border: 1px solid var(--zw-border);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(5, 5, 7, 0.04);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.grid.cards > ul > li:hover {
  transform: translateY(-1px);
  border-color: #d1d5db;
  box-shadow: 0 4px 12px rgba(5, 5, 7, 0.06);
}

@media screen and (min-width: 48em) {
  .md-typeset .grid.cards > ul {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* =========================
   Spacing rhythm
   ========================= */

.md-typeset .highlight,
.md-typeset pre {
  margin: 8px 0 16px;
}

.md-typeset h3 + .highlight,
.md-typeset h3 + pre {
  margin-top: 6px;
}

.md-content__inner > hr {
  margin: 24px 0;
  border-color: var(--zw-border);
}

/* =========================
   Search highlight
   ========================= */

.md-search-result mark {
  background-color: rgba(255, 45, 45, 0.15);
  color: inherit;
}

/* =========================
   Admonitions â€” Stripe/Linear style callouts
   ========================= */

.md-typeset .admonition,
.md-typeset details {
  font-size: 14px;
  border: 1px solid var(--zw-border);
  border-left: 3px solid #9ca3af;
  border-radius: 0 8px 8px 0;
  background: #f9fafb;
  box-shadow: none;
}

.md-typeset .admonition .admonition-title,
.md-typeset details summary {
  background: transparent !important;
  border-bottom: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--zw-text);
}

.md-typeset .admonition .admonition-title::before,
.md-typeset details summary::before {
  background-color: #6b7280 !important;
}

.md-typeset .admonition.info,
.md-typeset details.info {
  border-left-color: #6b7280;
}

.md-typeset .admonition.tip,
.md-typeset details.tip {
  border-left-color: #059669;
}

.md-typeset .admonition.tip .admonition-title::before,
.md-typeset details.tip summary::before {
  background-color: #059669 !important;
}

.md-typeset .admonition.warning,
.md-typeset details.warning {
  border-left-color: #D97706;
}

.md-typeset .admonition.warning .admonition-title::before,
.md-typeset details.warning summary::before {
  background-color: #D97706 !important;
}

.md-typeset .admonition.danger,
.md-typeset details.danger {
  border-left-color: var(--zw-red);
}

.md-typeset .admonition.danger .admonition-title::before,
.md-typeset details.danger summary::before {
  background-color: var(--zw-red) !important;
}

.md-typeset :is(.admonition, details):is(.question, .help, .faq) {
  border-color: var(--zw-border) !important;
  border-left-color: #6b7280 !important;
}

.md-typeset :is(.question, .help, .faq) :is(.admonition-title, summary)::before {
  background-color: #6b7280 !important;
}

.md-typeset :is(.question, .help, .faq) :is(.admonition-title, summary)::after {
  color: #6b7280 !important;
}

.md-typeset :is(.admonition, details):is(.question, .help, .faq):focus-within,
.md-typeset :is(.admonition, details):is(.question, .help, .faq)[open] {
  border-color: var(--zw-border) !important;
  border-left-color: #6b7280 !important;
  box-shadow: none !important;
}

/* =========================
   Footer — match zwischen.ai layout
   ========================= */

.md-footer {
  background-color: var(--zw-black);
  position: relative;
  z-index: 2;
}

.md-footer-meta {
  background-color: var(--zw-black);
  padding: 14px 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.md-footer-meta__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.md-copyright {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.md-copyright__highlight {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
}

.md-copyright__privacy a {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  transition: color 0.2s;
}

.md-copyright__privacy a:hover {
  color: rgba(255, 255, 255, 0.7);
}

.md-footer__link {
  padding: 8px 16px;
}

.md-footer__direction {
  font-size: 10px;
}

.md-footer__title {
  font-size: 12px;
}

.md-footer__button.md-icon svg {
  width: 18px;
  height: 18px;
}

@media screen and (max-width: 48em) {
  .md-footer-meta {
    padding: 14px 20px;
  }

  .md-copyright {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

/* =========================
   Mobile drawer — slide from right
   ========================= */

@media screen and (max-width: 76.24em) {
  .md-sidebar--primary {
    left: auto !important;
    right: 0 !important;
    transform: translateX(100%) !important;
    top: 73px !important;
    height: calc(100vh - 73px) !important;
  }

  [data-md-toggle="drawer"]:checked ~ .md-container .md-sidebar--primary {
    transform: translateX(0) !important;
  }

  .zw-back-link {
    background: var(--zw-black);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    padding: 14px 16px;
    border-bottom: none;
    margin-bottom: 0;
  }

  .zw-back-link:hover {
    color: #fff;
  }

  .md-nav--primary > .md-nav__title {
    display: none !important;
  }

  .md-nav--primary > .md-nav__list {
    padding: 8px 12px;
  }

  .md-nav--primary > .md-nav__list > .md-nav__item {
    border-bottom: 1px solid #f0f0f0;
    padding: 2px 0;
  }

  .md-nav--primary > .md-nav__list > .md-nav__item:last-child {
    border-bottom: none;
  }
}
