:root {
  --bg: #fbfaf7; --fg: #1d1d1b; --muted: #6b6b66; --line: #e2dfd6; --accent: #7a1f1f;
  --tag-bg: #eee9dd; --ins: #d9f2d9; --del: #f7d9d9; --bar: #7a1f1f; --ok: #2f7a2f; --warn: #b3541e;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #17171a; --fg: #e8e6e1; --muted: #9a9892; --line: #33333a; --accent: #d98484;
    --tag-bg: #2a2a30; --ins: #1f3d1f; --del: #4a1f1f; --bar: #c46a6a; --ok: #6fbf6f; --warn: #e0894a; }
}
* { box-sizing: border-box; }
html { color-scheme: light dark; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
header { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; align-items: center; padding: 0.9rem 1.2rem; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 0.3em; font-weight: 700; color: var(--fg); font-size: 1.1rem; }
.brand a { color: inherit; text-decoration: none; }
.brand .sub { color: var(--muted); font-weight: 400; }
/* The logo is the monitor's; hovering "Atento" (the link to atento.pt) fades it into Atento's. */
.brand .logo { position: relative; flex: none; width: 28px; height: 28px; margin-right: 0.2em; }
.brand .logo img { position: absolute; inset: 0; transition: opacity 0.25s ease; }
.brand .logo-a { opacity: 0; }
.brand .atento:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.brand:has(.atento:focus-visible) .logo-a { opacity: 1; }
.brand:has(.atento:focus-visible) .logo-p { opacity: 0; }
@media (hover: hover) and (pointer: fine) {
  .brand .atento:hover { text-decoration: underline; }
  .brand:has(.atento:hover) .logo-a { opacity: 1; }
  .brand:has(.atento:hover) .logo-p { opacity: 0; }
}
nav a { margin-right: 1rem; text-decoration: none; }
nav a[aria-current] { font-weight: 600; border-bottom: 2px solid var(--accent); }
main { max-width: 72rem; margin: 0 auto; padding: 1rem 1.2rem 2rem; }
footer { max-width: 72rem; margin: 0 auto; padding: 1rem 1.2rem 2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
footer code { font-size: 0.9em; }
#push button { padding: 0.25rem 0.7rem; border: 1px solid var(--line); border-radius: 4px; background: var(--tag-bg); color: var(--fg); font: inherit; cursor: pointer; }
#push button:disabled { cursor: progress; opacity: 0.7; }
.push-note { margin-left: 0.5rem; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0.4rem 0 0.6rem; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 0.5rem; }
h2 small { color: var(--muted); font-weight: 400; font-size: 0.8rem; margin-left: 0.4rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.search { display: flex; gap: 0.5rem; margin: 0.3rem 0 1rem; }
.search input { flex: 1; max-width: 24rem; padding: 0.4rem 0.6rem; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--fg); font: inherit; }
.search button { padding: 0.4rem 0.8rem; border: 1px solid var(--line); border-radius: 4px; background: var(--tag-bg); color: var(--fg); font: inherit; cursor: pointer; }
.filter { margin: 0 0 0.8rem; }
.tablewrap { overflow-x: auto; }
table.articles { width: 100%; border-collapse: collapse; }
table.articles th { text-align: left; font-weight: 600; font-size: 0.8rem; color: var(--muted); padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.articles th small { font-weight: 400; }
table.articles td { padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
td.when, td.date { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
td.date { color: var(--muted); }
td.title a { text-decoration: none; color: var(--fg); }
td.title a:hover { text-decoration: underline; }
td.orig a { text-decoration: none; }
.unknown { color: var(--muted); }
.tag { display: inline-block; background: var(--tag-bg); color: var(--fg); text-decoration: none; padding: 0 0.45rem; border-radius: 3px; font-size: 0.8rem; margin: 0.1rem 0; }
.tag:hover { background: var(--line); }
.tag.suspect { box-shadow: inset 0 0 0 1px var(--warn); color: var(--warn); }
.badge { display: inline-block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); border: 1px solid var(--accent); border-radius: 3px; padding: 0 0.3rem; vertical-align: middle; }
.pager { display: flex; justify-content: space-between; margin-top: 1rem; color: var(--muted); }
.empty { color: var(--muted); }
.intro { max-width: 46rem; margin: 0.2rem 0 1rem; color: var(--muted); }
.about { max-width: 46rem; margin-top: 2.4rem; padding-top: 0.2rem; scroll-margin-top: 1rem; }
/* Arriving from a "Sobre" link: mark the section, so it's clear where the jump landed
   even when the page can't scroll far enough to bring it to the top. */
.about:target { border-left: 3px solid var(--accent); padding-left: 0.9rem; animation: about-flash 1.6s ease-out; }
@keyframes about-flash { from { background: var(--tag-bg); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .about:target { animation: none; } }
.detail .orig { margin: 0 0 1rem; }
.prose { max-width: 46rem; }
.adjacent { gap: 1.5rem; border-top: 1px solid var(--line); padding-top: 0.8rem; }
.adjacent span { flex: 1; }
.adjacent span:last-child { text-align: right; }
.adjacent a { text-decoration: none; }
dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0 0 1rem; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; }
ul.plain { list-style: none; margin: 0; padding: 0; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; margin: 0 0 1rem; padding-left: 0.6rem; }
.timeline li::before { content: ""; position: absolute; left: -1.45rem; top: 0.5rem; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--line); }
.timeline li.v-page::before { background: var(--accent); }
.timeline li.v-listing::before { background: var(--line); border: 1px solid var(--muted); }
.v-head time { font-variant-numeric: tabular-nums; }
.src { display: inline-block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 0.3rem; margin: 0 0.3rem; }
.retitle { margin: 0.3rem 0; }
.diff { white-space: pre-wrap; margin: 0.4rem 0 0; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: 4px; font-size: 0.92rem; }
.diff ins, .retitle ins { background: var(--ins); text-decoration: none; }
.diff del, .retitle del { background: var(--del); }
.diff .skip { color: var(--muted); font-style: italic; }
ul.taglist { list-style: none; padding: 0; margin: 0; columns: 3 14rem; }
ul.taglist li { margin: 0.2rem 0; break-inside: avoid; }
ul.taglist .count { color: var(--muted); font-size: 0.85rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0.8rem; margin: 0.5rem 0 1rem; }
.card { border: 1px solid var(--line); border-radius: 6px; padding: 0.7rem 0.9rem; font-size: 0.9rem; }
.card b { display: block; font-size: 1.6rem; line-height: 1.2; }
.card small { display: block; color: var(--muted); }
.card.ok b { color: var(--ok); }
.card.warn b { color: var(--warn); }
svg.chart { width: 100%; height: auto; max-height: 220px; display: block; }
svg.chart rect { fill: var(--bar); }
svg.chart rect:hover { opacity: 0.7; }
svg.chart text { fill: var(--muted); font-size: 11px; }
ol.bars { list-style: none; padding: 0; margin: 0; max-width: 40rem; }
ol.bars li { display: grid; grid-template-columns: 14rem 1fr; gap: 0.6rem; align-items: center; margin: 0.2rem 0; font-size: 0.9rem; }
ol.bars .label { text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
ol.bars .bar { display: block; height: 0.9rem; background: var(--bar); border-radius: 2px; min-width: 2px; }
@media (max-width: 600px) {
  dl.meta { grid-template-columns: 1fr; gap: 0 0; }
  dl.meta dt { margin-top: 0.4rem; }
  ol.bars li { grid-template-columns: 8rem 1fr; }
}
/* The article list stops working as a table well before phone width: measured against the
   real data, tag labels start wrapping around 820px and titles run to three lines, while at
   880px both sit comfortably. So below 820 — which also covers tablets in portrait — each
   row becomes a card. The markup keeps its table roles (see index.html), so the visually
   hidden header still names the fields. Order is deliberately not the column order: the
   title leads, and the first-seen time is an annotation rather than the first thing read,
   because most rows are backfilled and have none. */
@media (max-width: 820px) {
  .tablewrap { overflow-x: visible; }
  table.articles, table.articles tbody, table.articles tr, table.articles td { display: block; }
  table.articles thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  /* The title spans every track: sharing a row with the timestamp would let that
     nowrap column dictate the title's width, and only on rows that have a time. */
  table.articles tr {
    display: grid; grid-template-columns: auto 1fr auto; gap: 0.3rem 0.6rem; align-items: baseline;
    border: 1px solid var(--line); border-radius: 6px;
    padding: 0.7rem 0.9rem; margin: 0 0 0.7rem;
  }
  table.articles td { border: 0; padding: 0; }
  td.title { grid-area: 1 / 1 / auto / -1; font-size: 1.02rem; }
  td.title a { font-weight: 600; }
  td.date { grid-area: 2 / 1; }
  td.when { grid-area: 2 / 2; justify-self: end; }
  td.orig { grid-area: 2 / 3; }
  td.tags { grid-area: 3 / 1 / auto / -1; }
  /* A card has no cell to fill, so an unknown time shows nothing at all rather than a dash. */
  td.when .unknown { display: none; }
  td.tags:empty { display: none; }
}
