/*
Theme Name: C-Partes
Theme URI: https://example.org/cpartes
Author: C-Partes
Description: Tema de blocos (Full Site Editing) para o C-Partes — Centro de Pesquisa e Ativismo de Rondônia sobre Tecnologia, Estado e Sociobiodiversidade. Identidade visual "Cores da Nossa Terra", blog de Publicações e páginas institucionais.
Version: 1.0.0
Requires at least: 6.5
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cpartes
*/

/* Estilos adicionais que o theme.json não cobre. */
html { scroll-behavior: smooth; }
img { height: auto; }

.cp-faixa { display: flex; height: 14px; }
.cp-faixa span { flex: 1; }
.cp-faixa span:nth-child(1) { background: var(--wp--preset--color--chao-de-oca); }
.cp-faixa span:nth-child(2) { background: var(--wp--preset--color--madeirao); }
.cp-faixa span:nth-child(3) { background: var(--wp--preset--color--oliva-tucumazeiro); }
.cp-faixa span:nth-child(4) { background: var(--wp--preset--color--sombra-da-castanheira); }
.cp-faixa span:nth-child(5) { background: var(--wp--preset--color--sol-de-cupuacu); }
.cp-faixa span:nth-child(6) { background: var(--wp--preset--color--encanto-do-boto); }
.cp-faixa span:nth-child(7) { background: var(--wp--preset--color--ceu-de-rondonia); }
.cp-faixa span:nth-child(8) { background: var(--wp--preset--color--litorina); }
.cp-faixa span:nth-child(9) { background: var(--wp--preset--color--acaizeiro); }

/* Cartões de publicação */
.cp-card { transition: transform .2s ease; }
.cp-card:hover { transform: translateY(-4px); }
.cp-card .wp-block-post-featured-image img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.cp-card .wp-block-post-title a { text-decoration: none; }
.cp-card .wp-block-post-title a:hover { color: var(--wp--preset--color--chao-de-oca); }

/* Cartões de eixo */
.cp-eixo img { border-radius: 14px; }

/* Termos (categorias) como etiquetas */
.cp-tag a, .cp-tag { text-decoration: none; }
.cp-tag a {
  display: inline-block; padding: .2em .7em; border-radius: 999px;
  background: var(--wp--preset--color--sol-de-cupuacu); color: var(--wp--preset--color--madeirao);
  font-weight: 600;
}
.cp-tag a:hover { background: var(--wp--preset--color--litorina); color: var(--wp--preset--color--sombra-da-castanheira); }

/* Foco acessível */
:where(a, button, input, textarea):focus-visible { outline: 3px solid var(--wp--preset--color--ceu-de-rondonia); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) { .cp-card { transition: none; } html { scroll-behavior: auto; } }

/* ---- Cabeçalho (referência: LAPIN) ---- */
.cp-topbar .wp-block-search__inside-wrapper { background: rgba(246, 237, 223, .35); border-radius: 6px; padding: 2px 6px; }
.cp-topbar .wp-block-search__input { background: transparent; border: 0; color: var(--wp--preset--color--fundo-papel); font-size: .9rem; padding: .35rem .5rem; }
.cp-topbar .wp-block-search__input::placeholder { color: var(--wp--preset--color--fundo-papel); opacity: .85; }
.cp-topbar .wp-block-search__button { background: transparent; color: var(--wp--preset--color--fundo-papel); border: 0; padding: .2rem .4rem; }
.cp-topbar .wp-block-search__button:hover { background: transparent; }
.wp-block-navigation .current-menu-item > a,
.wp-block-navigation .current-menu-item > .wp-block-navigation-item__content,
.wp-block-navigation .current_page_item > a { background: var(--wp--preset--color--encanto-do-boto); color: var(--wp--preset--color--fundo-papel); }
.wp-block-navigation .wp-block-navigation-item__content { padding: .45rem 1rem; border-radius: 999px; }
.wp-block-navigation .wp-block-navigation-item__content:hover { background: rgba(246, 237, 223, .15); color: var(--wp--preset--color--fundo-papel); }
footer .wp-block-navigation .wp-block-navigation-item__content { padding: .2rem 0; border-radius: 0; background: none; }
footer .wp-block-navigation .wp-block-navigation-item__content:hover { background: none; color: var(--wp--preset--color--sol-de-cupuacu); }

/* ---- Cartões de publicação (referência: LAPIN) ---- */
.cp-card { position: relative; overflow: hidden; border-radius: 10px; box-shadow: 0 2px 14px rgba(8, 7, 6, .12); }
.cp-card .wp-block-post-featured-image { margin: 0; border-radius: 0; }
.cp-card .wp-block-post-featured-image img { border-radius: 0; aspect-ratio: 3 / 2; object-fit: cover; width: 100%; display: block; }
.cp-card .cp-tag { position: absolute; top: 1rem; right: 1rem; z-index: 2; margin: 0; }
.cp-card .cp-tag a { background: var(--wp--preset--color--encanto-do-boto); color: var(--wp--preset--color--fundo-papel); text-transform: uppercase; font-size: .78rem; letter-spacing: .02em; font-weight: 500; padding: .35em 1em; }
.cp-card .cp-tag a:hover { background: var(--wp--preset--color--madeirao); color: var(--wp--preset--color--fundo-papel); }
.cp-card .wp-block-post-title a { color: var(--wp--preset--color--chao-de-oca); }
.cp-card .wp-block-post-excerpt__excerpt { margin: 0; color: #4a4038; }
.cp-card .wp-block-read-more { font-family: var(--wp--preset--font-family--archivo); font-weight: 700; text-transform: uppercase; text-decoration: none; color: var(--wp--preset--color--chao-de-oca); }
.cp-card .wp-block-read-more:hover { color: var(--wp--preset--color--madeirao); }
.cp-card-data { border-top: 1px solid rgba(112, 61, 35, .2); color: #7a6a60; }
.cp-card-data .wp-block-post-date { color: #7a6a60; }

/* ---- Divisor com ícone ---- */
.cp-divisor { display: flex; align-items: center; gap: 1rem; color: var(--wp--preset--color--madeirao); max-width: 1000px; margin-inline: auto; }
.cp-divisor span { flex: 1; height: 2px; background: currentColor; }
.wp-block-categories-dropdown { text-align: center; }
.wp-block-categories-dropdown select { padding: .6rem 1rem; border-radius: 8px; border: 1px solid var(--wp--preset--color--madeirao); background: var(--wp--preset--color--branco); font-family: inherit; }

/* ---- Anexos: cartão clicável com ícone do formato + selo "Baixar" ---- */
.wp-block-file__embed, .wp-block-file__preview, .wp-block-file object,
.wp-block-file .wp-block-file__button,
.wp-block-file .wp-block-file__button-richtext-wrapper { display: none !important; }
.wp-block-file {
  margin: 0 0 .75rem; padding: 0; overflow: hidden;
  background: var(--wp--preset--color--branco); border: 1px solid rgba(112, 61, 35, .22); border-radius: 10px;
}
.wp-block-file a {
  display: flex; align-items: center; gap: 1rem; padding: 14px 18px;
  color: var(--wp--preset--color--madeirao); font-weight: 700; text-decoration: none; overflow-wrap: anywhere;
}
.wp-block-file a:hover { color: var(--wp--preset--color--chao-de-oca); background: rgba(246, 195, 138, .2); }
.cp-anexo-icone { flex: none; width: 32px; height: 38px; display: block; }
.cp-anexo-icone svg { display: block; width: 32px; height: 38px; }
.cp-anexo-nome { flex: 1 1 10rem; min-width: 0; }
.cp-anexo-baixar { white-space: nowrap; }
.cp-anexo-baixar, .editor-styles-wrapper .wp-block-file a::after {
  flex: none; margin-left: auto; padding: .5em 1.1em; border-radius: 999px;
  background: var(--wp--preset--color--chao-de-oca); color: var(--wp--preset--color--fundo-papel);
  font-family: var(--wp--preset--font-family--archivo); font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em;
}
.wp-block-file a:hover .cp-anexo-baixar { background: var(--wp--preset--color--madeirao); }
@media (max-width: 480px) { .wp-block-file a { flex-wrap: wrap; } .cp-anexo-baixar { margin-left: 0; } }

/* Editor de blocos: o PHP não roda lá, então o ícone e o selo vêm por CSS. */
.editor-styles-wrapper .wp-block-file a::before { content: ""; display: inline-block; vertical-align: middle; margin-right: 1rem; flex: none; width: 32px; height: 38px; background: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2240%22 height=%2248%22 viewBox=%220 0 40 48%22%3E%3Cpath d=%22M4 0h22l14 14v30a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z%22 fill=%22%23703D23%22/%3E%3Cpath d=%22M26 0l14 14H30a4 4 0 0 1-4-4z%22 fill=%22%23F6C38A%22/%3E%3Crect x=%229%22 y=%2226%22 width=%2222%22 height=%223%22 rx=%221.5%22 fill=%22%23F6EDDF%22/%3E%3Crect x=%229%22 y=%2233%22 width=%2222%22 height=%223%22 rx=%221.5%22 fill=%22%23F6EDDF%22/%3E%3C/svg%3E") center / contain no-repeat; }
.editor-styles-wrapper .wp-block-file a::after { content: "Baixar \2193"; display: inline-block; vertical-align: middle; margin-left: 1rem; }
.editor-styles-wrapper .wp-block-file a[href$=".pdf" i]::before { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2240%22 height=%2248%22 viewBox=%220 0 40 48%22%3E%3Cpath d=%22M4 0h22l14 14v30a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z%22 fill=%22%23B74A1A%22/%3E%3Cpath d=%22M26 0l14 14H30a4 4 0 0 1-4-4z%22 fill=%22%23F6C38A%22/%3E%3Ctext x=%2220%22 y=%2238%22 text-anchor=%22middle%22 font-family=%22Arial%2CHelvetica%2Csans-serif%22 font-weight=%22700%22 font-size=%2212%22 fill=%22%23F6EDDF%22%3EPDF%3C/text%3E%3C/svg%3E"); }
.editor-styles-wrapper .wp-block-file a[href$=".doc" i]::before,
.editor-styles-wrapper .wp-block-file a[href$=".docx" i]::before,
.editor-styles-wrapper .wp-block-file a[href$=".odt" i]::before,
.editor-styles-wrapper .wp-block-file a[href$=".rtf" i]::before { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2240%22 height=%2248%22 viewBox=%220 0 40 48%22%3E%3Cpath d=%22M4 0h22l14 14v30a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z%22 fill=%22%23508AC0%22/%3E%3Cpath d=%22M26 0l14 14H30a4 4 0 0 1-4-4z%22 fill=%22%23F6C38A%22/%3E%3Ctext x=%2220%22 y=%2238%22 text-anchor=%22middle%22 font-family=%22Arial%2CHelvetica%2Csans-serif%22 font-weight=%22700%22 font-size=%2212%22 fill=%22%23F6EDDF%22%3EDOC%3C/text%3E%3C/svg%3E"); }
.editor-styles-wrapper .wp-block-file a[href$=".xls" i]::before,
.editor-styles-wrapper .wp-block-file a[href$=".xlsx" i]::before,
.editor-styles-wrapper .wp-block-file a[href$=".ods" i]::before,
.editor-styles-wrapper .wp-block-file a[href$=".csv" i]::before { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2240%22 height=%2248%22 viewBox=%220 0 40 48%22%3E%3Cpath d=%22M4 0h22l14 14v30a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z%22 fill=%22%234B451B%22/%3E%3Cpath d=%22M26 0l14 14H30a4 4 0 0 1-4-4z%22 fill=%22%23F6C38A%22/%3E%3Ctext x=%2220%22 y=%2238%22 text-anchor=%22middle%22 font-family=%22Arial%2CHelvetica%2Csans-serif%22 font-weight=%22700%22 font-size=%2212%22 fill=%22%23F6EDDF%22%3EXLS%3C/text%3E%3C/svg%3E"); }
.editor-styles-wrapper .wp-block-file a[href$=".ppt" i]::before,
.editor-styles-wrapper .wp-block-file a[href$=".pptx" i]::before,
.editor-styles-wrapper .wp-block-file a[href$=".odp" i]::before { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2240%22 height=%2248%22 viewBox=%220 0 40 48%22%3E%3Cpath d=%22M4 0h22l14 14v30a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z%22 fill=%22%23C34F5B%22/%3E%3Cpath d=%22M26 0l14 14H30a4 4 0 0 1-4-4z%22 fill=%22%23F6C38A%22/%3E%3Ctext x=%2220%22 y=%2238%22 text-anchor=%22middle%22 font-family=%22Arial%2CHelvetica%2Csans-serif%22 font-weight=%22700%22 font-size=%2212%22 fill=%22%23F6EDDF%22%3EPPT%3C/text%3E%3C/svg%3E"); }
.editor-styles-wrapper .wp-block-file a[href$=".zip" i]::before,
.editor-styles-wrapper .wp-block-file a[href$=".rar" i]::before,
.editor-styles-wrapper .wp-block-file a[href$=".7z" i]::before { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2240%22 height=%2248%22 viewBox=%220 0 40 48%22%3E%3Cpath d=%22M4 0h22l14 14v30a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z%22 fill=%22%23381E47%22/%3E%3Cpath d=%22M26 0l14 14H30a4 4 0 0 1-4-4z%22 fill=%22%23F6C38A%22/%3E%3Ctext x=%2220%22 y=%2238%22 text-anchor=%22middle%22 font-family=%22Arial%2CHelvetica%2Csans-serif%22 font-weight=%22700%22 font-size=%2212%22 fill=%22%23F6EDDF%22%3EZIP%3C/text%3E%3C/svg%3E"); }

/* ---- Cartões com a mesma altura na linha; "Leia mais" e data alinhados na base ---- */
.wp-block-post-template.is-layout-grid > li { display: flex; }
.wp-block-post-template .cp-card { display: flex; flex-direction: column; width: 100%; height: 100%; }
.cp-card > .wp-block-group:not(.cp-card-data) { flex: 1 1 auto; display: flex; flex-direction: column; }
.cp-card .wp-block-read-more { margin-top: auto; align-self: flex-start; padding-top: .5rem; }
.cp-card .cp-card-data { flex: none; margin-top: 0; }
