/* ============ SISTEMA DE CONFIGURAÇÕES E LEITURA PERSONALIZADA ============
   Partido Missão 2026 — Leitura & Acessibilidade Nobre Sem Falhas
   ========================================================================== */

:root {
  --reader-bg: #120e0a;
  --reader-text: #e4decd;
  --reader-heading: #f7ce5b;
  --reader-subtext: #c4b9a7;
  --reader-card-bg: #1c1611;
  --reader-card-text: #e4decd;
  --reader-card-heading: #f7ce5b;
  --reader-card-border: rgba(212, 163, 39, 0.3);
  
  --reader-font-size: 1.15rem;
  --reader-line-height: 1.75;
  --reader-letter-spacing: 0.01em;
  --reader-word-spacing: 0em;
  --reader-para-spacing: 1.5rem;
  --reader-col-width: 68ch;
  --reader-font-family: 'Cormorant Garamond', Georgia, serif;
  
  --ruler-opacity: 0.65;
  --ruler-height: 56px;
  --overlay-color: transparent;
}

/* ==========================================================================
   1. EXCLUSÃO E PROTEÇÃO ABSOLUTA DA HERO SECTION ("O FUTURO É GLORIOSO")
   ========================================================================== */
#loader, #loader * {
  /* Proteção 100% — As configurações de leitura NUNCA afetam o Loader */
}

/* PROTEÇÃO DA HERO SECTION: Nenhuma regra de leitura ou acessibilidade afeta a Hero Section ou o título "O FUTURO É GLORIOSO" */

/* TRANSIÇÃO DE GRADIENTE NA FUSÃO DA HERO PARA A DOBRA DE BAIXO */
.hero::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 140px;
  background: linear-gradient(180deg, transparent 0%, #060402 40%, var(--reader-bg, #120e0a) 100%) !important;
  pointer-events: none !important;
  z-index: 10 !important;
  transition: background 0.4s ease;
}

/* ISOLAMENTO DO PAINEL LATERAL (#settingsDrawer) */
#settingsDrawer,
#settingsDrawer * {
  font-family: var(--f-sans) !important;
}

/* ==========================================================================
   2. REAVALIAÇÃO E CONTRASTE ABSOLUTO EM TODOS OS CARDS E SEÇÕES DO SITE
   ========================================================================== */
body.custom-reader {
  background-color: var(--reader-bg) !important;
  color: var(--reader-text) !important;
}

body.custom-reader main,
body.custom-reader section:not(.hero),
body.custom-reader .sec,
body.custom-reader .sec-divider,
body.custom-reader .sec--message,
body.custom-reader .sec--philo,
body.custom-reader .sec--codex,
body.custom-reader .sec--figures,
body.custom-reader .sec--lexicon,
body.custom-reader .sec--parts,
body.custom-reader .sec--faq,
body.custom-reader .interlude,
body.custom-reader .interlude__scrim,
body.custom-reader footer,
body.custom-reader .foot,
body.custom-reader .foot__in {
  background-color: var(--reader-bg) !important;
  background-image: none !important;
  color: var(--reader-text) !important;
  box-shadow: none !important;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Linhas separadoras entre seções */
body.custom-reader .sec-divider__line {
  background: linear-gradient(90deg, transparent, var(--reader-card-border), transparent) !important;
}

body.custom-reader .sec-divider__gem {
  color: var(--reader-heading) !important;
}

/* CARDS E BLOCOS (PILARS, TRÊS PARTES, CÓDICE, LÉXICO, NÚMEROS, FAQ, DIALOGS) */
body.custom-reader .pillar,
body.custom-reader .part,
body.custom-reader .cap,
body.custom-reader .lex,
body.custom-reader .fig,
body.custom-reader .lineage__list > div,
body.custom-reader .inscription,
body.custom-reader .hero__info-card,
body.custom-reader .message__frame,
body.custom-reader .rd__nums div,
body.custom-reader .rd__fecho,
body.custom-reader .reader,
body.custom-reader .reader__bar,
body.custom-reader .reader__body,
body.custom-reader .reader__nav button,
body.custom-reader .filter {
  background-color: var(--reader-card-bg) !important;
  background-image: none !important;
  color: var(--reader-card-text) !important;
  border-color: var(--reader-card-border) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
}

/* REMOÇÃO DE TEXT-CLIP TRANSPARENTE NOS NÚMEROS E CAPULARES DO SITE */
body.custom-reader .dropcap::first-letter,
body.custom-reader .inscription blockquote p,
body.custom-reader .pillar__num,
body.custom-reader .fig__v,
body.custom-reader .rd__num {
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
  background: none !important;
  color: var(--reader-card-heading) !important;
}

/* TÍTULOS E SUBTÍTULOS DO SITE */
body.custom-reader h1:not(.hero *):not(#settingsDrawer *),
body.custom-reader h2:not(.hero *):not(#settingsDrawer *),
body.custom-reader h3:not(.hero *):not(#settingsDrawer *),
body.custom-reader h4:not(.hero *):not(#settingsDrawer *),
body.custom-reader .h2,
body.custom-reader .h3,
body.custom-reader .kicker,
body.custom-reader .phil__title,
body.custom-reader .phil__num,
body.custom-reader .pillar h4,
body.custom-reader .part__title,
body.custom-reader .cap__titulo,
body.custom-reader .lex__t,
body.custom-reader .fig__v,
body.custom-reader .rd__titulo,
body.custom-reader .rd__h,
body.custom-reader .lineage__list dt,
body.custom-reader .foot__title,
body.custom-reader .foot__legal,
body.custom-reader .part__no,
body.custom-reader .cap__tema,
body.custom-reader .cap__go,
body.custom-reader .reader__part,
body.custom-reader .info-modal__title {
  color: var(--reader-card-heading) !important;
}

/* TEXTOS E PARÁGRAFOS DENTRO DOS CARDS E PÁGINA */
body.custom-reader p:not(.hero *):not(#settingsDrawer *),
body.custom-reader span:not(.hero *):not(.nav *):not(#settingsDrawer *),
body.custom-reader li:not(.hero *):not(#settingsDrawer *),
body.custom-reader dt,
body.custom-reader dd,
body.custom-reader blockquote,
body.custom-reader figcaption,
body.custom-reader small,
body.custom-reader strong,
body.custom-reader em,
body.custom-reader b,
body.custom-reader .lead,
body.custom-reader .intro,
body.custom-reader .prose,
body.custom-reader .pillar p,
body.custom-reader .pillar__note,
body.custom-reader .part__desc,
body.custom-reader .part__meta,
body.custom-reader .cap__resumo,
body.custom-reader .cap__parte,
body.custom-reader .lex__d,
body.custom-reader .fig__l,
body.custom-reader .interlude__txt,
body.custom-reader .interlude__quote,
body.custom-reader .sign,
body.custom-reader .message__body p,
body.custom-reader .rd__resumo,
body.custom-reader .reader__body p,
body.custom-reader .rd__props li {
  color: var(--reader-card-text) !important;
}

/* APLICAÇÃO GERAL DA FAMÍLIA TIPOGRÁFICA EM TODO O CONTEÚDO */
body.custom-reader,
body.custom-reader main,
body.custom-reader main *:not(.hero *):not(#settingsDrawer *):not(.nav *):not(svg):not(path):not(button.btn) {
  font-family: var(--reader-font-family) !important;
}

body.custom-reader .prose p,
body.custom-reader .cap__body p,
body.custom-reader .pillar p,
body.custom-reader .intro,
body.custom-reader .reader__body p {
  font-size: var(--reader-font-size) !important;
  line-height: var(--reader-line-height) !important;
  letter-spacing: var(--reader-letter-spacing) !important;
  word-spacing: var(--reader-word-spacing) !important;
  margin-bottom: var(--reader-para-spacing) !important;
}

body.custom-reader .pull {
  border-left-color: var(--reader-card-heading) !important;
  color: var(--reader-card-heading) !important;
}

/* ==========================================================================
   3. BARRA FLUTUANTE DE ÁUDIO E LEITURA NO CANTO INFERIOR DIREITO
      (SOMENTE VISÍVEL AO USAR O SCROLL)
   ========================================================================== */
.floating-controls-bar {
  position: fixed;
  bottom: 1.8rem;
  right: 1.8rem;
  z-index: 9995;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(16px) scale(0.95);
  transition: opacity 0.4s var(--ease), visibility 0.4s var(--ease), transform 0.4s var(--ease);
}

.floating-controls-bar.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.floating-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  border: 1px solid var(--gold-500);
  border-radius: 30px;
  background: radial-gradient(circle at 35% 35%, #2a2015 0%, #120e0a 100%);
  color: var(--gold-300);
  font-family: var(--f-display);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8), 0 0 14px rgba(247, 206, 91, 0.25);
  transition: all 0.3s var(--ease);
}

.floating-btn:hover {
  border-color: var(--gold-200);
  color: #ffffff;
  background: radial-gradient(circle at 35% 35%, #3a2e1e 0%, #1c1611 100%);
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.9), 0 0 22px rgba(247, 206, 91, 0.5);
}

.floating-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  stroke: currentColor;
}

.floating-btn--audio.is-playing {
  border-color: var(--gold-300);
  color: #ffffff;
  box-shadow: 0 0 18px rgba(247, 206, 91, 0.5);
}

/* ==========================================================================
   4. DRAWER DE CONFIGURAÇÕES (ESTILO ESCURO ISOLADO)
   ========================================================================== */
.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(6, 4, 3, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.settings-backdrop.is-active {
  opacity: 1;
  visibility: visible;
}

.settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(92vw, 450px);
  z-index: 9999;
  background: #14100b !important;
  border-left: 2px solid var(--gold-600) !important;
  box-shadow: -12px 0 50px rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
  color: #f7f3ea !important;
  font-family: var(--f-sans) !important;
  transform: translateX(100%);
  transition: transform 0.4s var(--ease);
  overflow: hidden;
}

.settings-drawer.is-active {
  transform: translateX(0);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.3rem 1.5rem;
  border-bottom: 1px solid rgba(212, 163, 39, 0.35);
  background: linear-gradient(180deg, #241b12 0%, #14100b 100%) !important;
}

.settings-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.settings-title-icon {
  width: 26px;
  height: 26px;
  fill: var(--gold-400) !important;
}

.settings-title {
  font-family: var(--f-display) !important;
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-300) !important;
  margin: 0;
}

.settings-close-btn {
  background: rgba(212, 163, 39, 0.1);
  border: 1px solid rgba(212, 163, 39, 0.4);
  border-radius: 6px;
  color: #f7f3ea !important;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.4rem;
  transition: all 0.2s ease;
}

.settings-close-btn:hover {
  background: var(--gold-400) !important;
  color: #000 !important;
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-600) transparent;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.settings-section-title {
  font-family: var(--f-display) !important;
  font-size: 0.84rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-300) !important;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.settings-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(212, 163, 39, 0.3);
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.preset-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.85rem;
  border: 2px solid rgba(212, 163, 39, 0.35) !important;
  border-radius: 8px;
  background: #1e1811 !important;
  color: #f7f3ea !important;
  cursor: pointer;
  text-align: left;
  transition: all 0.25s ease;
}

.preset-card:hover {
  border-color: var(--gold-300) !important;
  background: #2d2419 !important;
}

.preset-card.is-selected {
  border-color: var(--gold-300) !important;
  background: var(--gold-400) !important;
  color: #000000 !important;
  box-shadow: 0 0 16px rgba(247, 206, 91, 0.4);
}

.preset-card.is-selected .preset-name {
  color: #000000 !important;
  font-weight: 800 !important;
}

.preset-preview {
  width: 100%;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-serif) !important;
  font-weight: 700 !important;
  font-size: 0.95rem !important;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.preset-name {
  font-size: 0.84rem !important;
  font-weight: 700 !important;
}

.color-picker-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.color-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.color-input-wrapper label {
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  color: #dcd4c5 !important;
}

.color-picker-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(212, 163, 39, 0.4) !important;
  border-radius: 6px;
  background: #18130d !important;
}

.color-picker-field input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  background: transparent;
}

.color-picker-field input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 50%;
}

.color-hex-val {
  font-family: monospace !important;
  font-size: 0.84rem !important;
  font-weight: 600 !important;
  color: #f7f3ea !important;
}

.contrast-badge {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.84rem !important;
  font-weight: 600 !important;
  margin-top: 0.3rem;
  background: #1e1811 !important;
  border: 1px solid var(--gold-600) !important;
  color: var(--gold-300) !important;
}

.contrast-badge.optimal {
  border-color: var(--gold-400) !important;
  background: rgba(247, 206, 91, 0.12) !important;
  color: #f7ce5b !important;
}

.contrast-badge.fair {
  border-color: #d4a327 !important;
  color: #e6b800 !important;
}

.contrast-badge.poor {
  border-color: #e53935 !important;
  color: #ff8a80 !important;
  background: rgba(229, 57, 53, 0.15) !important;
}

.contrast-icon-svg {
  width: 20px;
  height: 20px;
  fill: currentColor !important;
  flex-shrink: 0;
}

.live-preview-box {
  padding: 0.9rem;
  border-radius: 6px;
  border: 1px solid rgba(212, 163, 39, 0.35) !important;
  margin-top: 0.3rem;
}

.live-preview-box p {
  margin: 0;
  font-size: 0.92rem !important;
  line-height: 1.5 !important;
}

.setting-control-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-label-val {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  color: #dcd4c5 !important;
}

.control-val-num {
  font-weight: 700 !important;
  color: var(--gold-300) !important;
}

.settings-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(212, 163, 39, 0.3);
  outline: none;
}

.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold-400);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0,0,0,0.6);
}

.font-quick-buttons {
  display: flex;
  gap: 0.6rem;
}

.font-quick-btn {
  flex: 1;
  padding: 0.55rem;
  border: 1px solid rgba(212, 163, 39, 0.4) !important;
  background: #1e1811 !important;
  color: #f7f3ea !important;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem !important;
  font-weight: 700 !important;
  transition: all 0.2s ease;
}

.font-quick-btn:hover {
  border-color: var(--gold-300) !important;
  background: var(--gold-400) !important;
  color: #000 !important;
}

.font-family-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(212, 163, 39, 0.4) !important;
  border-radius: 6px;
  background: #18130d !important;
  color: #f7f3ea !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  outline: none;
}

.overlay-color-options {
  display: flex;
  gap: 0.6rem;
}

.overlay-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.overlay-btn:hover {
  transform: scale(1.15);
}

.overlay-btn.is-selected {
  border-color: var(--gold-300);
  box-shadow: 0 0 10px var(--gold-400);
}

.ambient-select-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.ambient-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 0.6rem;
  border: 2px solid rgba(212, 163, 39, 0.35) !important;
  border-radius: 8px;
  background: #1e1811 !important;
  color: #dcd4c5 !important;
  cursor: pointer;
  font-size: 0.84rem !important;
  font-weight: 600 !important;
  transition: all 0.2s ease;
}

.ambient-btn:hover {
  border-color: var(--gold-300) !important;
  color: #ffffff !important;
}

.ambient-btn.is-selected {
  border-color: var(--gold-300) !important;
  background: var(--gold-400) !important;
  color: #000000 !important;
  font-weight: 800 !important;
  box-shadow: 0 0 12px rgba(247, 206, 91, 0.35);
}

.ambient-svg-icon {
  width: 20px;
  height: 20px;
  fill: currentColor !important;
  flex-shrink: 0;
}

.settings-footer {
  padding: 1.3rem 1.5rem;
  border-top: 1px solid rgba(212, 163, 39, 0.35);
  background: #100c08 !important;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-reset-original {
  width: 100%;
  padding: 0.8rem;
  border: 2px solid var(--gold-500) !important;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(212, 163, 39, 0.3) 0%, rgba(140, 100, 15, 0.4) 100%) !important;
  color: #ffffff !important;
  font-family: var(--f-display) !important;
  font-size: 0.88rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.btn-reset-original:hover {
  background: var(--gold-400) !important;
  color: #000000 !important;
  border-color: var(--gold-200) !important;
  box-shadow: 0 0 16px rgba(247, 206, 91, 0.4);
}

.footer-sub-actions {
  display: flex;
  gap: 0.6rem;
}

.btn-secondary-action {
  flex: 1;
  padding: 0.6rem;
  border: 1px solid rgba(212, 163, 39, 0.35) !important;
  border-radius: 6px;
  background: #18130d !important;
  color: #dcd4c5 !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary-action:hover {
  border-color: var(--gold-400) !important;
  color: #ffffff !important;
}

.reading-ruler {
  position: fixed;
  left: 0; right: 0;
  z-index: 9990;
  pointer-events: none;
  display: none;
}

.reading-ruler.is-active {
  display: block;
}

.ruler-mask-top,
.ruler-mask-bottom {
  position: fixed;
  left: 0; right: 0;
  background: rgba(0, 0, 0, var(--ruler-opacity));
  transition: background 0.2s ease;
}

.ruler-mask-top { top: 0; }
.ruler-mask-bottom { bottom: 0; }

.ruler-clear-window {
  position: fixed;
  left: 0; right: 0;
  height: var(--ruler-height);
  border-top: 2px solid var(--gold-400);
  border-bottom: 2px solid var(--gold-400);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6);
}

.color-overlay {
  position: fixed;
  inset: 0;
  z-index: 9989;
  pointer-events: none;
  mix-blend-mode: multiply;
  background-color: var(--overlay-color);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.color-overlay.is-active {
  opacity: 1;
}

@media (max-width: 768px) {
  .floating-controls-bar {
    bottom: 1.2rem;
    right: 1.2rem;
    gap: 0.4rem;
  }
  .floating-btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.68rem;
  }
}
