/* ============================================================
   style.css — palco: papel quadriculado, folhagem, rodapé
   ============================================================ */

@import url('assets/tokens.css?v=65');
@import url('assets/components.css?v=78');
@import url('assets/chrome.css?v=5');
@import url('assets/layout.css?v=6');
@import url('assets/visual-effects.css?v=2');
@import url('assets/nav-figure.css?v=4');
@import url('assets/portal.css?v=4');
@import url('assets/know.css?v=6');
@import url('assets/pomodoro.css?v=2');
@import url('assets/planner.css?v=1');

/* ---- fontes ----
   A DejaVu (licença livre, parente da Verdana) é a fonte embutida do jardim:
   garante o mesmo visual em sistemas sem Verdana, como o Linux. As outras cinco
   entram como opções do painel "personalizar" (todas OFL), com as woff2 em
   public/fonts/. Nenhuma delas é a padrão: o DEFAULT_THEME pede a pilha do jardim. */
@font-face { font-family: "DejaVu Web"; font-weight: 400; font-style: normal; font-display: swap; src: url('fonts/DejaVuSans.woff2') format('woff2'); }
@font-face { font-family: "DejaVu Web"; font-weight: 700; font-style: normal; font-display: swap; src: url('fonts/DejaVuSans-Bold.woff2') format('woff2'); }
@font-face { font-family: "DejaVu Web"; font-weight: 400; font-style: italic; font-display: swap; src: url('fonts/DejaVuSans-Oblique.woff2') format('woff2'); }
@font-face { font-family: 'Fraunces'; font-weight: 100 900; font-style: normal; font-display: swap; src: url('fonts/fraunces-latin-wght-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fraunces'; font-weight: 100 900; font-style: italic; font-display: swap; src: url('fonts/fraunces-latin-wght-italic.woff2') format('woff2'); }
@font-face { font-family: 'Lora'; font-weight: 400; font-style: normal; font-display: swap; src: url('fonts/lora-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Lora'; font-weight: 700; font-style: normal; font-display: swap; src: url('fonts/lora-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Lora'; font-weight: 400; font-style: italic; font-display: swap; src: url('fonts/lora-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Lora'; font-weight: 700; font-style: italic; font-display: swap; src: url('fonts/lora-latin-700-italic.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 200 1000; font-style: normal; font-display: swap; src: url('fonts/nunito-latin-wght-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 200 1000; font-style: italic; font-display: swap; src: url('fonts/nunito-latin-wght-italic.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-style: normal; font-display: swap; src: url('fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 700; font-style: normal; font-display: swap; src: url('fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Caveat'; font-weight: 400 700; font-style: normal; font-display: swap; src: url('fonts/caveat-latin-wght-normal.woff2') format('woff2'); }
/* as de 2000 (pixel, terminal, fliperama, gibi), todas OFL */
@font-face { font-family: 'Silkscreen'; font-weight: 400; font-style: normal; font-display: swap; src: url('fonts/silkscreen-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Silkscreen'; font-weight: 700; font-style: normal; font-display: swap; src: url('fonts/silkscreen-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'VT323'; font-weight: 400; font-style: normal; font-display: swap; src: url('fonts/vt323-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Press Start 2P'; font-weight: 400; font-style: normal; font-display: swap; src: url('fonts/press-start-2p-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Comic Neue'; font-weight: 400; font-style: normal; font-display: swap; src: url('fonts/comic-neue-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Comic Neue'; font-weight: 700; font-style: normal; font-display: swap; src: url('fonts/comic-neue-latin-700-normal.woff2') format('woff2'); }


html, body {
  margin: 0;
  padding: 0;
}

/* a folhagem balança e pode passar da borda: sem rolagem horizontal */
html { overflow-x: hidden; }
/* a folhagem é posicionada em relação à janela, então quem corta o excesso é o
   body: clip (e não hidden) não cria área rolável, o menu lateral continua grudando
   e a folha girada não deixa 4px de largura sobrando */
body { position: relative; overflow-x: clip; }

/* O fundo vem do tema (shared/theme/backgrounds.ts): a treliça de losangos de
   sempre, liso, xadrez, bolinhas, listras, estrelas, corações, brilhos, manchas
   ou a imagem/GIF do dono. Sem --bg-image vale a treliça. --bg-anim, --bg-drift
   e --bg-dur dizem se e quanto o fundo anda (uma volta = um ladrilho). */
body {
  min-height: 100vh;
  background-color: var(--paper-bg);
  background-image: var(--bg-image,
    linear-gradient(45deg, transparent calc(50% - 1px), var(--grid) calc(50% - 1px), var(--grid) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(-45deg, transparent calc(50% - 1px), var(--grid) calc(50% - 1px), var(--grid) calc(50% + 1px), transparent calc(50% + 1px)));
  background-size: var(--bg-size, var(--grid-size) var(--grid-size));
  background-repeat: var(--bg-repeat, repeat);
  background-attachment: var(--bg-attach, scroll);
  background-position: 0 0;
  color: var(--ink);
  font-family: var(--serif);
}

/* a folhagem é o único png que não se pinta: o dono é que liga e desliga */
body.no-foliage .foliage { display: none; }

/* folhagem pendurada nos dois cantos de cima */
.foliage {
  position: absolute;
  top: 0;
  width: min(34vw, 480px);
  aspect-ratio: 320 / 213;
  pointer-events: none;
  z-index: 0;
}

/* o desenho fica num pseudo-elemento para a direita poder ser espelhada
   sem deslocar a caixa que balança */
.foliage::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('images/foliage.png') no-repeat top left / 100% 100%;
}

.foliage.right::before { transform: scaleX(-1); }

/* vento: a folhagem balança a partir do canto de onde sai, e o filtro
   #wind (index.html) faz as folhas ondularem por dentro */
.foliage {
  filter: url(#wind);
  will-change: transform;
}

.foliage.left {
  left: 0;
  transform-origin: 0 0;
  animation: sway-left 7s ease-in-out infinite;
}

.foliage.right {
  right: 0;
  transform-origin: 100% 0;
  animation: sway-right 8.5s ease-in-out -3s infinite;
}

@keyframes sway-left {
  0%, 100% { transform: rotate(-1.4deg) skewX(0.8deg); }
  35%      { transform: rotate(1.2deg) skewX(-1deg); }
  70%      { transform: rotate(-0.4deg) skewX(0.4deg); }
}

@keyframes sway-right {
  0%, 100% { transform: rotate(1.2deg) skewX(-0.8deg); }
  40%      { transform: rotate(-1.5deg) skewX(1deg); }
  75%      { transform: rotate(0.3deg) skewX(-0.5deg); }
}

/* o fundo desliza devagar na diagonal; um ciclo = um ladrilho, então o loop é contínuo */
@keyframes drift {
  from { background-position: 0 0; }
  to   { background-position: var(--bg-drift, var(--grid-size) var(--grid-size)); }
}

body { animation: var(--bg-anim, drift) var(--bg-dur, 40s) linear infinite; }

/* o cabeçalho é só a barra de título */
#mast { padding-bottom: 0; }
#mast .win-title { border-radius: 8px 8px 5px 5px; }

/* faixa opcional no topo da janela de cima (imagem do dono ou cena de manchas).
   Fica dentro do #mast, acima da barra, e só existe quando o theme.js escreve
   --banner-image; sem ele a altura é zero e o cabeçalho continua como sempre. */
#mast .banner {
  display: block;
  height: var(--banner-h, 0px);
  margin: 0 -3px 3px;
  border-radius: 7px 7px 0 0;
  background-image: var(--banner-image, none);
  background-size: cover;
  background-position: 50% 30%;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--theme-ink, #1b281c) 40%, transparent);
}

/* com faixa em cima, a barra de título perde o arredondamento de cima */
body.banner-on #mast .win-title { border-radius: 0; }

/* corpo da página: coluna lateral (menu + blocos do dono) à esquerda, seções à direita.
   A largura da coluna e o empilhamento no celular estão em assets/layout.css. */
.page {
  display: grid;
  grid-template-columns: var(--rail-w, 190px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-top: 16px;
}

.page > .dir { position: sticky; top: 12px; }

.layout { min-width: 0; }

/* sem isto, texto em nowrap (título das janelas, nomes de post) impõe a
   largura mínima da coluna do grid e a página inteira ganha rolagem lateral */
#out { min-width: 0; }

.side-win { margin-bottom: 0; }
.side-win .win-body { padding: 6px; max-height: calc(100vh - 90px); overflow-y: auto; }

.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li { border-bottom: 1px dotted var(--rule); }
.side-list li:last-child { border-bottom: 0; }

.side-list a {
  display: block;
  padding: 5px 6px 0;
  color: var(--ink);
  font: var(--fs-s)/1.35 var(--serif);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.side-list a:hover { background: var(--title-a); color: var(--title-text); }
.side-list a[aria-current="page"] { background: var(--panel-hi); font-weight: bold; box-shadow: inset 3px 0 0 var(--gold); }
.side-list a:hover + .side-meta { color: var(--title-text); background: var(--title-a); }

.side-meta {
  display: block;
  padding: 0 6px 5px;
  font: var(--fs-xs)/1.3 var(--mono);
  color: var(--ink-soft);
}

.side-empty { padding: 8px 6px; font: italic var(--fs-s)/1.4 var(--serif); color: var(--ink-soft); }

@media (max-width: 820px) {
  /* menu no topo (continuando o cabeçalho), depois o conteúdo — a ordem de
     leitura natural no celular */
  .page { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
  .page > .dir { position: static; margin-bottom: 18px; }
  .page > .layout { min-width: 0; }

}

/* rodapé: botões 88x31 como no daikonet */
footer#foot {
  position: relative;
  z-index: 1;
  margin: 10px auto 40px;
  padding: 0 14px;
  text-align: center;
  color: var(--ink);
  font: var(--fs-s)/1.7 var(--serif);
}

footer#foot a { color: var(--link); }

/* botões 88x31 (o tamanho do daikonet), com moldura de janela */
footer#foot .buttons {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
}

footer#foot .buttons img {
  width: 88px;
  height: 31px;
  image-rendering: pixelated;
  border: 0;
  box-shadow: var(--bevel-out);
  background: var(--sheet);
}

footer#foot .buttons a:hover img { filter: brightness(1.08); }
footer#foot .buttons a:active img { box-shadow: var(--bevel-in); }

/* links do rodapé, escolhidos no painel: pequenos botões do mesmo jardim */
footer#foot .foot-links {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
}

footer#foot .foot-links a {
  display: inline-block;
  padding: 1px 9px 2px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--panel-hi);
  color: var(--title-a);
  font: bold var(--fs-xs)/1.7 var(--ui);
  text-decoration: none;
  white-space: nowrap;
}

footer#foot .foot-links a:hover { background: var(--gold); color: var(--accent-text); }

.hit-counter {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  background: var(--bar-deep);
  color: var(--accent);
  box-shadow: var(--bevel-in);
  font: var(--fs-xs)/1.6 var(--mono);
  letter-spacing: 2px;
}

@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
  .foliage { animation: none; filter: none; }
}

/* linha do modo admin (só design) no rodapé */
.admin-row { margin: 6px 0 0; font: var(--fs-xs)/1.5 var(--serif); }
.admin-row a { color: var(--ink-soft); }

/* Sino do dono e lista de comentários: diálogo também funciona no celular. */
.notifications-bell { display: inline-flex; position: relative; align-items: center; justify-content: center; flex-shrink: 0; min-width: 36px; min-height: 32px; margin-left: auto; padding: 5px; border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); cursor: pointer; }
.notifications-bell svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notifications-badge { padding: 1px 4px; background: var(--accent); color: var(--on-accent); border-radius: 7px; font: bold var(--fs-xs)/1.3 var(--mono); }
.notifications-badge[hidden] { display: none; }
.notifications-panel { width: min(480px, calc(100% - 24px)); max-height: calc(100dvh - 32px); box-sizing: border-box; padding: 12px; border: 2px solid var(--rule); background: var(--sheet); color: var(--ink); box-shadow: var(--bevel-out); }
.notifications-panel::backdrop { background: #0006; }
.notifications-heading { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.notifications-heading h2 { margin: 0; font: bold var(--fs-m)/1.5 var(--serif); }
.notifications-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.notifications-tools select { width: 100%; min-width: 0; padding: 8px; background: var(--field); color: var(--ink); font: inherit; border: 1px solid var(--rule); }
.notifications-list { max-height: 55dvh; overflow-y: auto; }
.notification { display: grid; gap: 3px; padding: 10px; border-top: 1px dotted var(--rule); color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.notification:hover, .notification:focus-visible { background: var(--field); }
.notification--unread { border-left: 3px solid var(--accent); background: var(--field); }
.notification__post, .notification small { color: var(--ink-soft); font: var(--fs-xs)/1.5 var(--serif); }
.notification__text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.post-metrics { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 6px; }
.post-metrics .entry__comments { margin-top: 0; }
.post-view-widget { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; font: var(--fs-xs)/1.5 var(--mono); color: var(--ink-soft); }
.post-views-content { max-height: 58dvh; overflow-y: auto; overflow-wrap: anywhere; }
.post-views-content h3 { margin: 10px 0 6px; font-size: var(--fs-m); }
.post-view-regions p { margin: 3px 0; font-size: var(--fs-xs); }
.post-view-table { width: 100%; border-collapse: collapse; font: var(--fs-xs)/1.5 var(--serif); }
.post-view-table th, .post-view-table td { padding: 6px; text-align: left; border-bottom: 1px dotted var(--rule); }
.side-list li.pinned a { font-weight: bold; color: var(--link); }

/* no celular, links da lateral e do rodapé ganham área de toque maior */
@media (max-width: 640px) {
  .side-list a { padding: 8px 6px 2px; }
  .admin-row a { display: inline-block; padding: 6px 4px; }
}

/* ============================================================
   articles — lista, página do artigo e o texto do editor
   (mesma matéria dos componentes, sem tema configurável)
   ============================================================ */

/* ---- avisos curtos (salvou, erro, copiou) ---- */
.toasts {
  position: fixed;
  right: 12px;
  /* sobe acima do rodapé da gaveta do "personalizar", onde moram salvar/descartar */
  bottom: calc(12px + var(--toast-lift, 0px));
  z-index: 10100; /* acima da gaveta (10050), dos seletores (10060) e dos balões (10070) */
  display: grid;
  gap: 6px;
  justify-items: end;
  pointer-events: none; /* o aviso é só leitura: nunca rouba o clique de baixo */
  transition: bottom .18s ease;
}

.toast {
  padding: 6px 12px;
  background: var(--win);
  border: 1px solid var(--edge);
  box-shadow: var(--bevel-out), 2px 2px 0 rgba(0, 0, 0, 0.25);
  font: var(--fs-s)/1.4 var(--serif);
  color: var(--ink);
  transition: opacity .4s, transform .4s;
}

.toast--ok { border-color: var(--leaf); }
.toast--error { border-color: var(--alert); color: var(--link-hover); }
.toast--out { opacity: 0; transform: translateY(6px); }

/* ---- chips de categoria (a cor vem da categoria, pintada em js) ---- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }

.chip {
  display: inline-block;
  padding: 1px 9px 2px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--panel-hi);
  color: var(--title-a);
  font: bold var(--fs-xs)/1.6 var(--serif);
  text-decoration: none;
  white-space: nowrap;
}

a.chip:hover { background: var(--gold); color: var(--accent-text); }
.chip.on, .chip[aria-current="page"] { background: var(--cat, var(--panel-hi)); color: var(--cat-on, var(--ink)); box-shadow: var(--bevel-in); }
.chip__count { font: var(--fs-xs)/1 var(--mono); opacity: .75; }

/* ---- lista de artigos ---- */
.articles-win .win-body { padding: 12px; }
.articles-win .sheet { padding: 10px 12px 14px; }

.listhead { display: grid; gap: 10px; margin-bottom: 12px; }
.listhead__title { margin: 0; font: bold 1.9rem/1.15 var(--display); color: var(--title-a); }
.listhead .note { margin: 0; }

.search {
  width: 100%;
  padding: 5px 8px;
  background: var(--field);
  border: 0;
  box-shadow: var(--bevel-in);
  font: var(--fs-m)/1.4 var(--serif);
  color: var(--ink);
}

.search:focus { outline: 1px dotted var(--title-a); outline-offset: -2px; }

.archive-box summary { cursor: pointer; font: bold var(--fs-s)/1.4 var(--serif); color: var(--link); }
.archive { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }

.arch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  background: var(--sheet);
  box-shadow: var(--bevel-in);
  font: var(--fs-xs)/1.6 var(--mono);
  color: var(--ink);
  text-decoration: none;
}

.arch:hover { background: var(--panel-hi); }
.arch[aria-current="page"] { background: var(--title-a); color: var(--title-text); }
.cat__count { opacity: .7; }

.cards { display: grid; gap: 10px; }

.card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  background: var(--sheet);
  box-shadow: var(--bevel-in);
}

.card:hover { box-shadow: inset 0 0 0 2px var(--gold); }

.card__media {
  display: block;
  align-self: start;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--panel-hi);
  text-decoration: none;
}

.card__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card__media--empty { display: grid; place-items: center; }
.card__initial { font: bold 2.4rem/1 var(--display); color: var(--title-a); }
.card__body { min-width: 0; }
.card__body .chips { margin-bottom: 4px; }

.card__title {
  margin: 0 0 4px;
  font: bold 1.25rem/1.25 var(--display);
  color: var(--title-a);
  overflow-wrap: anywhere;
}

.card__title a { color: inherit; text-decoration: none; }
.card__title a:hover { color: var(--link-hover); text-decoration: underline; }

.card__excerpt {
  margin: 0 0 6px;
  font: var(--fs-s)/1.55 var(--serif);
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .meta { margin: 0; font: var(--fs-xs)/1.5 var(--mono); color: var(--ink-soft); }

/* ---- página do artigo ---- */
.article-win .win-body { padding: 0; }
.article-win .sheet { padding: 16px clamp(14px, 4vw, 40px) 26px; }

.article__head { margin: 0 0 10px; }
.article__head .chips { margin-bottom: 6px; }
.article__title { margin: 0 0 6px; font: bold clamp(1.5rem, 4.5vw, 2.3rem)/1.15 var(--display); color: var(--title-a); overflow-wrap: anywhere; }
.article__subtitle { margin: 0 0 6px; font: italic var(--fs-m)/1.5 var(--serif); color: var(--ink-soft); }
.article__head .meta { margin: 0; font: var(--fs-xs)/1.6 var(--mono); color: var(--ink-soft); }

.fig--wide, .fig--full { margin: 14px 0; }
.cover img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); background: var(--field); }

/* sumário */
.toc {
  margin: 14px 0;
  padding: 8px 12px;
  background: var(--paper-hi);
  box-shadow: var(--bevel-in);
  font: var(--fs-s)/1.5 var(--serif);
}

.toc summary { cursor: pointer; font: bold var(--fs-xs)/1.6 var(--mono); color: var(--title-a); letter-spacing: 1px; text-transform: uppercase; }
.toc ol { margin: 8px 0 2px; padding-left: 22px; }
.toc__3 { margin-left: 12px; list-style: circle; }
.toc__4 { margin-left: 24px; list-style: square; }
.toc a { color: var(--link); text-decoration: none; }
.toc a:hover { text-decoration: underline; }

.stars { margin: 22px auto 12px; text-align: center; letter-spacing: .5em; font: var(--fs-m)/1 var(--display); color: var(--ink-soft); }

/* barra de leitura */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  z-index: 90;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* ============================================================
   prose — o texto que sai do editor de blocos
   ============================================================ */

.prose { font: var(--fs-read)/1.7 var(--serif); overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1em; }
.prose h2, .prose h3, .prose h4 { margin: 1.6em 0 .5em; font: bold 1.3em/1.25 var(--display); color: var(--title-a); scroll-margin-top: 14px; }
.prose h3 { font-size: 1.15em; }
.prose h4 { font-size: 1em; }
.prose a { color: var(--link); }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.5em; }
.prose li { margin: .2em 0; }
.prose li > p { margin: 0; }
.prose blockquote { margin: 1em 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--gold); color: var(--ink-soft); font-style: italic; }
.prose blockquote p:last-child { margin: 0; }
.prose mark { color: inherit; padding: 0 3px; background: var(--sel); }
.prose code { padding: 0 4px; background: var(--win-mid); font: .9em/1.4 var(--mono); }
.prose pre { margin: 1em 0; padding: 8px 10px; overflow-x: auto; background: var(--pre-bg); color: var(--pre-ink); }
.prose pre code { padding: 0; background: none; color: inherit; }
.prose pre[data-lang]::before { content: attr(data-lang); display: block; margin-bottom: 6px; font: bold var(--fs-xs)/1.4 var(--mono); color: var(--gold); text-transform: uppercase; }

.prose .ta-center { text-align: center; }
.prose .ta-right { text-align: right; }
.prose .ta-justify { text-align: justify; }

/* fontes fixas de um trecho (as mesmas do menu de fonte do editor): o autor
   escolheu a fonte aqui, então ela não muda com o tema */
.prose .f-dejavu { font-family: Verdana, "DejaVu Web", Tahoma, sans-serif; }
.prose .f-display { font-family: 'Fraunces', Georgia, serif; }
.prose .f-serif { font-family: 'Lora', Georgia, serif; }
.prose .f-sans { font-family: 'Nunito', system-ui, sans-serif; }
.prose .f-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .92em; }
.prose .f-hand { font-family: 'Caveat', 'Comic Sans MS', cursive; font-size: 1.15em; }
.prose .s-xs { font-size: .78em; }
.prose .s-sm { font-size: .9em; }
.prose .s-lg { font-size: 1.2em; }
.prose .s-xl { font-size: 1.45em; line-height: 1.3; }
.prose .s-xxl { font-size: 1.9em; line-height: 1.15; }

/* separadores */
.prose hr.rule { border: 0; margin: 1.6em auto; height: auto; text-align: center; }
.prose hr.rule--line { border-top: 2px solid var(--ink-soft); max-width: 6em; }
.prose hr.rule--line::after { content: none; }
.prose hr.rule--dots::after { content: '* * *'; letter-spacing: .5em; color: var(--ink-soft); }
.prose hr.rule--stars::after { content: '* * *'; letter-spacing: .5em; color: var(--gold); }
.prose hr.rule--blob::after { content: '~ ~ ~'; letter-spacing: .5em; color: var(--ink-soft); }

/* figuras */
.prose figure { margin: 1.2em 0; }
.prose .fig img, .prose .fig video { display: block; height: auto; border: 1px solid var(--rule); padding: 2px; background: var(--field); }
.prose .fig figcaption { margin-top: 4px; font: italic var(--fs-xs)/1.4 var(--serif); color: var(--ink-soft); text-align: center; }
.prose .fig--center { margin-inline: auto; width: var(--w, 100%); }
.prose .fig--left { float: left; width: var(--w, 45%); max-width: 50%; margin: .3em 1.4em .8em 0; }
.prose .fig--right { float: right; width: var(--w, 45%); max-width: 50%; margin: .3em 0 .8em 1.4em; }
.prose .fig--wide, .prose .fig--full { clear: both; }
.prose .fig--wide img, .prose .fig--wide video, .prose .fig--full img, .prose .fig--full video { width: 100%; }
.prose img.zoomable { cursor: zoom-in; }
.prose video { max-width: 100%; }
.prose::after { content: ''; display: block; clear: both; }

/* embeds de outros sites */
.prose .embed { position: relative; aspect-ratio: 16 / 9; background: var(--pre-bg); border: 1px solid var(--edge); }
.prose .embed--fixed { aspect-ratio: auto; background: var(--sheet); }
.prose .embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* cartão de link com prévia */
.prose .linkcard {
  display: grid;
  grid-template-columns: minmax(0, 160px) minmax(0, 1fr);
  margin: 1.4em 0;
  color: var(--ink);
  background: var(--sheet);
  text-decoration: none;
  box-shadow: var(--bevel-in);
  clear: both;
}

.prose a.linkcard:hover { box-shadow: inset 0 0 0 2px var(--gold); }
.prose .linkcard--plain { grid-template-columns: minmax(0, 1fr); }
.linkcard__img { display: block; min-height: 96px; background: var(--panel-hi); }
.linkcard__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.linkcard__body { display: grid; gap: 3px; align-content: center; min-width: 0; padding: 10px 12px; }
.linkcard__title { font: bold 1.05em/1.3 var(--display); color: var(--title-a); overflow-wrap: anywhere; }
.linkcard__desc { font: var(--fs-xs)/1.45 var(--serif); color: var(--ink-soft); }
.linkcard__host { font: var(--fs-xs)/1.3 var(--mono); color: var(--ink-soft); }
.embedcard--missing { opacity: .7; }

/* cartões */
.prose .callout { display: flex; gap: 10px; margin: 1.2em 0; padding: 10px 12px; background: var(--paper-hi); box-shadow: var(--bevel-in); font-size: .95em; clear: both; }
.prose .callout--tip { background: var(--panel-hi); }
.prose .callout--warn { background: var(--sel); }
.prose .callout--alert { background: color-mix(in srgb, var(--alert, #e0322b) 18%, var(--sheet)); }
.prose .callout--blob { background: var(--win-hi); }
.callout__emoji { font-size: 1.4em; line-height: 1.2; }
.callout__body { flex: 1; min-width: 0; }
.callout__body > :last-child { margin-bottom: 0; }

.prose details.toggle { margin: 1em 0; padding: 2px 0 2px 10px; border-left: 3px solid var(--rule); }
.prose details.toggle summary { cursor: pointer; font-weight: bold; }
.prose .toggle__body { padding-left: 8px; }

/* tarefas */
.prose ul.tasks { list-style: none; padding-left: 4px; }
.prose ul.tasks li { display: flex; gap: 8px; align-items: baseline; }
.prose ul.tasks li.done > div { text-decoration: line-through; color: var(--ink-soft); }
.prose ul.tasks input { flex: none; width: 14px; height: 14px; margin: 0; accent-color: var(--leaf); }

/* tabela */
.prose .table-wrap { margin: 1.2em 0; overflow-x: auto; clear: both; }
.prose table { border-collapse: collapse; width: 100%; font: var(--fs-s)/1.5 var(--serif); }
.prose th, .prose td { padding: 5px 8px; border: 1px solid var(--ink-soft); text-align: left; vertical-align: top; }
.prose th { background: var(--title-a); color: var(--title-text); }
.prose td > :last-child, .prose th > :last-child { margin-bottom: 0; }

/* colunas */
.prose .columns { display: grid; gap: 18px; margin: 1.2em 0; clear: both; }
.prose .columns--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.prose .columns--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.prose .column { min-width: 0; }
.prose .column > :last-child { margin-bottom: 0; }

/* ============================================================
   objetos soltos e janelas próprias do dono
   ============================================================ */

/* A camada cobre a área do site (dentro do .shell) e nunca come o clique de
   baixo: só os próprios objetos recebem o ponteiro. `x` do dono é % desta
   largura e `y` é px a partir do topo do site — o mesmo que objects.js grava. */
.objects {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.obj {
  position: absolute;
  display: block;
  pointer-events: auto;
  touch-action: none;
}
.obj img { display: block; width: 100%; height: auto; }
.obj--text {
  padding: 2px 6px;
  font-family: var(--serif);
  line-height: 1.25;
  color: var(--ink);
  text-shadow: 0 1px 0 var(--paper-bg);
  overflow-wrap: break-word;
}
.obj:focus-visible { outline: 2px dashed var(--gold); outline-offset: 2px; }

/* edição: o dono arrasta, estica e gira direto na página */
.objects.is-editing { cursor: crosshair; }
.objects.is-editing .obj { cursor: move; outline: 1px dashed var(--gold); outline-offset: 3px; }
.objects.is-editing .obj.is-selected { outline: 2px solid var(--gold); }
.obj.is-dragging { opacity: .85; }

.obj__resize,
.obj__rotate {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid var(--ink);
  background: var(--paper-bg);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, .3);
}
.obj__resize { right: -8px; bottom: -8px; cursor: nwse-resize; }
.obj__rotate { left: -8px; top: -8px; border-radius: 50%; cursor: grab; }
.objects:not(.is-editing) .obj__resize,
.objects:not(.is-editing) .obj__rotate { display: none; }

/* janela que o dono cria na home: mesmo papel de papel das outras */
.own-win .own-win__img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-bottom: 1px solid var(--edge);
}
.own-win__body > :first-child { margin-top: 0; }
.own-win__body > :last-child { margin-bottom: 0; }

/* no celular: coluna vira pilha, card vira lista, capa e embed ocupam a largura toda */
@media (max-width: 640px) {
  .article-win .sheet { padding: 12px 12px 20px; }
  .card { grid-template-columns: 96px minmax(0, 1fr); gap: 10px; padding: 8px; }
  .card__title { font-size: 1.1rem; }
  .prose .columns--2, .prose .columns--3 { grid-template-columns: minmax(0, 1fr); }
  .prose .fig--left, .prose .fig--right { float: none; width: 100%; max-width: 100%; margin: 1em 0; }
  .prose .linkcard { grid-template-columns: minmax(0, 1fr); }
  .prose .linkcard__img { min-height: 0; aspect-ratio: 16 / 9; }
  .toasts { left: 12px; justify-items: stretch; }
}
