/* General Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
}

/* Night Mode (Default) */
body.dark-mode {
    background-color: #000000;
    color: #FFFFFF;
}

/* Day Mode */
body.light-mode {
    background-color: #FFFFFF;
    color: #000000;
}

/* Links */
a {
    text-decoration: none;
    transition: color 0.3s ease;
}

body.dark-mode a {
    color: #AAAAAA;
}

body.light-mode a {
    color: #555555;
}

a:hover {
    color: #FFFFFF;
}

/* Header Section */
.header {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    text-align: center;
    background-color: #000; /* èƒŒæ™¯è‰²ç”¨äºŽæ— å›¾ç‰‡æ—¶ */
    color: #fff;
    overflow: hidden;
}

/* Promo Banner Background */
.promo-banner {
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.3) 20%, /* å¤œé—´æ¨¡å¼ï¼šé¡¶éƒ¨æ¸å˜å°‘ */
        rgba(0, 0, 0, 0.8) 80% /* å¤œé—´æ¨¡å¼ï¼šåº•éƒ¨æ¸å˜å¤š */
    ), 
    url('ace.png'); /* æ›¿æ¢ä¸ºä½ çš„å®£ä¼ å›¾è·¯å¾„ */
    background-size: cover; /* ç¡®ä¿å›¾ç‰‡è¦†ç›–æ•´ä¸ªåŒºåŸŸ */
    background-position: center; /* å›¾ç‰‡å±…ä¸­æ˜¾ç¤º */
    background-repeat: no-repeat; /* ä¸é‡å¤å›¾ç‰‡ */
    height: 100vh; /* é«˜åº¦å¡«å……æ•´ä¸ªè§†å£ */
    justify-content: center;
    align-items: center;
    position: relative; /* ä¿æŒæ–‡å­—å’ŒèƒŒæ™¯å åŠ  */
    color: white; /* ç¡®ä¿æ–‡å­—é¢œè‰²æ¸…æ™° */
    transition: background 0.3s ease; /* å¹³æ»‘åˆ‡æ¢ç™½å¤©/å¤œé—´æ¨¡å¼ */
}

/* ç™½å¤©æ¨¡å¼çš„æ¸å˜æ•ˆæžœ */
body.light-mode .promo-banner {
    background: #f8f9fa; /* æ›¿æ¢ä¸ºä½ çš„å®£ä¼ å›¾è·¯å¾„ */
    background-size: cover; /* ç¡®ä¿å›¾ç‰‡è¦†ç›–æ•´ä¸ªåŒºåŸŸ */
    background-position: center; /* å›¾ç‰‡å±…ä¸­æ˜¾ç¤º */
    background-repeat: no-repeat; /* ä¸é‡å¤å›¾ç‰‡ */
    height: 100vh; /* é«˜åº¦å¡«å……æ•´ä¸ªè§†å£ */
    justify-content: center;
    align-items: center;
    position: relative; /* ä¿æŒæ–‡å­—å’ŒèƒŒæ™¯å åŠ  */
    color: white; /* ç¡®ä¿æ–‡å­—é¢œè‰²æ¸…æ™° */
    transition: background 0.3s ease; /* å¹³æ»‘åˆ‡æ¢ç™½å¤©/å¤œé—´æ¨¡å¼ */
}


/* Title in Header */
.header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    color: #ffffff; /* ç¡®ä¿æ–‡å­—ä¸ºç™½è‰²ï¼Œé€‚é…æ·±è‰²èƒŒæ™¯ */
    margin: 0;
    z-index: 1; /* ç¡®ä¿æ ‡é¢˜æ˜¾ç¤ºåœ¨å›¾ç‰‡ä¸Šæ–¹ */
    text-shadow: none; /* åŽ»æŽ‰æ–‡å­—é˜´å½± */
}

/* Scroll Bar Style */
.scroll-bar {
    position: absolute;
    bottom: 5vh;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: max(5vw, 60px);
    height: max(1vh, 8px);
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.scroll-bar::after {
    content: "";
    display: block;
    width: max(3vw, 40px);
    height: max(0.5vh, 3px);
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 50px;
    animation: pulse 1.8s infinite;
    transition: background-color 0.3s ease;
}

body.light-mode .scroll-bar {
    background-color: rgba(0, 0, 0, 0.15);
}

body.light-mode .scroll-bar::after {
    background-color: rgba(0, 0, 0, 0.7);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: translateY(0);
    }
    50% {
        opacity: 0.5;
        transform: translateY(max(0.8vh, 8px));
    }
}

/* Navigation Bar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%; /* è¦†ç›–æ•´ä¸ªå±å¹•å®½åº¦ */
    height: 60px;
    display: flex;
    justify-content: center; /* å±…ä¸­å¯¹é½å†…éƒ¨å†…å®¹ */
    background-color: transparent;
    color: inherit;
    padding: 0 20px;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.navbar-content {
    width: 100%;
    max-width: 1200px; /* å†…å®¹æœ€å¤§å®½åº¦ */
    display: flex;
    justify-content: space-between; /* å·¦å³å¯¹é½ */
    align-items: center;
}

body.dark-mode .navbar {
    background-color: rgba(0, 0, 0, 0.8);
}

body.light-mode .navbar {
    background-color: rgba(255, 255, 255, 0.8);
}

/* Context Bar */
.context-bar {
    position: sticky;
    top: 80px;
    width: 160px;
    padding-right: 20px;
    max-height: calc(100vh - 80px);
    overflow: auto;
}

.context-bar ul {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: #fff;
    border-radius: 8px;
    padding: 10px;
}

.context-bar ul li {
    margin: 10px 0;
}

.context-bar ul li a {
    font-size: 1rem;
    padding: 10px;
    text-decoration: none;
    color: #000;
    border-radius: 4px;
    display: block;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.context-bar ul li a:hover {
    background-color: #444;
    color: #fff;
}

/* Placeholder for content alignment */
.content-placeholder {
    width: 250px;
    visibility: hidden;
}

/* Main Content Section */
.content {
    margin: 0 auto;
    display: flex;
    margin-top: 60px;
    min-height: calc(100vh - 60px);
    align-items: start;
    max-width: 1200px;
    padding: 0 2rem;
    width: 100%;
    position: relative; /* Add this for side note positioning */
}

.content-section {
    flex: 1;
    max-width: 700px; /* Limit content width for better readability */
    margin: 0 auto; /* Center the content */
    padding: 0 50px; /* Add padding to prevent overlap with side notes */
}

.content-section h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.content-section p {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 40px;
}

/* Mode Toggle Button */
.mode-toggle {
    font-size: 1.5rem;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.mode-toggle:hover {
    transform: scale(1.2);
}

/* Footer Section */
.footer {
    text-align: center;
    padding: 20px 10px;
    font-size: 0.9rem;
    color: inherit;
}

.footer a {
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: inherit;
}

/* Section Adjustment for Navbar */
.section {
    position: relative;
    padding-top: 80px;
    margin-top: -80px;
}
/* Responsive Design Adjustments */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    .navbar {
        flex-direction: column;
        height: auto;
    }
    .context-bar {
        width: 100%;
        position: static;
        height: auto;
    }
    .content {
        flex-direction: column;
        padding: 20px;
    }
    .content-section {
        padding-left: 0;
    }
    .footer {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }
    .navbar-content {
        flex-direction: column;
        align-items: center;
    }
    .mode-toggle {
        font-size: 1.2rem;
    }
    .content {
        padding: 10px;
    }
}

@media (max-width: 768px) {
    .context-bar {
        display: none; /* Hide context bar on smaller screens */
    }
    .content {
        padding: 0 2.5rem; /* Remove padding reserved for context bar */
    }
    .content-placeholder {
        display: none; /* Hide placeholder when context bar is not visible */
    }
}

@media (max-width: 768px) {
    .navbar-content {
        max-width: none; /* Remove the max-width restriction for mobile */
        width: 100%; /* Make navbar content span the full width */
    }
    .navbar {
        flex-direction: column; /* Stack navbar items vertically on smaller screens */
    }
}

/* Header Buttons */
.header-buttons {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.header-button {
    text-decoration: none;
    font-size: 1rem;
    padding: 10px 25px;
    color: #ffffff !important; /* å¼ºåˆ¶æ–‡å­—ä¸ºç™½è‰² */
    background-color: transparent; /* èƒŒæ™¯é€æ˜Ž */
    border: 2px solid rgba(255, 255, 255, 0.8); /* åŠé€æ˜Žç™½è‰²è¾¹æ¡† */
    border-radius: 25px; /* åœ†æ¶¦è®¾è®¡ */
    font-weight: 500; /* å­—ä½“ç¨åŠ ç²— */
    transition: background-color 0.3s ease, transform 0.2s ease, border-color 0.3s ease;
}

.header-button:hover {
    background-color: rgba(255, 255, 255, 0.1); /* é¼ æ ‡æ‚¬åœæ—¶ç™½è‰²èƒŒæ™¯ */
    border-color: rgba(255, 255, 255, 1); /* é¼ æ ‡æ‚¬åœæ—¶è¾¹æ¡†å˜ä¸ºçº¯ç™½ */
    transform: translateY(-2px); /* é¼ æ ‡æ‚¬åœæ—¶è½»å¾®ä¸Šç§» */
}

/* Byline Section */
.byline {
    margin: 40px 20px;
    padding: 20px;
    background-color: inherit; /* é€‚åº”å½“å‰ä¸»é¢˜ï¼ˆå¤œé—´/ç™½å¤©ï¼‰ */
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.byline-container {
    display: flex;
    flex-wrap: wrap; /* é€‚åº”å°å±å¹•ï¼Œè‡ªåŠ¨æ¢è¡Œ */
    gap: 40px;
    max-width: 1200px;
    width: 100%;
    justify-content: space-around;
}

/* Columns */
.byline-column {
    flex: 1;
    min-width: 200px; /* æ¯åˆ—æœ€å°å®½åº¦ */
}

.byline-column h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: inherit; /* é€‚åº”ä¸»é¢˜è‰² */
}

.byline-column p {
    margin: 8px 0;
    font-size: 1rem;
    color: inherit; /* é€‚åº”ä¸»é¢˜è‰² */
}

/* Links */
.author-link, .affiliation-link {
    text-decoration: none;
    font-weight: 500;
    color: inherit;
    transition: color 0.3s ease;
}

.author-link:hover, .affiliation-link:hover {
    color: #FFD700; /* é¼ æ ‡æ‚¬åœæ—¶çš„é«˜äº®é¢œè‰² */
}

/* Superscript Styling */
.byline-column p sup {
    font-size: 0.8rem;
    vertical-align: top;
    margin-left: 5px;
    color: #AAAAAA; /* æ¬¡è¦ä¿¡æ¯ç”¨æµ…ç°è‰² */
}

/* Responsive Design */
@media (max-width: 768px) {
    .byline-container {
        flex-direction: column; /* å°å±å¹•ä¸‹åž‚ç›´å¸ƒå±€ */
        align-items: center;
    }

    .byline-column {
        flex: none;
        width: 100%;
        text-align: center;
    }

    .byline-column h3 {
        margin-top: 20px;
    }
}


.double-column {
    --left-width: 0.5; /* é»˜è®¤å·¦æ å®½åº¦æ¯”ä¾‹ä¸º0.5 (50%) */
    display: grid;
    grid-template-columns: calc(var(--left-width) * 100%) calc((1 - var(--left-width)) * 100%);
    gap: 2rem;
    margin: 2rem 0;
}

.double-column .left-column,
.double-column .right-column {
    width: 100%;
}

.card {
    --card-padding: 1.5rem;
    --card-radius: 12px;
    position: relative;
    border-radius: var(--card-radius);
    padding: var(--card-padding);
    overflow: hidden;
    background-color: #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 100px;
    display: flex;
    flex-direction: column;
}

/* å¡ç‰‡èƒŒæ™¯ */
.card-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* å¡ç‰‡å†…å®¹å®¹å™¨ */
.card-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* å¡ç‰‡æ ‡é¢˜ */
.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: inherit;
}

/* å¡ç‰‡ä¸»ä½“å†…å®¹ */
.card-body {
    flex: 1;
}

/* æš—è‰²èƒŒæ™¯æ—¶çš„æ–‡å­—é¢œè‰² */
.card.dark-theme {
    color: #ffffff;
}

/* å¡ç‰‡æ‚¬åœæ•ˆæžœ */
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* èƒŒæ™¯å åŠ å±‚ï¼ˆç”¨äºŽç¡®ä¿æ–‡å­—å¯è¯»æ€§ï¼‰ */
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0.4));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.card.dark-theme .card-overlay {
    opacity: 1;
}

.flip-container {
  position: relative;
  width: 100%;
  perspective: 1000px;
}

.flip-inner {
  position: relative;
  width: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flip-container:hover .flip-inner {
  transform: rotateY(180deg);
}

.flip-front,
.flip-back {
  width: 100%;
  backface-visibility: hidden;
  border-radius: var(--card-radius);
}

.flip-front img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--card-radius);
}

.flip-back {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  transform: rotateY(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
}

.flip-back img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--card-radius);
  background: #ffffff;
}

.head-content {
    font-size: 1.1rem;
    color: #444;
    max-width: 1500px;
}

@media (max-width: 768px) {
    .double-column {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}
@media (max-width: 768px) {
    .head-content {
        font-size: 1rem;
        color: #444;
        padding: 0 2rem;
    }
    .card {
        width: 100%;
    }
    .banner {
        padding: 1rem 2rem;
    }

    .menu-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -300px;
        width: 300px;
        height: 100vh;
        background-color: white;
        flex-direction: column;
        padding: 80px 2rem 2rem;
        gap: 2rem;
        transition: right 0.3s ease;
        z-index: 999;
    }

    .nav-links.active {
        right: 0;
    }

    .overlay.active {
        display: block;
    }

    /* æ±‰å ¡èœå•åŠ¨ç”» */
    .menu-toggle.active span:first-child {
        transform: rotate(45deg) translate(6px, 6px);
    }

    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.active span:last-child {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    main {
        padding: 1rem;
    }
}

.banner {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.banner .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.nav-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

@media (min-width: 2000px) {
    .container {
        max-width: 1400px;
    }
    .content {
        max-width: 1400px;
    }
}

/* ä¸­ç­‰å®½åº¦å±å¹•é€‚é… */
@media (max-width: 1200px) {
    .container {
        max-width: 900px;
    }
    .content {
        max-width: 900px;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;

}

/* Blockquote Styles */
blockquote {
    position: relative;
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    font-size: 1.125rem;
    font-style: italic;
    line-height: 1.8;
    color: #666;
    background-color: rgba(0, 0, 0, 0.02);
    border-left: 4px solid #333;
    border-radius: 0 8px 8px 0;
    transition: all 0.3s ease;
}

/* Dark mode blockquote */
body.dark-mode blockquote {
    color: #ccc;
    background-color: rgba(255, 255, 255, 0.05);
    border-left-color: #fff;
}

/* Light mode blockquote */
body.light-mode blockquote {
    color: #555;
    background-color: rgba(0, 0, 0, 0.03);
    border-left-color: #000;
}

/* Optional: Add quotation marks */
blockquote::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 10px;
    font-size: 4rem;
    color: rgba(0, 0, 0, 0.1);
    font-family: Georgia, serif;
    line-height: 1;
}

body.dark-mode blockquote::before {
    color: rgba(255, 255, 255, 0.1);
}

/* Hover effect */
blockquote:hover {
    transform: translateX(5px);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
}

body.dark-mode blockquote:hover {
    box-shadow: -5px 0 20px rgba(255, 255, 255, 0.05);
}

/* Attribution style (if needed) */
blockquote cite {
    display: block;
    margin-top: 1rem;
    font-size: 0.9rem;
    font-style: normal;
    text-align: right;
    opacity: 0.8;
}

blockquote cite::before {
    content: "â€” ";
}

/* Responsive adjustments */
@media (max-width: 768px) {
    blockquote {
        margin: 1.5rem 0;
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    blockquote::before {
        font-size: 3rem;
        top: -5px;
        left: 5px;
    }
}

/* Alternative minimal style */
blockquote.minimal {
    background-color: transparent;
    border-left-width: 3px;
    padding-left: 1.5rem;
    font-size: 1.25rem;
}

blockquote.minimal::before {
    display: none;
}

/* Alternative centered style */
blockquote.centered {
    text-align: center;
    border-left: none;
    border-top: 2px solid #333;
    border-bottom: 2px solid #333;
    padding: 2rem 1rem;
    max-width: 800px;
    margin: 2rem auto;
}

body.dark-mode blockquote.centered {
    border-color: #fff;
}

blockquote.centered::before {
    left: 50%;
    transform: translateX(-50%);
}

/* ========================================
   BLOCKQUOTE STYLES
   ======================================== */

/* Blockquote Styles */
blockquote {
    position: relative;
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    font-size: 1.125rem;
    font-style: italic;
    line-height: 1.8;
    color: #666;
    background-color: rgba(0, 0, 0, 0.02);
    border-left: 4px solid #333;
    border-radius: 0 8px 8px 0;
    transition: all 0.3s ease;
}

/* Dark mode blockquote */
body.dark-mode blockquote {
    color: #ccc;
    background-color: rgba(255, 255, 255, 0.05);
    border-left-color: #fff;
}

/* Light mode blockquote */
body.light-mode blockquote {
    color: #555;
    background-color: rgba(0, 0, 0, 0.03);
    border-left-color: #000;
}

/* Optional: Add quotation marks */
blockquote::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 10px;
    font-size: 4rem;
    color: rgba(0, 0, 0, 0.1);
    font-family: Georgia, serif;
    line-height: 1;
}

body.dark-mode blockquote::before {
    color: rgba(255, 255, 255, 0.1);
}

/* Hover effect */
blockquote:hover {
    transform: translateX(5px);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
}

body.dark-mode blockquote:hover {
    box-shadow: -5px 0 20px rgba(255, 255, 255, 0.05);
}

/* Attribution style (if needed) */
blockquote cite {
    display: block;
    margin-top: 1rem;
    font-size: 0.9rem;
    font-style: normal;
    text-align: right;
    opacity: 0.8;
}

blockquote cite::before {
    content: "â€” ";
}

/* Responsive adjustments for blockquotes */
@media (max-width: 768px) {
    blockquote {
        margin: 1.5rem 0;
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    blockquote::before {
        font-size: 3rem;
        top: -5px;
        left: 5px;
    }
}

/* ========================================
   FIGURE STYLES
   ======================================== */

figure {
    margin: 2rem 0;
    padding: 0;
    text-align: center;
}

figure img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

body.dark-mode figure img {
    box-shadow: 0 4px 6px rgba(255, 255, 255, 0.1);
}

figure img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

body.dark-mode figure img:hover {
    box-shadow: 0 8px 16px rgba(255, 255, 255, 0.15);
}

/* Figure Caption */
figcaption {
    margin-top: 1rem;
    padding: 0 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #666;
    font-style: italic;
}

body.dark-mode figcaption {
    color: #aaa;
}

/* Full-width Figure */
figure.full-width {
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    padding: 2rem 0;
}

figure.full-width img {
    border-radius: 0;
}

/* Side-by-side Figures */
.figure-group {
    display: flex;
    gap: 2rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.figure-group figure {
    flex: 1;
    margin: 0;
    min-width: 300px;
}

/* Figure with border */
figure.bordered img {
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem;
    background: #fff;
}

body.dark-mode figure.bordered img {
    border-color: rgba(255, 255, 255, 0.1);
    background: #000;
}

/* Figure Grid */
.figure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.figure-grid figure {
    margin: 0;
}

/* Numbered Figures */
figure.numbered {
    counter-increment: figure-counter;
}

figure.numbered figcaption::before {
    content: "Figure " counter(figure-counter) ": ";
    font-weight: 600;
}

/* Reset counter at section level */
.content-section {
    counter-reset: figure-counter;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    figure {
        margin: 1.5rem 0;
    }

    .figure-group {
        flex-direction: column;
        gap: 1.5rem;
    }

    figure.full-width {
        margin-left: -2rem;
        margin-right: -2rem;
        padding: 1rem 0;
    }

    figcaption {
        padding: 0 0.5rem;
        font-size: 0.85rem;
    }
}

/* ========================================
   MARGIN NOTES / SIDE REFERENCES
   ======================================== */

/* Main content container adjustment for margin notes */
.content-with-margins {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0;
    position: relative;
}

/* Ensure proper layout on larger screens */
@media (min-width: 1200px) {
    .content {
        justify-content: center;
        max-width: 1400px;
    }
    
    .content-section {
        max-width: 800px;
        margin: 0 auto;
        position: relative;
    }
}

/* Inline reference number */
.ref {
    position: relative;
    font-size: 0.8em;
    vertical-align: super;
    color: #0066cc;
    cursor: pointer;
    margin-left: 1px;
}

/* Side note container */
.side-note {
    position: absolute;
    width: 250px;
    left: calc(100% + 40px);
    margin-top: -1.5rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #666;
}

/* Side note number */
.side-note-number {
    float: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: #0066cc;
    margin-right: 0.5rem;
    margin-top: 0.1rem;
}

/* Side note text */
.side-note-text {
    display: block;
    margin-left: 1.5rem;
}

/* Dark mode support for margin notes */
body.dark-mode .ref {
    color: #66b3ff;
}

body.dark-mode .side-note {
    color: #aaa;
}

body.dark-mode .side-note-number {
    color: #66b3ff;
}

/* Alternative: Margin note style (appears directly in margin) */
.margin-note {
    position: absolute;
    width: 250px;
    right: -290px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #666;
    margin-top: 0;
}

.margin-note::before {
    content: attr(data-note-number);
    font-size: 0.8rem;
    font-weight: 600;
    color: #0066cc;
    margin-right: 0.5rem;
}

/* Mobile responsive - show notes inline */
@media (max-width: 1199px) {
    .content-section {
        padding: 0;
        max-width: 100%;
    }
    
    /* Convert side notes to inline blocks on mobile */
    .side-note {
        position: static;
        width: 100%;
        left: auto;
        margin: 1rem 0;
        padding: 1rem;
        background-color: rgba(0, 0, 0, 0.03);
        border-left: 3px solid #0066cc;
        border-radius: 0 4px 4px 0;
    }
    
    .margin-note {
        position: static;
        width: 100%;
        right: auto;
        margin: 1rem 0;
        padding: 1rem;
        background-color: rgba(0, 0, 0, 0.03);
        border-left: 3px solid #0066cc;
        border-radius: 0 4px 4px 0;
    }

    body.dark-mode .side-note,
    body.dark-mode .margin-note {
        background-color: rgba(255, 255, 255, 0.05);
        border-left-color: #66b3ff;
    }
}

/* Hover effect to highlight connection */
.ref:hover {
    background-color: rgba(0, 102, 204, 0.1);
    border-radius: 3px;
    padding: 0 2px;
}

/* Ensure side notes don't overlap on smaller wide screens */
@media (min-width: 1200px) and (max-width: 1399px) {
    .side-note,
    .margin-note {
        font-size: 0.8rem;
        width: 220px;
    }
    
    .side-note {
        left: calc(100% + 30px);
    }
    
    .margin-note {
        right: -250px;
    }
}