/* ── Reset ───────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Page Transition ─────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Base ────────────────────────────────────────────────── */
body {
    font-family: Georgia, serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    animation: fadeIn 0.15s ease;
}

.page-fade-out {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

/* ── Layout ──────────────────────────────────────────────── */
.container { display: flex; min-height: 100vh; width: 100%; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: 200px;
    background-color: #f5f5f5;
    color: #333;
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: hidden;
    box-sizing: border-box;
    border: none;
    z-index: 10;
}

.sidebar h1 {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.2;
    cursor: default;
    color: #000;
}

.sidebar h1 a { color: inherit; text-decoration: none; }

.sidebar nav ul { list-style: none; }
.sidebar nav ul li { margin-bottom: 15px; }

.sidebar nav ul li a {
    color: #333;
    text-decoration: none;
    font-size: 16px;
    display: block;
    padding: 5px 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.sidebar nav ul li a:hover  { border-bottom: 1px solid #333; }
.sidebar nav ul li a.active { font-weight: bold; border-bottom: 2px solid #333; }

/* ── Main Content ────────────────────────────────────────── */
.main-content {
    margin-left: 200px;
    padding: 40px 60px;
    background-color: #fff;
    flex: 1;
    box-sizing: border-box;
    min-height: 100vh;
    width: calc(100% - 200px);
}

/* ── Content Card ────────────────────────────────────────── */
/* Default: full-width, left-aligned (blog listing page)     */
.content-card {
    max-width: 100%;
}

/* Centered variant: individual blog post content            */
.content-card--centered {
    max-width: 820px;
    margin: 0 auto;
}

/* ── Content Header (Blog listing page) ──────────────────── */
.content-header {
    border-bottom: 2px solid #333;
    padding-bottom: 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-header h1 { font-size: 48px; font-weight: bold; }

/* ── Blog List ───────────────────────────────────────────── */
.blog-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.blog-entry {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: inherit;
    transition: color 0.15s ease;
}

.blog-entry:last-child { border-bottom: none; }

.blog-date {
    font-size: 14px;
    color: #888;
    white-space: nowrap;
    min-width: 100px;
}

.blog-title { font-size: 16px; color: #333; }
.blog-entry:hover .blog-title { text-decoration: underline; }

/* ── Post Header ─────────────────────────────────────────── */
.post-header {
    border-bottom: 2px solid #333;
    padding-bottom: 20px;
    margin-bottom: 36px;
}

.post-header h1 {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 10px;
    line-height: 1.25;
}

.post-meta { font-size: 14px; color: #888; }
.post-meta span { margin-right: 16px; }

/* ── Post Body Typography ────────────────────────────────── */
.post-body { line-height: 1.8; }

.post-body p {
    margin-bottom: 20px;
    text-align: justify;
}

.post-body h2 {
    font-size: 24px;
    margin: 40px 0 14px;
    padding-bottom: 6px;
    border-bottom: 1px solid #ddd;
    color: #111;
}

.post-body h3 {
    font-size: 19px;
    margin: 28px 0 10px;
}

.post-body h4 {
    font-size: 16px;
    margin: 20px 0 8px;
    font-style: italic;
}

.post-body ul,
.post-body ol { margin: 0 0 20px 28px; }
.post-body li { margin-bottom: 6px; }

.post-body a { color: #222; text-decoration: underline; text-decoration-color: #aaa; }
.post-body a:hover { text-decoration: underline; }

/* ── Inline Code ─────────────────────────────────────────── */
.post-body code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13.5px;
    background: #f0f0f0;
    padding: 2px 5px;
    border-radius: 3px;
    border: 1px solid #e0e0e0;
}

/* ── Code Block ──────────────────────────────────────────── */
.post-body pre {
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 6px;
    padding: 20px 24px;
    overflow-x: auto;
    margin: 0 0 28px;
    font-size: 14px;
    line-height: 1.6;
    border: 1px solid #111;
}

.post-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.code-block { margin-bottom: 28px; }

.code-block .code-label {
    font-size: 12px;
    font-family: monospace;
    color: #888;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-bottom: none;
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px 4px 0 0;
}

.code-block pre { margin-bottom: 0; border-radius: 0 6px 6px 6px; }

/* ── Figure ──────────────────────────────────────────────── */
figure { margin: 0 0 32px; text-align: center; }

figure img {
    max-width: 65%;
    height: auto;
    border: none;
    display: block;
    margin: 0 auto;
}

figcaption {
    font-size: 13px;
    color: #666;
    margin-top: 8px;
    font-style: italic;
}

figcaption strong { font-style: normal; }

/* ── Chart Container ─────────────────────────────────────── */
.chart-container {
    margin: 0 0 32px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 24px;
    background: #fafafa;
}

.chart-container canvas,
.chart-container svg { display: block; margin: 0 auto; max-width: 100%; }

.chart-caption {
    font-size: 13px;
    color: #666;
    margin-top: 12px;
    text-align: center;
    font-style: italic;
}

/* ── Table ───────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; margin-bottom: 32px; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }

thead tr { background-color: #333; color: white; }
thead th { padding: 10px 16px; text-align: left; font-weight: bold; }

tbody tr { border-bottom: 1px solid #e0e0e0; }
tbody tr:last-child { border-bottom: none; }
tbody tr:nth-child(even) { background-color: #f9f9f9; }
tbody td { padding: 10px 16px; }

.table-caption {
    font-size: 13px;
    color: #666;
    margin-top: 8px;
    font-style: italic;
    text-align: center;
}

/* ── Callout Boxes ───────────────────────────────────────── */
.callout {
    margin: 0 0 28px;
    padding: 16px 20px;
    border-left: 4px solid;
    border-radius: 0 6px 6px 0;
    font-size: 15px;
}

.callout-title {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.callout.note    { border-color: #111; background: #f7f7f7; }
.callout.tip     { border-color: #555; background: #f3f3f3; }
.callout.warning { border-color: #888; background: #efefef; }
.callout.math    { border-color: #222; background: #f5f5f5; font-family: 'Courier New', monospace; }

/* ── Equation ────────────────────────────────────────────── */
.equation {
    margin: 0 0 28px;
    padding: 16px 24px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-align: center;
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    overflow-x: auto;
}

.equation-label {
    font-size: 12px;
    color: #888;
    margin-top: 6px;
    font-family: Georgia, serif;
}

/* ── Divider ─────────────────────────────────────────────── */
.post-body hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 40px 0;
}

/* ── Back Link ───────────────────────────────────────────── */
.back-link {
    display: inline-block;
    margin-top: 48px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #333;
    font-size: 14px;
    transition: border-bottom-width 0.15s ease;
}

.back-link:hover { border-bottom-width: 2px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .container { flex-direction: column; }
    .sidebar { position: relative; width: 100%; height: auto; order: 1; }
    .main-content { margin-left: 0; order: 2; width: 100%; padding: 24px 20px; }
    .content-card { padding: 0; }
    .content-card--centered { padding: 0; }
    .post-header h1 { font-size: 26px; }
    .content-header h1 { font-size: 36px; }
    .content-header { flex-direction: column; align-items: flex-start; }
    .blog-entry { flex-direction: column; gap: 4px; }
}
