/* ==========================================================================
   Matzielab — Ghost theme
   Design tokens mirror matzielab.com (src/layouts/Layout.astro)
   ========================================================================== */

:root {
    --ink: #05060a;
    --ink-2: #08090f;
    --ink-3: #0a0b12;
    --ember: #ff4b4b;
    --gold: #ffd25f;
    --zap: #4f8cff;

    --text: #d4d4d8;      /* zinc-300 */
    --text-muted: #a1a1aa; /* zinc-400 */
    --text-dim: #71717a;   /* zinc-500 */
    --text-faint: #52525b; /* zinc-600 */
    --white: #ffffff;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);

    --magic: linear-gradient(90deg, var(--gold), var(--ember), var(--zap), var(--gold));
    --magic-btn: linear-gradient(115deg, var(--gold), var(--ember) 55%, var(--zap));

    --font-sans: var(--gh-font-body, "Inter"), ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display: var(--gh-font-heading, "Space Grotesk"), "Inter", ui-sans-serif, system-ui, sans-serif;
    --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --radius: 1.25rem;

    --content-width: 720px;
    --wide-width: 1120px;
    --page-width: 1280px;
    --gutter: clamp(1.25rem, 4vw, 2rem);

    /* Ghost card accent */
    --ghost-accent-color: var(--ember);
}

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

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

html, body { margin: 0; overscroll-behavior: none; }
html.scroll-smooth { scroll-behavior: smooth; }

body {
    background-color: var(--ink);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--white);
    font-family: var(--font-display);
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 0;
}

p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

::selection { background: rgba(255, 75, 75, 0.4); color: var(--white); }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--gold), var(--ember), var(--zap));
    border-radius: 8px;
    border: 2px solid var(--ink);
}

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

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

.container { max-width: var(--page-width); margin: 0 auto; padding: 0 var(--gutter); }
.container-narrow { max-width: calc(var(--content-width) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
.container-wide { max-width: calc(var(--wide-width) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }

.section { padding-top: clamp(4rem, 8vw, 7rem); padding-bottom: clamp(4rem, 8vw, 7rem); }
.section-tight { padding-top: 1rem; }

.text-ember { color: var(--ember); }

/* ---------- Ambient background ---------- */

.scene { position: fixed; inset: 0; z-index: -1; overflow: hidden; }

.aurora {
    position: absolute;
    width: 62vw;
    aspect-ratio: 1;
    border-radius: 50%;
    filter: blur(110px);
    will-change: transform;
}
.aurora-a {
    top: -18%; left: -12%;
    background: radial-gradient(closest-side, rgba(255, 210, 95, 0.28), rgba(255, 75, 75, 0.18), transparent 72%);
    animation: drift-a 26s ease-in-out infinite alternate;
}
.aurora-b {
    bottom: -25%; right: -15%;
    background: radial-gradient(closest-side, rgba(79, 140, 255, 0.3), rgba(160, 80, 255, 0.14), transparent 72%);
    animation: drift-b 32s ease-in-out infinite alternate;
}
.scene-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse 110% 65% at 50% 0%, black 25%, transparent 78%);
    mask-image: radial-gradient(ellipse 110% 65% at 50% 0%, black 25%, transparent 78%);
}
.grain {
    position: fixed;
    inset: 0;
    z-index: 60;
    pointer-events: none;
    opacity: 0.05;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
    background-size: 160px 160px;
}

/* ---------- Signature styles ---------- */

.text-magic {
    background: var(--magic);
    background-size: 300% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shine 8s linear infinite;
}

.eyebrow,
.eyebrow-center {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.eyebrow::before {
    content: "";
    width: 2rem;
    height: 1px;
    background: linear-gradient(90deg, var(--ember), transparent);
}
.eyebrow-center { letter-spacing: 0.3em; justify-content: center; }
.eyebrow-center::before,
.eyebrow-center::after { content: ""; width: 2rem; height: 1px; }
.eyebrow-center::before { background: linear-gradient(90deg, transparent, var(--ember)); }
.eyebrow-center::after { background: linear-gradient(90deg, var(--ember), transparent); }
a.eyebrow { transition: color 0.25s; }
a.eyebrow:hover { color: var(--white); }

.section-head { margin-bottom: 3rem; }
.section-title {
    margin-top: 1rem;
    font-size: clamp(2.25rem, 5vw, 3rem);
    line-height: 1.05;
    font-weight: 700;
    text-wrap: balance;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 2rem;
    padding: 0.375rem 1rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text);
}
.pill-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--ember);
    box-shadow: 0 0 12px 2px rgba(255, 75, 75, 0.7);
}

.chip {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
}
.chip-link { transition: all 0.3s var(--ease); }
.chip-link:hover { border-color: rgba(255, 210, 95, 0.5); background: rgba(255, 255, 255, 0.1); color: var(--gold); }

.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }

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

.btn-primary,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 9999px;
    padding: 0.85rem 1.9rem;
    font-weight: 600;
    white-space: nowrap;
    transition: transform 0.25s var(--ease), box-shadow 0.25s, filter 0.25s, border-color 0.25s, background 0.25s;
}
.btn-primary {
    font-family: var(--font-display);
    color: #200505;
    background: var(--magic-btn);
    box-shadow: 0 10px 40px -10px rgba(255, 75, 75, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn-primary:hover {
    transform: translateY(-2px) scale(1.03);
    filter: saturate(1.15);
    box-shadow: 0 18px 60px -12px rgba(255, 75, 75, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn-ghost {
    color: var(--white);
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px);
}
.btn-ghost:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.45); background: rgba(255, 255, 255, 0.09); }
.btn-primary:active, .btn-ghost:active { transform: scale(0.97); }
.btn-sm { padding: 0.5rem 1.1rem; font-size: 0.875rem; }

.glow-border {
    position: relative;
    display: inline-block;
    border-radius: 9999px;
    padding: 2px;
    background: linear-gradient(115deg, var(--gold), var(--ember), var(--zap), var(--gold));
    background-size: 300% 300%;
    animation: border-flow 7s linear infinite;
    box-shadow: 0 12px 50px -12px rgba(255, 75, 75, 0.55);
    transition: transform 0.3s var(--ease), box-shadow 0.3s;
}
.glow-border:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 22px 70px -14px rgba(255, 75, 75, 0.75); }
.glow-border-inner {
    display: flex;
    align-items: center;
    border-radius: 9999px;
    background: var(--ink-2);
    padding: 1rem 2.25rem;
    color: var(--white);
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.glow-border .arrow { margin-left: 0.75rem; display: inline-block; transition: transform 0.3s; }
.glow-border:hover .arrow { transform: translateX(6px); }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem; height: 2.5rem;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    transition: all 0.3s var(--ease);
}
.icon-btn svg { width: 1.1rem; height: 1.1rem; }
.icon-btn:hover { color: var(--white); border-color: rgba(255, 210, 95, 0.6); box-shadow: 0 0 24px -6px rgba(255, 210, 95, 0.6); }

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid transparent;
    transition: background 0.3s, border-color 0.3s, backdrop-filter 0.3s;
}
.site-header.is-scrolled {
    background: rgba(5, 6, 10, 0.72);
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    border-bottom-color: var(--line);
}
.site-header-inner {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 1rem var(--gutter);
    display: flex;
    align-items: center;
    gap: 2rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.brand-mark { width: 2rem; height: 2rem; object-fit: contain; transition: transform 0.4s var(--ease); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.08); }
.brand-logo { max-height: 2.25rem; width: auto; }
.brand-text { font-family: var(--font-display); font-size: 1.125rem; font-weight: 700; letter-spacing: -0.02em; color: var(--white); }

.site-nav { flex: 1; }
.site-nav .nav { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.site-nav .nav a {
    display: block;
    padding: 0.45rem 0.9rem;
    border-radius: 9999px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.25s, background 0.25s;
}
.site-nav .nav a:hover { color: var(--white); background: rgba(255, 255, 255, 0.05); }
.site-nav .nav-current a { color: var(--white); background: rgba(255, 255, 255, 0.07); }

.header-actions { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }
.menu-toggle { display: none; }

@media (max-width: 800px) {
    .menu-toggle { display: inline-flex; }
    .header-actions .btn-ghost { display: none; }
    .site-nav {
        position: absolute;
        top: 100%; left: 0; right: 0;
        padding: 0.5rem var(--gutter) 1.25rem;
        background: rgba(5, 6, 10, 0.95);
        backdrop-filter: blur(14px);
        border-bottom: 1px solid var(--line);
        opacity: 0;
        pointer-events: none;
        transform: translateY(-8px);
        transition: opacity 0.25s, transform 0.25s var(--ease);
    }
    .site-nav .nav { flex-direction: column; }
    .site-nav .nav a { font-size: 1.05rem; padding: 0.7rem 0.9rem; }
    body.menu-open .site-nav { opacity: 1; pointer-events: auto; transform: none; }
    body.menu-open .site-header { background: rgba(5, 6, 10, 0.95); }
}

/* ---------- Hero ---------- */

.hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: clamp(4rem, 10vw, 8rem) var(--gutter) clamp(4rem, 9vw, 7rem);
    text-align: center;
}
.hero-inner { position: relative; max-width: 56rem; margin: 0 auto; }
.hero-title {
    font-size: clamp(2.75rem, 8vw, 5.75rem);
    line-height: 0.98;
    font-weight: 700;
    letter-spacing: -0.035em;
    text-wrap: balance;
}
.hero-sub {
    max-width: 36rem;
    margin: 2rem auto 0;
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    line-height: 1.6;
    color: var(--text-muted);
    text-wrap: pretty;
}

.orb {
    position: absolute;
    width: 300px;
    aspect-ratio: 1;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
}
.orb-gold { left: 6%; top: 24%; background: rgba(255, 210, 95, 0.25); }
.orb-zap { right: 8%; top: 32%; background: rgba(79, 140, 255, 0.25); }
@media (max-width: 768px) { .orb { display: none; } }
.float-y { animation: float-y 9s ease-in-out infinite; }
.orb-delay { animation-delay: -4.5s; }

/* ---------- Marquee ---------- */

.marquee {
    overflow: hidden;
    transform: rotate(-0.6deg) scaleX(1.02);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.025);
    padding: 1rem 0;
}
.marquee-track { display: flex; width: max-content; animation: marquee 38s linear infinite; will-change: transform; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-group { display: flex; flex-shrink: 0; align-items: center; }
.marquee-item {
    padding: 0 1.75rem;
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.24em;
    white-space: nowrap;
    text-transform: uppercase;
    color: var(--text-muted);
}
.spark { font-size: 0.75rem; color: var(--gold); }
.spark:nth-of-type(3n + 2) { color: var(--ember); }
.spark:nth-of-type(3n) { color: var(--zap); }

/* ---------- Cards ---------- */

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 1.5rem;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.028);
    backdrop-filter: blur(6px);
    transition: transform 0.4s var(--ease), border-color 0.4s, box-shadow 0.4s, opacity 0.9s var(--ease);
}
.card:hover {
    transform: translateY(-6px);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 24px 70px -20px rgba(0, 0, 0, 0.85);
}
.card-link { position: absolute; inset: 0; z-index: 20; }
.card-hairline {
    position: absolute;
    top: 0; left: 12%; right: 12%;
    height: 1px;
    z-index: 10;
    background: linear-gradient(90deg, transparent, var(--gold), var(--ember), var(--zap), transparent);
    opacity: 0;
    transition: opacity 0.4s;
}
.card:hover .card-hairline { opacity: 1; }

.card-media { position: relative; height: 13rem; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease); }
.card:hover .card-media img { transform: scale(1.06); }
.card-media-fade { position: absolute; inset: 0; background: linear-gradient(to top, var(--ink-3), rgba(10, 11, 18, 0.1) 50%, transparent); }
.card-media-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%; height: 100%;
    background:
        radial-gradient(circle at 25% 30%, rgba(255, 210, 95, 0.22), transparent 55%),
        radial-gradient(circle at 75% 70%, rgba(79, 140, 255, 0.22), transparent 55%),
        radial-gradient(circle at 60% 20%, rgba(255, 75, 75, 0.18), transparent 50%),
        var(--ink-3);
}
.card-media.card-media-empty { height: 13rem; }
.card-media-empty span { font-size: 2.5rem; color: rgba(255, 255, 255, 0.18); transition: transform 0.7s var(--ease); }
.card:hover .card-media-empty span { transform: rotate(90deg) scale(1.2); }

.ghost-num {
    position: absolute;
    left: 1rem; top: 0.6rem;
    z-index: 10;
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: rgba(255, 255, 255, 0.16);
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.card-body { display: flex; flex: 1; flex-direction: column; gap: 0.75rem; padding: 1.5rem; }
.card-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; transition: color 0.3s; }
.card:hover .card-title { color: var(--gold); }
.card-excerpt { font-size: 0.875rem; line-height: 1.6; color: var(--text-muted); }
.card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-top: auto;
    padding-top: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-dim);
}
.lock { color: var(--gold); margin-left: auto; }

.card-featured { margin-bottom: 1.5rem; }
@media (min-width: 900px) {
    .card-featured { display: grid; grid-template-columns: 1.35fr 1fr; }
    .card-featured .card-media { height: auto; min-height: 24rem; }
    .card-featured .card-media-fade { background: linear-gradient(to right, transparent 60%, var(--ink-3)); }
}
.card-featured .card-body { justify-content: center; padding: clamp(1.5rem, 3vw, 2.75rem); gap: 1rem; }
.card-featured .card-title { font-size: clamp(1.75rem, 3vw, 2.5rem); letter-spacing: -0.03em; line-height: 1.1; }
.card-featured .card-excerpt { font-size: 1rem; line-height: 1.7; }
.card-featured .card-meta { margin-top: 0.5rem; }
.read-more { margin-top: 0.75rem; font-family: var(--font-display); font-weight: 600; color: var(--white); }
.read-more span { display: inline-block; transition: transform 0.3s; }
.card:hover .read-more span { transform: translateX(6px); }

.empty { color: var(--text-dim); text-align: center; padding: 4rem 0; }

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

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 3.5rem; }
.pagination-info { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-dim); }

/* ---------- Archive headers (tag / author) ---------- */

.archive-header { text-align: center; padding-top: clamp(4rem, 9vw, 7rem); padding-bottom: 3rem; }
.archive-title { margin-top: 1rem; font-size: clamp(2.5rem, 7vw, 4.5rem); font-weight: 700; letter-spacing: -0.035em; }
.archive-sub { max-width: 36rem; margin: 1.5rem auto 0; font-size: 1.125rem; color: var(--text-muted); }
.archive-count { margin-top: 1.25rem; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-dim); }
.author-avatar { position: relative; width: 6.5rem; height: 6.5rem; margin: 0 auto; }
.author-avatar::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; background: var(--magic-btn); filter: blur(14px); opacity: 0.45; }
.author-avatar img { position: relative; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255, 255, 255, 0.15); background: var(--ink-3); }
.author-links { display: flex; justify-content: center; gap: 1.25rem; margin-top: 1.25rem; font-size: 0.875rem; color: var(--text-dim); }
.author-links a:hover { color: var(--gold); }

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

.article-header { padding-top: clamp(3.5rem, 8vw, 6rem); padding-bottom: 2.5rem; }
.article-title {
    margin-top: 1.25rem;
    font-size: clamp(2.25rem, 6vw, 3.75rem);
    line-height: 1.02;
    font-weight: 700;
    letter-spacing: -0.035em;
    text-wrap: balance;
}
.article-excerpt { margin-top: 1.5rem; font-size: clamp(1.1rem, 2vw, 1.3rem); line-height: 1.6; color: var(--text-muted); text-wrap: pretty; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 2rem; font-size: 0.875rem; color: var(--text-dim); }
.author-chip { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 600; color: var(--white); transition: color 0.25s; }
.author-chip:hover { color: var(--gold); }
.author-chip img { width: 2.25rem; height: 2.25rem; border-radius: 50%; object-fit: cover; border: 1px solid var(--line-strong); background: var(--ink-3); }

.article-image { position: relative; margin-top: 0.5rem; margin-bottom: 3.5rem; }
.article-image-glow {
    position: absolute;
    inset: 0.75rem calc(var(--gutter) - 0.75rem);
    border-radius: 2rem;
    background: linear-gradient(45deg, var(--gold), var(--ember), var(--zap));
    opacity: 0.22;
    filter: blur(40px);
}
.article-image img { position: relative; width: 100%; border-radius: 1.5rem; border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.6); }
.article-image figcaption { margin-top: 0.9rem; text-align: center; font-size: 0.85rem; color: var(--text-dim); }

.article-footer { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-list .chip { position: relative; z-index: 1; text-transform: none; letter-spacing: 0; font-size: 0.8rem; }
.comments { margin-top: 3rem; }

/* ---------- Post content (Koenig) ---------- */

.gh-content {
    display: grid;
    grid-template-columns:
        [full-start] minmax(var(--gutter), 1fr)
        [wide-start] minmax(0, calc((var(--wide-width) - var(--content-width)) / 2))
        [main-start] min(var(--content-width), calc(100% - var(--gutter) * 2)) [main-end]
        minmax(0, calc((var(--wide-width) - var(--content-width)) / 2)) [wide-end]
        minmax(var(--gutter), 1fr) [full-end];
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text);
}
.gh-content > * { grid-column: main-start / main-end; margin-top: 0; margin-bottom: 0; }
.gh-content > * + * { margin-top: 1.6em; }
.gh-content > .kg-width-wide { grid-column: wide-start / wide-end; }
.gh-content > .kg-width-full { grid-column: full-start / full-end; }
.gh-content > .kg-width-full img { border-radius: 0; }

.gh-content > h2, .gh-content > h3, .gh-content > h4 { margin-top: 2.2em; }
.gh-content > h2 + *, .gh-content > h3 + *, .gh-content > h4 + * { margin-top: 0.8em; }
.gh-content h2 { font-size: clamp(1.75rem, 3.5vw, 2.25rem); }
.gh-content h3 { font-size: clamp(1.35rem, 2.5vw, 1.6rem); }
.gh-content h4 { font-size: 1.2rem; }

.gh-content a:not([class]) {
    color: var(--white);
    text-decoration: underline;
    text-decoration-color: var(--ember);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    transition: color 0.2s, text-decoration-color 0.2s;
}
.gh-content a:not([class]):hover { color: var(--gold); text-decoration-color: var(--gold); }
.gh-content strong { color: var(--white); font-weight: 600; }

.gh-content ul, .gh-content ol { padding-left: 1.4em; }
.gh-content li + li { margin-top: 0.5em; }
.gh-content ul li::marker { color: var(--ember); }
.gh-content ol li::marker { color: var(--gold); font-family: var(--font-display); font-weight: 600; }

.gh-content blockquote:not([class]) {
    position: relative;
    margin-left: 0; margin-right: 0;
    padding: 0.25em 0 0.25em 1.5em;
    font-family: var(--font-display);
    font-size: 1.3em;
    line-height: 1.5;
    color: var(--white);
    border-left: 2px solid transparent;
    border-image: linear-gradient(180deg, var(--gold), var(--ember), var(--zap)) 1;
}
.gh-content blockquote.kg-blockquote-alt {
    text-align: center;
    font-family: var(--font-display);
    font-size: 1.6em;
    line-height: 1.4;
    color: var(--white);
    padding: 0 1em;
}

.gh-content hr {
    width: 100%;
    height: 1px;
    border: 0;
    margin-top: 3em; margin-bottom: 1.4em;
    background: linear-gradient(90deg, transparent, var(--gold), var(--ember), var(--zap), transparent);
    opacity: 0.6;
}

.gh-content :not(pre) > code {
    padding: 0.15em 0.4em;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.06);
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--gold);
}
.gh-content pre {
    overflow-x: auto;
    padding: 1.25rem 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--line);
    background: var(--ink-2);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--text);
}

.gh-content figure { margin-left: 0; margin-right: 0; }
.gh-content img { border-radius: 1rem; }
.gh-content figcaption { margin-top: 0.8em; text-align: center; font-size: 0.85rem; color: var(--text-dim); }
.gh-content table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.gh-content th, .gh-content td { padding: 0.7em 0.9em; border-bottom: 1px solid var(--line); text-align: left; }
.gh-content th { color: var(--white); font-family: var(--font-display); }

/* Koenig cards — dark-mode tweaks on top of Ghost's card_assets */
.kg-card.kg-callout-card { border-radius: 1rem; }
.kg-callout-card-grey, .kg-callout-card-white { background: rgba(255, 255, 255, 0.05) !important; }
.kg-bookmark-card .kg-bookmark-container {
    border-radius: 1rem !important;
    border: 1px solid var(--line) !important;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text) !important;
    transition: border-color 0.3s;
}
.kg-bookmark-card .kg-bookmark-container:hover { border-color: rgba(255, 255, 255, 0.25) !important; }
.kg-bookmark-title { color: var(--white) !important; }
.kg-bookmark-description, .kg-bookmark-metadata { color: var(--text-muted) !important; }
.kg-btn, .kg-btn-accent { border-radius: 9999px !important; font-family: var(--font-display); }
.kg-toggle-card, .kg-product-card-container, .kg-file-card-container { background: rgba(255, 255, 255, 0.04) !important; border-color: var(--line) !important; border-radius: 1rem !important; }
.kg-toggle-heading-text, .kg-product-card-title, .kg-file-card-title { color: var(--white) !important; }

/* ---------- Subscribe CTA ---------- */

.cta { position: relative; max-width: 42rem; margin: 0 auto; padding: clamp(4rem, 9vw, 7rem) var(--gutter); text-align: center; }
.cta::before {
    content: "";
    position: absolute;
    inset: 10% 0;
    z-index: -1;
    background: radial-gradient(closest-side, rgba(255, 210, 95, 0.18), rgba(255, 75, 75, 0.1), transparent);
}
.cta-title { margin-top: 1rem; font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.05; font-weight: 700; text-wrap: balance; }
.cta-text { margin: 1.25rem auto 2.5rem; font-size: 1.1rem; color: var(--text-muted); }

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

.site-footer { border-top: 1px solid rgba(255, 255, 255, 0.1); margin-top: 2rem; }
.site-footer-inner {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 2.5rem var(--gutter);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}
.footer-brand p { margin-top: 0.25rem; font-size: 0.875rem; color: var(--text-dim); }
.footer-nav .nav { display: flex; flex-wrap: wrap; gap: 1.25rem; list-style: none; margin: 0; padding: 0; font-size: 0.875rem; color: var(--text-dim); }
.footer-nav .nav a:hover { color: var(--white); }
.socials { display: flex; gap: 0.75rem; }
.social {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem; height: 2.75rem;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    transition: all 0.3s;
}
.social svg { width: 1.25rem; height: 1.25rem; }
.social:hover { transform: translateY(-4px); color: var(--white); }
.social-gold:hover { border-color: rgba(255, 210, 95, 0.6); box-shadow: 0 0 24px -6px rgba(255, 210, 95, 0.6); }
.social-ember:hover { border-color: rgba(255, 75, 75, 0.6); box-shadow: 0 0 24px -6px rgba(255, 75, 75, 0.6); }
.social-zap:hover { border-color: rgba(79, 140, 255, 0.6); box-shadow: 0 0 24px -6px rgba(79, 140, 255, 0.6); }
@media (max-width: 700px) {
    .site-footer-inner { flex-direction: column; text-align: center; }
}

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

.error-page {
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem var(--gutter);
    text-align: center;
}
.error-code {
    font-size: clamp(6rem, 18vw, 10rem);
    font-weight: 800;
    line-height: 1;
    background: var(--magic);
    background-size: 300% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shine 8s linear infinite;
}
.error-title { margin-top: 1.5rem; font-size: clamp(1.25rem, 3vw, 1.5rem); font-weight: 500; color: var(--text); }
.error-sub { margin: 0.75rem 0 2.5rem; color: var(--text-dim); }
.error-details { margin-top: 2rem; text-align: left; font-size: 0.85rem; color: var(--text-dim); }

/* ---------- Scroll reveal ---------- */

.js [data-reveal] {
    opacity: 0;
    transform: translateY(28px) scale(0.985);
    transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.js [data-reveal].is-visible { opacity: 1; transform: none; }
.js .card[data-reveal] { transition: opacity 0.9s var(--ease), transform 0.9s var(--ease), border-color 0.4s, box-shadow 0.4s; }
.js .card[data-reveal].is-visible:hover { transform: translateY(-6px); transition-delay: 0s !important; }

/* ---------- Keyframes ---------- */

@keyframes shine { to { background-position: 300% center; } }
@keyframes border-flow { to { background-position: 300% center; } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes float-y { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes drift-a {
    from { transform: translate(0, 0) rotate(0deg) scale(1); }
    to { transform: translate(14%, 10%) rotate(35deg) scale(1.15); }
}
@keyframes drift-b {
    from { transform: translate(0, 0) rotate(0deg) scale(1.1); }
    to { transform: translate(-12%, -8%) rotate(-30deg) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    html.scroll-smooth { scroll-behavior: auto; }
    .aurora, .marquee-track, .float-y, .text-magic, .glow-border, .error-code { animation: none !important; }
    .js [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
}
