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

.bd-sidebar-primary {
  background-color: var(--pst-color-background);
  border-right: 1px solid var(--pst-color-border);
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  font-size: var(--pst-sidebar-font-size-mobile);
  gap: 1rem;
  max-height: calc(100vh - var(--pst-header-height));
  overflow-y: auto;
  padding: 2rem 1rem 1rem;
  position: sticky;
  top: var(--pst-header-height);
  width: 15%;
  max-width: 300px;
}

.bd-main .bd-content .bd-article-container {
  display: flex;
  flex-direction: column;
  justify-content: start;
  max-width: none;
  overflow-x: auto;
  padding: 1rem;
  width: 100%;
}

.bd-page-width {
  max-width: 100%; 
}

.bd-article-container h1:first-of-type {
  text-align: center;
}

body {
  font-family: var(--pst-font-family-sans-serif);
  background-color: var(--pst-color-background);
  color: var(--pst-color-text-base);
  line-height: 1.6;
}

/* CODE BLOCKS (Unified Styling) */
pre {
  background-color: var(--pst-color-inline-code-background) !important;
  color: var(--pst-color-text-base) !important;
  border: 1px solid var(--pst-color-border) !important;
  padding: 16px !important;
  border-radius: 8px !important;
  font-family: var(--pst-font-family-monospace);
  font-size: 0.9rem;
  overflow-x: auto;
  margin: 1rem 0;
}

code {
  font-family: var(--pst-font-family-monospace);
  color: var(--pst-color-text-base);
}

footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.9rem;
  color: var(--pst-color-text-muted);
}

/* SPHINX LAYOUT OVERRIDES (Keep these for full-width landing) */
body.pagename-index .bd-sidebar { display: none !important; }
body.pagename-index .bd-toc { display: none !important; }
body.pagename-index .bd-main { grid-template-columns: 1fr !important; }
body.pagename-index .bd-content { max-width: 100% !important; }
body.pagename-index h1 { text-align: center; font-size: 4rem; margin-bottom: 0.5rem; }

/* INDEX PAGE STYLES */
.index-subtitle {
  text-align: center;
  font-size: 1.25rem;
  color: var(--pst-color-text-muted);
  margin-bottom: 4rem;
}

.index-about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 3rem;
  align-items: center;
  margin-bottom: 4rem;
}

.about-viz {
  /* Always use flex layout for main area so sidebar and content share space */
  .bd-main {
    display: flex;
    flex-direction: row;
    width: 100vw;
    box-sizing: border-box;
    min-width: 0;
  }
  .bd-sidebar-primary {
    flex: 0 0 auto;
  }
  .bd-content {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100vw;
    overflow-x: auto;
    display: block;
  }
  align-items: center;
  justify-content: center;
}

.about-viz-inner img {
  display: block;
  height: auto;
  max-width: 100%;
}

html[data-theme="dark"] .about-viz-inner img {
  background-color: transparent !important;
}

/* Section divider */
.section-divider {
  border: 0;
  border-top: 1px solid var(--pst-color-border);
}

/* Installation section */
.installation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.install-card {
  background: var(--install-card-bg);
  border: 1px solid var(--install-card-border, rgb(178, 175, 175));
  border-radius: 12px;
  padding: 1rem;
}

.install-card-title {
  margin-top: 0;
  font-size: 1.3rem;
  font-weight: 700; 
}

.install-label {
  background: var(--install-card-bg);
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

.install-box-single {
  margin-bottom: 0.75rem;
}

.install-box-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.install-box-multi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.install-code-block {
  display: block;
  width: 100%;
  padding-right: 4.5rem;
}

/* Learn More section */
.learn-more-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.learn-more-card-link {
  background: var(--pst-color-surface);
  border: 1px solid var(--pst-color-border);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
}

.learn-more-card-link a {
  color: var(--pst-color-text-base);
  text-decoration: none;
  display: block;
  font-size: 2rem;
  font-weight: 700;  
}

.learn-more-card-desc {
  background: var(--pst-color-background);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--pst-color-text-muted);
}

/* References section */
.index-reference-box {
  background-color: var(--pst-color-surface);
  border-left: 5px solid var(--pst-color-primary);
  padding: 20px;
  font-size: 14px;
  line-height: 1.6;
  border-radius: 0 8px 8px 0;
  margin: 1.5rem 0;
}

@media (max-width: 950px) {
  .index-about-grid,
  .installation-grid,
  .learn-more-grid {
    grid-template-columns: 1fr;
  }
  
  .learn-more-grid {
    grid-template-rows: repeat(4, 1fr);
  }
  /* Make sidebar wider on narrow screens */
  .bd-sidebar-primary {
    width: 45vw;
    min-width: 800px;
    max-width: 100vw;
  }
}
