/*
 * STWDB Article Styling
 * Deliberately scoped to body.stwdb-article-ui so database pages, archive pages,
 * homepage modules and other site tools are left alone.
 */

body.stwdb-article-ui {
    --stwdb-bg: #02060c;
    --stwdb-panel: #07111d;
    --stwdb-panel-2: #0a1726;
    --stwdb-panel-3: #0e2034;
    --stwdb-blue: #1769d2;
    --stwdb-blue-bright: #3d91f5;
    --stwdb-pink: #e23d9a;
    --stwdb-text: #f7f9fc;
    --stwdb-muted: #a9b9cd;
    --stwdb-border: rgba(61, 145, 245, .38);
    --stwdb-border-soft: rgba(61, 145, 245, .18);
    --stwdb-shadow: 0 24px 70px rgba(0, 0, 0, .42);
    background:
        radial-gradient(circle at 18% 8%, rgba(23, 105, 210, .10), transparent 30rem),
        radial-gradient(circle at 88% 24%, rgba(226, 61, 154, .055), transparent 26rem),
        var(--stwdb-bg);
}

/* Keep the post away from the fixed/site header. */
body.stwdb-article-ui .site-main,
body.stwdb-article-ui main,
body.stwdb-article-ui #main {
    position: relative;
}

body.stwdb-article-ui article.type-post,
body.stwdb-article-ui article.post,
body.stwdb-article-ui .single-entry {
    position: relative;
    box-sizing: border-box;
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
    margin-top: clamp(3.5rem, 7vw, 7rem);
    margin-bottom: clamp(3rem, 7vw, 7rem);
    padding: clamp(1.5rem, 3vw, 2.8rem) clamp(1.25rem, 4vw, 3.5rem) clamp(2rem, 5vw, 4rem);
    background:
        linear-gradient(135deg, rgba(23, 105, 210, .085), transparent 18rem),
        linear-gradient(180deg, var(--stwdb-panel-2), var(--stwdb-panel));
    border: 1px solid var(--stwdb-border-soft);
    border-radius: 18px;
    box-shadow: var(--stwdb-shadow);
    overflow: hidden;
}

/* Thin Homebase-style top rail. */
body.stwdb-article-ui article.type-post::before,
body.stwdb-article-ui article.post::before,
body.stwdb-article-ui .single-entry::before {
    content: "SAVE THE WORLD GUIDE";
    display: inline-flex;
    align-items: center;
    width: max-content;
    max-width: 100%;
    min-height: 30px;
    margin: 0 0 1.15rem;
    padding: .34rem .72rem .31rem;
    color: #fff;
    background: linear-gradient(90deg, rgba(23, 105, 210, .96), rgba(23, 105, 210, .78));
    border-left: 4px solid var(--stwdb-pink);
    border-radius: 4px;
    font-size: .73rem;
    line-height: 1;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

/* Make the title area feel intentional and stop it crowding the navigation. */
body.stwdb-article-ui .entry-header,
body.stwdb-article-ui .post-header,
body.stwdb-article-ui header.entry-header {
    position: relative;
    margin: 0 0 2rem;
    padding: 0 0 1.35rem;
    border-bottom: 1px solid var(--stwdb-border-soft);
}

body.stwdb-article-ui .entry-header::after,
body.stwdb-article-ui header.entry-header::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 92px;
    height: 3px;
    background: linear-gradient(90deg, var(--stwdb-pink), var(--stwdb-blue-bright));
    border-radius: 999px;
}

body.stwdb-article-ui .entry-title,
body.stwdb-article-ui h1.entry-title,
body.stwdb-article-ui article h1 {
    margin-top: 0;
    margin-bottom: .7rem;
    color: #fff;
    line-height: 1.05;
    text-wrap: balance;
    text-shadow: 0 2px 18px rgba(23, 105, 210, .14);
}

body.stwdb-article-ui .entry-meta,
body.stwdb-article-ui .posted-on,
body.stwdb-article-ui .byline,
body.stwdb-article-ui .post-meta {
    color: var(--stwdb-muted);
}

/* Core reading experience. */
body.stwdb-article-ui .entry-content,
body.stwdb-article-ui .post-content,
body.stwdb-article-ui .single-content {
    color: var(--stwdb-text);
    font-size: clamp(1.03rem, 1vw + .7rem, 1.18rem);
    line-height: 1.72;
}

body.stwdb-article-ui .entry-content p,
body.stwdb-article-ui .post-content p,
body.stwdb-article-ui .single-content p {
    margin-top: 0;
    margin-bottom: 1.45em;
}

body.stwdb-article-ui .entry-content > p:first-of-type,
body.stwdb-article-ui .post-content > p:first-of-type,
body.stwdb-article-ui .single-content > p:first-of-type {
    font-size: 1.08em;
    color: #fff;
}

/* H2s become section panels rather than text floating in black space. */
body.stwdb-article-ui .entry-content h2,
body.stwdb-article-ui .post-content h2,
body.stwdb-article-ui .single-content h2 {
    position: relative;
    clear: both;
    margin: 2.65rem 0 1.25rem;
    padding: .78rem 1rem .72rem 1.2rem;
    color: #fff;
    background:
        linear-gradient(90deg, rgba(23, 105, 210, .24), rgba(14, 32, 52, .88) 65%, rgba(14, 32, 52, .38));
    border: 1px solid rgba(61, 145, 245, .20);
    border-left: 5px solid var(--stwdb-blue-bright);
    border-radius: 8px;
    line-height: 1.12;
    text-wrap: balance;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
}

body.stwdb-article-ui .entry-content h2::after,
body.stwdb-article-ui .post-content h2::after,
body.stwdb-article-ui .single-content h2::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 34px;
    height: 3px;
    transform: translateY(-50%);
    background: var(--stwdb-pink);
    border-radius: 99px;
    opacity: .88;
}

body.stwdb-article-ui .entry-content h3,
body.stwdb-article-ui .post-content h3,
body.stwdb-article-ui .single-content h3 {
    margin: 2rem 0 .9rem;
    padding-left: .8rem;
    color: #fff;
    border-left: 3px solid var(--stwdb-pink);
    line-height: 1.2;
}

/* Links feel branded without turning every paragraph neon. */
body.stwdb-article-ui .entry-content a,
body.stwdb-article-ui .post-content a,
body.stwdb-article-ui .single-content a {
    color: #69aefb;
    text-decoration-thickness: 1px;
    text-underline-offset: .18em;
    text-decoration-color: rgba(105, 174, 251, .45);
    transition: color .16s ease, text-decoration-color .16s ease;
}

body.stwdb-article-ui .entry-content a:hover,
body.stwdb-article-ui .post-content a:hover,
body.stwdb-article-ui .single-content a:hover {
    color: #ff71bf;
    text-decoration-color: rgba(255, 113, 191, .7);
}

/* Images sit like real content modules. */
body.stwdb-article-ui .entry-content figure,
body.stwdb-article-ui .entry-content .wp-block-image,
body.stwdb-article-ui .post-content figure,
body.stwdb-article-ui .single-content figure {
    margin-top: 1.2rem;
    margin-bottom: 1.8rem;
}

body.stwdb-article-ui .entry-content img,
body.stwdb-article-ui .post-content img,
body.stwdb-article-ui .single-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid rgba(61, 145, 245, .27);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .28);
}

body.stwdb-article-ui figcaption,
body.stwdb-article-ui .wp-element-caption,
body.stwdb-article-ui .wp-caption-text {
    margin-top: .55rem;
    color: var(--stwdb-muted);
    font-size: .83em;
    line-height: 1.45;
    text-align: center;
}

/* Lists become small Homebase cards. */
body.stwdb-article-ui .entry-content ul,
body.stwdb-article-ui .entry-content ol,
body.stwdb-article-ui .post-content ul,
body.stwdb-article-ui .post-content ol,
body.stwdb-article-ui .single-content ul,
body.stwdb-article-ui .single-content ol {
    margin: 1.2rem 0 1.65rem;
    padding: 1rem 1.15rem 1rem 2.4rem;
    background: rgba(14, 32, 52, .62);
    border: 1px solid var(--stwdb-border-soft);
    border-radius: 9px;
}

body.stwdb-article-ui .entry-content li,
body.stwdb-article-ui .post-content li,
body.stwdb-article-ui .single-content li {
    margin: .38rem 0;
}

body.stwdb-article-ui .entry-content li::marker,
body.stwdb-article-ui .post-content li::marker,
body.stwdb-article-ui .single-content li::marker {
    color: var(--stwdb-pink);
    font-weight: 800;
}

/* Quotes / tips. */
body.stwdb-article-ui blockquote,
body.stwdb-article-ui .wp-block-quote {
    position: relative;
    margin: 1.8rem 0;
    padding: 1.2rem 1.35rem 1.15rem 1.45rem;
    color: #eaf3ff;
    background: linear-gradient(90deg, rgba(23, 105, 210, .15), rgba(226, 61, 154, .055));
    border: 1px solid var(--stwdb-border-soft);
    border-left: 4px solid var(--stwdb-pink);
    border-radius: 8px;
}

/* Tables are readable on dark backgrounds and scroll safely on phones. */
body.stwdb-article-ui .wp-block-table,
body.stwdb-article-ui .entry-content table,
body.stwdb-article-ui .post-content table,
body.stwdb-article-ui .single-content table {
    width: 100%;
    margin: 1.4rem 0 1.8rem;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid var(--stwdb-border-soft);
    border-radius: 9px;
    background: rgba(7, 17, 29, .75);
}

body.stwdb-article-ui table th {
    padding: .8rem .9rem;
    color: #fff;
    background: rgba(23, 105, 210, .26);
    border-color: rgba(61, 145, 245, .18);
    text-align: left;
}

body.stwdb-article-ui table td {
    padding: .75rem .9rem;
    color: #edf4fd;
    background: rgba(10, 23, 38, .62);
    border-color: rgba(61, 145, 245, .12);
}

body.stwdb-article-ui table tr:nth-child(even) td {
    background: rgba(14, 32, 52, .68);
}

/* Buttons / CTA blocks. */
body.stwdb-article-ui .wp-block-button__link,
body.stwdb-article-ui .entry-content .button,
body.stwdb-article-ui .entry-content button {
    color: #fff;
    background: linear-gradient(90deg, var(--stwdb-blue), #245fa7);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 7px;
    box-shadow: 0 8px 24px rgba(23, 105, 210, .19);
}

body.stwdb-article-ui .wp-block-button__link:hover,
body.stwdb-article-ui .entry-content .button:hover,
body.stwdb-article-ui .entry-content button:hover {
    background: linear-gradient(90deg, var(--stwdb-pink), #a52970);
}

/* Horizontal rules should feel intentional. */
body.stwdb-article-ui .entry-content hr,
body.stwdb-article-ui .post-content hr,
body.stwdb-article-ui .single-content hr {
    height: 1px;
    margin: 2rem 0;
    border: 0;
    background: linear-gradient(90deg, transparent, rgba(61, 145, 245, .55), rgba(226, 61, 154, .55), transparent);
}

/* Don't let common theme wrappers reintroduce a large white/transparent slab. */
body.stwdb-article-ui .content-bg,
body.stwdb-article-ui .entry-content-wrap,
body.stwdb-article-ui .post-inner,
body.stwdb-article-ui .inside-article {
    background: transparent;
}

/* Related/navigation cards below the article. */
body.stwdb-article-ui .post-navigation,
body.stwdb-article-ui .navigation.post-navigation,
body.stwdb-article-ui .author-box,
body.stwdb-article-ui .comments-area {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 1024px) {
    body.stwdb-article-ui article.type-post,
    body.stwdb-article-ui article.post,
    body.stwdb-article-ui .single-entry {
        width: calc(100% - 2rem);
        margin-top: 4rem;
    }
}

@media (max-width: 680px) {
    body.stwdb-article-ui article.type-post,
    body.stwdb-article-ui article.post,
    body.stwdb-article-ui .single-entry {
        width: calc(100% - 1rem);
        margin-top: 1.75rem;
        margin-bottom: 2.5rem;
        padding: 1.15rem .95rem 2rem;
        border-radius: 12px;
    }

    body.stwdb-article-ui article.type-post::before,
    body.stwdb-article-ui article.post::before,
    body.stwdb-article-ui .single-entry::before {
        font-size: .65rem;
        letter-spacing: .09em;
    }

    body.stwdb-article-ui .entry-content,
    body.stwdb-article-ui .post-content,
    body.stwdb-article-ui .single-content {
        font-size: 1rem;
        line-height: 1.66;
    }

    body.stwdb-article-ui .entry-content h2,
    body.stwdb-article-ui .post-content h2,
    body.stwdb-article-ui .single-content h2 {
        margin-top: 2.15rem;
        padding: .72rem .8rem .68rem .9rem;
        border-left-width: 4px;
    }

    body.stwdb-article-ui .entry-content h2::after,
    body.stwdb-article-ui .post-content h2::after,
    body.stwdb-article-ui .single-content h2::after {
        display: none;
    }

    body.stwdb-article-ui .wp-block-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Respect visitors who prefer less animation. */
@media (prefers-reduced-motion: reduce) {
    body.stwdb-article-ui * {
        scroll-behavior: auto !important;
        transition-duration: 0s !important;
    }
}
