/* ═══════════════════════════════════════════════════════════════
   LABORATORIO TERRAPPK · Stylesheet común para artículos técnicos
   Compartido por todas las páginas /lab/*.html
═══════════════════════════════════════════════════════════════ */

:root {
    --g900: #1B5E20;
    --g800: #2E7D32;
    --g700: #388E3C;
    --g600: #43A047;
    --g500: #4CAF50;
    --g400: #66BB6A;
    --g300: #81C784;
    --g200: #A5D6A7;
    --g100: #C8E6C9;
    --g50:  #E8F5E9;
    --text: #1B3A2A;
    --text-light: #4b6b58;
    --white: #ffffff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: #f9fafb;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ── Topbar ── */
.lab-topbar {
    background: linear-gradient(180deg, var(--g50) 0%, #ffffff 100%);
    border-bottom: 1px solid var(--g100);
    padding: 1.1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
    background-color: rgba(255, 255, 255, 0.92);
}
.lab-topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.lab-topbar a.lab-back {
    color: var(--g700);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.lab-topbar a.lab-back:hover { text-decoration: underline; }

/* ── Container ── */
.lab-main {
    max-width: 900px;
    margin: 2.5rem auto 4rem;
    padding: 0 1.2rem;
}

.lab-breadcrumb {
    font-size: 0.82rem;
    color: var(--text-light);
    margin-bottom: 1.4rem;
}
.lab-breadcrumb a {
    color: var(--g700);
    text-decoration: none;
    font-weight: 500;
}
.lab-breadcrumb a:hover { text-decoration: underline; }
.lab-breadcrumb .sep { margin: 0 0.45rem; color: var(--g300); }

/* ── Article wrapper ── */
.article-card {
    background: var(--white);
    border: 1.5px solid #d8eedd;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.article-hero {
    background: linear-gradient(135deg, var(--g900) 0%, var(--g700) 60%, var(--g500) 100%);
    padding: 3rem 3.5rem 2.5rem;
    position: relative;
    overflow: hidden;
}
.article-hero::after {
    content: '';
    position: absolute;
    bottom: -20px; right: -20px;
    width: 120px; height: 120px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
}
.article-num {
    font-size: 0.72rem; font-weight: 700; letter-spacing: 1.5px;
    color: var(--g300); text-transform: uppercase; margin-bottom: 0.7rem;
    position: relative; z-index: 1;
}
.article-title {
    font-size: 1.75rem; font-weight: 800; color: var(--white);
    line-height: 1.3; margin-bottom: 1rem; letter-spacing: -0.3px;
    position: relative; z-index: 1;
}
.article-tags {
    display: flex; gap: 0.5rem; flex-wrap: wrap;
    position: relative; z-index: 1;
}
.article-tag {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--g100);
    font-size: 0.72rem; font-weight: 600;
    padding: 3px 10px; border-radius: 12px; letter-spacing: 0.3px;
}

/* ── Body ── */
.article-body {
    padding: 2.5rem 3.5rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Meta */
.article-meta {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding-bottom: 1.4rem;
    border-bottom: 1.5px solid var(--g50);
    margin-bottom: 0.3rem;
}
.article-meta-item {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.82rem; color: var(--text-light);
}
.article-meta-item i { color: var(--g500); font-size: 0.75rem; }
.article-meta-item strong { color: var(--text); font-weight: 700; }

/* Hook */
.article-hook {
    font-size: 1.08rem; font-weight: 600; color: var(--g800);
    line-height: 1.6; border-left: 3px solid var(--g400);
    padding-left: 1rem; font-style: italic;
}

/* Section heading */
.lab-h3 {
    font-size: 1.15rem; font-weight: 700; color: var(--g800);
    margin: 0 0 0.75rem; padding-bottom: 0.45rem;
    border-bottom: 2px solid var(--g100);
}

/* Body paragraphs */
.article-text {
    font-size: 0.95rem; color: var(--text-light); line-height: 1.75;
}
.article-text strong { color: var(--text); font-weight: 600; }

/* Terminal / code block */
.lab-terminal {
    background: #0b1e12; border-radius: 12px; padding: 1.1rem 1.3rem;
    font-family: 'Courier New', monospace; font-size: 0.82rem; line-height: 1.55;
    color: #c8e6c9;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(165,214,167,0.35) transparent;
}
.lab-terminal > div {
    white-space: nowrap;
    min-height: 1.55em;
}
.lab-terminal::-webkit-scrollbar { height: 6px; }
.lab-terminal::-webkit-scrollbar-track { background: transparent; }
.lab-terminal::-webkit-scrollbar-thumb { background: rgba(165,214,167,0.35); border-radius: 3px; }
.lab-terminal .t-comment { color: #4a7c59; }
.lab-terminal .t-ok      { color: #4CAF50; }
.lab-terminal .t-warn    { color: #ff9800; }
.lab-terminal .t-err     { color: #ef5350; }
.lab-terminal .t-val     { color: #80CBC4; font-weight: 700; }
.lab-terminal .t-label   { color: #A5D6A7; }
.lab-terminal code       { color: #fff59d; background: transparent; padding: 0; }

/* Fix rate bars */
.fix-compare { display: flex; flex-direction: column; gap: 0.8rem; }
.fix-row { display: flex; flex-direction: column; gap: 0.3rem; }
.fix-label { display: flex; justify-content: space-between; font-size: 0.8rem; font-weight: 600; }
.fix-label span:first-child { color: var(--text-light); }
.fix-bar-track { background: #edf7ee; border-radius: 8px; height: 10px; overflow: hidden; }
.fix-bar { height: 100%; border-radius: 8px; transition: width 1.2s ease; }
.fix-bar.low  { background: linear-gradient(90deg,#ef5350,#ff7043); }
.fix-bar.high { background: linear-gradient(90deg,var(--g500),var(--g400)); }

/* Flow diagram */
.flow-diagram { display: flex; flex-direction: column; gap: 0.6rem; }
.flow-row { display: flex; align-items: center; gap: 0.6rem; }
.flow-box {
    flex: 1; border-radius: 10px; padding: 0.6rem 0.9rem;
    font-size: 0.8rem; font-weight: 600; text-align: center;
}
.flow-box.source     { background: var(--g50); color: var(--g800); border: 1.5px solid var(--g300); }
.flow-box.bad        { background: #fce4ec; color: #b71c1c; border: 1.5px solid #ef9a9a; }
.flow-box.good       { background: var(--g50); color: var(--g800); border: 1.5px solid var(--g500); }
.flow-box.result-bad { background: #ffebee; color: #c62828; border: 1.5px solid #ef9a9a; font-size: 0.75rem; }
.flow-box.result-good{ background: var(--g50); color: var(--g700); border: 1.5px solid var(--g400); font-size: 0.75rem; }
.flow-arrow { color: var(--text-light); font-size: 0.9rem; flex-shrink: 0; }

/* Insight boxes */
.insight-box {
    background: var(--g50); border-radius: 12px; padding: 1rem 1.2rem;
    border-left: 3px solid var(--g500);
}
.insight-box p { font-size: 0.88rem; color: var(--text); line-height: 1.7; }
.insight-box strong { color: var(--g700); }

/* Problem lists */
.problem-list { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.problem-list li {
    display: flex; align-items: flex-start; gap: 0.6rem;
    font-size: 0.9rem; color: var(--text-light); line-height: 1.6;
}
.problem-list li i { color: var(--g500); margin-top: 3px; flex-shrink: 0; font-size: 0.75rem; }
.problem-list li strong { color: var(--text); font-weight: 600; }

/* Author signature */
.author-sig {
    background: linear-gradient(135deg, var(--g900), var(--g700));
    border-radius: 16px; padding: 1.8rem 2.2rem;
    display: flex; align-items: center; gap: 1.5rem; margin-top: 0.5rem;
}
.author-sig-avatar {
    width: 68px; height: 68px; border-radius: 50%;
    background: rgba(255,255,255,0.14); border: 2px solid rgba(255,255,255,0.3);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; overflow: hidden;
}
.author-sig-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.author-sig-name  { font-size: 1rem; font-weight: 800; color: var(--white); letter-spacing: -0.2px; }
.author-sig-role  { font-size: 0.8rem; color: var(--g300); margin-top: 0.15rem; font-weight: 600; letter-spacing: 0.3px; }
.author-sig-note  { font-size: 0.8rem; color: rgba(255,255,255,0.6); margin-top: 0.5rem; font-style: italic; line-height: 1.55; }

/* Share + Follow */
.article-share {
    margin-top: 2rem;
    padding: 1.6rem 1.8rem;
    background: linear-gradient(135deg, #f1f8e9 0%, var(--g50) 100%);
    border-radius: 16px;
    border: 1.5px solid var(--g100);
}
.share-header {
    display: flex; align-items: center; gap: 0.6rem;
    font-size: 0.95rem; font-weight: 700; color: var(--g800);
    margin-bottom: 1rem;
}
.share-header i { color: var(--g600); font-size: 1.1rem; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.share-btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.55rem 1rem;
    border: none; border-radius: 999px;
    font-size: 0.82rem; font-weight: 600;
    font-family: inherit; cursor: pointer;
    text-decoration: none; color: var(--white);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.share-btn i { font-size: 0.95rem; }
.share-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.share-btn:active { transform: translateY(0); }
.share-linkedin  { background: #0077b5; }
.share-whatsapp  { background: #25d366; }
.share-twitter   { background: #000; }
.share-facebook  { background: #1877f2; }
.share-email     { background: #546e7a; }
.share-copy      { background: var(--g700); }
.share-copy.copied { background: var(--g500); }
.share-copy.copied::after { content: " ✓"; }

.follow-lab {
    margin-top: 1.3rem; padding-top: 1.2rem;
    border-top: 1.5px dashed var(--g100);
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem;
    justify-content: space-between;
}
.follow-label { font-size: 0.85rem; color: var(--text-light); font-weight: 600; }
.follow-label strong { color: var(--g700); }
.follow-buttons { display: flex; gap: 0.55rem; }
.follow-buttons a {
    width: 38px; height: 38px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--white); color: var(--g700);
    border: 1.5px solid var(--g200);
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.15s ease;
}
.follow-buttons a:hover {
    background: var(--g700); color: var(--white);
    border-color: var(--g700); transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(46,125,50,0.3);
}

/* Related articles */
.lab-related {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1.5px solid var(--g100);
}
.lab-related h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--g800);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.2rem;
}
.lab-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}
.lab-related-card {
    background: var(--white);
    border: 1.5px solid var(--g100);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.lab-related-card:hover {
    border-color: var(--g400);
    box-shadow: 0 6px 20px rgba(46,125,50,0.1);
    transform: translateY(-2px);
}
.lab-related-num {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--g600);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.lab-related-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}

/* Footer */
.lab-footer {
    border-top: 1px solid var(--g100);
    padding: 1.8rem 1.5rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.82rem;
    background: #fafafa;
}
.lab-footer-links {
    margin-bottom: 0.6rem;
}
.lab-footer-links a {
    color: var(--text-light);
    text-decoration: none;
    margin: 0 0.4rem;
}
.lab-footer-links a:hover { color: var(--g700); }
.lab-footer-copy {
    font-size: 0.75rem;
    opacity: 0.85;
}

/* Mobile */
@media (max-width: 768px) {
    .lab-main { margin: 1.5rem auto 3rem; padding: 0 0.8rem; }
    .article-title { font-size: 1.3rem; }
    .article-hero { padding: 2rem 1.5rem 1.8rem; }
    .article-body { padding: 1.8rem 1.5rem 2rem; }
    .author-sig { flex-direction: column; text-align: center; }
    .article-meta { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .article-share { padding: 1.2rem 1rem; }
    .share-btn span { display: none; }
    .share-btn { padding: 0.6rem 0.8rem; }
    .share-btn i { font-size: 1.05rem; }
    .follow-lab { flex-direction: column; align-items: stretch; text-align: center; }
    .follow-buttons { justify-content: center; }
    .lab-h3 { font-size: 1.05rem; }
    .article-text { font-size: 0.92rem; }
}
