/* ==========================================================================
   Caça-Palavras Bíblico — Design System
   Identidade "tocha + pergaminho": marrons quentes, pergaminho, dourado 3D,
   azul-marinho profundo para telas escuras. Jogável e reverente, sem lilás.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Cores — tinta (navy profundo para telas escuras) */
  --ink-900: #0e1424;
  --ink-800: #16203c;
  --ink-700: #1f2c52;
  --ink-600: #2b3b6b;
  --ink-500: #46578c;
  --ink-400: #7c8ab5;
  --ink-300: #aab3d0;

  /* Cores — pergaminho / papel */
  --parchment-50: #fdfbf7;
  --parchment-100: #f9f5eb;
  --parchment-200: #f3ead5;
  --parchment-300: #eadbbd;
  --parchment-400: #dcbfa1;

  /* Cores — madeira, marrom e dourado (3D) */
  --wood-700: #40260f;
  --wood-600: #5c3a21;
  --wood-500: #8a5a2b;
  --marrom-900: #2a1708;
  --marrom-800: #3a200c;
  --marrom-700: #542f12;
  --marrom-600: #6b441c;
  --marrom-500: #8a5a2b;
  --marrom-400: #b9853f;
  --gold-600: #c07d05;
  --gold-500: #e5a00d;
  --gold-400: #f4ba31;
  --gold-100: #fff5d6;

  /* Cores — apoio */
  --wine-600: #7b2d3a;
  --wine-500: #a83a4d;
  --wine-400: #cf6a74;
  --wine-300: #e9a3a8;
  --teal-600: #2f6b63;
  --leaf-600: #3f7a48;

  /* Neutros */
  --white: #ffffff;
  --black: #000000;
  --overlay-soft: rgba(20, 10, 3, 0.55);
  --overlay-strong: rgba(20, 10, 3, 0.78);

  /* Cores das palavras encontradas (§11) — sem lilás: azul, verde, terracota,
     dourado, rubi e petróleo */
  --word-1: #1f5fa8;   /* azul     */
  --word-1-bg: #dcebf9;
  --word-2: #2c6b3a;   /* verde    */
  --word-2-bg: #ddf0e1;
  --word-3: #8a5a2b;   /* marrom   */
  --word-3-bg: #efe3d2;
  --word-4: #c0522a;   /* terracota */
  --word-4-bg: #fbe3d4;
  --word-5: #a17817;   /* dourado  */
  --word-5-bg: #f7ecd0;
  --word-6: #1f6b70;   /* petróleo */
  --word-6-bg: #dcefef;

  /* Tipografia */
  --font-display: "Cinzel", "Cinzel Decorative", "Cormorant Garamond",
    "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Playfair Display", "Cormorant Garamond", Georgia, serif;

  --fs-xs: clamp(0.72rem, 0.68rem + 0.2vw, 0.8rem);
  --fs-sm: clamp(0.82rem, 0.78rem + 0.2vw, 0.9rem);
  --fs-base: clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem);
  --fs-md: clamp(1.05rem, 1rem + 0.35vw, 1.2rem);
  --fs-lg: clamp(1.25rem, 1.15rem + 0.6vw, 1.55rem);
  --fs-xl: clamp(1.6rem, 1.4rem + 1.2vw, 2.3rem);
  --fs-2xl: clamp(2rem, 1.6rem + 2.2vw, 3.2rem);
  --fs-hero: clamp(2.4rem, 1.8rem + 3.6vw, 4.4rem);

  /* Espaçamento */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;

  /* Raios */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 999px;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(14, 20, 36, 0.08),
    0 2px 6px rgba(14, 20, 36, 0.06);
  --shadow-md: 0 4px 12px rgba(14, 20, 36, 0.1),
    0 10px 28px rgba(14, 20, 36, 0.09);
  --shadow-lg: 0 10px 30px rgba(14, 20, 36, 0.16),
    0 24px 60px rgba(14, 20, 36, 0.14);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.6);

  /* Movimento */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 160ms;
  --dur: 260ms;
  --dur-slow: 520ms;

  /* Layout */
  --container: 1180px;
  --header-h: 72px;
}

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.65;
  color: var(--ink-800);
  background-color: var(--parchment-100);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink-900);
}

/* --------------------------------------------------------------------------
   3. Utilitários
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- Configuração de recursos (config.json / js/config.js) ----
   Enquanto a config carrega, os elementos controláveis ficam só invisíveis
   (sem "flash") e a classe é removida no load como fallback. Quando um flag
   é false, o elemento recebe .is-config-hidden (display:none vence o
   display:inline-flex dos botões). */
html.config-pending [data-config] {
  visibility: hidden;
}

.is-config-hidden {
  display: none !important;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: 999;
  padding: var(--space-3) var(--space-5);
  background: var(--ink-800);
  color: var(--parchment-50);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: top var(--dur) var(--ease);
}

.skip-link:focus {
  top: 0;
}

.text-center {
  text-align: center;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-600);
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: var(--fs-xl);
  margin-bottom: var(--space-4);
}

.section-lead {
  font-size: var(--fs-md);
  color: var(--ink-600);
  max-width: 62ch;
}

.text-center .section-lead {
  margin-inline: auto;
}

.divider-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
  color: var(--gold-500);
}

.divider-ornament::before,
.divider-ornament::after {
  content: "";
  height: 1px;
  width: min(120px, 22vw);
  background: linear-gradient(
    90deg,
    transparent,
    var(--parchment-400),
    transparent
  );
}

.section {
  padding-block: clamp(3rem, 8vw, var(--space-9));
}

.section--alt {
  background: var(--parchment-50);
}

.section--ink {
  background: linear-gradient(160deg, var(--marrom-900), var(--marrom-800));
  color: var(--parchment-200);
}

.section--ink h2,
.section--ink h3 {
  color: var(--parchment-50);
}

.section--ink .section-lead {
  color: #d9c3a0;
}

.section--ink .eyebrow {
  color: var(--gold-400);
}

/* --------------------------------------------------------------------------
   4. Botões
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 0.8rem 1.7rem;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-align: center;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  transition: transform var(--dur-fast) var(--ease),
    box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease),
    color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: 3px solid var(--gold-500);
  outline-offset: 3px;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: linear-gradient(180deg, #6b441c 0%, #40260f 100%);
  color: var(--gold-100);
  border-color: #8a5a2b;
  box-shadow: 0 5px 0 #2a1708, 0 10px 20px rgba(0, 0, 0, 0.32);
}

.btn--primary:hover {
  box-shadow: 0 7px 0 #2a1708, 0 12px 24px rgba(0, 0, 0, 0.36);
  background: linear-gradient(180deg, #8a5a2b 0%, #542f12 100%);
}

.btn--primary:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #2a1708, 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn--gold {
  background: linear-gradient(180deg, #f8db62 0%, #e69d0e 100%);
  color: #3a2404;
  border-color: #f0c950;
  box-shadow: 0 5px 0 #8a5a1a, 0 10px 20px rgba(0, 0, 0, 0.32);
}

.btn--gold:hover {
  box-shadow: 0 7px 0 #8a5a1a, 0 12px 24px rgba(0, 0, 0, 0.36);
  background: linear-gradient(180deg, #fce79d 0%, #f4ba31 100%);
}

.btn--gold:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #8a5a1a, 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-800);
  border-color: var(--ink-300);
}

.btn--ghost:hover {
  border-color: var(--ink-700);
  background: rgba(22, 32, 60, 0.05);
}

.btn--ghost-light {
  background: rgba(255, 255, 255, 0.06);
  color: var(--parchment-100);
  border-color: rgba(255, 255, 255, 0.45);
}

.btn--ghost-light:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--parchment-100);
}

/* Botão de apoio/doação — caloroso e convidativo (§20). Tom terracota/rosé
   quente (nada de lilás), com brilho suave e sombra 3D como os demais. */
.btn--support {
  background: linear-gradient(180deg, var(--wine-400) 0%, var(--wine-500) 100%);
  color: #fff6ee;
  border-color: var(--wine-300);
  box-shadow: 0 5px 0 var(--wine-600), 0 10px 20px rgba(0, 0, 0, 0.3);
}

.btn--support:hover {
  box-shadow: 0 7px 0 var(--wine-600), 0 12px 24px rgba(0, 0, 0, 0.34);
  background: linear-gradient(180deg, var(--wine-300) 0%, #b4485e 100%);
}

.btn--support:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--wine-600), 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Emoji dentro de botões (ícone decorativo, ignorado por leitores de tela) */
.btn__emoji {
  font-size: 1.15em;
  line-height: 1;
}

.btn--sm {
  min-height: 40px;
  padding: 0.5rem 1.15rem;
  font-size: var(--fs-xs);
}

.btn--block {
  width: 100%;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.btn-row--center {
  justify-content: center;
}

/* --------------------------------------------------------------------------
   5. Formulários
   -------------------------------------------------------------------------- */
.field {
  display: block;
  margin-bottom: var(--space-4);
}

.field__label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: var(--space-2);
}

.field__input {
  width: 100%;
  min-height: 52px;
  padding: 0.75rem 1rem;
  font-size: var(--fs-md);
  color: var(--ink-900);
  background: var(--white);
  border: 1px solid var(--parchment-400);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.field__input::placeholder {
  color: var(--ink-400);
}

.field__input:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 4px rgba(201, 162, 75, 0.22);
}

.field__hint {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--fs-xs);
  color: var(--ink-500);
}

/* --------------------------------------------------------------------------
   6. Painéis e cartões
   -------------------------------------------------------------------------- */
.panel {
  background: var(--white);
  border: 1px solid var(--parchment-300);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: clamp(1.25rem, 4vw, 2.5rem);
}

.panel--parchment {
  background: linear-gradient(180deg, var(--parchment-50), var(--parchment-100));
  box-shadow: var(--shadow-inset), var(--shadow-sm);
}

.card {
  background: linear-gradient(180deg, var(--parchment-50), var(--parchment-100));
  border: 1px solid var(--parchment-300);
  border-top: 3px solid var(--gold-500);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

/* Título dourado 3D (efeito do herói) */
.text-gold-3d {
  background: linear-gradient(
    180deg,
    #fff7d6 0%,
    #f7c34d 40%,
    #d88909 70%,
    #854e02 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--gold-400);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.65));
}

/* --------------------------------------------------------------------------
   7. Modais
   -------------------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: var(--overlay-strong);
  backdrop-filter: blur(3px);
}

.modal.is-open {
  display: flex;
  animation: fade-in var(--dur) var(--ease);
}

.modal__dialog {
  width: min(560px, 100%);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: var(--parchment-50);
  border-radius: var(--radius-lg);
  border-top: 4px solid var(--gold-500);
  box-shadow: var(--shadow-lg);
  padding: clamp(1.25rem, 4vw, 2.25rem);
  animation: pop-in var(--dur) var(--ease);
}

.modal__title {
  font-size: var(--fs-lg);
  margin-bottom: var(--space-3);
}

.modal__text {
  color: var(--ink-600);
  margin-bottom: var(--space-4);
}

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: flex-end;
  margin-top: var(--space-5);
}

/* --------------------------------------------------------------------------
   8. Sistema de telas (SPA)
   -------------------------------------------------------------------------- */
.screen {
  display: none;
  min-height: 100vh;
}

.screen.is-active {
  display: block;
  animation: fade-in var(--dur-slow) var(--ease);
}

.screen--center {
  display: none;
  place-items: center;
  min-height: 100vh;
  background:
    radial-gradient(
      1100px 520px at 50% -12%,
      rgba(244, 186, 49, 0.2),
      transparent 70%
    ),
    linear-gradient(165deg, var(--marrom-900), var(--marrom-800));
  padding-block: var(--space-6);
}

.screen--center.is-active {
  display: grid;
}

.screen--center__inner {
  width: min(520px, 100%);
}

.player-panel {
  text-align: left;
  animation: rise-in var(--dur-slow) var(--ease);
}

.player-panel .section-lead {
  margin-bottom: var(--space-5);
}

/* Botão de fechar genérico de modais */
.modal__close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--ink-500);
  font-size: 1.3rem;
  line-height: 1;
  transition: background-color var(--dur) var(--ease);
}

.modal__close:hover {
  background: rgba(22, 32, 60, 0.08);
  color: var(--ink-900);
}

/* --------------------------------------------------------------------------
   Doação (§20)
   -------------------------------------------------------------------------- */
.donation-qr {
  position: relative;
  display: grid;
  place-items: center;
  width: 180px;
  height: 180px;
  margin: 0 auto var(--space-4);
  background: var(--white);
  border: 1px solid var(--parchment-300);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.donation-qr__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.donation-qr__logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 4px rgba(14, 20, 36, 0.18);
}

.donation-qr__logo img {
  width: 30px;
  height: 30px;
  display: block;
}

.donation-qr__placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-align: center;
  color: var(--ink-400);
  background: repeating-linear-gradient(
    45deg,
    var(--parchment-100),
    var(--parchment-100) 10px,
    var(--parchment-200) 10px,
    var(--parchment-200) 20px
  );
}

.donation-key {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--ink-600);
  margin-bottom: var(--space-4);
}

.donation-key__label {
  display: block;
  font-size: var(--fs-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-500);
}

.donation-key__value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-sm);
  color: var(--ink-900);
  word-break: break-all;
}

/* Passo 1 — escolha do valor (§20) */
.donation-amounts {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

@media (min-width: 460px) {
  .donation-amounts {
    grid-template-columns: repeat(3, 1fr);
  }
}

.donation-amount {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 58px;
  padding: 0.6rem 0.8rem;
  font-family: var(--font-body);
  background: transparent;
  border: 2px solid var(--parchment-300);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

.donation-amount:hover {
  transform: translateY(-1px);
  border-color: var(--wine-400);
  background: rgba(207, 106, 116, 0.08);
}

.donation-amount:active {
  transform: translateY(0);
}

.donation-amount__value {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--ink-800);
}

.donation-amount__hint {
  font-size: var(--fs-xs);
  color: var(--ink-500);
}

/* Passo 2 — QR Code gerado (§20) */
.donation-amount-ref {
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-600);
  margin-bottom: var(--space-4);
}

.donation-back {
  display: block;
  margin: var(--space-3) auto 0;
  padding: 0.4rem 1rem;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  background: transparent;
  border: 0;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease);
}

.donation-back:hover {
  color: var(--wine-500);
}

/* --------------------------------------------------------------------------
   9. Foco, seleção e movimento reduzido
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--gold-500);
  outline-offset: 2px;
}

::selection {
  background: var(--gold-100);
  color: var(--ink-900);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   10. Animações base
   -------------------------------------------------------------------------- */
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes glow-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

/* --------------------------------------------------------------------------
   9. Áreas seguras (notch/status bar) — PWA/Capacitor (§38)
   -------------------------------------------------------------------------- */
@supports (padding: env(safe-area-inset-left)) {
  .modal {
    padding-left: max(var(--space-4), env(safe-area-inset-left));
    padding-right: max(var(--space-4), env(safe-area-inset-right));
    padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
  }
}
