/* =====================
   VARIÁVEIS E BASE
===================== */
:root {
--bg: #121212;
--bg-surface: #1E1E1E;
--bg-surface-2: #2A2A2A;
--text: #E0E0E0;
--text-muted: #9E9E9E;
--text-faint: #616161;
--destaque: #9B59B6;
--destaque-hover: #B07CC6;
--verde-neon: #39FF14;
--border: #2C2C2C;
--code-bg: #1A1A1A;
--radius: 4px;
--font-main: 'JetBrains Mono', 'Courier New', monospace;
--font-body: 'Inter', system-ui, sans-serif;
--max-width: 860px;
--sidebar-width: 260px;
}

*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}

html {
scroll-behavior: smooth;
}

body {
background-color: var(--bg);
color: var(--text);
font-family: var(--font-body);
font-size: 15px;
line-height: 1.7;
}

/* =====================
   TIPOGRAFIA
===================== */
h1, h2, h3, h4 {
font-family: var(--font-main);
color: var(--destaque);
line-height: 1.3;
margin-bottom: 0.75rem;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; margin-top: 2.5rem; }
h3 { font-size: 1rem; color: var(--text); }

p { margin-bottom: 1rem; }

a {
color: var(--destaque);
text-decoration: none;
}

a:hover {
color: var(--destaque-hover);
text-decoration: underline;
}

ul, ol {
padding-left: 1.4rem;
margin-bottom: 1rem;
}

li { margin-bottom: 0.3rem; }

/* =====================
   LAYOUT PRINCIPAL (GRID COORDENADAS)
===================== */
.site-wrapper {
display: grid;
grid-template-columns: var(--sidebar-width) 1fr;
grid-template-rows: auto 1fr auto;
min-height: 100vh;
}

.site-header {
grid-column: 1 / -1;
grid-row: 1;
background: var(--bg-surface);
border-bottom: 1px solid var(--border);
padding: 0.75rem 1.5rem;
display: flex;
align-items: center;
justify-content: space-between;
position: sticky;
top: 0;
z-index: 100;
}

.site-header .logo {
font-family: var(--font-main);
font-size: 1rem;
color: var(--destaque);
font-weight: 700;
letter-spacing: 0.05em;
}

.site-sidebar {
grid-column: 1;
grid-row: 2;
background: var(--bg-surface);
border-right: 1px solid var(--border);
padding: 1.5rem 1rem;
position: sticky;
top: 53px;
height: calc(100vh - 53px);
overflow-y: auto;
}

.site-main {
grid-column: 2;
grid-row: 2;
padding: 2rem 2.5rem;
max-width: var(--max-width);
}

.site-footer {
grid-column: 1 / -1 !important;
grid-row: 3 !important;
width: 100%;
background: var(--bg-surface);
border-top: 1px solid var(--border);
padding: 1.5rem 2rem;
}

/* =====================
   NAVEGAÇÃO SIDEBAR
===================== */
.nav-label {
font-size: 0.7rem;
text-transform: uppercase;
letter-spacing: 0.12em;
color: var(--text-faint);
margin-bottom: 0.5rem;
margin-top: 1.2rem;
font-family: var(--font-main);
}

.nav-label:first-child { margin-top: 0; }

.sidebar-nav a {
display: block;
padding: 0.3rem 0.6rem;
border-radius: var(--radius);
color: var(--text-muted);
font-size: 0.88rem;
transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
background: var(--bg-surface-2);
color: var(--text);
text-decoration: none;
}

/* =====================
   BUSCA
===================== */
.search-wrapper {
margin-bottom: 1.5rem;
position: relative;
}

#search-input {
width: 100%;
background: var(--bg-surface-2);
border: 1px solid var(--border);
color: var(--text);
padding: 0.5rem 0.75rem;
border-radius: var(--radius);
font-size: 0.85rem;
font-family: var(--font-body);
outline: none;
transition: border-color 0.15s;
}

#search-input:focus {
border-color: var(--destaque);
}

#search-input::placeholder {
color: var(--text-faint);
}

#search-results {
position: absolute;
top: 100%;
left: 0;
right: 0;
background: var(--bg-surface);
border: 1px solid var(--border);
border-radius: var(--radius);
max-height: 320px;
overflow-y: auto;
z-index: 200;
display: none;
}

#search-results.active { display: block; }

.search-result-item {
padding: 0.6rem 0.75rem;
border-bottom: 1px solid var(--border);
cursor: pointer;
font-size: 0.85rem;
}

.search-result-item:last-child { border-bottom: none; }

.search-result-item:hover {
background: var(--bg-surface-2);
}

.search-result-item .result-title {
color: var(--destaque);
font-weight: 600;
font-size: 0.85rem;
}

.search-result-item .result-section {
color: var(--text-faint);
font-size: 0.75rem;
margin-top: 0.1rem;
}

/* =====================
   TABELAS
===================== */
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 1.5rem;
font-size: 0.88rem;
}

th {
background: var(--bg-surface-2);
color: var(--destaque);
font-family: var(--font-main);
font-size: 0.78rem;
text-transform: uppercase;
letter-spacing: 0.08em;
padding: 0.6rem 0.75rem;
text-align: left;
border-bottom: 1px solid var(--border);
}

td {
padding: 0.55rem 0.75rem;
border-bottom: 1px solid var(--border);
color: var(--text);
vertical-align: top;
}

tr:hover td { background: var(--bg-surface); }

/* =====================
   BLOCOS DE CÓDIGO
===================== */
pre {
background: var(--code-bg);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 1rem 1.25rem;
overflow-x: auto;
margin-bottom: 1.2rem;
position: relative;
}

code {
font-family: var(--font-main);
font-size: 0.83rem;
color: var(--verde-neon);
}

p code, li code {
background: var(--code-bg);
padding: 0.15em 0.4em;
border-radius: 3px;
font-size: 0.82rem;
color: var(--verde-neon);
}

.copy-btn {
position: absolute;
top: 0.5rem;
right: 0.5rem;
background: var(--bg-surface-2);
border: 1px solid var(--border);
color: var(--text-muted);
padding: 0.2rem 0.6rem;
border-radius: var(--radius);
font-size: 0.72rem;
font-family: var(--font-main);
cursor: pointer;
transition: color 0.15s, border-color 0.15s;
}

.copy-btn:hover {
color: var(--destaque);
border-color: var(--destaque);
}

.copy-btn.copied {
color: var(--verde-neon);
border-color: var(--verde-neon);
}

/* =====================
   GLOSSÁRIO
===================== */
.glossary-letter {
font-family: var(--font-main);
font-size: 1.8rem;
color: var(--destaque);
border-bottom: 1px solid var(--border);
padding-bottom: 0.3rem;
margin: 2rem 0 1rem;
}

.glossary-term {
margin-bottom: 1.2rem;
padding-left: 0.75rem;
border-left: 2px solid var(--border);
scroll-margin-top: 70px;
}

.glossary-term:hover {
border-left-color: var(--destaque);
}

.glossary-term .term-name {
font-family: var(--font-main);
font-size: 0.95rem;
color: var(--destaque);
font-weight: 700;
}

.glossary-term .term-def {
color: var(--text);
font-size: 0.88rem;
margin-top: 0.2rem;
}

.glossary-term .term-anchor {
font-size: 0.72rem;
color: var(--text-faint);
margin-left: 0.5rem;
opacity: 0;
transition: opacity 0.15s;
}

.glossary-term:hover .term-anchor { opacity: 1; }

.letter-index {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
margin-bottom: 1.5rem;
}

.letter-index a {
font-family: var(--font-main);
font-size: 0.8rem;
padding: 0.2rem 0.5rem;
border: 1px solid var(--border);
border-radius: var(--radius);
color: var(--text-muted);
transition: all 0.15s;
}

.letter-index a:hover {
border-color: var(--destaque);
color: var(--destaque);
text-decoration: none;
}

/* =====================
   BLOG / LABORATÓRIO
===================== */
.post-list { list-style: none; padding: 0; }

.post-item {
padding: 1rem 0;
border-bottom: 1px solid var(--border);
}

.post-item:last-child { border-bottom: none; }

.post-item .post-title {
font-size: 1rem;
color: var(--destaque);
font-family: var(--font-main);
}

.post-item .post-title:hover {
color: var(--destaque-hover);
}

.post-item .post-meta {
font-size: 0.78rem;
color: var(--text-faint);
margin-top: 0.2rem;
}

.post-updated {
font-size: 0.78rem;
color: var(--text-faint);
font-family: var(--font-main);
margin-bottom: 1.5rem;
}

/* =====================
   ADSENSE SLOTS
===================== */
.ad-slot {
background: var(--bg-surface);
border: 1px dashed var(--border);
border-radius: var(--radius);
padding: 1rem;
margin: 1.5rem 0;
text-align: center;
min-height: 90px;
display: flex;
align-items: center;
justify-content: center;
}

.ad-slot-sidebar {
margin-top: 1.5rem;
min-height: 250px;
}

/* =====================
   RODAPÉ
===================== */
.footer-nav {
display: flex;
flex-wrap: wrap;
gap: 0.5rem 1.5rem;
margin-bottom: 1rem;
}

.footer-nav a {
font-size: 0.83rem;
color: var(--text-muted);
}

.footer-nav a:hover { color: var(--destaque); }

.footer-disclaimer {
font-size: 0.75rem;
color: var(--text-faint);
line-height: 1.6;
border-top: 1px solid var(--border);
padding-top: 0.75rem;
}

/* =====================
   RESPONSIVO
===================== */
@media (max-width: 768px) {
.site-wrapper {
grid-template-columns: 1fr;
grid-template-rows: auto auto auto;
}
.site-header {
grid-column: 1;
grid-row: 1;
}
.site-sidebar {
display: none;
}
.site-main {
grid-column: 1;
grid-row: 2;
padding: 1.25rem 1rem;
width: 100%;
box-sizing: border-box;
}
.site-footer {
grid-column: 1 !important;
grid-row: 3 !important;
}
h1 { font-size: 1.3rem; }
h2 { font-size: 1.1rem; }
table { font-size: 0.8rem; }
.letter-index a { font-size: 0.75rem; }
}

/* =====================
   RESET DO BRICKLAYER
===================== */
.bricklayer {
display: block !important;
height: auto !important;
position: relative !important;
}

.bricklayer-column {
float: none !important;
width: 100% !important;
display: block !important;
}

/* Força o rodapé a quebrar o fluxo do script */
.site-footer {
clear: both !important;
display: block !important;
width: 100% !important;
position: relative !important;
margin-top: 3rem !important;
}