/* devutilites — tema de Ghost limpio para tecnología y programación.
   Estructura y calma de Journal + tarjetas y colores por tema de Ruby.
   Sin paso de compilación: este fichero se sirve tal cual. */

/* 1. Tokens
   ------------------------------------------------------------------ */

:root {
    --accent: var(--ghost-accent-color, #3b6cf6);
    --tag-color: var(--accent);

    --bg: #ffffff;
    --surface: #f6f7f9;
    --surface-2: #eef0f3;
    --text: #15171a;
    --text-2: #3d434b;
    --muted: #6b727c;
    --border: #e4e7eb;
    --code-bg: #f5f6f8;
    --code-text: #1f2328;
    --shadow: 0 1px 2px rgb(16 24 40 / 0.04), 0 4px 16px rgb(16 24 40 / 0.06);
    --is-dark: 0;

    --tok-comment: #6e7781;
    --tok-keyword: #cf222e;
    --tok-string: #0a3069;
    --tok-number: #0550ae;
    --tok-function: #8250df;
    --tok-type: #953800;
    --tok-punct: #57606a;

    --font-sans: var(--gh-font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
    --font-heading: var(--gh-font-heading, var(--font-sans));
    --font-mono: ui-monospace, "JetBrains Mono", "Cascadia Code", SFMono-Regular, Menlo, Consolas, monospace;

    --radius: 12px;
    --radius-sm: 8px;
    --content-width: 1000px;
    --site-width: 1320px;
    --gutter: clamp(16px, 4vw, 32px);
    --head-height: 64px;

    color-scheme: light;
}

:root[data-theme="dark"],
:root[data-scheme="dark"]:not([data-theme="light"]) {
    --bg: #0e1014;
    --surface: #161920;
    --surface-2: #1d2129;
    --text: #e9ebee;
    --text-2: #c3c8cf;
    --muted: #8f97a3;
    --border: #262b33;
    --code-bg: #12151b;
    --code-text: #e6edf3;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 20px rgb(0 0 0 / 0.25);
    --is-dark: 1;

    --tok-comment: #8b949e;
    --tok-keyword: #ff7b72;
    --tok-string: #a5d6ff;
    --tok-number: #79c0ff;
    --tok-function: #d2a8ff;
    --tok-type: #ffa657;
    --tok-punct: #9da7b3;

    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root[data-scheme="auto"]:not([data-theme="light"]) {
        --bg: #0e1014;
        --surface: #161920;
        --surface-2: #1d2129;
        --text: #e9ebee;
        --text-2: #c3c8cf;
        --muted: #8f97a3;
        --border: #262b33;
        --code-bg: #12151b;
        --code-text: #e6edf3;
        --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 20px rgb(0 0 0 / 0.25);
        --is-dark: 1;

        --tok-comment: #8b949e;
        --tok-keyword: #ff7b72;
        --tok-string: #a5d6ff;
        --tok-number: #79c0ff;
        --tok-function: #d2a8ff;
        --tok-type: #ffa657;
        --tok-punct: #9da7b3;

        color-scheme: dark;
    }
}

/* 2. Base
   ------------------------------------------------------------------ */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--head-height) + 16px);
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img,
video,
iframe {
    max-width: 100%;
}

img {
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    font-family: var(--font-heading);
    line-height: 1.2;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

p {
    margin: 0;
}

button {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

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

.main {
    flex-grow: 1;
    padding-bottom: 96px;
}

.container {
    width: 100%;
    max-width: calc(var(--site-width) + var(--gutter) * 2);
    padding-inline: var(--gutter);
    margin-inline: auto;
}

/* 3. Botones, etiquetas y chips
   ------------------------------------------------------------------ */

.btn {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 16px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    cursor: pointer;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: border-color 0.15s, background 0.15s;
}

.btn:hover {
    border-color: var(--muted);
}

.btn-primary {
    color: #fff;
    background: var(--accent);
    border-color: transparent;
}

.btn-primary:hover {
    border-color: transparent;
    filter: brightness(1.08);
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    color: var(--text-2);
    cursor: pointer;
    background: transparent;
    border: 0;
    border-radius: 999px;
}

.icon-btn:hover {
    color: var(--text);
    background: var(--surface);
}

.tag-label {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--tag-color);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tag-label::before {
    width: 8px;
    height: 8px;
    content: "";
    background: var(--tag-color);
    border-radius: 2px;
}

.section-title {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.section-title::after {
    flex-grow: 1;
    height: 1px;
    content: "";
    background: var(--border);
}

.eyebrow {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    height: 36px;
    padding: 0 14px;
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: border-color 0.15s, transform 0.15s;
}

.chip:hover {
    border-color: var(--tag-color);
}

.chip-dot {
    display: inline-block;
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    background: var(--tag-color);
    border-radius: 3px;
}

.chip-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.chip-all {
    color: var(--muted);
    background: transparent;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--muted);
}

.meta-item + .meta-item::before {
    margin: 0 8px;
    content: "·";
}

.meta a:hover {
    color: var(--text);
}

.meta-members {
    font-weight: 600;
    color: var(--accent);
}

/* 4. Cabecera y pie
   ------------------------------------------------------------------ */

.site-head {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    border-bottom: 1px solid var(--border);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    backdrop-filter: saturate(1.4) blur(10px);
}

.site-head-inner {
    display: flex;
    gap: 24px;
    align-items: center;
    height: var(--head-height);
}

.site-logo {
    display: inline-flex;
    flex-shrink: 0;
    gap: 10px;
    align-items: center;
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.site-logo img {
    max-height: 36px;
}

.site-logo-mark {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    background: var(--accent);
    border-radius: 8px;
}

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

.site-nav .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.site-nav .nav a {
    display: block;
    padding: 6px 12px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-2);
    border-radius: 999px;
}

.site-nav .nav a:hover {
    color: var(--text);
    background: var(--surface);
}

.site-nav .nav-current a {
    color: var(--text);
    background: var(--surface);
}

.site-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-left: auto;
}

.site-subscribe {
    margin-left: 8px;
}

.icon-sun {
    display: none;
}

:root[data-theme="dark"] .icon-sun,
:root[data-scheme="dark"]:not([data-theme="light"]) .icon-sun {
    display: block;
}

:root[data-theme="dark"] .icon-moon,
:root[data-scheme="dark"]:not([data-theme="light"]) .icon-moon {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root[data-scheme="auto"]:not([data-theme="light"]) .icon-sun {
        display: block;
    }

    :root[data-scheme="auto"]:not([data-theme="light"]) .icon-moon {
        display: none;
    }
}

.burger {
    display: none;
}

.burger span,
.burger span::before {
    position: relative;
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.2s;
}

.burger span::before {
    position: absolute;
    top: 6px;
    content: "";
}

.burger span {
    top: -3px;
}

.nav-open .burger span {
    top: 0;
    transform: rotate(45deg);
}

.nav-open .burger span::before {
    top: 0;
    transform: rotate(-90deg);
}

@media (max-width: 767px) {
    .burger {
        display: inline-grid;
    }

    .site-subscribe {
        display: none;
    }

    .site-nav {
        position: absolute;
        top: var(--head-height);
        right: 0;
        left: 0;
        display: none;
        padding: 12px var(--gutter) 20px;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
    }

    .nav-open .site-nav {
        display: block;
    }

    .site-nav .nav {
        flex-direction: column;
    }

    .site-nav .nav a {
        padding: 10px 12px;
        font-size: 1.0625rem;
    }
}

.site-foot {
    padding: 48px 0 40px;
    font-size: 0.875rem;
    color: var(--muted);
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.site-foot-inner {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px 48px;
}

.site-foot-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
}

.site-foot-brand p {
    max-width: 480px;
    margin-top: 6px;
}

.site-foot-nav .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    justify-content: flex-end;
    padding: 0;
    margin: 0;
    list-style: none;
}

.site-foot a:hover {
    color: var(--text);
}

.site-foot-meta {
    display: flex;
    flex-wrap: wrap;
    grid-column: 1 / -1;
    gap: 8px 24px;
    justify-content: space-between;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.site-foot-meta a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

@media (max-width: 767px) {
    .site-foot-inner {
        grid-template-columns: 1fr;
    }

    .site-foot-nav .nav {
        justify-content: flex-start;
    }
}

/* 5. Portada
   ------------------------------------------------------------------ */

.intro {
    padding-top: 56px;
}

.intro-title {
    max-width: 820px;
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 48px;
    padding-top: 48px;
}

.hero-link {
    display: block;
}

.hero-media {
    margin: 0 0 24px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: var(--surface);
    border-radius: var(--radius);
}

.hero-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.hero-link:hover .hero-media img {
    transform: scale(1.02);
}

.hero-title {
    font-size: clamp(1.75rem, 3.4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.025em;
}

.hero-link:hover .hero-title {
    color: var(--tag-color);
}

.hero-excerpt {
    margin: 14px 0 16px;
    font-size: 1.125rem;
    line-height: 1.55;
    color: var(--text-2);
}

.mini-list {
    padding: 0;
    margin: 0;
    list-style: none;
    counter-reset: mini;
}

.mini {
    display: grid;
    gap: 6px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
}

.mini:first-child {
    padding-top: 0;
    border-top: 0;
}

.mini-title {
    font-family: var(--font-heading);
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.3;
}

.mini-title:hover {
    color: var(--tag-color);
}

.mini-date {
    font-size: 0.8125rem;
    color: var(--muted);
}

.topics-bar {
    padding-top: 72px;
}

.topic-section {
    padding-top: 72px;
}

.topic-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 24px;
    align-items: end;
    padding-top: 16px;
    margin-bottom: 24px;
    border-top: 3px solid var(--tag-color);
}

.topic-title {
    font-size: 1.5rem;
    font-weight: 800;
}

.topic-title a:hover {
    color: var(--tag-color);
}

.topic-description {
    grid-row: 2;
    color: var(--muted);
}

.topic-more {
    display: inline-flex;
    grid-row: 1 / span 2;
    grid-column: 2;
    gap: 6px;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--tag-color);
    white-space: nowrap;
}

.topic-more:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.archive {
    padding-top: 72px;
}

@media (max-width: 959px) {
    .hero {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

/* 6. Tarjetas (rejilla) y filas (lista)
   ------------------------------------------------------------------ */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.card {
    overflow: hidden;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.card:hover {
    border-color: color-mix(in srgb, var(--tag-color) 50%, var(--border));
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-media {
    margin: 0;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: var(--surface);
}

.card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 10px;
    padding: 20px;
    border-top: 3px solid var(--tag-color);
}

.card-media + .card-body {
    border-top-width: 0;
}

.card-title {
    font-size: 1.1875rem;
    font-weight: 700;
    line-height: 1.3;
}

.card-excerpt {
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--text-2);
}

.card .meta {
    margin-top: auto;
    padding-top: 6px;
}

.rows {
    display: grid;
}

.row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 24px;
    padding: 28px 0;
    border-top: 1px solid var(--border);
}

.row:first-child {
    border-top: 0;
    padding-top: 0;
}

.row-date {
    padding-top: 4px;
    font-size: 0.8125rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.row-title {
    font-size: 1.375rem;
    font-weight: 700;
}

.row-title a:hover {
    color: var(--tag-color);
}

.row-excerpt {
    margin-top: 8px;
    color: var(--text-2);
}

.row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    margin-top: 12px;
    font-size: 0.8125rem;
    color: var(--muted);
}

@media (max-width: 599px) {
    .row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

/* 7. Páginas de listado (tema, autor, temas)
   ------------------------------------------------------------------ */

.page-head {
    max-width: 760px;
    padding: 56px 0 40px;
}

.page-title {
    display: flex;
    gap: 14px;
    align-items: center;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.page-title .chip-dot {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.page-description {
    margin-top: 12px;
    font-size: 1.125rem;
    color: var(--text-2);
}

.topic-page-head .eyebrow a:hover {
    color: var(--text);
}

.grid-first {
    margin-bottom: 48px;
}

.author-head {
    display: flex;
    gap: 24px;
    align-items: center;
}

.author-image {
    width: 88px;
    height: 88px;
    object-fit: cover;
    border-radius: 50%;
}

.author-links {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--muted);
}

.author-links a {
    color: var(--accent);
}

.topic-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.topic-card {
    display: flex;
    flex-direction: column;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--tag-color);
    border-radius: var(--radius);
}

.topic-card header {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.topic-card-title {
    font-size: 1.25rem;
    font-weight: 800;
}

.topic-card-title a {
    display: inline-flex;
    gap: 10px;
    align-items: center;
}

.topic-card-title a:hover {
    color: var(--tag-color);
}

.topic-card-description {
    margin-top: 8px;
    font-size: 0.9375rem;
    color: var(--muted);
}

.topic-card-list {
    flex-grow: 1;
    padding: 0;
    margin: 16px 0;
    list-style: none;
}

.topic-card-list li {
    padding: 8px 0;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.4;
    border-top: 1px solid var(--border);
}

.topic-card-list a:hover {
    color: var(--tag-color);
}

.pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
    margin-top: 48px;
}

.pagination .btn:last-child {
    justify-self: end;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--muted);
}

.error-page {
    padding-top: 80px;
}

.error-code {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
}

.error-page .page-title {
    margin: 8px 0 24px;
}

.error-page .section-title {
    margin-top: 64px;
}

/* 8. Artículo
   ------------------------------------------------------------------ */

.canvas {
    display: grid;
    grid-template-columns:
        [full-start] minmax(var(--gutter), 1fr)
        [wide-start] minmax(0, 120px)
        [main-start] min(var(--content-width), calc(100% - var(--gutter) * 2))
        [main-end] minmax(0, 120px)
        [wide-end] minmax(var(--gutter), 1fr)
        [full-end];
}

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

/* Las imágenes "anchas" ocupan lo mismo que el texto, para que todo quede alineado */
.canvas > .kg-width-wide,
.gh-content > .kg-width-wide {
    grid-column: main-start / main-end;
}

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

.kg-width-full img {
    width: 100%;
}

.progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    width: 100%;
    height: 3px;
    pointer-events: none;
}

.progress span {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--tag-color, var(--accent));
    transform: scaleX(0);
    transform-origin: 0 50%;
}

.article-head {
    padding-top: 56px;
    padding-bottom: 32px;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-bottom: 18px;
}

.article-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.03em;
}

.article-excerpt {
    margin-top: 16px;
    font-size: 1.25rem;
    line-height: 1.5;
    color: var(--text-2);
}

.article-meta {
    margin-top: 24px;
    font-size: 0.875rem;
}

.article-meta a {
    font-weight: 600;
    color: var(--text);
}

.article-image {
    margin: 0 0 40px;
}

.article-image img {
    display: block;
    width: 100%;
    border-radius: var(--radius);
}

.article-image figcaption,
.gh-content figcaption {
    margin-top: 10px;
    font-size: 0.875rem;
    color: var(--muted);
    text-align: center;
}

.toc-wrap {
    margin-bottom: 32px;
}

.toc-wrap[hidden] {
    display: none;
}

.toc summary {
    padding: 12px 16px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.toc[open] summary {
    border-bottom-color: transparent;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.toc ol {
    padding: 4px 16px 14px 36px;
    margin: 0;
    font-size: 0.9375rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.toc li {
    padding: 3px 0;
}

.toc li.toc-sub {
    margin-left: 18px;
    font-size: 0.875rem;
    list-style: circle;
}

.toc a {
    color: var(--text-2);
}

.toc a:hover,
.toc a.is-active {
    color: var(--tag-color);
}

/* Contenido del editor */

.gh-content {
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--text);
    word-break: break-word;
}

.gh-content > * + * {
    margin-top: 1.25em;
    margin-bottom: 0;
}

.gh-content > h2 {
    margin-top: 2em;
    font-size: 1.75rem;
    font-weight: 800;
}

.gh-content > h3 {
    margin-top: 1.6em;
    font-size: 1.375rem;
    font-weight: 700;
}

.gh-content > h4 {
    margin-top: 1.4em;
    font-size: 1.125rem;
    font-weight: 700;
}

.gh-content > :first-child {
    margin-top: 0;
}

.gh-content > h2 + *,
.gh-content > h3 + *,
.gh-content > h4 + * {
    margin-top: 0.6em;
}

.gh-content a:not(.kg-btn):not([class*="kg-"] a) {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.gh-content a:not(.kg-btn):hover {
    text-decoration-thickness: 2px;
}

.gh-content strong {
    font-weight: 700;
}

.gh-content ul,
.gh-content ol {
    padding-left: 1.4em;
}

.gh-content li + li {
    margin-top: 0.4em;
}

.gh-content li::marker {
    color: var(--muted);
}

.gh-content blockquote:not([class]) {
    padding-left: 20px;
    margin-left: 0;
    margin-right: 0;
    font-style: italic;
    color: var(--text-2);
    border-left: 3px solid var(--tag-color);
}

.gh-content hr {
    width: 100%;
    height: 1px;
    margin-block: 2.5em;
    background: var(--border);
    border: 0;
}

.gh-content table:not([class]) {
    display: block;
    width: 100%;
    overflow-x: auto;
    font-size: 0.9375rem;
    word-break: normal;
    overflow-wrap: normal;
    border-collapse: collapse;
}

.gh-content table:not([class]) th,
.gh-content table:not([class]) td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.gh-content table:not([class]) th {
    font-weight: 700;
    background: var(--surface);
}

.gh-content figure {
    margin-inline: 0;
}

.gh-content img {
    border-radius: var(--radius-sm);
}

.gh-content .kg-width-full img {
    border-radius: 0;
}

/* Código */

.gh-content :not(pre) > code {
    padding: 0.15em 0.4em;
    font-family: var(--font-mono);
    font-size: 0.88em;
    color: var(--code-text);
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.gh-content pre {
    position: relative;
    padding: 18px 20px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--code-text);
    tab-size: 4;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.gh-content pre code {
    font-family: inherit;
    background: none;
}

.code-block {
    position: relative;
}

.gh-content > .code-block {
    margin-top: 1.25em;
}

.code-block pre {
    margin: 0;
    padding-top: 40px;
}

.code-bar {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 32px;
    padding: 0 8px 0 16px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: lowercase;
    border-bottom: 1px solid var(--border);
}

.code-copy {
    height: 24px;
    padding: 0 10px;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
}

.code-copy:hover {
    color: var(--text);
    border-color: var(--border);
}

.code-copy.is-copied {
    color: var(--accent);
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    font-style: italic;
    color: var(--tok-comment);
}

.token.keyword,
.token.important,
.token.atrule,
.token.rule,
.token.selector,
.token.tag,
.token.deleted {
    color: var(--tok-keyword);
}

.token.string,
.token.char,
.token.attr-value,
.token.regex,
.token.url,
.token.inserted {
    color: var(--tok-string);
}

.token.number,
.token.boolean,
.token.constant,
.token.symbol,
.token.variable {
    color: var(--tok-number);
}

.token.function,
.token.attr-name,
.token.property {
    color: var(--tok-function);
}

.token.class-name,
.token.builtin,
.token.namespace {
    color: var(--tok-type);
}

.token.punctuation,
.token.operator {
    color: var(--tok-punct);
}

/* Pie del artículo */

.article-foot {
    padding-top: 48px;
}

.share-btn {
    justify-self: start;
    width: max-content;
}

.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 32px;
}

.post-nav-link {
    display: grid;
    gap: 6px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s;
}

.post-nav-link:hover {
    border-color: var(--tag-color);
}

.post-nav-next {
    grid-column: 2;
    text-align: right;
}

.post-nav-label {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.post-nav-next .post-nav-label {
    justify-content: flex-end;
}

.post-nav-title {
    font-weight: 700;
    line-height: 1.35;
}

@media (max-width: 599px) {
    .post-nav {
        grid-template-columns: 1fr;
    }

    .post-nav-next {
        grid-column: 1;
    }
}

.comments {
    padding-top: 48px;
}

.related {
    padding-top: 80px;
}

/* 9. Tarjetas del editor de Ghost (el resto lo aporta card_assets) */

.kg-card + .kg-card {
    margin-top: 1.25em;
}

.kg-bookmark-card a.kg-bookmark-container,
.kg-bookmark-card a.kg-bookmark-container:hover {
    color: var(--text) !important;
    text-decoration: none !important;
    background: var(--surface);
    border-color: var(--border);
}

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

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