/* General Styles */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* Header height adjustment */
}

/* Typography */
p {
  text-indent: 0; /* All p tags default to no indent */
  line-height: 1.6;
}

/* Indent first line of the first p element immediately following an h3 */
/* h3 + p {
  text-indent: 1.2em;
}


h4 + p {
  text-indent: 1.2em;
}



h2 + p {
  text-indent: 1.2em;
}


h2 {
  margin-bottom: 30px !important;
}

h3 {
  text-indent: 0.8em; 
  margin-bottom: 30px !important;
}

h4 {
  text-indent: 1em; 
  margin-bottom: 20px !important;
} */

/* Figure (Table/Image) Caption and Source Styling */
figure figcaption.tit {
  font-size: 0.9em; /* Smaller than body, but prominent for a title */
  font-weight: bold;
  text-align: center;
  margin-bottom: 10px; /* Space between title and table/image */
}

figure figcaption.tit em { /* For "표 1", "그림 1" part */
  font-style: normal; /* Removes italics if not desired */
  margin-right: 5px;
  display: inline; /* Keep inline for desktop */
}

figure .table-responsive {
  margin-top: 0;
  margin-bottom: 0;
}

table th,
table td {
  font-size: 0.85em; /* Smaller than figcaption.tit, addressing "표 안의 텍스트가 더 커요" */
  padding: 8px; /* Example padding, adjust as needed */
  /* text-align is usually handled by bootstrap or specific table classes */
}

figure .txt { /* For source text below tables/images: "출처", "자료" */
  font-size: 0.75em; /* Smallest text on the page */
  color: #555;
  text-align: center; /* Centered source text */
  margin-top: 10px;
  display: block; /* Ensures it takes its own line if not already */
}

/* Mobile-specific styles for figure spacing */
@media only screen and (max-width: 767px) {
  figure figcaption.tit {
    margin-bottom: 20px !important; /* Increased space between title and image on mobile */
    padding: 15px 10px !important; /* Add padding for better visual breathing room */
    line-height: 1.6; /* Better line spacing */
    text-align: center !important; /* Ensure center alignment */
    display: block !important;
  }

  /* Make em tag display on new line in mobile - match PC style */
  figure figcaption.tit em,
  .con_img .tit em {
    display: block !important; /* Block to force new line and center alignment */
    font-style: normal !important;
    height: 36px !important; /* Same as PC */
    line-height: 36px !important; /* Same as PC */
    padding: 0 12px !important; /* Same as PC */
    background-color: #3266b3 !important; /* Same blue as PC */
    border-radius: 10px !important; /* Same rounded corners as PC */
    color: #fff !important; /* White text like PC */
    margin: 0 auto 12px auto !important; /* Center horizontally with bottom margin */
    width: fit-content !important; /* Only as wide as content */
    width: -moz-fit-content !important; /* Firefox support */
  }
}

  figure .txt {
    margin-top: 15px !important; /* Increased space between image and source text on mobile */
    padding-top: 5px !important; /* Additional padding for better visual separation */
    line-height: 1.5;
  }

  /* Ensure adequate spacing for con_img wrapper on mobile */
  .con_img {
    padding: 25px 15px !important; /* Adjusted padding for mobile */
    margin-bottom: 20px;
  }

  .con_img .img {
    margin-top: 20px !important; /* More space between caption and image */
    margin-bottom: 10px !important; /* Add some bottom margin */
  }
}

/* Footnote Styling */
.footnote-link {
  text-decoration: none;
  color: blue;
  vertical-align: super; /* Superscript for footnote markers */
  font-size: smaller;   /* Smaller font for footnote markers */
}

.footnote-section-box {
  border: 1px solid #eee;
  padding: 15px;
  margin-top: 20px;
  margin-bottom: 20px;
  background-color: #f9f9f9;
}

.footnote-section-box h4 { /* Title within footnote box, e.g., "각주" */
  font-size: 1.1em; /* Relative to parent, so still respects overall hierarchy */
  font-weight: bold;
  margin-bottom: 10px;
  margin-left: 0; /* No indent for this h4 */
}

.footnote-section-box ul {
  list-style-type: none;
  padding-left: 0;
  margin-bottom: 0;
}

.footnote-section-box li {
  font-size: 0.8em; /* Smaller font size for footnote text */
  margin-bottom: 5px;
  padding-top: 0;
  margin-top: 0;
  margin-left: 0;
}

/* Legacy .table-caption-box styles (if used elsewhere, retained but improved) */
/* Note: The provided HTML for tables uses <figure>, not this class directly. */
.table-caption-box {
  border: 1px solid #e0e0e0;
  padding: 10px;
  margin-bottom: 5px;
  background-color: #f9f9f9;
  text-align: center;
}

.table-caption-box .caption-title {
  font-weight: bold;
  font-size: 0.9em; /* Ensure smaller than body */
  display: block;
  margin-bottom: 5px;
}

.table-caption-box .caption-source {
  font-size: 0.8em; /* Ensure smaller than body and title */
  color: #555;
  display: block;
}

/* Table Scroll Wrapper for Mobile */
.table-wrapper-scroll {
  position: relative;
  width: 100%;
}

.scroll-hint {
  display: none;
  text-align: center;
  font-size: 0.85em;
  color: #666;
  margin-top: 10px;
  margin-bottom: 0;
  font-weight: 500;
}

/* Mobile styles for table scrolling */
@media only screen and (max-width: 991px) {
  .table-wrapper-scroll {
    position: relative;
    margin: 0 -15px; /* Extend to screen edges */
    padding: 0;
    width: calc(100% + 30px); /* Account for negative margins */
  }

  .table-wrapper-scroll .table-responsive {
    position: relative; /* For absolute positioned ::after */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    border-left: 3px solid #007bff; /* Visual indicator for scrollable content */
    border-right: 3px solid #007bff; /* Visual indicator for scrollable content */
    padding: 0 5px;
    margin: 0;
  }

  /* Force table to maintain minimum width for scrolling */
  .table-wrapper-scroll .table-responsive table {
    min-width: 1400px; /* Further increased minimum width */
    width: 1400px; /* Set fixed width */
    table-layout: fixed; /* Use fixed layout for consistent column widths */
  }

  /* Ensure table cells don't shrink */
  .table-wrapper-scroll .table-responsive table td {
    white-space: normal;
    width: 25%; /* Each cell takes 25% of table width (except first column) */
    padding: 12px 8px;
  }

  /* First column (category column) - fixed narrower width */
  .table-wrapper-scroll .table-responsive table td:first-child {
    width: 15%; /* 15% for category column */
    min-width: 100px;
  }

  /* Ensure images scale properly within cells */
  .table-wrapper-scroll .table-responsive table td img {
    width: 100%;
    max-width: none; /* Remove max-width constraint */
    height: auto;
    min-height: 200px; /* Ensure minimum height for images */
    object-fit: cover;
  }
}

  .scroll-hint {
    display: block;
    animation: pulse 2s infinite;
  }

  /* Pulse animation to draw attention */
  @keyframes pulse {
    0%, 100% {
      opacity: 1;
    }
    50% {
      opacity: 0.5;
    }
  }

  /* Add shadow gradient to indicate more content on the right */
  .table-wrapper-scroll::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(to left, rgba(255,255,255,0.95), transparent);
    pointer-events: none;
    z-index: 10;
  }

  /* Remove shadow when scrolled to the end */
  .table-wrapper-scroll.scrolled-end::after {
    display: none;
  }
}