/* Ensure About modal sits above the blog category dropdown (which uses very high z-index) */
#about-modal {
  z-index: 2000002 !important;
}

/* Subscribe Modal Styles - match mobile preview aesthetic */
#subscribe-modal { z-index: 2000003 !important; }
.subscribe-modal-content {
  max-width: 520px;
  border-radius: 16px;
  border: 1px solid rgba(0, 229, 255, 0.25);
  background: linear-gradient(135deg, rgb(0 12 73 / 90%), rgb(0 55 78 / 95%));
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  backdrop-filter: blur(12px);
  padding: 24px 24px 20px 24px;
}
.subscribe-container { text-align: left; }
.subscribe-title {
  margin: 0 0 6px 0;
  font-family: 'Cormorant Garamond', 'EB Garamond', serif;
  font-size: 1.5rem;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
}
.subscribe-subtitle {
  margin: 0 0 16px 0;
  color: #e6f2ff;
}
#subscribe-form {
  display: flex;
  gap: 10px;
  align-items: center;
}
#subscribe-email {
  flex: 1;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(0, 229, 255, 0.25);
  background: rgba(12, 17, 31, 0.7);
  color: #e6f2ff;
  padding: 0 12px;
}
.subscribe-button {
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(0, 229, 255, 0.25);
  background: rgba(12, 17, 31, 0.7);
  color: #e6f2ff;
  font-family: 'Cormorant Garamond', 'EB Garamond', serif;
  padding: 0 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.subscribe-button:hover {
  background: rgba(0, 229, 255, 0.15);
  color: #ffffff;
  border-color: rgba(0, 229, 255, 0.5);
}
.subscribe-message { margin-top: 10px; color: #e6f2ff; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

/* Treatise Specific Styles - Adapted for index.html structure */

/* Override main container width for treatise section */
.blog-body .container {
    max-width: 90% !important; /* Override the default max-width */
}

/* Assuming .container provides max-width and centering */

/* Style the main treatise view container (analogous to chat-container) */
.blog-view-container {
    display: flex; /* Use flexbox for internal layout */
    flex-direction: column; /* Stack elements vertically */
    height: calc(100vh - 125px); /* Adjust height based on header/footer/margins, similar to chat */
    width: 100%; /* Take full width within .container */
    background-color: var(--bg-navy, #0C111F); /* Match chat container background */
    border-radius: 8px;
    overflow: hidden; /* Prevent content spillover */
    box-shadow: 0 4px 15px rgb(255, 255, 255);
    border: 3px solid #00e5ff;
}

/* Wrapper for the sidebar and main content */
.blog-content-wrapper {
    display: flex;
    flex: 1; /* Allow this wrapper to fill the container height */
    overflow: hidden; /* Important to contain scrolling */
}

/* Sidebar Styles - Adapted */
.blog-sidebar {
    flex: 0 0 300px; /* Fixed width */
    background-color: rgba(12, 17, 31, 0.7); /* Slightly more opaque */
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    /* Removed padding from sidebar itself */
    /* Removed border-radius as it's on the parent container */
    height: 100%; /* Fill the wrapper height */
    display: flex; /* Use flexbox to arrange header and scroll container */
    flex-direction: column; /* Stack header and scroll container vertically */
    overflow: hidden; /* Prevent scrollbar on the sidebar itself */
}

/* Fixed header within the sidebar */
.sidebar-header {
    padding: 20px; /* Add padding here */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Separator line */
    flex-shrink: 0; /* Prevent header from shrinking */
    line-height: 1.2; /* Adjust line height for logo */
}

/* Apply main logo styles to treatise logo */
.blog-logo-main {
    font-family: 'Merriweather', serif;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: lowercase;
    color: #ffffff;
    text-shadow: 0px 0px 8px var(--text-gradient-start);
    animation: glowCycle 3s infinite alternate;
    display: inline-block; /* Ensure proper alignment with superscript */
    vertical-align: baseline; /* Ensure proper alignment with superscript */
}

/* Size adjustment for main title logo */
.blog-main-title .blog-logo-main {
    font-size: 2.2rem; /* Match previous inline style */
    /* Optionally disable animation/shadow for title if desired */
    /* animation: none; */
    /* text-shadow: none; */
}

/* Center the main title H1 */
.blog-main-title {
    text-align: center;
    color: #2c3e50;
}

/* Treatise welcome section */
.blog-welcome {
    color: #2c3e50;
}

.blog-welcome h3 {
    color: #495057;
}

.blog-welcome ul {
    color: #2c3e50;
    font-size: 1.1rem; /* Match paragraph font size */
}

.blog-welcome li {
    font-size: 1.1rem; /* Ensure bullet point text matches paragraph size */
}

.blog-welcome hr {
    border-color: #dee2e6;
}

/* New styles for sidebar header */
.sidebar-title-main {
    font-family: 'Poppins', sans-serif;
    font-weight: 400; /* Non-bold */
    font-size: 1.4rem; /* Adjust size as needed */
    color: #ffffff;
    display: block; /* Ensure it takes its own line */
    margin-bottom: 0; /* Reduced space before 'by' line */
}

.sidebar-title-by {
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem; /* Smaller size for 'by' */
    font-weight: 300;
    color: rgba(255, 255, 255, 0.8);
    margin-right: 5px; /* Space between 'by' and 'Nunn.ai' */
}

.sidebar-logo-small {
    /* Inherits .blog-logo-main styles (Merriweather, animation, etc.) */
    font-size: 1.2rem; /* Smaller logo size */
    /* text-transform: capitalize; /* REMOVED - Caused incorrect capitalization */
    vertical-align: baseline; /* Align with 'by' */
}

.sidebar-superscript-small {
    /* Inherits .blog-logo-superscript styles (gradient, animation, etc.) */
    font-size: 0.6rem; /* Smaller superscript */
    top: -0.4em; /* Adjust vertical position */
    vertical-align: baseline; /* Align with 'by' */
}


/* Keep superscript styles separate */
.blog-logo-superscript {
    font-family: 'Merriweather', serif; /* Match font */
    font-weight: 700;
    text-transform: uppercase;
    /* Apply gradient to base superscript */
    background: linear-gradient(90deg, var(--text-gradient-start, #00E5FF), var(--text-gradient-end, #FF8C42));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent; /* Ensure text is transparent for gradient */
    animation: gradientShift 3s ease infinite; /* Reuse animation from main styles */
    background-size: 200% auto; /* Added for gradient animation */
    filter: drop-shadow(0 0 2px rgba(0, 198, 255, 0.5)); /* Subtle glow */
    position: relative; /* Added back for 'top' positioning */
    /* Base size and top offset (applies to sidebar) */
    font-size: 0.7rem;
    top: -0.5em;
}

/* Specific size/position adjustments for superscript in the main title */
.title-superscript {
    font-size: 0.9rem; /* Smaller relative to the 2.2rem main logo */
    top: -0.8em; /* Adjust vertical position */
    /* Gradient is now applied via the base class */
}

/* Specific size/position adjustments for superscript in the sidebar header - REMOVED */
/* .sidebar-header .blog-logo-superscript { */
    /* font-size: 0.8rem; /* Removed as requested */
/*    top: -1.0em; /* Adjusted vertical position again */
/* } */


/* Scrollable container for the actual ToC */
.toc-scroll-container {
    flex-grow: 1; /* Allow container to fill remaining space */
    overflow-y: auto; /* Enable vertical scrolling ONLY for this container */
    padding: 10px; /* Add padding here */
}

/* Style for the actual ToC nav element */

/* Style for the restored H3 */
.blog-toc h3 {
    font-family: 'Cormorant Garamond', 'EB Garamond', serif; /* Changed font */
    font-size: 1.1rem; /* Reduced font size */
    font-weight: 400; /* Set font-weight to normal (non-bold) */
    color: var(--text-gradient-start, #00E5FF);
    margin-top: 0; /* Remove top margin if padding is sufficient */
    margin-bottom: 15px;
}

/* Style for the linked ToC title */
.blog-toc h3 a.toc-title-link {
    color: inherit; /* Inherit color from h3 */
    text-decoration: none; /* Remove underline */
}

.blog-toc h3 a.toc-title-link:hover {
    text-decoration: none; /* Ensure no underline on hover */
    /* Optional: Add a subtle hover effect if desired */
    /* color: var(--text-gradient-end, #FF8C42); */
}

.blog-toc ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
    align-items: center;
}

.blog-toc li {
    margin-bottom: 8px;
}

/* Style for the new Introduction section - Match Volume style */
.blog-toc > ul > li > span.toc-intro {
    font-family: 'Cormorant Garamond', 'EB Garamond', serif;
    font-weight: 400; /* Match Volume */
    font-size: 1.0rem; /* Match Volume */
    font-variant: small-caps; /* Match Volume */
    color: #ffffff;
    display: block;
    margin-bottom: 10px;
    text-align: left;
    padding-left: 18px; /* Align with collapsible items */
    /* cursor: default; /* If not collapsible */
    /* If collapsible, add cursor: pointer; */
}

/* Style for the new top-level Volume */
.blog-toc > ul > li > span.toc-volume { /* Changed from toc-article */
    font-family: 'Cormorant Garamond', 'EB Garamond', serif; /* Ensure Garamond */
    font-weight: 400; /* Changed from 900 */
    font-size: 1.0rem; /* Reduced font size */
    color: #ffffff;
    display: block;
    margin-bottom: 10px; /* More space below parts */
    cursor: default; /* Not collapsible for now */
    /* text-transform: uppercase; /* Removed uppercase styling */
    text-align: left; /* Ensure left alignment */
    /* Add padding if needed for alignment with collapsible indicators */
    /* padding-left: 18px; */ /* Keep padding if using indicators */
}

.blog-toc > ul > li > ul { /* Indent chapters/entries under volumes */
    padding-left: 10px; /* Consistent 10px indentation */
}

.blog-toc > ul > li > ul > li > span.toc-chapter { /* Chapter level */
    font-family: 'Cormorant Garamond', 'EB Garamond', serif; /* Ensure Garamond */
    font-weight: 400; /* Changed from 700 */
    font-size: 0.85rem; /* Further reduced font size */
    color: #ffffff;
    display: block;
    margin-bottom: 5px;
    text-align: left; /* Ensure left alignment */
    /* cursor: default; /* Now handled by .collapsible */
}

.blog-toc ul ul { /* Sections under Chapters */
    padding-left: 10px; /* Consistent 10px indentation */
    margin-top: 5px;
}

.blog-toc span.toc-section { /* Section level */
    font-family: 'Cormorant Garamond', 'EB Garamond', serif; /* Ensure Garamond */
    font-weight: 400; /* Changed from 500 */
    font-size: 0.85rem; /* Made same as others */
    color: rgba(255, 255, 255, 0.9);
    display: block;
    margin-bottom: 5px;
    text-align: left; /* Ensure left alignment */
    /* cursor: default; /* Now handled by .collapsible */
}

.blog-toc ul ul ul { /* Entries under Sections (3-digit entries) */
    padding-left: 10px; /* Consistent 10px indentation */
}

/* Additional indentation for 4-digit entries (sub-sub-sections) */
.blog-toc ul ul ul ul { /* Sub-sub-sections (4-digit like 1.1.2.1) */
    padding-left: 10px; /* Consistent 10px indentation */
}

/* Systematic approach: Classes for different entry depths */
/* These classes will be added by JavaScript based on content analysis */
.blog-toc .toc-entry-link {
    /* Base indentation for 3-digit entries */
    margin-left: 0;
}

/* Additional left margin for 4-digit entries */
.blog-toc .toc-entry-link.four-digit {
    margin-left: 10px; /* Consistent 10px additional indentation */
}

/* Additional left margin for 5-digit entries (if any exist) */
.blog-toc .toc-entry-link.five-digit {
    margin-left: 20px; /* 20px total (10px more than 4-digit) */
}

/* Style for small caps on Volume level */
.toc-level-volume { /* Changed from toc-level-article */
    font-variant: small-caps;
}

/* Style for placeholder entries */
.toc-entry-link.placeholder {
    color: #666; /* Dim color for placeholders */
    font-style: normal; /* Override italic from .missing */
}

/* Style for all TOC links - ensure consistent Garamond font */
.toc-entry-link,
.toc-introduction-link,
.toc-volume-link,
.toc-part-link,
.toc-chapter-link,
.toc-section-link {
    font-family: 'Cormorant Garamond', 'EB Garamond', serif; /* Ensure Garamond */
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    display: block;
    padding: 3px 0;
    transition: color 0.2s ease, padding-left 0.2s ease;
    border-left: 3px solid transparent; /* For active state */
    padding-left: 5px;
    text-align: left; /* Ensure left alignment */
    /* Add overflow handling */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Specific styling for different levels - All same size now */
.toc-introduction-link {
    font-size: 0.85rem; /* Made same as others */
    font-weight: 400;
    font-variant: small-caps;
    color: #ffffff;
    font-style: normal !important; /* Ensure no italics */
}

.toc-volume-link {
    font-size: 0.85rem; /* Made same as others */
    font-weight: 400;
    color: #ffffff;
    font-variant: small-caps;
    font-style: normal !important; /* Ensure no italics */
}

.toc-part-link {
    font-size: 0.85rem; /* Made same as others */
    font-weight: 400;
    color: rgba(255, 255, 255, 0.95);
    font-style: normal !important; /* Ensure no italics */
}

.toc-chapter-link {
    font-size: 0.85rem; /* Already this size */
    font-weight: 400;
    color: #ffffff;
    font-style: normal !important; /* Ensure no italics */
}

.toc-section-link {
    font-size: 0.85rem; /* Made same as others */
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    font-style: normal !important; /* Ensure no italics */
}

.toc-entry-link {
    font-size: 0.85rem; /* Made same as others */
    font-style: normal !important; /* Ensure no italics */
}

/* Hover states for all link types */
.toc-introduction-link:hover,
.toc-volume-link:hover,
.toc-part-link:hover,
.toc-chapter-link:hover,
.toc-section-link:hover,
.toc-entry-link:hover {
    color: #ffffff;
    padding-left: 8px;
    border-left-color: var(--text-gradient-end, #FF8C42);
}

/* Active states for all link types */
.toc-introduction-link.active,
.toc-volume-link.active,
.toc-part-link.active,
.toc-chapter-link.active,
.toc-section-link.active,
.toc-entry-link.active {
    color: #ffffff;
    font-weight: 500;
    border-left-color: var(--text-gradient-start, #00E5FF);
    background-color: rgba(0, 229, 255, 0.05);
    padding-left: 8px;
}

/* Missing/placeholder states for all link types */
.toc-introduction-link.missing,
.toc-volume-link.missing,
.toc-part-link.missing,
.toc-chapter-link.missing,
.toc-section-link.missing,
.toc-entry-link.missing {
    color: #777;
    font-style: normal !important; /* Removed italic, ensure no italics */
    pointer-events: none;
    cursor: default;
    border-left-color: transparent !important;
    background-color: transparent !important;
    padding-left: 5px !important;
}

/* Style for section numbers in the TOC */
.section-number {
    color: var(--text-gradient-start, #00E5FF);
    font-weight: 600;
    margin-right: 2px;
    font-size: 0.7rem;
}

/* Style for entries directly under Introduction - Match Chapter style */
/* Targets the <a> or <span> within the <li> within the <ul> directly following the .toc-intro span */
.blog-toc > ul > li > span.toc-intro + ul > li > .toc-entry-link {
    font-size: 0.85rem; /* Match Chapter font size */
    font-weight: 400; /* Match Chapter font weight */
    font-style: normal !important; /* Override italics from <i> tag or .missing */
    color: #ffffff; /* Match Chapter color */
}
/* Hover/Active states for Intro entries */
.blog-toc > ul > li > span.toc-intro + ul > li > .toc-entry-link:hover {
    color: #ffffff; /* Keep white on hover like chapters */
    padding-left: 8px;
    border-left-color: var(--text-gradient-end, #FF8C42);
}
.blog-toc > ul > li > span.toc-intro + ul > li > .toc-entry-link.active {
    color: #ffffff; /* Keep white */
    font-weight: 500; /* Slightly bolder like other active links */
    border-left-color: var(--text-gradient-start, #00E5FF);
    background-color: rgba(0, 229, 255, 0.05);
    padding-left: 8px;
}
/* Ensure missing/placeholder intro entries are also not italic */
.blog-toc > ul > li > span.toc-intro + ul > li > .toc-entry-link.missing,
.blog-toc > ul > li > span.toc-intro + ul > li > .toc-entry-link.placeholder {
    font-style: normal !important;
    color: #777; /* Keep dim color */
}

/* --- New Expand/Collapse Button Styles --- */
.toc-item-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toc-expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-gradient-start, #00E5FF);
    border-radius: 3px;
    min-width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.toc-expand-btn:hover {
    background-color: rgba(0, 229, 255, 0.1);
    color: var(--text-gradient-end, #FF8C42);
}

.toc-expand-btn:focus {
    outline: 1px solid var(--text-gradient-start, #00E5FF);
    outline-offset: 1px;
}

.expand-icon {
    font-family: monospace;
    font-size: 1.1em;
    line-height: 1;
}

.toc-no-children {
    min-width: 24px; /* Same width as button to maintain alignment */
}

.toc-children.collapsed {
    display: none;
}

.toc-children {
    display: block;
}

/* Remove old collapsible styles */
.blog-toc .collapsible {
    cursor: pointer;
    position: relative; /* Needed for absolute positioning of pseudo-elements */
    padding-left: 18px; /* Make space for the indicator */
}

.blog-toc .collapsible::before {
    content: '+'; /* Default indicator: collapsed */
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    font-size: 1.1em; /* Adjust size as needed */
    /* Default color removed, will be set by specific level rules */
    width: 15px; /* Ensure consistent spacing */
    text-align: center;
    transition: transform 0.2s ease; /* Smooth rotation */
}

/* Color rules for +/- indicators based on level */
.blog-toc .toc-intro.collapsible::before,
.blog-toc .toc-volume.collapsible::before, /* Changed from toc-article */
.blog-toc .toc-section.collapsible::before {
    color: var(--text-gradient-start, #00E5FF); /* Teal */
}

.blog-toc .toc-chapter.collapsible::before {
    color: var(--text-gradient-end, #FF8C42); /* Orange */
}

.blog-toc .collapsible.expanded::before {
    content: '−'; /* Indicator for expanded state (using minus sign) */
    /* Optional: Rotate plus sign instead:
    content: '+';
    transform: translateY(-50%) rotate(45deg); */
}

.blog-toc .non-collapsible {
     cursor: default;
     padding-left: 18px; /* Align with collapsible items */
}

.blog-toc ul.collapsed {
    display: none;
}

/* Main Content Area Styles */
.blog-content { /* This is the <main> element */
    font-family: 'Cormorant Garamond', 'EB Garamond', serif; /* Ensure base font is Garamond */
    flex: 1; /* Takes remaining space */
    background-color: #ffffff;
    padding: 30px;
    /* Removed border-radius */
    /* Removed border */
    color: #2c3e50;
    line-height: normal; /* Set line-height to normal */
    overflow-y: auto; /* Enable vertical scrolling */
    text-align: left; /* Align text left */
}

/* Target h1 within the main content area */
.blog-content h1 {
    font-family: 'Cormorant Garamond', 'EB Garamond', serif; /* Changed font */
    font-size: 2.2rem;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 25px;
    border-bottom: 1px solid #007bff;
    padding-bottom: 10px;
}

/* Style for Bluebook citation */
.blog-citation {
    font-size: 0.85rem !important; /* Ensure this size trumps the base */
    color: #6c757d;
    margin-top: -15px; /* Pull it closer to the H1 */
    margin-bottom: 25px;
    font-style: normal; /* Ensure it's not italic by default */
}

.blog-citation i,
.blog-citation .citation-title {
    font-style: normal;
    font-variant: small-caps;
}

.blog-citation .citation-author {
    font-variant: small-caps;
}

.how-to-cite-citation {
    font-size: 0.85rem;
    color: #6c757d;
    font-style: normal;
}

.how-to-cite-citation .citation-author,
.how-to-cite-citation .citation-title {
    font-variant: small-caps;
}

/* Style for the separator and history link */
.history-link-separator {
    margin: 0 5px; /* Add space around the pipe */
    color: #adb5bd;
}

.view-history-link {
    /* Inherits color from .blog-content a */
    /* text-decoration: none; /* Already set by .blog-content a */
    font-size: inherit; /* Match citation font size */
}

.view-history-link:hover { text-decoration: underline; }

/* Target h2 within the main content area */
.blog-content h2 {
    font-family: 'Cormorant Garamond', 'EB Garamond', serif; /* Changed font */
    font-size: 1.8rem; /* Keep size */
    color: #2c3e50;
    margin-top: 30px;
    margin-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 8px; /* Keep style */
}

/* Target h3 within the main content area */
.blog-content h3 {
    font-family: 'Cormorant Garamond', 'EB Garamond', serif; /* Changed font */
    font-weight: 700; /* Keep style */
    font-size: 1.4rem; /* Keep size */
    color: #495057;
    margin-top: 25px; /* Keep style */
    margin-bottom: 10px; /* Keep style */
}

/* Keep general content styles, but ensure they target within .blog-content */
.blog-content p {
    margin-bottom: 1.2em;
    font-size: 1.1rem; /* Restoring explicit font-size for paragraphs */
    color: #2c3e50;
}

/* Links */
.blog-content a {
    color: #0056b3;
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.blog-content a:hover {
    color: #004085;
    text-decoration: underline;
}

/* Strong text */
.blog-content strong {
    font-weight: 700;
    color: #000000;
}

/* Blockquotes */
.blog-content blockquote {
    background-color: #f1f3f5;
    color: #6c757d;
    border-left: 4px solid #007bff;
    margin: 1em 0;
    padding: 1em;
    font-style: italic;
}

/* Adapt citation styles */
.blog-content .citations-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
    font-size: 0.75rem; /* Made smaller than main text */
    color: #6c757d;
    line-height: 1.4; /* Better line spacing for smaller text */
}

/* Citations section headings */
.blog-content .citations-section h2,
.blog-content .citations-section strong {
    font-family: 'Cormorant Garamond', 'EB Garamond', serif; /* Changed font */
    font-size: 1.1rem; /* Smaller than before but larger than citations */
    color: #007bff;
    margin-bottom: 15px;
    border-bottom: none;
}

.blog-content .citations-section ol,
.blog-content .citations-section ul {
    padding-left: 0; /* Remove default padding */
    list-style: none; /* Remove bullets since sources use • manually */
    margin: 0; /* Remove default margin */
}

.blog-content .citations-section li {
    margin-bottom: 6px; /* Slightly smaller spacing */
    white-space: nowrap; /* Prevent wrapping to single line */
    overflow: hidden; /* Hide overflow */
    text-overflow: ellipsis; /* Add ellipsis for long entries */
    line-height: 1.3; /* Tighter line height */
    /* Override any pointer-events: none that might be inherited */
    pointer-events: auto;
}

/* Style links within Sources section specifically */
.blog-content .citations-section a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.blog-content .citations-section a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Target Sources sections that appear after h2 headings */
.blog-content h2 + ul {
    font-size: 0.75rem;
    color: #6c757d;
    padding-left: 0;
    list-style: none;
    margin: 0;
}

.blog-content h2 + ul li {
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    pointer-events: auto;
}

/* Links in h2 + ul */
.blog-content h2 + ul a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.blog-content h2 + ul a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Alternative approach: Target sections that come near the end of entries */
.blog-content h2:last-of-type + ul,
.blog-content h2:nth-last-of-type(1) + ul,
.blog-content h2:nth-last-of-type(2) + ul {
    font-size: 0.95rem;
    color: #6c757d;
    padding-left: 0;
    list-style: none;
    margin: 0;
}

.blog-content h2:last-of-type + ul li,
.blog-content h2:nth-last-of-type(1) + ul li,
.blog-content h2:nth-last-of-type(2) + ul li {
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    pointer-events: auto;
}

/* Links in last-of-type + ul */
.blog-content h2:last-of-type + ul a,
.blog-content h2:nth-last-of-type(1) + ul a,
.blog-content h2:nth-last-of-type(2) + ul a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.blog-content h2:last-of-type + ul a:hover,
.blog-content h2:nth-last-of-type(1) + ul a:hover,
.blog-content h2:nth-last-of-type(2) + ul a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Index Page Specific Styles */
/* Style for Volume titles in main content */
.blog-content .index-volume-title { /* Changed from index-article-title */
    font-family: 'Cormorant Garamond', 'EB Garamond', serif; /* Changed font */
    font-size: 1.8rem; /* Same as old chapter title */
    color: #2c3e50;
    margin-top: 30px;
    margin-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 8px;
}

/* Style for Chapter titles (now H3) in main content */
.blog-content .index-chapter-title {
    font-family: 'Cormorant Garamond', 'EB Garamond', serif; /* Changed font */
    font-weight: 700;
    font-size: 1.4rem;
    color: #495057;
    margin-top: 25px;
    margin-bottom: 10px;
    /* Remove bottom border if desired */
}

/* Style for Section titles (now H4) in main content */
.blog-content .index-section-title {
    font-family: 'Cormorant Garamond', 'EB Garamond', serif; /* Changed font */
    font-weight: 500; /* Slightly less bold */
    font-size: 1.1rem;
    color: #6c757d;
    margin-top: 20px;
    margin-bottom: 8px;
}

.blog-content .index-entry-list { /* Target within .blog-content */
    list-style: none;
    padding-left: 20px; /* Keep indentation */
}

/* Index entry links */
.blog-content .index-entry-link { /* Target within .blog-content */
    color: #0056b3;
    text-decoration: none;
}

.blog-content .index-entry-link:hover { /* Target within .blog-content */
    color: #004085;
    text-decoration: underline;
}

/* Missing entry links */
.blog-content .index-entry-link.missing { /* Target within .blog-content */
    color: #adb5bd;
    font-style: italic;
    pointer-events: none;
}

/* Responsive Design - Adapt or rely on main bundle.css */
/* Consider removing or adjusting these if main styles handle responsiveness */

@media (max-width: 1000px) {
    /* Hide the nudge buttons on smaller screens */
    .subscribe-nudge-button, .nunn-ai-nudge-button { display: none !important; }
    .corner-coffee { display: none !important; }
}

@media (max-width: 768px) {
     /* Adjust layout for treatise content within the new structure */
    .blog-view-container {
        height: auto; /* Allow height to adjust */
        margin-top: 5px;
    }
    .blog-content-wrapper {
        flex-direction: column;
    }
    /* Ensure main grows beneath sidebar to accommodate its total height */
    .blog-content-wrapper > .blog-content { flex: 1 0 auto; }
    .blog-sidebar {
        flex: 0 0 auto; /* Allow sidebar to shrink */
        width: 100%;
        height: auto; /* Expand to encompass header + panel */
        max-height: none;
        margin-bottom: 15px; /* Space between sidebar and content */
        border-right: none; /* Remove border */
        border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Add bottom border */
        position: relative; /* stacking context above content */
        z-index: 2;
        overflow: visible !important; /* allow dropdown to extend beyond */
    }
    .blog-content {
        height: auto; /* Auto height */
        padding: 15px;
        position: relative;
        z-index: 1; /* ensure below sidebar dropdown */
    }
     /* Mobile: make blog header full-width without padding/margins */
    .blog-header-title {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    /* Mobile: hide home button; keep only hamburger with 10px right margin */
    .blog-body .home-button { display: none !important; }
    .blog-body .hamburger-menu { right: 10px !important; margin-right: 10px !important; }
    
    .blog-body .container {
        margin-top: 10px;
    }
    /* Mobile: add horizontal margins and allow overflow for dropdown */
    .blog-sidebar .toc-scroll-container { margin: 0 10%; overflow: visible !important; height: auto; }
    .blog-sidebar .toc-scroll-container .blog-sidebar-panel .panel-list { max-height: none !important; }
    
     /* Further adjustments if needed, potentially handled by main CSS */
     .blog-content h1 { font-size: 1.8rem; }
     .blog-content h2 { font-size: 1.5rem; }
     .blog-content h3 { font-size: 1.2rem; }
     /* Mobile: override main blog title size */
    .blog-main-title .blog-main-title-text {
        font-size: 2.7rem !important;
    }
     .blog-welcome .blog-main-title .blog-logo-main {
        font-size: 2.5rem;
     }
     .blog-body .hamburger-menu .menu-toggle-btn {
        position: fixed;
        right: 10px;
        top: 10px;
     }

    /* Blog sidebar: hide default list and its container; show mobile paginated container */
    #blog-panel-list { display: none !important; }
    #blog-posts-list { display: none !important; }
    .mobile-posts-container { 
        display: block; 
        width: 97%;
        margin: 10px auto 0 auto; 
    }
    .mobile-posts-container:empty { display: none !important; }
    .mobile-posts-container .mobile-post-item {
        width: 100%;
        margin: 0 0 8px 0;
    }
    .mobile-posts-container .mobile-post-link {
        display: flex;
        align-items: center;
        width: 100%;
        height: 42px; /* touch-friendly */
        padding: 0 10px 0 14px;
        border-radius: 12px;
        border: 1px solid rgba(0, 229, 255, 0.25);
        background: linear-gradient(135deg, rgba(0, 229, 255, 0.1), rgba(255, 140, 66, 0.05));
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        color: rgba(255, 255, 255, 0.9);
        text-decoration: none;
        transition: all 0.3s ease;
        backdrop-filter: blur(10px);
        box-sizing: border-box;
        position: relative;
    }
    .mobile-posts-container .mobile-post-link:hover {
        border-color: rgba(0, 229, 255, 0.5);
        color: #ffffff;
        text-decoration: none;
    }
    .mobile-posts-container .mobile-post-link .post-text {
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.9rem;
        line-height: 1;
    }
    .mobile-posts-container .mobile-next-btn {
        width: 100%;
        height: 42px;
        border-radius: 10px;
        border: 1px solid rgba(0, 229, 255, 0.25);
        background: rgba(12, 17, 31, 0.7);
        color: #e6f2ff;
        font-family: 'Cormorant Garamond', 'EB Garamond', serif;
        font-size: 1rem;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    .mobile-posts-container .mobile-next-btn:hover {
        background: rgba(0, 229, 255, 0.15);
        color: #ffffff;
        border-color: rgba(0, 229, 255, 0.5);
    }

    /* Main-content preview cards for mobile homepage */
    .mobile-home-previews { 
        display: block; 
        margin-top: 10px; 
        width: 100%; 
    }
    .mobile-preview-card {
        width: 100%;
        margin: 0 0 12px 0;
        border-radius: 12px;
        border: 1px solid rgba(0, 229, 255, 0.25);
        background: linear-gradient(135deg, rgba(0, 229, 255, 0.08), rgba(255, 140, 66, 0.05));
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
        overflow: hidden;
    }
    .mobile-preview-link {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 14px 12px 16px;
        text-decoration: none;
        color: #0c2d48;
        position: relative;
    }
    .mobile-preview-link .color-bar {
        position: relative;
        width: 4px;
        height: 24px;
        border-radius: 2px;
        flex-shrink: 0;
    }
    .mobile-preview-title {
        font-size: 1.0rem;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: #0c2d48;
    }
    .mobile-preview-meta {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 0 16px 0 16px;
        color: #0c2d48;
        flex-wrap: wrap;
    }
    .mobile-preview-meta .authors {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
    .mobile-preview-meta .dot { color: #666; }
    .author-avatar {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        object-fit: cover;
    }
    .author-name { font-size: 0.85rem; color: #0c2d48; }
    .category-badge {
        font-size: 0.75rem;
        padding: 2px 6px;
        border-radius: 999px;
        border: 1px solid rgba(0,0,0,0.1);
        background: #f1f3f5;
        color: #495057;
    }
    .mobile-preview-excerpt {
        padding: 6px 16px 4px 16px;
        margin: 0;
        font-size: 0.95rem;
        color: #0c2d48;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .mobile-preview-button {
        display: inline-block;
        margin: 8px 16px 14px 16px;
        padding: 8px 12px;
        border-radius: 10px;
        border: 1px solid rgba(0, 229, 255, 0.25);
        background: rgba(12, 17, 31, 0.05);
        color: #0056b3;
        text-decoration: none;
        font-family: 'Cormorant Garamond', 'EB Garamond', serif;
        transition: all 0.2s ease;
    }
    .mobile-preview-button:focus,
    .mobile-preview-link:focus {
        outline: 2px solid rgba(0, 229, 255, 0.7);
        outline-offset: 2px;
    }
    .mobile-preview-button:hover {
        background: rgba(0, 229, 255, 0.08);
        border-color: rgba(0, 229, 255, 0.5);
        text-decoration: none;
    }
    /* Next Page button within main previews container */
    .mobile-home-previews .mobile-next-btn {
        width: 100%;
        height: 42px;
        border-radius: 10px;
        border: 1px solid rgba(0, 229, 255, 0.25);
        background: rgba(12, 17, 31, 0.05);
        color: #0056b3;
        font-family: 'Cormorant Garamond', 'EB Garamond', serif;
        font-size: 1rem;
        cursor: pointer;
        transition: all 0.2s ease;
        margin: 4px 0 12px 0;
    }
    .mobile-home-previews .mobile-next-btn:hover {
        background: rgba(0, 229, 255, 0.08);
        border-color: rgba(0, 229, 255, 0.5);
        color: #004085;
    }
}

@media (min-width: 769px) {
    /* Ensure mobile container never shows on desktop */
    .mobile-posts-container { display: none !important; }
}

/* ================================================================
   TREATISE-SPECIFIC NAVIGATION BUTTONS (nunn.law only)
================================================================ */

/* New nunn.ai button in top left - replicates upgrade nudge button styling */
.subscribe-nudge-button {
  position: fixed;
  top: 17px;
  left: 25px;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  padding: 0 16px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #ffffff !important;
  font-weight: 400;
  font-family: 'Cormorant Garamond', 'EB Garamond', serif;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  min-width: 140px;
  text-decoration: none;
  font-size:0.95rem;
  overflow: hidden;
  margin-left: 50px;
  justify-content: center;
  background-color: transparent;
}

/* Keep original nunn-ai-nudge-button styles for legacy references (none on blog top-left) */
.nunn-ai-nudge-button {
  position: fixed;
  top: 17px;
  left: 20px;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  padding: 0 16px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #ffffff !important;
  font-weight: 400;
  font-family: 'Cormorant Garamond', 'EB Garamond', serif;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  min-width: 140px;
  text-decoration: none;
  overflow: hidden;
  margin-left: 50px;
}
.nunn-ai-nudge-button:hover {
  background: linear-gradient(135deg, #002a6a, #0048bf);
  border-color: rgba(255, 140, 66, 0.7);
  transform: translateY(-1px);
  box-shadow: 0 0 10px rgba(255, 140, 66, 0.6), 0 0 20px rgba(255, 140, 66, 0.45), 0 0 30px rgba(255, 140, 66, 0.3);
  color: #ffffff !important;
  text-decoration: none !important;
}

.subscribe-nudge-button:hover {
  background: linear-gradient(135deg, #002a6a, #0048bf);
  border-color: rgba(255, 140, 66, 0.7);
  transform: translateY(-1px);
  /* Orange glow similar to Search button */
  box-shadow: 0 0 10px rgba(255, 140, 66, 0.6), 0 0 20px rgba(255, 140, 66, 0.45), 0 0 30px rgba(255, 140, 66, 0.3);
  color: #ffffff !important; /* Ensure text stays white on hover */
  text-decoration: none !important; /* Prevent underline on hover */
}

/* nunn.ai logo styling within the button - replicates main logo format but smaller */
.nunn-ai-logo {
  font-family: 'Cormorant Garamond', 'EB Garamond', serif;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: lowercase;
  color: #ffffff;
  text-shadow: 0px 0px 5px var(--text-gradient-start, #00E5FF);
  animation: glowCycle 3s infinite alternate;
  white-space: nowrap;
  line-height: 1.2;
}

/* PRO indicator for nunn.ai logo - replicates main logo PRO styling but smaller */
.nunn-ai-pro-indicator {
  display: inline-block;
  position: relative;
  top: -0.7em;
  font-size: 0.4em;
  margin-left: 0.2em;
  font-weight: 900;
  letter-spacing: 0.05em;
  font-family: 'Cormorant Garamond', 'EB Garamond', serif;
  text-transform: uppercase;
  transition: all 0.3s ease;
}

.nunn-ai-pro-indicator.active {
  background: linear-gradient(90deg, #00c6ff, #FF8C42);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 3s ease infinite;
  filter: drop-shadow(0 0 2px rgba(0, 198, 255, 0.5));
  color: transparent;
  text-shadow: none;
}

/* Social media wrapper - positions the social icons */
.social-nav-right {
  position: fixed;
  top: 17px;
  right: 120px; /* adjusted to narrow gap to 10px */
  display: flex;
  gap: 10px; /* consistent spacing */
  z-index: 1000;
  align-items: center;
}

/* Social buttons styling: identical to home-button icons */
.social-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(12, 17, 31, 0.7);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  text-decoration: none;
  font-size: 16px;
  z-index: 1000;
}

/* Hover state for social buttons */
.social-btn:hover {
  background: linear-gradient(135deg, #001e3c, #00398f);
  border-color: rgba(0, 198, 255, 0.7);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 198, 255, 0.3);
  color: #ffffff;
}

/* Vertically center home and menu buttons in header */
.home-button,
.hamburger-menu {
  top: 17px;
}

/* ----------------------------------------------------------------
   OVERRIDE BUNDLE.CSS FOR NAVIGATION BUTTONS ON TREATISE
---------------------------------------------------------------- */
/* Ensure treatise-body pages have proper nav button styles */
.blog-body .home-button {
  position: fixed !important;
  top: 17px !important;
  margin-right: 50px !important;
}
.blog-body .home-button .home-btn {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  background: rgba(12, 17, 31, 0.7) !important;
  backdrop-filter: blur(5px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
  transition: all 0.3s ease !important;
}
.blog-body .home-button .home-btn:hover {
  background: linear-gradient(135deg, #001e3c, #00398f) !important;
  border-color: rgba(0, 198, 255, 0.7) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 15px rgba(0, 198, 255, 0.3) !important;
}

.blog-body .hamburger-menu {
  position: fixed !important;
  top: 17px !important;
  right: 20px !important;
  margin-right: 50px !important;
}
.blog-body .hamburger-menu .menu-toggle-btn {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  background: rgba(12, 17, 31, 0.7) !important;
  backdrop-filter: blur(5px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
  transition: all 0.3s ease !important;
}
.blog-body .hamburger-menu .menu-toggle-btn:hover {
  background: linear-gradient(135deg, #001e3c, #00398f) !important;
  border-color: rgba(0, 198, 255, 0.7) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 15px rgba(0, 198, 255, 0.3) !important;
}

/* Strongly override any resets to apply professional text shadow to the treatise title */
.blog-header-title .blog-title {
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5) !important;
}

/* Full-page table of contents styling */
.toc-full-page {
    font-family: 'Cormorant Garamond', 'EB Garamond', serif;
}

/* Blog About modal: make Buy Me a Coffee button white and size like CV button */
#about-modal .about-sidebar .about-coffee-button {
  background: #ffffff !important;
  border-radius: 40px;
  padding: 1px 25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: auto;
}
#about-modal .about-sidebar .about-coffee-button img {
  height: 45px; /* visually match cv-button line-height */
  display: block;
}

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

.toc-full-page li {
    margin-bottom: 8px;
}

/* Ensure all TOC elements in full-page view have same styling */
.toc-full-page .toc-entry-link,
.toc-full-page .toc-introduction-link,
.toc-full-page .toc-volume-link,
.toc-full-page .toc-part-link,
.toc-full-page .toc-chapter-link,
.toc-full-page .toc-section-link {
    font-size: 0.85rem !important; /* Same size for all */
    font-style: normal !important; /* No italics */
    font-family: 'Cormorant Garamond', 'EB Garamond', serif;
    color: #0056b3; /* Use link color for main content area */
    text-decoration: none;
    display: block;
    padding: 3px 0;
    transition: color 0.2s ease;
}

.toc-full-page .toc-entry-link:hover,
.toc-full-page .toc-introduction-link:hover,
.toc-full-page .toc-volume-link:hover,
.toc-full-page .toc-part-link:hover,
.toc-full-page .toc-chapter-link:hover,
.toc-full-page .toc-section-link:hover {
    color: #004085;
    text-decoration: underline;
}

/* Reduce indentation in full-page view as well */
.toc-full-page ul ul {
    padding-left: 10px; /* Consistent 10px indentation */
}

.toc-full-page .toc-entry-link.four-digit {
    margin-left: 10px; /* Consistent 10px additional indentation */
}

.toc-full-page .toc-entry-link.five-digit {
    margin-left: 20px; /* 20px total (10px more than 4-digit) */
}

@media (max-width: 768px) {
  .byline {
    font-size: 1.0rem !important;
  }
  /* Mobile: force main blog title to 2.7rem even if inline styles exist */
  h1.blog-main-title > div > span {
    font-size: 2.7rem !important;
  }
}
