/* article.css — archived long-form pieces.
   Shares tokens, fonts and the particles canvas with styles.css.
   Reading measure is the whole layout here: one column, nothing in the margins. */

.article-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 40px 120px;
    position: relative;
    z-index: 1;
}

/* Language switch: the current language is a state, not a link */

.lang-switch {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--color-border);
    background: var(--color-card);
    border-radius: 11px;
    overflow: hidden;
}

.lang-switch a,
.lang-switch span {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.lang-switch span[aria-current] {
    background: var(--color-accent);
    color: #fff;
}

.lang-switch a {
    color: var(--color-text-secondary);
}

.lang-switch a:hover {
    background: rgba(74, 85, 104, 0.08);
    color: var(--color-text);
}

/* The switch sits above the kicker now that the topbar is gone */
.article-lang {
    margin-bottom: 28px;
}

/* --- Article header --- */

.article {
    max-width: 720px;
    margin: 0 auto;
}

.article-header {
    padding: 72px 0 44px;
}

.article-kicker {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-accent);
    margin-bottom: 20px;
}

.article-header h1 {
    font-family: 'Bricolage Grotesque', 'Inter', sans-serif;
    font-size: clamp(32px, 5vw, 52px);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.025em;
    margin-bottom: 28px;
}

.article-byline {
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text-secondary);
    padding-top: 22px;
    border-top: 1px solid var(--color-border);
}

.article-byline strong {
    color: var(--color-text);
    font-weight: 600;
}

.article-byline a {
    color: var(--color-accent);
    font-weight: 600;
    text-decoration: none;
}

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

/* An editor's note, clearly not part of the original piece */
.editor-note {
    margin-top: 24px;
    padding: 16px 20px;
    border-radius: 14px;
    background: rgba(74, 85, 104, 0.06);
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text-secondary);
}

/* --- Body --- */

.article-body {
    font-size: 18px;
    line-height: 1.78;
    color: var(--color-text);
}

.article-body > p {
    margin-bottom: 26px;
}

.article-body > p.lead {
    font-size: 21px;
    line-height: 1.65;
    color: var(--color-text);
    margin-bottom: 34px;
}

.article-body h2 {
    font-family: 'Bricolage Grotesque', 'Inter', sans-serif;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 52px 0 22px;
}

.article-body > ul {
    margin: 0 0 30px;
    padding-left: 1.3em;
}

.article-body > ul li {
    margin-bottom: 12px;
    padding-left: 0.3em;
}

.article-body > ul li::marker {
    color: var(--color-accent);
}

/* File and folder names */
.article-body code {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.84em;
    padding: 0.12em 0.4em;
    border-radius: 6px;
    background: rgba(45, 55, 72, 0.07);
    overflow-wrap: anywhere;
}

.article-body a {
    color: var(--color-accent);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(74, 85, 104, 0.35);
}

.article-body a:hover {
    text-decoration-color: var(--color-accent);
}

/* --- Figures: allowed to break the measure on wide screens --- */

.article figure {
    margin: 40px 0;
}

.article figure img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 18px;
    background: rgba(45, 55, 72, 0.05);
}

.article figcaption {
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--color-text-secondary);
}

@media (min-width: 1000px) {
    .article figure.wide {
        width: calc(100% + 180px);
        margin-left: -90px;
    }
}

/* --- Embedded video link, in place of a tracking iframe --- */

.video-link {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 36px 0;
    padding: 18px 22px;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: var(--color-card);
    text-decoration: none;
    color: var(--color-text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.video-link:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-md);
}

.video-link-icon {
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(74, 85, 104, 0.1);
    color: var(--color-accent);
}

.video-link-text {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}

.video-link-text span {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: var(--color-text-secondary);
    margin-top: 3px;
}

/* --- Gallery --- */

.gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 32px 0 8px;
}

@media (min-width: 1000px) {
    .gallery {
        width: calc(100% + 180px);
        margin-left: -90px;
    }
}

.gallery button {
    padding: 0;
    border: 0;
    background: rgba(45, 55, 72, 0.05);
    border-radius: 14px;
    overflow: hidden;
    cursor: zoom-in;
    aspect-ratio: 3 / 2;
    display: block;
    width: 100%;
}

.gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery button:hover img {
    transform: scale(1.04);
}

.gallery-note {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 14px;
}

/* --- Lightbox --- */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(20, 24, 33, 0.93);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
}

.lightbox[open],
.lightbox.is-open {
    display: flex;
}

.lightbox img {
    max-width: 100%;
    max-height: calc(100vh - 130px);
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    background: rgba(255, 255, 255, 0.12);
    border: 0;
    color: #fff;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.lightbox-close:hover,
.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.24);
}

.lightbox-close {
    top: 22px;
    right: 22px;
}

.lightbox-prev {
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-counter {
    position: absolute;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.lightbox-full {
    position: absolute;
    bottom: 24px;
    right: 26px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.lightbox-full:hover {
    color: #fff;
    text-decoration: underline;
}

/* --- Footer --- */

.article-footer {
    max-width: 720px;
    margin: 80px auto 0;
    padding-top: 34px;
    border-top: 1px solid var(--color-border);
    font-size: 15px;
    line-height: 1.7;
    color: var(--color-text-secondary);
}

.article-footer a {
    color: var(--color-accent);
    font-weight: 600;
    text-decoration: none;
}

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

.article-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.article-footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 15px;
    border-radius: 10px;
    background: rgba(74, 85, 104, 0.08);
    font-size: 13px;
    transition: background-color 0.2s;
}

.article-footer-links a:hover {
    background: rgba(74, 85, 104, 0.16);
    text-decoration: none;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
    border-radius: 4px;
}

.lightbox a:focus-visible,
.lightbox button:focus-visible {
    outline-color: #fff;
}

/* --- Responsive --- */

@media (max-width: 900px) {
    .article-page {
        padding: 0 22px 80px;
    }

    .article-header {
        padding: 44px 0 32px;
    }

    .article-body {
        font-size: 17px;
    }

    .article-body > p.lead {
        font-size: 19px;
    }

    .article-body h2 {
        font-size: 24px;
        margin: 40px 0 18px;
    }

    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .lightbox {
        padding: 14px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-full {
        right: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery img {
        transition: none;
        transform: none;
    }
}
