/* Shared styles for blog posts */
/* Include this in all blog posts: <link rel="stylesheet" href="../shared-styles.css"> */

/* ===== Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.7;
    color: #1a1a1a;
    background: white;
    min-height: 100vh;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.dark-mode {
    background: #1a202c;
    color: #e2e8f0;
}

/* ===== Container ===== */
.container {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 80px 20px 60px 20px;
    animation: fadeIn 0.6s ease-in;
}

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

/* ===== Back Link ===== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #6b7280;
    text-decoration: none;
    font-weight: 400;
    font-size: 0.95em;
    margin-bottom: 40px;
    transition: all 0.2s ease;
}

.back-link:hover {
    color: #1a1a1a;
}

body.dark-mode .back-link {
    color: #9ca3af;
}

body.dark-mode .back-link:hover {
    color: #e2e8f0;
}

/* ===== Post Header ===== */
.post-header {
    margin-bottom: 40px;
    padding-bottom: 0;
    border-bottom: none;
}

/* ===== Typography ===== */
h1 {
    font-size: 2.2em;
    color: #1a1a1a;
    margin-bottom: 16px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

body.dark-mode h1 {
    color: #f7fafc;
}

h2 {
    font-size: 1.6em;
    color: #1a1a1a;
    margin-top: 48px;
    margin-bottom: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

body.dark-mode h2 {
    color: #f7fafc;
}

h3 {
    font-size: 1.25em;
    color: #1a1a1a;
    margin-top: 32px;
    margin-bottom: 12px;
    font-weight: 600;
}

body.dark-mode h3 {
    color: #f7fafc;
}

/* ===== Post Meta ===== */
.post-meta {
    color: #6b7280;
    font-size: 0.95em;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

body.dark-mode .post-meta {
    color: #9ca3af;
}

.post-meta .footer-separator {
    color: #d1d5db;
    margin: 0 4px;
}

body.dark-mode .post-meta .footer-separator {
    color: #4b5563;
}

.post-meta .reading-time {
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-meta .view-count {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Post Content ===== */
.post-content {
    color: #374151;
    font-size: 1.05em;
    line-height: 1.7;
}

body.dark-mode .post-content {
    color: #cbd5e0;
}

.post-content p {
    margin-bottom: 20px;
}

.post-content ul,
.post-content ol {
    margin-bottom: 20px;
    padding-left: 28px;
}

.post-content li {
    margin-bottom: 10px;
}

.post-content a {
    color: #2563eb;
    text-decoration: underline;
    text-decoration-color: rgba(37, 99, 235, 0.3);
    text-underline-offset: 2px;
    transition: all 0.2s ease;
}

.post-content a:hover {
    text-decoration-color: rgba(37, 99, 235, 0.8);
}

body.dark-mode .post-content a {
    color: #60a5fa;
    text-decoration-color: rgba(96, 165, 250, 0.3);
}

body.dark-mode .post-content a:hover {
    text-decoration-color: rgba(96, 165, 250, 0.8);
}

.post-content strong {
    font-weight: 600;
    color: #1a1a1a;
}

body.dark-mode .post-content strong {
    color: #f7fafc;
}

/* ===== Tables ===== */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 32px 0;
    font-size: 0.95em;
}

.post-content table th,
.post-content table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

body.dark-mode .post-content table th,
body.dark-mode .post-content table td {
    border-bottom-color: #374151;
}

.post-content table th {
    background: transparent;
    font-weight: 600;
    color: #1a1a1a;
    border-bottom: 2px solid #d1d5db;
}

body.dark-mode .post-content table th {
    color: #f7fafc;
    border-bottom-color: #4b5563;
}

/* ===== HR ===== */
.post-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 48px 0;
}

body.dark-mode .post-content hr {
    border-top-color: #374151;
}

/* ===== Images ===== */
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 32px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

body.dark-mode .post-content img {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* ===== Tags ===== */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
    margin-bottom: 0;
}

.tag {
    display: inline-block;
    padding: 6px 14px;
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

body.dark-mode .tag {
    background: linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%);
}

/* ===== Theme Toggle Button ===== */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5em;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

body.dark-mode .theme-toggle {
    background: #2d3748;
    border-color: #4a5568;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* Giscus comments section */
.giscus-comments {
    margin-top: 64px;
    padding-top: 48px;
    border-top: 1px solid #e5e7eb;
}

body.dark-mode .giscus-comments {
    border-top-color: #374151;
}

/* Post footer */
.post-footer {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

body.dark-mode .post-footer {
    border-top-color: #374151;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.footer-link {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: #1a1a1a;
}

body.dark-mode .footer-link {
    color: #9ca3af;
}

body.dark-mode .footer-link:hover {
    color: #e2e8f0;
}

.footer-link svg {
    display: block;
    width: 20px;
    height: 20px;
}

.footer-separator {
    color: #d1d5db;
    margin: 0 4px;
}

body.dark-mode .footer-separator {
    color: #4b5563;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .container {
        padding: 60px 20px 40px 20px;
    }

    h1 {
        font-size: 1.8em;
    }

    h2 {
        font-size: 1.4em;
        margin-top: 36px;
    }

    h3 {
        font-size: 1.15em;
        margin-top: 28px;
    }

    .post-content {
        font-size: 1em;
    }

    .post-content table {
        font-size: 0.9em;
    }
}
