	/* Modern Reset & CSS Variables */
:root {
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --text-muted: #64748b;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --border-color: #e2e8f0;
    --card-bg: #f8fafc;
    --max-width: 800px;
    --transition: all 0.3s ease;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-color: #0f172a;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --accent-color: #60a5fa;
    --accent-hover: #93c5fd;
    --border-color: #334155;
    --card-bg: #1e293b;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.7;
    margin: 0;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Layout Container */
article {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px 0;
}

/* Typography Styles */
h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    line-height: 1.1;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.8rem;
    margin-top: 2.5rem;
    border-left: 4px solid var(--accent-color);
    padding-left: 15px;
}

h3 {
    font-size: 1.4rem;
    margin-top: 2rem;
}

.meta {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 3rem;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Link Style */
p a, .section a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

p a:hover {
    border-bottom-color: var(--accent-color);
    opacity: 0.8;
}

/* Image Hover Effect (Maintain frame size) */
.section p:has(img) {
    border-radius: 16px;
    overflow: hidden; /* This keeps the edges cut off on scale */
    margin: 2.5rem 0;
    line-height: 0; /* Fixes bottom spacing in p tags */
}

.section img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 16px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.section p:has(img):hover img {
    transform: scale(1.05);
}

/* Table Design */
.section {
    overflow-x: auto; /* Makes table responsive down to 412px */
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.95rem;
    min-width: 500px; /* Forces scroll on small screens instead of squishing */
}

th {
    background-color: var(--card-bg);
    text-align: left;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

tr:hover {
    background-color: var(--card-bg);
}

/* Lists and FAQ */
ul, ol {
    padding-left: 20px;
    margin: 1.5rem 0;
}

li {
    margin-bottom: 0.8rem;
}

strong {
    color: var(--accent-color);
}

/* Theme Toggle Button Style */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 15px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    font-weight: 600;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    body {
        padding: 15px;
    }
    
    article {
        padding: 20px 0;
    }

    h1 {
        font-size: 2.2rem;
    }
}

/* Mobile Specific (412px and below) */
@media (max-width: 412px) {
    .meta {
        font-size: 0.85rem;
        flex-direction: column;
        gap: 5px;
    }
    
    .meta span:nth-child(even) {
        display: none; /* Hide the separator pipes on tiny screens */
    }

    h2 {
        font-size: 1.5rem;
    }
}



/* Container for the 2-column layout */
.page-wrapper {
    display: grid;
    grid-template-columns: 1fr 280px; /* Main content | Sidebar */
    gap: 50px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

article {
    min-width: 0; /* Prevents flex/grid blowouts */
    max-width: 800px; /* Optimal reading width */
}

/* Sidebar Styling */
.sidebar-right {
    position: sticky;
    top: 20px;
    height: fit-content;
}

.toc {
    padding: 20px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.toc h3 {
    margin-top: 0;
    font-size: 1.1rem;
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc li {
    margin-bottom: 10px;
}

.toc a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.2s;
    display: block;
}

.toc a.active {
    color: var(--accent-color);
    font-weight: bold;
    border-left: 2px solid var(--accent-color);
    padding-left: 10px;
    margin-left: -10px;
}

/* Related Section Styling */
.related-posts-section {
    margin-top: 80px;
    padding-top: 40px;
    border-top: 2px solid var(--border-color);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Hide sidebar on mobile */
@media (max-width: 1024px) {
    .page-wrapper {
        display: block;
    }
    .sidebar-right {
        display: none;
    }
}