/* Fontes da marca — as mesmas usadas nos posts (Montserrat, SIL OFL 1.1). */
@font-face {
  font-family: "Montserrat";
  src: url("assets/fonts/Montserrat-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("assets/fonts/Montserrat-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("assets/fonts/Montserrat-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("assets/fonts/Montserrat-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("assets/fonts/Montserrat-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Paleta retirada dos posts e do logo: ciano #00c7d6, gradiente do selo
     #0d9ba8 → #22c8d2 e preto profundo #15181d. */
  --brand: #00c7d6;
  --brand-deep: #0d9ba8;
  --brand-bright: #22c8d2;
  --brand-soft: #e2f7f9;
  --brand-faint: #c1f1f4;
  --ink: #15181d;
  --ink-deep: #0e1417;
  --muted: #5a6a71;
  --line: #dbe4e7;
  --line-strong: #b9c7cc;
  --paper: #ffffff;
  --canvas: #f5f8f9;
  --soft: #edf3f4;
  --coral: #c85d4b;
  --danger: #9b3f38;
  --shadow-low: 0 6px 22px rgba(14, 27, 33, 0.08);
  --shadow-mid: 0 18px 44px rgba(14, 27, 33, 0.14);
  --radius: 12px;
  --radius-small: 8px;
  /* Layout largo: margens laterais pequenas (15px) em qualquer ecrã. */
  --content: min(2000px, calc(100vw - 30px));
  --page-padding: 15px;
  font-family: Montserrat, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.6;
  transition: opacity 150ms ease;
}

body.switching {
  opacity: 0.68;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input {
  letter-spacing: 0;
}

::selection {
  color: var(--ink);
  background: var(--brand-faint);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(13, 155, 168, 0.4);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 16px;
  z-index: 100;
  padding: 9px 13px;
  border-radius: 6px;
  color: white;
  background: var(--ink-deep);
  transform: translateY(-160%);
  transition: transform 150ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 68px;
  padding: 10px var(--page-padding);
  border-bottom: 1px solid rgba(219, 228, 231, 0.9);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.brand img {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  object-fit: cover;
}

/* Wordmark do cabeçalho: letras + relógio do logo em fundo transparente. */
.brand .brand-wordmark {
  width: auto;
  height: 42px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 0;
  object-fit: contain;
}

.brand span {
  overflow: hidden;
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand span b {
  color: var(--brand-deep);
  font-weight: 800;
}

.main-nav {
  display: flex;
  min-width: 0;
  justify-content: center;
  gap: 6px;
}

.main-nav a {
  position: relative;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease;
}

.main-nav a:hover {
  color: var(--ink);
  background: var(--brand-soft);
}

.main-nav a.active {
  color: var(--brand-deep);
  background: var(--brand-soft);
  font-weight: 700;
}

.language-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(44px, auto));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--canvas);
  box-shadow: inset 0 1px 2px rgba(14, 27, 33, 0.06);
}

.language-switch button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  transition: background-color 150ms ease, color 150ms ease;
}

.language-switch button:hover {
  color: var(--ink);
}

.language-switch button[aria-pressed="true"] {
  color: white;
  background: linear-gradient(120deg, var(--brand-deep) 0%, var(--brand) 100%);
  box-shadow: 0 2px 8px rgba(13, 155, 168, 0.35);
}

.view {
  display: none;
  animation: reveal 210ms ease both;
}

.view.active {
  display: block;
}

.hero {
  position: relative;
  display: flex;
  width: 100%;
  /* Altura FIXA: o carrossel nunca muda de tamanho, só o conteúdo. */
  height: clamp(520px, 70vh, 640px);
  align-items: flex-end;
  overflow: hidden;
  padding: 64px 72px 64px;
  color: white;
  background-color: #101d23;
  background-position: center;
  background-size: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(115% 90% at 82% 8%, rgba(0, 199, 214, 0.16) 0%, rgba(0, 199, 214, 0) 55%),
    linear-gradient(180deg, rgba(8, 20, 26, 0.42) 0%, rgba(8, 20, 26, 0.86) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  width: min(790px, calc(100% - 56px));
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand-deep);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: var(--brand);
}

.hero h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(2.4rem, 4.6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.04;
  text-wrap: balance;
  /* Altura fixa do hero: no máximo 3 linhas de título. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.hero h1 a {
  color: inherit;
}

.hero h1 a:hover {
  text-decoration: underline;
  text-decoration-color: var(--brand);
  text-decoration-thickness: 3px;
  text-underline-offset: 7px;
}

.hero-year {
  display: inline-block;
  margin: 18px 0 0;
  padding: 4px 14px;
  border: 1px solid rgba(0, 199, 214, 0.55);
  border-radius: 999px;
  color: var(--brand);
  background: rgba(0, 199, 214, 0.14);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-summary {
  max-width: 650px;
  margin: 16px 0 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.02rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.hero-actions,
.card-actions,
.news-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions {
  margin-top: 26px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  cursor: pointer;
  font-size: 0.87rem;
  font-weight: 700;
  line-height: 1.2;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  border-color: transparent;
  color: white;
  background: linear-gradient(120deg, var(--brand-deep) 0%, var(--brand) 100%);
  box-shadow: 0 6px 18px rgba(13, 155, 168, 0.32);
}

.button.primary:hover {
  background: linear-gradient(120deg, #0b8a95 0%, #06b4c3 100%);
}

.button.secondary {
  border-color: rgba(255, 255, 255, 0.55);
  color: white;
  background: rgba(15, 35, 44, 0.2);
}

.button.secondary:hover {
  border-color: rgba(255, 255, 255, 0.85);
}

.button[aria-disabled="true"],
.button:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.button[hidden] {
  display: none;
}

.watermark {
  position: absolute;
  right: var(--page-padding);
  bottom: 20px;
  z-index: 2;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Controlos do carrossel: setas estilizadas nas pontas (sem caixa) e pontos
   no centro inferior — o ponto do destaque ativo é o temporizador: o círculo
   preenchido torna-se cinzento no sentido dos ponteiros do relógio. */
.hero-edge {
  position: absolute;
  top: 50%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  color: white;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.65));
  transform: translateY(-50%);
  transition: color 170ms ease, transform 170ms ease;
}

.hero-edge svg {
  width: 30px;
  height: 30px;
  stroke-width: 1.6;
}

.hero-edge:hover,
.hero-edge:focus-visible {
  color: var(--brand);
  outline: none;
}

.hero-edge.prev:hover {
  transform: translateY(-50%) translateX(-3px);
}

.hero-edge.next:hover {
  transform: translateY(-50%) translateX(3px);
}

.hero-edge.prev {
  left: 12px;
}

.hero-edge.next {
  right: 12px;
}

.hero-dots {
  position: absolute;
  bottom: 22px;
  left: 50%;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 9px;
  transform: translateX(-50%);
}

.hero-dot {
  position: relative;
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.34);
  cursor: pointer;
  overflow: hidden;
  transition: background-color 150ms ease, transform 150ms ease;
}

.hero-dot:hover {
  background: rgba(255, 255, 255, 0.65);
}

.hero-dot.active {
  width: 14px;
  height: 14px;
  transform: scale(1.08);
  box-shadow: 0 0 0 2px rgba(0, 199, 214, 0.35);
}

.hero-dot .hero-dot-fill {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  /* O cinzento avança a partir do topo no sentido dos ponteiros do relógio,
     consumindo o ciano preenchido. */
  background: conic-gradient(
    from 0deg,
    rgba(255, 255, 255, 0.34) 0turn,
    rgba(255, 255, 255, 0.34) calc(var(--p, 0) * 1turn),
    var(--brand) calc(var(--p, 0) * 1turn),
    var(--brand) 1turn
  );
}

.hero-dot:not(.active) .hero-dot-fill {
  display: none;
}

.section-shell,
.page-view {
  width: var(--content);
  margin-right: auto;
  margin-left: auto;
}

.explore-section {
  padding: 34px 0 8px;
}

.explore-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.explore-tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 96px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.explore-tile:hover {
  border-color: var(--brand-faint);
  box-shadow: var(--shadow-low);
  transform: translateY(-2px);
}

.explore-glyph {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  color: var(--brand-deep);
  background: var(--brand-soft);
}

.explore-glyph svg {
  width: 24px;
  height: 24px;
}

.explore-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.explore-copy strong {
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 700;
}

.explore-copy span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.explore-arrow {
  color: var(--brand-deep);
  font-size: 1.1rem;
  font-weight: 700;
  transition: transform 160ms ease;
}

.explore-tile:hover .explore-arrow {
  transform: translateX(4px);
}

.latest-section {
  padding: 40px 0 76px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.section-heading h2,
.page-intro h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.08;
  text-wrap: balance;
}

.section-note {
  max-width: 410px;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: right;
}

.latest-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.latest-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.latest-card:hover {
  border-color: var(--brand-faint);
  box-shadow: var(--shadow-low);
  transform: translateY(-2px);
}

.card-image-link {
  display: block;
  overflow: hidden;
  background: var(--soft);
}

.latest-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: 50% 28%;
  transition: transform 260ms ease;
}

.latest-card:hover img {
  transform: scale(1.02);
}

.latest-card .content {
  padding: 17px 17px 19px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 9px;
  color: var(--brand-deep);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.latest-card h3,
.story-card h3 {
  margin: 9px 0 0;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  text-wrap: pretty;
}

.latest-card p,
.story-card p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.card-actions {
  margin-top: 14px;
}

.text-link {
  color: var(--brand-deep);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: color 150ms ease, text-decoration-color 150ms ease;
}

.text-link:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

.carousel-section {
  padding: 44px 0 22px;
}

.carousel-controls {
  display: inline-flex;
  gap: 8px;
}

.carousel-controls button,
.day-navigation > button,
.calendar-toolbar > button:not(.calendar-date-button),
.calendar-month-nav > button:not(.calendar-month-button) {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  color: var(--brand-deep);
  background: var(--paper);
  cursor: pointer;
  font-size: 1.45rem;
  line-height: 1;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.carousel-controls button:hover,
.day-navigation > button:hover,
.calendar-toolbar > button:not(.calendar-date-button):hover,
.calendar-month-nav > button:not(.calendar-month-button):hover {
  border-color: var(--brand);
  color: var(--ink);
  background: var(--brand-soft);
}

.carousel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101d23;
}

.carousel-track {
  display: flex;
  transition: transform 400ms ease;
  will-change: transform;
}

.story-card {
  position: relative;
  display: flex;
  min-height: 390px;
  flex: 0 0 100%;
  align-items: flex-end;
  overflow: hidden;
  padding: 38px;
  color: white;
  background-position: center;
  background-size: cover;
}

.story-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 20, 26, 0.36) 0%, rgba(8, 20, 26, 0.82) 100%);
}

.story-card .content {
  position: relative;
  z-index: 1;
  max-width: 680px;
}

.story-card h3 {
  color: white;
  font-size: 2.4rem;
}

.story-card p,
.story-card .meta {
  color: rgba(255, 255, 255, 0.85);
}

.story-card .meta {
  color: var(--brand);
}

.page-view {
  min-height: calc(100vh - 174px);
  padding: 64px 0 84px;
}

.page-intro {
  max-width: 860px;
  margin-bottom: 34px;
}

.page-intro p:last-child {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

/* Painel único do calendário: navegação de mês/ano à esquerda, escolher data
   ao lado do filtro de fontes, e a grelha do mês na mesma caixa. */
.calendar-panel {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--canvas);
}

.calendar-panel[hidden] {
  display: none;
}

.calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.calendar-month-nav {
  display: flex;
  align-items: end;
  gap: 8px;
  flex: 0 0 auto;
}

.calendar-month-button {
  min-height: 42px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.calendar-month-button:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.calendar-month-button strong {
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: capitalize;
}

.calendar-month-button span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.calendar-date-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.calendar-date-button:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.calendar-date-button svg {
  width: 18px;
  height: 18px;
  color: var(--brand-deep);
}

.calendar-popover {
  position: fixed;
  z-index: 60;
  width: min(320px, calc(100vw - 24px));
  max-height: min(420px, calc(100vh - 24px));
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-mid);
}

.calendar-popover-year {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.calendar-popover-year strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.calendar-popover-year button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  color: var(--brand-deep);
  background: var(--paper);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.calendar-popover-year button:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.calendar-popover-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.calendar-popover-grid button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: capitalize;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.calendar-popover-grid button:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.calendar-popover-grid button.selected {
  color: white;
  border-color: transparent;
  background: linear-gradient(120deg, var(--brand-deep) 0%, var(--brand) 100%);
}

.calendar-popover-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.calendar-popover-days .popover-weekday {
  display: grid;
  place-items: center;
  min-height: 26px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.calendar-popover-days span:not(.popover-weekday) {
  display: block;
  min-height: 34px;
}

.calendar-popover-days button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background-color 140ms ease;
}

.calendar-popover-days button:hover {
  background: var(--brand-soft);
}

.calendar-popover-days button.has-posts::after {
  content: "·";
  display: block;
  height: 6px;
  margin: -6px 0 0;
  color: var(--brand-deep);
  font-size: 0.8rem;
  line-height: 1;
}

.calendar-popover-days button.selected {
  color: white;
  background: linear-gradient(120deg, var(--brand-deep) 0%, var(--brand) 100%);
}

.calendar-popover-days button.selected::after {
  color: white;
}

.calendar-toolbar > button:not(.calendar-date-button),
.calendar-month-nav > button:not(.calendar-month-button) {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  color: var(--brand-deep);
  background: var(--paper);
  cursor: pointer;
  font-size: 1.45rem;
  line-height: 1;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.calendar-toolbar > button:not(.calendar-date-button):hover,
.calendar-month-nav > button:not(.calendar-month-button):hover {
  border-color: var(--brand);
  color: var(--ink);
  background: var(--brand-soft);
}

.day-navigation label,
.calendar-toolbar label,
.topic-form label {
  display: grid;
  min-width: 0;
  gap: 6px;
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.day-navigation input,
.day-navigation select,
.calendar-toolbar input,
.calendar-toolbar select,
.topic-form input,
.topic-form select {
  width: 100%;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  color: var(--ink);
  background: var(--paper);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.calendar-toolbar select,
.topic-form select,
.chart-download-controls select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230d9ba8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.day-navigation input:focus,
.day-navigation select:focus,
.calendar-toolbar input:focus,
.calendar-toolbar select:focus,
.topic-form input:focus,
.topic-form select:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(0, 199, 214, 0.18);
}

.calendar-date-field input {
  min-width: 158px;
}

.calendar-source-field {
  min-width: min(290px, 100%);
}

.calendar-date-field,
.calendar-date-button {
  margin-left: auto;
}

.calendar-picker-panel .calendar-grid {
  margin-bottom: 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 28px;
}

.calendar-panel .calendar-grid {
  margin-bottom: 0;
}

.calendar-weekday,
.calendar-empty,
.calendar-day {
  min-height: 64px;
  border-radius: var(--radius-small);
}

.calendar-weekday {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.calendar-day {
  display: grid;
  width: 100%;
  align-content: space-between;
  padding: 8px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  text-align: left;
  font-weight: 600;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.calendar-day:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.calendar-day span {
  font-size: 0.9rem;
  font-weight: 700;
}

.calendar-day small {
  min-height: 16px;
  color: var(--brand-deep);
  font-size: 0.72rem;
  font-weight: 800;
}

.calendar-day.active {
  border-color: var(--brand-deep);
  color: white;
  background: linear-gradient(130deg, var(--brand-deep) 0%, var(--brand) 100%);
  box-shadow: 0 6px 16px rgba(13, 155, 168, 0.3);
}

.calendar-day.active small {
  color: rgba(255, 255, 255, 0.85);
}

.day-panel {
  padding-top: 8px;
}

.day-panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 20px;
}

.day-panel-heading h2,
.topic-result-heading h2,
.metrics-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.012em;
  line-height: 1.14;
}

.day-panel-heading p:last-child {
  max-width: 430px;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: right;
}

.calendar-status {
  margin: 0 0 18px;
  color: var(--muted);
  font-weight: 500;
}

.calendar-status.error {
  color: var(--danger);
}

.day-post-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.day-post-grid .latest-card .content {
  padding: 14px;
}

.day-post-grid + .recommendation-list {
  margin-top: 20px;
}

.recommendations-heading {
  margin: 36px 0 14px;
  font-size: 1.35rem;
  font-weight: 700;
}

.recommendation-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.recommendation-list a {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) minmax(120px, 190px);
  gap: 16px;
  align-items: center;
  min-height: 62px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-small);
  transition: background-color 140ms ease;
}

.recommendation-list a:hover {
  background: var(--brand-soft);
}

.recommendation-list span {
  color: var(--brand-deep);
  font-size: 0.82rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.recommendation-list strong {
  min-width: 0;
  color: var(--ink);
  font-size: 0.97rem;
  font-weight: 600;
  line-height: 1.3;
}

.recommendation-list em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 500;
  text-align: right;
}

.empty-state {
  margin: 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.topic-form {
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--canvas);
}

.topic-analysis-list {
  display: grid;
  gap: 12px;
}

.topic-analysis-row {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(180px, 1.25fr) 70px 42px;
  gap: 12px;
  align-items: end;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.topic-form-footer {
  display: grid;
  grid-template-columns: minmax(150px, 0.85fr) minmax(150px, 0.85fr) minmax(160px, 1fr) 42px auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.topic-form input[type="color"] {
  padding: 4px;
  cursor: pointer;
}

.topic-values-toggle {
  display: flex !important;
  min-height: 42px;
  align-items: center;
  gap: 9px !important;
  text-transform: none !important;
}

.topic-values-toggle input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--brand-deep);
}

.topic-add-analysis,
.topic-remove-analysis {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  color: var(--brand-deep);
  background: var(--paper);
  cursor: pointer;
  font: 700 1.35rem/1 Montserrat, system-ui, sans-serif;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.topic-add-analysis:hover,
.topic-remove-analysis:hover {
  border-color: var(--brand);
  color: var(--ink);
  background: var(--brand-soft);
}

.topic-add-analysis:disabled,
.topic-remove-analysis:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.topic-add-analysis[hidden] {
  display: none;
}

.topic-form .button.primary,
.news-detail-actions .button.primary,
.news-not-found .button.primary {
  border-color: transparent;
  color: white;
  background: linear-gradient(120deg, var(--brand-deep) 0%, var(--brand) 100%);
}

.topic-form .button.primary:hover,
.news-detail-actions .button.primary:hover,
.news-not-found .button.primary:hover {
  background: linear-gradient(120deg, #0b8a95 0%, #06b4c3 100%);
}

.topic-source-note {
  margin: -2px 0 16px;
  color: var(--muted);
  font-size: 0.84rem;
}

.topic-progress {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 14px 0 18px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.topic-progress[hidden] {
  display: none;
}

.topic-progress progress {
  width: min(350px, 58vw);
  height: 7px;
  accent-color: var(--brand);
}

.topic-progress > div {
  display: grid;
  gap: 2px;
}

.topic-progress small {
  max-width: 520px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.topic-status {
  min-height: 24px;
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 500;
}

.topic-result-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.topic-result-heading > strong {
  color: var(--brand-deep);
  font-variant-numeric: tabular-nums;
}

.topic-series-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0 0 12px;
}

.topic-series-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.topic-series-legend i {
  width: 20px;
  height: 3px;
  border-radius: 2px;
  background: var(--series-color);
}

.topic-chart-shell {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.topic-chart {
  display: block;
  width: 100%;
  min-width: 680px;
  aspect-ratio: 23 / 9.5;
}

.chart-grid-line {
  stroke: #e3ebee;
  stroke-width: 1;
}

.chart-axis-value,
.chart-year {
  fill: var(--muted);
  font-family: inherit;
  font-size: 12px;
}

.chart-line {
  fill: none;
  stroke: var(--brand-deep);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  /* Revelação ano a ano: a linha desenha-se e os pontos surgem em sequência
     apenas na renderização final — durante a pesquisa o gráfico cresce sem
     repetir a animação. */
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: chart-line-draw 1.6s ease-out forwards;
}

.topic-results.loading .chart-line {
  animation: none;
  stroke-dasharray: none;
  stroke-dashoffset: 0;
}

.topic-results.loading .chart-point,
.topic-results.loading .chart-value-label {
  animation: none;
  opacity: 1;
}

@keyframes chart-line-draw {
  to {
    stroke-dashoffset: 0;
  }
}

.chart-point {
  fill: var(--paper);
  stroke: var(--brand-deep);
  stroke-width: 3;
  opacity: 0;
  animation: chart-fade-in 260ms ease forwards;
  animation-delay: calc(var(--i, 0) * 110ms + 320ms);
}

@keyframes chart-fade-in {
  to {
    opacity: 1;
  }
}

.chart-value-label {
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 4px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  paint-order: stroke;
  pointer-events: none;
  opacity: 0;
  animation: chart-fade-in 260ms ease forwards;
  animation-delay: calc(var(--i, 0) * 110ms + 320ms);
}

.chart-post-point {
  fill: var(--coral);
  stroke: white;
  stroke-width: 2;
  cursor: pointer;
  transition: r 150ms ease;
}

.chart-post-point:hover {
  r: 7px;
}

.topic-chart-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 20px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

.topic-chart-notes,
.chart-download-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.chart-download-controls {
  flex-wrap: nowrap;
  gap: 8px;
}

.chart-download-controls select,
.chart-download {
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
}

.chart-download-controls select {
  color: var(--ink);
  background: var(--paper);
  font-weight: 500;
}

.chart-download {
  border-color: transparent;
  color: white;
  background: linear-gradient(120deg, var(--brand-deep) 0%, var(--brand) 100%);
  cursor: pointer;
  font-weight: 700;
}

.chart-download:hover {
  background: linear-gradient(120deg, #0b8a95 0%, #06b4c3 100%);
}

.chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.chart-legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--coral);
}

.metrics-overview {
  margin: 0 0 46px;
}

.metrics-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.metrics-heading .eyebrow {
  margin: 0;
}

.primary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.primary-metric {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand);
  border-radius: var(--radius);
  background: var(--paper);
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.primary-metric:hover {
  box-shadow: var(--shadow-low);
  transform: translateY(-2px);
}

.primary-metric > strong {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 2.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1;
}

.odometer-digit,
.odometer-static-digit,
.odometer-separator {
  display: inline-block;
  height: 1.16em;
  line-height: 1;
}

.odometer-digit {
  height: 1.16em;
  overflow: clip;
  vertical-align: -0.16em;
}

.odometer-static-digit {
  display: inline-block;
  height: 1.16em;
  /* Igual aos dígitos do rolo (line-height 1): sem desvio de baseline entre
     dígitos animados e estáticos no fim da animação. */
  line-height: 1;
}

.odometer-track {
  display: flex;
  flex-direction: column;
  transform: translateY(0);
  transition: transform 1250ms cubic-bezier(0.16, 0.72, 0.2, 1);
  transition-delay: var(--odometer-delay, 0ms);
  will-change: transform;
}

.odometer-track > span {
  height: 1.16em;
  flex: 0 0 1.16em;
  line-height: 1;
}

.primary-metric > strong.odometer-running .odometer-track {
  transform: translateY(var(--odometer-shift));
}

.primary-metric h3 {
  margin: 12px 0 6px;
  font-size: 0.98rem;
  font-weight: 700;
}

.primary-metric p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.supporting-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.supporting-metric {
  min-width: 0;
  padding: 17px 20px;
}

.supporting-metric + .supporting-metric {
  border-left: 1px solid var(--line);
}

.supporting-metric strong,
.supporting-metric span {
  display: block;
}

.supporting-metric strong {
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.supporting-metric-news strong {
  color: var(--brand-deep);
}

.supporting-metric-followers strong {
  color: var(--brand-deep);
}

.supporting-metric span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 42px;
  row-gap: 0;
  border-top: 1px solid var(--line);
}

.doc-card {
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.doc-card h2 {
  margin: 0 0 9px;
  color: var(--ink);
  font-size: 1.22rem;
  font-weight: 700;
}

.doc-card h2::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--brand);
}

.doc-card p,
.doc-card li {
  color: var(--muted);
}

.doc-card p {
  margin: 0;
}

.doc-card ul {
  margin: 12px 0 0;
  padding-left: 20px;
}

.doc-card li::marker {
  color: var(--brand-deep);
}

.docs-github {
  display: grid;
  gap: 4px;
  margin-top: 28px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.docs-github:hover {
  border-color: var(--brand-faint);
  box-shadow: var(--shadow-low);
  transform: translateY(-2px);
}

.docs-github strong {
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 700;
}

.docs-github span {
  color: var(--muted);
  font-size: 0.88rem;
}

/* Página individual da notícia — artigo de coluna única, como os sites de
   notícias: cabeçalho com categoria + Arquivo.pt, datas, imagem, texto e
   snapshot da página preservada. */
.news-detail {
  display: block;
  max-width: 860px;
  margin: 0 auto;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

/* Breadcrumb e artigo centrados na coluna de leitura */
.news-breadcrumb {
  max-width: 860px;
  margin: 0 auto;
}

.news-article-head {
  margin-bottom: 20px;
}

.news-article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.meta-pill {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  color: white;
  background: linear-gradient(120deg, var(--brand-deep) 0%, var(--brand) 100%);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-source {
  color: var(--brand-deep);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.news-article-head {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}

.news-article-head h1 {
  margin: 10px 0 12px;
  color: var(--ink);
  font-size: clamp(2rem, 3.6vw, 2.9rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.08;
  text-wrap: balance;
}

.news-article-dates {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.news-article-figure {
  width: 100%;
  margin: 0 0 26px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  aspect-ratio: 16 / 9;
  box-shadow: var(--shadow-low);
}

.news-article-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.news-article-lead {
  margin: 0 0 18px;
  color: var(--ink);
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.62;
}

.news-article-body p {
  margin: 0 0 16px;
  color: #46565d;
  font-size: 1rem;
  line-height: 1.7;
}

.news-article-sub {
  margin: 34px 0 14px;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.news-article-sub::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  margin-top: 8px;
  border-radius: 2px;
  background: var(--brand);
}

.news-article-snapshot {
  margin: 0 0 30px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-low);
}

.news-article-snapshot-frame {
  margin: 0;
}

.news-article-snapshot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 2px solid var(--brand);
  color: white;
  background: var(--ink-deep);
}

.news-article-snapshot-head strong {
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.news-article-snapshot-head strong::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--brand);
}

.news-article-snapshot-head span {
  color: #9fb0b8;
  font-size: 0.76rem;
  font-weight: 600;
}

.news-article-snapshot img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  object-position: top;
  background: white;
}

.news-article-snapshot figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.news-article-snapshot figcaption a {
  color: var(--brand-deep);
  font-weight: 700;
}

.news-article-snapshot figcaption a:hover {
  color: var(--ink);
}

.news-article-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.news-detail-copy h1,
.news-not-found h1 {
  margin: 8px 0 18px;
  color: var(--ink);
  font-size: clamp(2rem, 3.4vw, 2.7rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.1;
  text-wrap: balance;
}

.news-detail-meta {
  margin: 0;
  color: var(--brand-deep);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.news-detail-summary {
  margin: 0;
  color: #46565d;
  font-size: 1.02rem;
  line-height: 1.68;
}

.news-article-actions .button.secondary,
.news-detail-actions .button.secondary {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--paper);
}

.news-article-actions .button.secondary:hover,
.news-detail-actions .button.secondary:hover {
  border-color: var(--brand);
  color: var(--brand-deep);
}

.news-not-found {
  max-width: 680px;
}

.news-not-found > p:not(.eyebrow) {
  color: var(--muted);
}

.latest-card h3 a:hover,
.story-card h3 a:hover,
.day-post-grid h3 a:hover {
  color: var(--brand-deep);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.story-card h3 a:hover {
  color: var(--brand-faint);
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto auto;
  gap: 24px 48px;
  align-items: start;
  padding: 36px var(--page-padding);
  border-top: 3px solid var(--brand);
  color: #9fb0b8;
  background: var(--ink-deep);
  font-size: 0.84rem;
}

.footer-brand p {
  margin: 0;
  max-width: 380px;
}

.footer-brand p:first-child {
  margin-bottom: 6px;
  color: white;
  font-size: 1.05rem;
  font-weight: 800;
}

.footer-nav,
.footer-links {
  display: grid;
  gap: 8px;
  align-content: start;
}

.footer-nav a,
.footer-links a {
  color: #9fb0b8;
  font-weight: 500;
  transition: color 150ms ease;
}

.footer-nav a:hover,
.footer-links a:hover {
  color: var(--brand);
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  :root {
    --page-padding: 15px;
  }

  .site-header {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 4px;
    padding-bottom: 7px;
  }

  .main-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .main-nav::-webkit-scrollbar {
    display: none;
  }

  .hero {
    height: clamp(500px, 66vh, 600px);
    padding-right: 56px;
    padding-left: 56px;
  }

  .hero h1 {
    font-size: clamp(2.2rem, 7.5vw, 3.3rem);
  }

  .explore-grid {
    grid-template-columns: 1fr;
  }

  .latest-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .day-post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topic-analysis-row {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) 68px 42px;
  }

  .topic-form-footer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topic-values-toggle {
    grid-column: 1 / -1;
  }

  .topic-add-analysis {
    grid-column: 1;
  }

  .news-detail {
    gap: 32px;
  }

  .site-footer {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  :root {
    --page-padding: 12px;
  }

  body {
    font-size: 15px;
  }

  .site-header {
    min-height: 92px;
  }

  .brand .brand-wordmark {
    height: 36px;
  }

  .brand span {
    font-size: 0.95rem;
  }

  .main-nav a {
    padding-top: 7px;
    padding-bottom: 6px;
    font-size: 0.82rem;
  }

  .language-switch button {
    min-height: 33px;
    padding: 0 12px;
  }

  .hero {
    height: clamp(500px, 68svh, 600px);
    padding: 56px 54px 84px;
  }

  .hero-content {
    width: 100%;
  }

  .hero h1 {
    line-height: 1.06;
  }

  .hero-summary {
    font-size: 0.95rem;
  }

  .hero-edge {
    width: 36px;
    height: 36px;
  }

  .hero-edge svg {
    width: 24px;
    height: 24px;
  }

  .hero-edge.prev {
    left: 8px;
  }

  .hero-edge.next {
    right: 8px;
  }

  .hero-dots {
    bottom: 16px;
  }

  .watermark {
    right: 18px;
    bottom: 46px;
    font-size: 0.68rem;
  }

  .explore-section {
    padding: 26px 0 4px;
  }

  .latest-section {
    padding: 30px 0 58px;
  }

  .section-heading,
  .metrics-heading,
  .day-panel-heading,
  .topic-result-heading,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-heading {
    gap: 10px;
  }

  .section-note,
  .day-panel-heading p:last-child {
    text-align: left;
  }

  .page-view {
    padding: 44px 0 62px;
  }

  .page-intro {
    margin-bottom: 26px;
  }

  .primary-metrics,
  .doc-grid {
    grid-template-columns: 1fr;
  }

  .doc-grid {
    column-gap: 0;
  }

  .news-detail {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .news-detail-figure {
    order: -1;
  }

  .recommendation-list a {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 10px;
  }

  .recommendation-list em {
    grid-column: 2;
    text-align: left;
  }

  .topic-analysis-row {
    grid-template-columns: minmax(0, 1fr) 68px 42px;
  }

  .topic-analysis-row .topic-query-field,
  .topic-analysis-row .topic-source-field {
    grid-column: 1 / -1;
  }

  .topic-analysis-row .topic-color-field {
    grid-column: 2;
  }

  .topic-chart-footer {
    flex-direction: column;
  }

  .site-footer {
    gap: 18px;
  }

  .footer-nav,
  .footer-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
  }
}

@media (max-width: 620px) {
  .latest-grid,
  .day-post-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 520px) {
  .brand {
    max-width: calc(100vw - 112px);
  }

  .hero {
    height: 520px;
    padding: 48px 42px 64px;
  }

  .hero h1 {
    font-size: 2.1rem;
  }

  .hero-year {
    margin-top: 14px;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions .button {
    width: 100%;
  }

  .explore-tile {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .explore-arrow {
    display: none;
  }

  .story-card {
    min-height: 360px;
    padding: 24px;
  }

  .story-card h3 {
    font-size: 1.9rem;
  }

  .calendar-toolbar {
    justify-content: center;
  }

  .calendar-month-nav,
  .calendar-date-field,
  .calendar-date-button,
  .calendar-source-field {
    margin-left: 0;
  }

  .calendar-source-field {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .calendar-date-field input {
    min-width: 0;
  }

  .calendar-grid {
    gap: 4px;
  }

  .calendar-weekday,
  .calendar-empty,
  .calendar-day {
    min-height: 52px;
  }

  .calendar-day {
    padding: 6px;
  }

  .calendar-day small {
    font-size: 0.62rem;
  }

  .supporting-metrics {
    grid-template-columns: 1fr;
  }

  .supporting-metric + .supporting-metric {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .primary-metric > strong {
    font-size: 2.3rem;
  }

  .topic-form {
    padding: 15px;
  }

  .topic-form-footer {
    grid-template-columns: 1fr;
  }

  .topic-values-toggle,
  .topic-add-analysis {
    grid-column: auto;
  }

  .topic-form-footer .button {
    width: 100%;
  }

  .topic-progress {
    align-items: flex-start;
    flex-direction: column;
  }

  .topic-progress progress {
    width: 100%;
  }

  .chart-download-controls {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .chart-download-controls select,
  .chart-download {
    width: 100%;
  }

  .news-detail-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .news-detail-actions .button {
    width: 100%;
  }

  .news-article-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .news-article-actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ==== Níveis de relevância histórica (badges horizontais) ================== */
.relevance-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px 5px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  cursor: help;
  user-select: none;
  transition: transform 140ms ease, filter 140ms ease;
}

.relevance-badge svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex: 0 0 auto;
}

.relevance-badge:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.relevance-badge:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.relevance-badge.relevance-badge-compact {
  padding: 4px 10px 4px 7px;
  font-size: 0.64rem;
  gap: 5px;
}

.relevance-badge.relevance-badge-compact svg {
  width: 13px;
  height: 13px;
}

.relevance-level-1 { background: #a8203c; color: #fff; }
.relevance-level-2 { background: #d66a15; color: #fff; }
.relevance-level-3 { background: #c4940c; color: #181818; }
.relevance-level-4 { background: #10609b; color: #fff; }
.relevance-level-5 { background: #56626a; color: #fff; }

/* Sobre fundo escuro (hero, story cards) o nível 3 precisa de mais contraste */
.hero .relevance-level-3,
.story-card .relevance-level-3 {
  color: #181818;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

/* Tooltip do badge — estilos do site */
.relevance-tooltip {
  position: fixed;
  z-index: 60;
  max-width: 300px;
  padding: 12px 14px;
  border: 1px solid var(--brand);
  border-left-width: 4px;
  border-radius: 10px;
  background: var(--ink);
  color: #e8eff2;
  font-size: 0.82rem;
  line-height: 1.45;
  box-shadow: 0 14px 34px rgba(5, 12, 16, 0.45);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 130ms ease, transform 130ms ease;
  pointer-events: none;
}

.relevance-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.relevance-tooltip strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.relevance-tooltip.relevance-level-1 strong { color: #ff7d95; }
.relevance-tooltip.relevance-level-2 strong { color: #ffb066; }
.relevance-tooltip.relevance-level-3 strong { color: #ffd45e; }
.relevance-tooltip.relevance-level-4 strong { color: #6cc0ff; }
.relevance-tooltip.relevance-level-5 strong { color: #c3ced5; }

/* Chip do tipo de fonte (Jornal · Perfil · Wikipédia · Arquivo.pt) */
.source-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid rgba(16, 24, 29, 0.16);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(16, 24, 29, 0.04);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.story-card .source-chip,
.hero .source-chip {
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.82);
  background: rgba(8, 16, 20, 0.35);
}

/* Cartões: meta em linha com chips */
.latest-card .meta,
.story-card .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* Secções da home por nível */
.level-section {
  border-top: 1px solid rgba(219, 228, 231, 0.9);
}

.level-section .section-heading h2 {
  margin: 0;
}

.level-1-section .section-heading h2 {
  color: #a8203c;
}

.level-2-section .section-heading h2 {
  color: #d66a15;
}

/* ==== Calendário: filtros de formato e vista ============================== */
.calendar-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding: 0 22px 16px;
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(16, 24, 29, 0.12);
  border-radius: 999px;
  background: rgba(16, 24, 29, 0.03);
}

.segmented-label {
  padding: 0 8px 0 12px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.segmented-button {
  min-height: 32px;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.segmented-button:hover {
  color: var(--ink);
}

.segmented-button.active {
  background: var(--brand);
  color: #fff;
}

/* Grelha semanal (domingo → sábado) */
.calendar-grid.calendar-grid-week {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

/* Bloco das publicações do projeto no painel do dia */
.day-posts-block {
  margin: 18px 0 8px;
}

.day-posts-title {
  margin: 0 0 12px;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

/* Lista do dia: badge inline à direita */
.recommendation-list li a {
  align-items: center;
}

.recommendation-list li .relevance-badge {
  margin-left: auto;
}

/* ==== Documentação: secção de relevância =================================== */
.relevance-doc {
  padding: 8px var(--page-padding) 8px;
}

.relevance-doc-head h2 {
  margin: 6px 0 8px;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.relevance-doc-head p {
  max-width: 860px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.relevance-doc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 20px;
  margin-top: 24px;
}

.relevance-doc-card {
  padding: 22px;
  border: 1px solid rgba(16, 24, 29, 0.08);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 24px rgba(9, 20, 26, 0.06);
}

.relevance-doc-card h3 {
  margin: 18px 0 8px;
  font-size: 1rem;
}

.relevance-doc-card h3:first-child {
  margin-top: 0;
}

.relevance-doc-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.relevance-criteria {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 6px;
}

.relevance-criteria th,
.relevance-criteria td {
  padding: 8px 10px 8px 0;
  border-bottom: 1px solid rgba(16, 24, 29, 0.07);
  text-align: left;
  vertical-align: top;
}

.relevance-criteria th {
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

.relevance-criteria .weight {
  font-weight: 800;
  color: var(--brand-deep);
  white-space: nowrap;
}

.relevance-criteria .description {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.relevance-example {
  padding: 16px;
  border: 1px solid rgba(16, 24, 29, 0.08);
  border-left: 4px solid #a8203c;
  border-radius: 12px;
  background: rgba(168, 32, 60, 0.03);
}

.relevance-example h4 {
  margin: 10px 0 6px;
  font-size: 1.02rem;
  line-height: 1.35;
}

.relevance-example p {
  margin: 0;
}

.relevance-scores-note {
  margin-top: 14px;
}

.relevance-level-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* ==== Página individual: breadcrumb, scores, mesmo dia, vizinhos =========== */
.news-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 18px var(--page-padding) 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.news-breadcrumb a {
  color: var(--brand-deep);
  font-weight: 600;
}

.news-breadcrumb a:hover {
  text-decoration: underline;
}

.news-breadcrumb .current {
  overflow: hidden;
  max-width: 420px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.news-article-relevance {
  margin: 22px 0;
  padding: 18px;
  border: 1px solid rgba(16, 24, 29, 0.08);
  border-left: 4px solid var(--brand);
  border-radius: 12px;
  background: rgba(0, 199, 214, 0.04);
}

.relevance-scores {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.relevance-score-row {
  display: grid;
  grid-template-columns: minmax(130px, 210px) minmax(0, 1fr) 38px;
  align-items: center;
  gap: 12px;
}

.relevance-score-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}

.relevance-score-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(16, 24, 29, 0.08);
  overflow: hidden;
}

.relevance-score-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-deep));
}

.relevance-score-value {
  font-size: 0.82rem;
  font-weight: 800;
  text-align: right;
  color: var(--brand-deep);
}

.relevance-justification {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed rgba(16, 24, 29, 0.14);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.news-article-same-day {
  margin-top: 30px;
}

.same-day-lead {
  margin: 4px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.same-day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.same-day-card {
  display: grid;
  gap: 6px;
  justify-items: start;
  padding: 14px;
  border: 1px solid rgba(16, 24, 29, 0.08);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  transition: border-color 140ms ease, transform 140ms ease;
}

.same-day-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
}

.same-day-year {
  color: var(--brand-deep);
  font-weight: 800;
  font-size: 0.85rem;
}

.same-day-card strong {
  line-height: 1.35;
  font-size: 0.92rem;
}

.news-article-neighbours {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 26px;
}

.neighbour {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(16, 24, 29, 0.08);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  transition: border-color 140ms ease;
}

.neighbour:hover {
  border-color: var(--brand);
}

.neighbour.next {
  text-align: right;
}

.neighbour span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.neighbour strong {
  font-size: 0.9rem;
  line-height: 1.35;
}

/* ==== Scrollbar com estilo do site ========================================= */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--brand-deep) var(--ink-deep);
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--ink-deep);
}

::-webkit-scrollbar-thumb {
  border: 3px solid var(--ink-deep);
  border-radius: 999px;
  background: var(--brand-deep);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--brand);
}

::-webkit-scrollbar-corner {
  background: var(--ink-deep);
}

/* ==== Rodapé melhorado ====================================================== */
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) auto auto;
  gap: 24px 56px;
  align-items: start;
  width: 100%;
}

.footer-heading {
  margin: 0 0 10px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footer-links {
  justify-items: start;
}

.footer-badges-demo {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.footer-back-top {
  min-height: 34px;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: transparent;
  color: #cdd8dd;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease;
}

.footer-back-top:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.footer-sources {
  width: 100%;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-sources-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}

.footer-source-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  opacity: 0.78;
  transition: opacity 140ms ease, transform 140ms ease;
}

.footer-source-logo:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.footer-source-logo img {
  max-height: 30px;
  max-width: 110px;
  object-fit: contain;
}

.back-top-floating {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: var(--ink);
  color: var(--brand);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(5, 12, 16, 0.4);
  transition: background 140ms ease, color 140ms ease;
}

.back-top-floating:hover {
  background: var(--brand);
  color: #fff;
}

@media (max-width: 980px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .relevance-doc-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .calendar-filters-row {
    flex-direction: column;
    gap: 10px;
  }

  .segmented-control {
    flex-wrap: wrap;
  }

  .news-article-neighbours {
    grid-template-columns: 1fr;
  }

  .neighbour.next {
    text-align: left;
  }

  .relevance-score-row {
    grid-template-columns: minmax(110px, 1fr) minmax(0, 1fr) 34px;
  }
}

/* Grelha de fontes na Documentação */
.doc-sources {
  padding: 10px var(--page-padding);
}

.doc-sources h2 {
  margin: 6px 0 18px;
  font-size: clamp(1.3rem, 2.6vw, 1.8rem);
}

.doc-sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.doc-source {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 14px 10px;
  border: 1px solid rgba(16, 24, 29, 0.08);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  text-align: center;
  transition: border-color 140ms ease, transform 140ms ease;
}

.doc-source:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
}

.doc-source img {
  height: 34px;
  width: auto;
  max-width: 96px;
  object-fit: contain;
}

.doc-source span {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
}
