/* ============================================================================
   hub.css — design system das páginas de conteúdo (hubs, matéria, índice).
   Aditivo: NÃO altera styles.css. Reusa as variáveis do tema escuro do site.
   Cada página define --cat (cor de acento da categoria) inline; o resto herda.
   ========================================================================== */

:root { --cat: var(--cyan); }

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.eh-hd {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(8, 7, 24, 0.84);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.eh-hd-in {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.85rem 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
}

.logo-mk {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(135deg, #20b997, #8b5cf6);
  box-shadow: 0 12px 28px color-mix(in srgb, #20b997 24%, transparent);
  font-weight: 800;
  font-size: 1.2rem;
  line-height: 1;
}

.logo-tx b {
  display: block;
  font-size: 0.95rem;
  font-weight: 850;
  letter-spacing: 0;
}

.logo-tx span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.66rem;
}

.eh-nav {
  display: flex;
  gap: 1.5rem;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.86rem;
  transform: translateX(-32px);
}

.eh-nav a {
  position: relative;
  padding: 0.2rem 0;
}

.eh-nav a:hover {
  color: var(--text);
}

.eh-nav a.on {
  color: var(--text);
  font-weight: 750;
}

.eh-nav a.on::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.85rem;
  height: 2px;
  background: var(--cat);
  box-shadow: 0 0 18px color-mix(in srgb, var(--cat) 42%, transparent);
}

.eh-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.icbtn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.icbtn:hover {
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(167, 139, 250, 0.42);
}

.ic {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .i-moon {
  display: none;
}

:root[data-theme="light"] .theme-toggle .i-sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle .i-moon {
  display: block;
}

.content-main {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 1.25rem 4.5rem;
}

/* ── Breadcrumb ───────────────────────────────────────────────────────────── */
.crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.crumb a { color: var(--muted); transition: color 0.15s; }
.crumb a:hover { color: var(--text); }
.crumb .sep { opacity: 0.4; }

/* ── Chip de categoria ────────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: max-content;
  padding: 0.3rem 0.72rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cat) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--cat) 38%, transparent);
  color: var(--cat);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Hero do hub de categoria ─────────────────────────────────────────────── */
.cat-hero {
  position: relative;
  isolation: isolate;
  margin-bottom: 2.6rem;
  padding: 3rem 1.6rem 2.6rem;
  border-radius: 0 0 22px 22px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.cat-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(70% 140% at 0% 0%, color-mix(in srgb, var(--cat) 26%, transparent), transparent 55%),
    radial-gradient(60% 130% at 100% 0%, color-mix(in srgb, var(--cat) 14%, transparent), transparent 55%),
    linear-gradient(180deg, var(--bg-soft), var(--bg));
}
.cat-hero-inner { max-width: 1160px; margin: 0 auto; }
.cat-hero .crumb { margin-bottom: 1.3rem; }
.cat-hero h1 {
  margin: 0.9rem 0 0.7rem;
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--text);
}
.cat-hero p {
  max-width: 60ch;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}
.cat-hero .count {
  margin-top: 1.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

/* ── Grid de cards ────────────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.4rem;
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--cat) 50%, var(--line));
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.42);
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--panel-2);
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.card:hover .card-media img { transform: scale(1.05); }

/* Placeholder em gradiente (quando não há thumbnail) */
.thumb-ph {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 30% 22%, color-mix(in srgb, var(--cat) 60%, transparent), transparent 62%),
    linear-gradient(135deg, color-mix(in srgb, var(--cat) 26%, var(--panel-2)), var(--panel-2));
}
.thumb-ph svg {
  width: 34px;
  height: 34px;
  stroke: color-mix(in srgb, var(--cat) 85%, white);
  stroke-width: 1.4;
  fill: none;
  opacity: 0.8;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.05rem 1.15rem 1.2rem;
}
.card-title {
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.34;
  color: var(--text);
}
.card-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}
.card-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.3rem;
  font-size: 0.77rem;
  color: var(--muted);
}
.card-meta .dot { opacity: 0.5; }

.content-empty {
  padding: 2.4rem;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

/* ── Índice de artigos ────────────────────────────────────────────────────── */
.idx-secao { margin: 0 0 3rem; }
.idx-secao-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.idx-secao-head .left { display: flex; align-items: center; gap: 0.8rem; }
.idx-secao-head h2 { margin: 0; font-size: 1.35rem; color: var(--text); }
.idx-secao-head .ver-tudo {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--cat);
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}
.idx-secao-head .ver-tudo svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; fill: none; }

/* ── Página de matéria ────────────────────────────────────────────────────── */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--cat);
  z-index: 60;
  transition: width 0.08s linear;
}

.article-wrap { max-width: 1160px; margin: 0 auto; padding: 0 1.25rem 4.5rem; }

.article-head {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.6rem 0 0.6rem;
}
.article-head .crumb { margin-bottom: 1.5rem; }
.article-head .chip { margin-bottom: 1.1rem; }
.article-head h1 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.9rem, 4.6vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--text);
}
.article-lede {
  margin: 0 0 1.3rem;
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--muted);
}
.article-meta-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.article-meta-row .dot { opacity: 0.5; }

.article-hero {
  max-width: 1000px;
  margin: 2rem auto 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--line);
}
.article-hero img { width: 100%; height: 100%; object-fit: cover; }
.article-hero .thumb-ph svg { width: 54px; height: 54px; }

/* Corpo — otimizado para leitura */
.prose {
  max-width: 720px;
  margin: 2.4rem auto 0;
  font-size: 1.13rem;
  line-height: 1.8;
  color: #d7dee8;
}
.prose > :first-child { margin-top: 0; }
.prose h2 {
  margin: 2.6rem 0 0.9rem;
  font-size: 1.6rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
}
.prose h3 { margin: 2rem 0 0.7rem; font-size: 1.28rem; color: var(--text); }
.prose p { margin: 0 0 1.2rem; }
.prose a {
  color: var(--cat);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.prose strong { color: var(--text); font-weight: 700; }
.prose ul, .prose ol { margin: 0 0 1.2rem; padding-left: 1.4rem; }
.prose li { margin: 0.45rem 0; }
.prose li::marker { color: var(--cat); }
.prose blockquote {
  margin: 1.7rem 0;
  padding: 0.9rem 1.3rem;
  border-left: 3px solid var(--cat);
  border-radius: 0 12px 12px 0;
  background: color-mix(in srgb, var(--cat) 9%, var(--panel));
  color: var(--text);
  font-size: 1.08rem;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code {
  padding: 0.15em 0.42em;
  border-radius: 6px;
  background: var(--panel);
  font-size: 0.9em;
}
.prose hr { border: none; border-top: 1px solid var(--line); margin: 2.2rem 0; }

/* Rodapé da matéria — fonte + leia também */
.article-source {
  max-width: 720px;
  margin: 2.4rem auto 0;
  padding-top: 1.3rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}
.article-source a { color: var(--cat); }

.related { margin: 3.6rem auto 0; padding-top: 2rem; border-top: 1px solid var(--line); }
.related h2 { margin: 0 0 1.4rem; font-size: 1.4rem; color: var(--text); }

/* ── Responsivo ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .eh-nav { display: none; }
}
@media (max-width: 560px) {
  .card-grid { grid-template-columns: 1fr; }
  .cat-hero { padding: 2.2rem 1.1rem 2rem; }
  .content-main, .article-wrap { padding-left: 1rem; padding-right: 1rem; }
}

/* Tema global escolhido pelo usuario. Matérias usam claro como default; hubs seguem escuro. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f1ea;
  --bg-soft: #ebe7df;
  --panel: #fffdfa;
  --panel-2: #ece8df;
  --text: #171412;
  --muted: #68635c;
  --line: rgba(31, 27, 21, 0.13);
  --cyan: #635bff;
  --coral: #b65c50;
  --lime: #4f7f2a;
  --gold: #8f7a54;
  --shadow: 0 18px 45px rgba(44, 36, 24, 0.12);
}

:root[data-theme="light"] body {
  background:
    radial-gradient(circle at 18% 0%, rgba(99, 91, 255, 0.08), transparent 30%),
    linear-gradient(180deg, #f8f6f1 0%, var(--bg) 42%, #efebe3 100%);
  color: var(--text);
}

.base-theme-toggle {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #f7f5ff;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
}

.base-theme-toggle:hover {
  border-color: rgba(167, 139, 250, 0.42);
  background: rgba(139, 92, 246, 0.14);
}

.theme-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:root[data-theme="dark"] .theme-icon-moon,
:root[data-theme="light"] .theme-icon-sun {
  display: none;
}

:root[data-theme="light"] .news-header {
  background: rgba(248, 246, 241, 0.86);
  border-bottom-color: rgba(31, 27, 21, 0.1);
  backdrop-filter: blur(16px);
}

:root[data-theme="light"] .eh-hd {
  background: rgba(248, 246, 241, 0.86);
  border-bottom-color: rgba(31, 27, 21, 0.1);
  backdrop-filter: blur(16px);
}

:root[data-theme="light"] .logo,
:root[data-theme="light"] .eh-nav,
:root[data-theme="light"] .icbtn {
  color: #27231f;
}

:root[data-theme="light"] .logo-mk {
  color: #ffffff;
  background: linear-gradient(135deg, #20b997, #8b5cf6);
  box-shadow: 0 12px 28px color-mix(in srgb, #20b997 20%, transparent);
}

:root[data-theme="light"] .logo-tx span {
  color: #77716a;
}

:root[data-theme="light"] .eh-nav a:hover,
:root[data-theme="light"] .eh-nav a.on {
  color: #171412;
}

:root[data-theme="light"] .eh-nav a.on::after {
  background: var(--cat);
  box-shadow: 0 0 18px color-mix(in srgb, var(--cat) 28%, transparent);
}

:root[data-theme="light"] .icbtn {
  border-color: rgba(31, 27, 21, 0.12);
  background: rgba(255, 255, 255, 0.66);
}

:root[data-theme="light"] .icbtn:hover {
  border-color: rgba(99, 91, 255, 0.34);
  background: #ffffff;
}

:root[data-theme="light"] .news-brand,
:root[data-theme="light"] .news-links,
:root[data-theme="light"] .news-login {
  color: #27231f;
}

:root[data-theme="light"] .news-brand-mark {
  border-color: rgba(99, 91, 255, 0.35);
  color: #635bff;
  box-shadow: 0 0 18px rgba(99, 91, 255, 0.14);
}

:root[data-theme="light"] .news-links a:hover {
  color: #0f0d0b;
}

:root[data-theme="light"] .news-signup {
  color: #ffffff;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  box-shadow: 0 12px 26px rgba(79, 70, 229, 0.16);
}

:root[data-theme="light"] .base-theme-toggle {
  color: #27231f;
  border-color: rgba(31, 27, 21, 0.12);
  background: rgba(255, 255, 255, 0.66);
}

:root[data-theme="light"] .base-theme-toggle:hover {
  border-color: rgba(99, 91, 255, 0.34);
  background: #ffffff;
}

body.article-detail-page {
  min-height: 100svh;
}

.article-detail-page .eh-hd-in {
  max-width: 1240px;
  padding-right: 1.5rem;
  padding-left: 1.5rem;
}

.article-detail-page .logo-tx span {
  margin-top: 1px;
}

.article-detail-page .article-wrap {
  max-width: 1240px;
  padding: 0 1.5rem 5.5rem;
}

.article-detail-page .article-layout {
  display: grid;
  grid-template-columns: minmax(0, 860px) 250px;
  gap: clamp(2.6rem, 5vw, 5rem);
  align-items: start;
  justify-content: center;
}

.article-detail-page .article-main {
  min-width: 0;
}

.article-detail-page .article-head {
  max-width: 860px;
  margin: 0;
  padding: clamp(2.8rem, 5vw, 4.2rem) 0 0.8rem;
}

.article-detail-page .article-head h1 {
  max-width: 860px;
  font-size: clamp(2.25rem, 5vw, 3.85rem);
  line-height: 1.02;
  letter-spacing: 0;
  font-weight: 900;
}

.article-detail-page .article-lede {
  max-width: 780px;
  font-size: clamp(1.05rem, 1.6vw, 1.22rem);
  line-height: 1.65;
}

.article-detail-page .article-meta-row {
  padding-top: 0.2rem;
}

.article-detail-page .article-hero {
  max-width: none;
  width: 100%;
  margin: 2.4rem 0 0;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.article-detail-page .article-hero img {
  filter: saturate(0.98) contrast(1.02);
}

.article-detail-page .prose {
  max-width: 760px;
  margin: 3rem 0 0;
  font-size: 1.12rem;
  line-height: 1.86;
}

.article-detail-page .prose h2 {
  margin-top: 3rem;
  font-size: clamp(1.5rem, 2vw, 1.9rem);
  line-height: 1.18;
  letter-spacing: 0;
  font-weight: 850;
}

.article-detail-page .prose h3 {
  font-weight: 850;
}

.article-detail-page .prose h2,
.article-detail-page .prose h3 {
  scroll-margin-top: 6.5rem;
}

.article-detail-page .article-source {
  max-width: 760px;
  margin-left: 0;
  margin-right: 0;
}

.article-toc {
  position: sticky;
  top: 5.75rem;
  max-height: calc(100svh - 7rem);
  overflow: auto;
  margin-top: clamp(10.2rem, 16vw, 13.2rem);
  padding: 0.15rem 0 0.25rem 1.15rem;
  border-left: 1px solid var(--line);
}

.article-toc strong {
  display: block;
  margin-bottom: 0.85rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 850;
}

.article-toc ol {
  display: grid;
  gap: 0.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.article-toc a {
  position: relative;
  display: block;
  padding: 0.34rem 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.38;
  transition: color 0.16s ease;
}

.article-toc a::before {
  content: "";
  position: absolute;
  top: 0.62rem;
  bottom: 0.62rem;
  left: -1.18rem;
  width: 2px;
  border-radius: 999px;
  background: transparent;
}

.article-toc a:hover,
.article-toc a.is-active {
  color: var(--text);
}

.article-toc a.is-active {
  font-weight: 800;
}

.article-toc a.is-active::before {
  background: var(--cat);
}

.article-toc .depth-3 a {
  padding-left: 0.85rem;
  font-size: 0.84rem;
}

@media (max-width: 1120px) {
  .article-detail-page .article-layout {
    grid-template-columns: minmax(0, 860px);
  }

  .article-toc {
    position: static;
    max-height: none;
    margin-top: 2rem;
    padding: 1.2rem 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .article-toc a::before {
    display: none;
  }
}

:root[data-theme="light"] .article-detail-page .crumb,
:root[data-theme="light"] .article-detail-page .article-meta-row,
:root[data-theme="light"] .article-detail-page .article-source {
  color: #77716a;
}

:root[data-theme="light"] .article-detail-page .crumb a:hover {
  color: #171412;
}

:root[data-theme="light"] .article-detail-page .article-head h1,
:root[data-theme="light"] .article-detail-page .prose h2,
:root[data-theme="light"] .article-detail-page .prose h3,
:root[data-theme="light"] .article-detail-page .prose strong,
:root[data-theme="light"] .related h2,
:root[data-theme="light"] .card-title {
  color: #171412;
}

:root[data-theme="light"] .article-detail-page .article-lede,
:root[data-theme="light"] .article-detail-page .prose,
:root[data-theme="light"] .card-excerpt,
:root[data-theme="light"] .card-meta {
  color: #5f5a53;
}

:root[data-theme="light"] .article-detail-page .chip {
  color: #4f46e5;
  background: rgba(99, 91, 255, 0.08);
  border-color: rgba(99, 91, 255, 0.2);
}

:root[data-theme="light"] .article-detail-page .article-hero,
:root[data-theme="light"] .card {
  border-color: rgba(31, 27, 21, 0.12);
}

:root[data-theme="light"] .card {
  background: #fffdfa;
  color: #171412;
  box-shadow: 0 14px 32px rgba(44, 36, 24, 0.08);
}

:root[data-theme="light"] .card:hover {
  box-shadow: 0 22px 45px rgba(44, 36, 24, 0.12);
}

:root[data-theme="light"] .article-detail-page .prose blockquote {
  background: #fffdfa;
  color: #25211d;
  box-shadow: 0 14px 32px rgba(44, 36, 24, 0.08);
}

:root[data-theme="light"] .article-detail-page .prose code {
  background: #ece8df;
  color: #25211d;
}

:root[data-theme="light"] .article-detail-page .prose hr,
:root[data-theme="light"] .related,
:root[data-theme="light"] .article-source {
  border-color: rgba(31, 27, 21, 0.12);
}

:root[data-theme="dark"] body.article-detail-page {
  background: #070713;
}

:root[data-theme="dark"] .article-detail-page .article-head h1,
:root[data-theme="dark"] .article-detail-page .prose h2,
:root[data-theme="dark"] .article-detail-page .prose h3,
:root[data-theme="dark"] .article-detail-page .prose strong {
  color: #f7f5ff;
}

:root[data-theme="dark"] .article-detail-page .article-lede,
:root[data-theme="dark"] .article-detail-page .prose {
  color: rgba(240, 237, 255, 0.78);
}

:root[data-theme="dark"] .article-detail-page .prose blockquote {
  background: rgba(18, 15, 43, 0.88);
}
