/**
 * TrizTech Docs — Custom Theme
 * A modern, premium dark-first documentation theme.
 */

/* ========================================
   CSS Custom Properties — Light Mode
   ======================================== */
:root {
  /* Indigo primary palette */
  --ifm-color-primary: #4F46E5;
  --ifm-color-primary-dark: #4338CA;
  --ifm-color-primary-darker: #3730A3;
  --ifm-color-primary-darkest: #312E81;
  --ifm-color-primary-light: #6366F1;
  --ifm-color-primary-lighter: #818CF8;
  --ifm-color-primary-lightest: #C7D2FE;

  /* Typography */
  --ifm-font-family-base: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ifm-heading-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ifm-font-family-monospace: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --ifm-font-size-base: 16px;
  --ifm-code-font-size: 88%;

  /* Spacing & shapes */
  --ifm-global-radius: 0.5rem;
  --ifm-code-border-radius: 0.5rem;

  /* Code highlighting */
  --docusaurus-highlighted-code-line-bg: rgba(79, 70, 229, 0.08);

  /* Custom tokens */
  --tt-bg-surface: #f8fafc;
  --tt-bg-surface-raised: #ffffff;
  --tt-border-color: #e2e8f0;
  --tt-text-muted: #64748b;
  --tt-glow-color: rgba(79, 70, 229, 0.15);
  --tt-navbar-bg: rgba(255, 255, 255, 0.82);
  --tt-hero-gradient-start: #eef2ff;
  --tt-hero-gradient-end: #f8fafc;
}

/* ========================================
   CSS Custom Properties — Dark Mode
   ======================================== */
[data-theme='dark'] {
  --ifm-color-primary: #818CF8;
  --ifm-color-primary-dark: #6366F1;
  --ifm-color-primary-darker: #4F46E5;
  --ifm-color-primary-darkest: #4338CA;
  --ifm-color-primary-light: #A5B4FC;
  --ifm-color-primary-lighter: #C7D2FE;
  --ifm-color-primary-lightest: #E0E7FF;

  --ifm-background-color: #0B1121;
  --ifm-background-surface-color: #131B2E;

  --docusaurus-highlighted-code-line-bg: rgba(129, 140, 248, 0.12);

  --tt-bg-surface: #131B2E;
  --tt-bg-surface-raised: #1A2338;
  --tt-border-color: #1E293B;
  --tt-text-muted: #94a3b8;
  --tt-glow-color: rgba(129, 140, 248, 0.08);
  --tt-navbar-bg: rgba(11, 17, 33, 0.82);
  --tt-hero-gradient-start: #0B1121;
  --tt-hero-gradient-end: #0f172a;
}

/* ========================================
   Global
   ======================================== */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  scroll-behavior: smooth;
}

h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.02em;
  font-weight: 700;
}

h1 {
  font-weight: 800;
}

/* ========================================
   Navbar
   ======================================== */
.navbar {
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  background-color: var(--tt-navbar-bg);
  border-bottom: 1px solid var(--tt-border-color);
  box-shadow: none;
  padding: 0.5rem 1rem;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.navbar__title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.navbar__link {
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.15s ease;
}

.navbar__link:hover {
  color: var(--ifm-color-primary);
}

/* ========================================
   Sidebar
   ======================================== */
.menu {
  padding: 0.75rem !important;
}

.menu__link {
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.45rem 0.75rem;
  transition: all 0.15s ease;
}

.menu__link:hover:not(.menu__link--active) {
  background-color: var(--tt-glow-color);
}

.menu__link--active:not(.menu__link--sublist) {
  background-color: var(--ifm-color-primary);
  color: #ffffff;
  font-weight: 600;
}

.menu__list-item-collapsible .menu__link {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--tt-text-muted);
}

/* ========================================
   Documentation Content
   ======================================== */
.markdown > h1:first-child {
  font-size: 2rem;
}

.markdown h2 {
  border-bottom: 1px solid var(--tt-border-color);
  padding-bottom: 0.5rem;
  margin-top: 2.5rem;
}

.markdown img {
  display: block;
  margin: 2.5rem auto;
  border-radius: 0.75rem;
  box-shadow: 0 12px 40px var(--tt-glow-color);
  border: 1px solid var(--tt-border-color);
  max-width: 100%;
  height: auto;
  transition: transform 0.3s ease;
}

.markdown img:hover {
  transform: scale(1.01);
}

/* Tables */
table {
  display: table;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--tt-border-color);
  border-radius: 0.625rem;
  overflow: hidden;
  font-size: 0.9rem;
}

table th {
  background-color: var(--tt-bg-surface);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--tt-text-muted);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--tt-border-color);
}

table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--tt-border-color);
}

table tr:last-child td {
  border-bottom: none;
}

[data-theme='dark'] table th {
  background-color: var(--tt-bg-surface-raised);
}

/* Blockquotes */
blockquote {
  border-left: 3px solid var(--ifm-color-primary);
  background-color: var(--tt-bg-surface);
  border-radius: 0 0.625rem 0.625rem 0;
  padding: 0.85rem 1.15rem;
  margin: 1.25rem 0;
  font-size: 0.92rem;
}

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

/* Code blocks */
pre {
  border: 1px solid var(--tt-border-color);
  border-radius: 0.625rem !important;
}

code {
  border-radius: 0.3rem;
  padding: 0.15rem 0.4rem;
  font-size: var(--ifm-code-font-size);
}

/* ========================================
   Scrollbar
   ======================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--tt-border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ifm-color-primary-light);
}

/* ========================================
   Footer
   ======================================== */
.footer {
  background-color: var(--tt-bg-surface);
  border-top: 1px solid var(--tt-border-color);
  padding: 1.5rem 0;
}

[data-theme='dark'] .footer {
  background-color: #080E1A;
}

.footer__copyright {
  font-size: 0.82rem;
  color: var(--tt-text-muted);
}

/* ========================================
   Table of Contents (Right sidebar)
   ======================================== */
.table-of-contents__link {
  font-size: 0.82rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.table-of-contents__link--active {
  color: var(--ifm-color-primary);
  font-weight: 600;
}

/* ========================================
   Pagination
   ======================================== */
.pagination-nav__link {
  border-radius: 0.75rem;
  border: 1px solid var(--tt-border-color);
  transition: all 0.2s ease;
}

.pagination-nav__link:hover {
  border-color: var(--ifm-color-primary);
  box-shadow: 0 0 0 1px var(--ifm-color-primary);
}

/* ========================================
   Search Bar (Local Search)
   ======================================== */
.navbar__search {
  padding-left: 0.5rem;
}

.aa-DetachedSearchButton {
  background-color: var(--tt-bg-surface-raised) !important;
  border: 1px solid var(--tt-border-color) !important;
  border-radius: 0.5rem !important;
  padding: 0 0.75rem !important;
  font-size: 0.85rem !important;
  transition: all 0.2s ease !important;
  color: var(--ifm-font-color-base) !important;
  width: 12rem !important;
  height: 36px !important;
}

.aa-DetachedSearchButton:hover {
  border-color: var(--ifm-color-primary) !important;
  background-color: var(--ifm-background-surface-color) !important;
}

[data-theme='dark'] .aa-DetachedSearchButton {
  background-color: var(--ifm-background-surface-color) !important;
}

.aa-DetachedSearchButtonIcon {
  color: var(--ifm-font-color-base) !important;
  opacity: 0.6;
}

.aa-DetachedSearchButtonPlaceholder {
  color: var(--ifm-font-color-base) !important;
  opacity: 0.6;
}

/* Mobile Responsiveness for Search Button */
@media (max-width: 996px) {
  .aa-DetachedSearchButton {
    width: 36px !important;
    padding: 0 !important;
    justify-content: center !important;
  }

  .aa-DetachedSearchButtonPlaceholder {
    display: none !important;
  }

  .aa-DetachedSearchButtonIcon {
    width: 20px !important;
    margin: 0 !important;
  }
}

/* ========================================
   Search & DocCard (category index pages)
   ======================================== */
article.margin-top--lg .col .card {
  border-radius: 0.75rem;
  border: 1px solid var(--tt-border-color);
  transition: all 0.2s ease;
}

article.margin-top--lg .col .card:hover {
  border-color: var(--ifm-color-primary-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--tt-glow-color);
}

/* ========================================
   Breadcrumbs
   ======================================== */
.breadcrumbs__link {
  font-size: 0.82rem;
  font-weight: 500;
}

/* ========================================
   Responsive polish
   ======================================== */
@media (max-width: 996px) {
  .navbar {
    padding: 0.35rem 0.75rem;
  }
}
