/* ============================================================================
   Rubber Bands — Ghost theme
   Ported from the rubberbands.app design system (theme.ts / sections.css).
   Pure black page, dark surface ramp, Poppins display type, and the three
   brand accents rotating through cards and section chrome.
   ========================================================================= */

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
    /* Surface ramp (dark tuple, index 0 lightest to 9 darkest) */
    --rb-surface-sunken: #0c0d0f;
    --rb-surface: #17181b;
    --rb-surface-raised: #212225;
    --rb-surface-control: #2e3135;

    --rb-text: #ffffff;
    --rb-text-secondary: #c7cbd1;
    --rb-text-tertiary: #7c7c82;

    --rb-border: rgba(255, 255, 255, 0.08);
    --rb-border-strong: rgba(255, 255, 255, 0.14);
    --rb-border-strongest: rgba(255, 255, 255, 0.24);

    /* Brand accents, seeded from the logo bars */
    --rb-accent-pink: #ff008d;
    --rb-accent-orange: #ff8800;
    --rb-accent-green: #00ff2e;
    --rb-accent-aqua: #19acd1;
    --rb-idle: #98989e;

    --rb-gradient-brand: linear-gradient(90deg, #ff008d 0%, #ff8800 50%, #00ff2e 100%);

    /* Type */
    --rb-font-body: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
        "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif,
        "Apple Color Emoji";
    --rb-font-display: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, sans-serif;
    --rb-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco,
        Consolas, monospace;

    --rb-tracking-tight: -0.03em;
    --rb-tracking-snug: -0.02em;
    --rb-ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);

    /* Layout */
    --rb-content-width: 1120px;
    --rb-prose-width: 680px;

    /* Spacing: 4 / 8 / 16 / 24 / 32 / 48 / 64 / 96 / 160 */
    --sp-3xs: 4px;
    --sp-2xs: 8px;
    --sp-sm: 16px;
    --sp-md: 24px;
    --sp-lg: 32px;
    --sp-xl: 48px;
    --sp-2xl: 64px;
    --sp-3xl: 96px;
    --sp-4xl: 160px;

    /* Radius: 16 and 24. Never pill, except .btn. */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;

    /* Ghost accent var fallback */
    --ghost-accent-color: #ff008d;
}

/* ── Reset and base ─────────────────────────────────────────────────────── */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background-color: #000000;
    color: var(--rb-text);
    font-family: var(--gh-font-body, var(--rb-font-body));
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: rgba(255, 0, 141, 0.3);
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--rb-accent-pink);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--gh-font-heading, var(--rb-font-display));
    font-weight: 700;
    letter-spacing: var(--rb-tracking-snug);
    text-wrap: balance;
    margin: 0;
}

/* ── Layout primitives ──────────────────────────────────────────────────── */

.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-main {
    flex-grow: 1;
}

.container {
    max-width: var(--rb-content-width);
    margin: 0 auto;
    padding: 0 var(--sp-md);
}

.container-prose {
    max-width: calc(var(--rb-prose-width) + var(--sp-3xl));
}

.section {
    position: relative;
    padding: var(--sp-3xl) 0;
    overflow-x: clip;
}

.section-tight {
    padding: var(--sp-2xl) 0;
}

/* ── Kicker ─────────────────────────────────────────────────────────────── */

.kicker {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: var(--sp-sm);
    color: var(--rb-idle);
    text-decoration: none;
}
a.kicker:hover {
    text-decoration: none;
    filter: brightness(1.2);
}
.kicker-pink { color: var(--rb-accent-pink); }
.kicker-orange { color: var(--rb-accent-orange); }
.kicker-green { color: var(--rb-accent-green); }
.kicker-aqua { color: var(--rb-accent-aqua); }

.lede {
    color: var(--rb-text-secondary);
    font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
    line-height: 1.55;
    max-width: 52ch;
    margin: var(--sp-md) 0 0;
}

/* ── Glow ───────────────────────────────────────────────────────────────── */

.glow {
    position: absolute;
    width: min(70vw, 900px);
    aspect-ratio: 1;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
}
.glow-pink {
    background: radial-gradient(circle, rgba(255, 0, 141, 0.3) 0%, transparent 62%);
}
.glow-green {
    background: radial-gradient(circle, rgba(0, 255, 46, 0.22) 0%, transparent 62%);
}
.glow-orange {
    background: radial-gradient(circle, rgba(255, 136, 0, 0.26) 0%, transparent 62%);
}
.glow-aqua {
    background: radial-gradient(circle, rgba(25, 172, 209, 0.28) 0%, transparent 62%);
}
.glow-header {
    opacity: 0.5;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 999px;
    font-family: var(--gh-font-body, var(--rb-font-body));
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    transition: transform 0.2s var(--rb-ease-out-expo), background-color 0.15s ease,
        border-color 0.15s ease;
    cursor: pointer;
}
.btn:hover {
    text-decoration: none;
    transform: translateY(-2px);
}
.btn-primary {
    background: var(--rb-accent-pink);
    color: #ffffff;
}
.btn-primary:hover {
    background: #e60081;
}
.btn-ghost {
    background: var(--rb-surface);
    color: var(--rb-text);
    border-color: var(--rb-border-strong);
}
.btn-ghost:hover {
    border-color: var(--rb-border-strongest);
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.75);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--rb-border);
}

.site-header-inner {
    max-width: var(--rb-content-width);
    margin: 0 auto;
    padding: 0 var(--sp-md);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-md);
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2xs);
    color: var(--rb-text);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: var(--rb-tracking-snug);
    text-decoration: none;
}
.site-brand:hover {
    text-decoration: none;
}

.site-brand-logo {
    width: 32px;
    height: 32px;
    display: block;
}

.site-brand-name {
    font-family: var(--gh-font-heading, var(--rb-font-display));
    font-weight: 700;
}

/* Ghost {{navigation}} outputs ul.nav > li > a */
.site-nav .nav {
    display: flex;
    align-items: center;
    gap: var(--sp-2xs);
    list-style: none;
    margin: 0;
    padding: 0;
}
.site-nav .nav a {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--rb-text-secondary);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}
.site-nav .nav a:hover {
    color: var(--rb-text);
    background: rgba(255, 255, 255, 0.06);
}
.site-nav .nav-current a {
    color: var(--rb-text);
}

/* Mobile nav */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: none;
    border: 1px solid var(--rb-border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    height: 2px;
    background: var(--rb-text);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.mobile-nav {
    display: none;
    border-top: 1px solid var(--rb-border);
    padding: var(--sp-sm) var(--sp-md) var(--sp-md);
}
.mobile-nav.is-open {
    display: block;
}
.mobile-nav .nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-3xs);
}
.mobile-nav .nav a {
    display: block;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--rb-text-secondary);
    text-decoration: none;
    font-size: 16px;
}
.mobile-nav .nav a:hover {
    color: var(--rb-text);
    background: rgba(255, 255, 255, 0.06);
}

/* ── Hero / archive headers ─────────────────────────────────────────────── */

.hero {
    padding: var(--sp-3xl) 0 var(--sp-xl);
}

.hero-inner {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: clamp(2.75rem, 8vw, 6rem);
    line-height: 1.05;
    letter-spacing: var(--rb-tracking-tight);
}

.archive-header {
    padding: var(--sp-2xl) 0 var(--sp-md);
}

.archive-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.08;
    letter-spacing: var(--rb-tracking-tight);
}

.author-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: var(--sp-md);
}

.author-header-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 1px solid var(--rb-border-strong);
    object-fit: cover;
}

/* ── Post grid and cards ────────────────────────────────────────────────── */

.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-md);
}

.post-card {
    position: relative;
    --rb-card-accent: var(--rb-idle);
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--rb-card-accent) 7%, var(--rb-surface)) 0%,
        var(--rb-surface-sunken) 100%
    );
    border: 1px solid var(--rb-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: 100%;
    transition: transform 0.25s var(--rb-ease-out-expo), border-color 0.15s ease;
}
.post-card:hover {
    transform: translateY(-4px);
    border-color: var(--rb-border-strong);
}

/* Accent hairline fading out at both ends */
.post-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    z-index: 1;
    background: linear-gradient(
        90deg,
        transparent,
        color-mix(in srgb, var(--rb-card-accent) 55%, transparent),
        transparent
    );
}

/* The accent rotation that keeps the grid from reading as one slab */
.post-grid > .post-card:nth-child(4n + 1) { --rb-card-accent: var(--rb-accent-pink); }
.post-grid > .post-card:nth-child(4n + 2) { --rb-card-accent: var(--rb-accent-orange); }
.post-grid > .post-card:nth-child(4n + 3) { --rb-card-accent: var(--rb-accent-green); }
.post-grid > .post-card:nth-child(4n + 4) { --rb-card-accent: var(--rb-accent-aqua); }

.post-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}
.post-card-link:hover {
    text-decoration: none;
}

.post-card-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--rb-surface-raised);
}
.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--rb-ease-out-expo);
}
.post-card:hover .post-card-image img {
    transform: scale(1.03);
}

.post-card-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: var(--sp-md);
}

.post-card-body .kicker {
    color: var(--rb-card-accent);
    font-size: 12px;
    margin-bottom: var(--sp-2xs);
}

.post-card-title {
    font-size: 20px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--rb-text);
}

.post-card-excerpt {
    margin: var(--sp-2xs) 0 0;
    color: var(--rb-text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: var(--sp-2xs);
    margin-top: auto;
    padding-top: var(--sp-sm);
    color: var(--rb-text-tertiary);
    font-size: 12px;
}

.meta-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--rb-text-tertiary);
}

/* ── Pagination (Ghost {{pagination}} helper) ───────────────────────────── */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--sp-xl);
    color: var(--rb-text-tertiary);
    font-size: 14px;
}
.pagination a {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 999px;
    background: var(--rb-surface);
    border: 1px solid var(--rb-border-strong);
    color: var(--rb-text);
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.2s ease;
}
.pagination a:hover {
    border-color: var(--rb-border-strongest);
    transform: translateY(-2px);
}

/* ── Article ────────────────────────────────────────────────────────────── */

.article-header {
    padding: var(--sp-2xl) 0 var(--sp-lg);
}

.article-header .container-prose {
    position: relative;
    z-index: 1;
}

.article-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.08;
    letter-spacing: var(--rb-tracking-tight);
}

.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--sp-2xs);
    margin-top: var(--sp-md);
    color: var(--rb-text-tertiary);
    font-size: 14px;
}

.article-meta-author {
    color: var(--rb-text-secondary);
    font-weight: 600;
    text-decoration: none;
}
.article-meta-author:hover {
    color: var(--rb-text);
    text-decoration: none;
}

.author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--rb-border-strong);
    object-fit: cover;
}

.article-feature-image {
    margin: 0 auto var(--sp-xl);
}
.article-feature-image img {
    width: 100%;
    border-radius: var(--radius-lg);
    border: 1px solid var(--rb-border);
}
.article-feature-image figcaption {
    margin-top: var(--sp-2xs);
    text-align: center;
    color: var(--rb-text-tertiary);
    font-size: 13px;
}

.article-footer {
    margin-top: var(--sp-xl);
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2xs);
}

.tag-pill {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--rb-surface);
    border: 1px solid var(--rb-border-strong);
    color: var(--rb-text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.tag-pill:hover {
    color: var(--rb-text);
    border-color: var(--rb-border-strongest);
    text-decoration: none;
}

/* ── Post content (Koenig canvas) ───────────────────────────────────────── */

.gh-canvas {
    display: grid;
    grid-template-columns:
        [full-start] minmax(var(--sp-md), 1fr)
        [wide-start] minmax(0, calc((var(--rb-content-width) - var(--rb-prose-width)) / 2))
        [main-start] min(calc(100% - var(--sp-md) * 2), var(--rb-prose-width)) [main-end]
        minmax(0, calc((var(--rb-content-width) - var(--rb-prose-width)) / 2)) [wide-end]
        minmax(var(--sp-md), 1fr) [full-end];
}

.gh-canvas > * {
    grid-column: main-start / main-end;
}

.gh-canvas > .kg-width-wide {
    grid-column: wide-start / wide-end;
}

.gh-canvas > .kg-width-full {
    grid-column: full-start / full-end;
}

.gh-content {
    font-size: clamp(1.0625rem, 1.5vw, 1.1875rem);
    line-height: 1.7;
    color: var(--rb-text-secondary);
}

.gh-content > * + * {
    margin-top: var(--sp-md);
}

.gh-content h2,
.gh-content h3,
.gh-content h4 {
    color: var(--rb-text);
    margin-top: var(--sp-xl);
}
.gh-content h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    line-height: 1.15;
}
.gh-content h3 {
    font-size: clamp(1.25rem, 2.5vw, 1.625rem);
    line-height: 1.25;
    font-weight: 600;
}
.gh-content h4 {
    font-size: 20px;
    line-height: 1.3;
    font-weight: 600;
}

.gh-content strong {
    color: var(--rb-text);
}

.gh-content a {
    color: #ff5cad;
    text-decoration: none;
}
.gh-content a:hover {
    text-decoration: underline;
}

.gh-content hr {
    border: 0;
    height: 1px;
    background: var(--rb-border-strong);
    margin: var(--sp-xl) 0;
}

.gh-content blockquote {
    margin: var(--sp-lg) 0;
    padding-left: var(--sp-md);
    border-left: 3px solid var(--rb-accent-pink);
    color: var(--rb-text);
    font-size: 1.15em;
}

.gh-content blockquote.kg-blockquote-alt {
    border: 0;
    padding: 0;
    text-align: center;
    font-family: var(--gh-font-heading, var(--rb-font-display));
    font-weight: 600;
    font-size: 1.4em;
    line-height: 1.4;
}

.gh-content ul,
.gh-content ol {
    padding-left: 1.4em;
}
.gh-content li + li {
    margin-top: var(--sp-2xs);
}
.gh-content li::marker {
    color: var(--rb-accent-pink);
}

.gh-content code {
    font-family: var(--rb-font-mono);
    font-size: 0.85em;
    background: var(--rb-surface-raised);
    border: 1px solid var(--rb-border);
    border-radius: 6px;
    padding: 0.15em 0.4em;
    color: var(--rb-text);
}

.gh-content pre {
    background: var(--rb-surface-sunken);
    border: 1px solid var(--rb-border);
    border-radius: var(--radius-md);
    padding: var(--sp-md);
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.6;
}
.gh-content pre code {
    background: none;
    border: 0;
    padding: 0;
    color: var(--rb-text-secondary);
}

.gh-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}
.gh-content th,
.gh-content td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--rb-border);
    text-align: left;
}
.gh-content th {
    color: var(--rb-text);
    font-weight: 600;
}

/* Images and figures */
.gh-content img {
    border-radius: var(--radius-md);
}
.gh-content .kg-width-full img {
    border-radius: 0;
}

.gh-content figure {
    margin: var(--sp-lg) 0;
}
.gh-content figcaption {
    margin-top: var(--sp-2xs);
    text-align: center;
    color: var(--rb-text-tertiary);
    font-size: 13px;
}

/* Galleries */
.kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2xs);
}
.kg-gallery-row {
    display: flex;
    gap: var(--sp-2xs);
}
.kg-gallery-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Bookmark card */
.kg-bookmark-card {
    width: 100%;
}
.kg-bookmark-container {
    display: flex;
    background: var(--rb-surface);
    border: 1px solid var(--rb-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    color: var(--rb-text);
    text-decoration: none;
    transition: border-color 0.15s ease;
}
.kg-bookmark-container:hover {
    border-color: var(--rb-border-strongest);
    text-decoration: none;
}
.kg-bookmark-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: var(--sp-sm) var(--sp-md);
}
.kg-bookmark-title {
    font-weight: 600;
    font-size: 15px;
}
.kg-bookmark-description {
    margin-top: 4px;
    color: var(--rb-text-tertiary);
    font-size: 13px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: var(--sp-2xs);
    font-size: 13px;
    color: var(--rb-text-tertiary);
}
.kg-bookmark-icon {
    width: 18px;
    height: 18px;
    border-radius: 3px;
}
.kg-bookmark-thumbnail {
    position: relative;
    flex-shrink: 0;
    min-width: 33%;
    max-height: 100%;
}
.kg-bookmark-thumbnail img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}

/* Callout card */
.kg-callout-card {
    display: flex;
    gap: var(--sp-2xs);
    padding: var(--sp-sm) var(--sp-md);
    border-radius: var(--radius-md);
    background: var(--rb-surface);
    border: 1px solid var(--rb-border);
}
.kg-callout-card-accent {
    background: color-mix(in srgb, var(--rb-accent-pink) 10%, var(--rb-surface));
    border-color: color-mix(in srgb, var(--rb-accent-pink) 30%, transparent);
}
.kg-callout-emoji {
    font-size: 1.15em;
}
.kg-callout-text {
    color: var(--rb-text-secondary);
}

/* Button card */
.kg-button-card {
    display: flex;
}
.kg-button-card.kg-align-center {
    justify-content: center;
}
.kg-btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 28px;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s var(--rb-ease-out-expo);
}
.kg-btn:hover {
    transform: translateY(-2px);
    text-decoration: none;
}
.kg-btn-accent {
    background: var(--rb-accent-pink);
    color: #ffffff;
}

/* Toggle card */
.kg-toggle-card {
    background: var(--rb-surface);
    border: 1px solid var(--rb-border);
    border-radius: var(--radius-md);
    padding: var(--sp-sm) var(--sp-md);
}
.kg-toggle-heading-text {
    color: var(--rb-text);
    font-weight: 600;
}

/* Embeds */
.kg-embed-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.kg-embed-card iframe {
    max-width: 100%;
    border-radius: var(--radius-md);
}

/* Header card */
.kg-header-card {
    padding: var(--sp-2xl) var(--sp-md);
    border-radius: var(--radius-lg);
}

/* File card */
.kg-file-card-container {
    display: flex;
    align-items: center;
    background: var(--rb-surface);
    border: 1px solid var(--rb-border);
    border-radius: var(--radius-md);
    padding: var(--sp-sm) var(--sp-md);
    color: var(--rb-text);
    text-decoration: none;
}

/* Video / audio */
.kg-video-card video,
.kg-audio-card {
    width: 100%;
    border-radius: var(--radius-md);
}

/* ── Post CTA ───────────────────────────────────────────────────────────── */

.post-cta {
    padding: var(--sp-2xl) 0 0;
}

.cta-card {
    position: relative;
    text-align: center;
    padding: var(--sp-xl) var(--sp-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--rb-border);
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--rb-accent-pink) 7%, var(--rb-surface)) 0%,
        var(--rb-surface-sunken) 100%
    );
    overflow: hidden;
}
.cta-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--rb-gradient-brand);
    opacity: 0.7;
}

.cta-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    line-height: 1.15;
}

.cta-copy {
    margin: var(--sp-sm) auto 0;
    max-width: 44ch;
    color: var(--rb-text-secondary);
}

.cta-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--sp-sm);
    margin-top: var(--sp-md);
}

/* ── Error page ─────────────────────────────────────────────────────────── */

.error-page {
    text-align: center;
    padding: var(--sp-3xl) 0;
}
.error-page .lede {
    margin-left: auto;
    margin-right: auto;
}
.error-page .cta-buttons {
    margin-top: var(--sp-lg);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */

.site-footer {
    position: relative;
    margin-top: var(--sp-3xl);
    padding: var(--sp-2xl) 0 var(--sp-lg);
    background: linear-gradient(180deg, transparent, rgba(255, 0, 141, 0.05));
}
/* Brand-gradient hairline across the top — the footer's one loud note */
.site-footer::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--rb-gradient-brand);
    opacity: 0.7;
}

.site-footer-inner {
    max-width: var(--rb-content-width);
    margin: 0 auto;
    padding: 0 var(--sp-md);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
    gap: var(--sp-xl);
}

.footer-tag {
    margin: var(--sp-sm) 0 0;
    color: var(--rb-text-secondary);
    max-width: 26ch;
}

.footer-col h4 {
    margin: 0 0 var(--sp-sm);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rb-text-tertiary);
}
.footer-col a {
    display: block;
    color: var(--rb-text-secondary);
    text-decoration: none;
    padding: 5px 0;
    font-size: 14px;
    transition: color 0.15s ease;
}
.footer-col a:hover {
    color: var(--rb-text);
}
.footer-col .nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-legal {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2xs);
    margin-top: var(--sp-2xl);
    padding-top: var(--sp-md);
    border-top: 1px solid var(--rb-border);
    color: var(--rb-text-secondary);
    font-size: 14px;
}
.footer-ghost a {
    color: var(--rb-text-tertiary);
    text-decoration: none;
}
.footer-ghost a:hover {
    color: var(--rb-text-secondary);
}

/* ── Ghost portal / misc ────────────────────────────────────────────────── */

.gh-post-upgrade-cta,
.gh-post-upgrade-cta-content {
    border-radius: var(--radius-lg);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1000px) {
    .post-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
    .footer-brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .site-nav {
        display: none;
    }
    .nav-toggle {
        display: flex;
    }
    .section {
        padding: var(--sp-2xl) 0;
    }
    .hero {
        padding: var(--sp-2xl) 0 var(--sp-lg);
    }
}

@media (max-width: 640px) {
    .post-grid {
        grid-template-columns: 1fr;
    }
    .author-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .cta-buttons .btn {
        width: 100%;
    }
}

/* color-mix fallback for older browsers */
@supports not (background: color-mix(in srgb, red 7%, black)) {
    .post-card,
    .cta-card {
        background: var(--rb-surface);
    }
    .kg-callout-card-accent {
        background: var(--rb-surface);
        border-color: var(--rb-border-strong);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
    html {
        scroll-behavior: auto;
    }
}
