/* Fredoka (OFL, fontes/OFL.txt), servida daqui mesmo: o Google Fonts
   receberia o IP de cada visitante. Fonte variável: um arquivo, todos os pesos. */
@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fontes/fredoka-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fontes/fredoka-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --fundo: #0b0b0b;
  --cartao: #151414;
  --cartao-2: #1d1b1a;
  --tinta: #f4efe6;
  --tinta-2: #b9b2a7;
  --tinta-3: #6f6a63;
  --linha: #2b2826;
  --vermelho: #e8584c;
  --creme: #f0dcae;
  --raio: 14px;
  --fonte: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--fundo);
  color: var(--tinta);
  font-family: var(--fonte);
  font-weight: 400;
  line-height: 1.45;
  /* granulado de papel: ruído fractal bem leve por cima do preto */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--creme); outline-offset: 3px; }

/* ---------- topo ---------- */
.topo {
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 16px 8px;
  text-align: center;
}
.marcas {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 4vw, 40px);
}
.rpg img { width: clamp(84px, 16vw, 168px); height: auto; transition: transform .3s; }
.rpg:hover img { transform: rotate(-6deg) scale(1.04); }
.inktober { margin: 0; }
.inktober img { width: clamp(200px, 46vw, 470px); height: auto; }
.chamada {
  margin: 28px auto 0;
  max-width: 34em;
  color: var(--tinta-2);
  font-size: clamp(15px, 2.2vw, 18px);
}
.progresso {
  margin: 28px auto 0;
  max-width: 600px;
}
.progresso .barra { max-width: 420px; margin: 0 auto; }
.barra {
  height: 6px;
  border-radius: 99px;
  background: var(--linha);
  overflow: hidden;
}
.barra span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--vermelho);
  border-radius: inherit;
  transition: width .8s ease;
}
.progresso p {
  margin: 10px 0 0;
  font-size: 14px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tinta-2);
}
.progresso strong { color: var(--tinta); font-weight: 600; }

/* ---------- calendário ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 40px 16px 24px; }
.calendario h2 {
  margin: 0 0 18px;
  font-weight: 600;
  font-size: clamp(26px, 4vw, 36px);
  letter-spacing: .14em;
  text-transform: uppercase;
  text-align: center;
}
.calendario h2 span { color: var(--vermelho); }

.semana, .dias {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}
.semana li {
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--tinta-3);
  padding-bottom: 4px;
}
.dias { margin-top: 6px; }
.dias .vazio { visibility: hidden; }

.dia {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  aspect-ratio: 4 / 5;
  padding: 10px 11px;
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  background: var(--cartao);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  container-type: inline-size; /* o tema mede a largura do cartão */
  transition: transform .2s, border-color .2s, background .2s;
}
.dia:hover { transform: translateY(-3px); border-color: var(--tinta-3); }
.dia .num {
  font-size: clamp(20px, 2.6vw, 30px);
  font-weight: 600;
  line-height: 1;
}
.dia .sem { display: none; }
.dia .tema {
  font-size: clamp(10px, 1.15vw, 13px);
  /* proporcional ao cartão: "CONHECIMENTO" cabe inteiro em qualquer largura */
  font-size: clamp(8px, 11.5cqi, 13px);
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  line-height: 1.15;
}
.dia .base { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dia .autor {
  font-size: clamp(9px, 1vw, 11px);
  color: var(--creme);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dia.publicado .autor { text-shadow: 0 1px 6px rgba(0,0,0,.8); }
.dia .selo {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tinta-3);
}

/* com desenho: a miniatura ocupa o cartão, com um véu escuro para o texto */
.dia.publicado { border-color: #3a3633; }
.dia.publicado .miniatura {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.dia.publicado::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,0) 35%, rgba(0,0,0,0) 55%, rgba(0,0,0,.8) 100%);
}
.dia.publicado:hover .miniatura { transform: scale(1.05); }
.dia.publicado .num, .dia.publicado .tema { text-shadow: 0 1px 6px rgba(0,0,0,.7); }

.dia.hoje { border-color: var(--vermelho); box-shadow: 0 0 0 1px var(--vermelho); }
.dia.hoje .selo { color: var(--vermelho); }

.dia.futuro {
  background: transparent;
  border-style: dashed;
  color: var(--tinta-3);
}
.dia.futuro:hover { color: var(--tinta-2); }
.dia.passado:not(.publicado) .num { color: var(--tinta-2); }

/* ---------- mais constantes ---------- */
.ranking { margin: 56px auto 0; text-align: center; }
.ranking[hidden] { display: none; }
.ranking h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--tinta-3);
}
.ranking h2::before, .ranking h2::after {
  content: "";
  width: 48px;
  height: 1px;
  background: var(--linha);
}
.ranking ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 0;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.ranking li { display: inline-flex; align-items: baseline; gap: 6px; padding: 0 14px; }
.ranking li + li { border-left: 1px solid var(--linha); }
.ranking .pos { min-width: .7em; color: var(--vermelho); font-weight: 600; }
.ranking .nome { color: var(--creme); }
/* destaque: o nome vira botão, sem cara de botão */
.ranking button.nome {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.ranking button.nome:hover { border-color: rgba(240, 220, 174, .4); }
.ranking button.nome[aria-pressed="true"] { border-color: var(--creme); }

.filtro {
  margin: -8px 0 16px;
  text-align: center;
  font-size: 13px;
  color: var(--tinta-2);
}
.filtro[hidden] { display: none; }
.filtro strong { color: var(--creme); font-weight: 500; }
.filtro button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--tinta-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.filtro button:hover { color: var(--tinta); }
.dias.filtrando .dia { transition: opacity .25s, border-color .25s, transform .2s; }
.dias.filtrando .dia:not(.destacado) { opacity: .22; }
.dias.filtrando .dia.destacado { border-color: var(--creme); }
.ranking .qtd { color: var(--tinta-3); }
.ranking-nota {
  margin: 10px 0 0;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: lowercase;
  color: var(--tinta-3);
}
@media (max-width: 720px) {
  .ranking ol { flex-direction: column; align-items: center; gap: 8px; }
  .ranking li + li { border-left: 0; }
}

/* ---------- rodapé ---------- */
.rodape {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 16px 48px;
  text-align: center;
  color: var(--tinta-2);
}
.tags { margin: 0; font-weight: 500; letter-spacing: .1em; color: var(--tinta); }
.perfis { margin: 10px 0 0; display: flex; gap: 22px; justify-content: center; }
.perfis a { text-decoration: none; border-bottom: 1px solid var(--tinta-3); }
.perfis a:hover { color: var(--creme); border-color: var(--creme); }
.nota { margin: 22px 0 0; font-size: 12px; color: var(--tinta-3); }

/* ---------- visor (dialog) ---------- */
.visor {
  width: min(1000px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--linha);
  border-radius: 18px;
  background: var(--cartao);
  color: var(--tinta);
  overflow: hidden;
}
.visor::backdrop { background: rgba(0,0,0,.82); backdrop-filter: blur(3px); }
.visor[open] { animation: entra .25s ease; }
@keyframes entra { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.visor-caixa {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 34px);
}
.visor-topo {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 16px 64px 14px 22px;
  border-bottom: 1px solid var(--linha);
}
.visor-dia {
  margin: 0;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--vermelho);
  white-space: nowrap;
}
.visor-topo h3 {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.fechar {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}
.fechar:hover { background: var(--cartao-2); }

.palco {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  min-height: min(60vh, 560px);
  padding: 18px 70px;
  background: #0e0d0d;
}
.palco img {
  /* --livre: altura que sobra no visor, medida pelo app.js */
  max-height: var(--livre, calc(100vh - 320px));
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
}
.palco .aviso {
  text-align: center;
  padding: 70px 10px;
  color: var(--tinta-2);
}
.aviso .grande { font-size: clamp(20px, 3vw, 26px); color: var(--tinta); margin: 0 0 8px; }
.aviso p { margin: 0; }

.credito {
  margin: 0;
  padding: 10px 22px 12px;
  text-align: center;
  font-size: 15px;
  color: var(--tinta-2);
  border-top: 1px solid var(--linha);
}
.credito:empty { display: none; }
.credito a {
  color: var(--creme);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid rgba(240, 220, 174, .35);
}
.credito a:hover { border-color: var(--creme); }
.credito strong { color: var(--creme); font-weight: 500; }
.credito span { margin-left: 6px; color: var(--tinta-3); }
.credito:not(:empty) + .outras { border-top: 0; padding-top: 0; }

.outras {
  list-style: none;
  margin: 0;
  padding: 12px 22px 16px;
  display: flex;
  gap: 10px;
  justify-content: center;
  border-top: 1px solid var(--linha);
}
.outras:empty { display: none; }
.outras button {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: none;
  cursor: pointer;
  opacity: .55;
}
.outras button[aria-current="true"] { border-color: var(--creme); opacity: 1; }
.outras img { width: 64px; height: 64px; object-fit: cover; }

.passo {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 64px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}
.passo:hover { background: rgba(255,255,255,.14); }
.passo:disabled { opacity: .2; cursor: default; }
.passo[hidden] { display: none; }
.anterior { left: 12px; }
.proximo { right: 12px; }

/* ---------- telas estreitas: o calendário vira grade de cartões ---------- */
@media (max-width: 720px) {
  .semana, .dias .vazio { display: none; }
  .dias { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .dia .sem {
    display: block;
    position: absolute;
    top: 12px;
    right: 10px;
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tinta-3);
  }
  .dia .selo { position: static; }
  .visor-caixa { padding-bottom: 64px; }  /* faixa das setas */
  .visor.sem-setas .visor-caixa { padding-bottom: 0; }
  .palco { padding: 12px; min-height: 50vh; }
  .passo { top: auto; bottom: 10px; height: 44px; }
}
@media (max-width: 330px) {
  .dias { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
