/* ================================================================
   CADERNO ABERTO · theme.css (Winter theme)
   PALETA: para mudar o visual, edite apenas os dois blocos abaixo.
   ================================================================ */
:root {
  --paper: 247 244 238;
  --surface: 255 253 248;
  --sunk: 238 233 224;
  --ink: 43 39 35;
  --mute: 117 110 100;
  --line: 222 215 202;
  --brand: 62 110 92;
  --brandsoft: 227 237 230;
  --gold: 191 138 60;
}

.dark {
  --paper: 22 21 19;
  --surface: 30 28 25;
  --sunk: 39 36 32;
  --ink: 232 227 217;
  --mute: 157 150 139;
  --line: 58 54 48;
  --brand: 146 197 170;
  --brandsoft: 37 52 44;
  --gold: 222 176 106;
}

/* largura da página: margem lateral = metade do gap entre colunas */
.wrap {
  margin-inline: auto;
  width: 100%;
  max-width: 1520px;
  padding-inline: 1rem
}

@media (min-width:1536px) {
  .wrap {
    max-width: 1720px
  }
}

@media (min-width:2400px) {
  .wrap {
    max-width: 2100px
  }

  html {
    font-size: 17px
  }
}

/* ---------- base ---------- */
html {
  scroll-behavior: smooth
}

body {
  font-family: 'Karla', system-ui, sans-serif;
  background: rgb(var(--paper));
  color: rgb(var(--ink));
  -webkit-font-smoothing: antialiased
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E")
}

.dark body::after {
  opacity: .07
}

::selection {
  background: rgb(var(--brand)/.25)
}

:focus-visible {
  outline: 2px solid rgb(var(--brand));
  outline-offset: 2px;
  border-radius: 4px
}

.icn {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none
}

.skip {
  position: absolute;
  left: -999px;
  top: .5rem;
  z-index: 200;
  background: rgb(var(--brand));
  color: #fff;
  padding: .5rem 1rem;
  border-radius: 8px
}

.skip:focus {
  left: .5rem
}

/* ---------- componentes ---------- */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  color: rgb(var(--mute));
  transition: background .25s, color .25s
}

.btn-icon:hover {
  background: rgb(var(--sunk));
  color: rgb(var(--ink))
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: rgb(var(--brand));
  color: rgb(var(--surface));
  font-weight: 700;
  font-size: .875rem;
  padding: .65rem 1.2rem;
  border-radius: 10px;
  transition: transform .25s, filter .25s
}

.btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px)
}

.btn-ghost {
  border: 1px solid rgb(var(--line));
  color: rgb(var(--ink));
  background: transparent
}

.btn-ghost:hover {
  border-color: rgb(var(--brand)/.5);
  color: rgb(var(--brand));
  background: transparent
}

.chip {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  padding: .3rem .6rem;
  border-radius: 999px;
  white-space: nowrap
}

.chip-brand {
  background: rgb(var(--brandsoft));
  color: rgb(var(--brand))
}

.chip-gold {
  background: rgb(var(--gold)/.16);
  color: rgb(var(--gold))
}

.chip-ghost {
  border: 1px solid rgb(var(--line));
  color: rgb(var(--mute))
}

.av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgb(var(--brandsoft));
  color: rgb(var(--brand));
  font-weight: 700
}

.av-xs {
  width: 1.5rem;
  height: 1.5rem;
  font-size: .58rem
}

.av-md {
  width: 2.5rem;
  height: 2.5rem;
  font-size: .8rem
}

.av-lg {
  width: 4.5rem;
  height: 4.5rem;
  font-size: 1.3rem;
  font-family: 'Fraunces', serif
}

.inp {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--line));
  border-radius: 10px;
  padding: .6rem .85rem;
  width: 100%;
  font-size: .9rem;
  color: rgb(var(--ink));
  transition: border-color .25s, box-shadow .25s
}

.inp:focus {
  outline: none;
  border-color: rgb(var(--brand));
  box-shadow: 0 0 0 3px rgb(var(--brand)/.15)
}

/* cartão de artigo */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--line));
  border-radius: 16px;
  overflow: hidden;
  transition: transform .45s cubic-bezier(.2, .7, .2, 1), box-shadow .45s, border-color .45s
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 45px -22px rgb(30 25 18/.3);
  border-color: rgb(var(--brand)/.45)
}

.card .share {
  position: absolute;
  top: .7rem;
  right: .7rem;
  display: flex;
  gap: .35rem;
  padding: .3rem;
  border-radius: 999px;
  background: rgb(var(--surface)/.9);
  backdrop-filter: blur(4px);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .3s, transform .3s
}

.card:hover .share,
.card:focus-within .share {
  opacity: 1;
  transform: none
}

.shbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  color: rgb(var(--mute));
  border: 1px solid transparent
}

.shbtn:hover {
  color: rgb(var(--brand));
  background: rgb(var(--brandsoft));
  border-color: rgb(var(--brand)/.3)
}

/* widgets */
.widget {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--line));
  border-radius: 14px;
  padding: 1.1rem 1.1rem 1.2rem
}

.w-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: rgb(var(--mute));
  margin-bottom: .9rem
}

.w-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgb(var(--line))
}

/* publicidade */
.ad-label {
  display: block;
  text-align: center;
  font-size: .6rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgb(var(--mute));
  margin-bottom: .4rem
}

.ad-slot {
  border: 1.5px dashed rgb(var(--line));
  border-radius: 12px;
  background: repeating-linear-gradient(45deg, transparent 0 12px, rgb(var(--sunk)/.55) 12px 24px)
}

.ad-box {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  color: rgb(var(--mute));
  font-size: .75rem;
  text-align: center;
  padding: 1rem
}

.ad-rect {
  min-height: 250px
}

.ad-sky {
  min-height: 600px
}

.ad-board {
  min-height: 90px
}

/* ticker */
.ticker {
  overflow: hidden;
  border-block: 1px solid rgb(var(--line));
  background: rgb(var(--surface))
}

.ticker-track {
  display: flex;
  gap: 2.75rem;
  width: max-content;
  padding: .55rem 0;
  animation: tick 45s linear infinite
}

.ticker:hover .ticker-track {
  animation-play-state: paused
}

@keyframes tick {
  to {
    transform: translateX(-50%)
  }
}

/* pesquisa / drawer */
.search-panel {
  position: absolute;
  inset-inline: 0;
  top: 100%;
  z-index: 60;
  background: rgb(var(--surface));
  border-bottom: 1px solid rgb(var(--line));
  box-shadow: 0 24px 50px -30px rgb(0 0 0/.35);
  transform: translateY(-10px);
  opacity: 0;
  pointer-events: none;
  transition: transform .3s, opacity .3s
}

.search-panel.open {
  transform: none;
  opacity: 1;
  pointer-events: auto
}

.sr-item {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .7rem 1rem;
  border-radius: 10px
}

.sr-item:hover {
  background: rgb(var(--sunk))
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgb(20 18 15/.5);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s
}

.backdrop.show {
  opacity: 1;
  pointer-events: auto
}

#drawer {
  position: fixed;
  inset-block: 0;
  left: 0;
  z-index: 70;
  width: min(86vw, 22rem);
  background: rgb(var(--paper));
  border-right: 1px solid rgb(var(--line));
  transform: translateX(-102%);
  transition: transform .45s cubic-bezier(.2, .7, .2, 1);
  overflow-y: auto
}

#drawer.open {
  transform: none
}

/* comentários colapsados (.fold — evita conflito com utility do Tailwind) */
.fold {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .55s cubic-bezier(.2, .7, .2, 1)
}

.fold.open {
  grid-template-rows: 1fr
}

.fold>div {
  overflow: hidden
}

/* inquérito */
.bar {
  height: 8px;
  border-radius: 99px;
  background: rgb(var(--sunk));
  overflow: hidden
}

.bar>span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: rgb(var(--brand));
  transition: width 1s cubic-bezier(.2, .7, .2, 1)
}

/* capítulo de série */
.chap {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.1rem;
  align-items: start;
  padding: 1.15rem 1.2rem;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--line));
  border-radius: 14px;
  transition: border-color .3s, transform .3s
}

.chap:hover {
  border-color: rgb(var(--brand)/.5);
  transform: translateX(4px)
}

.chap-num {
  font-family: 'Fraunces', serif;
  font-size: 2rem;
  font-weight: 600;
  line-height: 1;
  color: rgb(var(--brand))
}

/* artigo */
.prose-blog {
  font-size: 1.0625rem;
  line-height: 1.85
}

.prose-blog p {
  margin: 1.1em 0
}

.prose-blog h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.65em;
  line-height: 1.25;
  margin: 2.1em 0 .7em;
  font-weight: 600
}

.prose-blog h2::before {
  content: "";
  display: block;
  width: 2.2rem;
  height: 3px;
  border-radius: 2px;
  background: rgb(var(--brand));
  margin-bottom: .65rem
}

.prose-blog h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.2em;
  margin: 1.8em 0 .5em
}

.prose-blog a {
  color: rgb(var(--brand));
  text-decoration: underline;
  text-underline-offset: 3px
}

.prose-blog ul,
.prose-blog ol {
  padding-left: 1.4em;
  margin: 1.1em 0;
  display: grid;
  gap: .4em
}

.prose-blog ul li::marker {
  content: "✦  ";
  color: rgb(var(--gold))
}

.prose-blog ol {
  list-style: decimal
}

.prose-blog blockquote {
  margin: 1.8em 0;
  padding: 1.1rem 1.4rem;
  border-left: 3px solid rgb(var(--gold));
  background: rgb(var(--sunk));
  border-radius: 0 12px 12px 0;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 1.12em
}

.prose-blog code {
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: .85em;
  background: rgb(var(--sunk));
  padding: .15em .45em;
  border-radius: 6px
}

.prose-blog pre {
  background: #26221d;
  color: #efe9dd;
  padding: 1.2rem 1.4rem;
  border-radius: 12px;
  overflow-x: auto;
  font-size: .85em;
  line-height: 1.7
}

.prose-blog pre code {
  background: none;
  padding: 0
}

.prose-blog figure {
  margin: 2em 0
}

.prose-blog figure img {
  border-radius: 14px
}

.prose-blog figcaption {
  font-size: .78rem;
  color: rgb(var(--mute));
  margin-top: .55rem
}

.callout {
  margin: 1.8em 0;
  padding: 1rem 1.3rem;
  border: 1px solid rgb(var(--brand)/.35);
  border-radius: 12px;
  background: rgb(var(--brandsoft));
  font-size: .95em;
  display: flex;
  gap: .7rem
}

/* movimentos assinatura */
.rl {
  overflow: hidden
}

.rl>span {
  display: block;
  transform: translateY(120%);
  animation: rise .9s .15s cubic-bezier(.2, .7, .2, 1) forwards
}

@keyframes rise {
  to {
    transform: none
  }
}

.rv {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1)
}

.rv.in {
  opacity: 1;
  transform: none
}

#progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: rgb(var(--brand));
  z-index: 90
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translate(-50%, 20px);
  z-index: 120;
  opacity: 0;
  background: rgb(var(--ink));
  color: rgb(var(--paper));
  padding: .65rem 1.2rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  transition: opacity .3s, transform .3s;
  pointer-events: none
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0)
}

@media (prefers-reduced-motion:reduce) {
  html {
    scroll-behavior: auto
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important
  }

  .ticker-track {
    animation: none;
    flex-wrap: wrap;
    width: auto
  }

  .rl>span {
    transform: none;
    animation: none
  }

  .rv {
    opacity: 1;
    transform: none
  }
}

/* avatares: contraste e legibilidade das iniciais */
.av {
  background: rgb(var(--brand)) !important;
  color: #0c1712 !important;
  font-weight: 800;
  letter-spacing: .02em;
}

.av-xs {
  width: 2.5rem !important;
  height: 2.5rem !important;
  font-size: 1rem !important;
}

.av-sm {
  width: 2.75rem !important;
  height: 2.75rem !important;
  font-size: 1.1rem !important;
}

.av-md {
  width: 3.5rem !important;
  height: 3.5rem !important;
  font-size: 1.35rem !important;
}

.av img,
.img.av {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 9999px;
}

/* avatar: círculo perfeito — não comprime dentro de flex */
.av {
  flex: none !important;
  aspect-ratio: 1/1 !important;
}

/* medidor de força */
.pw-meter {
  margin-top: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #dc2626;
}

.pw-meter::before {
  content: "";
  display: block;
  height: 4px;
  border-radius: 2px;
  background: rgb(var(--line));
  margin-bottom: 3px;
  transition: background .2s;
}

.pw-meter[data-s="1"]::before,
.pw-meter[data-s="2"]::before {
  background: #dc2626;
}

.pw-meter[data-s="3"]::before {
  background: #d97706;
}

.pw-meter[data-s="4"]::before {
  background: #16a34a;
}

.pw-meter[data-s="3"] {
  color: #d97706;
}

.pw-meter[data-s="4"] {
  color: #16a34a;
}

/* popover de partilha */
.share-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 160px;
  padding: 6px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgb(0 0 0 / .2);
}

.share-pop a,
.share-pop button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
}

.share-pop a:hover,
.share-pop button:hover {
  color: rgb(var(--brand));
}
/* popover compacto (cards): só ícones, abre para cima */
.share-pop-up {
  top: auto;
  bottom: calc(100% + 6px);
  min-width: 0;
  padding: .3rem;
  align-items: center
}
.share-pop-up .sp-label { display: none }
.share-pop-up a,
.share-pop-up button {
  width: 2rem;
  height: 2rem;
  justify-content: center;
  padding: 0;
  border-radius: 999px
}

/* popover de séries (cards) */
.series-pop { min-width: 220px; padding: .4rem; }
.series-pop a { display: flex; align-items: center; gap: .5rem; padding: .35rem .45rem; border-radius: .5rem; font-size: .85rem; font-weight: 600; }
.series-pop a img { width: 44px; height: 30px; object-fit: cover; border-radius: .35rem; flex: none; }


/* popover de séries: filho do card, centrado e sem cortes */
.card { position: relative; }
.series-pop {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 46px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: .4rem;
  min-width: 0;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--line));
  border-radius: .75rem;
  box-shadow: 0 8px 24px rgb(0 0 0 / .35);
}
.series-pop a { display: flex; align-items: center; gap: .5rem; padding: .35rem .45rem; border-radius: .5rem; font-size: .85rem; font-weight: 600; min-width: 0; }
.series-pop a img { width: 44px; height: 30px; object-fit: cover; border-radius: .35rem; flex: none; }
.series-pop a .sp-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.series-pop[hidden] { display: none !important; }

/* chips: títulos longos com reticências */
a.chip { max-width: 280px; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }

.card { overflow: visible !important; }
.series-pop { z-index: 999 !important; }

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

.series-pop a .sp-c { margin-left: auto; padding-left: .75rem; font-size: .7rem; font-weight: 500; color: rgb(var(--mute)); white-space: nowrap; }

/* badge de tipo nos resultados de pesquisa */
.sr-badge{display:inline-block;margin-right:.45rem;padding:.08rem .45rem;border-radius:999px;border:1px solid rgb(var(--line));font-size:.6rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:rgb(var(--mute));white-space:nowrap}

/* dropdown de pesquisa colado ao input do topo */
.top-results{position:absolute;top:calc(100% + 6px);left:0;right:0;z-index:70;background:rgb(var(--surface));border:1px solid rgb(var(--line));border-radius:12px;box-shadow:0 14px 34px rgba(0,0,0,.28);max-height:62vh;overflow:auto;padding:.4rem}
.top-results[hidden]{display:none}
.top-results .sr-item{display:flex;flex-wrap:wrap;align-items:baseline;gap:.15rem .5rem;padding:.5rem .7rem;border-radius:8px}
.top-results .sr-item:hover{background:rgb(var(--sunk))}

/* garantia: o atributo hidden vence qualquer display definido por classes */
[hidden]{display:none!important}

/* .card(position:relative, linha ~854) anulava o absolute do .share-pop por ordem de cascata */
.share-pop { position: absolute !important; }

/* títulos .rl: espaço para descendentes (g, ç, p...) sem quebrar a máscara do reveal */
.rl { padding-bottom: .12em; margin-bottom: -.12em; }
