/* ============================================================
   Kinetic — Ghost theme
   Tokens lifted verbatim from MarketingSite/index.html :root
   so blog and marketing site stay visually identical.
   ============================================================ */

:root {
    --black: #000;
    --surface: #0e0e0e;
    --surface-low: #131313;
    --surface-mid: #1a1a1a;
    --surface-high: #262626;
    --lime: #ccff00;
    --lime-text: #334000;
    --cyan: #00e3fd;
    --crimson: #e60073;
    --white: #fff;
    --muted: #adaaaa;
    --border: #484847;
    --shadow-lime: 0 0 34px rgba(204, 255, 0, 0.24);
    --max: 1180px;

    --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "SF Mono", Menlo, Consolas, monospace;

    /* Ghost font picker (Admin → Settings → Branding → Fonts) lets a site
       admin override these. Defaults match the Kinetic brand. */
    --gh-font-heading: var(--font-display);
    --gh-font-body: var(--font-display);

    --h1-size: clamp(3.2rem, 8vw, 7.4rem);
    --h2-size: clamp(2.2rem, 5vw, 4.6rem);
    --h3-size: clamp(1.5rem, 3vw, 2.2rem);
    --section-pad: clamp(70px, 9vw, 124px);

    --shell: min(100% - 40px, var(--max));
}

@font-face {
    font-family: "Space Grotesk";
    src: url("../fonts/SpaceGrotesk-Variable.ttf") format("truetype-variations"),
         url("../fonts/SpaceGrotesk-Variable.ttf") format("truetype");
    font-weight: 300 700;
    font-display: swap;
    font-style: normal;
}

/* ---------- Reset ---------- */

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

html {
    scroll-behavior: smooth;
    background: var(--black);
}

body {
    margin: 0;
    color: var(--white);
    background:
        radial-gradient(circle at 78% 18%, rgba(0, 227, 253, 0.16), transparent 26rem),
        linear-gradient(180deg, #050505 0%, var(--black) 38%, #080808 100%);
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img, video, svg { max-width: 100%; height: auto; display: block; }

a { color: var(--lime); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font: inherit; cursor: pointer; }

/* ---------- Typography ---------- */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1;
    margin: 0 0 0.4em;
    color: var(--white);
    letter-spacing: -0.01em;
}

h1 { font-size: var(--h1-size); line-height: 0.86; letter-spacing: -0.02em; }
h2 { font-size: var(--h2-size); line-height: 0.95; }
h3 { font-size: var(--h3-size); line-height: 1.1; }
h4 { font-size: 1.25rem; line-height: 1.2; }

p { margin: 0 0 1.2em; }

.kicker {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--lime);
    margin-bottom: 1.2em;
}

.lede {
    font-size: clamp(1.06rem, 2vw, 1.3rem);
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.76);
}

.mono {
    font-family: var(--font-mono);
    font-feature-settings: "tnum" 1;
}

/* ---------- Layout ---------- */

.shell { width: var(--shell); margin: 0 auto; }

.section {
    padding: var(--section-pad) 0;
}

.section--narrow { max-width: 720px; margin: 0 auto; }

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(5, 5, 5, 0.85);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--white);
    font-weight: 700;
    letter-spacing: 0.04em;
    font-size: 1.05rem;
}

.brand:hover { text-decoration: none; }

.brand__mark {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
}

.nav { display: flex; align-items: center; gap: 28px; }
.nav a { color: rgba(255, 255, 255, 0.78); font-size: 0.95rem; font-weight: 500; }
.nav a:hover { color: var(--white); text-decoration: none; }

@media (max-width: 720px) {
    .nav { gap: 16px; }
    .nav a:not(.btn-primary):not(.btn-secondary) { display: none; }
}

/* ---------- Buttons ---------- */

.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 22px;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    border: 0;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-primary {
    color: var(--lime-text);
    background: var(--lime);
    background-image: linear-gradient(135deg, #f3ffca, var(--lime));
    box-shadow: var(--shadow-lime);
}

.btn-primary:hover { transform: translateY(-1px); text-decoration: none; }

.btn-secondary {
    color: var(--white);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); text-decoration: none; }

/* ---------- Hero (front page) ---------- */

.hero {
    padding: clamp(80px, 12vw, 160px) 0 clamp(60px, 8vw, 120px);
}

.hero__lede { max-width: 640px; margin-top: 1.4em; }

/* ---------- Post grid ---------- */

.post-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px;
    padding-bottom: var(--section-pad);
}

.post-grid__feature { grid-column: 1 / -1; }

@media (max-width: 720px) {
    .post-grid { grid-template-columns: 1fr; gap: 24px; }
}

/* ---------- Post card ---------- */

.post-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.post-card:hover {
    border-color: rgba(204, 255, 0, 0.3);
    transform: translateY(-2px);
    text-decoration: none;
}

.post-card__image {
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface-mid);
}

.post-card__image img { width: 100%; height: 100%; object-fit: cover; }

.post-card__body { display: flex; flex-direction: column; gap: 10px; }

.post-card__kicker {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--lime);
}

.post-card__title {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--white);
    margin: 0;
}

.post-card__excerpt {
    font-size: 0.95rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.66);
    margin: 0;
}

.post-card__meta {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 0.78rem;
    color: var(--muted);
    font-family: var(--font-mono);
    margin-top: auto;
}

.post-card--feature .post-card__title {
    font-size: clamp(1.6rem, 3.5vw, 2.6rem);
    line-height: 1.05;
}

.post-card--feature .post-card__image {
    aspect-ratio: 21 / 9;
}

@media (min-width: 900px) {
    .post-card--feature {
        display: grid;
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
        gap: 32px;
        align-items: center;
        padding: 32px;
    }

    .post-card--feature .post-card__image { aspect-ratio: 4 / 3; margin: 0; }
}

/* ---------- Pagination ---------- */

.pagination {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 24px 0 var(--section-pad);
}

.pagination a {
    min-height: 46px;
    padding: 0 22px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: var(--white);
    display: inline-flex;
    align-items: center;
    font-size: 0.86rem;
    font-weight: 600;
}

.pagination a:hover { border-color: var(--lime); color: var(--lime); text-decoration: none; }

.pagination__page {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    align-self: center;
}

/* ---------- Single post ---------- */

.article {
    padding: clamp(40px, 6vw, 80px) 0 var(--section-pad);
}

.article__hero { max-width: 1100px; margin: 0 auto 40px; }

.article__feature-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 40px;
}

.article__header {
    max-width: 720px;
    margin: 0 auto;
    text-align: left;
}

.article__title {
    font-size: clamp(2.4rem, 6vw, 4.4rem);
    line-height: 1;
    margin-bottom: 0.5em;
}

.article__byline {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin-bottom: 1em;
}

.article__byline .author { color: var(--white); font-family: var(--font-display); font-weight: 600; }
.article__byline .read-time { color: var(--cyan); }

.article__content { max-width: 720px; margin: 0 auto; font-size: 1.075rem; line-height: 1.7; color: rgba(255, 255, 255, 0.88); }

/* ---------- Prose styles for Ghost-rendered HTML ---------- */

.article__content > * + * { margin-top: 1.4em; }
.article__content h2 { font-size: 2rem; margin-top: 2em; line-height: 1.1; }
.article__content h3 { font-size: 1.4rem; margin-top: 1.6em; line-height: 1.2; }
.article__content h4 { font-size: 1.15rem; margin-top: 1.4em; }

.article__content a { color: var(--lime); border-bottom: 1px solid rgba(204, 255, 0, 0.4); }
.article__content a:hover { border-bottom-color: var(--lime); text-decoration: none; }

.article__content blockquote {
    margin: 1.6em 0;
    padding: 0.4em 0 0.4em 1.2em;
    border-left: 2px solid var(--lime);
    font-size: 1.2rem;
    color: var(--white);
    font-style: normal;
}

.article__content code {
    font-family: var(--font-mono);
    font-size: 0.92em;
    padding: 0.15em 0.4em;
    background: var(--surface-mid);
    border-radius: 4px;
    color: var(--cyan);
}

.article__content pre {
    background: var(--surface-low);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 18px 20px;
    overflow-x: auto;
    font-size: 0.92rem;
    line-height: 1.6;
}

.article__content pre code { background: none; padding: 0; color: var(--white); }

.article__content ul, .article__content ol { padding-left: 1.4em; }
.article__content li { margin: 0.4em 0; }

.article__content hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2.4em 0;
}

.article__content img {
    border-radius: 8px;
    margin: 0.6em auto;
}

/* Ghost Koenig (kg-*) cards */

.kg-image-card, .kg-gallery-card, .kg-embed-card, .kg-bookmark-card,
.kg-callout-card, .kg-toggle-card, .kg-button-card, .kg-product-card,
.kg-video-card, .kg-audio-card, .kg-file-card {
    margin: 1.8em 0;
}

.kg-width-wide { max-width: 1040px; margin-left: -160px; margin-right: -160px; }
.kg-width-full { width: 100vw; max-width: 100vw; margin-left: calc(-50vw + 50%); margin-right: calc(-50vw + 50%); }

@media (max-width: 1080px) {
    .kg-width-wide, .kg-width-full { max-width: 100%; margin-left: 0; margin-right: 0; }
}

.kg-callout-card {
    padding: 24px;
    border-radius: 8px;
    border: 1px solid rgba(204, 255, 0, 0.18);
    background: rgba(204, 255, 0, 0.04);
    display: flex;
    gap: 16px;
}

.kg-callout-emoji { font-size: 1.5rem; line-height: 1.2; }
.kg-callout-text { flex: 1; }

.kg-bookmark-card a, .kg-bookmark-container {
    display: flex;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    overflow: hidden;
    color: var(--white);
    text-decoration: none;
}

.kg-bookmark-content { flex: 1; padding: 20px; }
.kg-bookmark-title { font-weight: 700; margin-bottom: 6px; }
.kg-bookmark-description { color: var(--muted); font-size: 0.9rem; margin-bottom: 10px; }
.kg-bookmark-metadata { display: flex; gap: 10px; font-size: 0.78rem; color: var(--muted); align-items: center; }
.kg-bookmark-thumbnail img { width: 200px; height: 100%; object-fit: cover; }
.kg-bookmark-icon { width: 18px; height: 18px; flex-shrink: 0; }
.kg-bookmark-author { color: var(--white); font-weight: 600; }
.kg-bookmark-publisher { color: var(--muted); }

@media (max-width: 720px) {
    .kg-bookmark-card a, .kg-bookmark-container { flex-direction: column; }
    .kg-bookmark-thumbnail img { width: 100%; height: 200px; }
}

.kg-button-card a { /* match .btn-primary */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 22px;
    border-radius: 999px;
    color: var(--lime-text);
    background: var(--lime);
    background-image: linear-gradient(135deg, #f3ffca, var(--lime));
    box-shadow: var(--shadow-lime);
    font-weight: 700;
    text-decoration: none;
}

figcaption {
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 0.8em;
}

/* ---------- Article footer ---------- */

.article__footer {
    max-width: 720px;
    margin: 60px auto 0;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.article__tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 32px; }
.article__tags a {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.article__tags a:hover { border-color: var(--lime); color: var(--lime); text-decoration: none; }

.author-card {
    display: flex;
    gap: 18px;
    align-items: center;
    padding: 24px;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
}
.author-card__avatar { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--surface-mid); }
.author-card__avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-card__name { font-weight: 700; font-size: 1.05rem; }
.author-card__bio { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }

/* ---------- Related posts ---------- */

.related {
    padding: var(--section-pad) 0 0;
}
.related__heading {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--lime);
    margin-bottom: 1.4em;
}

/* ---------- Newsletter CTA ---------- */

.newsletter-cta {
    margin: var(--section-pad) 0;
    padding: clamp(48px, 7vw, 80px);
    border-radius: 16px;
    background: #060606;
    border: 1px solid rgba(204, 255, 0, 0.12);
    text-align: center;
}

.newsletter-cta h2 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    margin-bottom: 0.4em;
}

.newsletter-cta p {
    color: rgba(255, 255, 255, 0.72);
    max-width: 520px;
    margin: 0 auto 2em;
}

/* ---------- Tag / author header ---------- */

.archive-header {
    padding: clamp(60px, 8vw, 100px) 0 clamp(40px, 6vw, 60px);
    text-align: left;
}
.archive-header h1 { margin-bottom: 0.4em; }
.archive-header .lede { max-width: 640px; }
.archive-header .count { font-family: var(--font-mono); color: var(--muted); font-size: 0.85rem; margin-top: 1.2em; display: block; }

.author-header {
    display: flex;
    gap: 24px;
    align-items: center;
    padding: clamp(60px, 8vw, 100px) 0;
}
.author-header__avatar { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--surface-mid); }
.author-header__avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-header__social { display: flex; gap: 12px; margin-top: 12px; }
.author-header__social a { color: var(--muted); font-size: 0.85rem; }
.author-header__social a:hover { color: var(--lime); text-decoration: none; }

/* ---------- Error page ---------- */

.error-page {
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
}

.error-page__mark { width: 96px; height: 96px; margin-bottom: 24px; opacity: 0.85; }
.error-page__code { font-family: var(--font-mono); color: var(--cyan); font-size: 1rem; letter-spacing: 0.18em; margin-bottom: 1em; }
.error-page h1 { font-size: clamp(2.4rem, 6vw, 4rem); margin-bottom: 0.4em; }
.error-page p { color: var(--muted); max-width: 420px; margin-bottom: 2em; }

/* ---------- Footer ---------- */

.site-footer {
    padding: clamp(60px, 8vw, 100px) 0 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: var(--black);
}

.site-footer__inner {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 40px;
    align-items: start;
}

.site-footer__brand { display: flex; flex-direction: column; gap: 16px; }
.site-footer__brand .brand { font-size: 1.1rem; }
.site-footer__tagline { color: var(--muted); font-size: 0.9rem; max-width: 280px; line-height: 1.5; }

.site-footer__col h4 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--muted);
    margin-bottom: 1em;
    font-weight: 700;
}
.site-footer__col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.site-footer__col a { color: rgba(255, 255, 255, 0.78); font-size: 0.9rem; }
.site-footer__col a:hover { color: var(--lime); text-decoration: none; }

.site-footer__legal {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--muted);
    font-size: 0.82rem;
}

@media (max-width: 720px) {
    .site-footer__inner { grid-template-columns: 1fr; gap: 32px; }
    .site-footer__legal { flex-direction: column; }
}

/* ---------- Portal trigger styling ---------- */
/* Ghost Portal injects its own modal in a Shadow DOM — we can't restyle it from here.
   Set the accent in Ghost Admin → Settings → Branding (#ccff00). What we CAN style
   are the portal data-attribute trigger buttons that the theme renders. */

[data-portal="signup"], [data-portal="signin"] { /* match .btn-primary visually */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 22px;
    border-radius: 999px;
    color: var(--lime-text);
    background: var(--lime);
    background-image: linear-gradient(135deg, #f3ffca, var(--lime));
    box-shadow: var(--shadow-lime);
    font-weight: 700;
    font-size: 0.86rem;
    letter-spacing: 0.02em;
    text-decoration: none;
    border: 0;
    cursor: pointer;
}

/* ---------- Reveal-on-scroll (used by main.js) ---------- */

.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal--in { opacity: 1; transform: none; }
