@charset "UTF-8";

/* =========================
   Base
   ========================= */
:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f7f9fc;
    --surface-accent: #eef4ff;
    --border: #dfe6f1;
    --border-strong: #cbd6e6;
    --text: #1f2937;
    --text-soft: #5b6678;
    --text-faint: #7b8798;
    --primary: #066af3;
    --primary-dark: #0453c0;
    --primary-soft: #e9f2ff;
    --success: #2e8b57;
    --shadow-sm: 0 6px 18px rgba(20, 38, 63, 0.06);
    --shadow-md: 0 18px 40px rgba(20, 38, 63, 0.09);
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 24px;
    --container: 1380px;
    --content: 860px;
    --sidebar: 320px;
    --transition: 180ms ease;
    --font-sans: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body.article-page {
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(6, 106, 243, 0.06), transparent 30%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.75;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition), opacity var(--transition), transform var(--transition);
}

a:hover,
a:focus-visible {
    color: var(--primary-dark);
}

p,
ul,
ol,
table,
blockquote,
figure {
    margin-top: 0;
}

h1,
h2,
h3,
h4 {
    margin-top: 0;
    color: #0f172a;
    line-height: 1.2;
}

strong {
    color: #0f172a;
}

::selection {
    background: rgba(6, 106, 243, 0.18);
}

/* =========================
   Layout general
   ========================= */
#mainwrapper {
    width: min(var(--container), calc(100% - 28px));
    margin: 18px auto 30px;
}

.site-header {
    margin-bottom: 20px;
}

.site-header__inner {
    background: linear-gradient(135deg, #066af3 0%, #2f7cff 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    box-shadow: var(--shadow-md);
}

.site-logo {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
}

.site-logo img {
    display: block;
    height: auto;
    max-width: min(320px, 100%);
}

.page-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, var(--sidebar));
    gap: 24px;
    align-items: start;
}

.content-main {
    min-width: 0;
}

.article-card,
.sidebar-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(223, 230, 241, 0.9);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.article-card {
    max-width: 100%;
    padding: clamp(20px, 2.5vw, 34px);
}

.sidebar-card {
    padding: 20px;
    position: sticky;
    top: 18px;
}

.site-footer {
    margin-top: 24px;
    padding: 20px 22px;
    text-align: center;
    color: var(--text-soft);
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(223, 230, 241, 0.9);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

/* =========================
   Top article
   ========================= */
.article-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.home-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.94rem;
    color: var(--text-soft);
}

.home-link::before {
    content: "◂";
    color: var(--primary);
    font-size: 0.95rem;
}

.article-title {
    font-size: clamp(2rem, 3vw, 3.1rem);
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    overflow-wrap: anywhere;
}

.postdescription {
    margin: 0 0 18px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(6, 106, 243, 0.08), rgba(6, 106, 243, 0.03));
    border: 1px solid rgba(6, 106, 243, 0.14);
    border-radius: var(--radius-md);
    color: var(--text-soft);
    font-size: 1rem;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    color: var(--text-soft);
    font-size: 0.95rem;
}

.meta-autor {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.meta-autor::before {
    content: "✦";
    color: var(--primary);
}

.meta-fecha {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
    color: var(--text-soft);
}

/* =========================
   Search panels
   ========================= */
.search-panel {
    margin: 22px 0;
    padding: 16px 18px;
    background: linear-gradient(180deg, #f9fbff 0%, #f5f8fd 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.search-panel strong {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 0.98rem;
}

.search-panel--content {
    margin-top: 18px;
}

.search-panel--sidebar {
    margin-top: 0;
}

/* =========================
   Share widget
   ========================= */
.share-widget {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 22px 0;
    padding: 14px;
    min-height: 74px; /* reserva espacio para evitar CLS */
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.share-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    width: 100%;
    min-height: 44px; /* altura mínima de la fila de iconos */
}

.share-button {
    --size: 44px;
    width: var(--size);
    height: var(--size);
    border: none;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), #5a94ff);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(6, 106, 243, 0.22);
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.share-button:hover,
.share-button:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 14px 24px rgba(6, 106, 243, 0.28);
}

.share-list {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.share-link {
    --size: 44px;
    width: var(--size);
    height: var(--size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.share-link:hover,
.share-link:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.16);
}

.share-link svg,
.share-button svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    display: block;
}

.share-link--whatsapp { background-color: #25D366; }
.share-link--facebook { background-color: #1877F2; }
.share-link--twitter  { background-color: #111111; }
.share-link--email    { background-color: #5f7280; }

/* =========================
   Cuerpo del artículo
   ========================= */
.article-body {
    color: var(--text);
    font-size: 1.05rem;
    max-width: var(--content);
}

.article-body > *:last-child {
    margin-bottom: 0;
}

.article-body p,
.section-content p,
.sources-content p {
    margin-bottom: 1.15rem;
    overflow-wrap: break-word;
}

.article-body h2,
.article-body h3,
.article-body h4,
.section-content h2,
.section-content h3,
.section-content h4 {
    margin-top: 1.9rem;
    margin-bottom: 0.9rem;
}

.article-body h2,
.section-content h2 {
    font-size: clamp(1.45rem, 2vw, 2rem);
}

.article-body h3,
.section-content h3 {
    font-size: clamp(1.2rem, 1.6vw, 1.45rem);
}

.article-body ul,
.article-body ol,
.section-content ul,
.section-content ol,
.sources-content ul,
.sources-content ol {
    margin: 0 0 1.25rem 1.25rem;
    padding: 0;
}

.article-body li,
.section-content li,
.sources-content li {
    margin-bottom: 0.4rem;
}

.article-body blockquote,
.section-content blockquote,
.sources-content blockquote {
    margin: 1.4rem 0;
    padding: 1rem 1.1rem 1rem 1.2rem;
    border-left: 4px solid var(--primary);
    background: var(--surface-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-soft);
}

.article-body hr,
.section-content hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 1.8rem 0;
}

.article-body table,
.section-content table,
.sources-content table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    white-space: normal;
}

.article-body th,
.article-body td,
.section-content th,
.section-content td,
.sources-content th,
.sources-content td {
    border: 1px solid var(--border);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}

.article-body th,
.section-content th,
.sources-content th {
    background: #f4f8ff;
    color: #0f172a;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    margin: 1.4rem 0;
    border-radius: var(--radius-sm);
}

.table-scroll > table {
    margin: 0;
    min-width: 100%;
}

.article-body a,
.section-content a,
.sources-content a,
.qa-content a {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-decoration-color: rgba(6, 106, 243, 0.35);
    text-underline-offset: 2px;
}

.article-body a:hover,
.section-content a:hover,
.sources-content a:hover,
.qa-content a:hover {
    text-decoration-color: rgba(6, 106, 243, 0.7);
}

.article-body img,
.section-content img,
.sources-content img {
    border-radius: var(--radius-sm);
}

.article-body pre,
.article-body code,
.section-content pre,
.section-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.article-body pre,
.section-content pre {
    overflow: auto;
    padding: 14px 16px;
    background: #0f172a;
    color: #f8fafc;
    border-radius: var(--radius-sm);
    margin: 1.4rem 0;
}

.article-body code,
.section-content code {
    background: #eff3f8;
    border-radius: 6px;
    padding: 0.15rem 0.35rem;
}

/* =========================
   Zoom / imágenes
   ========================= */
.article-gallery,
.section-gallery {
    display: grid;
    gap: 20px;
    margin-top: 18px;
}

.article-figure {
    margin: 0;
}

.article-caption {
    margin-top: 8px;
    color: var(--text-soft);
    font-size: 0.95rem;
    line-height: 1.6;
}

.zoomable-media {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    max-width: 100%;
}

.zoomable-media__link {
    display: inline-block;
    max-width: 100%;
}

.zoomable-media__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(6, 106, 243, 0.08);
    border: 1px solid rgba(6, 106, 243, 0.14);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.zoomable-media__icon img {
    width: 24px;
    height: 24px;
    border-radius: 0;
}

/* =========================
   TOC
   ========================= */
.toc-card {
    margin: 26px 0;
    padding: 18px 20px;
    background: linear-gradient(180deg, #f9fbff 0%, #f4f8ff 100%);
    border: 1px solid rgba(6, 106, 243, 0.14);
    border-radius: var(--radius-md);
}

.toc-title {
    font-size: 1.15rem;
    margin-bottom: 12px;
}

.toc-list {
    margin: 0;
    padding-left: 1.2rem;
}

.toc-list li {
    margin-bottom: 0.45rem;
}

.toc-list a {
    text-decoration: none;
}

/* =========================
   Secciones H2
   ========================= */
.article-sections {
    display: grid;
    gap: 22px;
    margin-top: 8px;
}

.section-block {
    padding: 22px;
    background: linear-gradient(180deg, rgba(245, 249, 255, 0.9) 0%, rgba(255, 255, 255, 0.96) 100%);
    border: 1px solid rgba(213, 224, 238, 0.95);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.section-block > h2 {
    margin-bottom: 14px;
    font-size: clamp(1.45rem, 2vw, 2rem);
}

/* =========================
   Preguntas y respuestas
   ========================= */
.qa-block {
    margin-top: 24px;
    padding: 22px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.qa-block > h2 {
    margin-bottom: 18px;
}

.qa-question {
    margin: 1.4rem 0 0.55rem;
    font-size: 1.1rem;
    color: #0f172a;
}

.qa-answer {
    margin-bottom: 0.9rem;
    color: var(--text-soft);
}

/* =========================
   Info cards
   ========================= */
.info-card {
    margin-top: 24px;
    padding: 20px;
    background: linear-gradient(180deg, #fbfdff 0%, #f6f9ff 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.info-card h2 {
    font-size: 1.15rem;
    margin-bottom: 12px;
}

.info-card p:last-child {
    margin-bottom: 0;
}

.article-url {
    overflow-wrap: anywhere;
}

.sources-content {
    color: var(--text-soft);
}

/* =========================
   Sidebar
   ========================= */
.sidebar {
    min-width: 0;
}

.sidebar-block + .sidebar-block {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.sidebar-title {
    font-size: 1.05rem;
    margin-bottom: 12px;
}

.language-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.language-list li + li {
    margin-top: 8px;
}

.current-language {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
}

.current-language::before {
    content: "•";
    color: var(--success);
}

.sidebar-meta {
    color: var(--text-soft);
    font-size: 0.94rem;
}

.letter-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.letter-grid li {
    margin: 0;
}

.letter-grid a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 700;
    color: #12325f;
    text-decoration: none;
}

.letter-grid a:hover,
.letter-grid a:focus-visible {
    background: var(--primary-soft);
    border-color: rgba(6, 106, 243, 0.28);
    color: var(--primary-dark);
    transform: translateY(-1px);
}

/* =========================
   Ad slots
   ========================= */
.ad-slot {
    margin: 24px 0;
    padding: 10px;
    background: linear-gradient(180deg, #fafcff 0%, #f4f8ff 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.ad-slot .adsbygoogle {
    overflow: hidden;
    border-radius: var(--radius-sm);
}

/* =========================
   Google CSE ajustes
   ========================= */
.gsc-control-cse,
.gsc-control-cse-es,
.gsc-control-wrapper-cse {
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
}

.gsc-search-box {
    margin-bottom: 0 !important;
}

.gsc-input-box {
    border-radius: 12px !important;
    border: 1px solid var(--border-strong) !important;
    box-shadow: none !important;
}

.gsc-input-box input {
    background: #fff !important;
}

.gsc-search-button-v2 {
    border-radius: 12px !important;
    border: 0 !important;
    background: var(--primary) !important;
    padding: 10px 16px !important;
}

.gsc-search-button-v2:hover {
    background: var(--primary-dark) !important;
}

.gsc-results-wrapper-overlay,
.gsc-modal-background-image,
.gcsc-find-more-on-google-root {
    z-index: 9999;
}

/* =========================
   Utilidades
   ========================= */
[hidden] {
    display: none !important;
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 1180px) {
    .page-layout {
        grid-template-columns: minmax(0, 1fr) 290px;
    }

    .letter-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    #mainwrapper {
        width: min(100%, calc(100% - 18px));
        margin-top: 10px;
    }

    .page-layout {
        grid-template-columns: 1fr;
    }

    .sidebar-card {
        position: static;
    }

    .article-card,
    .sidebar-card {
        padding: 18px;
    }

    .letter-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    body.article-page {
        font-size: 15.5px;
    }

    #mainwrapper {
        width: calc(100% - 10px);
        margin: 6px auto 18px;
    }

    .site-header__inner {
        border-radius: 18px;
        padding: 16px;
    }

    .article-card,
    .sidebar-card,
    .site-footer {
        border-radius: 18px;
    }

    .article-card {
        padding: 16px;
    }

    .sidebar-card {
        padding: 16px;
    }

    .article-title {
        font-size: clamp(1.7rem, 8vw, 2.3rem);
    }

    .meta {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-block,
    .qa-block,
    .info-card,
    .toc-card,
    .search-panel {
        padding: 16px;
    }

    /* En móvil dejamos visible solo el buscador del contenido */
    .search-panel--sidebar {
        display: none;
    }

    .letter-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .article-card,
    .sidebar-card {
        padding: 14px;
    }

    .share-widget {
        padding: 12px;
    }

    .share-button,
    .share-link {
        --size: 42px;
    }

    .letter-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
    }

    .article-body,
    .section-content {
        font-size: 1rem;
    }
}

@media (max-width: 420px) {
    #mainwrapper {
        width: calc(100% - 6px);
    }

    .site-header__inner,
    .article-card,
    .sidebar-card,
    .site-footer {
        border-radius: 16px;
    }

    .letter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .toc-list {
        padding-left: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}