body {
        font-family: "Lato", sans-serif; margin: 0;
        background-color: var(--main-bg); color: var(--main-text);
    }

    /* Contain floats within their wrapper (float:left images inside accordion bodies) */
    .clearfix { display: flow-root; }
    
	/* ADD THIS - Offset for sticky navbar when jumping to anchors */
	html {
		scroll-padding-top: 60px; /* Adjust this value to match your sticky navbar height + spacing */
	}
	
    /* Language-specific text styling */
    .pali-text { color: var(--pali-text); }
    .english-text { color: var(--english-text); }
    .chinese-text { color: var(--chinese-text); }

    /* Table column styling for 4 columns */
    .pali-col { 
        color: var(--pali-text, #8B4513); 
        font-style: italic;
    }
    .eng-col { 
        color: var(--english-text, #000080); 
    }
    .markup-col {
        color: var(--markup-text, #666);
        font-family: monospace;
        font-size: 0.9em;
    }
    .chinese-col {
        color: var(--chinese-text, #8B0000);
    }

    /* Font-family pickers (⚙️ Settings → Font family): themes.js sets ONE :root
       custom property per language (--l24-font-pali/-english/-chinese) instead of
       writing inline styles on every cell — O(1) on any page size. Property unset
       = the fallbacks below, i.e. the page's normal defaults. */
    .pali-col, .pali-text { font-family: var(--l24-font-pali, "Lato", sans-serif); }
    .eng-col, .english-text { font-family: var(--l24-font-english, "Lato", sans-serif); }
    .chinese-text { font-family: var(--l24-font-chinese, "Lato", sans-serif); }
    .chinese-col { font-family: var(--l24-font-chinese, "Microsoft YaHei", "SimSun", serif); }

    /* ── l24sx column differentiation (3-col seg-table) ──────────────────────────
       TWEAK these two values and EVERY page updates on reload — NO rebuild (they live
       in this shared stylesheet, not baked into pages). You can also change them live
       in devtools: set --l24-pali-cn-mix / --l24-eng-tint on :root.
         --l24-pali-cn-mix : how much of the Chinese hue blends into Pali, so
                             English | Pali | Chinese are three distinct pen colours.
                             (The themes set --pali-text ~= --english-text, so without
                             this Pali looks identical to English.)
         --l24-eng-tint    : translucent background tint on the English (middle) column.
                             Translucent (mix with `transparent`) so the row-hover /
                             :target highlight shows THROUGH it. Theme-agnostic via
                             color-mix on the live theme vars (works light or dark). */
    :root{
        --l24-pali-cn-mix: 25%;
        --l24-eng-tint: 6%;
    }
    table.seg-table td.pali-col{
        color: var(--pali-text, #8B4513);   /* fallback when color-mix unsupported */
        color: color-mix(in srgb, var(--chinese-text,#8B0000) var(--l24-pali-cn-mix,35%), var(--pali-text,#8B4513));
    }
    table.seg-table td.eng-col{
        background: rgba(128,128,128,.12);   /* fallback */
        background: color-mix(in srgb, var(--main-text,#000) var(--l24-eng-tint,12%), transparent);
    }

    /* Language visibility controls for 4 columns */
    body.hide-english .english-text, body.hide-english .eng-col { display: none; }
    body.hide-pali .pali-text, body.hide-pali .pali-col { display: none; }
    body.hide-markup .markup-col { display: none; }
    body.hide-chinese .chinese-text, body.hide-chinese .chinese-col { display: none; }

    /* Fixed-layout translation tables: do NOT display:none the hidden-language
       CELLS — that re-maps the remaining cells onto the wrong <col> (a single
       visible column would inherit column 1's 0 width and render super-narrow).
       Keep the cell in place; its 0-width column (set below) collapses it and
       overflow:hidden clips the content. Cell→column mapping stays correct, so
       the visible column gets its full (renormalized) width. */
    body.hide-pali    table.l24-tr-table td.pali-col,
    body.hide-english table.l24-tr-table td.eng-col,
    body.hide-chinese table.l24-tr-table td.chinese-col {
        display: table-cell;
        padding: 0;
        overflow: hidden;
        white-space: nowrap;
    }

    /* Language visibility checkboxes (⚙️ Settings → 🌐 Languages submenu) */
    .lang-cb-row {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 16px;
        cursor: pointer;
        white-space: nowrap;
        user-select: none;
    }
    .lang-cb-row input { cursor: pointer; margin: 0; }

    /* Table styling - clean borderless design */
    table {
        border-collapse: collapse;
        width: 100%;
        margin: 20px 0;
    }

    /* ============================================================
       Per-table render containment (large-page performance).
       01-xlsx-to-html.py wraps each translation <table> in a
       <div class="cv-wrap">. content-visibility lets the browser skip
       layout/paint for off-screen tables, so a width change (side-TOC
       open/close, column-sash drag, scroll) relayouts only the on-screen
       tables instead of all of them — the difference between "instant"
       and "several seconds" on suttas with thousands of verse tables.
       A bare <table> can't take containment, hence the block wrapper.
       contain-intrinsic-size is the pre-render height estimate; the
       `auto` keyword remembers each table's real size after first paint.
       ============================================================ */
    .cv-wrap {
        content-visibility: auto;
        contain-intrinsic-size: auto 240px;
    }

    td, th {
        border: none; /* Remove ugly borders */
        text-align: left;
        padding: 4px 8px; /* Reduced padding - 4px vertical, 8px horizontal */
        vertical-align: top;
        overflow-wrap: break-word; /* long Pali words wrap instead of overflowing fixed columns */
    }

    /* ============================================================
       Fixed-width translation columns + draggable resize sashes.
       column-sash.js tags each translation <table> with .l24-tr-table,
       injects a <colgroup>, and drives the --col-* vars (on :root) below.
       Because every table reads the same vars, all blocks stay aligned.
       ============================================================ */
    table.l24-tr-table { table-layout: fixed; }

    table.l24-tr-table col.l24-col-pali    { width: var(--col-pali, 40%); }
    table.l24-tr-table col.l24-col-eng     { width: var(--col-eng, 40%); }
    table.l24-tr-table col.l24-col-chinese { width: var(--col-chinese, 20%); }

    /* Hidden language → collapse its column so the rest reclaim the width */
    body.hide-pali    table.l24-tr-table col.l24-col-pali    { width: 0; }
    body.hide-english table.l24-tr-table col.l24-col-eng     { width: 0; }
    body.hide-chinese table.l24-tr-table col.l24-col-chinese { width: 0; }

    /* Opt-in column-resize bar — a second row inside the sticky nav header.
       In-flow + sticky (rides the nav), so it is immune to the CSS zoom page
       zoom. Toggled from the ⚙️ settings menu (default off via inline display). */
    .l24-colbar {
        display: none;              /* JS flips to block when enabled */
        position: relative;         /* anchor for the absolute sash + ✕ */
        width: 100%;
        box-sizing: border-box;
        padding: 4px 8px;
        margin-top: 4px;
        border-top: 1px solid var(--l24-acc-border, rgba(127,127,127,0.35));
        font-size: 0.85em;
    }
    .l24-colbar-standalone {        /* fallback when there is no .sticky nav */
        position: sticky;
        top: 0;
        z-index: 50;
        background: var(--header-bg, #e8e8e8);
        margin-top: 0;
    }
    .l24-colbar-track {
        display: flex;
        width: 100%;                /* full bar width → aligns with table columns */
        box-sizing: border-box;
        align-items: stretch;
        border: 1px solid var(--l24-acc-border, rgba(127,127,127,0.35));
        border-radius: 6px;
        overflow: hidden;
        background: var(--l24-acc-bg2, rgba(127,127,127,0.06));
    }
    .l24-colbar-seg {
        flex: 1 1 0;
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 3px 6px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        user-select: none;
    }
    .l24-colbar-handle {
        flex: 0 0 11px;
        position: relative;
        cursor: col-resize;
        background: var(--l24-acc-border, rgba(127,127,127,0.45));
        touch-action: none;
    }
    .l24-colbar-handle::before {
        content: "";
        position: absolute;
        left: 50%;
        top: 50%;
        width: 2px;
        height: 60%;
        transform: translate(-50%, -50%);
        background: var(--main-bg, #fff);
        opacity: 0.55;
        border-radius: 1px;
    }
    .l24-colbar-handle:hover,
    .l24-colbar-handle.l24-dragging { background: var(--main-text, #333); }
    /* Sidebar (TOC) sash: a grip floated at the bar's left edge (= the TOC
       border), shown only while the sidebar is open. Defined AFTER the base
       .l24-colbar-handle so its position:absolute wins; absolute keeps the
       column segments full-width and aligned with the tables. */
    .l24-colbar-handle-side {
        position: absolute;
        left: 5px;
        top: 3px;
        bottom: 3px;
        width: 14px;
        z-index: 3;
        background: var(--button-bg, #d8c8a9);
        border: 1px solid var(--l24-acc-border, rgba(127,127,127,0.55));
        border-radius: 4px;
        box-shadow: 1px 0 3px rgba(0,0,0,0.18);
    }
    .l24-colbar-handle-side::before {
        background: var(--main-text, #333);
        opacity: 0.7;
        width: 2px;
        height: 55%;
    }
    .l24-colbar-close {
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 3;
        border: 1px solid var(--l24-acc-border, rgba(127,127,127,0.45));
        background: var(--header-bg, #e8e8e8);
        color: inherit;
        border-radius: 6px;
        cursor: pointer;
        padding: 0 9px;
        font-size: 1em;
        line-height: 1.5;
    }
    .l24-colbar-close:hover { background: var(--l24-acc-bg, rgba(127,127,127,0.10)); }
    
    th {
        background-color: var(--header-bg, #e8e8e8);
        font-weight: bold;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    /* Row styling - 4px spacing between rows */
    tr {
        margin-bottom: 4px; /* Space between rows */
    }
    
    tr:hover {
        background-color: var(--hover-bg, rgba(0,0,0,0.05));
    }
    
    /* Remove alternating row colors since no borders - cleaner look */
    /* tr:nth-child(even) {
        background-color: var(--alt-row-bg, rgba(0,0,0,0.02));
    } */

    div.sticky {
        position: -webkit-sticky; position: sticky; top: 0;
        color: var(--header-text);
        padding: 2px 8px; font-size: 18px; z-index: 999;
        transition: margin-left .3s; /* Add transition for smooth movement */
        backdrop-filter: blur(8px); /* Modern blur effect behind the bar */
        /* Drive the frosted bar from the THEME'S OWN header-bg/header-text pair
           (each theme defines a contrast-checked pair). Deriving the translucent
           background from --header-bg — rather than a hardcoded white with a
           name-based dark override — guarantees the text stays readable on every
           theme, including dark themes whose name lacks "dark" (e.g. dracula) and
           any future theme. Solid --header-bg first as a fallback for engines
           without color-mix; the frosted layer then overrides it where supported. */
        background-color: var(--header-bg);
        background: color-mix(in srgb, var(--header-bg) 85%, transparent);
        border-bottom: 1px solid color-mix(in srgb, var(--header-text) 15%, transparent);
    }
    .sidebar { 
        height: 100%; width: 0; position: fixed; z-index: 1001; top: 0; left: 0; 
        background-color: var(--sidebar-bg); color: var(--sidebar-text);
        overflow-y: auto; transition: 0.3s; padding-top: 0; 
    }
    .sidebar-nav { 
        position: -webkit-sticky; position: sticky; top: 0; 
        background-color: #333; 
        padding: 8px 10px; box-sizing: border-box; text-align: right; z-index: 10; 
    }
    .sidebar-nav-btn, .settings-btn { 
        background: var(--button-bg); border: 1px solid var(--button-border); color: var(--button-text); 
        font-size: 1.1em; cursor: pointer; margin-left: 8px; vertical-align: middle;
    }
    .openbtn { font-size: 20px; cursor: pointer; background-color: var(--sidebar-bg); color: var(--sidebar-text); padding: 10px 15px; border: none; }
    .openbtn:hover { background-color: var(--button-bg); }
    a { color: var(--link-color); text-decoration: none; }
    a:hover { color: var(--link-hover); text-decoration: underline; }
    a:visited { color: var(--link-visited); }
    #main { transition: margin-left .3s; padding: 16px; }
    
    /* FIXED COLLAPSIBLE HEADER STYLING */
    .collapsible-header, .samyutta-header, .sutta-group-header { 
        padding-top: 2.0px; padding-bottom: 2.0px; padding-right: 8px;
        text-decoration: none; display: block; cursor: pointer; text-align: left; 
        background-color: var(--sidebar-bg); color: var(--sidebar-text);
        border: none; width: 100%; 
        position: relative; /* ADDED for arrow positioning */
        transition: background-color 0.3s; /* ADDED for smooth hover */
    }
    .collapsible-header { font-size: 20px; font-weight: bold; color: #f1f1f1; padding-left: 32px; }
    .samyutta-header { font-size: 18px; color: #ccc; padding-left: 40px; }
    .sutta-group-header { font-size: 16px; color: #a0a0a0; padding-left: 48px; }
    
    /* FIXED HOVER AND ACTIVE STATES */
    .collapsible-header:hover,
    .collapsible-header.active {
        background-color: #555; /* Darker on hover/active */
    }
    
    /* FIXED ARROW INDICATORS */
    .collapsible-header::after {
        content: "▶"; /* Right arrow */
        position: absolute;
        right: 16px;
        transition: transform 0.3s;
        font-size: 14px;
        font-weight: bold;
    }
    
    .collapsible-header.active::after {
        transform: rotate(90deg); /* Down arrow when active */
    }
    
    .sutta-list a { 
        display: block; padding-top: 2.0px; padding-bottom: 2.0px;
        padding-right: 8px; padding-left: 56px;
        color: #ddd; text-decoration: none; font-size: 15px; 
    }
    .sutta-list a:hover { background-color: #333; }
    
    /* FIXED COLLAPSIBLE CONTENT */
    .collapsible-content, .samyutta-content { 
        display: none; 
        background-color: var(--sidebar-bg); 
        overflow: visible; 
    }
    
    /* ACTIVE STATE FOR CONTENT */
    .collapsible-content.active {
        display: block;
    }
    
    /* SUTTA LIST SHOULD ALWAYS BE VISIBLE WHEN PARENT IS ACTIVE */
    .sutta-list {
        display: block; /* Always visible when parent .collapsible-content is shown */
        background-color: var(--sidebar-bg); 
        overflow: visible;
        padding: 0;
    }
    
    .menu-container { position: relative; display: inline-block; vertical-align: middle; }
    .menu-button { font-size: 1em; cursor: pointer; background-color: transparent; border: none; padding: 0 10px; vertical-align: middle; }
    .menu-button:hover { background-color: #ddd; }
    .menu-content { 
        display: none; position: absolute; right: 0; 
        background-color: #f9f9f9; min-width: 180px; 
        max-height: 70vh; overflow-y: auto;
        box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); 
        z-index: 1002; border-radius: 4px;
        scrollbar-width: thin;
    }
    .menu-content.show { display: block; }
    .menu-content a, .menu-content .theme-item { color: black; padding: 12px 16px; text-decoration: none; display: block; cursor: pointer; }
    .menu-content a:hover, .menu-content .theme-item:hover { background-color: #f1f1f1; }


/* Submenu styling */
.submenu-content {
    background-color: var(--sidebar-bg, #f9f9f9);
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 4px 0;
    max-height: 300px;
    overflow-y: auto;
}

.submenu-content .theme-item {
    padding: 8px 16px;
    cursor: pointer;
    display: block;
}

.submenu-content .theme-item:hover {
    background-color: #f1f1f1;
}



/* ==========   CLICKABLE THUMBNAIL LINK STYLES  ============================================ */


/* Base link item container */
.link-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
    padding: 10px;
    border-radius: 6px;
    transition: background 0.2s ease;
}



.link-item:hover {
    background: rgba(0, 0, 0, 0.03);
}
/* Title is NEVER a link */
.link-title {
    cursor: default;
    text-decoration: none;
    color: var(--main-text);
}

/* Kill ALL hover/link inheritance */
.link-item:hover .link-title,
.link-title:hover {
    text-decoration: none !important;
    color: var(--main-text) !important;
}

.thumb-wrapper {
    cursor: pointer;
}




/* Dark theme hover */
[data-theme*="dark"] .link-item:hover,
[data-theme="tokyo-storm"] .link-item:hover,
[data-theme="catppuccin-mocha"] .link-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Thumbnail wrapper - Style 1: Corner Arrow (DEFAULT) */
.thumb-wrapper {
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
}

.thumb-wrapper img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
    transition: opacity 0.2s ease;
}

.thumb-wrapper:hover img {
    opacity: 0.8;
}



.thumb-wrapper::after {
    content: '↗';
    position: absolute;
    bottom: 4%;
    right: 4%;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    width: 25%;
    height: 25%;
    max-width: 24px;
    max-height: 24px;
    min-width: 14px;
    min-height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(9px, 2.5vw, 14px);
    font-weight: bold;
}

/* Link content area */
.link-content {
    flex: 1;
    min-width: 0; /* Prevents text overflow issues */
}

.link-title {
    font-weight: 600;
    color: var(--link-color); /* Uses your existing link color */
    margin-bottom: 5px;
    font-size: 16px;
}

.link-item:hover .link-title {
    text-decoration: underline;
    color: var(--link-hover); /* Uses your existing hover color */
}

.link-desc {
    color: var(--main-text); /* Uses theme text color */
    opacity: 0.7; /* Makes it slightly dimmer */
    font-size: 14px;
    line-height: 1.4;
}

.code-label {
    display: inline-block;
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-family: monospace;
    color: var(--main-text);
    margin-bottom: 5px;
}

/* Dark theme adjustments */
[data-theme*="dark"] .code-label,
[data-theme="tokyo-storm"] .code-label,
[data-theme="catppuccin-mocha"] .code-label {
    background: rgba(255, 255, 255, 0.1);
}

/* Alternative Style 2: Border hover (add .style-2 class to use) */
.link-item.style-2 .thumb-wrapper img {
    border: 2px solid var(--button-border, #ddd);
    transition: border-color 0.2s ease;
}

.link-item.style-2:hover {
    background: rgba(0, 123, 255, 0.05);
    transform: translateX(5px);
}

.link-item.style-2:hover .thumb-wrapper img {
    border-color: var(--link-color);
}

/* Alternative Style 3: Badge (add .style-3 class to use) */
.link-item.style-3 .thumb-wrapper::before {
    content: 'VIEW';
    position: absolute;
    top: 3px;
    right: 3px;
    background: var(--link-color);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.link-item.style-3 .thumb-wrapper::after {
    display: none; /* Hide arrow when using badge */
}

/* =====  Fake headings (autotoc-safe) =====
   <div class="fake-hN" role="heading" aria-level="N">…</div> looks like a real hN
   and is announced as a level-N heading (W3C/WAI-ARIA), but it is NOT an <hN> tag, so
   the tag-based passes (05 accordion wrap, sidebar TOC, prettify_section_num) skip it.
   Font scale mirrors the built-page accordion heading scale in 05-generate_auto_toc_v2.py
   (.l24-acc.l24-hN .l24-acc-heading: h1=90% … h6=55% of h1base 1.65em). */
.fake-h1,.fake-h2,.fake-h3,.fake-h4,.fake-h5,.fake-h6 {
    display: block;
    margin: 0.8em 0 0.4em;
    color: var(--main-text);
}
.fake-h1 { font-size: 1.485em;  font-weight: 800; line-height: 1.15; }
.fake-h2 { font-size: 1.32em;   font-weight: 750; line-height: 1.18; }
.fake-h3 { font-size: 1.155em;  font-weight: 700; line-height: 1.20; }
.fake-h4 { font-size: 1.0725em; font-weight: 650; line-height: 1.22; }
.fake-h5 { font-size: 0.99em;   font-weight: 600; line-height: 1.24; }
.fake-h6 { font-size: 0.9075em; font-weight: 600; line-height: 1.26; }

/* =====  NEW: Arrow Corner Card Style (from clickable2.html) ===== */
/* This is a CARD-BASED layout, different from the horizontal .link-item style */

.arrow-card {
    background: var(--main-bg, white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 20px;
}

.arrow-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.arrow-card h3,
.arrow-card .fake-h3 {
    padding: 12px 15px;
    background: var(--header-bg, #333);
    color: var(--header-text, white);
    font-size: 14px;
    text-align: center;
    margin: 0;
}

.arrow-image-wrapper {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4 / 3;
}

.arrow-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.arrow-image-wrapper:hover img {
    transform: scale(1.05);
}


/* Arrow indicator for card style - scales with card size */
.arrow-image-wrapper::after {
    content: '↗';
    position: absolute;
    bottom: 6%;
    right: 6%;
    background: rgba(0,0,0,0.7);
    color: white;
    width: 18%;
    height: 18%;
    max-width: 36px;
    max-height: 36px;
    min-width: 16px;
    min-height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(10px, 3vw, 18px);
    font-weight: bold;
}


/* Dark theme for arrow cards */
[data-theme*="dark"] .arrow-card,
[data-theme="tokyo-storm"] .arrow-card,
[data-theme="catppuccin-mocha"] .arrow-card {
    background: var(--sidebar-bg, #2a2a2a);
}

[data-theme*="dark"] .arrow-image-wrapper::after,
[data-theme="tokyo-storm"] .arrow-image-wrapper::after,
[data-theme="catppuccin-mocha"] .arrow-image-wrapper::after {
    background: rgba(255,255,255,0.85);
    color: #333;
}

.arrow-card-description {
    padding: 15px;
    font-size: 13px;
    color: var(--main-text);
    opacity: 0.8;
    line-height: 1.5;
}

/* Optional: Grid layout for arrow cards */
.arrow-card-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 20px 0;
}

/* ==========   END CLICKABLE THUMBNAIL LINK STYLES  ============================================ */
