/* =========================================================
   LISTA DE NOTÍCIAS (/artigos, categorias, pesquisa)
   ========================================================= */

/* Barra: categorias + pesquisa */
.nw-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px 28px; flex-wrap: wrap; margin-bottom: 34px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.nw-cats { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.nw-cats a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--input-border, var(--border)); background: var(--surface); font-family: var(--font-head); font-size: 12.5px; font-weight: 600; color: var(--text) !important; white-space: nowrap; transition: all .2s; }
.nw-cats a span { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--bg-alt); font-size: 11px; color: var(--muted); text-align: center; }
.nw-cats a:hover { border-color: var(--accent); color: var(--accent) !important; }
.nw-cats a.active { background: var(--accent); border-color: var(--accent); color: #fff !important; }
.nw-cats a.active span { background: rgba(255, 255, 255, .2); color: #fff; }
.nw-search { position: relative; flex: 0 0 280px; }
.nw-search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.nw-search input { width: 100%; height: 44px; padding: 0 16px 0 42px; border-radius: 999px; border: 1px solid var(--input-border, var(--border)); background: var(--input-bg, var(--surface)); color: var(--heading); font-size: 14px; }
.nw-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Notícia em destaque */
.nw-featured { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); margin-bottom: 40px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.nwf-media { position: relative; min-height: 380px; display: block; background: var(--bg-alt); overflow: hidden; }
.nwf-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease, ease); }
.nw-featured:hover .nwf-media img { transform: scale(1.04); }
.nwf-badge { position: absolute; left: 18px; top: 18px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--accent-2); color: #fff; font-family: var(--font-head); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; box-shadow: 0 8px 20px rgba(0, 0, 0, .18); }
.nwf-body { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: clamp(28px, 4vw, 48px); }
.nwf-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 16px; font-size: 13px; color: var(--muted); }
.nwf-meta time { display: inline-flex; align-items: center; gap: 6px; }
.nw-chip { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent) !important; font-family: var(--font-head); font-size: 11.5px; font-weight: 700; letter-spacing: .03em; }
html[data-theme="dark"] .nw-chip { color: color-mix(in srgb, var(--accent) 45%, #9fe0b9) !important; }
.nwf-body h2 { font-size: clamp(22px, 2.4vw, 30px); line-height: 1.3; text-transform: none; letter-spacing: -.005em; margin: 0 0 14px; }
.nwf-body h2 a { color: var(--heading) !important; }
.nwf-body h2 a:hover { color: var(--accent) !important; }
.nwf-body p { font-size: 15.5px; line-height: 1.85; margin: 0 0 24px; }

/* Grelha de cartões */
.nw-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.nw-grid .post-card { border-radius: 14px; overflow: hidden; border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0, 0, 0, .03); }
.nw-grid .post-card:hover { box-shadow: var(--shadow-hover); }
.nw-grid .post-card-img { aspect-ratio: 16 / 10; }
.nw-grid .post-card-body { padding: 20px 22px 24px; }
.nw-grid .post-meta { font-size: 12px; gap: 4px 12px; }
.nw-grid .post-meta a { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nw-grid .post-card h3 { font-size: 16.5px; text-transform: none; letter-spacing: 0; line-height: 1.45; margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nw-grid .post-card p { font-size: 14px; line-height: 1.75; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nw-grid .read-more { align-self: flex-start; color: var(--accent) !important; border-bottom-color: transparent; }
.nw-grid .read-more::after { content: " →"; }
.nw-grid .post-card.nw-new { animation: nwIn .5s var(--ease, ease) both; }
@keyframes nwIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Carregar mais */
.nw-more { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 44px; }
.nw-count { margin: 0; font-size: 13.5px; color: var(--muted); }
.nw-progress { width: min(260px, 70%); height: 4px; border-radius: 4px; background: var(--bg-alt); overflow: hidden; }
.nw-progress span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s var(--ease, ease); }
.nw-more-btn { margin-top: 6px; min-width: 240px; justify-content: center; gap: 8px; }
.nw-more-btn.is-loading { opacity: .75; pointer-events: none; }
.nw-more-btn.is-loading .ico { animation: nwSpin .9s linear infinite; }
@keyframes nwSpin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
    .nw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .nw-featured { grid-template-columns: minmax(0, 1fr); }
    .nwf-media { min-height: 0; aspect-ratio: 16 / 9; }
    .nw-search { flex: 1 1 100%; order: -1; }
    .nw-cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin: 0 calc(var(--gutter, 20px) * -1); padding-left: var(--gutter, 20px); padding-right: var(--gutter, 20px); }
    .nw-cats::-webkit-scrollbar { display: none; }
}
@media (max-width: 640px) {
    .nw-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .nw-more-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .nw-grid .post-card.nw-new { animation: none; }
}

/* ---------- Topo tipo revista: destaque + 2 secundárias ---------- */
.nw-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; margin-bottom: 48px; }
.nw-top.no-side { grid-template-columns: minmax(0, 1fr); }
.nw-top .nw-featured { margin-bottom: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
.nw-top .nwf-media { min-height: 0; aspect-ratio: 16 / 8.2; }
.nw-top .nwf-body { justify-content: flex-start; padding: 26px 30px 30px; }
.nw-top .nwf-body h2 { font-size: clamp(21px, 2vw, 27px); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nw-top .nwf-body p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 18px; }
.nwf-more { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-head); font-size: 13px; font-weight: 700; color: var(--accent) !important; }
.nwf-more:hover { gap: 10px; }
.nw-side { display: grid; gap: 24px; grid-template-rows: 1fr 1fr; }
.nw-side-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: 0 1px 2px rgba(0, 0, 0, .03); transition: box-shadow .3s, transform .3s; }
.nw-side-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.nws-media { position: relative; display: block; flex: 1; min-height: 150px; overflow: hidden; background: var(--bg-alt); }
.nws-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s; }
.nw-side-card:hover .nws-media img { transform: scale(1.05); }
.nws-body { padding: 16px 20px 18px; }
.nws-body .nwf-meta { margin-bottom: 8px; font-size: 12px; gap: 8px 12px; }
.nws-body h3 { margin: 0; font-size: 16px; line-height: 1.4; text-transform: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nws-body h3 a { color: var(--heading) !important; }
.nws-body h3 a:hover { color: var(--accent) !important; }
.nw-section-title { display: flex; align-items: center; gap: 14px; margin: 0 0 24px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); }
.nw-section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Categorias numa linha + menu "Mais" ---------- */
.nw-cats { flex-wrap: nowrap; align-items: center; }
.nw-more-cats { position: relative; flex-shrink: 0; }
.nw-more-cats summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--input-border, var(--border)); background: var(--surface); font-family: var(--font-head); font-size: 12.5px; font-weight: 600; color: var(--text); cursor: pointer; white-space: nowrap; }
.nw-more-cats summary::-webkit-details-marker { display: none; }
.nw-more-cats[open] summary, .nw-more-cats summary:hover { border-color: var(--accent); color: var(--accent); }
.nw-more-cats.has-active summary { background: var(--accent); border-color: var(--accent); color: #fff; }
.nw-more-cats[open] summary .ico { transform: rotate(180deg); }
.nw-more-menu { position: absolute; z-index: 30; top: calc(100% + 8px); left: 0; width: 300px; max-height: 360px; overflow: auto; padding: 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 18px 40px rgba(0, 0, 0, .14); }
.nw-more-menu a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 9px; font-size: 13.5px; color: var(--text) !important; }
.nw-more-menu a span { font-size: 11.5px; color: var(--muted); }
.nw-more-menu a:hover, .nw-more-menu a.active { background: var(--accent-soft); color: var(--accent) !important; }

@media (max-width: 1100px) {
    .nw-cats a:nth-of-type(n+5) { display: none; }
}
@media (max-width: 900px) {
    .nw-top { grid-template-columns: minmax(0, 1fr); }
    .nw-side { grid-template-columns: 1fr 1fr; grid-template-rows: none; }
    .nw-cats a:nth-of-type(n+5) { display: inline-flex; }
    .nw-more-cats { position: static; }
    .nw-more-menu { left: var(--gutter, 20px); right: var(--gutter, 20px); width: auto; }
}
@media (max-width: 640px) {
    .nw-side { grid-template-columns: minmax(0, 1fr); }
    .nws-media { min-height: 0; aspect-ratio: 16 / 9; flex: none; }
}
/* Ajuste: filtros nunca passam por baixo da pesquisa */
.nw-cats { flex-wrap: wrap; }
@media (max-width: 1100px) { .nw-cats a:nth-of-type(n+5) { display: inline-flex; } }
@media (max-width: 900px) { .nw-cats { flex-wrap: nowrap; } }
@media (min-width: 901px) { .nw-search { flex: 0 0 230px; } .nw-toolbar { gap: 16px 20px; } .nw-cats { gap: 6px; } .nw-cats a, .nw-more-cats summary { padding: 8px 13px; } }
