/* =========================================================
   ESCALA DE VALORES — Sistema de Design
   Paleta: ink (fundo/leitura escura), brass (destaque/agulha do
   medidor), paper (fundo claro), teal (alta) e rose (baixa).
   Tipografia: Fraunces (display), IBM Plex Mono (dados/ticker),
   Inter (texto corrido).
   ========================================================= */

:root {
  --ink: #10242B;
  --ink-soft: #1B3540;
  --brass: #B8934A;
  --brass-light: #D8B876;
  --paper: #E9E7DF;
  --paper-2: #F4F2EC;
  --teal: #1E5C56;
  --rose: #A63D40;
  --line: #C7C2B4;
  --text: #1B2320;
  --text-muted: #5B6360;
  --white: #FFFFFF;

  --font-display: 'Fraunces', Georgia, serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --font-body: 'Inter', -apple-system, sans-serif;

  --radius: 6px;
  --container: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper-2);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0 0 .5em;
  line-height: 1.1;
  font-weight: 600;
}
h1 { font-size: clamp(2.2rem, 4vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }

/* ---------- Fita de cotações (ticker ribbon) — assinatura visual ---------- */
.ticker-ribbon {
  background: var(--ink);
  color: var(--brass-light);
  font-family: var(--font-mono);
  font-size: .82rem;
  letter-spacing: .02em;
  overflow: hidden;
  white-space: nowrap;
  border-bottom: 1px solid #2A4750;
}
.ticker-track {
  display: inline-flex;
  gap: 40px;
  padding: 8px 24px;
  animation: ticker-scroll 38s linear infinite;
}
.ticker-ribbon:hover .ticker-track { animation-play-state: paused; }
.ticker-item { display: inline-flex; gap: 8px; align-items: baseline; }
.ticker-item .chg-up { color: #6FBFA0; }
.ticker-item .chg-down { color: #E08A8A; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; overflow-x: auto; }
}

/* ---------- Cabeçalho / navegação ---------- */
.site-header {
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.nav-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; gap: 24px;
}
.brand img { height: 34px; }
.nav-links {
  display: flex; gap: 28px; list-style: none; margin: 0; padding: 0;
  font-family: var(--font-mono); font-size: .82rem; letter-spacing: .03em; text-transform: uppercase;
}
.nav-links a { padding: 6px 2px; border-bottom: 2px solid transparent; }
.nav-links a:hover, .nav-links a[aria-current="page"] { border-bottom-color: var(--brass); }
.nav-toggle { display: none; }

@media (max-width: 860px) {
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--paper-2); border-bottom: 1px solid var(--line);
    flex-direction: column; gap: 0; padding: 8px 24px 16px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: 10px 0; }
  .nav-toggle {
    display: inline-flex; background: none; border: 1px solid var(--line);
    border-radius: var(--radius); padding: 8px 12px; font-family: var(--font-mono);
    cursor: pointer;
  }
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--radius);
  font-family: var(--font-mono); font-size: .85rem; letter-spacing: .02em;
  border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--ink); color: var(--paper-2); }
.btn-primary:hover { background: var(--ink-soft); }
.btn-outline { border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: var(--paper-2); }

/* ---------- Hero ---------- */
.hero {
  padding: 72px 0 56px;
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 48px; align-items: center;
}
.hero .eyebrow {
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .08em;
  color: var(--brass); font-size: .8rem; margin-bottom: 12px; display: block;
}
.hero-actions { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }
.gauge-card {
  background: var(--ink); border-radius: 12px; padding: 28px;
  color: var(--paper-2);
}
.gauge-card .label { font-family: var(--font-mono); font-size: .75rem; color: var(--brass-light); text-transform: uppercase; letter-spacing: .06em; }
.gauge-card .big { font-family: var(--font-mono); font-size: 2.4rem; margin: 6px 0; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 40px 0; }
}

/* ---------- Cards / grids ---------- */
.section { padding: 56px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media (max-width: 860px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px;
}
.card .tag {
  font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--teal);
}

/* ---------- Tabela de cotações ---------- */
table.quotes { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: .9rem; }
table.quotes th {
  text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); border-bottom: 1px solid var(--line); padding: 10px 12px;
}
table.quotes td { padding: 12px; border-bottom: 1px solid #EDEBE3; }
table.quotes tr:hover td { background: var(--paper); }
.chg-up { color: var(--teal); font-weight: 600; }
.chg-down { color: var(--rose); font-weight: 600; }

.search-bar { display: flex; gap: 10px; margin-bottom: 20px; }
.search-bar input {
  flex: 1; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: .9rem;
}

/* ---------- Trilha de educação ---------- */
.trail { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.trail .step { border-left: 3px solid var(--brass); padding-left: 18px; }
.trail .step .level { font-family: var(--font-mono); font-size: .72rem; color: var(--brass); text-transform: uppercase; }
@media (max-width: 860px) { .trail { grid-template-columns: 1fr; } }

/* ---------- Calculadoras ---------- */
.tool-panel {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; margin-bottom: 32px;
}
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 18px; }
.field label { display: block; font-family: var(--font-mono); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: .95rem;
}
.result-box {
  background: var(--paper); border-radius: var(--radius); padding: 20px; margin-top: 16px;
  font-family: var(--font-mono);
}
.result-box .amount { font-size: 1.8rem; color: var(--ink); }

/* ---------- Rodapé ---------- */
.site-footer {
  background: var(--ink); color: var(--paper-2); padding: 48px 0 24px; margin-top: 64px;
  border-top: 3px solid var(--brass);
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.site-footer a:hover { color: var(--brass-light); }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 8px; }
.footer-bottom {
  margin-top: 36px; padding-top: 20px; border-top: 1px solid #2A4750;
  font-family: var(--font-mono); font-size: .78rem; color: #9FB0AC;
}
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Utilidades ---------- */
.disclaimer {
  background: var(--paper); border-left: 3px solid var(--brass); padding: 14px 18px;
  font-size: .88rem; color: var(--text-muted); border-radius: 0 var(--radius) var(--radius) 0;
}
.divider-ticks {
  height: 14px; margin: 8px 0 32px;
  background-image: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 14px);
  background-position: bottom;
  background-size: 100% 1px;
  background-repeat: no-repeat;
  border-bottom: 1px solid var(--line);
}

/* =========================================================
   Animações — entrada da hero, mini-gráfico e brilho do card
   ========================================================= */

/* Entrada suave dos elementos (fade + subida) */
@keyframes ev-reveal { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.reveal { opacity: 0; animation: ev-reveal .7s cubic-bezier(.2,.7,.2,1) forwards; }
.reveal-1 { animation-delay: .05s; }
.reveal-2 { animation-delay: .18s; }
.reveal-3 { animation-delay: .32s; }
.reveal-4 { animation-delay: .46s; }
.reveal-5 { animation-delay: .60s; }

/* Card do Ibovespa: brilho sutil que percorre a superfície */
.gauge-card { position: relative; overflow: hidden; }
.gauge-card::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(216,184,118,.10), transparent);
  transform: skewX(-18deg); pointer-events: none;
  animation: ev-sheen 6.5s ease-in-out 1.4s infinite;
}
@keyframes ev-sheen { 0% { left: -60%; } 24%, 100% { left: 135%; } }

.gauge-card .big { transition: color .3s; }
.gauge-chg { font-size: .85rem; margin: -2px 0 6px; min-height: 1.1em; letter-spacing: .02em; }
.gauge-chg.up   { color: #6FBFA0; }
.gauge-chg.down { color: #E08A8A; }

/* Mini-gráfico (sparkline) que se desenha */
.spark { width: 100%; height: 90px; display: block; margin: 6px 0 12px; }
#spark-line { stroke-dasharray: var(--spark-len, 1); stroke-dashoffset: var(--spark-len, 1); }
#spark-line.draw { animation: ev-draw 1.6s ease forwards; }
@keyframes ev-draw { to { stroke-dashoffset: 0; } }
#spark-area { opacity: 0; }
#spark-area.show { animation: ev-fade 1s ease .8s forwards; }
@keyframes ev-fade { to { opacity: 1; } }
#spark-dot { opacity: 0; }
@keyframes ev-dot { 0%, 100% { r: 3.5px; opacity: 1; } 50% { r: 5.5px; opacity: .5; } }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; animation: none; }
  .gauge-card::after { display: none; }
  #spark-line { stroke-dashoffset: 0 !important; animation: none; }
  #spark-area { opacity: 1; }
}
