/* ═══════════════════════════════════════════════════════════
   CASA DA FILOSOFIA — Projeto Viva
   Espaço institucional da Arquitetura de Inteligência
   ═══════════════════════════════════════════════════════════ */

.cf-hero {
  min-height: 70vh;
  display: flex;
  align-items: center;
  padding-top: 10rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cf-hero .container {
  position: relative;
  z-index: 2;
  max-width: 880px;
}

.cf-hero h1 {
  margin: 0.8rem 0 1.5rem;
}

.cf-hero__lead {
  max-width: 700px;
  margin: 0 auto 2.5rem;
}

/* Fundamentos — grade de quatro princípios */
.cf-fundamentos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: rgba(201, 162, 39, 0.18);
}

.cf-fundamento {
  background: #0a1628;
  padding: 2.25rem;
  min-height: 260px;
}

.cf-fundamento span {
  color: var(--color-gold);
  font-family: var(--font-display, serif);
  font-size: 2rem;
  opacity: 0.6;
}

.cf-fundamento h3 {
  font-family: var(--font-display, serif);
  font-size: 1.3rem;
  margin: 1.5rem 0 1rem;
}

.cf-fundamento p {
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.7;
  font-size: 0.95rem;
}

/* Arquitetura — oito camadas */
.cf-camadas {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 2.5rem;
}

.cf-camada {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  border: 1px solid rgba(201, 162, 39, 0.2);
  background: color-mix(in srgb, currentColor 3%, transparent);
  transition: border-color 0.35s, transform 0.35s, background-color 0.35s;
}

.cf-camada:hover {
  border-color: rgba(201, 162, 39, 0.6);
  background: color-mix(in srgb, var(--color-accent) 8%, transparent);
  transform: translateY(-4px);
}

.cf-camada__number {
  color: var(--color-accent);
  font-family: var(--font-display, serif);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.cf-camada__name {
  font-family: var(--font-display, serif);
  font-size: 1.05rem;
  color: var(--text-primary);
}

/* Nova Atlântida — pergunta orientadora */
.cf-question {
  font-family: var(--font-display, serif);
  font-style: italic;
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  line-height: 1.55;
  color: var(--color-gold);
  margin: 2.5rem 0 0;
  padding-left: 1.5rem;
  border-left: 2px solid rgba(201, 162, 39, 0.4);
}

/* Presença conversacional — Converse com Projeto */
.cf-chat {
  margin-top: 2.5rem;
  text-align: left;
}

.cf-chat__status {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.5rem;
  border: 1px dashed rgba(201, 162, 39, 0.5);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-gold);
  margin-bottom: 1.75rem;
}

.cf-chat__status[hidden] {
  display: none;
}

.cf-chat__status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-gold);
  flex-shrink: 0;
}

.cf-chat__panel {
  border: 1px solid rgba(201, 162, 39, 0.22);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-lg, 16px);
  padding: 2rem;
}

.cf-chat__panel + .cf-chat__panel {
  margin-top: 1.5rem;
}

.cf-chat__fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.cf-chat__fieldset:disabled {
  opacity: 0.45;
}

.cf-chat__legend {
  font-family: var(--font-display, serif);
  font-size: 1.15rem;
  color: #fff;
  padding: 0;
  margin-bottom: 1rem;
}

.cf-chat__privacy {
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.7;
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  padding-left: 1rem;
  border-left: 2px solid rgba(201, 162, 39, 0.4);
}

.cf-chat__notice-list {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.cf-chat__notice-list li {
  position: relative;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.6);
}

.cf-chat__notice-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-gold);
}

.cf-chat__consent-label {
  margin-bottom: 1.5rem;
}

/* Campos de formulário e checkbox — o restante do site define estes
   nomes de classe em apesquisa.css, que não é carregado nesta página;
   por isso reproduzimos a mesma linguagem visual aqui, sob o escopo
   .cf-chat, para não depender de uma folha de estilos alheia. */
.cf-chat .form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 0.5rem;
}

.cf-chat .form-input {
  width: 100%;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md, 10px);
  color: var(--color-white);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, background-color 0.2s;
}

.cf-chat .form-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.cf-chat .form-input:focus {
  outline: none;
  border-color: var(--color-gold);
  background: rgba(201, 162, 39, 0.05);
}

.cf-chat .form-textarea {
  resize: vertical;
  display: block;
  line-height: 1.6;
}

.cf-chat .checkbox-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  cursor: pointer;
}

.cf-chat .checkbox-wrapper input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cf-chat .checkbox-custom {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-sm, 4px);
  position: relative;
  transition: border-color 0.2s, background-color 0.2s;
}

.cf-chat .checkbox-custom::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 6px;
  width: 5px;
  height: 10px;
  border: solid var(--color-black);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 0;
  transition: opacity 0.2s;
}

.cf-chat .checkbox-wrapper input:checked + .checkbox-custom {
  background: var(--color-gold);
  border-color: var(--color-gold);
}

.cf-chat .checkbox-wrapper input:checked + .checkbox-custom::after {
  opacity: 1;
}

.cf-chat .checkbox-wrapper input:focus-visible + .checkbox-custom {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

.cf-chat .checkbox-label {
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.75);
}

.cf-chat__history {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-height: 60vh;
  overflow-y: auto;
  margin-bottom: 1.25rem;
  padding-right: 0.25rem;
}

.cf-chat__message {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md, 10px);
  padding: 1.1rem 1.25rem;
}

.cf-chat__message:focus {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

.cf-chat__message--user {
  background: rgba(255, 255, 255, 0.03);
}

.cf-chat__message--casa {
  background: rgba(201, 162, 39, 0.04);
  border-color: rgba(201, 162, 39, 0.25);
}

.cf-chat__message-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-gold);
  margin-bottom: 0.5rem;
}

.cf-chat__message-text {
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.7;
  white-space: pre-wrap;
}

.cf-chat__notice {
  font-size: 0.88rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm, 6px);
  background: rgba(255, 255, 255, 0.03);
}

.cf-chat__notice:empty {
  display: none;
  padding: 0;
  margin: 0;
}

.cf-chat__notice--refusal {
  color: #f1c1c1;
  background: rgba(229, 57, 53, 0.08);
  border: 1px solid rgba(229, 57, 53, 0.25);
}

.cf-chat__notice--confirm {
  color: var(--color-gold);
  background: rgba(201, 162, 39, 0.08);
}

.cf-chat__badge {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
}

.cf-chat__badge-label {
  color: rgba(255, 255, 255, 0.4);
}

.cf-chat__section {
  margin-top: 1rem;
}

.cf-chat__section-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.5rem;
}

.cf-chat__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.cf-chat__list-item {
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.75);
  padding-left: 1rem;
  border-left: 2px solid rgba(255, 255, 255, 0.15);
}

.cf-chat__list-item strong {
  display: block;
  color: #fff;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.cf-chat__source-role {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-gold);
  border: 1px solid rgba(201, 162, 39, 0.4);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  margin-bottom: 0.35rem;
}

/* Sprint 5 — revelação gradual da resposta principal. */

/* Visualmente oculto, mas presente para leitor de tela: recebe o texto
   completo assim que a mensagem chega, para o aria-live do histórico
   anunciar uma única vez — a camada visual animada é aria-hidden e nunca
   entra na árvore de acessibilidade. Padrão "clip" convencional. */
.cf-chat__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Mesmo padrão já usado acima em .cf-chat__status[hidden]. */
.cf-chat__complements[hidden] {
  display: none;
}

.cf-chat__skip-reveal {
  margin-top: 0.9rem;
}

/* Pergunta de continuidade de Projeto — fala, não aviso técnico. */
.cf-chat__followup {
  margin-top: 0.9rem;
  padding-left: 1rem;
  border-left: 2px solid rgba(201, 162, 39, 0.4);
  color: rgba(255, 255, 255, 0.85);
  font-style: italic;
  line-height: 1.6;
}

/* Seções progressivas — <details> nativo, sem dependência de JavaScript
   para abrir/fechar; leitor de tela e teclado usam o comportamento padrão
   do elemento. Cada uma abre/fecha independente das demais. */
.cf-chat__details {
  margin-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.75rem;
}

.cf-chat__summary {
  cursor: pointer;
  list-style: revert;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0.4rem 0.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  -webkit-tap-highlight-color: transparent;
}

.cf-chat__summary:hover {
  color: var(--color-gold);
}

.cf-chat__summary::marker,
.cf-chat__summary::-webkit-details-marker {
  color: var(--color-gold);
}

.cf-chat__details-body {
  margin-top: 0.75rem;
  overflow-wrap: anywhere;
}

/* Badge compacto de estado epistêmico + modo — nunca operation_id,
   identificador de conversa, nome de classe/provedor ou código interno. */
.cf-chat__status-badge {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.cf-chat__status-badge .cf-chat__badge {
  margin-top: 0;
  padding: 0.2rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

.cf-chat__status-badge .cf-chat__badge--mode {
  border-color: rgba(201, 162, 39, 0.35);
  color: var(--color-gold);
}

.cf-chat__contest {
  margin-top: 1rem;
}

.cf-chat__contest-form {
  display: grid;
  gap: 0.75rem;
}

.cf-chat__textarea {
  min-height: 96px;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.cf-chat__form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.cf-chat__btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm, 6px);
  transition: border-color 0.3s, color 0.3s, background-color 0.3s;
}

.cf-chat__btn-secondary:hover {
  color: #fff;
  border-color: var(--color-gold);
  background: rgba(201, 162, 39, 0.06);
}

.cf-chat__btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cf-chat .btn:disabled,
.cf-chat button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.cf-chat .btn__loading {
  display: none;
}

.cf-chat .btn--loading .btn__text {
  display: none;
}

.cf-chat .btn--loading .btn__loading {
  display: inline-flex;
}

.cf-chat__error {
  font-size: 0.85rem;
  color: #e5736f;
  min-height: 1em;
  margin-bottom: 1rem;
}

.cf-chat__error:empty {
  display: none;
  margin: 0;
}

.cf-chat *:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

/* Posição no ecossistema */
.cf-position-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin: 2.5rem 0;
}

.cf-position-node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 240px;
  max-width: 100%;
  padding: 1rem 1.75rem;
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 999px;
  font-family: var(--font-display, serif);
  font-size: 1.05rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  transition: border-color 0.3s, background-color 0.3s;
}

a.cf-position-node:hover {
  border-color: var(--color-gold);
  background: rgba(201, 162, 39, 0.08);
}

.cf-position-node--current {
  border-color: var(--color-gold);
  background: var(--color-gold);
  color: #000;
  font-weight: 600;
}

.cf-position-arrow {
  color: var(--color-gold);
  font-size: 1.25rem;
  line-height: 1;
}

.cf-position-note {
  margin-top: 1.5rem;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.9rem;
}

/* Encerramento */
.cf-closing {
  text-align: center;
}

@media (max-width: 1024px) {
  .cf-fundamentos {
    grid-template-columns: repeat(2, 1fr);
  }

  .cf-camadas {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .cf-hero {
    min-height: auto;
    padding-top: 8.5rem;
  }

  .cf-fundamentos {
    grid-template-columns: 1fr;
  }

  .cf-fundamento {
    min-height: auto;
  }

  .cf-camadas {
    grid-template-columns: 1fr;
  }

  .cf-position-node {
    min-width: 0;
    width: 100%;
  }

  .cf-chat__panel {
    padding: 1.25rem;
  }

  .cf-chat__form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .cf-chat__form-actions .btn,
  .cf-chat__btn-secondary {
    width: 100%;
  }

  .cf-chat__history {
    max-height: 50vh;
  }
}

@media (max-width: 400px) {
  .cf-chat__panel {
    padding: 1rem 0.85rem;
  }

  .cf-chat__status {
    padding: 0.65rem 1rem;
    font-size: 0.7rem;
  }
}

/* Reforço de defesa (a checagem real é em JS, a cada resposta — ver
   prefersReducedMotion() em casa-da-filosofia-chat.js): sem rolagem suave
   quando o visitante prefere movimento reduzido. */
@media (prefers-reduced-motion: reduce) {
  #cfChatHistory {
    scroll-behavior: auto;
  }
}
