/* =========================================================
   RADAR TECH — notícias de tecnologia
   Página noticias.html e resumo na home (#radar).
   JS: js/noticias.js
   ========================================================= */

/* ---------- página: abertura com radar ---------- */
.news-page { max-width: 1240px; margin: 0 auto; padding: 8.5rem 2rem 5rem; }
.news-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; align-items: center;
  padding-bottom: 2.5rem;
}
.news-hero h1 {
  font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; line-height: 1;
  font-size: clamp(3rem, 9vw, 7rem); margin: .5rem 0 1.25rem;
}
.news-hero h1 .ss-line { display: block; overflow: hidden; }
.news-hero h1 .ss-line > span { display: inline-block; animation: news-rise .5s var(--ease-out) both; }
.news-hero h1 .ss-line:nth-child(2) > span { animation-delay: .12s; }
.news-hero .news-intro { color: var(--gray); font-size: 1.02rem; line-height: 1.75; max-width: 560px; animation: news-fade .4s var(--ease-out) .12s both; }
.news-hero .section-label { animation: news-fade .4s var(--ease-out) both; }
@keyframes news-rise { from { transform: translateY(105%); } to { transform: none; } }
@keyframes news-fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* radar */
.news-radar { width: clamp(150px, 22vw, 240px); aspect-ratio: 1; position: relative; animation: news-fade .4s var(--ease-out) .06s both; }
.news-radar svg { width: 100%; height: 100%; overflow: visible; }
.news-radar .ring { fill: none; stroke: color-mix(in srgb, var(--gray) 35%, transparent); stroke-width: 1; }
.news-radar .sweep { transform-origin: 100px 100px; animation: news-sweep 3.2s linear infinite; }
.news-radar .blip { fill: var(--accent); transform-box: fill-box; transform-origin: center; animation: news-blip 3.2s ease-out infinite; opacity: 0; }
.news-radar .blip.b2 { animation-delay: .9s; }
.news-radar .blip.b3 { animation-delay: 1.7s; }
.news-radar .blip.b4 { animation-delay: 2.4s; }
@keyframes news-sweep { to { transform: rotate(360deg); } }
@keyframes news-blip { 0% { opacity: 0; transform: scale(.3); } 8% { opacity: 1; transform: scale(1.4); } 25% { transform: scale(1); } 80% { opacity: .6; } 100% { opacity: 0; } }

/* ---------- filtros ---------- */
.news-controls {
  position: sticky; top: 74px; z-index: 5;
  display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center;
  padding: 1rem 0 1.25rem; margin-bottom: 1rem;
  background: linear-gradient(var(--dark) 75%, transparent);
  animation: news-fade .4s var(--ease-out) .18s both;
}
.news-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.news-chip {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .06em;
  padding: .45rem .9rem; border-radius: 2rem; cursor: pointer;
  background: transparent; color: var(--gray); border: 1px solid var(--border);
  transition: background .2s, color .2s, border-color .2s;
}
.news-chip:hover { border-color: var(--accent); color: var(--cream); }
.news-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #08090b; }
body.light-theme .news-chip[aria-pressed="true"] { color: #fff; }
.news-sep { width: 1px; height: 22px; background: var(--border); }
.news-search {
  margin-left: auto; min-width: 220px;
  font: .85rem var(--sans); color: var(--cream);
  background: var(--mid); border: 1px solid var(--border); border-radius: 2rem;
  padding: .6rem 1rem;
}
.news-search::placeholder { color: var(--gray); }
.news-search:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.news-chip:focus-visible, .news-refresh:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.news-statusbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin-bottom: 1.25rem; font-family: var(--mono); font-size: .72rem; color: var(--gray); letter-spacing: .04em; }
.news-statusbar .live { white-space: nowrap; display: inline-flex; align-items: center; gap: .45rem; color: var(--accent); text-transform: uppercase; letter-spacing: .12em; }
.news-statusbar .live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: news-ping 1.6s ease-out infinite; }
@keyframes news-ping { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.75); } }
.news-refresh { white-space: nowrap; margin-left: auto; background: none; border: 1px solid var(--border); color: var(--gray); border-radius: 2rem; padding: .35rem .8rem; cursor: pointer; font: inherit; transition: color .2s, border-color .2s; }
.news-refresh:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- grade de notícias ---------- */
.news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.news-card {
  position: relative; display: flex; flex-direction: column; gap: .8rem;
  padding: 1.5rem 1.5rem 1.35rem; min-height: 200px;
  background: var(--mid); border: 1px solid var(--border); border-radius: 1.25rem;
  color: var(--cream); text-decoration: none;
  transition: border-color .25s, transform .25s;
  animation: news-in .3s var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 12) * 35ms);
}
.news-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.news-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@keyframes news-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
body.light-theme .news-card { box-shadow: 0 1px 2px rgba(30, 50, 45, 0.04), 0 8px 24px rgba(30, 50, 45, 0.06); }

.news-top { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.news-source { display: inline-flex; align-items: center; gap: .5rem; font-family: var(--mono); font-size: .68rem; letter-spacing: .06em; color: var(--gray); }
.news-src { display: inline-grid; place-items: center; height: 20px; min-width: 20px; padding: 0 4px; border-radius: 4px; font-family: var(--sans); font-weight: 800; font-size: .68rem; letter-spacing: 0; }
.news-src.hn { background: #ff6600; color: #fff; }
.news-src.dev { background: var(--cream); color: var(--dark); }
.news-time { font-family: var(--mono); font-size: .68rem; color: var(--gray); white-space: nowrap; }
.news-card h3 { font-size: 1.02rem; font-weight: 700; line-height: 1.4; }
.news-meta { padding-right: 1.5rem; }
.news-desc { color: var(--gray); font-size: .85rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-meta { margin-top: auto; display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-family: var(--mono); font-size: .68rem; color: var(--gray); }
.news-meta span:first-child { color: var(--accent); }
.news-tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.news-tags span { font-family: var(--mono); font-size: .66rem; color: var(--gray); border: 1px solid var(--border); border-radius: 2rem; padding: .15rem .55rem; }
.news-arrow { position: absolute; bottom: 1.2rem; right: 1.35rem; color: var(--gray); transition: color .2s, transform .2s; }
.news-card:hover .news-arrow, .news-row:hover .news-arrow { color: var(--accent); transform: translate(3px, -3px); }

/* carregando */
.news-skel {
  min-height: 200px; border-radius: 1.25rem; border: 1px solid var(--border); background: var(--mid);
  padding: 1.5rem; display: grid; align-content: start; gap: .8rem; overflow: hidden; position: relative;
}
.news-skel i { display: block; height: 10px; border-radius: 6px; background: color-mix(in srgb, var(--gray) 18%, transparent); }
.news-skel i:nth-child(1) { width: 40%; }
.news-skel i:nth-child(2) { width: 90%; height: 14px; }
.news-skel i:nth-child(3) { width: 70%; height: 14px; }
.news-skel::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--cream) 6%, transparent) 50%, transparent 80%);
  animation: news-shimmer 1.3s linear infinite;
}
@keyframes news-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.news-empty { grid-column: 1 / -1; text-align: center; padding: 3rem 1rem; color: var(--gray); display: grid; gap: 1rem; justify-items: center; }
.news-empty .btn-ghost { cursor: pointer; background: none; font: inherit; }

.news-credit { margin-top: 2.5rem; font-size: .8rem; color: var(--gray); line-height: 1.7; }
.news-credit a { color: var(--accent); }

/* ---------- bloco Conteúdo na home: notícias ao lado de teologia ---------- */
.conteudo-grade { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.25rem; margin-top: 3rem; align-items: stretch; }
.conteudo-noticias {
  display: flex; flex-direction: column; padding: 2.25rem; border-radius: 1.8rem;
  background: var(--glass-tint); border: 1px solid var(--glass-line); box-shadow: var(--glass-shine), var(--glass-shadow);
  -webkit-backdrop-filter: blur(26px) saturate(170%); backdrop-filter: blur(26px) saturate(170%);
}
.conteudo-noticias h3 { font-size: clamp(1.7rem, 3vw, 2.4rem); font-weight: 600; letter-spacing: -.03em; line-height: 1.08; margin-bottom: .6rem; }
.conteudo-noticias > p { color: var(--gray); margin-bottom: 1.4rem; }
.conteudo-noticias .radar-list { margin-bottom: 1.25rem; }
.conteudo-noticias .news-row { grid-template-columns: minmax(0, 1fr) auto 24px; gap: .4rem 1rem; padding: 1.1rem .25rem; }
.conteudo-noticias .news-row .news-source { grid-column: 1 / -1; }
.conteudo-noticias .btn-ghost { align-self: flex-start; margin-top: auto; }
.conteudo-grade .teo-chamada { grid-template-columns: 1fr; padding: 2.25rem; align-content: space-between; }
.conteudo-grade .teo-chamada .teo-vitral { width: min(100%, 330px); margin: .5rem auto -7rem; }
html.perf-low .conteudo-noticias { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--glass-solid); }
@media (max-width: 760px), (pointer: coarse) {
  .conteudo-noticias { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--glass-solid); }
}
@media (max-width: 900px) {
  .conteudo-grade { grid-template-columns: 1fr; }
  .conteudo-noticias { padding: 1.75rem 1.5rem; }
}

/* ---------- resumo das notícias (#radar) ---------- */
.radar-list { display: grid; border-top: 1px solid var(--border); }
.radar-list .news-skel { min-height: 0; height: 74px; border-radius: 0; border: 0; border-bottom: 1px solid var(--border); background: none; padding: 1.4rem .25rem; }
.radar-list .news-skel i:nth-child(3) { display: none; }
.news-row {
  position: relative; display: grid; grid-template-columns: 170px minmax(0, 1fr) auto 24px; gap: 1.25rem; align-items: center;
  padding: 1.4rem .25rem; border-bottom: 1px solid var(--border);
  color: var(--cream); text-decoration: none;
  transition: background .2s ease;
  animation: news-in .3s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 80ms);
}
.news-row:hover, .news-event:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.news-row > *, .news-event > * { transition: transform .2s var(--ease-out), color .2s ease; }
.news-row:hover > *, .news-event:hover > * { transform: translateX(.65rem); }
.news-row-title { font-weight: 700; font-size: 1.02rem; line-height: 1.4; }
.news-row .news-arrow { position: static; }
.news-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 1000px) {
  .news-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .news-page { padding: 7rem 1.25rem 4rem; }
  .news-hero { grid-template-columns: 1fr; }
  .news-radar { display: none; }
  .news-controls { top: 64px; }
  .news-sep { display: none; }
  .news-search { margin-left: 0; width: 100%; min-width: 0; }
  .news-grid { grid-template-columns: 1fr; }
  .news-row { grid-template-columns: minmax(0, 1fr) 24px; gap: .5rem 1rem; }
  .news-row .news-source { grid-column: 1 / -1; }
  .news-row .news-time { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .news-page *, .radar-section * { animation: none !important; }
}

/* =========================================================
   CATEGORIAS (Tecnologia · Economia & Investimentos · Mundo)
   ========================================================= */
.news-tabs {
  display: flex; gap: .25rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); margin-bottom: 1.25rem;
  animation: news-fade .4s var(--ease-out) .18s both;
}
.news-tab {
  position: relative; background: none; border: 0; cursor: pointer;
  font: 700 1rem var(--sans); color: var(--gray); letter-spacing: -.01em;
  padding: .9rem 1.1rem 1rem; transition: color .2s;
}
.news-tab::after {
  content: ''; position: absolute; left: 1.1rem; right: 1.1rem; bottom: -1px; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .25s var(--ease-out);
}
.news-tab:hover { color: var(--cream); }
.news-tab[aria-selected="true"] { color: var(--cream); }
.news-tab[aria-selected="true"]::after { transform: scaleX(1); }
.news-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: .5rem; }

/* busca e "atualizar" na mesma linha do status */
.news-statusbar .news-search { margin-left: auto; flex: 0 1 300px; min-width: 180px; }
.news-statusbar .news-refresh { margin-left: 0; }
.news-controls { position: static; background: none; padding: 0 0 1rem; animation: none; }

@keyframes news-troca { from { opacity: 0; } }
.news-panel { padding: 0; animation: news-troca .18s ease; } /* padding: 0 anula o espaçamento padrão de <section> */
.news-panel[hidden] { display: none; }
/* enquanto digita na busca, os resultados aparecem na hora */
.news-page:has(.news-search input:focus) :is(.news-card, .news-event, .news-row) { animation: none; }
.news-panel-title { font-size: 1.2rem; font-weight: 800; letter-spacing: -.01em; margin: 1.5rem 0 1rem; }
.news-panel-title:first-child { margin-top: .5rem; }
.news-note { font-size: .8rem; color: var(--gray); margin: .25rem 0 1.25rem; line-height: 1.6; }
.news-src.wiki { background: var(--cream); color: var(--dark); font-family: var(--serif); font-size: .8rem; }

/* ---------- painel de mercado ---------- */
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: .9rem; }
.mk-card {
  display: flex; flex-direction: column; gap: .35rem;
  padding: 1.2rem 1.25rem; border-radius: 1.1rem;
  background: var(--mid); border: 1px solid var(--border);
  animation: news-in .3s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 50ms);
}
.mk-card.rate { background: color-mix(in srgb, var(--accent) 7%, var(--mid)); }
.mk-label { font-family: var(--mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gray); }
.mk-value { font-size: clamp(1.05rem, 1.4vw, 1.3rem); white-space: nowrap; font-weight: 800; letter-spacing: -.02em; color: var(--cream); font-variant-numeric: tabular-nums; }
.mk-change { font-family: var(--mono); font-size: .8rem; color: var(--gray); }
.mk-change.up, .tk i.up { color: #2fbf71; }
.mk-change.down, .tk i.down { color: #e5534b; }
.mk-unit { font-family: var(--mono); font-size: .75rem; color: var(--accent); }
.mk-range { font-family: var(--mono); font-size: .66rem; color: var(--gray); margin-top: auto; }
body.light-theme .mk-card { box-shadow: 0 1px 2px rgba(30, 50, 45, 0.04), 0 8px 24px rgba(30, 50, 45, 0.06); }
body.light-theme .mk-change.up, body.light-theme .tk i.up { color: #15803d; }
body.light-theme .mk-change.down, body.light-theme .tk i.down { color: #c0392b; }
.mk-skel { height: 118px; border-radius: 1.1rem; border: 1px solid var(--border); background: var(--mid); position: relative; overflow: hidden; }
.mk-skel i { display: none; }
.mk-skel::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--cream) 6%, transparent) 50%, transparent 80%);
  animation: news-shimmer 1.3s linear infinite;
}

/* ---------- lista de acontecimentos (Mundo / Economia) ---------- */
.news-events { display: grid; border-top: 1px solid var(--border); }
.news-event {
  position: relative; display: grid; grid-template-columns: 74px minmax(0, 1fr) 24px; gap: 1.1rem; align-items: baseline;
  padding: 1.1rem .25rem; border-bottom: 1px solid var(--border);
  color: var(--cream); text-decoration: none; transition: background .2s ease;
  animation: news-in .3s var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 15) * 30ms);
}
.news-event:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.news-event-date { font-family: var(--mono); font-size: .72rem; color: var(--accent); letter-spacing: .04em; text-transform: uppercase; }
.news-event-text { font-size: .98rem; line-height: 1.55; }
.news-event-text small { display: block; margin-top: .3rem; font-family: var(--mono); font-size: .68rem; color: var(--gray); }
.news-event .news-arrow { position: static; }
.news-event:hover .news-arrow { color: var(--accent); transform: translate(3px, -3px); }
.news-skel.row { min-height: 0; height: 64px; border-radius: 0; border: 0; border-bottom: 1px solid var(--border); background: none; padding: 1.2rem .25rem; }
.news-skel.row i:nth-child(3) { display: none; }

/* ---------- faixa de cotações no resumo da home ---------- */
.radar-ticker { display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; margin-bottom: 1.25rem; font-family: var(--mono); font-size: .78rem; color: var(--gray); min-height: 1.2em; }
.radar-ticker .tk b { color: var(--cream); font-weight: 500; margin-right: .35rem; }
.radar-ticker .tk i { font-style: normal; margin-left: .35rem; }

@media (max-width: 700px) {
  .news-tab { padding: .8rem .7rem .9rem; font-size: .9rem; }
  .news-tab::after { left: .7rem; right: .7rem; }
  .news-statusbar .news-search { order: 3; flex: 1 1 100%; margin-left: 0; }
  .news-statusbar .news-refresh { margin-left: auto; }
  .news-event { grid-template-columns: minmax(0, 1fr) 24px; gap: .35rem 1rem; }
  .news-event-date { grid-column: 1 / -1; }
  .mk-grid { grid-template-columns: repeat(2, 1fr); }
  .mk-value { font-size: 1.2rem; }
}
