/* Shared styles for all writeup pages */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: #fafafa;
    color: #2d3748;
    line-height: 1.7;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 24px;
}

header {
    margin-bottom: 64px;
    padding-bottom: 32px;
    border-bottom: 1px solid #e2e8f0;
}

.back-link {
    color: #4299e1;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s;
    display: inline-block;
    margin-bottom: 24px;
}

.back-link:hover {
    color: #2b6cb0;
}

.back-link::before {
    content: '← ';
}

h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #1a202c;
    letter-spacing: -0.02em;
}

.meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 14px;
    color: #718096;
    margin-bottom: 8px;
}

.meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.tag {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 4px;
    background: #edf2f7;
    color: #4a5568;
    font-family: 'Fira Code', monospace;
}

.banner {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 16px;
    margin: 16px 0 24px;
}

article {
    background: white;
    padding: 40px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    width: 100%;
}

article h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1a202c;
    margin-top: 40px;
    margin-bottom: 16px;
}

article h2:first-child {
    margin-top: 0;
}

article h3 {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    margin-top: 32px;
    margin-bottom: 12px;
}

article h4 {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    margin-top: 24px;
    margin-bottom: 12px;
}

article p {
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 16px;
    color: #2d3748;
}

article ul, article ol {
    margin-left: 24px;
    margin-bottom: 16px;
}

article li {
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 8px;
}

article a {
    color: #4299e1;
    text-decoration: none;
}

article a:hover {
    text-decoration: underline;
}

code {
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    background: #f7fafc;
    padding: 2px 6px;
    border-radius: 3px;
    color: #2d3748;
}

pre {
    position: relative;
    background: #1a202c;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    overflow-x: auto;
    border: 1px solid #2d3748;
    max-width: 100%;
}

pre code {
    background: none;
    padding: 0;
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.6;
}

.hljs {
    background: transparent;
    color: #e2e8f0;
}

hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 32px 0;
}

/* Image helpers */
.meme-image {
    width: 100%;
    max-width: 460px;
    display: block;
    margin: 24px auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.diagram-image {
    width: 100%;
    max-width: 700px;
    display: block;
    margin: 24px auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.figure-image {
    width: 100%;
    max-width: 600px;
    display: block;
    margin: 24px auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 15px;
}

table th,
table td {
    padding: 10px 16px;
    text-align: left;
    border: 1px solid #e2e8f0;
}

table th {
    background: #f7fafc;
    font-weight: 600;
    color: #1a202c;
}

table td code {
    font-size: 13px;
}

/* Copy button */
.copy-button {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    background: #2d3748;
    color: #e2e8f0;
    border: 1px solid #4a5568;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s;
    opacity: 0;
}

pre:hover .copy-button {
    opacity: 1;
}

.copy-button:hover {
    background: #4a5568;
    color: white;
}

.copy-button.copied {
    background: #48bb78;
    border-color: #48bb78;
    color: white;
}

/* Cat button */
.cat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: 2px solid #2d3748;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1000;
}

.cat-button:hover {
    transform: scale(1.1);
    box-shadow: 4px 4px 0 #2d3748;
}

.cat-button:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    h1 {
        font-size: 28px;
    }

    article {
        padding: 24px;
    }

    pre {
        padding: 16px;
    }
}
