/* =========================================================
   1. Brand Tokens / Theme Variables
   ========================================================= */

:root {
  --lattix-bg: #ffffff;
  --lattix-surface: #ffffff;
  --lattix-surface-soft: #f8f8fb;
  --lattix-surface-muted: #f1f2f6;
  --lattix-border: #e6e8ef;

  --lattix-heading: #29265e;
  --lattix-text: #4b5563;
  --lattix-text-strong: #1f2430;
  --lattix-text-soft: #6b7280;

  --lattix-navy: #29265e;
  --lattix-red: #bf2c3a;
  --lattix-red-dark: #a82532;

  --lattix-table-row-hover-bg: #ff8d97;

  --lattix-header-bar-bg: #ffffff;

  --lattix-link: #bf2c3a;
  --lattix-cta: #bf2c3a;
  --lattix-cta-hover: #a82532;
  
  --lattix-table-text: #ffffff;
   --lattix-table-odd-row: #ffffff;
   --lattix-table-even-row: #f1f2f6;

  --lattix-shadow-soft: 0 8px 24px rgba(40, 37, 96, 0.05);
}

html[data-theme="dark"] {
  --lattix-bg: #0f1220;
  --lattix-surface: #171b2d;
  --lattix-surface-soft: #1d2238;
  --lattix-surface-muted: #263044;
  --lattix-border: #2b3350;

  --lattix-heading: #f3f4f8;
  --lattix-text: #c6cad8;
  --lattix-text-strong: #ffffff;
  --lattix-text-soft: #aab0c3;

  --lattix-table-row-hover-bg: #d43a49;

  --lattix-header-bar-bg: #1d2238;

  --lattix-navy: #f3f4f8;
  --lattix-red: #ff6673;
  --lattix-red-dark: #ff8d97;

  --lattix-link: #ff6673;
  --lattix-cta: #bf2c3a;
  --lattix-cta-hover: #d43a49;

  --lattix-shadow-soft: none;

  --lattix-table-text: #29265e;
  --lattix-table-odd-row: #1d2238;
  --lattix-table-even-row: #171b2d;
}


/* =========================================================
   2. Global Typography
   ========================================================= */

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--lattix-bg);
  color: var(--lattix-text);
  line-height: 1.65;
}

h1,
h2,
h3,
h4,
h5,
h6,
article.bd-article h1,
article.bd-article h2,
article.bd-article h3,
article.bd-article h4,
article.bd-article h5,
article.bd-article h6 {
  font-family: "Quicksand", sans-serif !important;
  color: var(--lattix-heading);
  font-weight: 800;
  letter-spacing: -0.015em;
}

article.bd-article h1 {
  font-size: clamp(2rem, 3vw, 2.8rem);
  margin-bottom: 0.9rem;
}

article.bd-article h2 {
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  margin-top: 2.25rem;
  margin-bottom: 1rem;
}

article.bd-article h3 {
  font-size: 1.2rem;
  margin-top: 1.6rem;
}

p,
article.bd-article p,
article.bd-article li,
article.bd-article dd {
  color: var(--lattix-text);
}

article.bd-article strong,
article.bd-article b {
  color: var(--lattix-text-strong);
}

a {
  color: var(--lattix-link);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.14em;
}

a:hover {
  color: var(--lattix-red-dark);
}


/* =========================================================
   3. Layout
   ========================================================= */

.bd-page-width {
  max-width: 1500px;
}

.bd-main,
.bd-content,
.bd-article-container {
  background: var(--lattix-bg);
  color: var(--lattix-text);
}

.bd-main .bd-content .bd-article-container {
  max-width: 920px;
}

.bd-content .bd-article {
  padding-top: 1.25rem;
}

@media (min-width: 992px) {
  .bd-main .bd-content {
    padding-left: 2rem;
    padding-right: 2rem;
  } 
}

@media (max-width: 992px) {
  .bd-main .bd-content {
    padding-left: 1rem;
    padding-right: 1rem;
  } 
}


/* =========================================================
   4. Header / Top Nav
   ========================================================= */

.bd-header.navbar {
  background: var(--lattix-surface);
  border-bottom: 1px solid var(--lattix-border);
  box-shadow: var(--lattix-shadow-soft);
}

.navbar-brand.logo,
.navbar-brand {
  margin-right: 1rem;
}

.navbar-brand img,
.logo__image {
  max-height: 65px;
  width: auto;
}

.navbar-header-items,
.navbar-nav li a {
  font-weight: 600;
}

.navbar-nav > .nav-item > .nav-link,
.bd-header .navbar-nav .nav-link {
  color: var(--lattix-text-strong);
}

.navbar-nav > .nav-item > .nav-link:hover,
.bd-header .navbar-nav .nav-link:hover,
.navbar-nav > .current > .nav-link {
  color: var(--lattix-link);
}

.pst-navbar-icon:hover:before {
  border-bottom: max(3px, .1875rem, .12em) solid var(--lattix-red) !important;
}

.bd-header-article{

  background-color: var(--lattix-header-bar-bg);

}

/* Bring back header on smaller screens */
@media (max-width: 991.98px) {
  .bd-header-article {
    display: block !important;
  }
}


/* =========================================================
   5. Sidebar / Left Rail
   ========================================================= */

.bd-sidebar,
.bd-sidebar-primary,
.bd-sidebar-secondary {
  background: var(--lattix-surface);
  color: var(--lattix-text);
  border-color: var(--lattix-border);
}

.bd-sidebar {
  width: 300px !important;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}

.bd-sidebar::-webkit-scrollbar {
  display: none;
}

.bd-sidebar-primary {
  max-width: 300px !important;
  border-right: 1px solid var(--lattix-border);
}

.sidebar-primary-items__start,
.sidebar-primary-items__end {
  scrollbar-width: none;
  overflow-y: auto;
}

.sidebar-primary-item{
  padding: 0.5rem 0.2rem !important;
}


.sidebar-primary-items__start::-webkit-scrollbar,
.sidebar-primary-items__end::-webkit-scrollbar {
  width: 0;
  height: 0;
}

nav.bd-links {
  margin-right: 0 !important;
}

nav.bd-links .current>a{
  box-shadow: inset max(3px, .1875rem, .12em) 0 0 var(--lattix-red-dark);
}

.bd-sidebar .nav-item {
  min-width: 0;
}

.bd-sidebar .nav-link,
.bd-sidebar li > a,
.sidebar-tree .reference,
.bd-sidebar-primary a.reference.internal {
  color: var(--lattix-text-strong);
  font-family: "Inter", sans-serif;
  font-size: 14px;
}

.bd-sidebar .nav-link {
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: anywhere;
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 6px 10px;
}

.bd-sidebar .nav-link span {
  flex: 1;
  min-width: 0;
}

.bd-sidebar .nav-link:hover,
.bd-sidebar li > a:hover,
.bd-sidebar-primary a.reference.internal:hover {
  color: var(--lattix-link);
  background: color-mix(in srgb, var(--lattix-link) 8%, transparent);
}

.bd-sidebar .active,
.bd-sidebar-primary .current > a,
.bd-sidebar-primary .active > a,
.bd-sidebar-primary li.current > .reference {
  color: var(--lattix-link);
  background: color-mix(in srgb, var(--lattix-link) 8%, transparent);
  font-weight: 700;
}


/* Left rail background */
.bd-sidebar-primary,
.bd-sidebar,
.sidebar-primary-items__start,
.sidebar-primary-items__end {
  background: #f6f7fb;
}

/* Keep dark mode dark */
html[data-theme="dark"] .bd-sidebar-primary,
html[data-theme="dark"] .bd-sidebar,
html[data-theme="dark"] .sidebar-primary-items__start,
html[data-theme="dark"] .sidebar-primary-items__end {
  background: var(--lattix-surface);
}

/* Sidebar active / hover state: light gray instead of light red */
.bd-sidebar .nav-link:hover,
.bd-sidebar li > a:hover,
.bd-sidebar-primary a.reference.internal:hover,
.bd-sidebar .active,
.bd-sidebar-primary .current > a,
.bd-sidebar-primary .active > a,
.bd-sidebar-primary li.current > .reference {
  background: #f6f7fb;
  color: var(--lattix-link);
}

/* Dark mode sidebar hover / active */
html[data-theme="dark"] .bd-sidebar .nav-link:hover,
html[data-theme="dark"] .bd-sidebar li > a:hover,
html[data-theme="dark"] .bd-sidebar-primary a.reference.internal:hover,
html[data-theme="dark"] .bd-sidebar .active,
html[data-theme="dark"] .bd-sidebar-primary .current > a,
html[data-theme="dark"] .bd-sidebar-primary .active > a,
html[data-theme="dark"] .bd-sidebar-primary li.current > .reference {
  background: var(--lattix-surface-soft);
  color: var(--lattix-link);
}

/* Visited links */
a:visited {
  color: var(--lattix-red-dark);
}

html[data-theme="dark"] a:visited {
  color: var(--lattix-red);
}


/* =========================================================
   6. Right Rail / Page TOC
   ========================================================= */

.bd-sidebar-secondary {
  border-left: 1px solid var(--lattix-border);
}

/* Default entry colour matches the left rail */
.toc-entry a.nav-link,
.toc-entry a.nav-link > code,
.page-toc .nav-link {
  color: var(--lattix-text-strong);
  font-family: "Inter", sans-serif;
}

/* Hover: same soft background + link colour as the left rail */
.toc-entry a.nav-link:hover,
.page-toc .nav-link:hover {
  background: #f6f7fb;
  color: var(--lattix-link);
}

html[data-theme="dark"] .toc-entry a.nav-link:hover,
html[data-theme="dark"] .page-toc .nav-link:hover {
  background: var(--lattix-surface-soft);
  color: var(--lattix-link);
}

/* Active: red inset bar + link colour + bold, matching nav.bd-links .current>a */
.toc-entry a.nav-link.active,
.page-toc .nav-link.active,
.toc-entry a.active {
  background: #f6f7fb;
  color: var(--lattix-link);
  font-weight: 700;
  box-shadow: inset max(3px, .1875rem, .12em) 0 0 var(--lattix-red-dark);
}

html[data-theme="dark"] .toc-entry a.nav-link.active,
html[data-theme="dark"] .page-toc .nav-link.active,
html[data-theme="dark"] .toc-entry a.active {
  background: var(--lattix-surface-soft);
}


/* =========================================================
   7. Search
   ========================================================= */

.search-button__wrapper,
.search-button-field {
  margin-left: auto;
}

.search-button-field:hover {
  box-shadow: 0 0 0 .1875rem var(--lattix-red);
}

.bd-search,
.search-button,
.search-button__button,
input[type="search"],
#search-input,
.search-button__input {
  background: var(--lattix-surface-soft);
  color: var(--lattix-text-strong);
  border-color: var(--lattix-border);
}

#search-input,
.search-button__input {
  border-radius: 999px;
  border: 1px solid var(--lattix-border);
  box-shadow: none;
}

#search-input:focus,
.search-button__input:focus {
  border-color: var(--lattix-link);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lattix-link) 18%, transparent);
}

input[type="search"]::placeholder {
  color: var(--lattix-text-soft);
}


/* =========================================================
   8. Tables / Code / Admonitions
   ========================================================= */

article.bd-article table {
  border-radius: 14px;
  overflow: hidden;
}

.table thead tr{
  border-bottom: 2px solid var(--lattix-red-dark);  

}

article.bd-article thead th {
  background: var(--lattix-navy);
  color: var(--lattix-heading);
  border-color: var(--lattix-navy);
}

article.bd-article tbody tr:nth-child(even) {
  background: var(--lattix-table-odd-row);
}

article.bd-article tbody tr:nth-child(odd) {
  background: var(--lattix-table-even-row) !important;
}

.table tbody tr:hover {
    background-color: var(--lattix-table-row-hover-bg);
}

article.bd-article code {
  color: var(--lattix-red-dark);
  background: color-mix(in srgb, var(--lattix-link) 10%, transparent);
  border-radius: 0.375rem;
  padding: 0.12rem 0.35rem;
}

article.bd-article div.highlight,
article.bd-article pre {
  border-radius: 14px;
  border: 1px solid var(--lattix-border);
  box-shadow: var(--lattix-shadow-soft);
}

.admonition,
div.admonition,
details.sd-dropdown {
  background: var(--lattix-surface);
  border: 1px solid var(--lattix-border);
  border-radius: 16px;
  box-shadow: var(--lattix-shadow-soft);
}

.admonition-title,
div.admonition > .admonition-title {
  background: color-mix(in srgb, var(--lattix-link) 8%, transparent);
  color: var(--lattix-text-strong);
  font-weight: 700;
}

.table > thead > tr > th > p {
color: var(--lattix-table-text);

}


/* =========================================================
   9. Cards / Homepage Tiles
   ========================================================= */

.card,
.sd-card,
.explore-card,
.quick-link-card {
  background: var(--lattix-surface);
  border: 1px solid var(--lattix-border);
  color: var(--lattix-text);
}

.card h3,
.sd-card-title,
.explore-card h3 {
  color: var(--lattix-heading);
}


.lattix-homepage {
  max-width: 980px;
}

.lattix-hero {
  margin-bottom: 2.5rem;
}

.lattix-hero__intro {
  max-width: 760px;
  font-size: 1.1rem;
}

.lattix-hero__actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.lattix-doc-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.lattix-doc-card {
  display: block;
  padding: 1.1rem;
  border: 1px solid var(--lattix-border);
  border-radius: 14px;
  background: var(--lattix-surface);
  color: var(--lattix-text);
  text-decoration: none;
  transition: all 0.2s ease;
}

.lattix-doc-card:hover {
  transform: translateY(-2px);
  border-color: var(--lattix-link);
  box-shadow: var(--lattix-shadow-soft);
}

.lattix-doc-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 0.9rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--lattix-link) 12%, transparent);
  color: var(--lattix-link);
  font-weight: 700;
}

.lattix-doc-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
  color: var(--lattix-heading);
}

.lattix-doc-card p {
  margin: 0 0 0.8rem;
  font-size: 0.9rem;
}

.lattix-doc-card__link {
  color: var(--lattix-link);
  font-weight: 700;
}

.lattix-popular-guides {
  margin-top: 2.5rem;
}

.lattix-guide-list {
  border: 1px solid var(--lattix-border);
  border-radius: 14px;
  overflow: hidden;
}

.lattix-guide-list a {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: 1rem;
  padding: 0.9rem 1rem;
  color: var(--lattix-text);
  text-decoration: none;
  border-bottom: 1px solid var(--lattix-border);
}

.lattix-guide-list a:last-child {
  border-bottom: 0;
}

.lattix-guide-list a:hover {
  background: var(--lattix-surface-soft);
}

.lattix-guide-list strong {
  color: var(--lattix-heading);
}

.lattix-guide-list em {
  color: var(--lattix-link);
  font-style: normal;
}

@media (max-width: 1100px) {
  .lattix-doc-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .lattix-doc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lattix-guide-list a {
    grid-template-columns: 1fr auto;
  }

  .lattix-guide-list span {
    grid-column: 1 / -1;
  }
}

@media (max-width: 540px) {
  .lattix-doc-grid {
    grid-template-columns: 1fr;
  }
}


/* =========================================================
   10. Buttons / CTAs
   ========================================================= */

button,
.btn,
a.btn,
.sd-btn,
.button {
  border-radius: 999px;
  font-weight: 700;
  font-family: "Inter", sans-serif;
}

.button,
.btn-primary,
a.btn-primary,
.sd-btn-primary {
  background: var(--lattix-cta);
  border-color: var(--lattix-cta);
  color: #ffffff;
  padding: 10px 18px;
  transition: all 0.2s ease;
}

.button:hover,
.btn-primary:hover,
a.btn-primary:hover,
.sd-btn-primary:hover {
  background: var(--lattix-cta-hover);
  border-color: var(--lattix-cta-hover);
  color: #ffffff;
}

.btn-outline-primary,
.sd-btn-outline-primary {
  background: transparent;
  border-color: var(--lattix-cta);
  color: var(--lattix-cta);
  padding: 10px 18px;
}

.btn-outline-primary:hover,
.sd-btn-outline-primary:hover {
  background: color-mix(in srgb, var(--lattix-cta) 10%, transparent);
  color: var(--lattix-cta-hover);
}


/* =========================================================
   11. Breadcrumbs Injected by custom.js
   ========================================================= */

.lattix-breadcrumbs {
  margin: 1rem 0 1rem;
  font-size: 0.92rem;
  color: var(--lattix-text-soft);
}

.lattix-breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0;
  margin: 0;
}

.lattix-breadcrumbs li::after {
  content: "/";
  margin-left: 0.35rem;
  color: var(--lattix-text-soft);
}

.lattix-breadcrumbs li:last-child::after {
  content: "";
  margin: 0;
}

.lattix-breadcrumbs a {
  color: var(--lattix-text-soft);
  text-decoration: none;
}

.lattix-breadcrumbs a:hover {
  color: var(--lattix-link);
  text-decoration: underline;
}


/* =========================================================
   12. Optional Top Links Injected by custom.js
   ========================================================= */

.lattix-top-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: 1rem;
}

.lattix-top-links a {
  color: var(--lattix-text-strong);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.lattix-top-links a:hover {
  color: var(--lattix-link);
}


/* =========================================================
   13. Footer
   ========================================================= */

.bd-footer,
.footer {
  border-top: 1px solid var(--lattix-border);
  background: var(--lattix-surface);
  color: var(--lattix-text);
}


/* =========================================================
   14. Responsive
   ========================================================= */

@media (max-width: 991.98px) {
  .lattix-top-links {
    display: none;
  }

  .logo__image,
  .navbar-brand img {
    max-height: 30px;
  }

  article.bd-article h1 {
    font-size: 1.9rem;
  }
}
