/* ─── Base ─────────────────────────────────────────────────── */

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.font-inter { font-family: 'Inter', sans-serif; }

/* ─── Article content ─────────────────────────────────────── */

.article-content {
    line-height: 1.8;
    font-size: 1.1rem;
}

.article-content > * + * {
    margin-top: 1.25em;
}

/* Headings */
.article-content h1 { font-size: 2em; font-weight: 700; margin-top: 1.8em; line-height: 1.3; }
.article-content h2 { font-size: 1.6em; font-weight: 700; margin-top: 1.6em; line-height: 1.3; }
.article-content h3 { font-size: 1.3em; font-weight: 600; margin-top: 1.4em; line-height: 1.4; }
.article-content h4 { font-size: 1.1em; font-weight: 600; margin-top: 1.2em; }

/* First heading — no extra top margin */
.article-content > h1:first-child,
.article-content > h2:first-child,
.article-content > h3:first-child {
    margin-top: 0;
}

/* Heading anchors */
.heading-anchor {
    position: relative;
}

.heading-anchor .anchor-link {
    opacity: 0;
    color: #ccc;
    text-decoration: none;
    font-weight: 400;
    font-size: 0.7em;
    margin-left: 0.4em;
    transition: opacity 0.2s, color 0.2s;
    cursor: pointer;
    vertical-align: middle;
}

.heading-anchor:hover .anchor-link {
    opacity: 1;
}

.heading-anchor .anchor-link:hover {
    color: #000;
}

/* Paragraphs */
.article-content p {
    margin: 1em 0;
}

/* Links */
.article-content a {
    color: #000;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.article-content a:hover {
    text-decoration-thickness: 2px;
}

/* Images */
.article-content figure {
    margin: 2em 0;
}

.article-content figure img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.article-content figure.stretched img {
    width: 100%;
}

.article-content figure.with-border img {
    border: 1px solid #e5e5e5;
}

.article-content figure.with-bg {
    background: #f8f8f8;
    padding: 1em;
    border-radius: 8px;
}

.article-content figcaption {
    text-align: center;
    color: #999;
    font-size: 0.85em;
    margin-top: 0.6em;
}

/* Code blocks */
.article-content pre {
    background: #f5f5f5;
    padding: 1.2em 1.4em;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'IBM Plex Mono', 'Menlo', monospace;
    font-size: 0.9em;
    line-height: 1.6;
    margin: 1.5em 0;
}

.article-content pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

/* Inline code */
.article-content code {
    background: #f0f0f0;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-family: 'IBM Plex Mono', 'Menlo', monospace;
    font-size: 0.88em;
}

/* Blockquotes */
.article-content blockquote {
    border-left: 3px solid #000;
    padding-left: 1.2em;
    margin: 1.5em 0;
    font-style: italic;
}

.article-content blockquote p {
    margin: 0;
}

.article-content blockquote cite {
    display: block;
    font-style: normal;
    color: #888;
    font-size: 0.85em;
    margin-top: 0.5em;
}

/* Lists */
.article-content ul {
    list-style: disc;
    padding-left: 1.8em;
    margin: 1em 0;
}

.article-content ol {
    list-style: decimal;
    padding-left: 1.8em;
    margin: 1em 0;
}

.article-content li {
    margin: 0.4em 0;
    line-height: 1.7;
}

/* Delimiter / HR */
.article-content hr {
    border: 0;
    text-align: center;
    margin: 2em 0;
}

.article-content hr::before {
    content: '***';
    letter-spacing: 0.5em;
    color: #ccc;
    font-size: 1.2em;
}

/* Strong / emphasis */
.article-content strong, .article-content b { font-weight: 700; }
.article-content em, .article-content i { font-style: italic; }
.article-content del { text-decoration: line-through; color: #888; }
.article-content mark { background: #fef08a; padding: 0.1em 0.2em; border-radius: 2px; }
.article-content u { text-decoration: underline; text-underline-offset: 3px; }

/* Tables (just in case) */
.article-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.5em 0;
    font-size: 0.95em;
}

.article-content th,
.article-content td {
    border: 1px solid #e5e5e5;
    padding: 0.6em 0.8em;
    text-align: left;
}

.article-content th {
    font-weight: 600;
    background: #fafafa;
}

/* ─── Print ────────────────────────────────────────────────── */

@media print {
    .article-content { font-size: 12pt; }
    .anchor-link { display: none !important; }
}

/* ─── Table of Contents ───────────────────────────────────── */

.article-content .toc-block {
    background: #fafafa;
    border-radius: 8px;
    padding: 1.2em 1.6em;
    margin: 1.5em 0;
}

.article-content .toc-title {
    font-weight: 600;
    font-size: 0.9em;
    color: #666;
    margin-bottom: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.article-content .toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.article-content .toc-list li {
    margin: 0.3em 0;
    line-height: 1.5;
}

.article-content .toc-list a {
    color: #333;
    text-decoration: none;
    font-size: 0.95em;
}

.article-content .toc-list a:hover {
    text-decoration: underline;
}

.article-content .toc-list .toc-h1 a { font-weight: 600; }
.article-content .toc-list .toc-h2 a { font-weight: 500; }
.article-content .toc-list .toc-h3 a,
.article-content .toc-list .toc-h4 a { font-weight: 400; color: #555; }

/* ─── Preview banner ──────────────────────────────────────── */

.preview-banner {
    background: #fef3c7;
    color: #92400e;
    text-align: center;
    padding: 0.6em;
    font-size: 0.85em;
    font-weight: 500;
}

/* ─── Gallery ─────────────────────────────────────────────── */

.article-content .gallery-row {
    display: flex;
    gap: 6px;
    margin: 1.5em 0;
    border-radius: 8px;
    overflow: hidden;
}

.article-content .gallery-item {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.article-content .gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Equal heights: all items in a row match the tallest */
.article-content .gallery-count-2 .gallery-item { aspect-ratio: 3/4; }
.article-content .gallery-count-3 .gallery-item { aspect-ratio: 1/1; }
.article-content .gallery-count-4 .gallery-item { aspect-ratio: 4/3; }

/* Mobile: stack vertically */
@media (max-width: 640px) {
    .article-content .gallery-row {
        flex-direction: column;
    }
    .article-content .gallery-item {
        aspect-ratio: 16/9 !important;
    }
}
