/*
 * articles.css — Portal joinet.org
 * Criado em:     2026-10-19
 * Atualizado em: 2026-10-20 (Revisão 01: D1, D3, F1b)
 * Autor:         João Camargo Neto (com Claude Code)
 *
 * Artigos de Sucesso pages, ported from hub.html (ADR-014): header,
 * thesis dropdown, card grid, source seal, and the article page that
 * replaces the hub's modal. Color tokens come from base.css.
 */

/* ── Header: title + search, then subtitle + counters (D3) ── */

.hub-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.hub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.hub-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.hub-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.hub-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Search: discreet field with a magnifier (D3) ── */

.search {
  position: relative;
  width: min(100%, 360px);
}

.search input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  padding: 7px 38px 7px 14px;
}

.search input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-icon {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  padding: 5px;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
}

.search-icon:hover {
  color: var(--accent);
}

.copy-btn {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.copy-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ── Grid ── */

.grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Same 24px as the header's padding above the divider line. */
  margin: 24px 0;
  font-size: 0.82rem;
  /* Bold and a lighter gray than --text-muted (Revisão 03): 600 was
     barely different from the old 500 at this small size. */
  font-weight: 700;
  color: #a9b1cc;
}

.grid-tools {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ── Thesis dropdown: looks like the tags inside the cards ── */

.thesis-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.thesis-select-wrap {
  position: relative;
  display: inline-flex;
}

/* The arrow is drawn here because appearance: none hides the
   browser's own; pointer-events lets clicks reach the select. */
.thesis-select-wrap::after {
  content: "▾";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  pointer-events: none;
  color: inherit;
  opacity: 0.8;
}

.thesis-select {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  padding-right: 26px;
  cursor: pointer;
  border: 1px solid transparent;
  max-width: 14rem;
}

.thesis-select.tag-sector {
  border-color: var(--border);
}

.thesis-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The opened list is drawn by the system: keep it readable on dark. */
.thesis-select option {
  background: var(--surface);
  color: var(--text);
  text-transform: none;
}

.thesis-submit {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.72rem;
}

.grid-header h2 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.clear-filter {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 4px;
}

.clear-filter:hover {
  color: var(--text);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--text);
}

/* ── Card ── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface2);
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-company {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

.card-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.card-number {
  opacity: 0.55;
  font-size: 0.8em;
  margin-right: 6px;
}

.read-link {
  color: var(--accent);
  font-weight: 500;
}

/* ── Tags ── */

.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

a.tag {
  text-decoration: none;
}

.tag-sector {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ── Source seal and alert ── */

.seal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.2px;
  line-height: 1.3;
}

.seal-editorial_independente {
  background: #14331f;
  color: #4ade80;
  border: 1px solid #216b3a;
}

.seal-primaria_empresa {
  background: #2a2410;
  color: #fbbf24;
  border: 1px solid #6b5316;
}

.seal-patrocinado {
  background: #3b1616;
  color: #f87171;
  border: 1px solid #7f2626;
}

.alert {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 22px;
  font-size: 0.83rem;
  line-height: 1.6;
}

.alert strong {
  display: block;
  margin-bottom: 5px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.alert-editorial_independente {
  background: #14331f;
  border-left: 3px solid #4ade80;
  color: #9ae6b4;
}

.alert-primaria_empresa {
  background: #2a2410;
  border-left: 3px solid #fbbf24;
  color: #fcd77a;
}

.alert-patrocinado {
  background: #3b1616;
  border-left: 3px solid #f87171;
  color: #fca5a5;
}

/* ── Article page (was the hub modal) ── */

.article {
  max-width: 780px;
  margin: 0 auto;
}

/* Tags on the left, way back to the folder on the right (D1). */
.article-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.back-link {
  flex-shrink: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

.article-title {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 10px;
}

.article-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 22px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.article-cover {
  margin-bottom: 24px;
}

.article-cover img {
  width: 100%;
  max-height: 380px;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-sm);
}

.cover-note {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Tabs (owner only) ── */

.tabs {
  display: flex;
  gap: 8px;
  margin: 22px 0 20px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab-panel[hidden] {
  display: none;
}

/* ── Body ── */

.article-body {
  font-size: 0.95rem;
  line-height: 1.75;
}

.article-body h2 {
  font-size: 1.05rem;
  margin: 28px 0 8px;
  font-weight: 700;
}

.article-body p {
  margin-bottom: 14px;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 16px;
  margin: 12px 0;
  color: var(--text-muted);
  font-style: italic;
}

.divergence {
  background: #2a1f10;
  border-left: 3px solid #fbbf24;
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 16px 0;
  font-size: 0.85rem;
  color: #fbbf24;
}

/* ── References ── */

.references {
  margin-top: 32px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.references h3,
.investigation summary {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.references h3 {
  margin-bottom: 12px;
}

.references ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

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

/* ── "Detalhes da apuração" (ADR-010) ── */

.investigation {
  margin-top: 28px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.investigation summary {
  cursor: pointer;
}

.investigation dl {
  margin-top: 14px;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  font-size: 0.82rem;
}

.investigation dt {
  color: var(--text-muted);
}

/* ── LinkedIn panel ── */

.li-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.li-counter {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.copy-btn.is-done {
  background: #14331f;
  border-color: #4ade80;
  color: #4ade80;
}

.li-text {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 22px 24px;
  font-size: 0.92rem;
  line-height: 1.75;
  white-space: pre-wrap;
}

.li-note {
  margin-top: 12px;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Editorial footer ── */

.editorial-footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 40px 48px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.7;
}

.editorial-footer strong {
  color: var(--text);
  font-weight: 600;
}

/* ── Article page: header and footer stay put (Revisão 03) ──
   position: sticky lets an element scroll normally until it reaches
   the given edge, then holds it there. Only on large screens: on a
   phone both would take more than half of the screen. */

@media (min-width: 901px) and (min-height: 700px) {
  .article-head {
    position: sticky;
    top: var(--bar-height); /* right below the site bar */
    z-index: 10;
    background: var(--bg); /* the text passes underneath */
    padding-top: 14px;
    margin-top: -14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 22px;
  }

  .article-head .article-meta {
    margin-bottom: 14px;
  }

  .editorial-footer.is-sticky {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--bg);
    padding-top: 14px;
    padding-bottom: 14px;
  }
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
  }

  /* Title on its own line; dropdown and counter below it. */
  .grid-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .editorial-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .article-title {
    font-size: 1.3rem;
  }
}
