/*
 * Shared article layer for qc52.me: black-and-white editorial styling plus interactive extras.
 * Loaded after each page's inline styles, so equal-specificity rules here take precedence.
 */
:root {
    --ae-ink: #000;
    --ae-paper: #fff;
    --ae-text: #111;
    --ae-muted: rgba(0, 0, 0, .62);
    --ae-rule: rgba(0, 0, 0, .14);
    --ae-ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Base typography ---------- */
body {
    background: var(--ae-paper);
    color: var(--ae-text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: #000;
    color: #fff;
}

/* ---------- Top bar ---------- */
nav {
    background: #000;
    border-bottom: 1px solid rgba(255, 255, 255, .14);
    backdrop-filter: none;
}

.nav-logo span {
    letter-spacing: .02em;
}

.lang-switch {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .4);
    box-shadow: none;
    backdrop-filter: none;
}

.lang-btn {
    color: rgba(255, 255, 255, .78);
}

.lang-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, .12);
    border-color: transparent;
    transform: none;
}

.lang-btn.active {
    background: #fff;
    color: #000;
    border-color: #fff;
    box-shadow: none;
}

/* ---------- Buttons ---------- */
.btn,
.article-cta .btn,
.mid-cta .btn,
.hero-cta .btn {
    border-radius: 0;
    letter-spacing: .04em;
    text-shadow: none;
    backdrop-filter: none;
    transition: background .2s, color .2s, border-color .2s, transform .2s var(--ae-ease);
}

.hero-cta .btn::before,
.hero-cta .btn::after,
.mid-cta .btn::before,
.mid-cta .btn::after,
.article-cta .btn::before,
.article-cta .btn::after,
.btn::before,
.btn::after {
    display: none;
}

/* On dark surfaces: solid white primary, outlined secondary */
.btn-enter,
.hero-cta .btn-enter,
.mid-cta .btn-enter {
    background: #fff;
    color: #000;
    border: 1px solid #fff;
    box-shadow: none;
}

.btn-tg,
.hero-cta .btn-tg,
.mid-cta .btn-tg {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .7);
    box-shadow: none;
}

.btn-enter:hover,
.hero-cta .btn-enter:hover,
.mid-cta .btn-enter:hover {
    background: #000;
    color: #fff;
    border-color: #fff;
    transform: none;
    box-shadow: none;
}

.btn-tg:hover,
.hero-cta .btn-tg:hover,
.mid-cta .btn-tg:hover {
    background: #fff;
    color: #000;
    border-color: #fff;
    transform: none;
    box-shadow: none;
}

/* On light surfaces: solid black primary, outlined secondary */
.article-cta .btn-enter {
    background: #000;
    color: #fff;
    border: 1px solid #000;
    box-shadow: none;
}

.article-cta .btn-tg {
    background: #fff;
    color: #000;
    border: 1px solid #000;
    box-shadow: none;
}

.article-cta .btn-enter:hover {
    background: #fff;
    color: #000;
    transform: none;
    box-shadow: none;
}

.article-cta .btn-tg:hover {
    background: #000;
    color: #fff;
    transform: none;
    box-shadow: none;
}

/* ---------- Hero ---------- */
.article-hero {
    background-color: #000;
    padding: 132px 24px 56px;
    border-bottom: 1px solid #000;
}

.article-hero h1 {
    color: #fff;
    font-weight: 800;
    letter-spacing: -.01em;
    line-height: 1.28;
    max-width: 860px;
    text-wrap: balance;
}

.article-hero .meta {
    color: rgba(255, 255, 255, .72);
    font-size: .78rem;
    letter-spacing: .14em;
    text-transform: uppercase;
}

/* ---------- Article body ---------- */
.article-body {
    max-width: 720px;
    padding: 40px 22px 32px;
    font-size: 1.04rem;
}

.article-body p,
.article-body li {
    color: var(--ae-text);
}

.article-body p {
    line-height: 1.9;
}

.article-body h2 {
    color: #000;
    font-size: 1.42rem;
    font-weight: 800;
    line-height: 1.38;
    letter-spacing: -.005em;
    border-left: 0;
    border-top: 2px solid #000;
    padding: 16px 0 0;
    margin: 44px 0 14px;
}

.article-body h3 {
    color: #000;
    font-size: 1.08rem;
    font-weight: 700;
}

.article-body strong,
.article-body li strong {
    color: #000;
}

.article-body ul,
.article-body ol {
    margin-left: 22px;
}

.article-body li::marker {
    color: #000;
}

.article-body em {
    font-style: italic;
}

.body-link,
.article-cta .body-link,
.article-body a:not(.btn):not(.related-card) {
    color: #000;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    border-bottom: 0;
    transition: text-decoration-thickness .15s, background .2s, color .2s;
}

.body-link:hover,
.article-cta .body-link:hover,
.article-body a:not(.btn):not(.related-card):hover {
    text-decoration-thickness: 2px;
    border-bottom: 0;
}

.article-body .ae-dateline {
    margin-bottom: 10px;
    font-size: .78rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ae-muted);
}

.article-body .ae-dateline strong {
    color: #000;
}

.article-img {
    border-radius: 0;
    margin: 0 0 26px;
    max-height: 420px;
}

/* ---------- Gallery ---------- */
.gallery-card img {
    border-radius: 0;
    box-shadow: none;
}

/* ---------- Mid-article call to action ---------- */
.mid-cta {
    background: #000;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 30px 24px;
    margin: 40px 0;
}

.mid-cta p {
    color: #fff;
    font-weight: 600;
    letter-spacing: .01em;
}

/* ---------- End-of-article call to action ---------- */
.article-cta {
    background: #fff;
    border: 0;
    border-top: 2px solid #000;
    border-bottom: 1px solid #000;
    border-radius: 0;
    box-shadow: none;
    transform: none;
}

.article-cta::before,
.article-cta::after,
.article-cta .cta-frame {
    display: none;
}

.article-cta:hover {
    transform: none;
    box-shadow: none;
}

.article-cta p {
    color: #000;
}

/* ---------- Related articles ---------- */
.related-articles {
    background: transparent;
    border: 0;
    border-top: 3px solid #000;
    border-radius: 0;
    box-shadow: none;
    padding: 18px 0 8px;
    margin-top: 48px;
}

.related-articles h3 {
    color: #000;
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 24px;
}

.related-card {
    min-width: 0;
    border: 0;
    border-bottom: 1px solid var(--ae-rule);
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    text-decoration: none;
    transition: transform .3s var(--ae-ease), border-color .3s;
}

.related-card:hover,
.related-card:focus-visible {
    border-color: #000;
    box-shadow: none;
    background: transparent;
}

.related-card img {
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.related-card-content {
    padding: 16px 0 18px;
}

.related-card-title {
    color: #000;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.5;
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

.related-card:hover .related-card-title,
.related-card:focus-visible .related-card-title {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.related-card-meta {
    color: #000;
    font-size: .7rem;
    letter-spacing: .14em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.related-card-meta::after {
    content: "\2192";
    font-size: 1.1rem;
    transition: transform .25s var(--ae-ease);
}

.related-card:hover .related-card-meta::after,
.related-card:focus-visible .related-card-meta::after {
    transform: translateX(4px);
}

/* ---------- Footer ---------- */
footer {
    background: #000;
    color: rgba(255, 255, 255, .78);
    padding: 48px 24px 28px;
}

.footer-inner {
    max-width: 960px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 24px 40px;
    text-align: left;
    padding-bottom: 28px;
    border-bottom: 1px solid rgba(255, 255, 255, .16);
}

footer .footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 12px 24px;
    margin: 0;
    line-height: 1.6;
}

footer .footer-links a {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 6px 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    text-decoration: none;
    transition: color .2s;
}

footer .footer-links a::after {
    content: "";
    position: absolute;
    inset: auto 0 4px;
    height: 1px;
    margin: 0;
    background: #fff;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .25s var(--ae-ease);
}

footer .footer-links a:last-child::after {
    content: "";
}

footer .footer-links a:hover::after,
footer .footer-links a:focus-visible::after {
    transform: scaleX(1);
}

footer .footer-quick-links {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
    margin: 0;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, .16);
    text-align: left;
}

footer .footer-quick-links h4 {
    margin: 0 0 12px;
    font-size: .75rem;
    letter-spacing: .12em;
}

.footer-inner a,
footer a {
    color: rgba(255, 255, 255, .82);
}

.footer-inner a:hover,
footer a:hover {
    color: #fff;
}

.footer-copy {
    color: rgba(255, 255, 255, .55);
    max-width: 960px;
    margin: 20px auto 0;
    text-align: left;
    font-size: .75rem;
    line-height: 1.8;
}

footer a:focus-visible,
.related-card:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 5px;
}

/* =================== Interactive layer =================== */
.article-body h2 {
    scroll-margin-top: 84px;
}

/* Reading progress, drawn over the black top bar */
.ae-progress {
    position: fixed;
    inset: 0 0 auto;
    height: 2px;
    z-index: 130;
    pointer-events: none;
}

.ae-progress span {
    display: block;
    height: 100%;
    background: #fff;
    transform: scaleX(0);
    transform-origin: 0 50%;
    will-change: transform;
}

/* Reading meta */
.ae-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 22px;
}

.ae-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid #000;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .06em;
    line-height: 1.6;
    color: #000;
    background: #fff;
}

.ae-chip svg {
    width: 12px;
    height: 12px;
    flex: none;
}

/* In-article contents */
.ae-toc {
    margin: 8px 0 34px;
    padding: 14px 0 6px;
    border-top: 2px solid #000;
    border-bottom: 1px solid #000;
}

.article-body .ae-toc-title {
    margin: 0 0 6px;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #000;
}

.article-body .ae-toc ol,
.ae-rail ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

.article-body .ae-toc li,
.ae-rail li {
    margin: 0;
    line-height: inherit;
}

.article-body .ae-toc li + li {
    border-top: 1px solid var(--ae-rule);
}

.article-body .ae-toc a {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 10px 0;
    color: #000;
    font-weight: 600;
    font-size: .96rem;
    line-height: 1.5;
    text-decoration: none;
    transition: padding-left .25s var(--ae-ease);
}

.ae-toc a .ae-num {
    flex: none;
    min-width: 1.8em;
    font-size: .74rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #000;
}

.article-body .ae-toc a:hover,
.article-body .ae-toc a:focus-visible,
.article-body .ae-toc a.is-active {
    padding-left: 6px;
    text-decoration: underline;
    text-underline-offset: 3px;
    outline: none;
}

/* Desktop side rail */
.ae-rail {
    position: fixed;
    top: 50%;
    left: max(18px, calc(50% - 360px - 236px));
    width: 196px;
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transform: translate(-10px, -50%);
    transition: opacity .35s, transform .35s var(--ae-ease), visibility .35s;
}

.ae-rail.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(0, -50%);
}

.ae-rail-title {
    margin: 0 0 10px 16px;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #000;
}

.ae-rail ol {
    border-left: 1px solid #000;
}

.ae-rail a {
    position: relative;
    display: block;
    padding: 6px 0 6px 16px;
    color: var(--ae-muted);
    font-size: .8rem;
    line-height: 1.45;
    text-decoration: none;
    transition: color .2s;
}

.ae-rail a::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #000;
    transform: scaleY(0);
    transition: transform .3s var(--ae-ease);
}

.ae-rail a:hover,
.ae-rail a:focus-visible,
.ae-rail a.is-active {
    color: #000;
    outline: none;
}

.ae-rail a.is-active {
    font-weight: 700;
}

.ae-rail a.is-active::before {
    transform: scaleY(1);
}

@media (max-width: 1279px) {
    .ae-rail {
        display: none;
    }
}

/* Heading copy-link buttons */
.ae-anchor {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin-left: 8px;
    vertical-align: middle;
    border: 0;
    background: transparent;
    color: #000;
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s, background .2s, color .2s;
}

.ae-anchor svg {
    width: 15px;
    height: 15px;
}

.article-body h2:hover .ae-anchor,
.ae-anchor:focus-visible {
    opacity: 1;
}

.ae-anchor:hover,
.ae-anchor:focus-visible {
    background: #000;
    color: #fff;
    outline: none;
}

@media (hover: none) {
    .ae-anchor {
        opacity: .45;
    }
}

/* Scroll reveal: enabled only after the script confirms support */
.ae-motion .ae-reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .7s var(--ae-ease), transform .7s var(--ae-ease);
}

.ae-motion .ae-reveal.ae-in {
    opacity: 1;
    transform: none;
}

/* Gallery viewer */
.article-gallery .gallery-card {
    overflow: hidden;
}

.article-gallery .gallery-card img[data-ae-index] {
    cursor: zoom-in;
    transition: transform .6s var(--ae-ease), filter .4s;
}

.article-gallery .gallery-card:hover img[data-ae-index] {
    transform: scale(1.035);
}

.article-gallery .gallery-card img[data-ae-index]:focus-visible {
    outline: 3px solid #000;
    outline-offset: -3px;
}

.ae-lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 56px 16px;
    background: rgba(0, 0, 0, .94);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s, visibility .3s;
}

.ae-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.ae-lightbox img {
    max-width: min(1100px, 100%);
    max-height: 100%;
    transform: scale(.97);
    transition: transform .35s var(--ae-ease);
}

.ae-lightbox.is-open img {
    transform: none;
}

.ae-lb-btn {
    position: absolute;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, .6);
    background: #000;
    color: #fff;
    cursor: pointer;
    transition: background .2s, color .2s;
}

.ae-lb-btn:hover,
.ae-lb-btn:focus-visible {
    background: #fff;
    color: #000;
    outline: none;
}

.ae-lb-btn svg {
    width: 20px;
    height: 20px;
}

.ae-lb-close {
    top: 14px;
    right: 14px;
}

.ae-lb-prev,
.ae-lb-next {
    top: 50%;
    margin-top: -22px;
}

.ae-lb-prev {
    left: 14px;
}

.ae-lb-next {
    right: 14px;
}

.ae-lb-count {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: .78rem;
    letter-spacing: .16em;
}

/* Floating dock */
.ae-dock {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity .3s, transform .3s var(--ae-ease);
}

.ae-dock.is-visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.ae-fab {
    position: relative;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid #000;
    background: #000;
    color: #fff;
    cursor: pointer;
    transition: background .2s, color .2s, transform .25s var(--ae-ease);
}

.ae-fab:hover,
.ae-fab:focus-visible {
    background: #fff;
    color: #000;
    transform: translateY(-2px);
    outline: none;
}

.ae-fab > svg {
    width: 18px;
    height: 18px;
}

.ae-ring {
    position: absolute;
    inset: 2px;
    width: calc(100% - 4px);
    height: calc(100% - 4px);
    transform: rotate(-90deg);
    pointer-events: none;
}

.ae-ring circle {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: butt;
    opacity: .9;
}

/* Toast */
.ae-toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    z-index: 210;
    padding: 10px 18px;
    background: #000;
    color: #fff;
    font-size: .84rem;
    font-weight: 600;
    letter-spacing: .02em;
    opacity: 0;
    transform: translate(-50%, 12px);
    pointer-events: none;
    transition: opacity .25s, transform .25s var(--ae-ease);
}

.ae-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Related card hover: image zoom and subtle lift */
.related-card img {
    transition: transform .6s var(--ae-ease), filter .4s;
}

.related-card:hover img {
    transform: scale(1.04);
}

.related-card.ae-tilting {
    transition: transform .12s linear;
}

@media (max-width: 600px) {
    .footer-inner {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .footer-copy {
        padding-right: 52px;
    }

    .related-grid {
        gap: 24px 16px;
    }

    .article-body {
        font-size: 1rem;
        padding-top: 28px;
    }

    .article-body h2 {
        font-size: 1.28rem;
    }

    .ae-dock {
        right: 12px;
        bottom: 12px;
    }

    .ae-fab {
        width: 42px;
        height: 42px;
    }

    .ae-lb-prev,
    .ae-lb-next {
        top: auto;
        bottom: 10px;
        margin-top: 0;
    }
}

@media (max-width: 420px) {
    .related-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ae-progress span,
    .ae-toc a,
    .ae-rail,
    .ae-rail a::before,
    .ae-dock,
    .ae-fab,
    .ae-toast,
    .ae-lightbox,
    .ae-lightbox img,
    .related-card img,
    .related-card,
    .related-card-meta::after,
    footer .footer-links a,
    footer .footer-links a::after,
    .article-gallery .gallery-card img[data-ae-index] {
        transition: none;
    }
}

@media print {
    nav,
    .hero-cta,
    .mid-cta,
    .ae-progress,
    .ae-rail,
    .ae-dock,
    .ae-toast,
    .ae-lightbox,
    .ae-anchor {
        display: none !important;
    }

    .ae-motion .ae-reveal {
        opacity: 1;
        transform: none;
    }
}

/* Pointer spotlight on the black mid-article call to action (desktop) */
.mid-cta.ae-spot {
    position: relative;
    overflow: hidden;
}

.mid-cta.ae-spot::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(360px circle at var(--ae-x, 50%) var(--ae-y, 50%), rgba(255, 255, 255, .13), transparent 62%);
    opacity: 0;
    transition: opacity .35s;
    pointer-events: none;
}

.mid-cta.ae-spot:hover::before {
    opacity: 1;
}

.mid-cta.ae-spot > * {
    position: relative;
}

/* Contents links: plain until hovered or active (outranks the general body-link rule) */
.article-body .ae-toc.ae-toc a {
    text-decoration: none;
    font-weight: 600;
}

.article-body .ae-toc.ae-toc a:hover,
.article-body .ae-toc.ae-toc a:focus-visible,
.article-body .ae-toc.ae-toc a.is-active {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

/* Some original links carry an inline purple colour; keep body links black */
.article-body a[style*="color"]:not(.btn) {
    color: #000 !important;
}
