/* página do mural: lista + quadro de cortiça navegável como mapa */
.pagina-mural #mural { min-height: 80vh; }
.pagina-mural {
  --ic-seta: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='square'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E");
  --ic-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='square'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E");
  --ic-mais: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='square'%3E%3Cpath d='M12 4v16M4 12h16'/%3E%3C/svg%3E");
  --ic-menos: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='square'%3E%3Cpath d='M4 12h16'/%3E%3C/svg%3E");
  --ic-seta-b: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='square'%3E%3Cpath d='M12 4v15M6 13l6 6 6-6'/%3E%3C/svg%3E");
  --ic-centro: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6'%3E%3Ccircle cx='12' cy='12' r='6'/%3E%3Cpath d='M12 1v5M12 18v5M1 12h5M18 12h5'/%3E%3C/svg%3E");
}
.filtros .abre-quadro { border-style: dashed; }
.filtros .abre-quadro[aria-pressed="true"] { background: #c09162; border-color: #c09162; border-style: solid; }
.vazio-msg .vazio { max-width: 420px; margin-inline: auto; }
.fim { height: 1px; }

/* ---------- quadro: viewport do tamanho da tela, plano que anda e escala dentro dele ---------- */
/* na página é uma janela do quadro: o dedo e a rodinha continuam rolando a página (ninguém fica preso);
   mexer de verdade é na tela cheia, que tem saída sempre à vista */
.quadro-vista {
  position: relative; overflow: hidden; touch-action: pan-x pan-y; user-select: none; -webkit-user-select: none; cursor: grab;
  /* sai da coluna de texto: quase a largura toda da tela (até 1680 px) e quase a altura toda */
  --larg: min(calc(100vw - 32px), 1680px);
  width: var(--larg); margin-inline: calc((100% - var(--larg)) / 2);
  height: clamp(400px, 80svh, 960px);
  border: 10px solid #6b4423;
  box-shadow: inset 0 0 50px rgba(50, 25, 8, .35);
  /* cortiça: só grão fino e miúdo sobre um tom quente; sem manchas grandes */
  background-color: #c39467;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='g' x='0' y='0'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .2 0 0 0 0 .08 0 0 0 -1.6 1.05'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='c' x='0' y='0'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='1' seed='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .96 0 0 0 0 .84 0 0 0 0 .64 0 0 0 3 -1.85'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23c)'/%3E%3C/svg%3E");
  background-size: 300px;
}
.quadro-vista[hidden] { display: none; }
.quadro-vista.cheio { position: fixed; inset: 0; z-index: 100; width: auto; margin: 0; height: 100dvh; border-width: 0; touch-action: none; overscroll-behavior: contain; }
html.quadro-aberto, html.quadro-aberto body { overflow: hidden; }
.quadro-ajuda { margin-top: 12px; font-size: 15px; opacity: .85; }

.quadro-vista .abrir, .quadro-vista .sair { position: absolute; z-index: 6; white-space: nowrap; font-size: 17px; padding: 13px 18px; }
/* celular na página: só o botão de abrir; zoom e setas moram na tela cheia */
@media (max-width: 600px) { .quadro-vista:not(.cheio) .controles { display: none; } }
.quadro-vista .abrir { left: 50%; bottom: 16px; translate: -50% 0; }
.quadro-vista .abrir:hover { transform: translateY(-3px) rotate(-1.5deg); }
.quadro-vista .sair { display: none; top: 16px; left: 16px; background: var(--preto); color: var(--ouro-claro); }
.cheio .abrir { display: none; }
.cheio .sair { display: inline-flex; top: max(16px, env(safe-area-inset-top)); }
.setas { display: none; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px); margin-bottom: 6px; }
.cheio .setas { display: grid; }
.setas button { width: 40px; height: 40px; }
.setas [data-z="cima"] { grid-area: 1 / 2; } .setas [data-z="esq"] { grid-area: 2 / 1; }
.setas [data-z="dir"] { grid-area: 2 / 3; } .setas [data-z="baixo"] { grid-area: 3 / 2; }

.dica { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; margin: 0; padding: 20px; text-align: center;
  background: rgba(14, 14, 14, .62); color: var(--papel); font: 900 clamp(18px, 3vw, 26px)/1.2 "Roboto Condensed"; text-transform: uppercase;
  opacity: 0; pointer-events: none; transition: opacity .25s; }
.dica.mostra { opacity: 1; }
.quadro-vista.arrastando { cursor: grabbing; }
.quadro-vista:focus-visible { outline-offset: -6px; }
.plano { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
.arrastando .plano { will-change: transform; }

.controles { position: absolute; right: 16px; bottom: 16px; z-index: 5; display: grid; gap: 8px; justify-items: end; }
.cheio .controles { bottom: max(16px, env(safe-area-inset-bottom)); }
.controles button { width: 48px; height: 48px; border: 3px solid var(--preto); cursor: pointer; box-shadow: var(--sombra);
  background: var(--ic-mais) center / 22px no-repeat, var(--ouro-claro); }
.controles [data-z="menos"] { background-image: var(--ic-menos); }
.controles [data-z="centro"] { background-image: var(--ic-centro); margin-top: 6px; }
.controles .setas button { width: 40px; height: 40px; border-width: 2px; background-image: var(--ic-seta-b); background-size: 18px; }
.setas [data-z="cima"] { rotate: 180deg; } .setas [data-z="esq"] { rotate: 90deg; } .setas [data-z="dir"] { rotate: -90deg; }
.controles button:hover { background-color: var(--papel-2); }
.contador { position: absolute; right: 16px; top: max(16px, env(safe-area-inset-top)); z-index: 5; margin: 0; padding: 6px 10px;
  background: var(--preto); color: var(--ouro-claro); font: 900 14px "Roboto Condensed"; text-transform: uppercase; }
.contador:empty { display: none; }

/* cada nota fica no centro da sua célula da espiral; giro e deslocamento cabem na folga, então nada se cobre */
.nota {
  position: absolute; width: 210px; height: 270px; display: flex; flex-direction: column;
  border: 0; padding: 0; text-align: left; font: inherit; color: var(--preto); cursor: zoom-in;
  background: var(--papel-2); box-shadow: 0 10px 16px -8px rgba(0, 0, 0, .55), 0 1px 3px rgba(0, 0, 0, .3);
  transform: translate(-50%, -50%) translate(var(--dx, 0), var(--dy, 0)) rotate(var(--giro, 0deg));
  transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s;
}
.arrastando .nota { cursor: grabbing; }
.nota.musica { height: 150px; }
.nota:hover, .nota:focus-visible { transform: translate(-50%, -50%) translate(var(--dx, 0), var(--dy, 0)) rotate(0) scale(1.04); z-index: 3;
  box-shadow: 0 22px 30px -12px rgba(0, 0, 0, .6), 0 2px 4px rgba(0, 0, 0, .3); }
.nota::before { /* tachinha */
  content: ""; position: absolute; top: -7px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; z-index: 2;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .75) 0 2px, var(--pino) 3px);
  box-shadow: 1px 3px 3px rgba(0, 0, 0, .45);
}
.nota img { flex: 1; min-height: 0; width: 100%; object-fit: cover; border: 8px solid var(--papel-2); border-bottom-width: 0; pointer-events: none; }
.nota.poema { padding: 18px 14px 0; background: #fbf6dc; }
.nota.poema.amarelo { background: var(--ouro-claro); }
.nota.poema strong { font: 900 17px/1.05 "Roboto Condensed"; text-transform: uppercase; margin-bottom: 6px; }
.nota.poema p { flex: 1; min-height: 0; overflow: hidden; font: 700 15px/1.35 "Roboto Condensed"; white-space: pre-line;
  -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.nota.musica { background: var(--ouro-metal); padding: 16px 14px 0; justify-content: center; }
.nota.musica .play { display: flex; align-items: center; gap: 10px; font: 900 17px/1.05 "Roboto Condensed"; text-transform: uppercase; }
.nota.musica .play::before { content: ""; width: 36px; height: 36px; flex: none;
  border-radius: 50%; border: 2px solid var(--preto);
  background: var(--ic-seta) center / 18px no-repeat, var(--ouro-claro); }
.nota .quem { display: block; padding: 6px 10px 8px; font: 900 13px "Roboto Condensed"; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nota.poema .quem, .nota.musica .quem { padding-inline: 0; }
.nota.musica.com-capa { height: 270px; padding: 0; justify-content: flex-start; background: var(--papel-2); }
.nota.musica.com-capa .play { padding: 10px 12px 0; }
.nota.musica.com-capa .quem { padding-inline: 12px; }

/* trampo ampliado: o fechar fica acima do cartão, sem cobrir a etiqueta do tipo */
dialog.ampliar { margin: auto; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  border: 0; padding: 0; background: transparent; }
dialog.ampliar::backdrop { background: rgba(14, 14, 14, .82); }
dialog.ampliar .peca { margin: 0; transform: none; cursor: auto; }
dialog.ampliar .fechar { display: block; margin: 0 0 10px auto; width: 44px; height: 44px; border: 0; cursor: pointer;
  background: var(--ic-x) center / 20px no-repeat, var(--ouro-claro); }

@media (prefers-reduced-motion: reduce) { .nota { transition: none; } }
