/* Wenqing Theme Styles */

:root {
    --bg-color: #F7F5F0; /* Warm paper white */
    --text-color: #333333; /* Charcoal */
    --accent-color: #C2785C; /* Terracotta */
    --meta-color: #7F91A1; /* Dusty Blue for meta info */
    --border-color: #E0DCD3;
    --font-serif: 'Noto Serif TC', serif;
    --font-sans: 'Noto Sans TC', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-serif);
    line-height: 1.8;
    margin: 0;
    padding: 0;
    /* Paper texture effect */
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
}

a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-color);
}

/* Header */
/* Header */
.site-header {
    padding: 1rem 0; /* Reduced padding */
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: rgba(247, 245, 240, 0.95);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border-bottom: 1px solid rgba(0,0,0,0.02);
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.site-header.hidden {
    transform: translateY(-100%);
    box-shadow: none;
}

.header-inner {
    max-width: 96%;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-family: var(--font-serif);
    font-size: clamp(1.2rem, 4vw, 1.8rem); /* Responsive font size */
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.05em;
}

.site-nav ul {
    list-style: none;
    padding: 0;
    margin: 0; /* Remove margin */
    display: flex;
    gap: 2rem;
}

/* Responsive Header */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        gap: 1rem;
    }
    
    .site-nav ul {
        gap: 1.5rem;
    }
}

.site-nav a {
    font-family: var(--font-sans);
    font-size: clamp(0.9rem, 2vw, 1rem); /* Responsive font size */
    font-weight: 500; /* More distinct */
    color: var(--meta-color);
    position: relative;
    padding: 0.5rem 0; /* Add hit area */
    display: block;
}

.site-nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px; /* Thicker underline */
    bottom: 0;
    left: 50%;
    background-color: var(--accent-color);
    transition: all 0.3s ease;
    transform: translateX(-50%); /* Center the underline expansion */
}

.site-nav a:hover {
    color: var(--accent-color); /* Change text color on hover */
}

.site-nav a:hover::after {
    width: 100%;
    left: 50%; /* Keep centered */
}

/* Hero Section */
.hero {
    height: 60vh;
    width: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4rem;
}

.hero-overlay {
    background: rgba(0, 0, 0, 0.2); /* Slight dim */
    padding: 2rem;
    color: #fff;
    text-align: center;
}

.hero-slogan {
    font-family: 'Dancing Script', cursive; /* Fallback or load handwriting font */
    font-size: clamp(1.1rem, 5vw, 2rem);
    letter-spacing: 0.1em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Main Content */
.site-main {
    max-width: 2000px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Post List (Zigzag) */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

.post-card {
    display: flex;
    gap: 3rem;
    align-items: center;
}

.post-card.reverse {
    flex-direction: row-reverse;
}

.post-image {
    flex: 1;
    height: 300px;
    overflow: hidden;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    filter: sepia(0.2) contrast(0.9); /* Film look */
}

.post-image:hover img {
    transform: scale(1.05);
}

.post-content {
    flex: 1;
}

.post-meta {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--meta-color);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-title {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    margin: 0.5rem 0 1rem;
    font-weight: 400;
}

.post-summary {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.8;
}

.read-more {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--accent-color);
    border-bottom: 1px solid transparent;
}

.read-more:hover {
    border-bottom-color: var(--accent-color);
}

/* Article Tags in Post Card */
.article-tags {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.article-tags .tag {
    background-color: rgba(0,0,0,0.05);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--meta-color);
    transition: all 0.2s ease;
    font-family: var(--font-sans);
}

.article-tags .tag:hover {
    background-color: var(--accent-color);
    color: #fff;
    text-decoration: none;
}

/* Single Post Redesign */
/* .single-post {
    padding-bottom: 4rem;
} */

.single-post .post-header {
    text-align: center;
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
}

.post-category {
    margin-bottom: 1rem;
}

.post-category a {
    color: #C2785C; /* Terracotta */
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.single-post .post-title {
    font-family: 'Noto Serif TC', serif;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    color: #333;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.single-post .post-meta {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: #999;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.meta-separator {
    font-weight: bold;
}

/* Hero Image */
.hero-image-container {
    width: 100%;
    max-width: 1200px; /* Cinema Width */
    margin: 0 auto 4rem;
    padding: 0 1rem;
}

.hero-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

/* Content Body - Golden Column */
.post-body {
    max-width: 1000px; /* Golden Column */
    margin: 0 auto;
    font-family: 'Noto Serif TC', serif;
    font-size: clamp(1.1rem, 2vw, 1.2rem); /* ~18px */
    line-height: 1.9;
    color: #2c2c2c;
    padding: 0 1.5rem;
}

.post-body p {
    margin-bottom: 1rem;
}

/* Links inside post content */
.post-body a {
    color: var(--accent-color); /* Make links visible by default */
    border-bottom: 1px dashed var(--accent-color); /* Subtle underline */
    padding-bottom: 1px;
}

.post-body a:hover {
    border-bottom-style: solid;
    background-color: rgba(194, 120, 92, 0.1); /* Subtle highlight on hover */
}

/* Drop Cap */
.post-body > p:first-of-type::first-letter {
    float: left;
    font-size: 3.5rem;
    line-height: 0.8;
    padding-top: 0.1em;
    padding-right: 0.1em;
    color: #C2785C;
    font-family: 'Dancing Script', cursive;
}

/* Headings */
.post-body h2 {
    font-size: clamp(1.3rem, 3vw, 1.9rem);
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.post-body h3 {
    font-size: clamp(1.3rem, 2.5vw, 1.7rem);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Blockquote */
.post-body blockquote {
    margin: 2.5rem 0;
    padding: 0 2rem;
    border-left: none;
    text-align: center;
    font-style: italic;
    font-size: 1.2rem;
    color: #555;
    position: relative;
}

.post-body blockquote::before {
    content: '“';
    display: block;
    font-size: 4rem;
    color: #eee;
    line-height: 1;
    margin-bottom: -2rem;
}

/* Images in Content */
.post-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2.5rem auto;
    border-radius: 4px;
}

/* End Mark */
.end-mark {
    text-align: center;
    margin-top: 4rem;
    margin-bottom: 4rem;
    color: #C2785C;
    font-size: 1.5rem;
    font-family: serif;
    letter-spacing: 0.5em;
}

/* Post Footer */
.post-footer {
    max-width: 740px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.post-footer .post-tags {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 3rem;
}

/* Author Bio */
.author-bio {
    background-color: #d9d9d8;
    padding: 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    /* margin-bottom: 3rem; */
}

.author-bio:hover {
  /* 滑鼠懸停時的樣式 */
  background-color: #d9d9d8;
  cursor: pointer; /* 顯示手形游標 */
}

.author-avatar img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}

.author-info h4 {
    margin: 0 0 0.25rem;
    font-family: var(--font-serif);
}

.author-info p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

/* Post Navigation */
.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    border-top: 1px solid #eee;
    padding-top: 3rem;
    margin-top: 2rem;
}

.nav-link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    padding: 2rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    background-color: #fff;
    min-height: 120px;
    justify-content: center;
}

.nav-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: all 0.5s ease;
    z-index: 1;
    filter: blur(3px) brightness(0.7);
    transform: scale(1.1);
}

.nav-content {
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

.nav-link:hover {
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.nav-link:hover .nav-bg {
    opacity: 1;
    transform: scale(1);
}

.nav-link:hover .nav-content {
    color: #fff;
}

.nav-link:hover .nav-label {
    color: rgba(255,255,255,0.8);
}

.nav-link:hover .nav-title {
    color: #fff;
}

.nav-link.next {
    text-align: right;
}

.nav-label {
    font-size: 0.85rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    display: block;
}

.nav-title {
    font-family: var(--font-serif);
    color: #333;
    font-weight: 600;
    font-size: 1.1rem;
    display: block;
    line-height: 1.4;
}

/* Footer */
.site-footer {
    margin-top: 2rem;
    /* padding: 3rem 0;  */
    text-align: center;
    border-top: 1px solid var(--border-color);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--meta-color);
}

.motto {
    font-family: var(--font-serif);
    font-style: italic;
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* Responsive */
@media (max-width: 768px) {
    .post-card, .post-card.reverse {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .post-image {
        width: 100%;
        height: 250px;
    }
    
    .site-title {
        font-size: 2rem;
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 4rem;
}

.page-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px; /* Rounded square */
    color: var(--text-color);
    font-family: var(--font-sans);
    font-weight: 500;
    transition: all 0.3s ease;
}

.page-item:hover, .page-item.active {
    background-color: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}

/* Animations */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-slogan {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slogan-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.slogan-part {
    display: block;
    opacity: 0;
    animation: fadeInUp 1.5s ease-out forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Category Colors */
.category-programming {
    color: #2E86C1; /* Blue for Programming */
}

.category-inspiration {
    color: #C2785C; /* Terracotta for Inspiration */
}

.placeholder-image {
    width: 100%;
    height: 100%;
    background-color: #ddd;
}

/* Tag Cloud */
/* Tag Cloud */
.home-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 3rem;
    max-width: 96%;
    margin: 0 auto 4rem;
    padding: 0 1rem;
    align-items: start; /* Important for sticky to work */
}

.tag-cloud-section {
    position: sticky;
    top: 100px; /* Adjust based on header height */
    padding: 1.5rem;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    height: fit-content;
}

/* Responsive Home Container */
@media (max-width: 768px) {
    .home-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .tag-cloud-section {
        position: static;
        margin-bottom: 2rem;
    }
}

.tag-cloud-title {
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.title-accent {
    color: var(--accent-color);
    font-weight: 800;
    font-size: 1.4rem;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.tag-item {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 20px; /* Rounded pill shape */
    color: var(--text-color);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.tag-item:hover {
    background-color: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}



/* Placeholder Image Backgrounds */
.placeholder-bg-programming {
    background-color: #2E4053;
}

.placeholder-bg-default {
    background-color: #C2785C;
}

/* Bento Grid Layout */
/* Literary About Page Layout */
.page-wrapper {
    max-width: 1000px;
    margin: 4rem auto;
    padding: 0 2rem 4rem;
}

.about-literary-container {
    display: flex;
    gap: 4rem;
    align-items: flex-start;
    margin-bottom: 6rem;
}

.about-photo-section {
    flex: 1;
    max-width: 400px;
}

.about-photo-wrapper {
    width: 100%;
    padding-bottom: 140%; /* 5:7 aspect ratio approx */
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.about-photo-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #e0e0e0;
    background-image: linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0.3));
    /* In real usage, use background-image: url(...) */
}

.about-photo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.about-text-section {
    flex: 1.2;
    padding-top: 2rem;
}

.about-header-group {
    margin-bottom: 3rem;
    position: relative;
}

.about-title {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    color: var(--text-color);
    margin: 0;
    letter-spacing: 0.1em;
}

.handwritten-accent {
    font-family: 'Dancing Script', cursive;
    font-size: 1.8rem;
    color: var(--accent-color);
    position: absolute;
    top: -1.5rem;
    left: 6rem;
    transform: rotate(-5deg);
    opacity: 0.9;
}

.about-prose p {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 2;
    color: #555;
    margin-bottom: 1.5rem;
    text-align: justify;
}

.about-contact-minimal {
    margin-top: 3rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    color: var(--meta-color);
}

.about-contact-minimal a {
    color: var(--meta-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

.about-contact-minimal a:hover {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.separator {
    margin: 0 0.5rem;
    color: #ddd;
}

/* Article Cards Section */
.about-articles-section {
    border-top: 1px solid var(--border-color);
    padding-top: 4rem;
}

.section-title-literary {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 2.5rem;
    text-align: center;
    letter-spacing: 0.1em;
}

.article-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.article-card-link {
    text-decoration: none;
    display: block;
}

.article-card-item {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-card-link:hover .article-card-item {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
}

.card-image-placeholder {
    height: 160px;
    width: 100%;
}

.card-content {
    padding: 1.5rem;
}

.card-content h3 {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    margin: 0 0 0.8rem;
    color: var(--text-color);
}

.card-content p {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: #777;
    margin: 0;
    line-height: 1.6;
}

/* Responsive Literary */
@media (max-width: 768px) {
    .about-literary-container {
        flex-direction: column;
        gap: 2rem;
    }
    
    .about-photo-section {
        max-width: 100%;
    }
    
    .handwritten-accent {
        position: static;
        display: block;
        margin-bottom: 1rem;
        transform: none;
    }
}

/* Dynamic Card Background Colors */
.bg-color-1 { background-color: #C2785C; }
.bg-color-2 { background-color: #2E86C1; }
.bg-color-3 { background-color: #7F91A1; }
.bg-color-4 { background-color: #A17F85; }
.bg-color-5 { background-color: #7FA182; }

/* Comments Section */
.comments-section {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.comments-section h3 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.comment-list {
    margin-bottom: 2rem;
}

.comment-item {
    border-bottom: 1px solid #eee;
    padding: 1rem 0;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-weight: 600;
    font-family: var(--font-sans);
    color: var(--text-color);
}

.comment-date {
    font-size: 0.85rem;
    color: var(--meta-color);
}

.comment-content {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    line-height: 1.6;
    color: #555;
    margin: 0;
}

.comment-form {
    background-color: rgba(0,0,0,0.02);
    padding: 1.5rem;
    border-radius: 8px;
}

.comment-input, .comment-textarea {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: border-color 0.3s ease;
    background-color: #fff;
}

.comment-input:focus, .comment-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.comment-textarea {
    height: 100px;
    resize: vertical;
}

.comment-submit-btn {
    background-color: var(--accent-color);
    color: #fff;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    font-family: var(--font-sans);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.comment-submit-btn:hover {
    background-color: #a6634b; /* Darker accent */
}

.comment-submit-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Code Blocks - Modern Dark Style (One Dark inspired) */
.highlight {
    background: #282c34; /* Dark background */
    color: #abb2bf; /* Light text */
    border-radius: 12px;
    margin-bottom: 2rem;
    position: relative;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    overflow: hidden; /* Ensure rounded corners clip content */
}

/* Reset for Code Block internals - FIX GRAY BACKGROUND */
.highlight pre, 
.highlight code,
.highlight .linenos pre,
.highlight .code pre {
    background-color: transparent !important;
    border: 0;
    margin: 0;
    padding: 0;
    color: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    font-family: inherit;
    text-shadow: none;
}

/* Table Layout config */
.highlight table {
    width: 100%;
    border-spacing: 0;
    border: 0;
    table-layout: fixed; /* Important for scrolling to work inside cell */
}

.highlight td {
    padding: 0;
    vertical-align: top;
    border: 0;
}

/* Line Numbers Column */
.highlight .linenos {
    background-color: #2c313a; /* Slightly lighter/different dark for gutter */
    border-right: 1px solid #3e4451;
    width: 40px; /* Fixed width or let it shrink, but fixed is safer for alignment */
    text-align: right;
    user-select: none;
    vertical-align: top;
}

.highlight .linenos pre {
    padding: 16px 10px 16px 16px !important; 
    color: #495162;
}

/* Code Column - FIX SCROLLING */
.highlight .code {
    width: 100%; /* Take remaining space */
    vertical-align: top;
    overflow: hidden; /* Hide overflow of the cell itself */
}

.highlight .code pre {
    padding: 16px !important;
    overflow-x: auto; /* Enable Horizontal Scroll */
    white-space: pre; /* Force single line */
    word-wrap: normal;
    display: block; /* Ensure it takes width to scroll */
    width: 100%;
}

/* Inline Code (Keep distinct light bg for inline text outside blocks) */
code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 85%;
    background-color: rgba(27,31,35,0.05); 
    padding: 0.2em 0.4em;
    border-radius: 3px;
    color: #c7254e; 
}

/* Hide inline style for code inside pre (double safety) */
pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
}

/* Copy Button Styling (Dark Theme Compatible) */
.copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(40, 44, 52, 0.8);
    border: 1px solid #3e4451;
    border-radius: 6px;
    color: #abb2bf;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 20;
    opacity: 0;
}

.highlight:hover .copy-code-btn {
    opacity: 1;
}

.copy-code-btn:hover {
    background-color: #3e4451;
    color: #fff;
    border-color: #5c6370;
}

.copy-code-btn.copied {
    border-color: #98c379;
    color: #98c379;
}

/* Pygments Syntax Highlighting - One Dark Style */
.highlight .hll { background-color: #4e4e4e }
.highlight .c { color: #5c6370; font-style: italic } /* Comment */
.highlight .err { color: #e06c75 } /* Error */
.highlight .k { color: #c678dd } /* Keyword - Purple */
.highlight .o { color: #56b6c2 } /* Operator - Cyan */
.highlight .cm { color: #5c6370; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #5c6370; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #5c6370; font-style: italic } /* Comment.Single */
.highlight .cs { color: #5c6370; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #e06c75 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #e06c75 } /* Generic.Error */
.highlight .gh { color: #61afef; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #98c379 } /* Generic.Inserted */
.highlight .go { color: #56b6c2 } /* Generic.Output */
.highlight .gp { color: #56b6c2 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #56b6c2; font-weight: bold } /* Generic.Subheading */
.highlight .gt { color: #e06c75 } /* Generic.Traceback */
.highlight .kc { color: #c678dd } /* Keyword.Constant */
.highlight .kd { color: #c678dd } /* Keyword.Declaration */
.highlight .kn { color: #c678dd } /* Keyword.Namespace */
.highlight .kp { color: #c678dd } /* Keyword.Pseudo */
.highlight .kr { color: #c678dd } /* Keyword.Reserved */
.highlight .kt { color: #e06c75 } /* Keyword.Type */
.highlight .m { color: #d19a66 } /* Literal.Number */
.highlight .s { color: #98c379 } /* Literal.String */
.highlight .na { color: #e06c75 } /* Name.Attribute */
.highlight .nb { color: #e5c07b } /* Name.Builtin */
.highlight .nc { color: #e5c07b } /* Name.Class */
.highlight .no { color: #d19a66 } /* Name.Constant */
.highlight .nd { color: #61afef } /* Name.Decorator */
.highlight .ni { color: #e06c75 } /* Name.Entity */
.highlight .ne { color: #e06c75 } /* Name.Exception */
.highlight .nf { color: #61afef } /* Name.Function */
.highlight .nl { color: #e5c07b } /* Name.Label */
.highlight .nn { color: #e5c07b } /* Name.Namespace */
.highlight .nt { color: #e06c75 } /* Name.Tag */
.highlight .nv { color: #e06c75 } /* Name.Variable */
.highlight .ow { color: #c678dd } /* Operator.Word */
.highlight .w { color: #abb2bf } /* Text.Whitespace */
.highlight .mb { color: #d19a66 } /* Literal.Number.Bin */
.highlight .mf { color: #d19a66 } /* Literal.Number.Float */
.highlight .mh { color: #d19a66 } /* Literal.Number.Hex */
.highlight .mi { color: #d19a66 } /* Literal.Number.Integer */
.highlight .mo { color: #d19a66 } /* Literal.Number.Oct */
.highlight .sa { color: #98c379 } /* Literal.String.Affix */
.highlight .sb { color: #98c379 } /* Literal.String.Backtick */
.highlight .sc { color: #98c379 } /* Literal.String.Char */
.highlight .dl { color: #98c379 } /* Literal.String.Delimiter */
.highlight .sd { color: #98c379 } /* Literal.String.Doc */
.highlight .s2 { color: #98c379 } /* Literal.String.Double */
.highlight .se { color: #98c379 } /* Literal.String.Escape */
.highlight .sh { color: #98c379 } /* Literal.String.Heredoc */
.highlight .si { color: #98c379 } /* Literal.String.Interpol */
.highlight .sx { color: #98c379 } /* Literal.String.Other */
.highlight .sr { color: #98c379 } /* Literal.String.Regex */
.highlight .s1 { color: #98c379 } /* Literal.String.Single */
.highlight .ss { color: #98c379 } /* Literal.String.Symbol */
.highlight .bp { color: #e5c07b } /* Name.Builtin.Pseudo */
.highlight .fm { color: #61afef } /* Name.Function.Magic */
.highlight .vc { color: #e06c75 } /* Name.Variable.Class */
.highlight .vg { color: #e06c75 } /* Name.Variable.Global */
.highlight .vi { color: #e06c75 } /* Name.Variable.Instance */
.highlight .vm { color: #e06c75 } /* Name.Variable.Magic */
.highlight .il { color: #d19a66 } /* Literal.Number.Integer.Long */
