/* DailyHistory · site público. Mobile-first, leitura longa, claro/escuro. */
:root {
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --surface-2: #efe7d8;
  --text: #241f1b;
  --muted: #74685c;
  --line: #e2d7c4;
  --accent: #8a4520;
  --accent-soft: #f1dfcf;
  --link: #8a4520;
  --serif: 'Newsreader', 'Iowan Old Style', Georgia, ui-serif, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --measure: 40rem;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1916;
    --surface: #24211d;
    --surface-2: #2e2a25;
    --text: #efe8dc;
    --muted: #a99d8f;
    --line: #3a352f;
    --accent: #e0a070;
    --accent-soft: #3a2a1f;
    --link: #e9b088;
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img,
video {
  max-width: 100%;
  display: block;
}
a {
  color: var(--link);
}
h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.12;
  text-wrap: balance;
}
.icon {
  flex-shrink: 0;
  vertical-align: -0.15em;
}
.muted {
  color: var(--muted);
}
.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 16px;
  top: 8px;
  z-index: 10;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: 8px;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

/* ---------- cabeçalho e rodapé ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 72rem;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 600 20px var(--serif);
  color: var(--text);
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--bg);
  font: 700 19px var(--serif);
}
.site-header nav {
  display: flex;
  gap: 18px;
}
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}
.site-header nav a:hover {
  color: var(--text);
}
.site-footer {
  max-width: 72rem;
  margin: 64px auto 0;
  padding: 24px 16px calc(32px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}
.site-footer p {
  margin: 0;
}
.site-footer a {
  color: inherit;
}

/* ---------- home: história do dia ---------- */
.eyebrow {
  margin: 0;
  font: 700 12px/1.3 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.hero {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 16px;
}
.hero-link {
  display: grid;
  color: inherit;
  text-decoration: none;
  border-radius: 20px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
}
.hero-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.hero-text {
  padding: 20px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hero-label {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.hero h1 {
  margin: 4px 0 0;
  font-size: clamp(32px, 8vw, 54px);
}
.hero-subtitle {
  margin: 0;
  font: italic 400 21px/1.35 var(--serif);
  color: var(--muted);
}
.hero-summary {
  margin: 4px 0 0;
  font: 400 19px/1.5 var(--serif);
}
.hero-cta {
  margin-top: 10px;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  font-size: 15px;
}
.hero-link:hover .hero-cta {
  filter: brightness(1.08);
}
@media (min-width: 860px) {
  .hero-link {
    grid-template-columns: 1.25fr 1fr;
    align-items: center;
  }
  .hero-img {
    height: 100%;
    min-height: 460px;
    aspect-ratio: auto;
  }
  .hero-text {
    padding: 40px;
  }
}

/* ---------- seções e cartões ---------- */
.section {
  max-width: 72rem;
  margin: 48px auto 0;
  padding: 0 16px;
}
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-header h2 {
  margin: 0;
  font-size: 26px;
}
.section-header a {
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}
.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 960px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.card-link {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.card-img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.card-img.placeholder {
  display: grid;
  place-items: center;
  font: 600 40px var(--serif);
  color: var(--muted);
}
.card-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card-title {
  font: 600 23px/1.18 var(--serif);
  letter-spacing: -0.01em;
}
.card-link:hover .card-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.card-summary {
  color: var(--muted);
  font-size: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-date {
  font-size: 13px;
  color: var(--muted);
}
/* Versão compacta (acervo): miniatura ao lado do texto. */
.list {
  display: flex;
  flex-direction: column;
}
.card-compact .card-link {
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.card-compact .card-img {
  width: 92px;
  height: 92px;
  aspect-ratio: 1;
  flex-shrink: 0;
  border-radius: 12px;
}
.card-compact .card-img.placeholder {
  font-size: 30px;
}
.card-compact .card-title {
  font-size: 20px;
}

/* ---------- acervo ---------- */
.archive-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 8px;
}
.archive-header h1 {
  margin: 0;
  font-size: clamp(34px, 7vw, 48px);
}
.search {
  display: flex;
  gap: 8px;
  max-width: 32rem;
}
.search input {
  flex: 1;
  min-width: 0;
  padding: 11px 16px;
  font: inherit;
  font-size: 16px;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.search button {
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tags a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.tags a.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.tags .count {
  color: var(--muted);
  font-weight: 500;
}
.pager {
  margin-top: 28px;
  text-align: center;
}

/* ---------- história ---------- */
.story-header,
.story-column {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 20px;
}
.story-header {
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.story-header h1 {
  margin: 0;
  font-size: clamp(36px, 9vw, 60px);
}
.story-subtitle {
  margin: 0;
  font: italic 400 22px/1.35 var(--serif);
  color: var(--muted);
}
.story-byline {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted);
}
.story-cover {
  max-width: 64rem;
  margin: 28px auto 8px;
  padding: 0;
}
.story-cover img {
  width: 100%;
  max-height: 78vh;
  object-fit: cover;
}
@media (min-width: 700px) {
  .story-cover {
    padding: 0 16px;
  }
  .story-cover img {
    border-radius: var(--radius);
  }
}
figcaption {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 20px 0;
  line-height: 1.45;
}
.story-cover figcaption {
  max-width: var(--measure);
  margin: 0 auto;
}
.credit {
  font-style: italic;
}
.listen {
  margin: 24px 0 8px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.listen p {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-weight: 600;
  font-size: 15px;
}
.listen audio {
  width: 100%;
}

/* Corpo do texto (gerado por renderBlocksToHtml). */
.prose {
  font: 400 20px/1.7 var(--serif);
  margin-top: 24px;
}
.prose p {
  margin: 0 0 1.1em;
}
.prose h2 {
  font-size: 30px;
  margin: 1.6em 0 0.5em;
}
.prose h3 {
  font-size: 24px;
  margin: 1.4em 0 0.4em;
}
.prose h4 {
  font-size: 20px;
  margin: 1.2em 0 0.4em;
}
.prose ul,
.prose ol {
  padding-left: 1.3em;
  margin: 0 0 1.1em;
}
.prose li {
  margin-bottom: 0.35em;
}
.prose blockquote {
  margin: 1.6em 0;
  padding: 0 0 0 20px;
  border-left: 3px solid var(--accent);
  font-size: 23px;
  font-style: italic;
  line-height: 1.5;
}
.prose .callout {
  display: flex;
  gap: 12px;
  margin: 1.6em 0;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: 18px;
  line-height: 1.6;
}
.prose .callout-icon {
  color: var(--accent);
  padding-top: 4px;
}
.prose .callout-alert .callout-icon {
  color: #b7791f;
}
.prose .callout-info .callout-icon {
  color: #2f6f99;
}
.prose figure {
  margin: 1.8em 0;
}
.prose figure img,
.prose figure video {
  width: 100%;
  border-radius: 10px;
}
.prose figure figcaption {
  padding: 8px 0 0;
}
.prose audio {
  width: 100%;
}
.prose hr {
  border: 0;
  margin: 2.2em auto;
  width: 64px;
  border-top: 2px solid var(--line);
}
.prose a {
  text-underline-offset: 3px;
}
.prose .align-center {
  text-align: center;
}
.prose .align-right {
  text-align: right;
}
.prose .align-justify {
  text-align: justify;
}
.story-video {
  margin: 1.8em 0;
}
.story-video video {
  width: 100%;
  border-radius: 10px;
}

/* Referências. */
.refs {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.refs h2 {
  font-size: 26px;
  margin: 0 0 16px;
}
.refs ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ref {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.ref img {
  width: 52px;
  height: 76px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.15);
  flex-shrink: 0;
}
.ref-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  flex-shrink: 0;
}
.ref p {
  margin: 0;
}
.ref-title {
  font: 600 18px/1.3 var(--serif);
}
.ref-title a {
  color: inherit;
}
.ref-meta {
  font-size: 14px;
  color: var(--muted);
}
.ref-note {
  font-size: 15px;
  margin-top: 4px !important;
}
.story-footer {
  margin-top: 36px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.share {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.more {
  margin-top: 64px;
}

/* ---------- vazio / 404 ---------- */
.empty-state {
  max-width: 34rem;
  margin: 18vh auto 0;
  padding: 0 20px;
  text-align: center;
}
.empty-state h1 {
  font-size: clamp(32px, 7vw, 44px);
  margin: 0 0 12px;
}
.empty-state p {
  color: var(--muted);
}

/* Cores de texto vindas do editor (mesmos nomes do BlockNote). */
.c-gray { color: #8f8d89; }
.c-brown { color: #7a5544; }
.c-red { color: #d33b3b; }
.c-orange { color: #d9730d; }
.c-yellow { color: #c99600; }
.c-green { color: #3f7a63; }
.c-blue { color: #1f6f9a; }
.c-purple { color: #7550b0; }
.c-pink { color: #b23a80; }
.bg-gray { background: rgb(143 141 137 / 0.18); }
.bg-brown { background: rgb(122 85 68 / 0.16); }
.bg-red { background: rgb(211 59 59 / 0.15); }
.bg-orange { background: rgb(217 115 13 / 0.16); }
.bg-yellow { background: rgb(223 171 1 / 0.2); }
.bg-green { background: rgb(63 122 99 / 0.16); }
.bg-blue { background: rgb(31 111 154 / 0.15); }
.bg-purple { background: rgb(117 80 176 / 0.15); }
.bg-pink { background: rgb(178 58 128 / 0.15); }
