/* ============================================
   PREVENT HORIZONTAL SCROLL
   ============================================ */
html {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  overflow-x: hidden;
  max-width: 100vw;
  position: relative;
}

/* ============================================
   FONTS - SELF-HOSTED
   ============================================ */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  src: url('/fonts/inter/Inter-Light.woff2') format('woff2');
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  src: url('/fonts/inter/Inter-Regular.woff2') format('woff2');
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  src: url('/fonts/inter/Inter-Medium.woff2') format('woff2');
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  src: url('/fonts/inter/Inter-SemiBold.woff2') format('woff2');
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  src: url('/fonts/inter/Inter-Bold.woff2') format('woff2');
  font-display: swap;
}


/* ============================================
   REPORT SECTION - BASE STYLES
   ============================================ */
.report-section {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 20px;
  line-height: 1.6;
  color: #2e3338;
  position: relative;
  min-height: 100vh;
  padding-top: 0;
  padding-bottom: 80px;
}

.report-content-wrapper {
  padding: 0 40px 20px 40px;
}


/* ============================================
   REPORT SECTION - TYPOGRAPHY
   ============================================ */
/* Obsidian-style headings with proper scale and weight */
.report-section h1 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 2em;
  font-weight: 700;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.3;
}

.report-section h2 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1.65em;
  font-weight: 700;
  margin-top: 1.3em;
  margin-bottom: 0.5em;
  line-height: 1.3;
}

.report-section h3 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1.37em;
  font-weight: 700;
  margin-top: 1.2em;
  margin-bottom: 0.5em;
  line-height: 1.3;
}

.report-section h4 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1.15em;
  font-weight: 700;
  margin-top: 1em;
  margin-bottom: 0.5em;
  line-height: 1.4;
}

.report-section h5 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1em;
  font-weight: 700;
  margin-top: 1em;
  margin-bottom: 0.5em;
  line-height: 1.4;
}

.report-section h6 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.9em;
  font-weight: 700;
  margin-top: 1em;
  margin-bottom: 0.5em;
  line-height: 1.4;
  color: #666;
}

.report-section p {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 400;
  margin-bottom: 1em;
}

.report-section strong {
  font-weight: 600;
}

.report-section code {
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;
}


/* ============================================
   TABLE OF CONTENTS - DRAWER (ALL SCREENS)
   ============================================ */

   /* TOC Toggle Button */
   .toc-toggle-button {
     position: fixed;
     top: 80px;
     left: 20px;
     z-index: 1001;
     background-color: #5b7ff5;
     color: white;
     border: none;
     border-radius: 8px;
     padding: 12px 20px;
     font-size: 16px;
     font-weight: 600;
     cursor: pointer;
     box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
     transition: all 0.3s ease;
     font-family: 'Inter', sans-serif;
   }

   .toc-toggle-button:hover {
     background-color: #4a6fd4;
     transform: translateY(-2px);
     box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
   }

   .toc-toggle-button i {
     margin-right: 8px;
   }

   /* Mobile: Position button in top menu bar - perfectly centered */
   @media (max-width: 991px) {
     .toc-toggle-button {
       position: fixed;
       top: 8px;           /* Fine-tuned for your menu */
       left: auto;
       right: 70px;
       transform: translateY(0);
       padding: 8px 14px;
       font-size: 14px;
       border-radius: 6px;
     }
   }

   /* Tablet and larger: Keep floating position */
   @media (min-width: 992px) {
     .toc-toggle-button {
       top: 100px;
       left: 20px;
     }
   }

/* TOC Overlay (darkens background) */
.toc-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.toc-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* TOC Drawer */
.toc-drawer {
  position: fixed;
  top: 0;
  left: -320px;
  width: 300px;
  height: 100vh;
  background-color: white;
  z-index: 1101;
  overflow-y: auto;
  transition: left 0.3s ease;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.toc-drawer.active {
  left: 0;
}

.toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
  background-color: #f8f9fa;
  position: sticky;
  top: 0;
  z-index: 10;
}

.toc-header h4 {
  margin: 0;
  font-size: 1.2em;
  font-weight: 700;
  color: #333;
  font-family: 'Inter', sans-serif;
}

.toc-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.toc-close:hover {
  color: #333;
}

.toc-content {
  padding: 20px;
}

.toc-content ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.toc-content ul ul {
  padding-left: 15px;
  margin-top: 8px;
}

.toc-content li {
  margin-bottom: 10px;
}

.toc-content a {
  color: #555;
  text-decoration: none;
  font-size: 15px;
  line-height: 1.6;
  display: block;
  padding: 6px 0;
  transition: color 0.2s;
  font-family: 'Inter', sans-serif;
}

.toc-content a:hover {
  color: #5b7ff5;
  font-weight: 500;
}

/* Scrollbar for TOC Drawer */
.toc-drawer::-webkit-scrollbar {
  width: 6px;
}

.toc-drawer::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.toc-drawer::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.toc-drawer::-webkit-scrollbar-thumb:hover {
  background: #999;
}


/* ============================================
   IMAGES & CAPTIONS
   ============================================ */
.report-image {
  margin: 20px 0;
}

.report-image img {
  display: block;
  width: 100%;
  height: auto;
}

.image-caption {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f5f5f5;
  padding: 12px 16px;
  margin-top: 0;
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  text-align: center;
}

.image-caption a {
  color: #5b7ff5;
  text-decoration: none;
}

.image-caption a:hover {
  text-decoration: underline;
}


/* ============================================
   TL;DR COLLAPSIBLE SECTION
   ============================================ */
.tldr-container {
  margin: 40px 0;
  border: 2px solid #5b7ff5;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(to bottom,
    rgba(91, 127, 245, 0.05) 0%,
    rgba(91, 127, 245, 0.02) 100%);
}

.tldr-header {
  position: relative;
  padding: 25px 30px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.3s ease;
}

.tldr-header:hover {
  background-color: rgba(91, 127, 245, 0.08);
}

.tldr-title {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.8em;
  font-weight: 700;
  color: #5b7ff5;
  font-family: 'Inter', sans-serif;
}

.tldr-icon {
  font-size: 0.7em;
  transition: transform 0.3s ease;
  color: #5b7ff5;
}

.tldr-header.active .tldr-icon {
  transform: rotate(180deg);
}

.tldr-preview {
  margin-top: 15px;
  font-size: 16px;
  color: #666;
  font-style: italic;
  line-height: 1.6;
  opacity: 0.8;
}

.tldr-header.active .tldr-preview {
  display: none;
}

.tldr-content {
  padding: 0 30px 30px 30px;
  animation: slideDown 0.3s ease-out;
}

.tldr-content p:first-child {
  margin-top: 0;
}

.tldr-content p:last-child {
  margin-bottom: 0;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 2000px;
  }
}

/* TL;DR Custom Tooltip */
.tldr-header::before {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background-color: rgba(51, 51, 51, 0.95);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 400;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1000;
  font-family: 'Inter', sans-serif;
}

.tldr-header::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-2px);
  border: 6px solid transparent;
  border-top-color: rgba(51, 51, 51, 0.95);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.tldr-header:hover::before,
.tldr-header:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ============================================
   CONTACT SECTION
   ============================================ */
.contact-section {
  padding: 80px 0;
  margin-top: 80px;
  background-color: #f8f9fa;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.05);
}

.contact-section h2 {
  font-family: 'Inter', sans-serif;
  font-size: 2.5em;
  font-weight: 700;
  color: #333;
  margin-bottom: 30px;
}

.contact-content p {
  font-family: 'Inter', sans-serif;
  color: #555;
}

.contact-button {
  display: inline-block;
  padding: 15px 40px;
  background-color: #5b7ff5;
  color: white !important;
  text-decoration: none;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
}

.contact-button:hover {
  background-color: #4a6fd4;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(91, 127, 245, 0.3);
}

.contact-button i {
  margin-left: 8px;
}

/* ============================================
   RESPONSIVE TABLES - FIXED
   ============================================ */

/* Force report section to never exceed viewport */
.report-section {
  max-width: 100vw;
  overflow-x: hidden;
}

.report-content-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 20px 20px; /* Add horizontal padding on mobile */
  box-sizing: border-box;
  overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Table wrapper - CRITICAL FIX */
.responsive-table-wrapper {
  margin: 30px 0;
  width: 100%;
  max-width: 100%; /* Never exceed parent */
  overflow: hidden; /* Clip children */
}

/* Table scroll container - THIS IS KEY */
.table-scroll {
  width: 100%;
  max-width: 100%; /* Never exceed viewport */
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
  position: relative; /* Create containing block */
}

/* Table itself */
.report-section table {
  width: auto; /* Don't force 100% width */
  min-width: 600px; /* Minimum before scroll */
  max-width: none; /* Allow table to be wider than container */
  border-collapse: collapse;
  font-size: 14px;
  background-color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin: 0; /* Remove any margins */
}

/* Remove sticky positioning on mobile - it causes issues */
@media (max-width: 768px) {
  .report-section table td:first-child,
  .report-section table th:first-child {
    position: static; /* Remove sticky on mobile */
  }

  .report-section table {
    font-size: 12px;
    min-width: 500px;
  }

  .report-content-wrapper {
    padding: 0 10px 20px 10px; /* Less padding on mobile */
  }
}

/* Rest of table styling stays the same */
.report-section table thead {
  background-color: #f8f9fa;
  border-bottom: 2px solid #5b7ff5;
}

.report-section table th {
  padding: 12px 15px;
  text-align: left;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #dee2e6;
  white-space: nowrap;
}

.report-section table td {
  padding: 10px 15px;
  border-bottom: 1px solid #dee2e6;
  vertical-align: top;
  line-height: 1.5;
}

.report-section table tbody tr:nth-child(even) {
  background-color: #f8f9fa;
}

.report-section table tbody tr:hover {
  background-color: #e9ecef;
  transition: background-color 0.2s ease;
}

/* Scrollbar styling */
.table-scroll::-webkit-scrollbar {
  height: 8px;
}

.table-scroll::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: #5b7ff5;
  border-radius: 4px;
}

.table-scroll::-webkit-scrollbar-thumb:hover {
  background: #4a6fd4;
}


/* ============================================
   UTILITIES / OVERRIDES - KEEP AT END
   ============================================ */
/* Fix scroll position for anchors with fixed header */
html {
  scroll-padding-top: 100px;
}

/* For browsers that don't support scroll-padding-top */
:target::before {
  content: "";
  display: block;
  height: 100px;
  margin-top: -100px;
  visibility: hidden;
}
