/* ==========================================================================
   jordiros.online — tema Ghost a medida
   Índice
   1. Tokens          6. Portada            11. Sobre mí y Contacto
   2. Base            7. Lista de artículos 12. Pie
   3. Utilidades      8. Artículo           13. Error y vacío
   4. Botones/forms   9. Contenido Ghost    14. Responsive, movimiento, impresión
   5. Cabecera       10. Archivo (tag/autor)
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
    --bg: #F6F6F3;
    --surface: #FFFFFF;
    --surface-2: #EDEEE9;
    --ink: #161B26;
    --ink-2: #353D4B;
    --muted: #5B6372;
    --line: #DADCD6;
    --line-strong: #C3C6BE;
    --accent: #2B4BD8;
    --accent-ink: #FFFFFF;
    --accent-soft: #E4E8FB;
    --accent-text: #2440C2;
    --brand-tile: #2B4BD8;
    --brand-letters: #F6F6F3;
    --success: #1C7A4E;
    --danger: #B42318;

    --font-ui: var(--gh-font-heading, "Bricolage Grotesque"), ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-read: var(--gh-font-body, "Source Serif 4"), Georgia, "Times New Roman", serif;

    --step--1: clamp(0.84rem, 0.82rem + 0.1vw, 0.9rem);
    --step-0: 1rem;
    --step-1: clamp(1.13rem, 1.08rem + 0.25vw, 1.25rem);
    --step-2: clamp(1.35rem, 1.25rem + 0.5vw, 1.6rem);
    --step-3: clamp(1.7rem, 1.5rem + 1vw, 2.25rem);
    --step-4: clamp(2.1rem, 1.7rem + 2vw, 3.2rem);
    --step-5: clamp(2.5rem, 1.8rem + 3.6vw, 4.75rem);

    --measure: 40rem;
    --container: 76rem;
    --gutter: clamp(1rem, 4vw, 2.5rem);
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 22px;
    --header-h: 4.25rem;
    --ease: cubic-bezier(.2, .7, .2, 1);
}

:root[data-theme="dark"] {
    --bg: #12151C;
    --surface: #1A1F29;
    --surface-2: #222836;
    --ink: #E8EAEE;
    --ink-2: #C9CED7;
    --muted: #9AA2B0;
    --line: #2C3342;
    --line-strong: #3B4457;
    --accent: #8FA3FF;
    --accent-ink: #0E1430;
    --accent-soft: #232C4D;
    --accent-text: #A9B8FF;
    --success: #5BD39A;
    --danger: #FF8A80;
    color-scheme: dark;
}

/* Sin JavaScript: respeta la preferencia del sistema */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg: #12151C; --surface: #1A1F29; --surface-2: #222836; --ink: #E8EAEE; --ink-2: #C9CED7;
        --muted: #9AA2B0; --line: #2C3342; --line-strong: #3B4457; --accent: #8FA3FF; --accent-ink: #0E1430;
        --accent-soft: #232C4D; --accent-text: #A9B8FF; --success: #5BD39A; --danger: #FF8A80;
        color-scheme: dark;
    }
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1.5rem); }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: var(--step-0);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.site-main { flex: 1 0 auto; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 700; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* 3. Utilidades ------------------------------------------------------------ */
.container { width: min(var(--container), 100% - var(--gutter) * 2); margin-inline: auto; }
.container-narrow { width: min(var(--measure), 100% - var(--gutter) * 2); margin-inline: auto; }
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: 1rem; top: -4rem; z-index: 100;
    background: var(--accent); color: var(--accent-ink); padding: .6rem 1rem; border-radius: var(--radius-sm);
    text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 1rem; }
.section-title { font-size: var(--step-2); letter-spacing: -0.015em; margin-bottom: 1.25rem; }
.badge {
    display: inline-block; font-size: var(--step--1); font-weight: 600; padding: .1rem .55rem;
    border-radius: 99px; background: var(--accent-soft); color: var(--accent-text);
}
.tag-link {
    position: relative; z-index: 1;
    font-size: var(--step--1); font-weight: 600; color: var(--accent-text); text-decoration: none;
}
.tag-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.avatar-lg { width: 72px; height: 72px; }
.avatar-xl { width: 96px; height: 96px; }

/* Logo */
.logo-mark { flex: none; }
.logo-mark-tile { fill: var(--brand-tile); }
.logo-mark-letters { stroke: var(--brand-letters); }

/* 4. Botones y formularios ------------------------------------------------- */
.btn {
    --btn-bg: transparent; --btn-fg: var(--ink); --btn-line: var(--line-strong);
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: 2.75rem; padding: .55rem 1.15rem;
    border: 1.5px solid var(--btn-line); border-radius: 99px;
    background: var(--btn-bg); color: var(--btn-fg);
    font-weight: 600; font-size: .975rem; line-height: 1.1; text-decoration: none; white-space: nowrap;
    cursor: pointer; transition: background-color .15s, border-color .15s, color .15s, transform .15s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { --btn-bg: var(--accent); --btn-fg: var(--accent-ink); --btn-line: var(--accent); }
.btn-primary:hover { --btn-bg: color-mix(in srgb, var(--accent) 86%, var(--ink)); --btn-line: var(--btn-bg); }
.btn-ghost:hover { --btn-line: var(--ink); }
.btn-sm { min-height: 2.35rem; padding: .4rem .95rem; font-size: .925rem; }
.btn-lg { min-height: 3.1rem; padding: .7rem 1.5rem; font-size: 1.025rem; }
.btn-loading { display: none; }
.loading .btn-label { display: none; }
.loading .btn-loading { display: inline; }

.icon-btn {
    display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem;
    border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer;
    transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

input[type="email"], input[type="text"], textarea {
    width: 100%; min-height: 2.9rem; padding: .7rem .95rem;
    background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 9rem; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.subscribe-form { width: 100%; max-width: 30rem; }
.subscribe-field {
    display: flex; gap: .35rem; padding: .3rem;
    background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 99px;
    transition: border-color .15s, box-shadow .15s;
}
.subscribe-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.subscribe-field input { border: 0; background: transparent; min-height: 2.6rem; padding: .4rem .9rem; box-shadow: none; }
.subscribe-field input:focus { box-shadow: none; }
.subscribe-field .btn { flex: none; min-height: 2.6rem; }
.form-note { margin-top: .6rem; font-size: var(--step--1); color: var(--muted); }
.form-note a, .consent a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.form-note a:hover, .consent a:hover { color: var(--accent-text); }
.form-msg { display: none; margin-top: .6rem; font-size: .95rem; font-weight: 500; }
.form-success { color: var(--success); }
.form-error { color: var(--danger); }
form.success .form-success, form.error .form-error { display: block; }
form.success .form-note { display: none; }
form.success .subscribe-field { opacity: .55; pointer-events: none; }

/* 5. Cabecera -------------------------------------------------------------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    border-bottom: 1px solid transparent; transition: border-color .2s;
}
/* El desenfoque va en una capa propia: si estuviera en la cabecera,
   el panel fijo del menú móvil quedaría encerrado dentro de ella. */
.site-header::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
}
.nav-open .site-header::before { background: var(--bg); }
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; gap: 1.5rem; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); }
.brand-name { font-weight: 700; font-size: 1.125rem; letter-spacing: -0.02em; }
.site-nav { margin-left: auto; }
.site-nav .nav { display: flex; gap: .25rem; list-style: none; }
.site-nav .nav a {
    display: block; padding: .45rem .8rem; border-radius: 99px;
    color: var(--ink-2); text-decoration: none; font-weight: 500;
    transition: background-color .15s, color .15s;
}
.site-nav .nav a:hover { color: var(--ink); background: var(--surface-2); }
.site-nav .nav-current a { color: var(--ink); background: var(--surface-2); }
.site-nav-member { display: none; }
.header-actions { display: flex; align-items: center; gap: .15rem; }
.header-cta { margin-left: .5rem; }
.menu-toggle { display: none; }
.menu-icon-close { display: none; }
.theme-icon { display: grid; }
:root[data-theme="dark"] .theme-icon-moon, :root:not([data-theme="dark"]) .theme-icon-sun { display: none; }

/* Barra de progreso de lectura (el único movimiento continuo del sitio) */
.reading-progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: 60; pointer-events: none; }
.reading-progress-bar {
    display: block; height: 100%; width: 100%; background: var(--accent);
    transform-origin: 0 50%; transform: scaleX(var(--progress, 0));
}

/* 6. Portada --------------------------------------------------------------- */
.hero {
    display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 2.5rem 4rem; align-items: end;
    padding-block: clamp(3rem, 8vw, 6.5rem) clamp(2.5rem, 5vw, 4rem);
}
.hero-title {
    font-size: var(--step-5); font-weight: 800; line-height: 1.02; letter-spacing: -0.04em;
    max-width: 17ch;
}
.hero-side { display: grid; gap: 1.25rem; padding-bottom: .4rem; }
.hero-intro { font-size: var(--step-1); color: var(--ink-2); line-height: 1.5; max-width: 34ch; }

.topics {
    display: flex; align-items: baseline; gap: 1rem;
    padding-block: 1.1rem; border-top: 1px solid var(--line);
}
.topics-label { flex: none; font-size: var(--step--1); color: var(--muted); font-weight: 600; }
.topics-list { display: flex; flex-wrap: wrap; gap: .45rem; list-style: none; }
.topics-list a {
    display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .8rem;
    border: 1px solid var(--line-strong); border-radius: 99px;
    font-size: .925rem; font-weight: 500; text-decoration: none; color: var(--ink-2);
    transition: border-color .15s, color .15s;
}
.topics-list a:hover { border-color: var(--accent); color: var(--accent-text); }
.topics-count { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 7. Lista de artículos ---------------------------------------------------- */
.post-feed { padding-bottom: clamp(3rem, 7vw, 5rem); }
.feed { border-top: 1px solid var(--line); }

.post-row {
    position: relative;
    display: grid; grid-template-columns: 8.5rem minmax(0, 1fr) 13.75rem; gap: 2rem;
    padding-block: 1.9rem; border-bottom: 1px solid var(--line);
}
.post-row:not(.has-image) { grid-template-columns: 8.5rem minmax(0, 1fr); }
.post-row-date {
    padding-top: .3rem; font-size: var(--step--1); color: var(--muted);
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
.post-row-body { display: flex; flex-direction: column; align-items: flex-start; gap: .45rem; max-width: 44rem; }
.post-row-title { font-size: var(--step-2); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.post-row-title a { text-decoration: none; }
.post-row-excerpt { font-family: var(--font-read); color: var(--ink-2); font-size: 1.05rem; line-height: 1.55; }
.post-row-meta { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; font-size: var(--step--1); color: var(--muted); margin-top: .2rem; }
.post-row-media { align-self: start; }
.post-row-media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); background: var(--surface-2); }

.stretched-link::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.post-row:hover .post-row-title a, .post-lead:hover .post-lead-title a {
    color: var(--accent-text); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px;
}
.post-row:has(.stretched-link:focus-visible) { outline: 2.5px solid var(--accent); outline-offset: 4px; border-radius: var(--radius-sm); }
.stretched-link:focus-visible { outline: none; }

.post-lead {
    position: relative;
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center;
    padding-block: 2.25rem; border-bottom: 1px solid var(--line);
}
.post-lead:not(.has-image) { grid-template-columns: minmax(0, 1fr); }
.post-lead-media img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--radius-lg); background: var(--surface-2); }
.post-lead-body { display: flex; flex-direction: column; align-items: flex-start; gap: .8rem; }
.post-lead-kicker { font-size: var(--step--1); color: var(--muted); font-weight: 500; }
.post-lead-title { font-size: var(--step-4); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.post-lead-title a { text-decoration: none; }
.post-lead-excerpt { font-family: var(--font-read); font-size: var(--step-1); color: var(--ink-2); line-height: 1.55; max-width: 38ch; }

.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; margin-top: 2.5rem; }
.pagination > :last-child { justify-self: end; }
.pagination-info { font-size: var(--step--1); color: var(--muted); }

/* 8. Artículo -------------------------------------------------------------- */
.article { padding-top: clamp(2.5rem, 6vw, 4.5rem); }
.article-header { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; margin-bottom: 2.5rem; }
.article-title { font-size: var(--step-4); font-weight: 800; letter-spacing: -0.035em; line-height: 1.06; }
.article-excerpt { font-family: var(--font-read); font-size: var(--step-1); color: var(--ink-2); line-height: 1.5; }
.article-byline { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; margin-top: .5rem; font-size: .95rem; }
.byline-author { display: inline-flex; align-items: center; gap: .6rem; font-weight: 600; text-decoration: none; position: relative; }
.byline-author:hover span { text-decoration: underline; text-underline-offset: 3px; }
.byline-meta { display: flex; gap: 1rem; color: var(--muted); }

.article-image { width: min(70rem, 100% - var(--gutter) * 2); margin: 0 auto 3rem; }
.article-image img { width: 100%; border-radius: var(--radius-lg); }
.article-image figcaption, .gh-content figcaption {
    margin-top: .75rem; font-size: var(--step--1); color: var(--muted); text-align: center;
}

.article-layout {
    --main: min(var(--measure), 100% - var(--gutter) * 2);
    display: grid;
    grid-template-columns:
        [full-start] minmax(var(--gutter), 1fr)
        [wide-start] minmax(0, 8rem)
        [main-start] var(--main) [main-end]
        minmax(0, 8rem) [wide-end]
        minmax(var(--gutter), 1fr) [full-end];
}
.article-layout > .gh-content { grid-column: full; grid-row: 1; display: grid; grid-template-columns: subgrid; }

.toc { display: none; }
@media (min-width: 1400px) {
    .toc:not([hidden]) {
        display: block; grid-column: full-start / wide-start; grid-row: 1; z-index: 1;
        position: sticky; top: calc(var(--header-h) + 2rem); align-self: start;
        justify-self: end; width: min(15rem, 100% - 2.5rem); margin-right: 2.5rem;
        max-height: calc(100vh - var(--header-h) - 4rem); overflow: auto;
    }
}
.toc-title { font-size: var(--step--1); font-weight: 700; color: var(--ink); margin-bottom: .75rem; }
.toc-list { list-style: none; border-left: 1.5px solid var(--line); }
.toc-list li.toc-h3 { padding-left: .85rem; }
.toc-list a {
    display: block; margin-left: -1.5px; padding: .3rem 0 .3rem .9rem; border-left: 1.5px solid transparent;
    font-size: .9rem; line-height: 1.35; color: var(--muted); text-decoration: none;
}
.toc-list a:hover { color: var(--ink); }
.toc-list a.is-active { color: var(--accent-text); border-left-color: var(--accent); font-weight: 600; }

.article-footer { display: grid; gap: 2rem; margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.share-label { font-weight: 600; margin-right: .5rem; }
.share-btn {
    display: inline-flex; align-items: center; gap: .45rem; height: 2.5rem; min-width: 2.5rem; padding: 0 .75rem;
    justify-content: center; border: 1.5px solid var(--line-strong); border-radius: 99px;
    background: transparent; color: var(--ink-2); font-size: .925rem; font-weight: 500; text-decoration: none; cursor: pointer;
    transition: border-color .15s, color .15s;
}
.share-btn:hover { border-color: var(--ink); color: var(--ink); }
.share-btn.is-copied { border-color: var(--success); color: var(--success); }
.article-tags { display: flex; flex-wrap: wrap; gap: .45rem; list-style: none; }
.article-tags a {
    display: inline-block; padding: .25rem .75rem; border-radius: 99px; background: var(--surface-2);
    font-size: .9rem; text-decoration: none; color: var(--ink-2);
}
.article-tags a:hover { color: var(--accent-text); }
.author-card {
    display: flex; gap: 1.25rem; align-items: flex-start; padding: 1.5rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.author-card-name { font-size: var(--step-1); }
.author-card-name a { text-decoration: none; }
.author-card-name a:hover { color: var(--accent-text); }
.author-card-bio { margin-top: .35rem; color: var(--ink-2); font-family: var(--font-read); }

.newsletter-cta { margin-block: 4rem; }
.newsletter-cta-inner {
    display: grid; grid-template-columns: auto 1fr; gap: 1.5rem; padding: clamp(1.5rem, 4vw, 2.5rem);
    border-radius: var(--radius-lg); background: var(--accent-soft);
}
.newsletter-cta-inner .logo-mark { width: 52px; height: 52px; }
.newsletter-cta-title { font-size: var(--step-2); letter-spacing: -0.02em; }
.newsletter-cta-text { margin: .5rem 0 1.25rem; color: var(--ink-2); font-family: var(--font-read); font-size: 1.075rem; }
.newsletter-cta .subscribe-field { background: var(--bg); }

.comments { margin-block: 3rem; }
.related { padding-block: 3rem 5rem; }
.related .post-row-title { font-size: var(--step-1); }

/* 9. Contenido Ghost (editor y tarjetas) ----------------------------------- */
.gh-content {
    font-family: var(--font-read); font-size: clamp(1.1rem, 1.04rem + 0.25vw, 1.2rem); line-height: 1.72; color: var(--ink);
    font-variant-ligatures: common-ligatures; hanging-punctuation: first;
}
.gh-content > * { grid-column: main; margin-block: 0; min-width: 0; }
.gh-content > * + * { margin-top: 1.5em; }
.gh-content > .kg-width-wide { grid-column: wide; }
.gh-content > .kg-width-full { grid-column: full; position: relative; z-index: 2; }
.gh-content > .kg-width-full img { border-radius: 0; }
.gh-content > h2 + *, .gh-content > h3 + *, .gh-content > h4 + * { margin-top: .8em; }
.gh-content h2, .gh-content h3, .gh-content h4 { font-family: var(--font-ui); letter-spacing: -0.02em; }
.gh-content > h2 { font-size: var(--step-3); margin-top: 2.2em; }
.gh-content > h3 { font-size: var(--step-2); margin-top: 1.9em; }
.gh-content > h4 { font-size: var(--step-1); margin-top: 1.7em; }
.gh-content a { color: var(--accent-text); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.gh-content a:hover { text-decoration-thickness: 2.5px; }
.gh-content strong { font-weight: 600; }
.gh-content ul, .gh-content ol { padding-left: 1.4em; }
.gh-content li + li { margin-top: .45em; }
.gh-content li::marker { color: var(--muted); }
.gh-content hr { border: 0; height: 1px; background: var(--line); margin-block: 3em; }
.gh-content blockquote:not([class]) {
    margin-inline: 0; padding-left: 1.25em; border-left: 3px solid var(--accent); font-style: italic; color: var(--ink-2);
}
.gh-content blockquote.kg-blockquote-alt {
    margin-inline: 0; padding: .5em 0; font-family: var(--font-ui); font-size: var(--step-2); font-weight: 600;
    line-height: 1.3; letter-spacing: -0.02em; text-align: center; font-style: normal;
}
.gh-content code:not(pre code) {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .86em;
    padding: .12em .4em; border-radius: 6px; background: var(--surface-2);
}
.gh-content pre {
    overflow-x: auto; padding: 1.15em 1.3em; border-radius: var(--radius);
    background: #0F1320; color: #E3E7F0; border: 1px solid var(--line);
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .86rem; line-height: 1.65;
}
.gh-content table:not([class]) {
    display: block; overflow-x: auto; border-collapse: collapse; font-family: var(--font-ui); font-size: .95rem; width: 100%;
}
.gh-content table:not([class]) th, .gh-content table:not([class]) td { padding: .6em .9em; border-bottom: 1px solid var(--line); text-align: left; }
.gh-content table:not([class]) th { font-weight: 600; }
.gh-content figure { margin-inline: 0; }
.gh-content .kg-image-card img, .gh-content .kg-gallery-image img { border-radius: var(--radius); }
.gh-content .kg-image { margin-inline: auto; }
.gh-content .kg-callout-card { font-family: var(--font-ui); font-size: 1.025rem; border-radius: var(--radius); }
.gh-content .kg-bookmark-card a.kg-bookmark-container { border-radius: var(--radius); color: var(--ink); background: var(--surface); }
.gh-content .kg-bookmark-title, .gh-content .kg-bookmark-description { font-family: var(--font-ui); }
.gh-content .kg-button-card a.kg-btn { border-radius: 99px; font-family: var(--font-ui); }
.gh-content .kg-toggle-card, .gh-content .kg-product-card-container { border-radius: var(--radius); }
.gh-content .kg-signup-card, .gh-content .kg-header-card { font-family: var(--font-ui); }
.gh-content .kg-embed-card { display: flex; flex-direction: column; align-items: center; }

/* 10. Archivo (etiqueta, autor) ------------------------------------------- */
.archive-header { padding-block: clamp(2.5rem, 7vw, 5rem) 2rem; }
.archive-kicker { font-size: var(--step--1); font-weight: 600; color: var(--accent-text); margin-bottom: .5rem; }
.archive-title { font-size: var(--step-5); font-weight: 800; letter-spacing: -0.04em; line-height: 1.02; }
.archive-description { margin-top: 1rem; max-width: 46ch; font-size: var(--step-1); color: var(--ink-2); }
.archive-count { margin-top: .75rem; color: var(--muted); font-size: .95rem; }
.author-header { display: flex; gap: 1.75rem; align-items: center; }

/* 11. Sobre mí y Contacto --------------------------------------------------- */
.about { padding-bottom: 2rem; }
.about-header {
    display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 5rem); align-items: center;
    padding-block: clamp(3rem, 7vw, 5.5rem) 3.5rem;
}
.about-title { font-size: var(--step-5); font-weight: 800; letter-spacing: -0.04em; line-height: 1.02; }
.about-excerpt { margin-top: 1.25rem; font-size: var(--step-1); color: var(--ink-2); line-height: 1.5; max-width: 36ch; }
.about-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.about-portrait { margin: 0; justify-self: end; width: min(26rem, 100%); }
.about-portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius-lg); }
.about-portrait-placeholder {
    display: grid; place-items: center; aspect-ratio: 4 / 5; border-radius: var(--radius-lg); background: var(--accent-soft);
}
.about-portrait-placeholder .logo-mark { width: 38%; height: auto; }

.contact { padding-block: clamp(3rem, 7vw, 5.5rem) 5rem; }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.contact-content { margin-top: 1.5rem; display: block; font-size: 1.1rem; }
.contact-content > * + * { margin-top: 1em; }
.contact-channels { list-style: none; display: grid; gap: .5rem; margin-top: 2rem; }
.contact-channels a {
    display: inline-flex; align-items: center; gap: .7rem; padding: .5rem 0;
    font-weight: 600; text-decoration: none; color: var(--ink);
}
.contact-channels a svg { color: var(--accent-text); }
.contact-channels a:hover span { text-decoration: underline; text-underline-offset: 3px; }
.contact-form, .contact-fallback {
    display: grid; gap: 1.25rem; padding: clamp(1.5rem, 4vw, 2.25rem);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.contact-fallback p { font-size: var(--step-1); }
.field { display: grid; gap: .45rem; }
.field label { font-weight: 600; font-size: .95rem; }
.field-error { display: none; font-size: .9rem; color: var(--danger); }
.field.is-invalid input, .field.is-invalid textarea { border-color: var(--danger); }
.field.is-invalid .field-error { display: block; }
.consent { display: flex; gap: .7rem; align-items: flex-start; font-size: .925rem; color: var(--ink-2); cursor: pointer; }
.consent input { margin-top: .2rem; width: 1.1rem; height: 1.1rem; accent-color: var(--accent); flex: none; }
.contact-form .btn { justify-self: start; }

/* 12. Pie ------------------------------------------------------------------- */
.site-footer { margin-top: auto; border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.5rem 4rem;
    padding-block: clamp(2.5rem, 6vw, 4rem) 2rem;
}
.footer-description { margin-top: 1rem; max-width: 36ch; color: var(--ink-2); }
.social-links { display: flex; gap: .25rem; list-style: none; margin-top: 1.25rem; margin-left: -.55rem; }
.social-links a { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; color: var(--ink-2); }
.social-links a:hover { background: var(--surface-2); color: var(--ink); }
.footer-heading { font-size: var(--step-1); margin-bottom: 1rem; }
.footer-subscribe .subscribe-field { background: var(--bg); }
.footer-bottom {
    grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem;
    padding-top: 1.5rem; border-top: 1px solid var(--line); font-size: var(--step--1); color: var(--muted);
}
.footer-bottom .nav { display: flex; flex-wrap: wrap; gap: 1.25rem; list-style: none; }
.footer-bottom .nav a { text-decoration: none; }
.footer-bottom .nav a:hover { color: var(--ink); text-decoration: underline; }

/* 13. Error y vacío ---------------------------------------------------------- */
.error-template { justify-content: center; }
.error { display: flex; flex-direction: column; align-items: flex-start; gap: 1.25rem; padding-block: 6rem; max-width: 40rem; }
.error .logo-mark { width: 52px; height: 52px; }
.error-code { font-size: 7rem; font-weight: 800; line-height: .9; letter-spacing: -0.05em; color: var(--accent-text); }
.error-title { font-size: var(--step-4); font-weight: 800; letter-spacing: -0.03em; }
.error-text { font-size: var(--step-1); color: var(--ink-2); }
.empty-state { padding-block: 4rem; }
.empty-state h2 { font-size: var(--step-2); }
.empty-state p { margin-top: .5rem; color: var(--muted); }

/* 14. Responsive ----------------------------------------------------------- */
@media (max-width: 980px) {
    .hero { grid-template-columns: 1fr; }
    .hero-title { max-width: 20ch; }
    .post-lead { grid-template-columns: 1fr; }
    .post-row { grid-template-columns: minmax(0, 1fr) 9rem; gap: .5rem 1.5rem; }
    .post-row:not(.has-image) { grid-template-columns: minmax(0, 1fr); }
    .post-row-date { grid-column: 1; grid-row: 1; padding-top: 0; }
    .post-row-body { grid-column: 1; grid-row: 2; }
    .post-row-media { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
    .about-header, .contact-grid { grid-template-columns: 1fr; }
    .about-portrait { justify-self: start; }
}

@media (max-width: 760px) {
    :root { --header-h: 3.75rem; }
    .menu-toggle { display: inline-grid; }
    .header-cta { display: none; }
    .site-nav {
        position: fixed; inset: var(--header-h) 0 0 0; z-index: 40;
        display: flex; flex-direction: column; gap: 1.5rem; padding: 1.5rem var(--gutter) 2rem;
        background: var(--bg); border-top: 1px solid var(--line);
        visibility: hidden; opacity: 0; transform: translateY(-8px);
        transition: opacity .2s var(--ease), transform .2s var(--ease), visibility 0s .2s;
    }
    .nav-open .site-nav { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
    .nav-open .menu-icon-open { display: none; }
    .nav-open .menu-icon-close { display: grid; }
    .nav-open { overflow: hidden; }
    .site-nav .nav { flex-direction: column; gap: 0; }
    .site-nav .nav a { padding: .9rem 0; border-radius: 0; border-bottom: 1px solid var(--line); font-size: var(--step-2); font-weight: 600; color: var(--ink); background: none; }
    .site-nav .nav-current a { color: var(--accent-text); background: none; }
    .site-nav-member { display: block; }
    .site-nav-member .btn { width: 100%; min-height: 3.1rem; }
    .header-actions { margin-left: auto; }
    .header-inner { gap: .75rem; }

    .topics { flex-direction: column; gap: .6rem; }
    .post-row { grid-template-columns: minmax(0, 1fr) 6rem; padding-block: 1.5rem; }
    .post-row-excerpt { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 1rem; }
    .post-row-media img { aspect-ratio: 1; border-radius: var(--radius-sm); }
    .pagination { grid-template-columns: 1fr; justify-items: center; }
    .pagination > :last-child { justify-self: center; }
    .pagination > span:empty { display: none; }
    .newsletter-cta-inner { grid-template-columns: 1fr; }
    .author-header { flex-direction: column; align-items: flex-start; }
    .footer-inner { grid-template-columns: 1fr; }
    .subscribe-field { flex-direction: column; border-radius: var(--radius); }
    .subscribe-field .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
    .reading-progress { display: none; }
}

@media print {
    .site-header, .site-footer, .reading-progress, .toc, .share, .newsletter-cta, .comments, .related { display: none !important; }
    body { background: #fff; color: #000; }
    .gh-content a::after { content: " (" attr(href) ")"; font-size: .8em; }
}
