/* Custom styles to match main site */
:root {
  --kai-blue: #2563EB;
  --kai-blue-dark: #1e40af;
  --kai-gray: #64748B;
  --kai-text: #0F172A;
}

/* Match main site fonts */
body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 18px;
  line-height: 1.7;
}

/* Navigation styling - Light mode */
.navbar {
  background-color: white !important;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--kai-text) !important;
}

/* Navigation styling - Dark mode */
.quarto-dark .navbar {
  background-color: #0f172a !important;
  border-bottom: 1px solid #334155 !important;
}

.quarto-dark .navbar-brand,
.quarto-dark .navbar .nav-link {
  color: #F8FAFC !important;
}

.quarto-dark .navbar .nav-link:hover {
  color: #60A5FA !important;
}

/* Search bar dark mode */
.quarto-dark #quarto-search {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

.quarto-dark .aa-Input {
  background-color: #1e293b !important;
  color: #F8FAFC !important;
}

/* Button styling to match main site */
.btn-primary {
  background-color: var(--kai-blue);
  border-color: var(--kai-blue);
  padding: 0.5rem 1.5rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary:hover {
  background-color: var(--kai-blue-dark);
  border-color: var(--kai-blue-dark);
}

/* Code blocks */
pre {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
}

.quarto-dark pre {
  background: #1e293b !important;
  border-color: #475569 !important;
}

/* Sidebar styling - Light mode */
.sidebar {
  background-color: #f8fafc;
  border-right: 1px solid #e5e7eb;
}

/* Sidebar styling - Dark mode */
.quarto-dark .sidebar,
.quarto-dark .sidebar-navigation {
  background-color: #1e293b !important;
  border-right: 1px solid #334155 !important;
}

.quarto-dark .sidebar .sidebar-item a {
  color: #F8FAFC !important;
}

.quarto-dark .sidebar .sidebar-item a:hover {
  color: #60A5FA !important;
}

/* Table of Contents - Light mode */
#TOC {
  background-color: #f8fafc;
  border-left: 1px solid #e5e7eb;
}

/* Table of Contents - Dark mode */
.quarto-dark #TOC {
  background-color: #1e293b !important;
  border-left: 1px solid #334155 !important;
}

.quarto-dark #TOC .nav-link {
  color: #F8FAFC !important;
}

.quarto-dark #TOC .nav-link:hover,
.quarto-dark #TOC .nav-link.active {
  color: #60A5FA !important;
}

/* Right margin sidebar (TOC) - Dark mode - HIGHEST SPECIFICITY */
body.quarto-dark #quarto-margin-sidebar,
body.quarto-dark .margin-sidebar,
body.quarto-dark #TOC {
  background-color: #1e293b !important;
  color: #F8FAFC !important;
}

body.quarto-dark #TOC .nav-link,
body.quarto-dark #quarto-margin-sidebar .nav-link {
  color: #F8FAFC !important;
}

body.quarto-dark #TOC .nav-link:hover,
body.quarto-dark #quarto-margin-sidebar .nav-link:hover {
  color: #60A5FA !important;
}

body.quarto-dark #TOC .nav-link.active,
body.quarto-dark #quarto-margin-sidebar .nav-link.active {
  color: #60A5FA !important;
  border-left-color: #60A5FA !important;
}

body.quarto-dark #quarto-margin-sidebar .toc-actions a {
  color: #F8FAFC !important;
}

/* Cards */
.card {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Dark mode adjustments for cards */
.quarto-dark .card {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

/* Grid spacing */
.grid {
  gap: 1.5rem;
  margin: 2rem 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* Dark mode text colors */
.quarto-dark h1,
.quarto-dark h2,
.quarto-dark h3,
.quarto-dark h4,
.quarto-dark h5,
.quarto-dark h6 {
  color: #F8FAFC !important;
}

/* Responsive */
@media (max-width: 768px) {
  .navbar-brand {
    font-size: 1.1rem;
  }
}

/* ======================================
   Mobile Screenshot Styling
   ====================================== */

/* Screenshot container wrapper */
.screenshot-container {
  max-width: 450px;
  width: 100%;
  margin: 2rem auto;
  display: block;
  text-align: center;
}

/* Mobile screenshot image styling */
.mobile-screenshot {
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -1px rgb(0 0 0 / 0.06);
  transition: box-shadow 0.3s ease;
}

/* Dark mode shadow adjustment */
.quarto-dark .mobile-screenshot {
  box-shadow: 0 4px 6px -1px rgb(255 255 255 / 0.05), 0 2px 4px -1px rgb(255 255 255 / 0.03);
  border: 1px solid rgb(255 255 255 / 0.1);
}

@media (prefers-color-scheme: dark) {
  .mobile-screenshot {
    box-shadow: 0 4px 6px -1px rgb(255 255 255 / 0.05), 0 2px 4px -1px rgb(255 255 255 / 0.03);
    border: 1px solid rgb(255 255 255 / 0.1);
  }
}

/* Hover effect for desktop */
@media (min-width: 641px) {
  .mobile-screenshot:hover {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
  }

  .quarto-dark .mobile-screenshot:hover {
    box-shadow: 0 10px 15px -3px rgb(255 255 255 / 0.08), 0 4px 6px -2px rgb(255 255 255 / 0.05);
  }

  @media (prefers-color-scheme: dark) {
    .mobile-screenshot:hover {
      box-shadow: 0 10px 15px -3px rgb(255 255 255 / 0.08), 0 4px 6px -2px rgb(255 255 255 / 0.05);
    }
  }
}

/* Mobile responsive behavior */
@media (max-width: 640px) {
  .screenshot-container {
    max-width: 375px;
    padding: 0 1rem;
    margin: 1.5rem auto;
  }
}

/* ======================================
   Workflow Sequence Layout
   ====================================== */

/* Workflow sequence container */
.workflow-sequence {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  margin: 2rem 0;
  padding: 0;
}

/* Individual workflow step */
.workflow-step {
  margin: 0;
  padding: 0;
  flex: 0 1 auto;
  max-width: 400px;
  text-align: center;
}

/* Screenshot within workflow sequence */
.workflow-step .screenshot-container {
  max-width: 400px;
  margin: 0 auto;
}

/* Caption styling for workflow steps */
.workflow-step figcaption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: rgb(107 114 128);
  text-align: center;
}

.quarto-dark .workflow-step figcaption {
  color: rgb(156 163 175);
}

@media (prefers-color-scheme: dark) {
  .workflow-step figcaption {
    color: rgb(156 163 175);
  }
}

/* Step number styling */
.workflow-step .step-number {
  font-weight: 600;
  color: var(--kai-blue);
}

.quarto-dark .workflow-step .step-number {
  color: #60A5FA;
}

@media (prefers-color-scheme: dark) {
  .workflow-step .step-number {
    color: #60A5FA;
  }
}

/* Mobile responsive - stack vertically */
@media (max-width: 640px) {
  .workflow-sequence {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    margin: 1.5rem 0;
  }

  .workflow-step {
    max-width: 375px;
  }

  .workflow-step .screenshot-container {
    max-width: 375px;
    padding: 0 1rem;
  }
}

/* Tablet - allow 2 columns if space permits */
@media (min-width: 641px) and (max-width: 1024px) {
  .workflow-sequence {
    gap: 1rem;
  }

  .workflow-step {
    flex: 0 1 calc(50% - 0.5rem);
    min-width: 300px;
  }
}

/* ======================================
   Grid Layout
   ====================================== */

/* Grid layout container for multiple screenshots */
.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 400px));
  gap: 2rem;
  justify-content: center;
  margin: 2rem 0;
  padding: 0;
}

/* Optional: Grid item wrapper for captions */
.screenshot-item {
  text-align: center;
  margin: 0;
  padding: 0;
}

.screenshot-item .mobile-screenshot {
  width: 100%;
  height: auto;
}

.screenshot-item figcaption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: rgb(107 114 128);
  text-align: center;
}

.quarto-dark .screenshot-item figcaption {
  color: rgb(156 163 175);
}

@media (prefers-color-scheme: dark) {
  .screenshot-item figcaption {
    color: rgb(156 163 175);
  }
}

/* Mobile responsive - single column */
@media (max-width: 640px) {
  .screenshot-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    margin: 1.5rem 0;
  }
}

/* Tablet - 2 columns if space permits */
@media (min-width: 641px) and (max-width: 1024px) {
  .screenshot-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 350px));
    gap: 1.5rem;
  }
}
