/* ============ Transparencer — porcelana & vidro ============ */
:root {
  --bg: #f6f4ef;
  --ink: #211d18;
  --ink-soft: #6d675e;
  --ink-faint: #8a8175;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.85);
  --shadow: 0 1px 2px rgba(40, 32, 20, 0.04), 0 8px 24px rgba(40, 32, 20, 0.07);
  --shadow-lift: 0 2px 4px rgba(40, 32, 20, 0.05), 0 18px 44px rgba(40, 32, 20, 0.13);
  --radius: 22px;

  /* escala semântica do score */
  --s-ok: #7d9b6f;
  --s-mid: #c9971f;
  --s-warn: #cf7a3c;
  --s-bad: #c05b4a;
  --s-max: #a83a3a;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Instrument Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; cursor: pointer; }

/* ---------- fundo: auras + grão ---------- */
.aura { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.aura-blob {
  position: absolute; border-radius: 50%; opacity: 0.85;
  animation: drift 26s ease-in-out infinite alternate;
  will-change: transform;
}
.aura-1 { width: 72vw; height: 72vw; top: -24vw; left: -20vw; background: radial-gradient(circle, rgba(232,217,184,0.9) 0%, rgba(232,217,184,0.4) 45%, transparent 70%); }
.aura-2 { width: 64vw; height: 64vw; top: 6vh; right: -24vw; background: radial-gradient(circle, rgba(213,221,201,0.9) 0%, rgba(213,221,201,0.4) 45%, transparent 70%); animation-delay: -9s; }
.aura-3 { width: 58vw; height: 58vw; bottom: -26vw; left: 14vw; background: radial-gradient(circle, rgba(230,211,203,0.9) 0%, rgba(230,211,203,0.4) 45%, transparent 70%); animation-delay: -17s; }
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(5vw, 4vh, 0) scale(1.14); }
}
.grain {
  position: absolute; inset: 0; opacity: 0.5; mix-blend-mode: multiply; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.035 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- vidro ---------- */
.glass, .glass-strong {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}
.glass-strong { background: var(--glass-strong); }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 14px; z-index: 50;
  margin: 14px auto 0; max-width: 1180px; width: calc(100% - 32px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; border-radius: 999px;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark { font-size: 1.25rem; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.18rem; letter-spacing: 0.01em; }
.tabs { display: flex; gap: 4px; background: rgba(33, 29, 24, 0.05); border-radius: 999px; padding: 4px; }
.tab {
  border: 0; background: transparent; padding: 7px 15px; border-radius: 999px;
  color: var(--ink-soft); font-weight: 600; font-size: 0.87rem; white-space: nowrap;
  transition: color 0.25s, background 0.25s, box-shadow 0.25s;
}
.tab:hover { color: var(--ink); }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(40, 32, 20, 0.1); }

/* ---------- hero ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 0 16px 60px; }
.hero { text-align: center; padding: 72px 8px 44px; }
.hero-kicker {
  text-transform: uppercase; letter-spacing: 0.22em; font-size: 0.72rem;
  font-weight: 700; color: var(--ink-faint);
}
.hero-title {
  font-family: var(--font-display); font-weight: 500; line-height: 1.06;
  font-size: clamp(2.4rem, 6vw, 4.6rem); margin: 18px 0 20px; letter-spacing: -0.015em;
}
.hero-title span { display: block; }
.hero-title em {
  font-style: italic; font-weight: 600;
  background: linear-gradient(100deg, var(--s-warn), var(--s-max));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { max-width: 620px; margin: 0 auto; color: var(--ink-soft); font-size: 1.04rem; }
.hero-stats { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 38px; }
.stat { padding: 16px 26px; min-width: 150px; }
.stat-num {
  display: block; font-family: var(--font-display); font-size: 1.75rem; font-weight: 600;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.stat-label { font-size: 0.76rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600; }

/* ---------- reveals ---------- */
.reveal { opacity: 0; transform: translateY(18px); animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
.reveal.d1 { animation-delay: 0.08s; } .reveal.d2 { animation-delay: 0.18s; }
.reveal.d3 { animation-delay: 0.3s; } .reveal.d4 { animation-delay: 0.42s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- seções ---------- */
.section-title {
  font-family: var(--font-display); font-weight: 500; font-size: clamp(1.5rem, 3vw, 2.1rem);
  margin: 46px 0 8px; letter-spacing: -0.01em;
}
.section-title.sm { font-size: 1.25rem; margin-top: 34px; }
.section-sub { color: var(--ink-soft); margin-bottom: 20px; max-width: 660px; font-size: 0.95rem; }

/* ---------- pódio ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 16px; align-items: end; margin-top: 22px; }
.podium-card {
  position: relative; text-align: center; padding: 26px 16px 20px; cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.35s;
  opacity: 0; animation: podiumRise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.podium-card:nth-child(1) { animation-delay: 0.25s; }
.podium-card:nth-child(2) { animation-delay: 0.1s; }
.podium-card:nth-child(3) { animation-delay: 0.4s; }
@keyframes podiumRise { from { opacity: 0; transform: translateY(46px); } to { opacity: 1; transform: none; } }
.podium-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lift); }
.podium-card.p1 { padding-top: 34px; padding-bottom: 30px; }
.podium-medal { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 1.9rem; filter: drop-shadow(0 4px 8px rgba(40, 32, 20, 0.25)); }
.podium-foto {
  width: 76px; height: 76px; border-radius: 50%; object-fit: cover; object-position: top;
  border: 3px solid #fff; box-shadow: 0 6px 16px rgba(40, 32, 20, 0.18); background: #e9e4da;
}
.p1 .podium-foto { width: 96px; height: 96px; }
.podium-nome { font-weight: 700; margin-top: 10px; font-size: 1.02rem; }
.podium-meta { color: var(--ink-soft); font-size: 0.8rem; }
.podium-ie { font-family: var(--font-display); font-size: 2rem; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ---------- filtros ---------- */
.filterbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 12px 16px; margin: 30px 0 22px; border-radius: 18px;
}
.filterbar input, .filterbar select {
  font: inherit; font-size: 0.9rem; color: var(--ink);
  background: rgba(255, 255, 255, 0.7); border: 1px solid rgba(33, 29, 24, 0.1);
  border-radius: 12px; padding: 9px 13px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.filterbar input { flex: 1 1 210px; }
.filterbar input:focus, .filterbar select:focus { border-color: var(--s-mid); box-shadow: 0 0 0 3px rgba(201, 151, 31, 0.15); }
.filter-count { margin-left: auto; color: var(--ink-faint); font-size: 0.82rem; font-weight: 600; }

/* ---------- cards de deputados ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.dep-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 16px 18px; cursor: pointer; border-radius: var(--radius);
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.3s;
  opacity: 0; animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.dep-card:hover { transform: translateY(-4px) scale(1.012); box-shadow: var(--shadow-lift); }
.dep-rank {
  font-family: var(--font-display); font-size: 0.95rem; font-weight: 600; color: var(--ink-faint);
  min-width: 2.2em; text-align: right; font-variant-numeric: tabular-nums;
}
.dep-foto { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; object-position: top; border: 2px solid #fff; box-shadow: 0 3px 10px rgba(40, 32, 20, 0.14); background: #e9e4da; }
.dep-info { min-width: 0; }
.dep-nome { font-weight: 700; font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dep-meta { color: var(--ink-soft); font-size: 0.78rem; }
.dep-badges { font-size: 0.86rem; letter-spacing: 0.05em; margin-top: 2px; }
.dep-score { text-align: right; }
.dep-ie { font-family: var(--font-display); font-size: 1.55rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.dep-nivel { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.dep-bar { grid-column: 1 / -1; height: 5px; border-radius: 99px; background: rgba(33, 29, 24, 0.07); overflow: hidden; }
.dep-bar-fill { height: 100%; border-radius: 99px; width: 0; transition: width 1.1s cubic-bezier(0.2, 0.7, 0.2, 1); }

.load-more-wrap { text-align: center; margin: 26px 0 8px; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(33, 29, 24, 0.12);
  padding: 11px 30px; border-radius: 999px; font-weight: 700; color: var(--ink);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  backdrop-filter: blur(10px);
}
.btn-ghost:hover { background: #fff; transform: translateY(-2px); box-shadow: var(--shadow); }

/* ---------- partidos ---------- */
.party-list { display: flex; flex-direction: column; gap: 14px; }
.party-card {
  display: grid; grid-template-columns: auto auto 1fr auto; gap: 18px; align-items: center;
  padding: 18px 22px; border-radius: var(--radius);
  opacity: 0; animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  transition: transform 0.3s, box-shadow 0.3s;
}
.party-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.party-rank { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; color: var(--ink-faint); min-width: 2em; text-align: right; }
.party-sigla {
  width: 62px; height: 62px; border-radius: 18px; display: grid; place-items: center;
  font-weight: 800; font-size: 0.95rem; letter-spacing: 0.02em; color: #fff;
  background: linear-gradient(135deg, #8d8577, #6d675e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 12px rgba(40, 32, 20, 0.18);
}
.party-info { min-width: 0; }
.party-nome { font-weight: 700; font-size: 1.05rem; }
.party-meta { color: var(--ink-soft); font-size: 0.82rem; }
.party-flag { font-size: 0.78rem; color: var(--s-bad); font-weight: 700; margin-top: 3px; }
.party-score { text-align: right; }
.party-iep { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.party-faces { display: flex; margin-top: 6px; justify-content: flex-end; }
.party-faces img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; object-position: top; border: 2px solid #fff; margin-left: -8px; background: #e9e4da; }

/* ---------- metodologia ---------- */
.method-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-top: 18px; }
.method-card { padding: 22px; border-radius: var(--radius); opacity: 0; animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
.method-icon { font-size: 1.6rem; }
.method-card h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; margin: 8px 0 4px; }
.method-max { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--s-warn); }
.method-card p { color: var(--ink-soft); font-size: 0.9rem; margin-top: 6px; }
.method-note { margin-top: 22px; padding: 26px; }
.method-note h3 { font-family: var(--font-display); margin-bottom: 8px; }
.method-note p { color: var(--ink-soft); max-width: 760px; }

/* ---------- qualidade dos dados ---------- */
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.check {
  display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; border-radius: 18px;
  opacity: 0; animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.check-icon { font-size: 1.1rem; line-height: 1.4; }
.check-name { font-weight: 700; font-size: 0.92rem; }
.check-detail { color: var(--ink-soft); font-size: 0.84rem; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgba(40, 34, 26, 0.35); backdrop-filter: blur(8px);
  animation: fadeIn 0.25s ease forwards; padding: 18px;
}
.modal-backdrop[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: min(760px, 100%); max-height: 88vh; overflow-y: auto; padding: 30px;
  animation: pop 0.45s cubic-bezier(0.2, 0.9, 0.25, 1.1) forwards;
}
@keyframes pop { from { opacity: 0; transform: translateY(26px) scale(0.96); } to { opacity: 1; transform: none; } }
.modal-close {
  position: sticky; top: 0; float: right; z-index: 2;
  border: 0; background: rgba(33, 29, 24, 0.07); width: 34px; height: 34px; border-radius: 50%;
  font-size: 0.95rem; color: var(--ink-soft); transition: background 0.2s, transform 0.2s;
}
.modal-close:hover { background: rgba(33, 29, 24, 0.14); transform: rotate(90deg); }

.m-head { display: flex; gap: 18px; align-items: center; margin-bottom: 6px; }
.m-foto { width: 84px; height: 84px; border-radius: 24px; object-fit: cover; object-position: top; border: 3px solid #fff; box-shadow: 0 8px 20px rgba(40, 32, 20, 0.2); background: #e9e4da; }
.m-nome { font-family: var(--font-display); font-size: 1.7rem; font-weight: 600; line-height: 1.1; }
.m-meta { color: var(--ink-soft); font-size: 0.9rem; }
.m-scorebig { margin-left: auto; text-align: right; }
.m-ie { font-family: var(--font-display); font-size: 3rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.m-nivel { font-weight: 800; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.1em; }
.m-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.m-badge {
  display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.75); border: 1px solid rgba(33, 29, 24, 0.08);
  font-size: 0.8rem; font-weight: 700; cursor: help;
}
.m-badge.positivo { border-color: rgba(125, 155, 111, 0.5); color: var(--s-ok); }
.m-section { margin-top: 22px; }
.m-section h4 { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; margin-bottom: 10px; }
.comp-row { display: grid; grid-template-columns: 190px 1fr auto; gap: 12px; align-items: center; margin-bottom: 9px; font-size: 0.87rem; }
.comp-name { font-weight: 600; }
.comp-name small { display: block; color: var(--ink-faint); font-weight: 500; font-size: 0.74rem; }
.comp-track { height: 8px; border-radius: 99px; background: rgba(33, 29, 24, 0.07); overflow: hidden; }
.comp-fill { height: 100%; border-radius: 99px; width: 0; transition: width 1s cubic-bezier(0.2, 0.7, 0.2, 1); }
.comp-pts { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 4.4em; text-align: right; }
.spark { width: 100%; height: 92px; }
.spark-caption { color: var(--ink-faint); font-size: 0.76rem; margin-top: 4px; }
.top-list { display: flex; flex-direction: column; gap: 7px; }
.top-item { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; font-size: 0.86rem; align-items: baseline; }
.top-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-item-pct { color: var(--ink-faint); font-weight: 600; min-width: 3.4em; text-align: right; }
.top-item-val { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 7.5em; text-align: right; }
.m-foot { margin-top: 22px; font-size: 0.8rem; color: var(--ink-faint); }

/* ---------- notas individuais ---------- */
.notas-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.notas-controls input, .notas-controls select {
  font: inherit; font-size: 0.85rem; color: var(--ink);
  background: rgba(255, 255, 255, 0.7); border: 1px solid rgba(33, 29, 24, 0.1);
  border-radius: 10px; padding: 7px 12px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.notas-controls input { flex: 1 1 220px; }
.notas-controls input:focus, .notas-controls select:focus { border-color: var(--s-mid); box-shadow: 0 0 0 3px rgba(201, 151, 31, 0.15); }
.notas-count { margin-left: auto; color: var(--ink-faint); font-size: 0.78rem; font-weight: 600; white-space: nowrap; }

.notas-lista {
  display: flex; flex-direction: column; gap: 2px; max-height: 420px; overflow-y: auto;
  border-radius: 14px; background: rgba(255, 255, 255, 0.35); padding: 4px;
}
.nota-item {
  display: grid; grid-template-columns: 5.2em 1fr auto auto 1.6em;
  grid-template-areas: "data forn tipo val link";
  gap: 10px; align-items: center; padding: 7px 10px; border-radius: 8px; font-size: 0.82rem;
}
.nota-item:hover { background: rgba(255, 255, 255, 0.65); }
.nota-data { grid-area: data; color: var(--ink-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nota-forn { grid-area: forn; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nota-tipo { grid-area: tipo; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.nota-val { grid-area: val; font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; white-space: nowrap; }
.nota-link { grid-area: link; text-align: center; color: var(--s-mid); font-weight: 700; text-decoration: none; }
.nota-link:hover { color: var(--s-bad); }

/* ---------- footer ---------- */
.footer { text-align: center; color: var(--ink-soft); padding: 26px 16px 44px; font-size: 0.86rem; }
.footer-fine { color: var(--ink-faint); font-size: 0.76rem; margin-top: 4px; }

/* ---------- responsivo ---------- */
@media (max-width: 780px) {
  .topbar { flex-direction: column; gap: 10px; border-radius: 26px; }
  .tabs { width: 100%; overflow-x: auto; }
  .podium { grid-template-columns: 1fr; }
  .podium-card { animation-delay: 0.1s !important; }
  .comp-row { grid-template-columns: 1fr; gap: 4px; }
  .comp-pts { text-align: left; }
  .m-head { flex-wrap: wrap; }
  .m-scorebig { margin-left: 0; text-align: left; }
  .nota-item {
    grid-template-columns: 1fr auto;
    grid-template-areas: "forn val" "data tipo" "link link";
    row-gap: 3px;
  }
  .nota-tipo { max-width: none; text-align: right; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
  .reveal, .podium-card, .dep-card, .party-card, .method-card, .check { opacity: 1; transform: none; }
}
