/* ── Wikipedia article content ──────────────────────────────────────────────
   Scoped to .article-content so styles don't leak into the rest of the site.
   Relies on CSS custom properties defined in styles.css.
   ─────────────────────────────────────────────────────────────────────────── */

.article-content {
    max-width: 960px;
    line-height: 1.7;
    font-size: 1rem;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ── Headings ────────────────────────────────────────────────────────────── */

.article-content h2 {
    font-size: 1.6rem;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

.article-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.4rem;
}

.article-content h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.3rem;
}

/* ── Paragraphs & lists ──────────────────────────────────────────────────── */

.article-content p {
    margin-bottom: 0.9rem;
}

.article-content ul,
.article-content ol {
    padding-left: 1.75rem;
    margin-bottom: 0.9rem;
}

.article-content li {
    margin-bottom: 0.25rem;
}

/* ── Links ───────────────────────────────────────────────────────────────── */

.article-content a {
    color: var(--link-color);
}

.article-content a:hover {
    color: var(--color);
}

/* ── Infobox ─────────────────────────────────────────────────────────────── */

.article-content .infobox {
    float: right;
    clear: right;
    margin: 0 0 1.25rem 1.5rem;
    padding: 0.6rem;
    background-color: var(--background-secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    max-width: 280px;
    width: 100%;
    box-sizing: border-box;
    border-collapse: collapse;
}

.article-content .infobox caption {
    font-weight: bold;
    font-size: 1rem;
    text-align: center;
    padding: 0.4rem 0;
    caption-side: top;
}

.article-content .infobox td,
.article-content .infobox th {
    padding: 3px 6px;
    vertical-align: top;
    border-top: 1px solid var(--border-color);
}

.article-content .infobox tr:first-child td,
.article-content .infobox tr:first-child th {
    border-top: none;
}

.article-content .infobox th {
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.article-content .infobox .infobox-label,
.article-content .infobox .infobox-data {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.article-content .infobox .infobox-data {
    border-top: none;
    padding-top: 0;
}

.article-content .infobox img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 0.4rem;
    border-radius: 4px;
}

@media (max-width: 600px) {
    .article-content .infobox {
        float: none;
        margin: 0 0 1.25rem 0;
        max-width: 100%;
    }
}

/* ── Wiki tables ─────────────────────────────────────────────────────────── */

.article-content .wikitable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    display: block;
}

.article-content .wikitable th,
.article-content .wikitable td {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    vertical-align: top;
}

.article-content .wikitable th {
    background-color: var(--background-secondary-color);
    font-weight: 600;
    text-align: left;
}

.article-content .wikitable tr:nth-child(even) td {
    background-color: var(--background-secondary-color);
}

/* ── Figures & image thumbnails ──────────────────────────────────────────── */

.article-content figure,
.article-content .thumb {
    margin: 0 0 1.25rem 1.5rem;
    float: right;
    clear: right;
    max-width: 260px;
    background-color: var(--background-secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 5px;
    box-sizing: border-box;
    font-size: 0.8rem;
    text-align: center;
}

.article-content figure.tleft,
.article-content .thumb.tleft,
.article-content figure.mw-halign-left,
.article-content .thumb.mw-halign-left {
    float: left;
    clear: left;
    margin: 0 1.5rem 1.25rem 0;
}

.article-content figure.mw-halign-right,
.article-content .thumb.mw-halign-right {
    float: right;
    clear: right;
    margin: 0 0 1.25rem 1.5rem;
}

.article-content figure img,
.article-content .thumb img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    margin: 0 auto;
}

.article-content figcaption,
.article-content .thumbcaption {
    padding: 4px 2px 2px;
    color: color-mix(in srgb, var(--color) 70%, transparent);
    line-height: 1.4;
}

@media (max-width: 600px) {
    .article-content figure,
    .article-content .thumb {
        float: none;
        margin: 0 0 1.25rem 0;
        max-width: 100%;
    }
}

/* ── Hatnotes (disambiguation / redirect notices) ────────────────────────── */

.article-content .hatnote {
    padding: 0.4rem 0.75rem;
    margin-bottom: 1rem;
    border-left: 3px solid var(--palette-brown);
    background-color: var(--background-secondary-color);
    border-radius: 0 4px 4px 0;
    font-size: 0.9rem;
    font-style: italic;
}

/* ── Citation superscripts ───────────────────────────────────────────────── */

.article-content sup.reference {
    font-size: 0.7rem;
    line-height: 1;
}

.article-content sup.reference a {
    padding: 0 2px;
}

/* ── References / footnotes section ─────────────────────────────────────── */

.article-content .reflist,
.article-content .references {
    font-size: 0.85rem;
    column-count: 2;
    column-gap: 2.5rem;
}

@media (max-width: 600px) {
    .article-content .reflist,
    .article-content .references {
        column-count: 1;
    }
}

.article-content .references li {
    margin-bottom: 0.4rem;
}

/* ── Blockquotes ─────────────────────────────────────────────────────────── */

.article-content blockquote {
    margin: 1rem 0 1rem 1.5rem;
    padding: 0.5rem 1rem;
    border-left: 3px solid var(--palette-brown);
    border-radius: 0 4px 4px 0;
    font-style: italic;
}

/* ── Horizontal rules ────────────────────────────────────────────────────── */

.article-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

/* ── Clearfix after floating elements ────────────────────────────────────── */

.article-content::after {
    content: '';
    display: table;
    clear: both;
}

/* ── Galleries ───────────────────────────────────────────────────────────── */

.article-content ul.gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 1.25rem 0;
    clear: both;
}

.article-content .gallerybox {
    box-sizing: border-box;
    background-color: var(--background-secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 5px;
    font-size: 0.8rem;
    text-align: center;
}

/* Override the float-based .thumb styles when inside a gallery */
.article-content .gallerybox .thumb {
    float: none;
    clear: none;
    margin: 0 0 4px 0;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    max-width: none;
    font-size: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.article-content .gallerybox .thumb img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    margin: 0 auto;
}

.article-content .gallerytext {
    padding: 2px 2px 0;
    color: color-mix(in srgb, var(--color) 70%, transparent);
    line-height: 1.4;
}

@media (max-width: 600px) {
    .article-content ul.gallery {
        gap: 6px;
    }

    .article-content .gallerybox {
        width: calc(50% - 3px) !important;
    }

    .article-content .gallerybox .thumb {
        width: auto !important;
        height: auto !important;
    }
}

/* ── Legend swatches ─────────────────────────────────────────────────────── */

.article-content .legend {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    white-space: nowrap;
    font-size: 0.9rem;
    margin-right: 0.75em;
}

.article-content .legend-color {
    display: inline-block;
    min-width: 1.25em;
    height: 1.25em;
    line-height: 1.25;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    flex-shrink: 0;
    vertical-align: middle;
}
