/*
 * Pulse Knowledge Base — global styles
 * Design tokens mirror pulseplatform.co so the KB reads as the same product.
 * Typography: Poppins (headings) + Inter (body/UI).
 */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@500;600;700;800&display=swap");

:root {
    /* Brand */
    --pulse-blue: #3fa9f5;
    --pulse-navy: #09384a;
    --deep-blue: #0c4d66;
    --navy-ink: #06283e;
    --action-blue: #0176d3;
    --action-blue-hover: #005fb2;

    /* Surfaces */
    --canvas: #f7f9fc;
    --mist: #f0f5fb;
    --sky-tint: #eaf4fd;
    --sky-tint-deep: #d8ebfa;
    --surface: #ffffff;

    /* Ink */
    --ink: #06283e;
    --body-ink: #3e4850;
    --op-gray: #727b88;
    --muted-gray: #a0a7b3;

    /* Lines */
    --line: #dce2f7;
    --line-strong: #bdc8d1;

    /* Status */
    --ok: #10b981;
    --warn: #f59e0b;
    --err: #ef4444;

    /* Agentforce */
    --agent-purple: #7b2ff2;
    --agent-magenta: #d946ef;
    --agentforce-gradient: linear-gradient(135deg, #00a1e0 0%, #7b2ff2 50%, #d946ef 100%);

    /* Type */
    --font-head: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-body: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    /* Radii */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-pill: 9999px;

    /* Elevation */
    --shadow-sm: 0 1px 2px rgba(6, 40, 62, 0.06), 0 1px 1px rgba(6, 40, 62, 0.04);
    --shadow-md: 0 2px 4px rgba(6, 40, 62, 0.05), 0 6px 16px -4px rgba(6, 40, 62, 0.1);
    --shadow-lg: 0 4px 8px rgba(6, 40, 62, 0.05), 0 12px 24px -6px rgba(6, 40, 62, 0.12);

    /* Rhythm */
    --gutter: 24px;
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Documentation measure — long-form prose should not run the full 1320px */
    --kb-measure: 78ch;
}

html,
body {
    height: 100%;
}

html {
    background: var(--canvas);
}

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--body-ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------------------------------------------------------------
   Headings — Poppins, navy, tightened tracking at display sizes
   --------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-head);
    color: var(--ink);
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Article title, rendered into the Knowledge Article component's heading slot */
.pulse-article-title {
    font-family: var(--font-head);
    font-size: 2.125rem;
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0.25rem 0 0.5rem;
    padding: 0 1rem;
}

@media (max-width: 767px) {
    .pulse-article-title {
        font-size: 1.625rem;
    }
}

/* ---------------------------------------------------------------
   Links
   --------------------------------------------------------------- */
a {
    color: var(--action-blue);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--action-blue-hover);
    text-decoration: underline;
}

/* Keyboard focus must stay visible everywhere — this is a docs site
   people navigate with the keyboard. */
:focus-visible {
    outline: 2px solid var(--action-blue);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ---------------------------------------------------------------
   Article prose — applied by the article component to rendered
   rich text so authored HTML inherits the design system.
   --------------------------------------------------------------- */
.pulse-prose {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--body-ink);
    max-width: var(--kb-measure);
}

.pulse-prose > * + * {
    margin-top: 1.1em;
}

.pulse-prose h2 {
    font-size: 1.5rem;
    margin-top: 2.5rem;
    padding-top: 0.5rem;
    scroll-margin-top: 5rem;
}

.pulse-prose h3 {
    font-size: 1.1875rem;
    margin-top: 2rem;
    scroll-margin-top: 5rem;
}

.pulse-prose h4 {
    font-size: 1rem;
    margin-top: 1.5rem;
    scroll-margin-top: 5rem;
}

/* SLDS resets list-style to none, so authored bullets and numbers vanish without this. */
.pulse-prose ul,
.pulse-prose ol {
    padding-left: 1.5rem;
    margin-left: 0;
}

.pulse-prose ul {
    list-style: disc outside;
}

.pulse-prose ol {
    list-style: decimal outside;
}

.pulse-prose ul ul {
    list-style: circle outside;
}

.pulse-prose li {
    display: list-item;
}

.pulse-prose li + li {
    margin-top: 0.4em;
}

.pulse-prose li::marker {
    color: var(--muted-gray);
}

.pulse-prose strong {
    color: var(--ink);
    font-weight: 600;
}

.pulse-prose code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--mist);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.1em 0.35em;
    color: var(--deep-blue);
    word-break: break-word;
}

.pulse-prose pre {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.6;
    background: var(--navy-ink);
    color: #e6eef5;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    overflow-x: auto;
}

.pulse-prose pre code {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
}

.pulse-prose blockquote {
    margin-left: 0;
    padding: 0.75rem 1.25rem;
    border-left: 3px solid var(--pulse-blue);
    background: var(--sky-tint);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--deep-blue);
}

.pulse-prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
    display: block;
    overflow-x: auto;
}

.pulse-prose th,
.pulse-prose td {
    border: 1px solid var(--line);
    padding: 0.625rem 0.875rem;
    text-align: left;
    vertical-align: top;
}

.pulse-prose th {
    background: var(--mist);
    font-family: var(--font-head);
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
}

.pulse-prose img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.pulse-prose hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 2rem 0;
}

/* Callouts — authors write <div class="pulse-callout pulse-callout_warning"> */
.pulse-callout {
    border: 1px solid var(--line);
    border-left: 4px solid var(--action-blue);
    background: var(--sky-tint);
    border-radius: var(--radius);
    padding: 0.875rem 1.125rem;
    color: var(--deep-blue);
}

.pulse-callout_warning {
    border-left-color: var(--warn);
    background: #fff8ec;
    color: #7a4b00;
}

.pulse-callout_danger {
    border-left-color: var(--err);
    background: #fef1f1;
    color: #8f1f1f;
}

.pulse-callout_success {
    border-left-color: var(--ok);
    background: #eefaf5;
    color: #0a5c43;
}

/* ---------------------------------------------------------------
   Home page (HTML Editor content - standard components only)
   --------------------------------------------------------------- */
.pkb-hero {
    background: linear-gradient(160deg, var(--navy-ink) 0%, var(--pulse-navy) 55%, var(--deep-blue) 100%);
    border-radius: var(--radius-lg);
    padding: 3.25rem 1.5rem 2.75rem;
    text-align: center;
}

.pkb-hero__title {
    font-family: var(--font-head);
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.1;
    color: #ffffff;
    margin: 0 0 0.75rem;
}

.pkb-hero__sub {
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--sky-tint-deep);
    max-width: 56ch;
    margin: 0 auto;
}

.pkb-section__title {
    font-family: var(--font-head);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
    margin: 2rem 0 1rem;
}

.pkb-roles,
.pkb-areas {
    display: grid;
    gap: 0.875rem;
}

.pkb-roles {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.pkb-areas {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.pkb-role,
.pkb-area {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.125rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.pkb-role:hover,
.pkb-area:hover {
    border-color: var(--pulse-blue);
    background: var(--sky-tint);
    transform: translateY(-1px);
    text-decoration: none;
}

.pkb-role__label,
.pkb-area__name {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
}

.pkb-role__blurb,
.pkb-area__desc {
    font-family: var(--font-body);
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--op-gray);
}

.pkb-area__covers {
    font-family: var(--font-body);
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--deep-blue);
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid var(--line);
}

.pkb-area__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.pkb-area__count {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--muted-gray);
    white-space: nowrap;
}

.pkb-card__list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0.625rem 0 0;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.pkb-card__list a {
    font-family: var(--font-body);
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--action-blue);
    text-decoration: none;
}

.pkb-card__list a:hover {
    text-decoration: underline;
}

.pkb-card__empty,
.pkb-card__more {
    font-family: var(--font-body);
    font-size: 0.8125rem;
    color: var(--muted-gray);
    margin: 0.25rem 0 0;
}

.pkb-browse-all {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin: 0.5rem 0 0.5rem;
}

/* The site's own link style outranks a single class, so the button is scoped and forced. */
.pkb-browse-all a.pkb-btn,
.pkb-browse-all a.pkb-btn:visited {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    background: var(--action-blue) !important;
    color: #ffffff !important;
    text-decoration: none;
}

.pkb-browse-all a.pkb-btn:hover,
.pkb-browse-all a.pkb-btn:focus-visible {
    background: var(--action-blue-hover) !important;
    color: #ffffff !important;
    text-decoration: none;
}

.pkb-browse-all__hint {
    font-family: var(--font-body);
    font-size: 0.8125rem;
    color: var(--op-gray);
}

@media (max-width: 640px) {
    .pkb-hero { padding: 2.25rem 1rem 2rem; }
    .pkb-hero__title { font-size: 1.875rem; }
}

/* ---------------------------------------------------------------
   Mobile
   --------------------------------------------------------------- */
@media (max-width: 767px) {
    .pulse-prose {
        font-size: 0.9375rem;
    }

    .pulse-prose h2 {
        font-size: 1.3125rem;
        margin-top: 2rem;
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
