/* SwissApp Docs — docs.swissapp.net */

:root {
  --red: #7f1d1d;
  --red-light: #991b1b;
  --red-bg: #fef2f2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --sidebar-w: 280px;
  --toc-w: 220px;
  --topbar-h: 60px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--gray-800);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

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

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 200;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
}
.sidebar-toggle {
  display: none;
  background: none; border: none; font-size: 1.2rem;
  color: var(--gray-600); cursor: pointer; padding: 8px;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none !important;
  flex-shrink: 0;
}
.brand-sep { color: var(--gray-300); font-weight: 300; }
.brand-docs { font-weight: 700; color: var(--gray-700); font-size: .95rem; }

.search-wrap {
  flex: 1; max-width: 420px; position: relative; margin: 0 auto;
}
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); font-size: .85rem; pointer-events: none;
}
#search {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font: inherit; font-size: .9rem;
  background: var(--gray-50);
  transition: border-color .15s, box-shadow .15s;
}
#search:focus {
  outline: none;
  border-color: var(--red-light);
  box-shadow: 0 0 0 3px rgba(127,29,29,.1);
  background: #fff;
}
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12);
  max-height: 360px; overflow-y: auto; z-index: 300;
}
.search-results.hidden { display: none; }
.search-result {
  display: block; padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  text-decoration: none !important; color: inherit;
}
.search-result:hover { background: var(--red-bg); }
.search-result strong { color: var(--red); font-size: .9rem; }
.search-result small { display: block; color: var(--gray-500); font-size: .8rem; margin-top: 2px; }

.topbar-links { display: flex; gap: 8px; flex-shrink: 0; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font: inherit; font-size: .875rem; font-weight: 600;
  cursor: pointer; border: none; text-decoration: none !important;
  transition: background .15s, color .15s;
}
.btn-sm { padding: 7px 14px; font-size: .82rem; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-light); }
.btn-ghost { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-200); }
.btn-ghost:hover { background: var(--gray-50); color: var(--gray-800); }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--toc-w);
  min-height: calc(100vh - var(--topbar-h));
}
.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  border-right: 1px solid var(--gray-200);
  background: var(--gray-50);
  padding: 16px 0;
}
.sidebar-overlay { display: none; }

.nav-group { margin-bottom: 8px; }
.nav-group-title {
  padding: 8px 20px 4px;
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--gray-400);
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 20px;
  color: var(--gray-600); font-size: .875rem; font-weight: 500;
  text-decoration: none !important;
  border-left: 3px solid transparent;
  transition: background .1s, color .1s, border-color .1s;
}
.nav-link i { width: 16px; text-align: center; font-size: .8rem; opacity: .7; }
.nav-link:hover { background: var(--gray-100); color: var(--gray-900); }
.nav-link.active {
  background: var(--red-bg); color: var(--red);
  border-left-color: var(--red); font-weight: 600;
}
.nav-link.active i { opacity: 1; }

.main {
  padding: 32px 48px 80px;
  max-width: 900px;
  min-width: 0;
}
.toc-panel {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 24px 16px;
  border-left: 1px solid var(--gray-200);
}
.toc-title {
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--gray-400); margin-bottom: 12px;
}
.toc-link {
  display: block; padding: 4px 0 4px 12px;
  font-size: .8rem; color: var(--gray-500);
  text-decoration: none !important;
  border-left: 2px solid var(--gray-200);
  line-height: 1.4;
}
.toc-link:hover { color: var(--red); border-left-color: var(--red); }
.toc-link.h3 { padding-left: 24px; font-size: .75rem; }

/* Home page */
.hero {
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--gray-200);
}
.hero h1 { font-size: 2rem; font-weight: 800; color: var(--gray-900); margin: 0 0 12px; letter-spacing: -.02em; }
.hero .lead { font-size: 1.05rem; color: var(--gray-500); margin: 0; max-width: 600px; }

.section-title {
  font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--gray-400); margin: 32px 0 16px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.card {
  display: block; padding: 20px;
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  background: #fff; text-decoration: none !important; color: inherit;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover {
  border-color: var(--red-light);
  box-shadow: 0 4px 16px rgba(127,29,29,.08);
  transform: translateY(-2px);
}
.card-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--red-bg); color: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; margin-bottom: 12px;
}
.card h3 { margin: 0 0 6px; font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.card p { margin: 0 0 12px; font-size: .85rem; color: var(--gray-500); line-height: 1.5; }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card-meta code {
  font-size: .72rem; background: var(--gray-100);
  padding: 2px 6px; border-radius: 4px; color: var(--gray-600);
}
.badge {
  font-size: .68rem; font-weight: 600;
  padding: 2px 8px; border-radius: 99px;
  background: var(--red-bg); color: var(--red);
}

/* Service header */
.service-header {
  margin-bottom: 32px; padding-bottom: 24px;
  border-bottom: 1px solid var(--gray-200);
}
.service-header h1 { font-size: 1.75rem; font-weight: 800; margin: 0 0 8px; color: var(--gray-900); }
.service-header .lead { color: var(--gray-500); margin: 0 0 16px; }
.service-meta {
  display: flex; flex-wrap: wrap; gap: 16px;
  font-size: .875rem; color: var(--gray-600);
}
.service-meta code {
  background: var(--gray-100); padding: 2px 8px; border-radius: 4px;
  font-family: var(--mono); font-size: .82rem;
}

/* Markdown content */
.md-content h1 { font-size: 1.5rem; margin: 2rem 0 1rem; font-weight: 800; color: var(--gray-900); }
.md-content h2 {
  font-size: 1.2rem; margin: 2.5rem 0 .75rem; font-weight: 700;
  color: var(--gray-900); padding-top: 1rem;
  border-top: 1px solid var(--gray-100);
}
.md-content h2:first-child { border-top: none; padding-top: 0; }
.md-content h3 { font-size: 1rem; margin: 1.5rem 0 .5rem; font-weight: 600; color: var(--gray-800); }
.md-content h4 { font-size: .9rem; margin: 1rem 0 .4rem; font-weight: 600; }
.md-content p { margin: 0 0 1rem; }
.md-content ul, .md-content ol { margin: 0 0 1rem; padding-left: 1.5rem; }
.md-content li { margin-bottom: .3rem; }
.md-content blockquote {
  margin: 1rem 0; padding: 12px 16px;
  border-left: 4px solid var(--red-light);
  background: var(--red-bg); border-radius: 0 8px 8px 0;
  color: var(--gray-700); font-size: .9rem;
}
.md-content hr { border: none; border-top: 1px solid var(--gray-200); margin: 2rem 0; }
.md-content table {
  width: 100%; border-collapse: collapse;
  margin: 1rem 0; font-size: .875rem;
  display: block; overflow-x: auto;
}
.md-content th, .md-content td {
  padding: 10px 14px; border: 1px solid var(--gray-200);
  text-align: left;
}
.md-content th { background: var(--gray-50); font-weight: 600; }
.md-content tr:nth-child(even) td { background: var(--gray-50); }
.md-content code {
  font-family: var(--mono); font-size: .82em;
  background: var(--gray-100); padding: 2px 6px; border-radius: 4px;
  color: var(--red-light);
}
.md-content pre {
  background: var(--gray-900); color: #e6edf3;
  padding: 16px 20px; border-radius: var(--radius);
  overflow-x: auto; margin: 1rem 0;
  font-size: .82rem; line-height: 1.5;
}
.md-content pre code {
  background: transparent; padding: 0; color: inherit; font-size: inherit;
}
.md-content img { max-width: 100%; border-radius: var(--radius); }

/* Responsive */
@media (max-width: 1100px) {
  .layout { grid-template-columns: var(--sidebar-w) 1fr; }
  .toc-panel { display: none; }
}
@media (max-width: 768px) {
  .sidebar-toggle { display: block; }
  .topbar-links .btn-ghost { display: none; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: -100%; top: var(--topbar-h);
    width: var(--sidebar-w); z-index: 150;
    transition: left .25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.1);
  }
  .sidebar.open { left: 0; }
  .main { padding: 24px 20px 60px; }
  .search-wrap { max-width: none; }
}
