/**
 * NicheRocket — Tema Starter CSS
 * Estilos custom + variables de color del sitio
 * Complementa Tailwind CSS (cargado vía CDN)
 */

/* === Reset y base === */
html { scroll-behavior: smooth; }
body { min-height: 100vh; }

/* === Tipografía del artículo === */
.article-content h2 {
    font-family: var(--font-heading, 'Merriweather', serif);
    font-size: 1.6rem;
    font-weight: 700;
    color: #1f2937;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f3f4f6;
    scroll-margin-top: 80px;
}

.article-content h3 {
    font-family: var(--font-heading, 'Merriweather', serif);
    font-size: 1.3rem;
    font-weight: 600;
    color: #374151;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    scroll-margin-top: 80px;
}

.article-content p {
    margin-bottom: 1.25rem;
    line-height: 1.8;
    color: #374151;
}

.article-content ul, .article-content ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.article-content li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

.article-content strong { color: #1f2937; }

.article-content a {
    color: var(--primary, #2563eb);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
.article-content a:hover { text-decoration-thickness: 2px; }

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}
.article-content th {
    background: #f9fafb;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
}
.article-content td {
    padding: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

.article-content blockquote {
    border-left: 4px solid var(--primary, #2563eb);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: #f9fafb;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #4b5563;
}

/* === Bloque de producto === */
.product-box {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    background: #fff;
    position: relative;
    transition: box-shadow 0.2s;
}
.product-box:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }

.product-badge {
    position: absolute;
    top: -8px;
    left: 16px;
    padding: 2px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.product-badge-top { background: var(--primary, #2563eb); color: #fff; }
.product-badge-budget { background: var(--accent, #f59e0b); color: #1f2937; }

.product-box-inner { display: flex; gap: 1.5rem; }
@media (max-width: 640px) {
    .product-box-inner { flex-direction: column; align-items: center; text-align: center; }
}

.product-image { flex-shrink: 0; }
.product-image img { width: 160px; height: 160px; object-fit: contain; }

.product-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.product-title a { color: #1f2937; text-decoration: none; }
.product-title a:hover { color: var(--primary, #2563eb); }

.product-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }

.stars { display: inline-flex; align-items: center; gap: 1px; }
.stars .star { display: inline-block; vertical-align: middle; }
.rating-number { color: #6b7280; font-size: 0.85rem; margin-left: 4px; }
.reviews-count { color: #9ca3af; font-size: 0.8rem; }

/* Precio sin verificar: muestra CTA a Amazon */
.product-price-dynamic .check-price-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: #d97706; font-weight: 600; font-size: 0.95rem;
    text-decoration: none;
}
.product-price-dynamic .check-price-link:hover { color: #b45309; text-decoration: underline; }
.product-price-dynamic .check-price-icon { flex-shrink: 0; opacity: 0.8; }

/* Anchor links: offset = header sticky (64px) + holgura */
.article-content h2, .article-content h3 {
    scroll-margin-top: 96px;
}

/* Grid de productos en artículos vs/comparison (fichas tipo card verticales) */
.product-grid-compact {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin: 2.5rem 0;
}
.product-grid-compact .product-box {
    margin: 0;
    padding: 1.25rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}
/* Layout interno vertical tipo card */
.product-grid-compact .product-box-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    flex: 1;
}
.product-grid-compact .product-image {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 140px;
    background: #f9fafb;
    border-radius: 8px;
    padding: 0.5rem;
}
.product-grid-compact .product-image img {
    max-width: 100%;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
}
.product-grid-compact .product-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-align: left;
}
.product-grid-compact .product-title {
    font-size: 0.95rem;
    line-height: 1.35;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-grid-compact .product-meta {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}
.product-grid-compact .product-pros {
    font-size: 0.82rem;
    margin: 0.5rem 0 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-grid-compact .product-pros li { margin-bottom: 0.15rem; }
.product-grid-compact .product-score {
    align-self: flex-start;
    font-size: 0.85rem;
    padding: 0.15rem 0.5rem;
}
.product-grid-compact .product-score .score-value { font-size: 1rem; }
.product-grid-compact .product-cta {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: auto;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
}
.product-grid-compact .product-badge {
    top: -10px;
    font-size: 0.65rem;
    padding: 3px 10px;
}
@media (max-width: 640px) {
    .product-grid-compact {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.prime-badge, .prime-badge-sm {
    background: #0066c0;
    color: #fff;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 700;
}

.product-price { margin: 0.5rem 0; }
.price-current { font-size: 1.5rem; font-weight: 700; color: #1f2937; }
.price-original { font-size: 0.9rem; color: #9ca3af; text-decoration: line-through; }
.price-discount { font-size: 0.85rem; color: #dc2626; font-weight: 600; }

.product-pros { list-style: none; padding: 0; margin: 0.75rem 0; }
.product-pros li {
    position: relative;
    padding-left: 1.25rem;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: #4b5563;
}
.product-pros li::before { content: '+'; position: absolute; left: 0; color: #10b981; font-weight: 700; }

.product-score {
    display: inline-flex;
    align-items: baseline;
    background: var(--primary, #2563eb);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    margin: 0.5rem 0;
}
.score-value { font-size: 1.4rem; font-weight: 700; }
.score-label { font-size: 0.75rem; margin-left: 2px; opacity: 0.8; }

.product-cta {
    display: inline-block;
    background: var(--accent, #f59e0b);
    color: #1f2937;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    margin-top: 0.75rem;
    transition: all 0.2s;
}
.product-cta:hover { filter: brightness(1.1); transform: translateY(-1px); }

/* === Tabla comparativa === */
.comparison-table-wrapper {
    overflow-x: auto;
    margin: 2rem 0;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}
.comparison-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.comparison-table th {
    background: #f9fafb;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}
.comparison-table td { padding: 1rem; border-top: 1px solid #f3f4f6; vertical-align: middle; }
.comparison-table .product-cell { display: flex; align-items: center; gap: 0.75rem; min-width: 240px; }
.table-product-img { width: 50px; height: 50px; object-fit: contain; flex-shrink: 0; }
.table-product-name { font-weight: 600; }
.table-badge { font-size: 0.6rem; padding: 1px 6px; border-radius: 3px; font-weight: 700; text-transform: uppercase; margin-left: 0.5rem; }
.badge-top { background: var(--primary, #2563eb); color: #fff; }
.badge-budget { background: var(--accent, #f59e0b); color: #1f2937; }
.top-pick-row { background: rgba(37, 99, 235, 0.03); }
.budget-pick-row { background: rgba(245, 158, 11, 0.03); }
.table-cta {
    display: inline-block;
    background: var(--accent, #f59e0b);
    color: #1f2937;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none;
    white-space: nowrap;
}
.table-cta:hover { filter: brightness(1.1); }
.price-cell { font-weight: 700; white-space: nowrap; }

/* === Caja del autor === */
.author-box {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    margin: 2rem 0;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}
@media (max-width: 640px) { .author-box { flex-direction: column; text-align: center; align-items: center; } }
.author-box-photo { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }
.author-box-name { font-weight: 700; margin-bottom: 0.25rem; }
.author-box-name a { color: #1f2937; text-decoration: none; }
.author-box-name a:hover { color: var(--primary, #2563eb); }
.author-box-bio { font-size: 0.875rem; color: #6b7280; margin-bottom: 0.5rem; }
.author-box-link { font-size: 0.8rem; color: var(--primary, #2563eb); text-decoration: none; }
.author-box-link:hover { text-decoration: underline; }

/* === Redes sociales del autor === */
.author-social { display: flex; gap: 0.5rem; margin: 0.5rem 0; }
.social-link {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #6b7280;
    text-decoration: none;
}
.social-link:hover { border-color: var(--primary, #2563eb); color: var(--primary, #2563eb); }

/* === TOC === */
.toc ol { list-style: none; counter-reset: toc-counter; padding: 0; }
.toc ol li { counter-increment: toc-counter; }
.toc ol li a::before {
    content: counter(toc-counter) ". ";
    color: var(--primary, #2563eb);
    font-weight: 600;
}

/* === AdSense === */
.adsense-container { margin: 2rem 0; text-align: center; min-height: 50px; }

/* === Utilidades === */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === Animaciones sutiles === */
@media (prefers-reduced-motion: no-preference) {
    .product-box, .bg-white { transition: box-shadow 0.2s ease; }
}

/* === Stretched link: tarjeta de artículo entera clickable === */
.article-card {
    cursor: pointer;
    position: relative;
    isolation: isolate;
}
.article-card .stretched-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background-color: transparent;
}
.article-card .relative.z-10 { position: relative; z-index: 2; }
.article-card:hover .stretched-link { color: var(--color-primary, #2563eb); }
