/* CustomerNode Insights — the /insights/ hub.
   Premium light editorial layout: a featured lead plus an image-forward grid,
   built around the brand indigo system (see brand/AGENTS.md). Cover art is the
   article header captured for each LinkedIn piece (static/img/articles/).
   Everything is namespaced under .cn-insight* / .cn-cover*. No inline styles:
   PUBLIC_CSP is style-src 'self', so all styling lives here. */

.cn-insights-hub {
    --cni-indigo: #6366f1;
    --cni-indigo-deep: #4f46e5;
    --cni-indigo-soft: #818cf8;
    --cni-ink: #2c2a4d;
    --cni-ink-soft: #4a4866;
    --cni-muted: #6f6d8a;
    --cni-border: #e4e2f2;
    --cni-border-strong: #cfcceb;
    --cni-card: #ffffff;
    --cni-lilac: #edeafe;
    --cni-cover-bg: #f1f1f9;

    position: relative;
    isolation: isolate;
    /* NOT overflow:hidden — that would trap the sticky header. */
    /* The section box starts at y=0 (behind the fixed 60px nav). Pad the top by
       the nav height so the sticky header's natural position == its sticky top
       (60px): the header sits flush under the nav with no gap and no clamp, so
       the grid can't slide up underneath it. */
    padding: 60px 24px 120px;
    /* Flat near-white to match the rest of the public site (no purple wash). */
    background: #fdfdff;
}

/* position:sticky is confined by any ancestor with overflow != visible. The
   shared .body-wrap clips overflow site-wide; relax it on THIS page only (scoped
   by the insights-hub-page body class) so the header can stick. */
body.insights-hub-page .body-wrap,
body.insights-reader-page .body-wrap {
    overflow: visible;
}

.cn-insights-inner {
    position: relative;
    z-index: 1;
    max-width: 1180px;
    margin: 0 auto;
}

/* ---- Compact masthead: full-width sticky bar under the nav ---- */
.cn-hub-head {
    position: sticky;
    top: 60px;              /* flush against the 60px fixed nav */
    z-index: 5;             /* above cards, below the nav (z-index 10) */
    /* Negative side margins cancel the section's 24px padding so the frosted
       bar spans the full viewport width (no 100vw -> no scrollbar overflow). */
    margin: 0 -24px 32px;
    /* 24px side padding here (not on the inner) so the inner's container box is
       identical to the grid's .cn-insights-inner -> content aligns with cards. */
    padding: 14px 24px;
    /* Transparent at the top; the frosted cover fades in once scrolled (hub.js
       toggles .is-stuck) so cards scroll cleanly underneath. */
    background: transparent;
    transition: background 200ms ease, box-shadow 200ms ease,
                -webkit-backdrop-filter 200ms ease, backdrop-filter 200ms ease;
}

.cn-hub-head.is-stuck {
    background: rgba(251, 251, 254, 0.92);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 26px -20px rgba(44, 42, 77, 0.55);
}

/* Content stays aligned to the grid container inside the full-width bar. */
.cn-hub-head-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px 24px;
}

.cn-hub-title {
    /* Match the Knowledge Center / Trust Center page titles (.faqx-h1 / .tc-h1). */
    font-size: 2.2rem;
    line-height: 1.15;
    letter-spacing: -0.025em;
    margin: 0;
    font-weight: 700;
    color: #0f172a;
}

.cn-hub-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* `a.` specificity so the global `a:not(.button)` underline never applies. */
a.cn-hub-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 12px;
    padding: 10px 18px;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, color 160ms ease;
}

a.cn-hub-cta svg { flex-shrink: 0; }

a.cn-hub-cta--linkedin {
    color: #ffffff;
    background: linear-gradient(120deg, #4f46e5, #6366f1);
    box-shadow: 0 14px 30px -16px rgba(79, 70, 229, 0.6);
}

a.cn-hub-cta--linkedin:hover,
a.cn-hub-cta--linkedin:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 20px 38px -16px rgba(79, 70, 229, 0.7);
    color: #ffffff;
    outline: none;
}

@media (max-width: 560px) {
    .cn-hub-head-inner { align-items: flex-start; }
    .cn-hub-actions { width: 100%; }
}

/* ---- Shared entry shell: clean card, matching the index .article-card ---- */
.cn-insight-entry {
    background: #ffffff;
    border: 1px solid var(--cni-border);
    border-radius: 20px;
    overflow: hidden;
    scroll-margin-top: 110px;
    box-shadow: 0 4px 24px rgba(44, 42, 77, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.cn-insight-entry:hover,
.cn-insight-entry:focus-within {
    transform: translateY(-4px);
    border-color: var(--cni-border-strong);
    box-shadow: 0 18px 50px rgba(79, 70, 229, 0.12);
}

/* ---- Cover art ---- */
.cn-cover {
    display: block;
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--cni-cover-bg);
    overflow: hidden;
    text-decoration: none;
}

.cn-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 420ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.cn-cover-img--top { object-position: top center; }
.cn-cover-img--center { object-position: center; }

.cn-insight-entry:hover .cn-cover-img,
.cn-insight-entry:focus-within .cn-cover-img {
    transform: scale(1.03);
}

/* Subtle top sheen on every cover so light and dark sources read as one set. */
.cn-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 62%, rgba(44, 42, 77, 0.06) 100%);
    pointer-events: none;
}

/* Generated cover for pieces without a designed hero. */
.cn-cover--gen {
    background:
        radial-gradient(120% 120% at 18% 12%, rgba(129, 140, 248, 0.55), rgba(129, 140, 248, 0) 60%),
        linear-gradient(135deg, #4f46e5 0%, #6366f1 48%, #312e81 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cn-cover-num {
    font-size: clamp(4rem, 12vw, 7rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    color: rgba(255, 255, 255, 0.16);
    user-select: none;
}

.cn-cover--gen::before {
    content: "Insights";
    position: absolute;
    bottom: 18px;
    left: 22px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
}

/* ---- Meta / badges ---- */
.cn-insight-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.cn-insight-badge {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--cni-indigo-deep);
    background: var(--cni-lilac);
    border-radius: 999px;
    padding: 5px 12px;
    line-height: 1;
}

.cn-insight-date {
    font-size: 0.8rem;
    color: var(--cni-muted);
    font-weight: 500;
}

/* ---- Titles / copy ---- */
.cn-insight-entry-title {
    color: var(--cni-ink);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 14px;
}

.cn-insight-abstract {
    font-size: 1.04rem;
    line-height: 1.68;
    color: var(--cni-ink-soft);
    margin: 0 0 22px;
}

.cn-insight-teaser {
    font-size: 0.98rem;
    line-height: 1.6;
    color: var(--cni-muted);
    margin: 0 0 22px;
    flex: 1 1 auto;
}

.cn-insight-takeaways {
    list-style: none;
    margin: 0 0 26px;
    padding: 0;
    color: var(--cni-ink-soft);
    font-size: 0.96rem;
    line-height: 1.5;
}

.cn-insight-takeaways li {
    position: relative;
    padding-left: 22px;
    margin-bottom: 10px;
}

.cn-insight-takeaways li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 0.5em;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    background: linear-gradient(135deg, var(--cni-indigo), var(--cni-indigo-soft));
    transform: rotate(45deg);
}

/* Kill the global `a:not(.button)` underline for our link classes (it out-ranks
   a bare class selector; matching `a.class` specificity + load order wins). */
a.cn-insight-titlelink,
a.cn-insight-entry-link,
a.cn-insight-li,
a.cn-insights-alllink {
    text-decoration: none;
}

/* ---- Title link (primary on-domain click) ---- */
.cn-insight-titlelink {
    color: inherit;
    text-decoration: none;
    background-image: linear-gradient(var(--cni-indigo), var(--cni-indigo));
    background-size: 0% 2px;
    background-repeat: no-repeat;
    background-position: 0 100%;
    transition: background-size 200ms ease, color 160ms ease;
}

.cn-insight-entry:hover .cn-insight-titlelink,
.cn-insight-titlelink:focus-visible {
    color: var(--cni-indigo-deep);
    background-size: 100% 2px;
    outline: none;
}

/* ---- Card link row (on-domain primary + LinkedIn affordance) ---- */
.cn-insight-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 20px;
    margin-top: auto;
    padding-top: 4px;
}

.cn-insight-li {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--cni-muted);
    text-decoration: none;
    transition: color 160ms ease;
}

.cn-insight-li svg { flex-shrink: 0; }

.cn-insight-li:hover,
.cn-insight-li:focus-visible {
    color: #0a66c2; /* LinkedIn blue on hover */
    outline: none;
}

/* ---- Read link ---- */
.cn-insight-entry-link {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 0.94rem;
    font-weight: 600;
    color: var(--cni-indigo-deep);
    text-decoration: none;
    margin-top: auto;
}

.cn-insight-entry-link svg:first-child { flex-shrink: 0; }

.cn-link-arrow { transition: transform 180ms ease; }

.cn-insight-entry-link:hover,
.cn-insight-entry-link:focus-visible {
    color: var(--cni-indigo);
    outline: none;
}

.cn-insight-entry-link:hover .cn-link-arrow,
.cn-insight-entry-link:focus-visible .cn-link-arrow {
    transform: translateX(4px);
}

/* ---- Grid ---- */
.cn-insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(364px, 1fr));
    gap: 28px;
}

.cn-insight-card {
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
}

/* Stretched link covering the whole card (crawlable on-domain href; hub.js
   intercepts the click to open the read-where modal). */
a.cn-card-link {
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: inherit;
    text-decoration: none;
    font-size: 0;
    cursor: pointer;
}

a.cn-card-link:focus-visible {
    outline: 2px solid var(--cni-indigo);
    outline-offset: 3px;
}

.cn-insight-card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 28px 28px 26px;
}

.cn-insight-card .cn-insight-entry-title {
    font-size: 1.26rem;
    line-height: 1.3;
}

/* ---- Back link ---- */
.cn-insights-hub-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 56px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--cni-indigo-deep);
    text-decoration: none;
}

.cn-insights-hub-back svg { transition: transform 180ms ease; }

.cn-insights-hub-back:hover,
.cn-insights-hub-back:focus-visible {
    color: var(--cni-indigo);
    outline: none;
}

.cn-insights-hub-back:hover svg,
.cn-insights-hub-back:focus-visible svg {
    transform: translateX(-3px);
}

/* ---- "Read where?" modal ---- */
.cn-readmodal {
    position: fixed;
    inset: 0;
    z-index: 1000;                 /* above the site nav (z-index 10) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 180ms ease;
}

.cn-readmodal.is-open { opacity: 1; }
.cn-readmodal[hidden] { display: none; }

.cn-readmodal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(28, 26, 54, 0.55);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.cn-readmodal-dialog {
    position: relative;
    width: min(440px, 100%);
    background: #ffffff;
    border-radius: 22px;
    padding: 34px 32px 30px;
    box-shadow: 0 40px 90px -30px rgba(28, 26, 54, 0.7);
    transform: translateY(8px) scale(0.98);
    transition: transform 200ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.cn-readmodal.is-open .cn-readmodal-dialog { transform: none; }

/* Cover art mirrored from the clicked card. Bleeds to the dialog's top edges
   (negative margins cancel the dialog padding) and shares the card's 16:9 crop
   and object-position variants, so the modal reads as the same piece. */
.cn-readmodal-cover {
    display: block;
    position: relative;
    aspect-ratio: 16 / 9;
    width: calc(100% + 64px);
    margin: -34px -32px 22px;
    border-radius: 22px 22px 0 0;
    overflow: hidden;
    background: var(--cni-cover-bg);
}

.cn-readmodal-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.cn-readmodal-cover-img--top { object-position: top center; }
.cn-readmodal-cover-img--center { object-position: center; }

/* Numbered-gradient fallback for pieces without a designed hero — matches
   the card's .cn-cover--gen so covered and uncovered pieces stay a set. */
.cn-readmodal-cover--gen {
    background:
        radial-gradient(120% 120% at 18% 12%, rgba(129, 140, 248, 0.55), rgba(129, 140, 248, 0) 60%),
        linear-gradient(135deg, #4f46e5 0%, #6366f1 48%, #312e81 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cn-readmodal-cover-num {
    font-size: clamp(3.4rem, 10vw, 5.6rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    color: rgba(255, 255, 255, 0.18);
    user-select: none;
}

.cn-readmodal-x {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;                    /* stay above the cover image */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: var(--cni-field-bottom, #eef0f6);
    color: var(--cni-muted);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(28, 26, 54, 0.22);
    transition: background 140ms ease, color 140ms ease;
}

.cn-readmodal-x:hover { background: var(--cni-lilac); color: var(--cni-indigo-deep); }

.cn-readmodal-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--cni-indigo-deep);
    margin: 0 0 8px;
}

.cn-readmodal-title {
    font-size: 1.3rem;
    line-height: 1.3;
    font-weight: 700;
    color: var(--cni-ink);
    margin: 0 0 24px;
    padding-right: 28px;
}

a.cn-readmodal-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 12px;
    padding: 14px 20px;
    transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, color 150ms ease;
}

a.cn-readmodal-cta + a.cn-readmodal-cta { margin-top: 12px; }

a.cn-readmodal-cta--linkedin {
    color: #ffffff;
    background: linear-gradient(120deg, #4f46e5, #6366f1);
    box-shadow: 0 16px 34px -16px rgba(79, 70, 229, 0.6);
}

a.cn-readmodal-cta--linkedin:hover,
a.cn-readmodal-cta--linkedin:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 22px 44px -16px rgba(79, 70, 229, 0.7);
    color: #ffffff;
    outline: none;
}

a.cn-readmodal-cta--site {
    color: var(--cni-indigo-deep);
    border: 1px solid var(--cni-border-strong);
    background: #ffffff;
}

a.cn-readmodal-cta--site:hover,
a.cn-readmodal-cta--site:focus-visible {
    border-color: var(--cni-indigo);
    color: var(--cni-indigo);
    outline: none;
}

body.cn-readmodal-open { overflow: hidden; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .cn-insights-hub { padding: 60px 16px 88px; }   /* clear the fixed nav */
    .cn-hub-head { margin: 0 -16px 28px; padding: 14px 16px; }  /* full width + 16px inset */
    .cn-hub-title { font-size: 1.8rem; }
    .cn-insights-grid { grid-template-columns: 1fr; gap: 22px; }
    .cn-insight-card-body { padding: 24px 22px; }
}

@media (prefers-reduced-motion: reduce) {
    .cn-insight-entry,
    .cn-cover-img,
    .cn-link-arrow,
    .cn-insights-hub-back svg {
        transition: none;
    }
    .cn-insight-entry:hover { transform: none; }
    .cn-insight-entry:hover .cn-cover-img { transform: none; }
}
