/* ============================================================
   styles.css — Biblioteca Pública Makertech Labs
   Paleta: branco · azul · cinza
   Fonte títulos: Plus Jakarta Sans · Corpo: Barlow
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Barlow:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

/* ═══════════════════════════════════════════════════════════════
   TOKENS DE DESIGN
════════════════════════════════════════════════════════════════ */
:root {
    /* Superfícies */
    --bg:           #eef2f7;
    --surface-1:    #ffffff;
    --surface-2:    #f5f7fa;
    --surface-3:    #eaeff6;

    /* Bordas */
    --border-subtle: #e2e8f0;
    --border-soft:   #c8d4e3;
    --border-mid:    #94a3b8;

    /* Texto */
    --text-high:    #0f172a;
    --text-mid:     #475569;
    --text-low:     #94a3b8;
    --text-faint:   #cbd5e1;

    /* Azul */
    --blue:         #2563eb;
    --blue-dim:     rgba(37, 99, 235, 0.07);
    --blue-soft:    rgba(37, 99, 235, 0.14);
    --blue-glow:    rgba(37, 99, 235, 0.22);
    --blue-dark:    #1d4ed8;
    --blue-light:   #dbeafe;
    --blue-text:    #1e40af;

    /* Raios */
    --r-xs:   4px;
    --r-sm:   6px;
    --r-md:   10px;
    --r-lg:   14px;
    --r-xl:   18px;

    /* Sombras */
    --shadow-card:  0 1px 4px rgba(15, 23, 42, 0.07), 0 4px 16px rgba(15, 23, 42, 0.05);
    --shadow-hover: 0 4px 24px rgba(37, 99, 235, 0.12), 0 1px 6px rgba(15, 23, 42, 0.08);
    --shadow-btn:   0 2px 6px rgba(37, 99, 235, 0.3);
    --shadow-hd:    0 1px 0 var(--border-subtle), 0 2px 8px rgba(15,23,42,0.05);

    /* Layout */
    --max-w:   1320px;
    --col-gap: 1.5rem;

    /* Transições */
    --t-fast:  0.15s ease;
    --t-mid:   0.22s ease;
}

/* ═══════════════════════════════════════════════════════════════
   RESET & BASE
════════════════════════════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg);
    color: var(--text-high);
    font-family: 'Barlow', system-ui, -apple-system, sans-serif;
    font-weight: 400;
    line-height: 1.65;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; }
button { font-family: inherit; cursor: pointer; }

/* Skip link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: var(--blue);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: var(--r-sm);
    z-index: 9999;
    transition: top var(--t-fast);
}
.skip-link:focus { top: 1rem; }

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Container */
.container {
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 1;
}

/* Focus */
:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
    border-radius: var(--r-xs);
}

/* ═══════════════════════════════════════════════════════════════
   HEADER
════════════════════════════════════════════════════════════════ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-hd);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    gap: 1rem;
}

/* Logo */
.site-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-img {
    height: 30px;
    width: auto;
    display: block;
    object-fit: contain;
}

/* Navegação header */
.header-nav {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
}

.header-label {
    font-size: 0.7rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--text-low);
    font-weight: 500;
}

.header-count {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-mid);
    min-height: 1em;
}

/* ═══════════════════════════════════════════════════════════════
   HERO
════════════════════════════════════════════════════════════════ */
.site-hero {
    background: var(--surface-1);
    padding: 5rem 0 4rem;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border-subtle);
}

/* Grade de pontos sutis */
.hero-grid-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, var(--border-subtle) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: radial-gradient(ellipse 90% 90% at 60% 50%, black 20%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 90% 90% at 60% 50%, black 20%, transparent 75%);
    opacity: 0.7;
}

/* Gradiente azul suave no canto superior direito */
.site-hero::after {
    content: '';
    position: absolute;
    top: -60px;
    right: -80px;
    width: 600px;
    height: 500px;
    background: radial-gradient(ellipse, rgba(37, 99, 235, 0.06) 0%, transparent 65%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
}

/* Eyebrow */
.hero-eyebrow {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--blue);
    margin-bottom: 1.4rem;
}

.eyebrow-line {
    display: inline-block;
    width: 24px;
    height: 2px;
    background: var(--blue);
    border-radius: 2px;
    flex-shrink: 0;
}

/* Título */
.hero-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(2.1rem, 4.5vw, 3.4rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: var(--text-high);
    margin-bottom: 1.2rem;
}

.hero-title-accent { color: var(--blue); }

/* Descrição */
.hero-description {
    font-size: clamp(0.93rem, 1.4vw, 1.05rem);
    color: var(--text-mid);
    line-height: 1.8;
    font-weight: 400;
    max-width: 560px;
    margin-bottom: 2.5rem;
}

/* Estatísticas */
.hero-stats {
    display: flex;
    align-items: stretch;
}

.stat-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0.85rem 2rem;
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
}

.stat-item:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.stat-item:last-child  { border-radius: 0 var(--r-md) var(--r-md) 0; }
.stat-item:not(:first-child) { border-left: none; }

.stat-number {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--blue);
    line-height: 1;
    letter-spacing: -0.04em;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-low);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.25rem;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════
   CONTROLES
════════════════════════════════════════════════════════════════ */
.controls-section {
    padding: 1.75rem 0 2rem;
    position: relative;
    z-index: 2;
}

.controls-surface {
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-card);
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Search */
.search-container {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 380px;
}

.search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-low);
    pointer-events: none;
}

.search-input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    color: var(--text-high);
    font-family: 'Barlow', sans-serif;
    font-size: 0.9rem;
    padding: 0.65rem 2.2rem 0.65rem 2.5rem;
    outline: none;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
    -webkit-appearance: none;
    appearance: none;
}

.search-input::placeholder { color: var(--text-low); }

.search-input:focus {
    border-color: var(--blue);
    background: var(--surface-1);
    box-shadow: 0 0 0 3px var(--blue-dim);
}

.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Limpar busca */
.search-clear {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-low);
    padding: 0.2rem;
    border-radius: var(--r-xs);
    transition: color var(--t-fast);
    display: flex;
    align-items: center;
    line-height: 0;
}
.search-clear:hover { color: var(--text-high); }

/* Filtros */
.filters-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-end;
}

.select-wrapper { position: relative; }

.filter-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    color: var(--text-mid);
    font-family: 'Barlow', sans-serif;
    font-size: 0.87rem;
    padding: 0.65rem 2.2rem 0.65rem 0.9rem;
    outline: none;
    cursor: pointer;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
    white-space: nowrap;
}

.filter-select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-dim);
    color: var(--text-high);
}

.filter-select option { background: var(--surface-1); color: var(--text-high); }

.select-arrow {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-low);
    pointer-events: none;
}

/* Botão limpar */
.btn-clear-filters {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    color: var(--text-low);
    font-family: 'Barlow', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.65rem 0.9rem;
    cursor: pointer;
    transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-clear-filters:hover {
    color: var(--text-high);
    border-color: var(--border-soft);
    background: var(--surface-2);
}

/* ═══════════════════════════════════════════════════════════════
   BARRA DE RESULTADOS
════════════════════════════════════════════════════════════════ */
.results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    min-height: 28px;
}

.results-count {
    font-size: 0.82rem;
    color: var(--text-low);
    letter-spacing: 0.02em;
}

.results-count strong {
    color: var(--blue-text);
    font-weight: 700;
}

.results-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--blue-light);
    border: 1px solid var(--blue-soft);
    border-radius: 20px;
    color: var(--blue-text);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.7rem;
}

/* ═══════════════════════════════════════════════════════════════
   GRID DE ARTIGOS
════════════════════════════════════════════════════════════════ */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: var(--col-gap);
    padding-bottom: 5rem;
}

/* ═══════════════════════════════════════════════════════════════
   CARD
════════════════════════════════════════════════════════════════ */
.article-card {
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-xl);
    padding: 1.6rem 1.6rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: border-color var(--t-mid), transform var(--t-mid), box-shadow var(--t-mid);
    position: relative;
    overflow: hidden;
    animation: fadeUp 0.36s ease both;
    box-shadow: var(--shadow-card);
}

/* Linha azul no topo — anima ao hover */
.article-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--blue);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.28s ease;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
}

.article-card:hover {
    border-color: var(--blue-soft);
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.article-card:hover::before { transform: scaleX(1); }

/* ── Badge ───────────────────────────────────────────────────── */
.card-badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    border-radius: var(--r-xs);
    padding: 0.2rem 0.65rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    margin-bottom: 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-left-width: 2px;
    color: var(--text-mid);
}

/* Cor da borda esquerda por categoria */
.badge-Implantodontia  { border-left-color: #2563eb; }
.badge-Biomateriais    { border-left-color: #7c3aed; }
.badge-TecnologiaDigital, .badge-Tecnologia { border-left-color: #059669; }
.badge-Periodontia     { border-left-color: #db2777; }
.badge-Endodontia      { border-left-color: #ea580c; }
.badge-Ortodontia      { border-left-color: #0284c7; }
.badge-Cirurgia        { border-left-color: #ca8a04; }
.badge-Estomatologia   { border-left-color: #0d9488; }
.badge-Biossegurana, .badge-Biosseguranca { border-left-color: #9333ea; }

/* ── Título ──────────────────────────────────────────────────── */
.card-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.97rem;
    font-weight: 700;
    color: var(--text-high);
    line-height: 1.42;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

/* ── Resumo ──────────────────────────────────────────────────── */
.card-summary {
    font-size: 0.855rem;
    color: var(--text-mid);
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    margin-bottom: 1rem;
    font-weight: 400;
}

/* ── Meta ────────────────────────────────────────────────────── */
.card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
}

.card-subtype {
    font-size: 0.72rem;
    color: var(--text-mid);
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-xs);
    padding: 0.15rem 0.55rem;
    font-weight: 600;
}

.card-year {
    font-size: 0.75rem;
    color: var(--text-low);
    font-weight: 500;
}

/* ── Tags ────────────────────────────────────────────────────── */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.tag {
    font-size: 0.7rem;
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-xs);
    padding: 0.12rem 0.5rem;
    color: var(--text-low);
    transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}

.article-card:hover .tag {
    border-color: var(--border-soft);
    color: var(--text-mid);
}

/* ── Footer do card ──────────────────────────────────────────── */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    margin-top: auto;
}

.card-source {
    font-size: 0.77rem;
    color: var(--text-low);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
    flex: 1;
    min-width: 0;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--blue);
    color: #fff;
    border-radius: var(--r-sm);
    padding: 0.45rem 0.9rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: var(--shadow-btn);
}

.card-link:hover {
    background: var(--blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

.card-link:active { transform: translateY(0); }

/* ═══════════════════════════════════════════════════════════════
   ESTADOS
════════════════════════════════════════════════════════════════ */
.state-container {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 1rem;
    gap: 1rem;
    text-align: center;
    color: var(--text-low);
}

.state-container h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-mid);
}

.state-container p {
    font-size: 0.875rem;
    max-width: 300px;
    line-height: 1.6;
}

.state-icon {
    font-size: 2.2rem;
    opacity: 0.25;
    line-height: 1;
}

.spinner-lg {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-soft);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════
   FOOTER
════════════════════════════════════════════════════════════════ */
.site-footer {
    background: var(--surface-1);
    border-top: 1px solid var(--border-subtle);
    padding: 2rem 0;
    position: relative;
    z-index: 1;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.footer-logo-img {
    height: 22px;
    width: auto;
    opacity: 0.55;
    transition: opacity var(--t-fast);
}
.footer-logo-img:hover { opacity: 0.85; }

.footer-copy {
    font-size: 0.78rem;
    color: var(--text-faint);
}

.footer-nav { display: flex; gap: 1.5rem; }

.footer-link {
    font-size: 0.78rem;
    color: var(--text-low);
    transition: color var(--t-fast);
}
.footer-link:hover { color: var(--blue); }

/* ═══════════════════════════════════════════════════════════════
   ANIMAÇÕES
════════════════════════════════════════════════════════════════ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVIDADE
════════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
    .container { padding: 0 1.5rem; }
}

@media (max-width: 900px) {
    .site-hero { padding: 3.5rem 0 3rem; }
    .hero-title { font-size: clamp(2rem, 6vw, 2.8rem); }

    .articles-grid {
        grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
        gap: 1.25rem;
    }

    .controls-row { gap: 0.6rem; }
    .search-container { max-width: none; flex: 1 1 100%; }
    .filters-group { justify-content: flex-start; flex: 1 1 100%; }
}

@media (max-width: 640px) {
    .container { padding: 0 1rem; }
    .site-hero { padding: 2.5rem 0 2.5rem; }

    .hero-eyebrow { font-size: 0.65rem; margin-bottom: 1rem; }
    .hero-title { font-size: 1.9rem; margin-bottom: 1rem; }
    .hero-description { font-size: 0.9rem; margin-bottom: 2rem; }

    .hero-stats {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .hero-stats::-webkit-scrollbar { display: none; }
    .stat-item { flex-shrink: 0; padding: 0.75rem 1.5rem; }

    .controls-section { padding: 1.25rem 0 1.5rem; }
    .controls-surface { padding: 0.85rem; }
    .filters-group { gap: 0.4rem; }

    .articles-grid { grid-template-columns: 1fr; gap: 1rem; }
    .article-card { padding: 1.3rem 1.3rem 1.2rem; border-radius: var(--r-lg); }

    .header-nav { display: none; }
    .header-inner { justify-content: center; }

    .footer-inner { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .footer-brand { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}

@media (max-width: 380px) {
    .hero-title { font-size: 1.7rem; }
    .stat-number { font-size: 1.45rem; }
}

/* Print */
@media print {
    body { background: white; }
    .site-header, .controls-section, .site-footer { display: none; }
    .article-card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
