/* ==========================================================================
   LAYOUT — barra superior, cabeçalho, navegação, ticker, grelhas, rodapé
   e navegação inferior (mobile)
   ========================================================================== */

/* ---- Barra superior ---- */
.topbar { background: var(--c-bg-dark); color: var(--c-on-dark); font-size: 13px; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 36px; }
.topbar__left, .topbar__right { display: flex; gap: 16px; align-items: center; }
.topbar a:hover { color: #fff; text-decoration: underline; }
.topbar__pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .03em;
  padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, .08);
}
.topbar__pill b { color: #ffd6d6; }

/* Temperatura (uma capital de cada vez) */
.weather { display: flex; align-items: center; padding-left: 16px; border-left: 1px solid rgba(255, 255, 255, .16); min-width: 0; }
.weather__item { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; animation: weather-in .45s ease both; }
.weather__item svg { width: 16px; height: 16px; flex: none; color: #ffc861; }
.weather__item b { font-weight: 700; color: #fff; }
.weather__now { font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.weather__range { display: inline-flex; gap: 8px; font-size: 12px; opacity: .8; font-variant-numeric: tabular-nums; }
.weather__range span:first-child { color: #8ec5ff; }
.weather__range span:last-child { color: #ffab8a; }
@keyframes weather-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .weather__item { animation: none; } }

/* ---- Logótipo ---- */
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--c-brand); }
.logo img { width: 40px; height: 40px; flex: none; border-radius: 8px; }
.logo__word {
  font-family: var(--f-serif); font-weight: 700; font-size: 36px; letter-spacing: -1.5px; line-height: 1;
}
.logo__tag {
  display: block; margin-top: 4px;
  font-family: var(--f-sans); font-size: 10.5px; font-weight: 600;
  letter-spacing: .2em; text-transform: uppercase; color: var(--c-muted);
}
.logo--sm img { width: 30px; height: 30px; }
.logo--sm .logo__word { font-size: 26px; letter-spacing: -1px; }

/* ---- Masthead ---- */
.masthead { background: var(--c-bg); border-bottom: 1px solid var(--c-line); }
.masthead .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 16px; }
.masthead__actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px;
  border: 1px solid var(--c-line); border-radius: 50%;
  background: var(--c-bg); color: var(--c-ink);
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--c-bg-soft); border-color: var(--c-muted); }
.icon-btn svg { width: 18px; height: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: var(--c-brand); color: #fff;
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--c-brand-dark); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn svg { width: 18px; height: 18px; }
.btn--ghost { background: transparent; color: var(--c-ink); border-color: var(--c-line); }
.btn--ghost:hover { background: var(--c-bg-soft); }
.btn--true { background: var(--c-true); }
.btn--false { background: var(--c-false); }
.btn--block { width: 100%; }

.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 14px 0 4px; border-radius: 999px;
  border: 1px solid var(--c-line); background: var(--c-bg);
  font-size: 14px; font-weight: 600; color: var(--c-ink);
}
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--c-brand); color: #fff; font-weight: 700; font-size: 14px;
}

/* ---- Navegação principal ---- */
.mainnav {
  position: sticky; top: 0; z-index: 50;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-line);
  box-shadow: 0 3px 0 -1px var(--c-brand);
}
.mainnav .container { display: flex; align-items: center; height: var(--header-h); gap: 8px; }
.mainnav__logo { display: none; margin-right: 8px; }
.mainnav.is-stuck .mainnav__logo { display: inline-flex; }

.mainnav__list { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.mainnav__list::-webkit-scrollbar { display: none; }
.mainnav__list a {
  display: block; padding: 8px 12px;
  font-size: 14px; font-weight: 600; color: var(--c-ink); white-space: nowrap;
}
.mainnav__list a:hover { color: var(--c-brand); }
.mainnav__list a.is-active { color: var(--c-brand); box-shadow: inset 0 -3px 0 var(--c-brand); }
.mainnav__sep { width: 1px; background: var(--c-line); margin: 8px 6px; flex: none; }
.mainnav__actions { display: flex; gap: 4px; flex: none; }
.mainnav__actions .icon-btn { width: 38px; height: 38px; border: 0; }
.menu-toggle { display: none; }

/* ---- Menu lateral ---- */
.drawer { position: fixed; inset: 0; z-index: 100; visibility: hidden; }
.drawer__backdrop { position: absolute; inset: 0; background: rgba(7, 16, 25, .55); opacity: 0; transition: opacity .25s; }
.drawer__panel {
  position: absolute; top: 0; left: 0; bottom: 0; width: min(330px, 86vw);
  background: var(--c-bg); padding: 20px; overflow-y: auto;
  transform: translateX(-100%); transition: transform .25s;
}
.drawer.is-open { visibility: visible; }
.drawer.is-open .drawer__backdrop { opacity: 1; }
.drawer.is-open .drawer__panel { transform: none; }
.drawer__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.drawer__label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--c-muted); margin: 18px 0 4px; }
.drawer__list a { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--c-line); font-weight: 600; color: var(--c-ink); }
.drawer__list a svg { width: 18px; height: 18px; flex: none; color: var(--c-muted); }
.drawer__panel .btn svg, .drawer__head .icon-btn svg { width: 18px; height: 18px; flex: none; }
.drawer__head .logo svg, .drawer__head .logo img { max-height: 32px; width: auto; }

/* ---- Pesquisa ---- */
.search-overlay {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(7, 16, 25, .94);
  display: none; align-items: flex-start; justify-content: center;
  padding: 15vh var(--gutter) 0;
}
.search-overlay.is-open { display: flex; }
.search-overlay form { width: 100%; max-width: 720px; display: flex; gap: 8px; }
.search-overlay input {
  flex: 1; min-width: 0; height: 56px; padding: 0 20px;
  font-size: 19px; border: 0; border-radius: var(--radius); background: #fff; color: #111;
}
.search-overlay .btn { height: 56px; width: 56px; padding: 0; }
.search-overlay__close { position: absolute; top: 20px; right: 20px; background: transparent !important; color: #fff !important; border-color: rgba(255, 255, 255, .3) !important; }
.search-overlay__hint { position: absolute; top: calc(15vh + 70px); color: #93a3ae; font-size: 13px; }

/* ---- Ticker ---- */
.ticker { background: var(--c-bg); border-bottom: 1px solid var(--c-line); font-size: 14px; }
.ticker .container { display: flex; align-items: center; height: 42px; gap: 14px; overflow: hidden; }
.ticker__label {
  flex: none; background: var(--c-false); color: #fff;
  padding: 4px 10px; border-radius: 2px;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  display: inline-flex; align-items: center; gap: 6px;
}
.ticker__label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }
.ticker__track { flex: 1; overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.ticker__items { display: flex; gap: 48px; width: max-content; animation: marquee 60s linear infinite; }
.ticker__items:hover { animation-play-state: paused; }
.ticker__items a { display: inline-flex; align-items: center; gap: 8px; color: var(--c-ink); font-weight: 500; white-space: nowrap; }
.ticker__items a:hover { color: var(--c-brand); }

@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes pulse { 50% { opacity: .3; } }

/* ---- Grelhas ---- */
main { padding-block: 20px 40px; min-height: 60vh; }
.section { margin-bottom: 48px; }

.layout-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 40px; }
.sidebar { display: flex; flex-direction: column; gap: 32px; min-width: 0; }
.sidebar__sticky { position: sticky; top: calc(var(--header-h) + 20px); display: flex; flex-direction: column; gap: 32px; }

.grid { display: grid; gap: var(--gap); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---- Rodapé ---- */
.footer { background: var(--c-bg-dark); color: rgba(255, 255, 255, .78); font-size: 14px; padding-top: 48px; }
.footer h4 { font-family: var(--f-sans); font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: #fff; margin-bottom: 14px; }
.footer__grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 32px; padding-bottom: 40px; border-bottom: 1px solid rgba(255, 255, 255, .18); }
.footer .logo { color: #fff; }
.footer__about { margin-top: 14px; max-width: 340px; line-height: 1.6; }
.footer__list li + li { margin-top: 8px; }
.footer__list a:hover { color: #fff; }
.footer__social { display: flex; gap: 8px; margin-top: 18px; }
.footer__social .icon-btn { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .3); }
.footer__social .icon-btn:hover { background: rgba(0, 0, 0, .2); }
.footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-block: 20px; font-size: 13px; }
.footer__bottom nav { display: flex; gap: 16px; flex-wrap: wrap; }
.footer__bottom a:hover { color: #fff; }

/* ---- Voltar ao topo ---- */
.to-top {
  position: fixed; right: 20px; bottom: calc(20px + var(--bottom-nav-h)); z-index: 40;
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--c-ink); color: var(--c-bg);
  display: grid; place-items: center; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transform: translateY(10px);
  transition: opacity .2s, transform .2s;
}
.to-top svg { width: 20px; height: 20px; }
.to-top.is-visible { opacity: 1; pointer-events: auto; transform: none; }

/* ---- Navegação inferior (estilo app, só mobile) ---- */
.bottom-nav { display: none; }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--bottom-nav-h)); z-index: 200;
  transform: translate(-50%, 20px); opacity: 0;
  background: var(--c-ink); color: var(--c-bg);
  padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow); transition: opacity .2s, transform .2s; pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   Responsivo
   ========================================================================== */
@media (max-width: 1080px) {
  .layout-sidebar { grid-template-columns: minmax(0, 1fr); }
  .sidebar__sticky { position: static; }
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  :root { --bottom-nav-h: 64px; --header-h: 58px; }
  .masthead { display: none; }
  .topbar__date, .topbar__right { display: none; }
  .topbar .container { justify-content: center; min-height: 32px; }
  .weather { padding-left: 0; border: 0; }
  .topbar:not(:has(.weather:not([hidden]))) { display: none; }
  .menu-toggle { display: inline-grid; }
  .mainnav { box-shadow: none; }
  .mainnav__list, .mainnav__sep { display: none; }
  .mainnav .container { justify-content: space-between; }
  .mainnav__logo { display: inline-flex; margin: 0; }
  .grid--2, .grid--3 { grid-template-columns: minmax(0, 1fr); }
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .footer__grid { grid-template-columns: 1fr; }
  main { padding-top: 16px; }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: var(--bottom-nav-h);
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--c-bg) 92%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--c-line);
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 10.5px; font-weight: 600; color: var(--c-muted);
  }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.is-active { color: var(--c-brand); }
  .bottom-nav__cta span:first-child {
    display: grid; place-items: center;
    width: 48px; height: 48px; margin-top: -22px; border-radius: var(--radius);
    background: var(--c-brand); color: #fff;
    box-shadow: 0 6px 16px rgba(193, 3, 3, .4);
  }
  .bottom-nav__cta.is-active { color: var(--c-brand); }
}

/* Os botões de tema/pesquisa do menu só aparecem quando o cabeçalho principal não está visível */
@media (min-width: 761px) {
  .mainnav__actions { display: none; }
  .mainnav.is-stuck .mainnav__actions { display: flex; }
}

/* Mais editorias: as secções fixas não encolhem e as editorias deslizam */
.mainnav__list { min-width: 0; }
.mainnav__list:first-of-type { flex: none; }

/* ---- Números de emergência ---- */
.sos { display: flex; align-items: center; gap: 14px 22px; flex-wrap: wrap; }
.sos__title { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #ff8a80; }
.sos__title svg { width: 18px; height: 18px; flex: none; }
.sos__list { display: flex; flex-wrap: wrap; gap: 8px; }
.sos__list a {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 7px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); font-size: 13.5px; white-space: nowrap;
  transition: background .2s, border-color .2s;
}
.sos__list a { cursor: pointer; }
.sos__list a.is-copied { background: rgba(31, 168, 120, .25); border-color: rgba(47, 224, 162, .6); }
.sos__list a:hover { background: rgba(214, 69, 69, .22); border-color: rgba(255, 138, 128, .5); text-decoration: none; }
.sos__name { display: inline-flex; align-items: center; gap: 7px; align-self: center; }
.sos__name svg { width: 19px; height: 19px; flex: none; color: #ff8a80; }
.sos--drawer .sos__name svg { color: var(--c-false); }
.sos__list a { align-items: center; }
.sos__list b { font-size: 15px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.sos--footer { padding-bottom: 26px; margin-bottom: 30px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.sos--drawer { display: block; margin-top: 18px; }
.sos--drawer .sos__title { color: var(--c-false); margin-bottom: 8px; }
.sos--drawer .sos__list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.sos--drawer .sos__list a { display: flex; justify-content: space-between; border-radius: 10px; background: var(--c-bg-soft); border-color: var(--c-line); color: var(--c-ink); }
.sos--drawer .sos__list b { color: var(--c-false); }
@media (max-width: 760px) { .sos--footer .sos__list { display: grid; grid-template-columns: 1fr 1fr; width: 100%; } .sos--footer .sos__list a { display: flex; justify-content: space-between; } }

/* ---- Faixa de emergência na página inicial ---- */
.sosband {
  --sos-red: #e5484d;
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 20px 32px;
  margin: -16px 0 48px; padding: 22px 26px; border-radius: var(--radius);
  background: linear-gradient(115deg, #13202b 0%, #1a2632 55%, #2a1a20 100%);
  color: #c8d3da;
}
.sosband::before { /* brilho vermelho que vai e vem, como uma luz de sirene */
  content: ""; position: absolute; z-index: -1; top: -60%; left: -10%; width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, rgba(229, 72, 77, .35), transparent 65%);
  animation: sos-sweep 7s ease-in-out infinite alternate;
}
@keyframes sos-sweep { from { transform: translateX(0); opacity: .9; } to { transform: translateX(min(70vw, 900px)); opacity: .5; } }
.sosband__head { display: flex; align-items: center; gap: 14px; }
.sosband__head h2 { font-size: 20px; color: #fff; line-height: 1.15; }
.sosband__head p { font-size: 13px; opacity: .75; margin-top: 3px; }
.sosband__beacon {
  position: relative; flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: var(--sos-red); color: #fff;
}
.sosband__beacon svg { width: 24px; height: 24px; }
.sosband__beacon::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--sos-red); animation: sos-ping 1.8s ease-out infinite; }
@keyframes sos-ping { from { transform: scale(1); opacity: .8; } to { transform: scale(1.9); opacity: 0; } }

.sosband__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.sosband__item {
  --c: var(--sos-red);
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 11px; align-items: center;
  padding: 11px 14px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1);
  color: inherit; text-decoration: none; transition: transform .2s ease, background .2s, border-color .2s;
  animation: sos-in .5s ease both; animation-delay: calc(var(--i) * 90ms + .15s);
}
.sosband__item:hover { transform: translateY(-3px); background: rgba(255, 255, 255, .1); border-color: color-mix(in srgb, var(--c) 60%, transparent); text-decoration: none; }
.sosband__item.is-copied { background: rgba(31, 168, 120, .25); border-color: rgba(47, 224, 162, .6); }
.sosband__icon { grid-row: 1 / 3; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--c); }
.sosband__icon svg { width: 22px; height: 22px; }
.sosband__item .sos__name { font-size: 12.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.sosband__item b { font-size: 22px; font-weight: 800; color: #fff; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.sos--police  { --c: #4f9cf0; }
.sos--medical { --c: #ff5a5f; }
.sos--flame   { --c: #ff8a3d; }
.sos--child   { --c: #f06bb3; }
.sos--phone   { --c: #2fe0a2; }
@keyframes sos-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sosband::before, .sosband__beacon::after, .sosband__item { animation: none; } }
@media (max-width: 900px) { .sosband { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .sosband { margin: -20px 0 36px; padding: 18px 16px; }
  .sosband__list { grid-template-columns: 1fr 1fr; gap: 8px; }
  .sosband__item { padding: 10px; column-gap: 9px; }
  .sosband__icon { width: 34px; height: 34px; }
  .sosband__item b { font-size: 19px; }
}
:root[data-theme="dark"] .sosband { border: 1px solid rgba(255, 255, 255, .08); }
@media (max-width: 760px) { .sosband__item .sos__name { white-space: normal; line-height: 1.2; } }
