.main-table {
    width: 90%;
    max-width: 1200px;
    margin: 20px auto;
    border-collapse: collapse;
    text-align: center;
    font-size: 16px;
}

.main-table th {
    background-color: #f4f4f4;
    font-weight: bold;
    font-size: 16px;
    border-bottom: 2px solid black;
    padding: 1px 2px;
}

.main-table td {
    padding: 1px 2px;
    border-bottom: none;
}

/* Double border after metrics column (column 2) */
.main-table th:nth-child(2),
.main-table td:nth-child(2) {
    border-right: 3px double #333;
}

/* Single borders after BC (column 3), MAQ+IQL (column 5), MAQ+SAC (column 7) */
.main-table th:nth-child(3),
.main-table td:nth-child(3) {
    border-right: 1px solid #999;
}

.main-table th:nth-child(5),
.main-table td:nth-child(5) {
    border-right: 1px solid #999;
}

.main-table th:nth-child(7),
.main-table td:nth-child(7) {
    border-right: 1px solid #999;
}

/* Midrule - horizontal borders between task sections */
/* After Door (row 6) */
.main-table tr:nth-child(6) td {
    border-bottom: 1px solid #666;
}

/* After Hammer (row 11) */
.main-table tr:nth-child(11) td {
    border-bottom: 1px solid #666;
}

/* After Pen (row 16) */
.main-table tr:nth-child(16) td {
    border-bottom: 1px solid #666;
}

/* After Relocate (row 21) - double border before Average */
.main-table tr:nth-child(21) td {
    border-bottom: 3px double #666;
}

/* Top border for last row (Average section last row) */
.main-table tr:last-child td {
    border-bottom: 2px solid black;
}

.bold {
    font-weight: bold;
}

.figure-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
}

.author_type {
    font-size: 16px;
    margin-bottom: 20px;
}

/* Folder selector styles */
.folder-wrapper {
    margin: 20px 0;
    width: 100%;
}

.folder-selector {
    display: flex;
    justify-content: flex-start;
    gap: 5px;
    margin-bottom: -2px;
    flex-wrap: nowrap; /* keep options on one line */
    overflow-x: auto; /* allow horizontal scroll on small screens */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #bbb transparent;
    position: relative;
    z-index: 1;
}

.folder-option {
    cursor: pointer;
    padding: 8px 16px;
    border: 2px solid #b7c4d8; /* darker base */
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background-color: #d6deea; /* UNSELECTED: deeper color */
    transition: all 0.2s ease;
    font-size: 16px;
    font-weight: 600;
    color: #0f223d; /* light-on-dark feel */
    white-space: nowrap; /* prevent label wrap */
    flex: 0 0 auto; /* don't shrink */
}

.folder-option:hover {
    background-color: #c8d4e7; /* slight lighten on hover */
}

.folder-option.active {
    background-color: #fafafa;
    color: #333;
    border-color: #ddd;
    position: relative;
}

/* Keyboard focus visibility */
.folder-option:focus-visible {
    outline: 2px solid #4a90ff;
    outline-offset: 2px;
}

.folder-box-wrapper {
    border: 2px solid #ddd;
    border-radius: 0 8px 8px 8px;
    padding: 20px;
    background-color: #fafafa;
    position: relative;
}

/* Improve scroll usability on very small screens */
@media (max-width: 640px) {
    .folder-selector { gap: 4px; }
    .folder-option { padding: 6px 12px; font-size: 12px; }
}

/* Optional: hide scrollbar track aesthetics */
.folder-selector::-webkit-scrollbar { height: 8px; }
.folder-selector::-webkit-scrollbar-track { background: transparent; }
.folder-selector::-webkit-scrollbar-thumb { background: #bbb; border-radius: 4px; }

/* ========== Two-column image/text grid (image1|image2 over text1|text2) ========== */
.media-duo {
    --duo-gap: 16px;
    --duo-img-height: auto; /* px or %; e.g., 220px */
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--duo-gap);
    align-items: start;
}

.media-duo .duo-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.media-duo .duo-image {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.media-duo .duo-image img {
    width: 100%;
    height: var(--duo-img-height);
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.media-duo .duo-text {
    text-align: justify;
    text-justify: inter-word;
}

/* RWD: stack columns on narrow screens */
@media (max-width: 1000px) {
    .media-duo { grid-template-columns: 1fr; }
    .media-duo .duo-image img { width: 100%; height: auto; }
}
.folder-container {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.folder-item {
    display: none;
}

.folder-item.active {
    display: block;
}

/* Video container and box styles */
.video-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    margin: 0 auto;
}

.video-box {
    flex: 1 1 calc(25% - 12px);
    min-width: 200px;
    max-width: 300px;
}

.video-container .video-box:only-child {
    flex: 1 1 100%;
    max-width: 800px;
}

.video-box video {
    width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.video-caption {
    text-align: center;
    margin-top: 10px;
    font-size: 18px;
    font-weight: 500;
    color: #333;
}

/* Video Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    margin: 5% auto;
    padding: 20px;
    width: 80%;
    max-width: 800px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.close {
    position: absolute;
    top: 10px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
}

#modalVideo {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

#modalCaption {
    text-align: center;
    margin-top: 15px;
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* LaTeX-style italic font for <i> tags */
i {
    font-family: 'Latin Modern Roman', 'Computer Modern', 'Times New Roman', 'Times', serif;
    font-style: italic;
}

/* Table footnote styling */
.table-footnote {
    text-align: left;
    margin-top: 5px;
    margin-left: 0;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    width: 100%;
}

.table-footnote p {
    margin: 0;
    padding: 0;
}

/* Remove bullets from list items */
.nobullets{
    list-style-type: none;
    padding-left: 0;
}

.custmo-align {
    text-align: left;
}

.highlight-text {
    font-weight: bold;
    /* color: #226E93;  */
}

.buttons button[disabled] {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
}

/* Responsive table: configurable width and bottom caption */
:root {
    --table-width: 95%;
    --table-font-base: 16px; /* default table font size */
    --table-font-md: 14px;   /* medium screens */
    --table-font-sm: 13px;   /* small screens */
    --table-font-xs: 12px;   /* extra small screens */
    --table-font-xxs: 11px;  /* very small screens */
    --table-font-xxxs: 10px; /* ultra small screens */
}

.table-wrapper {
    width: var(--table-width);
    max-width: 1200px;
    margin: 0 auto;
}

/* Ensure the main table fills the wrapper and captions appear at the bottom */
.table-wrapper .main-table {
    width: 100%;
    margin: 20px 0;
    table-layout: fixed;
    font-size: 16px; /* explicit default */
    line-height: 1.2;
}

.table-wrapper .main-table caption {
    caption-side: top; /* place caption on top for better context */
    padding-bottom: 8px;
    color: #444;
}

/* Improve cell wrapping on narrow screens */
.table-wrapper .main-table th,
.table-wrapper .main-table td {
    word-wrap: break-word;
    white-space: normal;
}

/* Ensure headers inherit table font size and tighten spacing */
.table-wrapper .main-table th {
    font-size: 1em; /* inherit from table */
    padding: 2px 6px;
}

.table-wrapper .main-table td {
    padding: 2px 6px;
    font-size: 0.97em; /* slightly smaller for better fit */
}

/* Caption size scales with table */
.table-wrapper .main-table caption {
    font-size: 0.9em;
}

/* Responsive scaling: make table more compact on smaller screens */
@media (min-width: 1440px) {
    .table-wrapper .main-table { font-size: 18px; }
    .table-wrapper .main-table caption { font-size: 1.05em; }
}

@media (min-width: 1280px) and (max-width: 1439px) {
    .table-wrapper .main-table { font-size: 17px; }
}

@media (max-width: 1024px) {
    .table-wrapper { width: var(--table-width); }
    .table-wrapper .main-table { font-size: 14px; }
    .table-wrapper .main-table th { padding: 2px 5px; }
    .table-wrapper .main-table td { padding: 2px 5px; font-size: 0.96em; }
    .table-wrapper .main-table caption { font-size: 0.85em; }
}

@media (max-width: 900px) {
    .table-wrapper .main-table { font-size: 13.5px; }
    .table-wrapper .main-table th, .table-wrapper .main-table td { padding: 1px 4px; }
}

@media (max-width: 768px) {
    .table-wrapper { width: var(--table-width); }
    .table-wrapper .main-table { font-size: 13px; }
    .table-wrapper .main-table th, .table-wrapper .main-table td { padding: 1px 4px; }
    .table-wrapper .main-table { line-height: 1.15; }
    .table-wrapper .main-table caption { font-size: 0.8em; }
}

@media (max-width: 600px) {
    .table-wrapper .main-table { font-size: 12.5px; }
}

@media (max-width: 480px) {
    .table-wrapper { width: var(--table-width); }
    .table-wrapper .main-table { font-size: 12px; }
    .table-wrapper .main-table th, .table-wrapper .main-table td { padding: 0 3px; }
    .table-wrapper .main-table { line-height: 1.1; }
    .table-wrapper .main-table caption { font-size: 0.78em; }
}

/* Additional tiny-screen support */
@media (max-width: 360px) {
    body { font-size: 13px; }
    .table-wrapper { width: var(--table-width); }
    .table-wrapper .main-table { font-size: 11px; line-height: 1.06; }
    .table-wrapper .main-table th, .table-wrapper .main-table td { padding: 0 2px; }
    .table-wrapper .main-table caption { font-size: 0.72em; }
}

@media (max-width: 320px) {
    body { font-size: 12px; }
    .table-wrapper { width: var(--table-width); }
    .table-wrapper .main-table { font-size: 10px; line-height: 1.04; }
    .table-wrapper .main-table th, .table-wrapper .main-table td { padding: 0 2px; }
    .table-wrapper .main-table caption { font-size: 0.7em; }
}

/* Section headings: make h2 larger and add prominent top spacing */
h2 {
    font-size: 42px; /* larger than body text */
    line-height: 1.3;
    margin-top: 48px; /* clear separation from prior content */
    margin-bottom: 12px;
}

/* Section headings: make h2 larger and add prominent top spacing */
h3 {
    font-size: 32px; /* larger than body text */
    line-height: 1.3;
    margin-top: 32px; /* clear separation from prior content */
    margin-bottom: 12px;
}

h4 {
    font-size: 24px; /* larger than body text */
    line-height: 1.3;
    margin-top: 24px; /* clear separation from prior content */
    margin-bottom: 12px;
    color: #226E93;
}




/* Full-bleed background option for sections: apply class "section-color" */
.section-color {
    position: relative;
    border-radius: 0; /* full-bleed looks cleaner without rounded corners */
    --section-color-bg: #f7fbff; /* subtler default tint */
    padding-top: 12px; /* soften spacing from top */
    padding-bottom: 28px; /* soften spacing from bottom */
    margin-top: 20px; /* space from previous block */
    margin-bottom: 20px; /* space to next block */
}

.section-color::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    width: 100vw;
    background-color: var(--section-color-bg);
    z-index: -1;
}




/* Reduce top margin on headings inside colored sections to balance padding */
.section-color h2 {
    margin-top: 8px;
    margin-bottom: 14px;
}
.section-color h3 {
    margin-top: 6px;
}
.section-color h4 {
    margin-top: 4px;
}

/* Optional variant: stronger blue */
.section-color.blue {
    --section-color-bg: #eef6ff;
}

/* Optional variant: light gray */
.section-color.gray {
    --section-color-bg: #fafbfc;
}

/* Responsive: tighten vertical rhythm on small screens */
@media (max-width: 768px) {
    .section-color { padding-top: 22px; padding-bottom: 22px; margin-top: 16px; margin-bottom: 16px; }
    .section-color h2 { margin-top: 6px; }
}
@media (max-width: 480px) {
    .section-color { padding-top: 18px; padding-bottom: 18px; margin-top: 14px; margin-bottom: 14px; }
    .section-color h2 { font-size: 28px; }
}

/* Global responsive typography overrides (do not touch index.css) */
@media (max-width: 1200px) {
    body { font-size: 17px; }
    h1 { font-size: 44px; }
    h2 { font-size: 36px; }
    h3 { font-size: 28px; }
    h4 { font-size: 22px; }
}
@media (max-width: 1024px) {
    body { font-size: 16px; }
    h1 { font-size: 40px; }
    h2 { font-size: 32px; }
    h3 { font-size: 26px; }
    h4 { font-size: 20px; }
}
@media (max-width: 768px) {
    body { font-size: 15px; }
    h1 { font-size: 34px; }
    h2 { font-size: 28px; }
    h3 { font-size: 24px; }
    h4 { font-size: 18px; }
}
@media (max-width: 480px) {
    body { font-size: 14px; }
    h1 { font-size: 30px; }
    h2 { font-size: 24px; }
    h3 { font-size: 20px; }
    h4 { font-size: 16px; }
}

/* Table-specific responsive refinements beyond variables */
@media (min-width: 1280px) {
    .table-wrapper { width: var(--table-width); }
}
@media (max-width: 1200px) {
    .table-wrapper { width: min(var(--table-width), 75%); }
}
@media (max-width: 1024px) {
    .table-wrapper { width: min(var(--table-width), 85%); }
}
@media (max-width: 640px) {
    .table-wrapper { width: 100%; }
    .table-wrapper .main-table { font-size: var(--table-font-xs); line-height: 1.1; }
    .table-wrapper .main-table th, .table-wrapper .main-table td { padding: 0 2px; }
    .table-wrapper .main-table caption { font-size: 0.75em; }
}

/* Prevent squish on very narrow screens while keeping within viewport */
/* Enable horizontal scroll only on very small screens to avoid unwanted scrollbars */
@media (max-width: 480px) {
    .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* (legacy media-row removed) */

/* ========== New media-flex layout (text/image row) ========== */
.media-flex {
    display: flex;
    gap: 16px;
    align-items: flex-start; /* text top align by default */
}

.media-flex .media-text {
    flex: 1 1 0;
    min-width: 0; /* allow text to shrink and wrap */
    text-align: justify; /* justify both sides */
    text-justify: inter-word;
    align-self: flex-start; /* top align text block */
}

/* Text width cap utilities: limit text block to a percentage of the row */
.media-flex.text-width-20 .media-text { max-width: 20%; flex-basis: 20%; }
.media-flex.text-width-25 .media-text { max-width: 25%; flex-basis: 25%; }
.media-flex.text-width-30 .media-text { max-width: 30%; flex-basis: 30%; }
.media-flex.text-width-35 .media-text { max-width: 35%; flex-basis: 35%; }
.media-flex.text-width-40 .media-text { max-width: 40%; flex-basis: 40%; }
.media-flex.text-width-45 .media-text { max-width: 45%; flex-basis: 45%; }
.media-flex.text-width-50 .media-text { max-width: 50%; flex-basis: 50%; }
.media-flex.text-width-55 .media-text { max-width: 55%; flex-basis: 55%; }
.media-flex.text-width-60 .media-text { max-width: 60%; flex-basis: 60%; }
.media-flex.text-width-65 .media-text { max-width: 65%; flex-basis: 65%; }
.media-flex.text-width-70 .media-text { max-width: 70%; flex-basis: 70%; }
.media-flex.text-width-75 .media-text { max-width: 75%; flex-basis: 75%; }
.media-flex.text-width-80 .media-text { max-width: 80%; flex-basis: 80%; }

/* For image-first layouts with text-width: fix width and right-align text */
.media-flex.is-image-first[class*="text-width-"] {
    justify-content: space-between; /* push image left, text right */
}
.media-flex.is-image-first[class*="text-width-"] .media-text {
    flex: 0 0 auto; /* override flex: 1 1 0 to prevent sticking */
}

/* When stacked (<1000px), let text width return to full width */
@media (max-width: 1000px) {
    .media-flex[class*="text-width-"] .media-text { max-width: 100%; flex-basis: auto; }
    .media-flex.is-image-first[class*="text-width-"] .media-text { width: auto; margin-left: 0; }
}

/* Image column adapts to intrinsic image width (up to container) */
.media-flex .media-image {
    flex: 0 1 auto;
    max-width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* User controls image height via --img-height (px or %) and image keeps aspect ratio */
.media-flex .media-image img {
    display: block;
    height: var(--img-height, auto); /* e.g., 260px or 60% */
    width: auto; /* width follows height to preserve aspect ratio */
    max-width: 100%;
    object-fit: contain; /* no cropping by default */
}

/* Ordering controls */
.media-flex.is-text-first .media-text { order: 1; }
.media-flex.is-text-first .media-image { order: 2; }
.media-flex.is-image-first .media-image { order: 1; }
.media-flex.is-image-first .media-text { order: 2; }

/* Stack on small screens: image first, full width */
@media (max-width: 1000px) {
    .media-flex { flex-direction: column; }
    .media-flex .media-image { width: 100%; max-width: 100%; }
    .media-flex .media-image img { width: 100%; height: auto; }

    /* Optional mobile ordering controls (default preserves desktop order) */
    .media-flex.mobile-image-first .media-image { order: 1; }
    .media-flex.mobile-image-first .media-text { order: 2; }
    .media-flex.mobile-text-first .media-text { order: 1; }
    .media-flex.mobile-text-first .media-image { order: 2; }
}
