/* ===== DeepDive Layout (Desktop) ===== */
.deepdive-container {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.content-area {
  flex: 1;
  min-width: 0;
  padding-left: 10px;
  line-height: 1.7;
  color: #333;
}

/* ===== Dynamic Content ===== */
#loadedContent {
  max-width: 100%;
  word-wrap: break-word;
}

#loadedContent img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 10px auto;
  border-radius: 8px;
}

/* ===== TOC Toggle Button ===== */
#toggleTocBtn {
  display: none;
  background: #e57c1f;
  color: #fff;
  border: none;
  padding: 10px 16px;
  font-size: 15px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 12px;
  width: 100%;
  text-align: center;
  transition: background 0.3s ease, transform 0.2s ease;
  z-index: 10;
  position: relative;
}

#toggleTocBtn:hover {
  background: #cf6d15;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
  .deepdive-container {
    flex-direction: column;
    align-items: center;
    padding: 10px;
  }

  #toggleTocBtn {
    display: block;
  }

  /* ===== TOC Hidden by Default ===== */
  .toc {
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 0 10px;
    background: #fff;
    margin-top: 0;
    position: relative;
    z-index: 9999;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* ===== TOC Visible (Slide + Fade) ===== */
  .toc.visible {
    max-height: 70vh;
    opacity: 1;
    padding: 10px;
    margin-top: 10px;
    overflow-y: auto;
    overscroll-behavior: contain;   /* prevent page scroll underneath */
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  }

  .content-area {
    width: 100%;
    padding: 0;
  }

  #loadedContent img {
    width: 95%;
    max-width: 350px;
  }

  #loadedContent p {
    font-size: 14px;
  }
}

/* ===== Extra Small Screens ===== */
@media (max-width: 480px) {
  #loadedContent img {
    width: 100%;
    max-width: 300px;
  }

  #loadedContent p {
    font-size: 13px;
  }

 
}
#backToTopBtn {
  position: fixed;
  bottom: 20px;
  right: 25px;
  background-color: #4CAF50;   /* same green color */
  border: none;
  border-radius: 8px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.2s ease, background-color 0.3s;
  z-index: 1200;
}

#backToTopBtn.show {
  opacity: 1;
  pointer-events: auto;
}

#backToTopBtn:hover {
  background-color: #3e8e41;   /* darker hover green */
  transform: translateY(-2px);
}

#backToTopBtn svg {
  width: 20px;
  height: 20px;
  fill: #ffffff;              /* ✅ solid white arrow */
}

@media (max-width: 768px) {
  #backToTopBtn {
    bottom: 70px;
    right: 16px;
    width: 44px;
    height: 44px;
  }
}

/* ===== FIX: Remove extra white space under header ===== */

/* Ensure body and main sections start at the top */
body {
  margin: 0;
  padding: 0;
  background-color: #fff;
}

/* Remove any unintended space between header and Deep Dive section */
main, 
.deepdive-container {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Make sure the DeepDive content starts right below sticky header */
.deepdive-container {
  margin-top: calc(var(--header-offset, 70px) * 0);
}

/* Optional fine-tune: if header overlaps the content slightly */
header.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Prevent main section from adding top gaps */
#main {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Keep the background clean */
.deepdive-container {
  background-color: #fff;
}

/* If using container padding in Bootstrap-like structure, reduce it */
.container[data-aos="fade-up"] {
  padding-top: 0 !important;
  margin-top: 0 !important;
}
/* ===== ALIGN TOC AND CONTENT ===== */

/* Make sure both TOC and content align evenly under the sticky header */
.deepdive-container {
  display: flex;
  align-items: flex-start;
  margin-top: 0 !important;
  padding-top: 0 !important;
  background: #fff;
}

/* Align the inner blocks (TOC + Content) at the same height */
.toc, 
.content-area {
  margin-top: 0 !important;
  padding-top: 0 !important;
  vertical-align: top;
}

/* Optional: Add subtle border to visually separate columns */
@media (min-width: 769px) {
  .toc {
    border-right: 1px solid #eee;
    padding-right: 15px;
  }

  .content-area {
    padding-left: 20px;
  }
}

/* Ensure no top spacing added by .container or AOS wrapper */
.container[data-aos="fade-up"] {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Make TOC heading and content top-aligned */
.toc h2 {
  margin-top: 0;
  padding-top: 0;
}

/* For smaller devices, keep the flow vertical but aligned */
@media (max-width: 768px) {
  .toc, 
  .content-area {
    border: none;
    padding: 0;
    margin: 0;
  }

  .toc h2 {
    margin-top: 8px;
  }
}
