/* =========================================================
   André de Carvalho Salazar — /artigos (adições)
   Reutiliza /style.css. Aqui só ficam componentes específicos
   da área de artigos, sem sobrepor a identidade visual da home.
   ========================================================= */

/* ---------- Acessibilidade utilitária ---------- */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* ---------- Estado ativo do link "Artigos" no menu ---------- */

.nav-list a.is-current {
    color: var(--ink-900);
}

.nav-list a.is-current::after {
    width: 100%;
}

/* =========================================================
   HERO COMPACTO / HERO DE ARTIGO
   Reaproveita .hero da homepage e apenas ajusta espaçamentos.
   ========================================================= */

.hero-compact {
    padding: 84px 0 72px;
}

.hero-compact .hero-inner {
    max-width: 780px;
}

.hero-compact h1 {
    font-family: var(--font-display);
    font-size: clamp(36px, 5.4vw, 56px);
    color: #ffffff;
    letter-spacing: -0.025em;
    margin-bottom: 18px;
}

.hero-compact .hero-lead {
    margin-bottom: 0;
}

.hero-article {
    padding: 88px 0 64px;
    text-align: left;
}

.hero-article .hero-inner {
    align-items: flex-start;
    max-width: 820px;
    text-align: left;
}

.hero-article .hero-eyebrow {
    color: #8fd3d9;
    margin-bottom: 14px;
}

.hero-article h1 {
    font-family: var(--font-display);
    font-size: clamp(30px, 5vw, 52px);
    color: #ffffff;
    letter-spacing: -0.025em;
    margin-bottom: 18px;
}

.article-meta-line {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(226, 240, 242, 0.72);
}

.article-back {
    margin: 0 0 22px 0;
}

.article-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(233, 242, 248, 0.9);
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.article-back-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.45);
}

/* =========================================================
   TOOLBAR — pesquisa, categoria e ordenação
   ========================================================= */

.articles-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 40px;
}

.toolbar-search {
    position: relative;
    display: flex;
    align-items: center;
}

.toolbar-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-400);
    display: inline-flex;
    pointer-events: none;
}

.toolbar-search input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper-soft);
    font-family: inherit;
    font-size: 15px;
    color: var(--ink-900);
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.toolbar-search input::placeholder {
    color: var(--ink-400);
}

.toolbar-search input:focus {
    outline: none;
    border-color: var(--accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.toolbar-controls {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.toolbar-select {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 8px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.toolbar-select:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.toolbar-select-label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-400);
}

.toolbar-select select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    padding: 4px 22px 4px 0;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-900);
    cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b6b7d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right center;
}

.toolbar-select select:focus {
    outline: none;
}

/* Estado da lista (texto de contagem/loading) */

.articles-status {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: var(--ink-400);
    min-height: 1.2em;
}

/* =========================================================
   GRID DE ARTIGOS + CARTÃO DE ARTIGO
   Herda o padrão visual dos .card da homepage.
   ========================================================= */

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 22px;
}

.article-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.article-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #4aa9b3);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
    z-index: 2;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: #cdd9e4;
}

.article-card:hover::before {
    transform: scaleX(1);
}

.article-card:focus-within {
    border-color: var(--accent);
}

/* Toda a área do cartão é clicável */

.article-card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    text-indent: -9999px;
}

.article-media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--paper-alt);
    overflow: hidden;
}

.article-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.article-card:hover .article-media img {
    transform: scale(1.03);
}

.article-media-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(140deg, #16334a 0%, #0e2033 60%, #0b1622 100%);
    color: rgba(255, 255, 255, 0.35);
    font-family: var(--font-display);
    font-size: 42px;
    letter-spacing: 0.08em;
}

.article-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px 26px 26px;
    flex: 1 1 auto;
}

.article-meta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
}

.article-meta .article-meta-dot {
    display: inline-block;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--line);
}

.article-meta .article-meta-date {
    color: var(--ink-400);
    font-weight: 500;
    letter-spacing: 0.08em;
}

.article-card h3 {
    font-size: 20px;
    font-family: var(--font-sans);
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink-900);
    margin: 0;
}

.article-card p.article-excerpt {
    font-size: 15px;
    line-height: 1.65;
    color: var(--ink-400);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 6px;
}

.article-cta {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink-800);
    font-size: 13.5px;
    font-weight: 500;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.article-card:hover .article-cta {
    border-color: var(--accent);
    color: var(--accent-strong);
    box-shadow: var(--shadow-sm);
}

/* Skeleton (loading) — mimetiza o cartão sem conteúdo */

.article-card.is-skeleton {
    pointer-events: none;
}

.article-card.is-skeleton .article-media,
.article-card.is-skeleton h3,
.article-card.is-skeleton p,
.article-card.is-skeleton .article-meta {
    background: linear-gradient(90deg, #eef2f6 0%, #f6f8fa 50%, #eef2f6 100%);
    background-size: 200% 100%;
    animation: acsShimmer 1.4s ease-in-out infinite;
    color: transparent;
    border-radius: 8px;
}

.article-card.is-skeleton .article-media {
    aspect-ratio: 16 / 9;
    border-radius: 0;
}

.article-card.is-skeleton h3 {
    height: 22px;
    margin-bottom: 6px;
}

.article-card.is-skeleton p {
    height: 60px;
}

.article-card.is-skeleton .article-meta {
    display: block;
    width: 120px;
    height: 12px;
}

@keyframes acsShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Estado vazio */

.articles-empty {
    margin: 40px 0 0 0;
    padding: 40px 24px;
    text-align: center;
    color: var(--ink-400);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: var(--paper-soft);
}

/* =========================================================
   HOMEPAGE — CTA "Ver todos os artigos" da secção Últimos Artigos
   Wrapper simples de centragem para o botão. Reutiliza .btn.
   ========================================================= */

.latest-articles-cta {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

/* =========================================================
   PAGINAÇÃO
   ========================================================= */

.articles-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 48px;
    flex-wrap: wrap;
}

.page-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 22px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink-800);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent-strong);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.page-info {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink-400);
    letter-spacing: 0.02em;
}

/* =========================================================
   PÁGINA DE DETALHE — corpo do artigo
   ========================================================= */

.article-container {
    max-width: 780px;
}

.article-featured {
    margin: 0 0 40px 0;
}

.article-featured img {
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: block;
}

.article-content {
    color: var(--ink-800);
    font-size: 17.5px;
    line-height: 1.8;
}

.article-content > *:first-child {
    margin-top: 0;
}

.article-content h2 {
    font-family: var(--font-display);
    font-size: clamp(24px, 3.4vw, 32px);
    font-weight: 600;
    color: var(--ink-900);
    margin: 48px 0 16px;
    letter-spacing: -0.02em;
}

.article-content h3 {
    font-family: var(--font-sans);
    font-size: 21px;
    font-weight: 600;
    color: var(--ink-900);
    margin: 36px 0 12px;
}

.article-content h4 {
    font-size: 17px;
    font-weight: 600;
    color: var(--ink-900);
    margin: 28px 0 10px;
    letter-spacing: 0.01em;
}

.article-content p {
    margin: 0 0 1.2em 0;
    color: var(--ink-600);
}

.article-content a {
    color: var(--accent-strong);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color 0.2s ease;
}

.article-content a:hover {
    color: var(--accent);
}

.article-content strong {
    color: var(--ink-900);
    font-weight: 600;
}

.article-content ul,
.article-content ol {
    margin: 0 0 1.4em 1.2em;
    padding: 0;
    color: var(--ink-600);
}

.article-content ul {
    list-style: disc;
}

.article-content ol {
    list-style: decimal;
}

.article-content li {
    margin-bottom: 0.5em;
}

.article-content blockquote {
    margin: 28px 0;
    padding: 18px 24px;
    border-left: 3px solid var(--accent);
    background: var(--paper-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--ink-600);
    font-style: italic;
}

.article-content code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.92em;
    background: var(--paper-alt);
    color: var(--ink-900);
    padding: 2px 6px;
    border-radius: 6px;
}

.article-content pre {
    margin: 24px 0;
    padding: 20px 22px;
    background: var(--ink-900);
    color: #eef3f8;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.6;
}

.article-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 24px 0;
    box-shadow: var(--shadow-sm);
}

.article-content hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 40px 0;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 15.5px;
}

.article-content th,
.article-content td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line-soft);
}

.article-content th {
    background: var(--paper-soft);
    font-weight: 600;
    color: var(--ink-900);
}

.article-loading {
    color: var(--ink-400);
    font-style: italic;
}

/* Footer do artigo (botão voltar) + variação de botão claro sobre paper */

.article-footer {
    margin-top: 56px;
    padding-top: 32px;
    border-top: 1px solid var(--line-soft);
    display: flex;
    justify-content: flex-start;
}

.btn-secondary-light {
    background: var(--paper-soft);
    border-color: var(--line);
    color: var(--ink-800);
}

.btn-secondary-light:hover {
    background: #ffffff;
    border-color: var(--accent);
    color: var(--accent-strong);
}

/* Estado de erro no detalhe */

.article-error {
    padding: 40px 28px;
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: var(--paper-soft);
}

.article-error h2 {
    font-size: 22px;
    margin-bottom: 10px;
}

.article-error p {
    color: var(--ink-400);
}

/* =========================================================
   RESPONSIVE — tablet
   ========================================================= */

@media (max-width: 1024px) {

    .articles-toolbar {
        grid-template-columns: 1fr;
    }

    .toolbar-controls {
        justify-content: flex-start;
    }

}

/* =========================================================
   RESPONSIVE — mobile
   ========================================================= */

@media (max-width: 768px) {

    .hero-compact {
        padding: 56px 0 48px;
    }

    .hero-article {
        padding: 60px 0 44px;
    }

    .articles-toolbar {
        padding: 12px 14px;
        gap: 12px;
        margin-bottom: 28px;
    }

    .toolbar-controls {
        gap: 8px;
    }

    .toolbar-select {
        flex: 1 1 auto;
        padding: 7px 12px 7px 14px;
    }

    .articles-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .article-body {
        padding: 20px 22px 22px;
    }

    .article-card h3 {
        font-size: 18.5px;
    }

    .article-content {
        font-size: 16.5px;
    }

    .article-content pre {
        margin-left: -18px;
        margin-right: -18px;
        border-radius: 0;
    }

    .article-featured {
        margin: 0 0 28px 0;
    }

    .articles-pagination {
        gap: 12px;
        margin-top: 32px;
    }

    .page-btn {
        padding: 10px 18px;
    }

}

@media (max-width: 520px) {

    .article-back-link {
        font-size: 12.5px;
        padding: 7px 12px;
    }

    .article-meta-line {
        font-size: 12.5px;
    }

}
