/* =============================================================================
   CYNAPSE -- Professional Network layer
   =============================================================================
   Shared styling for Community + Knowledge Center article/detail pages and
   feed listings, built entirely on the existing cw-* design tokens defined in
   cynapse_worldclass.css (loaded before this file on every page that uses
   it). No colors, fonts, or spacing units are reinvented here -- this file
   only adds card/feed/article layout patterns in a LinkedIn-style
   professional-network idiom (rounded cards, avatar-led bylines, chip tags,
   comment threads) on top of the site's actual brand system, so these pages
   look like part of CYNAPSE rather than a separate product.

   Used by: community.html, community_post.html, knowledge_center.html
   ========================================================================== */

/* ---- Shared card primitive -------------------------------------------- */
.cw-pn-card {
    border: 1px solid var(--cw-line);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(3, 25, 19, .04);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.cw-pn-card--hover:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(3, 25, 19, .10);
    border-color: rgba(19, 40, 33, .22);
}

/* ---- Utility breadcrumb bar (replaces any page-local duplicate header) - */
.cw-pn-subbar {
    border-bottom: 1px solid var(--cw-line);
    background: #fff;
}

.cw-pn-subbar__inner {
    width: min(1240px, calc(100% - 40px));
    margin: 0 auto;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.cw-pn-subbar__crumb {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--cw-muted);
    font-size: 13px;
    font-weight: 600;
}

.cw-pn-subbar__crumb a { color: var(--cw-green); }
.cw-pn-subbar__crumb a:hover { text-decoration: underline; }

.cw-pn-subbar__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---- Article hero (dark band, matches cw-resource-hero language) ------ */
.cw-pn-hero {
    padding: 46px 0 40px;
    color: #fff;
    background:
        linear-gradient(120deg, rgba(3, 25, 19, .97), rgba(21, 87, 67, .92)),
        radial-gradient(circle at 86% 8%, rgba(255, 255, 255, .08), transparent 32%);
}

.cw-pn-hero__inner {
    width: min(1240px, calc(100% - 40px));
    margin: 0 auto;
}

.cw-pn-hero__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.cw-pn-hero__tags .cw-tag {
    color: #fff;
    background: rgba(255, 255, 255, .14);
}

.cw-pn-hero h1 {
    max-width: 880px;
    margin: 0;
    font-size: clamp(30px, 4.4vw, 52px);
    line-height: 1.12;
    font-weight: 800;
    color: #fff;
}

.cw-pn-hero p {
    max-width: 760px;
    margin: 18px 0 0;
    color: rgba(255, 255, 255, .8);
    font-size: 16px;
    line-height: 1.8;
}

.cw-pn-hero__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, .78);
}

.cw-pn-hero__meta a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

.cw-pn-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: var(--cw-green);
    font-weight: 800;
    font-size: 15px;
    flex-shrink: 0;
}

/* ---- Article + sidebar layout ------------------------------------------ */
.cw-pn-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 22px;
    align-items: start;
}

.cw-pn-article {
    padding: clamp(24px, 3.4vw, 44px);
}

.cw-pn-article__body {
    color: #273f35;
    font-size: 17px;
    line-height: 1.9;
}

.cw-pn-article__body p { margin: 0 0 1.2rem; }

.cw-pn-article__body h1,
.cw-pn-article__body h2,
.cw-pn-article__body h3,
.cw-pn-article__body h4 {
    color: var(--cw-deep);
    line-height: 1.28;
    margin: 1.9rem 0 .9rem;
    font-weight: 800;
}

.cw-pn-article__body ul,
.cw-pn-article__body ol {
    margin: .9rem 0 1.3rem;
    padding-inline-start: 1.4rem;
}

.cw-pn-article__body li { margin: .32rem 0; }

.cw-pn-article__body blockquote {
    border-inline-start: 4px solid var(--cw-green);
    margin: 1.5rem 0;
    padding: .9rem 1.1rem;
    background: var(--cw-paper);
    color: #33493f;
    border-radius: 12px;
}

.cw-pn-article__body img {
    display: block;
    max-width: 100%;
    margin: 1.5rem auto;
    border-radius: 14px;
    border: 1px solid var(--cw-line);
}

.cw-pn-article__body a {
    color: var(--cw-green);
    font-weight: 700;
    border-bottom: 1px solid rgba(21, 87, 67, .3);
}

/* ---- Content gate card -------------------------------------------------- */
.cw-pn-gate {
    text-align: center;
    padding: clamp(30px, 4.5vw, 50px) clamp(18px, 3.6vw, 36px);
    border: 1px dashed rgba(21, 87, 67, .32);
    border-radius: 16px;
    background: var(--cw-paper);
}

.cw-pn-gate i.fa-lock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(21, 87, 67, .10);
    color: var(--cw-green);
    font-size: 19px;
    margin-bottom: 16px;
}

.cw-pn-gate h2 {
    margin: 0 0 10px;
    font-size: 22px;
    font-weight: 800;
    color: var(--cw-deep);
}

.cw-pn-gate p {
    max-width: 540px;
    margin: 0 auto;
    color: var(--cw-muted);
    font-size: 14px;
    line-height: 1.75;
}

.cw-pn-gate__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 22px;
}

/* ---- Sidebar cards ------------------------------------------------------ */
.cw-pn-side { display: grid; gap: 16px; position: sticky; top: 110px; }
.cw-pn-side-card { padding: 20px; }

.cw-pn-side-card__eyebrow {
    color: #7a9088;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.cw-pn-side-card__title {
    margin: 6px 0 6px;
    color: var(--cw-deep);
    font-size: 17px;
    line-height: 1.35;
    font-weight: 800;
}

.cw-pn-side-card__text {
    margin: 0;
    color: var(--cw-muted);
    line-height: 1.7;
    font-size: 13px;
}

.cw-pn-share-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.cw-pn-share-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--cw-line);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--cw-deep);
    background: #fff;
    cursor: pointer;
}

.cw-pn-share-btn:hover { border-color: var(--cw-green); color: var(--cw-green); }

.cw-pn-tag-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }

/* ---- Discussion / comment feed (LinkedIn-style thread) ------------------ */
.cw-pn-discussion { padding: clamp(22px, 3vw, 32px); margin-top: 22px; }

.cw-pn-discussion h2 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 800;
    color: var(--cw-deep);
}

.cw-pn-comment-list { display: grid; gap: 12px; margin-top: 18px; }

.cw-pn-comment {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--cw-line);
    border-radius: 14px;
    background: var(--cw-paper);
}

.cw-pn-comment__name { font-weight: 800; color: var(--cw-deep); font-size: 13.5px; }

.cw-pn-comment__date {
    margin-top: 1px;
    color: #7f9389;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.cw-pn-comment__body {
    margin-top: 8px;
    color: #45594e;
    line-height: 1.7;
    font-size: 14px;
    white-space: pre-wrap;
}

.cw-pn-reply-form { margin-top: 20px; display: grid; gap: 10px; }

.cw-pn-reply-form label {
    display: grid;
    gap: 7px;
    color: var(--cw-deep);
    font-weight: 800;
    font-size: 13px;
}

.cw-pn-reply-form textarea {
    width: 100%;
    min-height: 110px;
    resize: vertical;
    border: 1px solid var(--cw-line);
    border-radius: 12px;
    padding: 12px 14px;
    outline: none;
    background: #fff;
    color: var(--cw-deep);
    font: inherit;
}

.cw-pn-empty-discussion {
    margin-top: 18px;
    border: 1px dashed var(--cw-line);
    border-radius: 14px;
    padding: 22px;
    color: var(--cw-muted);
    text-align: center;
    background: var(--cw-paper);
    font-size: 14px;
}

/* ---- Knowledge Center: clean list + "Top articles" side rail ---------- */
.cw-kc-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 30px;
    align-items: start;
}

.cw-kc-list { border-top: 1px solid var(--cw-line); }

.cw-kc-row {
    display: block;
    padding: 22px 0;
    border-bottom: 1px solid var(--cw-line);
    text-decoration: none;
    color: inherit;
}

.cw-kc-row__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.cw-kc-row h3 {
    margin: 0 0 6px;
    color: var(--cw-deep);
    font-size: 19px;
    line-height: 1.35;
    font-weight: 800;
    transition: color .15s ease;
}

.cw-kc-row:hover h3 { color: var(--cw-green); }

.cw-kc-row p {
    margin: 0;
    color: var(--cw-muted);
    font-size: 14px;
    line-height: 1.7;
}

.cw-kc-row__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 12px;
    font-weight: 700;
    color: #7f9389;
}

.cw-kc-rail {
    position: sticky;
    top: 110px;
    padding-inline-start: 22px;
    border-inline-start: 1px solid var(--cw-line);
}

.cw-kc-rail__eyebrow {
    color: #7a9088;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.cw-kc-rail__item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--cw-line);
    text-decoration: none;
    color: inherit;
}

.cw-kc-rail__item:last-child { border-bottom: 0; }

.cw-kc-rail__num {
    color: #9fb0a7;
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
}

.cw-kc-rail__title {
    color: var(--cw-deep);
    font-size: 13.5px;
    line-height: 1.5;
    font-weight: 700;
    transition: color .15s ease;
}

.cw-kc-rail__item:hover .cw-kc-rail__title { color: var(--cw-green); }

/* ---- Community feed cohesion polish (applied additively) --------------- */
.cw-composer.cw-pn-card,
.cw-post.cw-pn-card,
.cw-community-side.cw-pn-card,
.cw-filter.cw-pn-card,
.cw-community-side.cw-pn-card .cw-community-side__head {
    border-radius: 16px;
}

.cw-composer.cw-pn-card,
.cw-post.cw-pn-card { overflow: hidden; }

.cw-community-side.cw-pn-card .cw-community-side__head {
    border-radius: 15px 15px 0 0;
}

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 980px) {
    .cw-pn-layout { grid-template-columns: 1fr; }
    .cw-pn-side { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cw-kc-layout { grid-template-columns: 1fr; }
    .cw-kc-rail {
        position: static;
        border-inline-start: 0;
        padding-inline-start: 0;
        border-top: 1px solid var(--cw-line);
        padding-top: 20px;
        margin-top: 6px;
    }
}

@media (max-width: 680px) {
    .cw-pn-side { grid-template-columns: 1fr; }
    .cw-pn-comment { grid-template-columns: 32px minmax(0, 1fr); }
    .cw-pn-article__body { font-size: 15.5px; }
}
