/* ===========================
   BRIVOX DOCS — CORE STYLES
   =========================== */

:root,
[data-theme="dark"] {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #161616;
  --bg-elevated: #1a1a1a;
  --bg-hover: #1f1f1f;

  --border-subtle: #1f1f1f;
  --border-default: #2a2a2a;
  --border-strong: #3a3a3a;

  --text-primary: #ededed;
  --text-secondary: #a1a1a1;
  --text-tertiary: #6e6e6e;
  --text-muted: #4a4a4a;

  --accent: #ffffff;
  --accent-hover: #e5e5e5;
  --accent-muted: rgba(255, 255, 255, 0.08);

  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  --bg-tertiary: #f5f5f5;
  --bg-elevated: #ffffff;
  --bg-hover: #f0f0f0;

  --border-subtle: #f0f0f0;
  --border-default: #e5e5e5;
  --border-strong: #d4d4d4;

  --text-primary: #0a0a0a;
  --text-secondary: #525252;
  --text-tertiary: #737373;
  --text-muted: #a3a3a3;

  --accent: #0a0a0a;
  --accent-hover: #262626;
  --accent-muted: rgba(0, 0, 0, 0.06);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

::selection {
  background: var(--accent);
  color: var(--bg-primary);
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  line-height: 1.1;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }
h4 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--text-secondary);
}

code {
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 0.875em;
  background: var(--bg-tertiary);
  padding: 0.125em 0.375em;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  position: relative;
}

pre code {
  background: transparent;
  border: none;
  padding: 0;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ---- Animations ---- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

.animate-fade-in { animation: fadeIn 0.4s ease forwards; }
.animate-fade-up { animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-slide-in { animation: slideInRight 0.4s ease forwards; }
.animate-scale-in { animation: scaleIn 0.3s ease forwards; }

.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Utility ---- */
.text-muted { color: var(--text-tertiary); }
.text-small { font-size: 0.875rem; }
.text-mono { font-family: 'JetBrains Mono', monospace; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 2rem 0;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background: var(--text-secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-default);
}

/* ---- Loading Bar ---- */
.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--text-primary);
  z-index: 9999;
  width: 0;
  transition: width 0.3s ease;
}

.loading-bar.active {
  width: 100%;
  transition: width 0.8s ease;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0.875rem 1.25rem;
  border-radius: 10px;
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10000;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast svg {
  width: 16px;
  height: 16px;
  color: var(--success);
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 9998;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 2rem;
  max-width: 400px;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999;
  text-align: center;
}

.modal.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 2rem;
}

.modal h3 { margin-bottom: 0.5rem; }
.modal p { color: var(--text-secondary); margin-bottom: 1.5rem; }

/* ---- Theme Toggle ---- */
.theme-toggle svg {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-toggle:hover svg {
  transform: rotate(20deg);
}

/* ---- Invertible Logos ---- */
.logo-invert {
  filter: brightness(0) invert(1);
  transition: filter 0.3s ease;
}

[data-theme="light"] .logo-invert {
  filter: brightness(0) invert(0);
}

.logo-mark-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.product-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
}

.product-logo-card {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

/* ---- SEARCH OVERLAY ---- */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9997;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.search-overlay.open {
  opacity: 1;
  visibility: visible;
}

.search-overlay-header {
  width: 100%;
  max-width: 600px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateY(-10px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.search-overlay.open .search-overlay-header {
  transform: translateY(0);
  opacity: 1;
}

.search-overlay-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: inherit;
  min-width: 0;
}

.search-overlay-input::placeholder {
  color: var(--text-tertiary);
}

/* ---- BACKDROP for drawer ---- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 199;
}

.drawer-backdrop.show {
  opacity: 1;
  visibility: visible;
}

/* ---- HIDE mobile elements on desktop by default ---- */
.mobile-menu-trigger,
.mobile-search-trigger,
.mobile-bottom-nav,
.mobile-drawer,
.mobile-sheet-trigger,
.bottom-sheet {
  display: none;
}

/* ===========================
   ARTICLE PROSE STYLES
   For long-form content
   =========================== */

.prose {
  max-width: 740px;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.prose h2 {
  font-size: 1.875rem;
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  scroll-margin-top: 100px;
}

.prose h3 {
  font-size: 1.375rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  scroll-margin-top: 100px;
}

.prose h4 {
  font-size: 1.125rem;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  letter-spacing: 0;
}

.prose p {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}

.prose strong {
  color: var(--text-primary);
  font-weight: 600;
}

.prose a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease;
}

.prose a:hover {
  text-decoration-color: var(--text-primary);
}

.prose ul,
.prose ol {
  margin: 1rem 0 1.5rem;
  padding-left: 1.5rem;
}

.prose li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

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

.prose blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--border-strong);
  background: var(--bg-secondary);
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
  font-style: italic;
}

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

.prose hr {
  border: none;
  height: 1px;
  background: var(--border-subtle);
  margin: 2.5rem 0;
}

.prose img {
  max-width: 100%;
  border-radius: 8px;
  margin: 1.5rem 0;
  border: 1px solid var(--border-subtle);
}

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

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

.prose th {
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.prose td {
  color: var(--text-secondary);
}

/* ---- Callout boxes (Info, Warning, Tip) ---- */
.callout {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  background: var(--bg-secondary);
  display: flex;
  gap: 0.875rem;
  align-items: flex-start;
}

.callout-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 0.125rem;
}

.callout-content {
  flex: 1;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

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

.callout.info { border-left: 3px solid var(--info); }
.callout.info .callout-icon { color: var(--info); }

.callout.warning { border-left: 3px solid var(--warning); }
.callout.warning .callout-icon { color: var(--warning); }

.callout.tip { border-left: 3px solid var(--success); }
.callout.tip .callout-icon { color: var(--success); }

.callout.error { border-left: 3px solid var(--error); }
.callout.error .callout-icon { color: var(--error); }

/* ---- Article tags ---- */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tag {
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ---- Related articles ---- */
.related-articles {
  margin: 3rem 0 2rem;
}

.related-articles h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

/* ---- Article List Grid ---- */
.article-list-card {
  display: block;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  transition: all 0.2s ease;
  margin-bottom: 1rem;
}

.article-list-card:hover {
  border-color: var(--border-default);
  background: var(--bg-tertiary);
  transform: translateY(-1px);
}

.article-list-card .article-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: 0.5rem;
}

.article-list-card .article-meta-divider {
  width: 3px;
  height: 3px;
  background: var(--text-tertiary);
  border-radius: 50%;
}

.article-list-card h3 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.article-list-card p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0;
}

/* Mobile prose adjustments */
@media (max-width: 899px) {
  .prose {
    font-size: 0.9375rem;
    line-height: 1.7;
  }

  .prose h2 {
    font-size: 1.5rem;
    margin-top: 2.25rem;
  }

  .prose h3 {
    font-size: 1.25rem;
    margin-top: 1.75rem;
  }

  .prose table {
    font-size: 0.8125rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .article-list-card {
    padding: 1.125rem;
  }

  .article-list-card h3 {
    font-size: 1.25rem;
  }

  .article-list-card p {
    font-size: 0.875rem;
  }
}