/* ─────────────────────────────────────────────────────────────
   noticias.email — layout jornal digital
   ───────────────────────────────────────────────────────────── */

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --bg: #fff;
  --fg: #111;
  --muted: #666;
  --muted2: #999;
  --line: #e0e0e0;
  --accent: #c0392b;
  --hover: #f6f6f6;
  --header-bg: #fff;
  --nav-bg: #1a1a1a;
  --maxw: 1240px;
  --serif: Georgia, "Times New Roman", Times, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
[data-theme="dark"] {
  --bg: #1c1c1e;
  --fg: #f0f0f0;
  --muted: #aaa;
  --muted2: #666;
  --line: #303030;
  --accent: #e05444;
  --hover: #252527;
  --header-bg: #1c1c1e;
  --nav-bg: #111;
}
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: var(--sans); color: var(--fg); background: var(--bg); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); text-decoration: none; }
img { display: block; max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Layout ─────────────────────────────────────────────────── */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ── Header ─────────────────────────────────────────────────── */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--header-bg); box-shadow: 0 1px 0 var(--line); }

/* Masthead: logo + controles */
.masthead { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; max-width: var(--maxw); margin: 0 auto; border-bottom: 3px solid var(--fg); }
.brand { font-family: var(--serif); font-weight: 900; font-size: 2rem; color: var(--fg); letter-spacing: -0.5px; line-height: 1; }
.brand:hover { color: var(--accent); }
.header-controls { display: flex; align-items: center; gap: 8px; }

/* Barra de navegação escura */
.nav-bar { background: var(--nav-bg); }
.nav { display: flex; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: #ddd; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 9px 12px; white-space: nowrap; display: block; border-bottom: 3px solid transparent; transition: background 0.1s; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.1); }
.nav-svc { color: #ffaaaa !important; }

/* Botões de controle */
.theme-toggle, .nav-toggle { flex: 0 0 auto; height: 34px; border-radius: 4px; border: 1px solid var(--line); background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--fg); transition: background 0.12s; }
.theme-toggle { width: 34px; font-size: 0.95rem; }
.theme-toggle:hover, .nav-toggle:hover { background: var(--hover); }
.theme-toggle::before { content: "🌙"; }
[data-theme="dark"] .theme-toggle::before { content: "☀️"; }
.nav-toggle { display: none; width: 34px; font-size: 1.1rem; font-weight: 700; }
.nav-toggle::before { content: "☰"; }
.nav-toggle[aria-expanded="true"]::before { content: "✕"; }

/* ── Cabeçalho de seção ─────────────────────────────────────── */
.section-head { display: flex; align-items: center; padding: 18px 0 8px; border-bottom: 3px solid var(--fg); margin-bottom: 0; gap: 10px; }
.section-head h1, .section-head h2 { margin: 0; font-size: 0.82rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.7px; color: var(--fg); }
.section-badge { background: var(--accent); color: #fff; font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; padding: 3px 7px; }
.section-head-all { margin-left: auto; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent); }
.section-head-all:hover { text-decoration: underline; }

/* ── Alerta ─────────────────────────────────────────────────── */
.alert-banner { border-left: 4px solid #d4a000; background: rgba(240,192,0,.07); padding: 10px 14px; margin: 14px 0 0; }
[data-theme="dark"] .alert-banner { background: rgba(240,192,0,.05); }
.alert-banner-tag { font-weight: 800; color: #8a6800; font-size: 0.78rem; }
[data-theme="dark"] .alert-banner-tag { color: #e0b800; }
.alert-banner ul { margin: 4px 0 2px; padding-left: 16px; }
.alert-banner li { font-size: 0.86rem; margin: 2px 0; }
.alert-banner li a { color: var(--fg); }
.alert-banner-all { font-size: 0.78rem; font-weight: 700; color: var(--accent); }

/* ── Lead: grid destaque (hero + sidebar) ───────────────────── */
.lead-section { margin-bottom: 24px; }
.lead-grid { display: grid; grid-template-columns: 1fr; }
.lead-main { padding: 16px 0; }
.lead-sidebar { display: flex; flex-direction: column; }

/* ── Grade de notícias ──────────────────────────────────────── */
.news-section { margin-bottom: 32px; }
.news-grid { display: grid; grid-template-columns: 1fr; }

/* ── Card de notícia (.tweet preservado para compatibilidade JS) */
.tweet { display: flex; flex-direction: column; padding: 16px 0; border-bottom: 1px solid var(--line); cursor: pointer; transition: background 0.1s; }
.tweet:hover { background: var(--hover); }

.tweet-img { display: block; overflow: hidden; aspect-ratio: 16 / 9; margin-bottom: 10px; background: var(--line); flex-shrink: 0; }
.tweet-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s; }
.tweet:hover .tweet-img img { transform: scale(1.04); }

.card-cat { display: inline-block; color: var(--accent); font-weight: 700; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 5px; }
.card-cat:hover { text-decoration: underline; }

.tweet-title { margin: 0 0 6px; font-size: 1.05rem; font-weight: 800; line-height: 1.25; }
.tweet-title a { color: var(--fg); }
.tweet-title a:hover { color: var(--accent); }
.tweet-text { margin: 0 0 6px; color: var(--muted); font-size: 0.86rem; line-height: 1.45; }
.tweet-meta { font-size: 0.72rem; color: var(--muted2); }

/* Variante hero (artigo principal do destaque) */
.tweet--hero .tweet-img { aspect-ratio: 16 / 9; margin-bottom: 14px; }
.tweet--hero .tweet-title { font-size: 1.65rem; font-family: var(--serif); line-height: 1.15; margin-bottom: 10px; }
.tweet--hero .tweet-text { font-size: 0.98rem; line-height: 1.5; }

/* Variante secondary (sidebar do destaque) */
.tweet--secondary { flex-direction: row; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: none; border-top: 1px solid var(--line); }
.tweet--secondary:first-child { border-top: none; padding-top: 16px; }
.tweet--secondary .tweet-img { flex: 0 0 96px; width: 96px; height: 64px; aspect-ratio: auto; margin-bottom: 0; }
.tweet--secondary .tweet-body { flex: 1; min-width: 0; }
.tweet--secondary .tweet-title { font-size: 0.88rem; font-weight: 700; margin-bottom: 4px; }
.tweet--secondary .tweet-text { display: none; }

.empty { padding: 20px 0; color: var(--muted); }

/* ── Página de categoria ────────────────────────────────────── */
.feed-header { padding: 16px 0; border-bottom: 3px solid var(--fg); margin-bottom: 0; }
.feed-header h1 { margin: 0 0 2px; font-size: 1.5rem; font-weight: 800; }
.feed-sub { margin: 0; color: var(--muted); font-size: 0.86rem; }
.breadcrumb { color: var(--muted); font-size: 0.8rem; margin: 0 0 4px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

/* ── Artigo ─────────────────────────────────────────────────── */
.post { padding: 20px 0; max-width: 720px; margin: 0 auto; }
.post header .card-cat { margin-bottom: 8px; }
.post h1 { font-size: 1.9rem; line-height: 1.15; margin: 0 0 10px; font-weight: 800; font-family: var(--serif); }
.post .dek { font-size: 1.08rem; color: var(--muted); margin: 0 0 12px; line-height: 1.45; }
.byline { color: var(--muted); font-size: 0.8rem; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.post-hero { margin: 16px 0 8px; }
.post-hero img { width: 100%; height: auto; aspect-ratio: 1200/630; object-fit: cover; }
.post-hero figcaption { color: var(--muted); font-size: 0.73rem; margin-top: 5px; }
.post-body { font-size: 1.05rem; line-height: 1.7; font-family: var(--serif); padding: 16px 0; }
.post-body h2 { font-family: var(--sans); font-size: 1.15rem; font-weight: 700; margin: 1.6rem 0 0.5rem; }
.post-body p { margin: 0 0 1.1rem; }
.post-body a { color: var(--accent); text-decoration: underline; }
.tags { margin: 10px 0; }
.tag { display: inline-block; background: var(--hover); border: 1px solid var(--line); padding: 3px 10px; font-size: 0.73rem; color: var(--muted); margin: 0 5px 5px 0; }
.related { border-top: 3px solid var(--fg); margin-top: 24px; }
.related h2 { font-size: 0.82rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; padding: 12px 0 8px; margin: 0; border-bottom: 1px solid var(--line); }
.next-up { margin: 20px 0; padding: 14px 16px; background: var(--hover); border-left: 3px solid var(--accent); display: flex; flex-direction: column; gap: 4px; }
.next-up span { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; }
.next-up a { font-weight: 700; font-size: 0.98rem; color: var(--fg); }
.next-up a:hover { color: var(--accent); }

/* ── Anúncios ───────────────────────────────────────────────── */
.ad-slot { margin: 4px 0; padding: 14px 0; border-bottom: 1px solid var(--line); min-height: 90px; text-align: center; }

/* ── Página de alertas ──────────────────────────────────────── */
.alerts { display: flex; flex-direction: column; }
.alert { padding: 14px 0 14px 14px; border-bottom: 1px solid var(--line); border-left: 4px solid var(--muted); }
.alert--agua { border-left-color: #2980b9; }
.alert--energia { border-left-color: #e67e22; }
.alert--transito { border-left-color: #c0392b; }
.alert-tag { display: inline-block; font-weight: 700; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.alert-title { margin: 0.2rem 0 0.4rem; font-size: 1rem; font-weight: 700; }
.alert-meta { margin: 0.1rem 0; font-size: 0.86rem; color: var(--fg); }
.alert-text { margin: 0.3rem 0 0.5rem; font-size: 0.9rem; }

/* ── Falecimentos ───────────────────────────────────────────── */
.obits { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.obit-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 520px; }
.obit-table th, .obit-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.obit-table th { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.4px; }
.obit-table tr:hover { background: var(--hover); }
.obit-sources { color: var(--muted); font-size: 0.76rem; margin: 14px 0; }

/* ── Rodapé ─────────────────────────────────────────────────── */
.site-footer { border-top: 3px solid var(--fg); background: var(--bg); margin-top: 32px; }
.site-footer .wrap { padding: 16px 20px; color: var(--muted); font-size: 0.78rem; }
.disclosure { color: var(--muted); font-size: 0.73rem; font-style: italic; }

/* ── Tablet (≥ 700px) ───────────────────────────────────────── */
@media (min-width: 700px) {
  .news-grid {
    grid-template-columns: repeat(2, 1fr);
    column-gap: 28px;
  }
  .news-grid .tweet {
    border-bottom: none;
    border-top: 1px solid var(--line);
    padding-top: 20px;
  }
  .news-grid .tweet:nth-child(-n+2) { border-top: none; padding-top: 0; }
}

/* ── Desktop médio (1024–1279px): nav compacto ──────────────── */
@media (min-width: 1024px) and (max-width: 1279px) {
  .nav a { padding: 9px 7px; letter-spacing: 0; font-size: 0.71rem; }
}

/* ── Desktop (≥ 1024px) ─────────────────────────────────────── */
@media (min-width: 1024px) {
  .brand { font-size: 2.3rem; }

  /* Lead: hero 3/5 + sidebar 2/5 */
  .lead-grid {
    grid-template-columns: 3fr 2fr;
    border-bottom: 1px solid var(--line);
    margin-bottom: 16px;
  }
  .lead-main { padding: 20px 32px 20px 0; border-right: 1px solid var(--line); }
  .lead-sidebar { padding: 0 0 0 28px; }
  .tweet--hero .tweet-title { font-size: 2rem; }

  /* Grade 3 colunas */
  .news-grid { grid-template-columns: repeat(3, 1fr); }
  .news-grid .tweet:nth-child(-n+3) { border-top: none; padding-top: 0; }
  /* os dois primeiros do grid 2-col precisam ter border-top de volta */
  .news-grid .tweet:nth-child(1),
  .news-grid .tweet:nth-child(2) { border-top: 1px solid var(--line); padding-top: 20px; }
  .news-grid .tweet:nth-child(-n+3) { border-top: none; padding-top: 0; }

  /* Artigo mais largo no desktop */
  .post { max-width: 780px; }
  .post h1 { font-size: 2.2rem; }
}

/* ── Mobile (≤ 760px) ───────────────────────────────────────── */
@media (max-width: 760px) {
  .wrap { padding: 0 12px; }
  .masthead { padding: 8px 12px; }
  .brand { font-size: 1.6rem; }
  .nav-toggle { display: flex; }
  .nav {
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    padding: 0 16px;
  }
  .nav.open { max-height: 500px; padding: 6px 16px; }
  .nav a { padding: 11px 4px; border-bottom: 1px solid rgba(255,255,255,.1); font-size: 0.88rem; letter-spacing: 0; }
  .post h1 { font-size: 1.5rem; }
  .tweet--hero .tweet-title { font-size: 1.3rem; }
}

/* ── Perfis municipais ──────────────────────────────────────── */
.mun-header { padding: 16px 0; border-bottom: 3px solid var(--fg); margin-bottom: 0; }
.mun-tagline { font-size: 1.1rem; color: var(--muted); margin: 6px 0 0; font-style: italic; }
.mun-ficha { margin: 24px 0; }
.mun-ficha table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mun-ficha th, .mun-ficha td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.mun-ficha th { color: var(--muted); font-size: .72rem; text-transform: uppercase; }
.mun-ficha tr:hover { background: var(--hover); }
.mun-body { max-width: 720px; }
.mun-body h2 { font-size: 1.1rem; font-weight: 800; margin: 24px 0 8px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.mun-body p { margin: 0 0 1rem; font-size: 1rem; line-height: 1.65; }
.mun-news { margin: 32px 0; }
.mun-news h2 { font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; padding: 12px 0; border-bottom: 3px solid var(--fg); }
.mun-fontes { margin: 24px 0; color: var(--muted); font-size: .82rem; }
.mun-fontes h2 { font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; padding: 12px 0; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.mun-fontes ul { padding-left: 18px; }
.mun-fontes li { margin: 3px 0; }
.mun-fontes a { color: var(--accent); text-decoration: underline; }
