/* Madbotz Blog theme — base styles.
 *
 * Design tokens synced from `02-Products/_Design/tokens/tokens.css` (canonical
 * source in the vault) and `packages/design-tokens` (code mirror). Tailwind v4
 * `@theme` block converted to plain `:root` because Ghost serves this as raw CSS.
 *
 * DO NOT edit tokens here — update `tokens.css` first, then re-sync this block.
 * Component styles below the tokens are theme-specific and OK to edit freely.
 *
 * Typography rules (from `_Design/tokens/typography.md`):
 *   - Body: Inter Tight (sans), 400.
 *   - Headings: Instrument Serif, 400, tracking-tight.
 *   - Card titles in feeds: sans 600 (denser, scannable).
 *   - Italic OK for editorial moments.
 */

:root {
    /* COLORS — brand */
    --color-brand-50:  #eff6ff;
    --color-brand-100: #dbeafe;
    --color-brand-200: #bfdbfe;
    --color-brand-300: #93c5fd;
    --color-brand-400: #60a5fa;
    --color-brand-500: #3b82f6;
    --color-brand-600: #2563eb;
    --color-brand-700: #1d4ed8;
    --color-brand-800: #1e40af;
    --color-brand-900: #1e3a8a;

    /* COLORS — neutrals */
    --color-neutral-50:  #f8f9fa;
    --color-neutral-100: #f1f3f5;
    --color-neutral-200: #e9ecef;
    --color-neutral-300: #dee2e6;
    --color-neutral-400: #9ca3af;
    --color-neutral-500: #6b7280;
    --color-neutral-600: #4b5563;
    --color-neutral-700: #374151;
    --color-neutral-800: #1f2937;
    --color-neutral-900: #1b1d1e;
    --color-neutral-950: #111214;

    /* COLORS — surface */
    --color-surface-base:   #ffffff;
    --color-surface-card:   #f4f4f4;
    --color-surface-subtle: #fafafa;

    /* COLORS — accent (decorative) */
    --color-accent-pink:   #ec4899;
    --color-accent-yellow: #facc15;
    --color-accent-green:  #79d45e;

    /* COLORS — semantic */
    --color-success: #40c057;
    --color-warning: #fab005;
    --color-danger:  #fa5252;
    --color-info:    #3b82f6;

    /* TYPOGRAPHY */
    --font-sans:  "Inter Tight", ui-sans-serif, system-ui, -apple-system, sans-serif;
    --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
    --font-mono:  ui-monospace, SFMono-Regular, Menlo, monospace;

    /* RADIUS */
    --radius-sm:   0.5rem;
    --radius-md:   0.75rem;
    --radius-lg:   1rem;
    --radius-xl:   1.5rem;
    --radius-full: 9999px;

    /* SHADOWS */
    --shadow-sm: 0 2px 16px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 2px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.10);
    --shadow-xl: 0 4px 24px rgba(0, 0, 0, 0.10);

    /* MOTION */
    --ease-out-expo: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out:   cubic-bezier(0.4, 0, 0.2, 1);

    --duration-fast:   150ms;
    --duration-base:   250ms;
    --duration-medium: 500ms;
    --duration-slow:   800ms;

    --stagger-base: 150ms;

    /* CONTAINER WIDTHS */
    --container-narrow: 720px;
    --container-base:   960px;
    --container-wide:   1200px;

    /* SEMANTIC SURFACES (theme-local aliases on top of tokens) */
    --bg:      var(--color-surface-base);
    --fg:      var(--color-neutral-900);
    --muted:   var(--color-neutral-500);
    --subtle:  var(--color-neutral-400);
    --border:  var(--color-neutral-200);
    --card-bg: var(--color-surface-card);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:      var(--color-neutral-950);
        --fg:      var(--color-neutral-50);
        --muted:   var(--color-neutral-400);
        --subtle:  var(--color-neutral-500);
        --border:  var(--color-neutral-800);
        --card-bg: var(--color-neutral-900);
    }
}

/* RESET */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font-sans);
    font-weight: 400;
    color: var(--fg);
    background: var(--bg);
    line-height: 1.6;
}
img { max-width: 100%; height: auto; }
a {
    color: var(--color-brand-600);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-in-out);
}
a:hover { color: var(--color-brand-700); text-decoration: underline; }

/* HEADINGS — serif, font-normal, tracking-tight (per typography.md) */
h1, h2, h3,
.site-intro h1,
.article-title,
.related-posts h2,
.gh-content h2,
.gh-content h3 {
    font-family: var(--font-serif);
    font-weight: 400;
    letter-spacing: -0.01em;
}

/* CONTAINERS */
.inner { max-width: var(--container-narrow); margin: 0 auto; padding: 0 1rem; }
.post-feed .inner,
.related-posts .inner,
.tags-page .inner { max-width: var(--container-wide); }

/* === HEADER === (floating rounded navbar matching visibility.madbotz.com) */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 1rem 1rem 0;
    background: transparent;
}
@media (min-width: 640px) {
    .site-header { padding: 1rem 1.5rem 0; }
}
.site-header-inner {
    max-width: var(--container-base);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--color-surface-base);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md);
}

.site-logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.site-logo img {
    height: 32px;
    width: auto;
    display: block;
}

.site-nav {
    display: none;
}
@media (min-width: 1024px) {
    .site-nav { display: flex; align-items: center; gap: 1.75rem; }
}
.site-nav > ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 1.75rem;
}
.site-nav a {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-neutral-900);
    transition: color var(--duration-fast) var(--ease-in-out);
}
.site-nav a:hover {
    color: var(--color-brand-500);
    text-decoration: none;
}

/* === TAG DROPDOWN (desktop header) === */
.has-tag-dropdown {
    position: relative;
}
.tags-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: transparent;
    border: 0;
    padding: 0;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-neutral-900);
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease-in-out);
}
.tags-toggle:hover { color: var(--color-brand-500); }
.tags-toggle:focus-visible {
    outline: 2px solid var(--color-brand-500);
    outline-offset: 4px;
    border-radius: var(--radius-sm);
}
.tags-toggle svg {
    transition: transform var(--duration-fast) var(--ease-in-out);
}
.has-tag-dropdown.is-open .tags-toggle svg { transform: rotate(180deg); }

.tags-dropdown {
    position: absolute;
    top: calc(100% + 0.75rem);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    min-width: 14rem;
    max-width: 20rem;
    background: var(--color-surface-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-fast) var(--ease-in-out),
                transform var(--duration-fast) var(--ease-out-expo);
    z-index: 60;
}
.has-tag-dropdown.is-open .tags-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}
.tags-dropdown-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: block;
    max-height: 24rem;
    overflow-y: auto;
}
.tags-dropdown-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--color-neutral-900);
    font-size: 0.9375rem;
    text-decoration: none;
    transition: background var(--duration-fast) var(--ease-in-out);
}
.tags-dropdown-list a:hover {
    background: var(--color-neutral-50);
    text-decoration: none;
}
.tags-dropdown-name { flex: 1; }
.tags-dropdown-count {
    font-size: 0.8125rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.tags-dropdown-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    margin-top: 0.25rem;
    padding: 0.625rem 0.75rem;
    border-top: 1px solid var(--border);
    color: var(--color-brand-500);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color var(--duration-fast) var(--ease-in-out);
}
.tags-dropdown-all:hover {
    color: var(--color-brand-700);
    text-decoration: none;
}
.tags-dropdown-empty {
    margin: 0;
    padding: 0.75rem;
    color: var(--muted);
    font-size: 0.875rem;
    text-align: center;
}

.site-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: transparent;
    border: 0;
    border-radius: var(--radius-full);
    color: var(--color-neutral-900);
    cursor: pointer;
    padding: 0;
    transition: background var(--duration-fast) var(--ease-in-out),
                color var(--duration-fast) var(--ease-in-out),
                transform var(--duration-base) var(--ease-out-expo);
}
.search-trigger:hover {
    background: var(--color-neutral-50);
    color: var(--color-brand-500);
    transform: translateY(-1px);
}
.search-trigger:focus-visible {
    outline: 2px solid var(--color-brand-500);
    outline-offset: 2px;
}

.lang-switch {
    display: inline-flex;
    align-items: center;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--color-neutral-900);
    transition: color var(--duration-fast) var(--ease-in-out),
                border-color var(--duration-fast) var(--ease-in-out),
                transform var(--duration-base) var(--ease-out-expo);
    text-decoration: none;
}
.lang-switch:hover {
    color: var(--color-brand-500);
    border-color: var(--color-neutral-400);
    transform: translateY(-1px);
    text-decoration: none;
}

.cta-button {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--color-neutral-900);
    color: var(--color-surface-base);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    text-decoration: none;
    transition: background var(--duration-fast) var(--ease-in-out),
                transform var(--duration-base) var(--ease-out-expo),
                box-shadow var(--duration-base) var(--ease-in-out);
}
@media (min-width: 640px) {
    .cta-button { display: inline-flex; }
}
.cta-button:hover {
    background: var(--color-neutral-700);
    color: var(--color-surface-base);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
}

.site-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: transparent;
    border: 0;
    border-radius: var(--radius-md);
    color: var(--color-neutral-900);
    cursor: pointer;
    padding: 0;
}
@media (min-width: 1024px) {
    .site-nav-toggle { display: none; }
}
.site-nav-toggle:hover { color: var(--color-brand-500); }
.site-nav-toggle:focus-visible {
    outline: 2px solid var(--color-brand-500);
    outline-offset: 2px;
}

/* === MOBILE MENU === (fullscreen panel toggled by .site-nav-toggle) */
.mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: var(--color-surface-base);
    display: flex;
    flex-direction: column;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--duration-base) var(--ease-out-expo),
                opacity var(--duration-base) var(--ease-in-out);
}
.mobile-menu[aria-hidden="false"] {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}
@media (min-width: 1024px) {
    .mobile-menu { display: none; }
}
.mobile-menu-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.5rem 1.25rem 2rem;
}
.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}
.mobile-menu-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted);
}
.mobile-menu-close {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: var(--color-neutral-900);
    cursor: pointer;
    padding: 0;
}
.mobile-menu-close:focus-visible {
    outline: 2px solid var(--color-brand-500);
    outline-offset: 2px;
}
.mobile-menu-search {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: var(--color-neutral-50);
    border: 0;
    border-radius: var(--radius-md);
    color: var(--color-neutral-900);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-in-out);
}
.mobile-menu-search:hover {
    background: var(--color-neutral-100);
}
.mobile-menu-search:focus-visible {
    outline: 2px solid var(--color-brand-500);
    outline-offset: 2px;
}
.mobile-menu-search svg {
    flex-shrink: 0;
    color: var(--muted);
}
.mobile-menu-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.mobile-menu-nav a {
    display: block;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--color-neutral-900);
    transition: background var(--duration-fast) var(--ease-in-out);
}
.mobile-menu-nav a:hover {
    background: var(--color-neutral-50);
    text-decoration: none;
}
.mobile-menu-lang {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.mobile-menu-lang-current {
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-neutral-900);
}
.mobile-menu-lang-other {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--muted);
    transition: color var(--duration-fast) var(--ease-in-out);
}
.mobile-menu-lang-other:hover {
    color: var(--color-neutral-900);
    text-decoration: none;
}

.mobile-menu-tags {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.mobile-menu-tags-title {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 0 0 0.5rem;
    padding: 0 0.75rem;
}
.mobile-menu-tags-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}
.mobile-menu-tags-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-md);
    color: var(--color-neutral-900);
    font-size: 0.9375rem;
    text-decoration: none;
    transition: background var(--duration-fast) var(--ease-in-out);
}
.mobile-menu-tags-list a:hover {
    background: var(--color-neutral-50);
    text-decoration: none;
}
.mobile-menu-tags-count {
    font-size: 0.8125rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.mobile-menu-tags-all {
    display: inline-flex;
    align-items: center;
    margin: 0.5rem 0 0 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-brand-500);
}
.mobile-menu-tags-all:hover {
    color: var(--color-brand-700);
    text-decoration: none;
}

.mobile-menu-cta {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    background: var(--color-neutral-900);
    color: var(--color-surface-base);
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    text-decoration: none;
    transition: background var(--duration-fast) var(--ease-in-out);
}
.mobile-menu-cta:hover {
    background: var(--color-neutral-700);
    color: var(--color-surface-base);
    text-decoration: none;
}
body.mobile-menu-open { overflow: hidden; }

/* INTRO (home / tag / author headers).
 * Bottom padding intentionally 0 — the feed wrapper below provides 3rem top padding
 * so the spacing between the header and the first row of posts stays consistent
 * whether or not the intro is rendered. The `:not(:has())` rule collapses the
 * wrapper to zero height when the homepage toggles `show_home_title` and
 * `show_home_description` are both off (no element children in `.inner`). */
.site-intro { padding: 3.5rem 0 0; text-align: center; }
.site-intro h1 { font-size: clamp(2.25rem, 5vw, 3rem); margin: 0 0 0.625rem; }
.site-description { color: var(--muted); margin: 0; font-size: 1.0625rem; }
.site-intro:not(:has(.inner > *)) { display: none; }

/* POST FEED */
.post-feed { padding: 3rem 0 4rem; }
.post-feed .inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2.5rem;
}
.post-card { display: flex; flex-direction: column; }
.post-card-image-link {
    display: block;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    transition: box-shadow var(--duration-base) var(--ease-in-out);
}
.post-card-image-link:hover { box-shadow: var(--shadow-md); }
.post-card-image {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    transition: transform var(--duration-medium) var(--ease-out-expo);
}
.post-card-image-link:hover .post-card-image { transform: scale(1.03); }
.post-card-content { padding-top: 0.875rem; }
.post-card-tag {
    font-family: var(--font-sans);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-brand-600);
}
.post-card-title {
    /* Card titles per typography.md — sans + 600 for scan density */
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 1.25rem;
    line-height: 1.3;
    margin: 0.375rem 0 0.5rem;
    letter-spacing: -0.01em;
}
.post-card-title a { color: var(--fg); }
.post-card-title a:hover { color: var(--color-brand-700); text-decoration: none; }
.post-card-excerpt { color: var(--muted); margin: 0 0 0.75rem; font-size: 0.9375rem; }
.post-card-meta {
    font-size: 0.8125rem;
    color: var(--muted);
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ARTICLE */
.article { padding-bottom: 4rem; }
.article-header { padding: 2.5rem 0 1.5rem; }
.article-tag {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-brand-600);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.article-title {
    font-size: clamp(2.25rem, 5vw, 3.75rem);
    line-height: 1.1;
    margin: 0.625rem 0 0.875rem;
    letter-spacing: -0.015em;
}
.article-excerpt {
    color: var(--muted);
    font-size: 1.125rem;
    margin: 0 0 1rem;
    line-height: 1.55;
}
.article-meta {
    font-size: 0.875rem;
    color: var(--muted);
    display: flex;
    gap: 0.875rem;
    flex-wrap: wrap;
    align-items: center;
}
.article-author { color: var(--fg); font-weight: 500; }
.article-author:hover { text-decoration: none; }

/* === FEATURE IMAGE LAYOUTS ===
 * Resolved via `data-layout="<value>"` set in post.hbs. Default value comes from the
 * theme setting `@custom.feature_image_layout` (Ghost Admin → Settings → Design →
 * Customize → Theme settings). Per-post override via internal tag #image-banner,
 * #image-narrow, or #image-contain.
 */
.article-image {
    margin: 0 auto 2rem;
    padding: 0 1rem;
    text-align: center;
}
.article-image img {
    display: block;
    width: 100%;
    border-radius: var(--radius-lg);
}
.article-image figcaption {
    color: var(--muted);
    font-size: 0.875rem;
    margin-top: 0.625rem;
    text-align: center;
}

/* contain — vertical-capped without cropping. Best for SVGs and square art.
 * Image preserved entirely; card-bg fills any unused space if image is transparent. */
.article-image[data-layout="contain"] {
    max-width: var(--container-base);
}
.article-image[data-layout="contain"] img {
    max-height: 60vh;
    object-fit: contain;
    background: var(--card-bg);
}

/* banner — cinematic 21:9 crop, centered to base container.
 * Best for panoramic photos and editorial hero banners. */
.article-image[data-layout="banner"] {
    max-width: var(--container-base);
}
.article-image[data-layout="banner"] img {
    aspect-ratio: 21 / 9;
    object-fit: cover;
}

/* narrow — constrained to body reading width (720 px).
 * Best for inline illustrations that should match the prose column. */
.article-image[data-layout="narrow"] {
    max-width: var(--container-narrow);
}

/* GHOST CONTENT (post body) */
.gh-content > * { margin-bottom: 1.25rem; }
.gh-content h2 {
    font-size: clamp(1.625rem, 3vw, 2rem);
    margin: 2.5rem 0 0.75rem;
    line-height: 1.25;
}
.gh-content h3 {
    font-size: 1.375rem;
    margin: 2rem 0 0.5rem;
    line-height: 1.3;
}
.gh-content p { font-size: 1.0625rem; line-height: 1.7; }
.gh-content blockquote {
    border-left: 3px solid var(--color-brand-500);
    padding: 0.5rem 0 0.5rem 1.25rem;
    margin-left: 0;
    color: var(--muted);
    font-family: var(--font-serif);
    font-size: 1.125rem;
    font-style: italic;
}
.gh-content code {
    background: var(--card-bg);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.875em;
}
.gh-content pre {
    background: var(--card-bg);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
}
.gh-content pre code { background: transparent; padding: 0; }
.gh-content ul, .gh-content ol { padding-left: 1.5rem; line-height: 1.7; }
.gh-content hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

/* GHOST KOENIG IMAGE WIDTHS (required by gscan):
 * Posts can mark images as wide/full and the editor outputs <figure class="kg-width-wide">
 * or <figure class="kg-width-full">. The default `.gh-content > * { margin: ... }` constrains
 * everything to the .inner width; these classes break out wider.
 */
.gh-content .kg-width-wide {
    margin-left: calc((var(--container-narrow) - var(--container-base)) / 2);
    margin-right: calc((var(--container-narrow) - var(--container-base)) / 2);
    max-width: var(--container-base);
}
.gh-content .kg-width-full {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    max-width: 100vw;
}
.gh-content .kg-width-wide img,
.gh-content .kg-width-full img {
    width: 100%;
    height: auto;
}

/* TAGS at end of article */
.article-tags { padding: 1.5rem 0; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.article-tags a {
    font-size: 0.8125rem;
    color: var(--muted);
    background: var(--card-bg);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
}
.article-tags a:hover { color: var(--fg); text-decoration: none; }

/* BREADCRUMBS */
.breadcrumbs { padding: 1rem 0 0; font-size: 0.8125rem; }
.breadcrumbs ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    color: var(--muted);
}
.breadcrumbs li + li::before { content: "/"; margin-right: 0.5rem; color: var(--subtle); }
.breadcrumbs li[aria-current="page"] { color: var(--fg); }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--fg); }

/* RELATED */
.related-posts {
    border-top: 1px solid var(--border);
    padding: 3rem 0;
}
.related-posts h2 {
    margin: 0 0 1.75rem;
    font-size: 1.5rem;
    line-height: 1.3;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.75rem;
}

/* === FOOTER === (2-col grid matching visibility.madbotz.com) */
.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 4rem;
    background: var(--bg);
}
.site-footer-inner {
    max-width: var(--container-base);
    margin: 0 auto;
    padding: 3.5rem 1.25rem 2rem;
}
@media (min-width: 1024px) {
    .site-footer-inner { padding-left: 1.5rem; padding-right: 1.5rem; }
}
.site-footer-grid {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}
@media (min-width: 1024px) {
    .site-footer-grid {
        flex-direction: row;
        justify-content: space-between;
        gap: 4rem;
    }
}
.site-footer-brand {
    max-width: 28rem;
}
.site-footer-logo {
    display: inline-flex;
    margin-bottom: 1.25rem;
}
.site-footer-logo img {
    height: 36px;
    width: auto;
    display: block;
}
.site-footer-description {
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--muted);
    margin: 0;
}
.site-footer-columns {
    display: flex;
    gap: 4rem;
}
@media (min-width: 640px) {
    .site-footer-columns { gap: 5rem; }
}
.site-footer-column-title {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--fg);
    margin: 0 0 1rem;
    letter-spacing: 0;
}
.site-footer-nav ul,
.site-footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.site-footer-nav a,
.site-footer-links a {
    font-size: 0.875rem;
    color: var(--muted);
    transition: color var(--duration-fast) var(--ease-in-out);
}
.site-footer-nav a:hover,
.site-footer-links a:hover {
    color: var(--fg);
    text-decoration: none;
}
.site-footer-bottom {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
@media (min-width: 640px) {
    .site-footer-bottom {
        flex-direction: row;
        justify-content: space-between;
    }
}
.site-footer-copyright {
    font-size: 0.875rem;
    color: var(--muted);
    margin: 0;
}
.site-footer-llms {
    font-size: 0.875rem;
    color: var(--muted);
    transition: color var(--duration-fast) var(--ease-in-out);
}
.site-footer-llms:hover {
    color: var(--fg);
    text-decoration: none;
}

/* Footer logo sits on the page background (which flips in dark mode). The
 * bundled wordmark is dark on transparent, so invert it on dark backgrounds.
 * Header logo lives on a white pill — no invert needed there. */
@media (prefers-color-scheme: dark) {
    .site-footer-logo img {
        filter: invert(1);
    }
}

/* === /tags/ PAGE === (dedicated tag index, rendered by page-tags.hbs) */
.tags-page { padding: 3rem 0 5rem; }
.tags-page-header {
    text-align: center;
    margin-bottom: 3rem;
}
.tags-page-title {
    font-size: clamp(2.25rem, 5vw, 3rem);
    margin: 0 0 0.75rem;
}
.tags-page-lead {
    font-size: 1.0625rem;
    color: var(--muted);
    max-width: 36rem;
    margin: 0 auto;
    line-height: 1.55;
}
.tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}
.tag-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    color: inherit;
    text-decoration: none;
    transition: transform var(--duration-base) var(--ease-out-expo),
                box-shadow var(--duration-base) var(--ease-in-out);
}
.tag-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}
.tag-card-name {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 400;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--fg);
}
.tag-card-description {
    color: var(--muted);
    font-size: 0.9375rem;
    margin: 0;
    line-height: 1.5;
}
.tag-card-count {
    font-size: 0.8125rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: auto;
}
.tags-page-content {
    max-width: var(--container-narrow);
    margin: 3rem auto 0;
}
.tags-page-empty {
    text-align: center;
    color: var(--muted);
    font-size: 1rem;
}

/* PAGINATION */
.pagination {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 2rem 0;
    font-size: 0.9375rem;
}
.pagination a, .pagination span {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    color: var(--muted);
}
.pagination a:hover {
    background: var(--card-bg);
    color: var(--fg);
    text-decoration: none;
}

/* === JUNIPER-STYLE FEED LAYOUT === (Pedido 2)
 * Active when @custom.feed_layout = "juniper-style". Applied via the feed-layout partial.
 * Wraps the post list in a 2-column grid (main feed + sidebar) on lg viewports.
 * Card visual language inspired by visibility.madbotz.com/report (radius-xl, shadow-md,
 * brand-50 tag chips). Layout structure inspired by Juniper screenshots from the handoff. */
.feed-layout-juniper {
    padding: 3rem 0 4rem;
}
.feed-layout-juniper .inner {
    max-width: var(--container-wide);
}
.feed-layout-juniper .feed-layout-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
}
@media (min-width: 1024px) {
    .feed-layout-juniper .feed-layout-grid {
        grid-template-columns: minmax(0, 1fr) 18rem;
        gap: 3rem;
    }
}
.feed-layout-main { min-width: 0; }

/* Hero (page 1 of feed): featured + 4 secondaries */
.feed-hero {
    margin-bottom: 3rem;
}
.feed-hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}
@media (min-width: 1024px) {
    .feed-hero-grid {
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
        gap: 2.5rem;
        align-items: start;
    }
}

.feed-hero-featured { display: flex; flex-direction: column; }
.feed-hero-featured-image-link {
    display: block;
    overflow: hidden;
    border-radius: var(--radius-xl);
    background: var(--card-bg);
    transition: box-shadow var(--duration-base) var(--ease-in-out);
}
.feed-hero-featured-image-link:hover { box-shadow: var(--shadow-md); }
.feed-hero-featured-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    transition: transform var(--duration-medium) var(--ease-out-expo);
}
.feed-hero-featured-image-link:hover .feed-hero-featured-image { transform: scale(1.03); }
.feed-hero-featured-content { padding-top: 1.25rem; }
.feed-hero-featured-title {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(1.875rem, 3.5vw, 2.5rem);
    line-height: 1.15;
    letter-spacing: -0.015em;
    margin: 0.625rem 0 0.75rem;
}
.feed-hero-featured-title a { color: var(--fg); }
.feed-hero-featured-title a:hover { color: var(--color-brand-700); text-decoration: none; }
.feed-hero-featured-excerpt {
    color: var(--muted);
    font-size: 1.0625rem;
    line-height: 1.55;
    margin: 0 0 0.875rem;
}
.feed-hero-featured-meta {
    font-size: 0.875rem;
    color: var(--muted);
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.feed-hero-secondaries {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.feed-hero-secondary {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}
.feed-hero-secondary-image-link {
    display: block;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    transition: box-shadow var(--duration-base) var(--ease-in-out);
}
.feed-hero-secondary-image-link:hover { box-shadow: var(--shadow-md); }
.feed-hero-secondary-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    transition: transform var(--duration-medium) var(--ease-out-expo);
}
.feed-hero-secondary-image-link:hover .feed-hero-secondary-image { transform: scale(1.03); }
.feed-hero-secondary-content { min-width: 0; }
.feed-hero-secondary-title {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.35;
    letter-spacing: -0.005em;
    margin: 0.375rem 0 0.375rem;
}
.feed-hero-secondary-title a { color: var(--fg); }
.feed-hero-secondary-title a:hover { color: var(--color-brand-700); text-decoration: none; }
.feed-hero-secondary-date {
    font-size: 0.8125rem;
    color: var(--muted);
}

/* Tag chip used in featured + secondaries. Brand-tinted pill, sober (no multicolor). */
.feed-hero-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: var(--color-brand-50);
    color: var(--color-brand-700);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: var(--radius-full);
    text-decoration: none;
    transition: background var(--duration-fast) var(--ease-in-out);
}
.feed-hero-tag:hover {
    background: var(--color-brand-100);
    color: var(--color-brand-700);
    text-decoration: none;
}
@media (prefers-color-scheme: dark) {
    .feed-hero-tag {
        background: rgba(59, 130, 246, 0.15);
        color: var(--color-brand-300);
    }
    .feed-hero-tag:hover {
        background: rgba(59, 130, 246, 0.25);
    }
}

/* Sidebar (right column on lg+, stacks on small). Soft card-bg block per section. */
.feed-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}
.feed-sidebar-block {
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
}
.feed-sidebar-title {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 0 0 1rem;
}

.feed-sidebar-about-logo {
    display: inline-flex;
    margin-bottom: 0.75rem;
}
.feed-sidebar-about-logo img {
    height: 32px;
    width: auto;
    display: block;
}
.feed-sidebar-about-text {
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--muted);
    margin: 0;
}
@media (prefers-color-scheme: dark) {
    .feed-sidebar-about-logo img { filter: invert(1); }
}

.feed-sidebar-featured-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.feed-sidebar-featured-item {
    display: grid;
    grid-template-columns: 4rem minmax(0, 1fr);
    gap: 0.75rem;
    align-items: center;
    color: inherit;
    text-decoration: none;
}
.feed-sidebar-featured-item:hover { text-decoration: none; }
.feed-sidebar-featured-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--radius-md);
    background: var(--bg);
    display: block;
}
.feed-sidebar-featured-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.feed-sidebar-featured-title {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--fg);
    transition: color var(--duration-fast) var(--ease-in-out);
}
.feed-sidebar-featured-item:hover .feed-sidebar-featured-title { color: var(--color-brand-700); }
.feed-sidebar-featured-date {
    font-size: 0.75rem;
    color: var(--muted);
}

.feed-sidebar-tags-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.feed-sidebar-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    background: var(--bg);
    color: var(--fg);
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: background var(--duration-fast) var(--ease-in-out),
                color var(--duration-fast) var(--ease-in-out);
}
.feed-sidebar-tag:hover {
    background: var(--color-brand-50);
    color: var(--color-brand-700);
    text-decoration: none;
}
@media (prefers-color-scheme: dark) {
    .feed-sidebar-tag:hover {
        background: rgba(59, 130, 246, 0.15);
        color: var(--color-brand-300);
    }
}

.feed-sidebar-newsletter-text {
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--muted);
    margin: 0 0 1rem;
}
.feed-sidebar-newsletter-cta {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    background: var(--color-neutral-900);
    color: var(--color-surface-base);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    border: 0;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-in-out),
                transform var(--duration-base) var(--ease-out-expo);
}
.feed-sidebar-newsletter-cta:hover {
    background: var(--color-neutral-700);
    transform: translateY(-1px);
}
.feed-sidebar-newsletter-cta:focus-visible {
    outline: 2px solid var(--color-brand-500);
    outline-offset: 2px;
}

/* Grid of post cards inside the juniper-style main column. 2 cols on sm+, 1 col below. */
.feed-layout-juniper .post-feed {
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
}
@media (min-width: 640px) {
    .feed-layout-juniper .post-feed {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Load more pill button + page status, centered below the grid (matches Juniper screenshot) */
.feed-load-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2.5rem 0 0;
}
.feed-load-more-button {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.75rem;
    background: var(--color-neutral-900);
    color: var(--color-surface-base);
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    text-decoration: none;
    transition: background var(--duration-fast) var(--ease-in-out),
                transform var(--duration-base) var(--ease-out-expo),
                box-shadow var(--duration-base) var(--ease-in-out);
}
.feed-load-more-button:hover {
    background: var(--color-neutral-700);
    color: var(--color-surface-base);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}
.feed-load-more-button:focus-visible {
    outline: 2px solid var(--color-brand-500);
    outline-offset: 2px;
}
.feed-load-more-status {
    font-size: 0.8125rem;
    color: var(--muted);
    margin: 0;
}

/* === ENTRANCE ANIMATIONS === (Pedido 5)
 * Gated by prefers-reduced-motion so users with the OS-level toggle see static layout.
 * Hover transforms above stay always-on (user-initiated, subtle). */
@media (prefers-reduced-motion: no-preference) {
    /* Feature image fades + scales in on post pages */
    @keyframes article-image-in {
        from { opacity: 0; transform: scale(0.98); }
        to   { opacity: 1; transform: scale(1); }
    }
    .article-image img {
        animation: article-image-in var(--duration-medium) var(--ease-out-expo) both;
    }

    /* Cards stagger entrance on feeds + /tags/ grid. The cascade caps at 6 so the
     * 7th+ card enters together — keeps long feeds from feeling slow. */
    @keyframes card-enter {
        from { opacity: 0; transform: translateY(16px); }
        to   { opacity: 1; transform: translateY(0); }
    }
    .post-feed .post-card,
    .related-grid .post-card,
    .tags-grid .tag-card {
        animation: card-enter var(--duration-medium) var(--ease-out-expo) both;
    }
    .post-feed .post-card:nth-child(1),
    .related-grid .post-card:nth-child(1),
    .tags-grid .tag-card:nth-child(1) { animation-delay: 0ms; }
    .post-feed .post-card:nth-child(2),
    .related-grid .post-card:nth-child(2),
    .tags-grid .tag-card:nth-child(2) { animation-delay: calc(var(--stagger-base) * 1); }
    .post-feed .post-card:nth-child(3),
    .related-grid .post-card:nth-child(3),
    .tags-grid .tag-card:nth-child(3) { animation-delay: calc(var(--stagger-base) * 2); }
    .post-feed .post-card:nth-child(4),
    .related-grid .post-card:nth-child(4),
    .tags-grid .tag-card:nth-child(4) { animation-delay: calc(var(--stagger-base) * 3); }
    .post-feed .post-card:nth-child(5),
    .related-grid .post-card:nth-child(5),
    .tags-grid .tag-card:nth-child(5) { animation-delay: calc(var(--stagger-base) * 4); }
    .post-feed .post-card:nth-child(6),
    .related-grid .post-card:nth-child(6),
    .tags-grid .tag-card:nth-child(6) { animation-delay: calc(var(--stagger-base) * 5); }
    .post-feed .post-card:nth-child(n+7),
    .related-grid .post-card:nth-child(n+7),
    .tags-grid .tag-card:nth-child(n+7) { animation-delay: calc(var(--stagger-base) * 6); }
}

/* SKIP LINK (a11y) */
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus {
    left: 1rem;
    top: 1rem;
    background: var(--bg);
    padding: 0.5rem;
    border: 2px solid var(--color-brand-500);
    border-radius: var(--radius-sm);
    z-index: 100;
}

/* SELECTION */
::selection {
    background: var(--color-brand-100);
    color: var(--color-neutral-900);
}
