/* Tokens do design system Farmix (design_system/design_system.html). */
:root {
  --fx-primary: #004a99;
  --fx-primary-dark: #003b7a;
  --fx-secondary: #2b80bc;
  --fx-accent: #e08a2d;
  --fx-bg: #f4f6f8;
  --fx-text: #1f2933;
  --fx-muted: #52606d;
  --fx-sidebar-bg: #204399;   /* .bg-farmix: mesmo azul do logo */
  --fx-sidebar-link: #3fa7f1; /* .bg-farmix .nav-link */
  --fx-sidebar-width: 260px;
  --fx-sidebar-rail-width: 72px; /* menu recolhido: só ícones */
}

body { font-family: 'Roboto', sans-serif; color: var(--fx-text); background: #fff; }
h1, h2, h3, .section-title { font-family: 'Work Sans', sans-serif; }

/* Navbar lateral: fixa no desktop, offcanvas no celular. Cores da sidebar do design system. */
.site-sidebar { --bs-offcanvas-width: 280px; --bs-offcanvas-bg: var(--fx-sidebar-bg); --bs-offcanvas-color: #fff; background: var(--fx-sidebar-bg); color: #fff; }
@media (min-width: 992px) {
  /* O Bootstrap zera o fundo do .offcanvas-lg nessa largura com !important. */
  .site-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--fx-sidebar-width); padding: 1.5rem 1.25rem; background-color: var(--fx-sidebar-bg) !important; overflow-x: hidden; transition: width .2s ease-in-out, padding .2s ease-in-out; }
  .site-main { margin-left: var(--fx-sidebar-width); transition: margin-left .2s ease-in-out; }
}
.sidebar-logo { width: 100%; max-width: 180px; height: auto; margin-bottom: 2rem; }
/* Selo da marca: só aparece com o menu recolhido, no lugar do logo. */
.sidebar-seal { display: none; width: 48px; height: 48px; margin: 0 auto 1.5rem; }
.sidebar-nav .nav-link { color: var(--fx-sidebar-link); padding: .65rem .25rem; display: flex; gap: .75rem; align-items: center; font-weight: 500; transition: opacity .2s ease-in-out; }
.sidebar-nav .nav-link:hover, .sidebar-nav .nav-link:focus { color: var(--fx-sidebar-link); opacity: .5; }
.sidebar-nav .nav-link.sidebar-active { color: var(--fx-accent); font-weight: 600; opacity: 1; }
.sidebar-contact { padding-top: 1rem; }
/* Só os textos: um nowrap na sidebar inteira impedia a quebra de linha entre os itens. */
.sidebar-label { white-space: nowrap; }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-whatsapp:hover, .btn-whatsapp:focus { background: #1ebe5b; color: #fff; }
/* "Fale conosco" da sidebar azul: contorno branco; no hover, fundo branco e texto azul. */
.btn-contact { --bs-btn-color: #fff; --bs-btn-border-color: #fff; --bs-btn-hover-bg: #fff; --bs-btn-hover-color: var(--fx-sidebar-bg); --bs-btn-hover-border-color: #fff; --bs-btn-active-bg: #fff; --bs-btn-active-color: var(--fx-sidebar-bg); --bs-btn-active-border-color: #fff; --bs-btn-focus-shadow-rgb: 255, 255, 255; }

/* Botão de recolher (só desktop; a exibição vem do .d-none/.d-lg-flex). */
.sidebar-toggle { align-self: flex-end; align-items: center; justify-content: center; width: 2rem; height: 2rem; margin-bottom: .5rem; padding: 0; border: 0; border-radius: .375rem; background: transparent; color: rgba(255, 255, 255, .75); transition: background-color .2s ease-in-out; }
.sidebar-toggle:hover, .sidebar-toggle:focus-visible { background: rgba(255, 255, 255, .12); color: #fff; }
.sidebar-toggle i { transition: transform .2s ease-in-out; }
/* Menu recolhido (classe no <html>, posta por js/sidebar.js): faixa só com ícones; o nome fica no title. */
@media (min-width: 992px) {
  .sidebar-collapsed .site-sidebar { width: var(--fx-sidebar-rail-width); padding-inline: .75rem; }
  .sidebar-collapsed .site-main { margin-left: var(--fx-sidebar-rail-width); }
  .sidebar-collapsed .sidebar-toggle { align-self: center; }
  .sidebar-collapsed .sidebar-toggle i { transform: rotate(180deg); }
  .sidebar-collapsed .sidebar-logo { display: none; }
  .sidebar-collapsed .sidebar-seal { display: block; }
  /* Escondido só visualmente: leitores de tela continuam lendo o nome do link. */
  .sidebar-collapsed .sidebar-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sidebar-collapsed .sidebar-nav .nav-link { justify-content: center; font-size: 1.25rem; }
  .sidebar-collapsed .sidebar-contact a { display: flex; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .site-sidebar, .site-main, .sidebar-toggle i { transition: none; }
}
.mobile-topbar { position: sticky; top: 0; z-index: 1020; display: flex; justify-content: space-between; align-items: center; padding: .5rem 1rem; background: var(--fx-sidebar-bg); }

/* Banner rotativo: mesma proporção do formato padrão (1920×600) recomendado no admin. */
.banner-carousel { background: var(--fx-bg); }
.banner-image { display: block; width: 100%; height: auto; aspect-ratio: 16 / 5; object-fit: cover; }

/* Faixa do Portal de Vendas entre o banner e as notícias; o fundo vem do .cta-section. */
.portal-strip { padding: 1.5rem 0; }

.section { padding: 4rem 0; }
/* Linha fina cinza-clara entre seções vizinhas (não aparece no topo da página). */
.site-main section + section { border-top: 1px solid #e5e7eb; }
.section-alt { background: var(--fx-bg); }
.section-title { color: var(--fx-primary); font-weight: 700; margin-bottom: 1rem; }
.section-lead { max-width: 70ch; }

.timeline { list-style: none; padding: 0; margin: 2rem 0 0; border-left: 3px solid var(--fx-secondary); }
.timeline-item { position: relative; padding: 0 0 1.75rem 1.5rem; max-width: 75ch; }
.timeline-item::before { content: ''; position: absolute; left: -9px; top: .3rem; width: 15px; height: 15px; border-radius: 50%; background: var(--fx-accent); }
.timeline-year { font-family: 'Work Sans', sans-serif; font-weight: 700; color: var(--fx-accent); }
.timeline-title { font-size: 1.15rem; margin: .25rem 0 .5rem; }
.timeline-title:first-child { margin-top: 0; }

.branch-card { background: #fff; border-radius: .75rem; overflow: hidden; box-shadow: 0 .25rem 1rem rgba(0, 0, 0, .08); height: 100%; }
.branch-photo { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.branch-body { padding: 1.25rem 1.5rem; }
.branch-body h3 { font-size: 1.2rem; color: var(--fx-primary); }

.site-footer { background: #0b2545; color: rgba(255, 255, 255, .8); padding: 2rem 1.5rem; }
.site-footer a { color: #fff; }
.social-links { display: flex; gap: 1rem; font-size: 1.35rem; }

.post-card { position: relative; background: #fff; border-radius: .75rem; overflow: hidden; box-shadow: 0 .25rem 1rem rgba(0, 0, 0, .08); height: 100%; }
.post-card-photo { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.post-card-body { padding: 1.25rem 1.5rem; }
.post-card-body time, .post-detail time { font-size: .9rem; color: var(--fx-muted); }
.post-card-title { font-size: 1.15rem; margin: .35rem 0 .5rem; }
.post-card-title a { color: var(--fx-primary); text-decoration: none; }
.post-detail { max-width: 860px; }
.post-body { font-size: 1.05rem; line-height: 1.7; }
.post-body h2, .post-body h3 { color: var(--fx-primary); margin-top: 1.75rem; }
.post-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: .5rem; }
.post-photos figcaption { font-size: .85rem; color: var(--fx-muted); margin-top: .35rem; }
.post-photo-link { display: block; cursor: zoom-in; border-radius: .5rem; }
.post-photo-link:focus-visible { outline: 3px solid var(--fx-secondary); outline-offset: 2px; }

/* Visualizador de fotos do post: imagem inteira (contain), no maior tamanho que couber na tela. */
.photo-viewer .modal-content { background: #0b0f17; color: #fff; }
.photo-viewer .modal-header { border-bottom: 0; padding: .75rem 1rem; }
.photo-viewer .modal-body { padding: 0 0 1rem; overflow: hidden; }
.photo-viewer-counter { font-size: .95rem; color: rgba(255, 255, 255, .85); }
.photo-viewer-slide { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 1rem; }
.photo-viewer-image { flex: 0 1 auto; min-height: 0; max-width: 100%; max-height: 100%; object-fit: contain; }
.photo-viewer-caption { flex: none; margin: .75rem 0 0; font-size: .95rem; text-align: center; color: rgba(255, 255, 255, .85); }
@media (min-width: 768px) {
  .photo-viewer-slide { padding: 0 5rem; } /* espaço para as setas não cobrirem a foto */
}
.back-link { text-decoration: none; }

.btn-primary { --bs-btn-bg: var(--fx-primary); --bs-btn-border-color: var(--fx-primary); --bs-btn-hover-bg: var(--fx-primary-dark); --bs-btn-hover-border-color: var(--fx-primary-dark); --bs-btn-active-bg: var(--fx-primary-dark); }
.btn-outline-primary { --bs-btn-color: var(--fx-primary); --bs-btn-border-color: var(--fx-primary); --bs-btn-hover-bg: var(--fx-primary); --bs-btn-hover-border-color: var(--fx-primary); --bs-btn-active-bg: var(--fx-primary-dark); --bs-btn-active-border-color: var(--fx-primary-dark); }
.cta-section { background: #e8f1fa; }

/* Chat de atendimento (support): botão flutuante e painel no canto inferior direito.
   Fica abaixo dos modais e do offcanvas do Bootstrap (z-index 1045+). */
.support-chat-toggle { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 1040; display: flex; align-items: center; justify-content: center; width: 3.5rem; height: 3.5rem; border: 0; border-radius: 50%; background: var(--fx-primary); color: #fff; font-size: 1.5rem; box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .25); transition: background-color .2s ease-in-out; }
.support-chat-toggle:hover, .support-chat-toggle:focus-visible { background: var(--fx-primary-dark); }
.support-chat-toggle[hidden], .support-chat-panel[hidden] { display: none; }
.support-chat-panel { position: fixed; right: 1.25rem; bottom: 5.5rem; z-index: 1041; display: flex; flex-direction: column; width: 380px; height: min(560px, calc(100vh - 7.5rem)); background: #fff; border-radius: .75rem; overflow: hidden; box-shadow: 0 .75rem 2rem rgba(0, 0, 0, .25); }
.support-chat-header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .75rem 1rem; background: var(--fx-sidebar-bg); color: #fff; }
.support-chat-title { margin: 0; font-family: 'Work Sans', sans-serif; font-weight: 600; }
.support-chat-log { flex: 1; display: flex; flex-direction: column; gap: .5rem; padding: 1rem; overflow-y: auto; background: var(--fx-bg); }
/* pre-line: as quebras de linha digitadas no admin aparecem no chat. */
.support-chat-message { max-width: 88%; padding: .55rem .8rem; border-radius: .75rem; font-size: .95rem; white-space: pre-line; overflow-wrap: anywhere; }
.support-chat-message p { margin: 0; }
.support-chat-message-bot, .support-chat-message-typing { align-self: flex-start; background: #fff; border-bottom-left-radius: .25rem; box-shadow: 0 .125rem .35rem rgba(0, 0, 0, .06); }
.support-chat-message-user { align-self: flex-end; background: var(--fx-primary); color: #fff; border-bottom-right-radius: .25rem; }
.support-chat-message-hint { align-self: center; padding: 0; font-size: .8rem; color: var(--fx-muted); text-align: center; }
.support-chat-message-typing { color: var(--fx-muted); }
.support-chat-links { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; margin-top: .6rem; white-space: normal; }
/* Aviso de bloqueio financeiro: fixo no rodapé da caixa, acima do campo de digitação. */
.support-chat-notice { padding: .6rem 1rem; border-top: 1px solid #f2d27a; background: #fff8e1; color: #5c4400; font-size: .85rem; }
.support-chat-notice p { margin: 0 0 .4rem; }
.support-chat-notice[hidden] { display: none; }
.support-chat-consent { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; padding: .75rem 1rem; border-top: 1px solid #e5e7eb; font-size: .85rem; }
.support-chat-form { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid #e5e7eb; }
.support-chat-choice { display: flex; flex-wrap: wrap; gap: .5rem; padding: .75rem; border-top: 1px solid #e5e7eb; }
.support-chat-choice .btn { flex: 1 1 auto; }
.support-chat-consent[hidden], .support-chat-form[hidden], .support-chat-choice[hidden] { display: none; }
/* Celular: o painel ocupa a largura da tela, acima do botão. */
@media (max-width: 575.98px) {
  .support-chat-toggle { right: 1rem; bottom: 1rem; }
  .support-chat-panel { right: .5rem; left: .5rem; bottom: 5rem; width: auto; height: calc(100vh - 6rem); height: calc(100dvh - 6rem); }
}
@media (prefers-reduced-motion: reduce) {
  .support-chat-toggle { transition: none; }
}

/* Parceiros: coluna ao lado da história, com os logos subindo devagar e sem parar.
   No desktop o carrossel ocupa a altura da história; no celular, uma faixa fixa. */
.partners-column { display: flex; flex-direction: column; }
.partners-viewport { position: relative; flex: 1 1 0; min-height: 22rem; overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(to bottom, transparent, #000 8%, #000 92%, transparent); }
/* Fora do fluxo: a lista longa não estica a coluna além da história. */
.partners-scroller { position: absolute; inset: 0 0 auto; animation: partners-scroll calc(var(--partner-count) * 3s) linear infinite; }
.partners-viewport:hover .partners-scroller { animation-play-state: paused; }
.partners-track { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 0; padding: 0 0 1rem; list-style: none; }
.partner-logo { display: block; width: 100%; height: auto; border-radius: .5rem; background: #fff; box-shadow: 0 .125rem .5rem rgba(0, 0, 0, .08); }
/* -50%: a segunda lista (cópia) chega exatamente onde a primeira começou. Roda para todos,
   inclusive com "reduzir animações" no sistema (decisão de 12/11/2026); pausa com o mouse em cima. */
@keyframes partners-scroll { from { transform: translateY(0); } to { transform: translateY(-50%); } }
