/* Ranqia Signals. Cores, fontes e molduras seguem o site da Ranqia (lp/static/css/site.css, tema escuro). */
:root {
  color-scheme: dark;
  --bg: #050607;
  --bg-2: #0a0c0e;
  --surface: rgba(255, 255, 255, .025);
  --ink: #edebe5;
  --muted: #9c9fa3;
  --faint: #92979d;
  --line: rgba(226, 232, 238, .1);
  --line-2: rgba(226, 232, 238, .23);
  --acc: #8fd0ea;
  --acc-ink: #b4e1f3;
  --acc-soft: rgba(143, 208, 234, .12);
  --warm: #e8956f;
  --dot: rgba(226, 232, 238, .07);
  --tick: rgba(237, 235, 229, .75);

  --sans: "IBM Plex Sans", "Plex Sans Fallback", "Plex Sans Fallback Android", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "Plex Mono Fallback", ui-monospace, monospace;

  --gut: max(2.4vw, 16px);
  --max: 1280px;
  --edge: max(var(--gut), calc((100vw - var(--max)) / 2 + var(--gut)));
  --measure: 68ch;

  /* Cantoneiras das figuras, iguais às do site da Ranqia. */
  --frame:
    linear-gradient(var(--tick), var(--tick)) left top / 11px 1px no-repeat,
    linear-gradient(var(--tick), var(--tick)) left top / 1px 11px no-repeat,
    linear-gradient(var(--tick), var(--tick)) right top / 11px 1px no-repeat,
    linear-gradient(var(--tick), var(--tick)) right top / 1px 11px no-repeat,
    linear-gradient(var(--tick), var(--tick)) left bottom / 11px 1px no-repeat,
    linear-gradient(var(--tick), var(--tick)) left bottom / 1px 11px no-repeat,
    linear-gradient(var(--tick), var(--tick)) right bottom / 11px 1px no-repeat,
    linear-gradient(var(--tick), var(--tick)) right bottom / 1px 11px no-repeat;
  --dots: radial-gradient(var(--dot) 1px, transparent 1.4px) 0 0 / 20px 20px;
}

*, *::before, *::after { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 72px; -webkit-tap-highlight-color: transparent; }
a, button { touch-action: manipulation; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { text-wrap: balance; font-weight: 400; }
p, li, dd { text-wrap: pretty; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }

.skip { position: absolute; left: var(--edge); top: -60px; z-index: 50; padding: 10px 14px; background: var(--ink); color: var(--bg); font: 500 14px var(--sans); }
.skip:focus { top: 10px; }

/* Rótulos em mono, como no site da Ranqia. Só onde dizem algo: data, série, fonte do gráfico, ficha. */
.meta, .chart-source, .sheet h2, .sheet dt, .archive time, .draft-tag, .change-legend, .top-nav, .foot {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--faint);
}

/* botões */
.btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px;
  border: 1px solid var(--line-2); color: var(--ink); text-decoration: none;
  font: 500 15px/1 var(--sans);
  transition: background-color .2s, border-color .2s, color .2s, transform .1s;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--acc); border-color: var(--acc); }

/* topo */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: stretch; justify-content: space-between; min-height: 52px;
  padding-left: max(var(--edge), env(safe-area-inset-left));
  padding-right: env(safe-area-inset-right);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; }
.logo { height: 18px; width: auto; }
.brand-name { padding-left: 14px; border-left: 1px solid var(--line-2); font: 500 16px/1 var(--sans); letter-spacing: -.01em; }
.top-nav { display: flex; align-items: stretch; }
.top-nav a { display: flex; align-items: center; padding: 0 16px; border-left: 1px solid var(--line); color: var(--muted); text-decoration: none; text-transform: uppercase; letter-spacing: .12em; font-weight: 500; font-size: 12px; transition: color .2s, background-color .2s; }
.top-nav a:hover { color: var(--ink); }
.top-nav .top-cta { background: var(--ink); color: var(--bg); padding: 0 calc(var(--edge) - var(--gut) + 18px) 0 18px; }
.top-nav .top-cta:hover { background: var(--acc); color: var(--bg); }

/* capa e cabeçalho do estudo: texto à esquerda, ranking à direita */
.hero, .study-head {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
}
/* No desktop, a capa e o topo do estudo ocupam a tela inteira e cabem nela: nada cortado embaixo, nada do bloco seguinte aparecendo. */
@media (min-width: 961px) {
  .hero, .study-head { min-height: calc(100svh - 53px); }
  .study-head-text { justify-content: center; }
}
/* Em telas baixas (740px de altura ou menos), o resumo do estudo sai da capa para o botão caber. O ranking ao lado já mostra o achado. */
@media (min-width: 961px) and (max-height: 740px) {
  .hero-study-summary { display: none; }
}
.hero-text, .study-head-text {
  padding: clamp(32px, min(6vw, 7vh), 88px) var(--gut) clamp(28px, min(4vw, 5vh), 56px) var(--edge);
  display: flex; flex-direction: column; gap: clamp(14px, 2.4vh, 22px);
}
.hero-figure, .study-head-figure {
  border-left: 1px solid var(--line);
  background: var(--dots);
  padding: clamp(32px, 4vw, 56px) var(--edge) clamp(32px, 4vw, 56px) clamp(24px, 3vw, 48px);
  display: flex; align-items: center;
}
.hero-figure > *, .study-head-figure > * { width: 100%; }

.hero h1 { margin: 0; font-size: clamp(34px, min(4.2vw, 6vh), 58px); line-height: 1.04; letter-spacing: -.035em; max-width: 18ch; }
.study-head h1 { margin: 0; font-size: clamp(32px, min(3.6vw, 6vh), 52px); line-height: 1.06; letter-spacing: -.035em; }
.lead { margin: 0; color: var(--muted); font-size: clamp(17px, 1.4vw, 20px); line-height: 1.5; max-width: 52ch; }
.meta { margin: 0; }
.empty { color: var(--muted); }

.hero-study { margin-top: auto; padding-top: clamp(18px, 3vh, 28px); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.hero-study h2 { margin: 0; font-size: clamp(22px, 2vw, 28px); line-height: 1.2; letter-spacing: -.02em; }
.hero-study h2 a { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .3s; }
.hero-study h2 a:hover { background-size: 100% 1px; }
.hero-study p { margin: 0; color: var(--muted); max-width: 60ch; }

.draft-tag { display: inline-block; align-self: flex-start; margin: 0; padding: 5px 10px; border: 1px dashed var(--acc); color: var(--acc); text-transform: uppercase; letter-spacing: .1em; font-size: 12px; }

/* gráficos */
.chart { margin: 0; padding: 22px 24px 20px; background: var(--frame), var(--surface); border: 1px solid var(--line); }
.prose .chart { margin: 36px 0; }
.chart-title { margin: 0 0 18px; font-weight: 500; font-size: 16px; line-height: 1.35; color: var(--ink); }
.chart-source { margin: 16px 0 0; line-height: 1.5; }

.bars-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.bar {
  display: grid; grid-template-columns: minmax(110px, 34%) 1fr 4.5em; align-items: center; gap: 14px;
  padding: 6px 0; font-size: 15px; transition: opacity .2s;
}
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; background: var(--line); }
.bar-fill { display: block; height: 100%; width: calc(var(--w) * 100%); background: var(--acc); transform-origin: left; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.bar:first-child .bar-fill { background: var(--acc-ink); }
.bars-list:hover .bar { opacity: .45; }
.bars-list:hover .bar:hover { opacity: 1; }

/* Na capa e no topo do estudo, o ranking cresce uma vez, barra por barra. */
.bars-intro .bar-fill { animation: grow .9s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(.25s + var(--i) * 70ms); }
.bars-intro .bar-value { animation: show .5s ease-out both; animation-delay: calc(.55s + var(--i) * 70ms); }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes show { from { opacity: 0; } }

.change-legend { display: flex; align-items: center; gap: 8px; margin: -6px 0 16px; }
.change-legend .dot-to { margin-left: 12px; }
.change-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.change-row { display: grid; grid-template-columns: minmax(110px, 26%) 1fr auto 5.5em; align-items: center; gap: 14px; padding: 7px 0; font-size: 15px; border-bottom: 1px solid var(--line); }
.change-row:last-child { border-bottom: 0; }
.change-track { position: relative; height: 14px; background: linear-gradient(var(--line), var(--line)) 0 50% / 100% 1px no-repeat; }
.change-line { position: absolute; top: 50%; height: 2px; margin-top: -1px; left: calc(min(var(--a), var(--b)) * 100%); width: calc(max(var(--a) - var(--b), var(--b) - var(--a)) * 100%); background: var(--acc); }
.change-row.down .change-line { background: var(--warm); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot-from { border: 1.5px solid var(--muted); background: var(--bg); }
.dot-to { background: var(--acc); }
.change-row.down .dot-to { background: var(--warm); }
.change-track .dot { position: absolute; top: 50%; margin: -5px 0 0 -5px; }
.change-track .dot-from { left: calc(var(--a) * 100%); }
.change-track .dot-to { left: calc(var(--b) * 100%); }
.change-values { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.change-values strong { color: var(--ink); font-weight: 500; }
.change-sep { color: var(--faint); }
.change-delta { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; color: var(--acc); white-space: nowrap; }
.change-row.down .change-delta { color: var(--warm); }

/* números em destaque, na largura condensada da Plex */
.figures { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.figure { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 8px; padding: 28px var(--gut) 30px; border-right: 1px solid var(--line); }
.figure:last-child { border-right: 0; }
.figure dd { margin: 0; font-size: clamp(44px, 5vw, 72px); line-height: .95; font-stretch: 80%; font-weight: 500; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.figure dt { color: var(--muted); font-size: 15px; line-height: 1.4; max-width: 24ch; }
.study-figures { border-bottom: 1px solid var(--line); padding: 0 calc(var(--edge) - var(--gut)); }
.hero-figure .figures { background: var(--frame), var(--surface); border: 1px solid var(--line); }

/* corpo do estudo: ficha técnica à esquerda, texto à direita */
.study-body { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: clamp(32px, 5vw, 80px); padding: clamp(40px, 5vw, 72px) var(--edge); }
.sheet { position: sticky; top: 76px; align-self: start; }
.sheet h2 { margin: 0 0 12px; text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 500; }
.sheet dl { margin: 0; border-top: 1px solid var(--line); }
.sheet dt { padding-top: 12px; text-transform: uppercase; letter-spacing: .1em; font-size: 12px; }
.sheet dd { margin: 4px 0 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.5; color: var(--muted); }

.prose { max-width: var(--measure); }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; color: #d9d7d1; }
.prose li { margin-bottom: .4em; }
.prose h2 { margin: 2.4em 0 .7em; font-size: clamp(24px, 2.2vw, 30px); line-height: 1.2; letter-spacing: -.02em; }
.prose h3 { margin: 2em 0 .6em; font-size: 20px; font-weight: 500; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--acc-ink); }
.prose code { font: 14px var(--mono); color: var(--ink); background: var(--surface); border: 1px solid var(--line); padding: 1px 5px; }
.prose table { width: 100%; border-collapse: collapse; margin: 28px 0 32px; font-size: 15px; font-variant-numeric: tabular-nums; }
.prose th { text-align: left; font: 500 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 0 12px 10px 0; border-bottom: 1px solid var(--line-2); }
.prose td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.prose td:first-child { color: var(--ink); }

.callout { margin: 36px 0 !important; padding: 4px 0 4px 22px; border-left: 2px solid var(--acc); font-size: clamp(21px, 1.9vw, 26px); line-height: 1.35; letter-spacing: -.015em; color: var(--ink) !important; }
.quote { margin: 36px 0; }
.quote blockquote { margin: 0; font-size: 21px; line-height: 1.45; color: var(--ink); }
.quote figcaption { margin-top: 10px; font: 12px var(--mono); color: var(--faint); }
.note { margin: 28px 0; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); font-size: 15px; }
.note p { color: var(--muted) !important; }
.note p:last-child { margin-bottom: 0; }

.cta { margin: 0 var(--edge) clamp(48px, 6vw, 96px); padding: clamp(28px, 4vw, 48px); background: var(--frame), var(--dots), var(--bg-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.cta h2 { margin: 0; font-size: clamp(24px, 2.4vw, 34px); line-height: 1.15; letter-spacing: -.025em; max-width: 26ch; }
.cta p { margin: 0 0 6px; color: var(--muted); max-width: 56ch; }

/* estudos anteriores */
.archive { padding: clamp(40px, 5vw, 72px) var(--edge); }
.archive h2 { margin: 0 0 20px; font-size: 24px; letter-spacing: -.02em; }
.archive ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.archive li { border-bottom: 1px solid var(--line); }
.archive a { display: grid; grid-template-columns: 140px minmax(0, 1fr); column-gap: 24px; row-gap: 6px; padding: 20px 0; text-decoration: none; transition: background-color .2s; }
.archive a:hover { background: var(--surface); }
.archive time { grid-row: span 3; padding-top: 4px; }
.archive-title { font-size: 19px; font-weight: 500; letter-spacing: -.01em; }
.archive-desc { color: var(--muted); font-size: 15px; max-width: 80ch; }

/* páginas de texto (Sobre, 404) */
.text-page { padding: clamp(40px, 6vw, 88px) var(--edge) clamp(48px, 6vw, 96px); }
.text-head { display: flex; flex-direction: column; gap: 20px; margin-bottom: clamp(32px, 4vw, 56px); max-width: 860px; }
.text-head h1 { margin: 0; font-size: clamp(34px, 4.2vw, 58px); line-height: 1.04; letter-spacing: -.035em; }

/* rodapé */
.foot { display: flex; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; padding: 28px var(--edge) 40px; border-top: 1px solid var(--line); }
.foot p { margin: 0; }
.foot ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 20px; flex-wrap: wrap; }
.foot a { text-decoration: none; color: var(--muted); }
.foot a:hover { color: var(--ink); }

@media (max-width: 960px) {
  .hero, .study-head { grid-template-columns: 1fr; }
  .hero-text, .study-head-text { padding-right: var(--edge); }
  .hero-figure, .study-head-figure { border-left: 0; border-top: 1px solid var(--line); padding: 28px var(--edge); }
  .study-body { grid-template-columns: 1fr; }
  .sheet { position: static; }
  .figure { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .top-nav a:not(.top-cta) { padding: 0 12px; }
  .top-nav .top-cta { display: none; }
  .hero-study .btn, .study-head-text .btn, .cta .btn { align-self: stretch; justify-content: center; }
  .brand-name { padding-left: 10px; }
  .chart { padding: 18px 16px; }
  .bar { grid-template-columns: 1fr auto; row-gap: 6px; padding: 5px 0; }
  .bar-name { grid-column: 1; grid-row: 1; }
  .bar-value { grid-column: 2; grid-row: 1; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; height: 6px; }
  .change-row { grid-template-columns: 1fr auto; row-gap: 6px; }
  .change-name { grid-column: 1 / -1; }
  .change-track { grid-column: 1 / -1; }
  .archive a { grid-template-columns: 1fr; }
  .archive time { grid-row: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Modo ?og: a página vira a imagem de compartilhamento de 1200x630 (scripts/og.sh). */
.og body { width: 1200px; height: 630px; overflow: hidden; }
.og .skip, .og .top-nav, .og .hero-study, .og .study-figures, .og .study-body, .og .cta, .og .archive, .og .foot, .og .draft-tag, .og .study-head-text .btn { display: none; }
.og .top { position: static; padding-left: 56px; }
.og .hero, .og .study-head { height: 578px; grid-template-columns: 1.1fr 1fr; border-bottom: 0; }
.og .hero-text, .og .study-head-text { padding: 48px 40px 48px 56px; justify-content: center; }
.og .hero h1, .og .study-head h1 { font-size: 46px; max-width: none; }
.og .lead { font-size: 19px; }
.og .hero-figure, .og .study-head-figure { padding: 40px 56px 40px 40px; }
.og .bar { padding: 3px 0; font-size: 14px; }
.og .bar:nth-child(n+8) { display: none; }
.og .chart-source { display: none; }
.og .bars-intro .bar-fill, .og .bars-intro .bar-value { animation: none; }
.hero:not(:has(.hero-figure)) { grid-template-columns: 1fr; }
.hero:not(:has(.hero-figure)) h1 { max-width: 20ch; }
.og .empty { display: none; }
.og .hero:not(:has(.hero-figure)) { background: var(--dots); }
.og .hero:not(:has(.hero-figure)) h1 { font-size: 64px; }
