/* ============================================================
   Supablog — custom style layer
   Loaded LAST (after built/screen.css) so it overrides the base
   Source theme. Uses the Supahost brand tokens already defined in
   :root (indigo scale, primary blue, grays). Build-free: edit this
   file and refresh.
   ============================================================ */

:root {
    --sb-accent: var(--color-indigo-darker);      /* #08306B */
    --sb-accent-soft: var(--color-indigo-lightest); /* #D8ECFD */
    --sb-link: var(--color-primary-dark);          /* #0C4497 — AA-safe on white (DESIGN.md) */
    --sb-line: var(--color-gray-lighter);          /* #E1E1E1 — canonical hairline (DESIGN.md) */
    --sb-heading: var(--color-gray-darker);        /* #333  — DESIGN.md heading color */
    --sb-text: var(--color-gray-dark);             /* #5C5C5C */
    --sb-muted: var(--color-gray-base);            /* #999 */
    --sb-surface: #fff;
    --sb-radius: 16px;
    --sb-radius-sm: 12px;
    --sb-shadow: 0 1px 2px rgb(8 48 107 / 0.04), 0 6px 20px rgb(8 48 107 / 0.06);
    --sb-shadow-hover: 0 2px 4px rgb(8 48 107 / 0.06), 0 16px 40px rgb(8 48 107 / 0.12);
}

/* ---- Feed section heading ("Latest") -------------------- */
.gh-container-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    color: var(--sb-accent);
    font-weight: 650;
    letter-spacing: 0.08em;
    border-bottom: 0;
    margin-bottom: var(--grid-gap);
    padding-bottom: 0;
}
.gh-container-title::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sb-link);
    box-shadow: 0 0 0 3px var(--sb-accent-soft);
}
.gh-container-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

/* ---- Post feed → framed editorial list (matches article) ---- */
/* Frame the feed (LATEST + rows) with the same gray hairlines + width
   as the article, and flatten the rows into hairline-separated entries. */
.gh-container.is-list .gh-container-inner {
    display: block;
    max-width: 1240px;
    margin: 0 auto;
    border-inline: 1px solid var(--sb-line);
    padding: 8px clamp(24px, 4vw, 64px) 0;
}
.gh-container.is-list .gh-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* drop the base divider pseudo-element; use real row borders instead */
.gh-container.is-list .gh-card + .gh-card::before {
    display: none;
}

.gh-container.is-list .gh-card {
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    border-top: 1px solid var(--sb-line);
}
.gh-container.is-list .gh-card:first-child {
    border-top: 0;
}

.gh-container.is-list .gh-card-link {
    gap: 36px;
    padding: 28px 4px;
    align-items: center;
}
.gh-container.is-list .no-image .gh-card-link {
    padding: 28px 4px;
}

.gh-container.is-list .gh-card-image {
    width: 232px;
    aspect-ratio: 16 / 10;
    border-radius: var(--sb-radius-sm);
    overflow: hidden;
}

/* surface the primary tag as a brand pill */
.gh-card-tag {
    display: inline-block;
    margin-bottom: 10px;
    padding: 4px 11px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--sb-accent);
    background: var(--sb-accent-soft);
    border-radius: 999px;
}

.gh-card-title {
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--sb-heading);
    transition: color 0.15s ease;
}
/* accent the title on hover instead of fading it */
.gh-card-link:hover .gh-card-title {
    opacity: 1;
    color: var(--sb-accent);
}

.gh-card-excerpt {
    color: var(--sb-text);
    -webkit-line-clamp: 2;
}

.gh-card-meta {
    color: var(--sb-muted);
    font-weight: 550;
    letter-spacing: 0.005em;
}
.gh-card-author {
    color: var(--sb-text);
}

@media (max-width: 767px) {
    .gh-container.is-list .gh-container-inner {
        padding-inline: clamp(20px, 5vw, 32px);
    }
    .gh-container.is-list .gh-card-link {
        flex-direction: column;
        align-items: flex-start;
        padding: 24px 0;
        gap: 16px;
    }
    .gh-container.is-list .gh-card-image {
        width: 100%;
    }
}

/* ---- Grid style cards (if toggled) ---------------------- */
.gh-container.is-grid .gh-card {
    background: var(--sb-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--sb-radius);
    box-shadow: var(--sb-shadow);
    padding: 14px;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.gh-container.is-grid .gh-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--sb-shadow-hover);
}
.gh-container.is-grid .gh-card::before,
.gh-container.is-grid .gh-card::after {
    display: none;
}
.gh-container.is-grid .gh-card-image {
    border-radius: var(--sb-radius-sm);
    overflow: hidden;
}

/* ============================================================
   Article — Attio-style framed editorial layout (light theme)
   [ header zone: eyebrow · title · author, full width ]
   [ body zone: content (left) | sticky TOC (right) ]
   Framed by gray hairlines (DESIGN.md: gray-lighter separators).
   ============================================================ */
.sb-article-frame {
    max-width: 1240px;
    margin: 0 auto;
    border-inline: 1px solid var(--sb-line);     /* left + right vertical frame lines */
}

/* ---- Header zone ---------------------------------------- */
/* No horizontal padding on the header itself — the eyebrow and the
   header body each manage their own insets so the body's columns line up
   exactly with the content/TOC grid below (and the image meets the divider).
   Generous top padding keeps the sticky header pill off the eyebrow. */
.sb-article-header {
    padding: 72px 0 44px;
}
@media (max-width: 767px) {
    .sb-article-header { padding-top: 48px; }
}

/* eyebrow: date / category .......... reading time (full content width) */
.sb-eyebrow {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    margin: 0 clamp(24px, 4vw, 64px);
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--sb-line);     /* the dashed top divider */
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--sb-text);
}
.sb-eyebrow__left { display: inline-flex; gap: 26px; flex-wrap: wrap; }
.sb-eyebrow__date { color: var(--sb-muted); }
.sb-eyebrow__cat { color: var(--sb-text); }
.sb-eyebrow__sep { color: var(--color-gray-light); margin: 0 2px; }
.sb-eyebrow__read { color: var(--sb-muted); white-space: nowrap; }

/* header body — mirrors the body grid: [ content col ] [ TOC-rail col ].
   Text sits in the content column; the image sits in the right band,
   directly above (and aligned with) the table of contents. */
.sb-header-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(260px, 22vw, 340px);
    align-items: start;
    margin-top: 40px;
}
.sb-header-inner {
    grid-column: 1;
    min-width: 0;
    padding-left: clamp(24px, 4vw, 64px);
    /* right padding lets the title/dek run up to the divider line with a gap */
    padding-right: clamp(32px, 3.5vw, 64px);
}
.sb-header-text {
    min-width: 0;
}
.sb-header-image {
    grid-column: 2;
    margin: 0;
    /* match the TOC rail's horizontal padding so the image lines up
       exactly with the "On this page" list beneath it */
    padding: 0 clamp(20px, 2vw, 32px);
}
.sb-header-image img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--sb-radius);
    box-shadow: var(--sb-shadow);
}
.sb-header-image figcaption {
    margin-top: 10px;
    font-size: 1.2rem;
    line-height: 1.4;
    color: var(--sb-muted);
}
/* below the TOC breakpoint: single column, image stacks under the text */
@media (max-width: 1099px) {
    .sb-header-body {
        grid-template-columns: minmax(0, 1fr);
    }
    .sb-header-inner {
        padding-right: clamp(24px, 4vw, 64px);
    }
    .sb-header-image {
        grid-column: 1;
        padding: 0 clamp(24px, 4vw, 64px);
        margin-top: 32px;
    }
    .sb-header-image img {
        max-width: 480px;
    }
}

.sb-title {
    margin: 0;
    font-size: clamp(3.4rem, 1.4vw + 2.8rem, 5.2rem);
    font-weight: 600;
    line-height: 1.06;
    letter-spacing: -0.025em;
    color: var(--sb-heading);
}

.sb-dek {
    margin: 22px 0 0;
    font-size: 1.7rem;
    line-height: 1.5;
    color: var(--sb-text);
}

.sb-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 32px;
    font-size: 1.45rem;
    line-height: 1;
}
.sb-author__avatar {
    display: inline-flex;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--color-gray-lightest);
}
.sb-author__avatar img,
.sb-author__avatar svg { width: 100%; height: 100%; object-fit: cover; }
.sb-author__name { font-weight: 600; color: var(--sb-heading); }
.sb-author__role { color: var(--sb-muted); }
.sb-author__date { color: var(--sb-muted); margin-left: auto; }

/* ---- Body zone: content + sticky TOC -------------------- */
.sb-article-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(260px, 22vw, 340px);
    border-top: 1px solid var(--sb-line);         /* hairline under the header */
    align-items: stretch;
}
.sb-article-body {
    min-width: 0;
    padding: 52px clamp(24px, 4vw, 64px) 72px;
}
.sb-article-body .gh-content {
    max-width: 700px;          /* readable measure; empty space sits to its right */
}
.sb-article-aside--right {
    border-left: 1px solid var(--sb-line);        /* vertical line between content & TOC */
    padding: 52px clamp(20px, 2vw, 32px) 72px;
}
/* the mount must fill the tall rail so the sticky TOC has room to travel */
.sb-toc-mount {
    height: 100%;
}

.kg-image-card .kg-image {
    border-radius: var(--sb-radius-sm);
}

/* inline content links → brand blue */
.gh-content a:not(.kg-btn):not([class*="kg-"]) {
    color: var(--sb-link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color 0.15s ease;
}
.gh-content a:not(.kg-btn):not([class*="kg-"]):hover {
    color: var(--sb-accent);
}

/* headings rhythm */
.gh-content h2 {
    letter-spacing: -0.02em;
    margin-top: 1.6em;
    color: var(--sb-heading);
}

/* branded blockquote */
.gh-content blockquote:not([class]) {
    border-left: 3px solid var(--sb-link);
    padding: 4px 0 4px 24px;
    margin-inline: 0;
    font-style: italic;
    color: var(--sb-accent);
}

/* ============================================================
   Article section menu ("On this page") — built by toc.js
   Lives IN-FLOW inside the right rail and sticks while scrolling;
   bounded by the article so it never covers the header or footer.
   ============================================================ */
.sb-toc {
    position: sticky;
    top: 130px;                 /* matches the scroll cut-off line (toc.js SCROLL_OFFSET) */
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: thin;
}
.sb-toc::-webkit-scrollbar { width: 4px; }
.sb-toc::-webkit-scrollbar-thumb { background: var(--color-gray-light); border-radius: 4px; }

/* section-label style (DESIGN.md): uppercase, gray-dark, no mono */
.sb-toc__label {
    margin: 0 0 16px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--sb-muted);
}

.sb-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sb-toc__item {
    margin: 0;
}
.sb-toc__item.is-sub {
    padding-left: 14px;
}

.sb-toc__link {
    display: block;
    padding: 7px 0 7px 14px;
    font-size: 1.35rem;
    line-height: 1.35;
    color: var(--sb-text);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.sb-toc__link:hover {
    color: var(--sb-accent);
}
.sb-toc__link.is-active {
    color: var(--sb-heading);
    font-weight: 600;
    border-left-color: var(--sb-link);
}

/* ---- Responsive: collapse the TOC rail below 1100px ----- */
@media (max-width: 1099px) {
    .sb-article-main {
        grid-template-columns: minmax(0, 1fr);
    }
    .sb-article-aside--right { display: none; }
    .sb-article-body {
        padding-block: 40px 64px;
    }
    .sb-article-body .gh-content {
        max-width: 720px;
        margin-inline: auto;
    }
}
@media (max-width: 600px) {
    .sb-article-frame { border-inline: 0; }
}

/* floating fallback (only if the mount point is missing) */
.sb-toc--floating {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    right: 40px;
    width: 220px;
}
@media (max-width: 1099px) {
    .sb-toc--floating { display: none; }
}

/* ============================================================
   Footer — give the rounded top corners a soft shadow so the
   white panel reads as lifted above the page (DESIGN.md soft depth).
   prefooter removed → cancel the footer's overlap pull-up.
   ============================================================ */
.landing-footer {
    margin-top: 0 !important;
    box-shadow: 0 -1px 0 var(--sb-line), 0 -12px 32px rgb(8 48 107 / 0.07);
}

/* ============================================================
   "Other readers enjoyed" — inline-title recommendation list
   (Anthropic-style: bold title left, category right, hairlines).
   ============================================================ */
/* spans the full frame-outline width (matches the article frame edges).
   width:100% is required because .sb-related is a flex child of .gh-viewport —
   without it, `margin:0 auto` would shrink-to-fit instead of honoring max-width. */
.sb-related {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 64px 0 96px;
}
@media (max-width: 600px) {
    .sb-related { padding-inline: clamp(20px, 5vw, 32px); }
}
.sb-related__title {
    margin: 0 0 8px;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sb-muted);
}
.sb-related__list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sb-related__item {
    border-bottom: 1px solid var(--sb-line);
}
.sb-related__link {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 24px;
    padding: 26px 4px;
    text-decoration: none;
    transition: padding-left 0.2s ease;
}
.sb-related__link:hover {
    padding-left: 12px;
}
.sb-related__name {
    font-size: clamp(1.9rem, 0.6vw + 1.7rem, 2.3rem);
    font-weight: 650;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--sb-heading);
}
.sb-related__link:hover .sb-related__name {
    color: var(--sb-accent);
}
.sb-related__cat {
    flex-shrink: 0;
    font-size: clamp(1.5rem, 0.4vw + 1.4rem, 1.9rem);
    color: var(--sb-muted);
    white-space: nowrap;
}
@media (max-width: 600px) {
    .sb-related__link { gap: 12px; }
    .sb-related__cat { font-size: 1.3rem; }
}

/* ============================================================
   Newsroom homepage (home.hbs) — masthead + product links,
   large featured tile, hairline list of recent posts.
   ============================================================ */
.sb-news-frame {
    max-width: 1240px;
    margin: 0 auto;
    /* generous top padding so the sticky header pill clears the title */
    padding: 80px clamp(24px, 4vw, 64px) 64px;
}
@media (max-width: 767px) {
    .sb-news-frame { padding-top: 52px; }
}

/* ---- Masthead ---- */
.sb-news-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 500px);
    gap: clamp(32px, 5vw, 88px);
    align-items: start;
    padding-bottom: 26px;
    margin-bottom: 36px;
    border-bottom: 1px solid var(--sb-line);
}
.sb-news-title {
    margin: 0;
    font-size: clamp(3rem, 2.4vw + 1.4rem, 4.6rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--sb-heading);
}
.sb-news-links {
    display: flex;
    flex-direction: column;
}
.sb-news-link {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 24px;
    padding: 9px 0;
    border-top: 1px solid var(--sb-line);
    text-decoration: none;
}
.sb-news-link__label {
    font-size: 1.45rem;
    color: var(--sb-text);
}
.sb-news-link__val {
    flex-shrink: 0;
    font-size: 1.45rem;
    font-weight: 500;
    color: var(--sb-heading);
    white-space: nowrap;
}
.sb-news-link__arr {
    display: inline-block;
    color: var(--sb-muted);
    transition: transform 0.18s ease, color 0.18s ease;
}
.sb-news-link:hover .sb-news-link__val { color: var(--sb-accent); }
.sb-news-link:hover .sb-news-link__arr { transform: translateX(4px); color: var(--sb-accent); }

/* ---- Featured + list grid ---- */
.sb-news-body {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(300px, 1fr);
    gap: clamp(32px, 4vw, 60px);
    align-items: start;
}

/* shared eyebrow: category (bold) + date (muted) */
.sb-news-eyebrow {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 1.3rem;
    line-height: 1.2;
}
.sb-news-eyebrow__cat { font-weight: 600; color: var(--sb-heading); }
.sb-news-eyebrow__date { color: var(--sb-muted); }

/* ---- Featured tile ---- */
.sb-feat { display: block; text-decoration: none; }
.sb-feat__media {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 16px;
    overflow: hidden;
    background: #0E1116;
    isolation: isolate;
}
.sb-feat__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* gradient + film-grain card (from the pricing plan heroes) when no image */
.sb-feat__media--logo {
    display: grid;
    place-items: center;
    background:
        radial-gradient(120% 130% at 85% 78%, #F0723A 0%, rgba(240, 114, 58, 0) 48%),
        radial-gradient(120% 120% at 22% 28%, #3E7BE6 0%, rgba(62, 123, 230, 0) 52%),
        linear-gradient(150deg, #08306B 0%, #1A56DB 52%, #5B43C9 100%);
}
.sb-feat__media--logo::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 160px 160px;
    opacity: 0.5;
    mix-blend-mode: overlay;
    pointer-events: none;
}
.sb-feat__logo {
    position: relative;
    z-index: 1;
    width: 19%;
    max-width: 132px;
    height: auto;
    object-fit: contain;
}
.sb-feat__body { margin-top: 18px; }
.sb-feat__title {
    margin: 11px 0 0;
    font-size: clamp(2.2rem, 1vw + 1.8rem, 3rem);
    font-weight: 700;
    line-height: 1.14;
    letter-spacing: -0.02em;
    color: var(--sb-heading);
    transition: color 0.15s ease;
}
.sb-feat:hover .sb-feat__title { color: var(--sb-accent); }
.sb-feat__excerpt {
    margin: 10px 0 0;
    max-width: 62ch;
    font-size: 1.55rem;
    line-height: 1.5;
    color: var(--sb-text);
}

/* ---- Recent list (right) ---- */
.sb-news-list { display: flex; flex-direction: column; }
.sb-newsrow {
    display: block;
    text-decoration: none;
    padding: 16px 0;
    border-top: 1px solid var(--sb-line);
}
.sb-newsrow:first-child { border-top: 0; padding-top: 0; }
.sb-newsrow__title {
    margin: 7px 0 0;
    font-size: 1.7rem;
    font-weight: 650;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--sb-heading);
    transition: color 0.15s ease;
}
.sb-newsrow:hover .sb-newsrow__title { color: var(--sb-accent); }
.sb-newsrow__excerpt {
    display: -webkit-box;
    overflow: hidden;
    margin: 6px 0 0;
    font-size: 1.4rem;
    line-height: 1.45;
    color: var(--sb-text);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ---- See all ---- */
.sb-news-more {
    margin-top: 44px;
    padding-top: 24px;
    border-top: 1px solid var(--sb-line);
}
.sb-news-more a {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--sb-heading);
    text-decoration: none;
}
.sb-news-more a:hover { color: var(--sb-accent); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .sb-news-head { grid-template-columns: minmax(0, 1fr); gap: 32px; }
    .sb-news-body { grid-template-columns: minmax(0, 1fr); gap: 48px; }
    .sb-feat__media { aspect-ratio: 16 / 10; }
}
