/* =========================================================
   MÁQUINA SANTA — Design tokens & base styles
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Palette */
  --azul-profundo: #0B1F3A;
  --azul-noite: #0E2647;
  --azul-luz: #1E3A66;
  --branco: #FBFAF7;
  --dourado: #C9A24B;
  --dourado-suave: #E4CE93;
  --texto-claro: #EDEFF4;
  --texto-suave: #B9C2D4;
  --linha: rgba(201, 162, 75, 0.25);

  /* Type */
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Layout */
  --max-w: 720px;
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  background: radial-gradient(120% 140% at 50% -10%, var(--azul-luz) 0%, var(--azul-profundo) 45%, #081525 100%);
  color: var(--texto-claro);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

a { color: inherit; }

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px 48px;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  max-width: var(--max-w);
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-flame {
  width: 30px; height: 30px;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--branco);
}

.nav-menu-btn {
  background: none;
  border: 1px solid var(--linha);
  color: var(--texto-claro);
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

/* ---------- Nav drawer (simple) ---------- */
.nav-drawer {
  position: fixed; inset: 0;
  background: rgba(6, 14, 28, 0.92);
  backdrop-filter: blur(6px);
  display: none;
  z-index: 50;
  padding: 24px;
}
.nav-drawer.open { display: block; }
.nav-drawer-inner {
  max-width: var(--max-w);
  margin: 60px auto 0;
}
.nav-drawer a {
  display: block;
  font-family: var(--serif);
  font-size: 1.4rem;
  padding: 14px 0;
  border-bottom: 1px solid var(--linha);
  text-decoration: none;
  color: var(--branco);
}
.nav-drawer .close-btn {
  position: absolute; top: 20px; right: 20px;
  background: none; border: none; color: var(--branco);
  font-size: 1.8rem; cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 8px 0 28px;
}

.hero-poster {
  width: 100%;
  border-radius: var(--radius);
  display: block;
  margin-bottom: 22px;
  border: 1px solid var(--linha);
}

.hero-eyebrow {
  font-size: 0.8rem;
  color: var(--dourado-suave);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 8vw, 2.6rem);
  line-height: 1.15;
  margin: 0 0 14px;
  color: var(--branco);
}

.hero p.lede {
  color: var(--texto-suave);
  font-size: 1.05rem;
  max-width: 46ch;
  margin: 0 auto 26px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 22px;
  border-radius: 14px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(180deg, var(--dourado-suave), var(--dourado));
  color: #201404;
  box-shadow: 0 8px 24px rgba(201, 162, 75, 0.25);
}

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--texto-claro);
  border: 1px solid var(--linha);
}

.btn-block { width: 100%; }

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}
.action-grid .btn { flex-direction: column; padding: 20px 10px; font-size: 0.92rem; }
.action-grid .icon { font-size: 1.4rem; }

/* ---------- Principles ring (CSS, not the poster image) ---------- */
.principles-section { padding: 10px 0 8px; }
.principles-section h2 {
  font-family: var(--serif);
  font-weight: 500;
  text-align: center;
  font-size: 1.4rem;
  color: var(--branco);
  margin-bottom: 4px;
}
.principles-section .sub {
  text-align: center;
  color: var(--texto-suave);
  font-size: 0.9rem;
  margin-bottom: 22px;
}

.principles-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.principle-chip {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--linha);
  border-radius: 14px;
  padding: 14px 6px;
  text-align: center;
}
.principle-chip .emoji { font-size: 1.3rem; display: block; margin-bottom: 6px; }
.principle-chip .label { font-size: 0.75rem; color: var(--texto-suave); }

/* ---------- QR section ---------- */
.qr-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--linha);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-top: 30px;
}
.qr-card h3 {
  font-family: var(--serif);
  font-weight: 500;
  margin: 0 0 6px;
  color: var(--branco);
}
.qr-card p { color: var(--texto-suave); font-size: 0.88rem; margin: 0 0 16px; }
#qrcode-box { display: inline-block; background: var(--branco); padding: 12px; border-radius: 12px; }
#qrcode-box canvas, #qrcode-box img { display: block; }

.contexts-row {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-top: 22px;
  flex-wrap: wrap;
  color: var(--texto-suave);
  font-size: 0.78rem;
}
.contexts-row span { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.contexts-row .emoji { font-size: 1.2rem; }

footer.site-footer {
  text-align: center;
  padding: 30px 20px 50px;
  color: var(--texto-suave);
  font-size: 0.8rem;
}

/* ---------- Chat screen ---------- */
.chat-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--linha);
}
.chat-header .back { text-decoration: none; color: var(--texto-claro); font-size: 1.3rem; }
.chat-header .title { font-family: var(--serif); font-size: 1.05rem; }
.chat-header .status { font-size: 0.72rem; color: var(--texto-suave); }

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 82%;
  padding: 12px 15px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.msg.assistant {
  align-self: flex-start;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--linha);
  border-bottom-left-radius: 4px;
}
.msg.user {
  align-self: flex-end;
  background: linear-gradient(180deg, var(--dourado-suave), var(--dourado));
  color: #201404;
  border-bottom-right-radius: 4px;
}
.msg.typing { color: var(--texto-suave); font-style: italic; }

.chat-quickbar {
  display: flex;
  gap: 8px;
  padding: 0 18px 10px;
  overflow-x: auto;
}
.chip-btn {
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--linha);
  color: var(--texto-claro);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.chat-input-bar {
  display: flex;
  gap: 10px;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--linha);
  background: rgba(8, 21, 37, 0.7);
}
.chat-input-bar textarea {
  flex: 1;
  resize: none;
  border-radius: 14px;
  border: 1px solid var(--linha);
  background: rgba(255,255,255,0.04);
  color: var(--texto-claro);
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 0.95rem;
  max-height: 120px;
}
.chat-input-bar textarea:focus { outline: 2px solid var(--dourado); }

.round-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
}
.round-btn.send { background: linear-gradient(180deg, var(--dourado-suave), var(--dourado)); color: #201404; }
.round-btn.mic { background: rgba(255,255,255,0.08); color: var(--texto-claro); border: 1px solid var(--linha); }
.round-btn.mic.listening { background: #7A1F2B; animation: pulse 1.4s infinite; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(122,31,43,0.5); }
  70% { box-shadow: 0 0 0 14px rgba(122,31,43,0); }
  100% { box-shadow: 0 0 0 0 rgba(122,31,43,0); }
}

/* ---------- Voice screen ---------- */
.voice-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
}
.voice-orb {
  width: 180px; height: 180px;
  border-radius: 50%;
  margin: 40px auto;
  background: radial-gradient(circle at 35% 30%, var(--dourado-suave), var(--azul-luz) 70%);
  box-shadow: 0 0 60px rgba(201,162,75,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  transition: box-shadow 0.3s ease;
}
.voice-orb.listening { box-shadow: 0 0 90px rgba(201,162,75,0.55); }
.voice-orb.speaking { box-shadow: 0 0 90px rgba(122,31,43,0.4); }
.voice-state { font-size: 0.95rem; color: var(--texto-suave); min-height: 1.4em; margin-bottom: 6px; }
.voice-transcript { font-family: var(--serif); font-size: 1.2rem; color: var(--branco); max-width: 30ch; min-height: 3em; }
.voice-controls { display: flex; gap: 16px; align-items: center; }
.voice-mic-btn {
  width: 84px; height: 84px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(180deg, var(--dourado-suave), var(--dourado));
  font-size: 2rem;
  cursor: pointer;
}
.voice-mic-btn.listening { background: #7A1F2B; }

/* ---------- Forms / settings ---------- */
.page-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.7rem;
  margin: 18px 0 6px;
}
.page-lede { color: var(--texto-suave); margin-bottom: 24px; font-size: 0.95rem; }

.card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--linha);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card h3 { font-family: var(--serif); font-weight: 500; margin: 0 0 8px; font-size: 1.05rem; }
.card p { color: var(--texto-suave); font-size: 0.9rem; margin: 0; }

.field-label { display: block; font-size: 0.85rem; color: var(--texto-suave); margin: 14px 0 6px; }
.field-input, .field-select, .field-textarea {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--linha);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--texto-claro);
  font-family: var(--sans);
  font-size: 0.95rem;
}
.field-textarea { min-height: 90px; resize: vertical; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--linha);
}
.toggle-row:last-child { border-bottom: none; }

.switch { position: relative; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  transition: 0.2s;
}
.slider::before {
  content: ""; position: absolute; height: 20px; width: 20px;
  left: 3px; bottom: 3px; background: var(--branco); border-radius: 50%;
  transition: 0.2s;
}
input:checked + .slider { background: var(--dourado); }
input:checked + .slider::before { transform: translateX(20px); }

/* ---------- Prayer screen ---------- */
.prayer-box {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--linha);
  border-radius: var(--radius);
  padding: 22px;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--branco);
  white-space: pre-wrap;
  margin-top: 18px;
}

/* ---------- Car mode ---------- */
.car-shell {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 30px;
  padding: 24px;
}
.car-mic-btn {
  width: 220px; height: 220px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(180deg, var(--dourado-suave), var(--dourado));
  font-size: 4rem;
  cursor: pointer;
}
.car-shell .voice-state { font-size: 1.3rem; }
.car-exit { position: absolute; top: 20px; left: 20px; }

/* Utility */
.mt-0 { margin-top: 0; }
.center { text-align: center; }
.small { font-size: 0.8rem; color: var(--texto-suave); }

@media (min-width: 600px) {
  .principles-list { grid-template-columns: repeat(4, 1fr); }
}
