/**
 * Single Post Styles
 * Extracted from single.php for better performance and maintainability.
 */

.single-hero {
    background: var(--github-bg-secondary);
    border-bottom: 1px solid var(--github-border);
    padding: 48px 0;
    margin-bottom: 32px;
}

.hero-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

.single-hero .entry-title {
    font-size: 36px;
    font-weight: 700;
    color: var(--github-text-primary);
    margin: 16px 0;
    font-family: var(--github-font-sans);
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.single-hero .post-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    color: var(--github-text-secondary);
    font-size: 14px;
    font-family: var(--github-font-sans);
}

.single-hero .post-meta svg {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 4px;
}

.single-layout {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 48px;
    align-items: start;
}

.single-main {
    min-width: 0;
    grid-column: 2;
}

.single-aside {
    position: sticky;
    top: 120px;
    grid-column: 1;
    grid-row: 1;
}

.post-article {
    background-color: var(--github-bg-secondary);
    border: 1px solid var(--github-border);
    border-radius: 0; /* Brutalist sharp corners */
    padding: 40px;
    position: relative;
}


.post-article .entry-content {
    font-size: 16px;
    line-height: 1.7;
    color: var(--github-text-primary);
    text-align: left;
    font-family: var(--github-font-sans);
}

.post-article .entry-content h2 {
    font-size: 26px;
    margin-top: 64px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--github-border);
    padding-bottom: 12px;
    font-weight: 600;
    color: var(--github-text-primary);
    position: relative;
    font-family: var(--github-font-sans);
    letter-spacing: -0.01em;
    scroll-margin-top: 120px;
}

.post-article .entry-content h3 {
    font-size: 20px;
    margin-top: 40px;
    margin-bottom: 16px;
    font-weight: 600;
    color: var(--github-text-primary);
    position: relative;
    font-family: var(--github-font-sans);
    letter-spacing: -0.01em;
    scroll-margin-top: 120px;
}

/* Anchor links para encabezados */
.post-article .entry-content h2,
.post-article .entry-content h3 {
    position: relative;
}

.heading-anchor {
    position: absolute;
    left: -28px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--github-accent);
    text-decoration: none !important;
    opacity: 0;
    transition: all 0.2s ease;
    padding: 4px;
    line-height: 1;
    font-family: var(--github-font-mono);
}

.post-article .entry-content h2:hover .heading-anchor,
.post-article .entry-content h3:hover .heading-anchor {
    opacity: 0.6;
    left: -24px;
}

.heading-anchor:hover {
    opacity: 1 !important;
    transform: translateY(-50%) scale(1.2);
}

/* Efecto de resaltado cuando se navega a un ancla */
:target {
    scroll-margin-top: 100px;
    animation: target-highlight 2s ease-out;
}

@keyframes target-highlight {
    0% { background-color: rgba(56, 139, 253, 0.15); }
    100% { background-color: transparent; }
}


.post-article .entry-content p {
    margin-bottom: 16px;
}

.post-article .entry-content a {
    color: var(--github-text-primary);
    text-decoration: underline;
    text-decoration-color: var(--github-text-tertiary);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s ease;
}

.post-article .entry-content a:hover {
    text-decoration-color: var(--github-text-primary);
}

/* Code Snippets & Syntax Highlighting */
.entry-content code {
    font-family: var(--github-font-mono);
    font-size: 85%;
    background-color: var(--github-bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--github-text-primary);
}

.code-block-wrapper {
    position: relative !important;
    background: var(--github-bg-primary);
    border: 1px solid var(--github-border);
    border-radius: 8px;
    margin-bottom: 24px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.code-block-wrapper:hover {
    border-color: #444444;
}

.code-block-header {
    background: var(--github-bg-secondary);
    border-bottom: 1px solid var(--github-border);
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Empujar etiquetas al final */
    padding: 0 8px 0 16px;
    position: relative;
    z-index: 2;
}

/* Dots in header */
.code-block-header::before {
    content: "•••";
    color: #484f58;
    font-size: 18px;
    line-height: 1;
    letter-spacing: 2px;
    font-family: sans-serif;
    opacity: 0.5;
    flex-shrink: 0;
}

.code-header-meta {
    display: flex;
    align-items: center;
    height: 100%;
    margin-left: auto;
}

.entry-content pre {
    position: relative;
    background: transparent; /* El fondo lo da el wrapper */
    border: none;
    border-radius: 0;
    padding: 20px;
    overflow-x: auto;
    margin-bottom: 0;
    white-space: pre; /* NO envolver líneas para sincronizar con números */
}

/* Solo aplicar padding extra si hay números de línea */
.entry-content pre.line-numbers {
    padding-left: 55px;
    counter-reset: linenumber;
}

/* Removidos pseudo-elementos antiguos de pre */
.entry-content pre::before,
.entry-content pre::after {
    display: none !important;
}

.entry-content pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    font-family: var(--github-font-mono);
    font-size: 13px;
    line-height: 1.6;
    display: block;
    color: #e6edf3;
}

.code-block-header .code-language-label {
    color: var(--github-text-tertiary);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0 12px;
    height: 100%;
    display: flex;
    align-items: center;
    border-left: 1px solid var(--github-border);
    font-family: var(--github-font-mono);
    letter-spacing: 1px;
    pointer-events: none;
    flex-shrink: 0;
}



.copy-button {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 24px;
    transition: all 0.2s ease;
    opacity: 0.6;
    flex-shrink: 0;
}

/* Scoped positioning for header and pre */
.code-block-header .copy-button {
    position: relative;
    margin-left: 4px;
}

.entry-content pre .copy-button {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
}

.code-block-wrapper:hover .copy-button {
    opacity: 1;
}

.copy-button:hover {
    background: rgba(110, 118, 129, 0.2);
    border-color: #8b949e;
}

.copy-button svg {
    width: 14px;
    height: 14px;
    fill: #8b949e;
}

.copy-button.copied {
    border-color: var(--github-success);
}

.copy-button.copied svg {
    fill: var(--github-success);
}

.line-numbers-rows {
    position: absolute;
    top: 20px; /* Sincronizado con padding-top del pre */
    left: 0;
    width: 40px;
    letter-spacing: -1px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    user-select: none;
    pointer-events: none;
    text-align: right;
    padding-right: 10px;
}

.line-numbers-rows span {
    display: block;
    counter-increment: linenumber;
}

.line-numbers-rows span::before {
    content: counter(linenumber);
    color: rgba(139, 148, 158, 0.45);
    font-size: 13px; /* Sincronizado con el código real */
    font-family: var(--github-font-mono); /* Obligatorio para alineación perfecta */
    line-height: 1.6;
    display: block;
}

/* Typography & Layout */
.post-article .entry-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--github-text-primary);
    text-align: left;
    font-family: var(--github-font-sans);
}

.entry-content blockquote {
    border-left: 4px solid var(--github-accent);
    padding-left: 16px;
    margin: 24px 0;
    color: var(--github-text-secondary);
    font-style: italic;
    background: rgba(255, 255, 255, 0.03);
    padding: 16px 24px;
    border-radius: 0 6px 6px 0;
}

.entry-content ul,
.entry-content ol {
    margin-left: 24px;
    margin-bottom: 24px;
}

.entry-content li {
    margin-bottom: 8px;
}

.entry-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--github-border);
    margin: -10px 0;
}

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 14px;
}

.entry-content table th,
.entry-content table td {
    border: 1px solid var(--github-border);
    padding: 10px 14px;
    text-align: left;
}

.entry-content table th {
    background-color: var(--github-bg-tertiary);
    font-weight: 600;
}

/* Steps List (Tutorial Pattern) */
.entry-content ol.steps-list {
    counter-reset: tutorial-steps;
    list-style: none;
    margin-left: 0;
}

.entry-content ol.steps-list li {
    position: relative;
    padding-left: 40px;
    margin-bottom: 24px;
}

.entry-content ol.steps-list li::before {
    counter-increment: tutorial-steps;
    content: counter(tutorial-steps);
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    background-color: var(--github-bg-tertiary);
    border: 1px solid var(--github-border);
    border-radius: 50%;
    text-align: center;
    line-height: 26px;
    font-size: 14px;
    font-weight: 600;
    color: var(--github-text-primary);
}

/* Table of Contents */
.toc-box {
    background: var(--github-bg-secondary);
    border: 1px solid var(--github-border);
    border-radius: 8px;
    padding: 16px; 
    margin-bottom: 24px;
    max-height: 70vh; /* Aumentado para evitar excesivo scroll */
    overflow-y: auto;
}

.toc-box::-webkit-scrollbar {
    width: 4px;
}

.toc-box::-webkit-scrollbar-thumb {
    background: var(--github-border);
    border-radius: 10px;
}

.toc-box h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--github-text-tertiary);
    margin: 0 0 12px 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: var(--github-font-sans);
}

#table-of-contents ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

#table-of-contents li {
    margin: 2px 0;
}

#table-of-contents a {
    display: block;
    padding: 8px 12px;
    color: var(--github-text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-family: var(--github-font-sans);
    transition: all 0.2s ease;
    border-radius: 6px;
    line-height: 1.4;
}

#table-of-contents a:hover {
    color: var(--github-text-primary);
    background: rgba(255, 255, 255, 0.05);
}

#table-of-contents a.active {
    color: var(--github-text-primary);
    background: rgba(255, 255, 255, 0.08); /* Fondo más visible sin bordes */
    font-weight: 600;
}

/* TOC Hierarchy */
#table-of-contents a.toc-h3 {
    padding-left: 24px;
    font-size: 12px;
    color: var(--github-text-tertiary);
}

#table-of-contents a.toc-h3.active {
    color: var(--github-text-primary);
}

/* Estilos de la guía que coinciden con el TOC */
.guide-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.guide-nav li {
    margin: 2px 0;
}

.guide-nav a {
    display: block;
    padding: 8px 12px;
    color: var(--github-text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-family: var(--github-font-sans);
    transition: all 0.2s ease;
    border-radius: 6px;
    line-height: 1.4;
}

.guide-nav a:hover {
    color: var(--github-text-primary);
    background: rgba(255, 255, 255, 0.05); /* Igual que el TOC */
}

.guide-nav a.active {
    color: var(--github-text-primary);
    background: rgba(255, 255, 255, 0.08);
    font-weight: 600;
}

/* Estilos de Pestañas en la Guía */
.guide-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--github-border);
    padding-bottom: 16px;
}

.guide-header h3 {
    margin-bottom: 0 !important;
}

.guide-tabs {
    display: flex;
    gap: 4px;
    background: var(--github-bg-primary);
    padding: 2px;
    border-radius: 6px;
    border: 1px solid var(--github-border);
}

.guide-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--github-text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 8px 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.guide-tab-btn svg {
    opacity: 0.6;
}

.guide-tab-btn:hover {
    color: var(--github-text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.guide-tab-btn.active {
    color: var(--github-text-primary);
    background: var(--github-bg-secondary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.guide-tab-btn.active svg {
    opacity: 1;
    color: var(--github-accent);
}

.guide-tab-content {
    display: none;
}

.guide-tab-content.active {
    display: block;
    animation: fadeInTab 0.3s ease;
}

@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1024px) {
    .single-layout {
        grid-template-columns: 1fr;
    }
    .single-main {
        grid-column: 1;
    }
    .single-aside {
        grid-column: 1;
        grid-row: 2;
        position: static;
    }
    .toc-box {
        max-height: none;
        overflow-y: visible;
    }
}

@media (max-width: 768px) {
    .post-article {
        padding: 24px;
    }
    .single-hero .entry-title {
        font-size: 28px;
    }
}

/* ==========================================================================
   Technical Posts Styles (Merged from technical-posts.css)
   ========================================================================== */

.tldr-box {
    background: color-mix(in srgb, #008ec2 6%, rgba(13, 17, 23, 0.5));
    border: none;
    padding: 16px 24px;
    border-radius: 6px;
    margin: -8px 0 32px 0; /* Eliminado margen superior y ajustado para que empiece mÃ¡s arriba */
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(4px);
}

.tldr-title {
    color: #008ec2;
    margin: 0 0 10px 0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    font-family: var(--github-font-sans);
    line-height: 1.2;
}

.tldr-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tldr-item {
    margin-bottom: 12px; /* Increased spacing for better readability in key points */
    font-size: 15px;
    line-height: 1.6;
    color: var(--github-text-secondary);
    position: relative;
    padding-left: 20px;
}

.tldr-item:last-child {
    margin-bottom: 0;
}

.tldr-item::before {
    content: "\2022";
    color: #008ec2;
    font-size: 18px;
    line-height: 1.6; /* Alineado verticalmente con el texto */
    position: absolute;
    left: -7px;
    top: -2px;
}

.expert-quote {
    background-color: color-mix(in srgb, var(--github-text-secondary) 5%, transparent);
    border: 1px solid color-mix(in srgb, var(--github-text-secondary) 20%, transparent);
    border-radius: 8px;
    padding: 20px;
    margin: 25px 0;
    font-style: italic;
}

.expert-quote footer {
    margin-top: 10px;
    font-size: 0.85em;
    opacity: 0.7;
    font-style: normal;
    font-weight: 500;
}

/* Callouts Base */
.tech-callout {
    margin: 32px 0;
    padding: 20px;
    border-left: 3px solid transparent;
    font-family: var(--github-font-main, sans-serif);
}

.tech-callout-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: var(--github-font-sans);
}

.tech-callout-content {
    color: var(--github-text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Callouts Variations */
.tech-callout.note {
    border-left-color: var(--github-warning);
    background: color-mix(in srgb, var(--github-warning) 3%, transparent);
}
.tech-callout.note .tech-callout-label { color: var(--github-warning); }

.tech-callout.glossary {
    border-left-color: var(--github-text-tertiary);
    background: color-mix(in srgb, var(--github-text-tertiary) 5%, transparent);
}
.tech-callout.glossary .tech-callout-label { color: var(--github-text-primary); }

.tech-callout.tip {
    border-left-color: var(--github-success);
    background: color-mix(in srgb, var(--github-success) 3%, transparent);
}
.tech-callout.tip .tech-callout-label { color: var(--github-success); }

.tech-callout.error {
    border-left-color: var(--github-danger);
    background: color-mix(in srgb, var(--github-danger) 3%, transparent);
}
.tech-callout.error .tech-callout-label { color: var(--github-danger); }

/* Query Result Snippet */
.query-result-box {
    margin: 40px 0;
    padding: 25px;
    border: 1px solid var(--github-border);
    border-radius: 4px;
    background: var(--github-bg-tertiary);
    font-family: var(--github-font-main, sans-serif);
}

.query-result-label {
    display: block;
    margin-bottom: 12px;
    color: var(--github-text-primary);
    font-family: var(--github-font-mono, monospace);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.query-result-content {
    color: var(--github-text-primary);
    line-height: 1.6;
    font-size: 1rem;
}

.query-result-content strong {
    display: block;
    margin-bottom: 4px;
    color: var(--github-text-primary);
    font-size: 1.1rem;
    font-weight: 700;
}

/* Summary Table */
.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    border: 1px solid color-mix(in srgb, var(--github-text-secondary) 20%, transparent);
}

.summary-table thead tr {
    background-color: color-mix(in srgb, var(--github-text-secondary) 10%, transparent);
}

.summary-table th,
.summary-table td {
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--github-text-secondary) 20%, transparent);
    text-align: left;
}

/* Indicador de progreso en la leyenda */
.legend-progress {
    font-size: 11px;
    font-weight: 600;
    color: var(--github-text-tertiary);
    margin-left: 4px;
    font-family: var(--github-font-mono);
    transition: all 0.3s ease;
}

.guide-legend-item {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--github-border);
    font-size: 12px;
}

.entry-content li {
    margin-bottom: 4px; /* Reduced spacing for list items and checklist items */
    padding: 2px 8px;
    border-radius: 6px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.entry-content li.is-checked {
    color: var(--github-text-primary);
}

.entry-content input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border: 1px solid var(--github-border);
    border-radius: 50%;
    background: var(--github-bg-primary);
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-right: 12px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.entry-content input[type="checkbox"]::before {
    content: '';
    position: absolute;
    inset: 0;
    background: conic-gradient(from 0deg, #008ec2, transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: rotate-radar 2s linear infinite;
}

.entry-content input[type="checkbox"]:checked {
    border-color: #008ec2;
    box-shadow: 0 0 10px rgba(0, 142, 194, 0.4);
}

.entry-content input[type="checkbox"]:checked::before {
    opacity: 0.6;
}

@keyframes rotate-radar {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.entry-content input[type="checkbox"]:hover {
    border-color: #008ec2;
}

/* Barra de progreso total en sidebar */
.guide-total-wrapper {
    margin: 12px 12px 20px 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--github-border);
}

.guide-progress-text {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--github-text-tertiary);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
}

.guide-progress-bar {
    height: 10px;
    background: var(--github-bg-primary);
    border: 1px solid var(--github-border);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.guide-progress-bar::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(0, 142, 194, 0.05) 50%,
        transparent 100%
    );
    z-index: 2;
    pointer-events: none;
}

.guide-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #008ec2, #00b4f5);
    width: 0%;
    transition: width 0.8s cubic-bezier(0.65, 0, 0.35, 1);
    border-radius: 1px;
    position: relative;
    box-shadow: 0 0 10px rgba(0, 142, 194, 0.4);
}
.post-tags{
	display:none;
}
.legend-progress {
    font-family: var(--github-font-mono);
    color: var(--github-accent);
    text-shadow: 0 0 5px rgba(0, 142, 194, 0.3);
}
