/* ==========================================================================
   assets/css/style.css — Estilos do site público (DevBlog)
   Complementa o Bootstrap 5.3 (tema claro/escuro via data-bs-theme).
   ========================================================================== */

:root {
    --db-primary: #0d6efd;
    --db-radius: 14px;
    --db-shadow: 0 6px 24px rgba(15, 23, 42, .08);
    --db-shadow-hover: 0 12px 32px rgba(15, 23, 42, .14);
    --db-transition: .25s cubic-bezier(.4, 0, .2, 1);
}

/* ============================ BASE ============================ */
html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

main { flex: 1 0 auto; }

a { transition: color var(--db-transition); }

img { max-width: 100%; }

/* Barra de progresso de leitura (topo) */
.reading-progress {
    position: fixed;
    inset: 0 0 auto 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--db-primary), #6ea8fe);
    z-index: 1080;
    transition: width .1s linear;
}

/* Avatares */
.avatar-xs { width: 24px; height: 24px; object-fit: cover; }
.avatar-sm { width: 36px; height: 36px; object-fit: cover; }
.avatar-md { width: 56px; height: 56px; object-fit: cover; }
.avatar-lg { width: 96px; height: 96px; object-fit: cover; }
.avatar-xl { width: 128px; height: 128px; object-fit: cover; }

/* Títulos de seção */
.section-title {
    position: relative;
    padding-bottom: .5rem;
}
.section-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 46px;
    height: 3px;
    border-radius: 3px;
    background: var(--db-primary);
}

/* Texto truncado em N linhas */
.text-truncate-2, .text-truncate-3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.text-truncate-2 { -webkit-line-clamp: 2; }
.text-truncate-3 { -webkit-line-clamp: 3; }

/* =========================== NAVBAR =========================== */
.site-navbar {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 0 rgba(15, 23, 42, .06);
    z-index: 1030;
}
[data-bs-theme="dark"] .site-navbar {
    background: rgba(33, 37, 41, .92);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}

.navbar-brand { font-size: 1.25rem; letter-spacing: -.02em; }
.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--db-primary), #6610f2);
    color: #fff;
    font-size: 1rem;
}

.nav-search { min-width: 220px; }

/* Botão de tema claro/escuro */
.btn-theme-toggle { border: 1px solid var(--bs-border-color); }
[data-bs-theme="light"] .theme-icon-light { display: none; }
[data-bs-theme="dark"]  .theme-icon-dark  { display: none; }

/* ======================= HERO (DESTAQUE) ======================= */
.hero-post {
    position: relative;
    border-radius: var(--db-radius);
    overflow: hidden;
    box-shadow: var(--db-shadow);
}
.hero-post-link { display: block; color: inherit; text-decoration: none; }
.hero-post-img {
    width: 100%;
    height: 380px;
    object-fit: cover;
    transition: transform .5s ease;
}
.hero-post:hover .hero-post-img { transform: scale(1.04); }
.hero-post-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: clamp(1rem, 3vw, 2rem);
    color: #fff;
    background: linear-gradient(to top, rgba(9, 14, 25, .92) 0%, rgba(9, 14, 25, .45) 45%, rgba(9, 14, 25, .05) 100%);
}
.hero-post-title {
    font-size: clamp(1.4rem, 3vw, 2.1rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: .5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.hero-post-excerpt {
    max-width: 62ch;
    opacity: .92;
    font-size: .95rem;
}
.hero-post-overlay .badge { align-self: flex-start; }

/* ========================= POST CARDS ========================= */
.post-card {
    border: 1px solid var(--bs-border-color);
    border-radius: var(--db-radius);
    overflow: hidden;
    transition: transform var(--db-transition), box-shadow var(--db-transition);
    background: var(--bs-body-bg);
}
.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--db-shadow-hover);
}
.post-card-cover {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bs-tertiary-bg);
}
.post-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .45s ease;
}
.post-card:hover .post-card-cover img { transform: scale(1.06); }
.post-card-category {
    position: absolute;
    top: 12px;
    left: 12px;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.post-card-title { margin-bottom: .5rem; line-height: 1.35; }
.post-card-title a { color: var(--bs-body-color); text-decoration: none; }
.post-card-title a:hover { color: var(--db-primary); }
.post-card-meta { font-size: .82rem; }

/* =========================== SIDEBAR =========================== */
.sidebar-card {
    border: 1px solid var(--bs-border-color);
    border-radius: var(--db-radius);
}
.sidebar-title {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: .78rem;
    color: var(--bs-secondary-color);
    margin-bottom: .9rem;
}
.sidebar-post {
    display: flex;
    gap: .75rem;
    padding: .6rem 0;
    border-bottom: 1px dashed var(--bs-border-color);
    text-decoration: none;
    color: var(--bs-body-color);
}
.sidebar-post:last-child { border-bottom: 0; padding-bottom: 0; }
.sidebar-post-rank {
    flex: 0 0 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--bs-tertiary-bg);
    font-weight: 700;
    font-size: .8rem;
    color: var(--db-primary);
}
.sidebar-post-title {
    display: block;
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.35;
}
.sidebar-post:hover .sidebar-post-title { color: var(--db-primary); }
.sidebar-about { background: linear-gradient(135deg, rgba(13,110,253,.08), rgba(102,16,242,.08)); }

/* ======================= POST INDIVIDUAL ======================= */
.single-post-title {
    font-size: clamp(1.6rem, 3.4vw, 2.4rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -.02em;
    margin-bottom: .75rem;
}
.single-post-lead {
    font-size: 1.08rem;
    color: var(--bs-secondary-color);
    line-height: 1.6;
    margin-bottom: 1.25rem;
}
.single-post-meta { font-size: .9rem; }
.single-post-cover img {
    width: 100%;
    max-height: 460px;
    object-fit: cover;
}

.single-post-content { font-size: 1.02rem; line-height: 1.8; }
.single-post-content h2,
.single-post-content h3,
.single-post-content h4 { font-weight: 700; margin: 1.8rem 0 .9rem; line-height: 1.3; }
.single-post-content p { margin-bottom: 1.15rem; }
.single-post-content a { color: var(--db-primary); text-decoration: underline; }
.single-post-content ul, .single-post-content ol { margin: 0 0 1.15rem 1.2rem; }
.single-post-content li { margin-bottom: .4rem; }
.single-post-content img { border-radius: 10px; margin: .5rem 0; }
.single-post-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-left: 4px solid var(--db-primary);
    background: var(--bs-tertiary-bg);
    border-radius: 0 10px 10px 0;
    font-style: italic;
    color: var(--bs-secondary-color);
}
.single-post-content pre {
    background: #0d1117;
    color: #e6edf3;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    overflow-x: auto;
    font-size: .88rem;
    margin-bottom: 1.15rem;
}
.single-post-content code {
    background: var(--bs-tertiary-bg);
    padding: .15rem .4rem;
    border-radius: 6px;
    font-size: .88em;
    color: #d63384;
}
[data-bs-theme="dark"] .single-post-content code { color: #ff7b9c; }
.single-post-content pre code { background: none; color: inherit; padding: 0; }
.single-post-content hr { margin: 2rem 0; }
.single-post-content table { width: 100%; margin-bottom: 1.15rem; border-collapse: collapse; }
.single-post-content th, .single-post-content td {
    border: 1px solid var(--bs-border-color);
    padding: .5rem .75rem;
}

.author-box { border-radius: var(--db-radius); background: var(--bs-tertiary-bg); }

/* ========================= COMENTÁRIOS ========================= */
.comments-section { border-radius: var(--db-radius); }
.comment-list > .comment-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--bs-border-color);
}
.comment-list > .comment-item:last-child { border-bottom: 0; }
.comment-reply {
    margin: .75rem 0 .25rem 3rem;
    padding-left: 1rem;
    border-left: 2px solid var(--bs-border-color);
    list-style: none;
}
.comment-bubble {
    background: var(--bs-tertiary-bg);
    border-radius: 12px;
    padding: .75rem 1rem;
}
.comment-text { font-size: .93rem; line-height: 1.65; white-space: normal; }
.comment-actions .btn-link { font-size: .78rem; }
.comment-item:target .comment-bubble {
    outline: 2px solid var(--db-primary);
    outline-offset: 2px;
}

/* ===================== CATEGORIA / AUTOR ===================== */
.category-header {
    background: linear-gradient(135deg, color-mix(in srgb, var(--cat-color) 12%, transparent), transparent);
    border-left: 4px solid var(--cat-color, var(--db-primary));
}
.author-card { border-radius: var(--db-radius); }

/* ===================== AUTENTICAÇÃO / PERFIL ===================== */
.auth-card { border: 1px solid var(--bs-border-color); border-radius: var(--db-radius); }
.auth-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    border-radius: 18px;
    font-size: 1.6rem;
    background: linear-gradient(135deg, rgba(13,110,253,.14), rgba(102,16,242,.14));
    color: var(--db-primary);
}
.profile-card { border-radius: var(--db-radius); overflow: hidden; }

/* Medidor de força da senha */
.password-strength-bar {
    height: 6px;
    border-radius: 6px;
    background: var(--bs-tertiary-bg);
    overflow: hidden;
}
.password-strength-bar span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 6px;
    background: #dc3545;
    transition: width var(--db-transition), background var(--db-transition);
}

/* ========================= EMPTY STATE ========================= */
.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    font-size: 2rem;
}

/* ============================ FOOTER ============================ */
.site-footer {
    background: var(--bs-tertiary-bg);
    border-top: 1px solid var(--bs-border-color);
    margin-top: 3rem;
}
.footer-links a {
    color: var(--bs-secondary-color);
    text-decoration: none;
    font-size: .9rem;
    display: inline-block;
    padding: .18rem 0;
}
.footer-links a:hover { color: var(--db-primary); transform: translateX(3px); }

/* Botão "voltar ao topo" */
.back-to-top {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 44px;
    height: 44px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: all var(--db-transition);
    z-index: 1040;
}
.back-to-top.show { opacity: 1; visibility: visible; transform: none; }

/* ========================= PAGINAÇÃO ========================= */
.pagination .page-link { border-radius: 8px !important; margin: 0 2px; border: 1px solid var(--bs-border-color); }
.pagination .page-item.active .page-link { background: var(--db-primary); border-color: var(--db-primary); }

/* ========================== RESPONSIVO ========================== */
@media (max-width: 991.98px) {
    .hero-post-img { height: 300px; }
    .nav-search { min-width: 0; }
    .comment-reply { margin-left: 1rem; }
}

@media (max-width: 575.98px) {
    .hero-post-img { height: 260px; }
    .hero-post-excerpt { display: none; }
    .single-post-meta { font-size: .82rem; gap: .5rem !important; }
}

/* Acessibilidade: respeita preferência por menos movimento */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}


