/* ============================================================
   components.css : cards, timeline, badges, details, table
   ============================================================ */

/* ------------------------------------------------------------ TIMELINE */
.timeline {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: calc(var(--gutter) + 11px);
  top: 6px; bottom: 6px;
  width: 2px;
  background: var(--line);
}
.timeline-filters {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 28px;
}
.timeline-filters button {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--text-soft);
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  transition: all var(--t-fast);
}
.timeline-filters button:hover  { color: var(--text); border-color: var(--text); }
.timeline-filters button.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.timeline-item {
  position: relative;
  padding: 8px 0 28px 44px;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: 4px; top: 14px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--text-mute);
  box-shadow: 0 0 0 4px var(--bg);
  z-index: 1;
}
.timeline-item[data-type="legal"]::before    { border-color: var(--dorado); }
.timeline-item[data-type="violencia"]::before { border-color: var(--rojo); }
.timeline-item[data-type="defensa"]::before  { border-color: var(--verde); }
.timeline-item[data-type="judicial"]::before { border-color: var(--rojo); background: var(--rojo); }
.timeline-item[data-type="operativo"]::before { border-color: var(--rojo); background: var(--rojo); }
.timeline-item[data-type="comunitario"]::before { border-color: var(--verde); background: var(--verde); }

.timeline-item .date {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: .08em;
  color: var(--text-mute);
  margin-bottom: 4px;
}
.timeline-item h3 {
  margin: 0 0 6px;
  font-size: var(--fs-md);
  font-weight: 700;
  font-family: var(--font-display);
}
.timeline-item p {
  margin: 0 0 8px;
  color: var(--text-soft);
  font-size: var(--fs-base);
  line-height: 1.55;
}
.timeline-item .source {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  color: var(--text-mute);
}
.timeline-item .source a { color: var(--text-mute); }

/* ------------------------------------------------------------ BADGES */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  vertical-align: middle;
  line-height: 1.5;
}
.badge--legal      { background: var(--dorado-soft); color: #6B5418; }
.badge--violencia,
.badge--operativo,
.badge--judicial   { background: var(--rojo-soft);   color: #6E1418; }
.badge--defensa,
.badge--comunitario{ background: var(--verde-soft);  color: #144A33; }
.badge--neutro     { background: var(--line);         color: var(--text-soft); }
[data-theme="dark"] .badge--legal     { color: #ECDEB5; }
[data-theme="dark"] .badge--violencia,
[data-theme="dark"] .badge--operativo,
[data-theme="dark"] .badge--judicial  { color: #F3B4B7; }
[data-theme="dark"] .badge--defensa,
[data-theme="dark"] .badge--comunitario { color: #B5E1CB; }

/* ------------------------------------------------------------ CARDS — protagonistas */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}
.card .role-tag {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.card[data-bando="denuncia"] { border-top: 4px solid var(--rojo); }
.card[data-bando="defensa"]  { border-top: 4px solid var(--verde); }
.card[data-bando="denuncia"] .role-tag { color: var(--rojo); }
.card[data-bando="defensa"]  .role-tag { color: var(--verde); }

.card .avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--line) 0%, var(--line-strong) 100%);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--bg);
  flex: none;
}
.card[data-bando="denuncia"] .avatar { background: linear-gradient(135deg, var(--rojo) 0%, #7E1B1F 100%); color: #fff; }
.card[data-bando="defensa"]  .avatar { background: linear-gradient(135deg, var(--verde) 0%, #1B5239 100%); color: #fff; }

.card h3 { margin: 6px 0 0; font-family: var(--font-display); font-size: var(--fs-md); font-weight: 700; }
.card .age { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-mute); }
.card p { margin: 4px 0 0; font-size: var(--fs-sm); line-height: 1.55; color: var(--text-soft); }
.card .source { margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--line); font-family: var(--font-display); font-size: var(--fs-xs); color: var(--text-mute); }
.card .source a { color: var(--text-mute); }

/* ------------------------------------------------------------ MODUS — compact cards */
.modus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.modus-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-left: 3px solid var(--rojo);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: var(--fs-sm);
}
.modus-card h4 {
  margin: 0 0 4px;
  font-size: var(--fs-base);
  font-family: var(--font-display);
  font-weight: 700;
}
.modus-card .place {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-mute);
  letter-spacing: .04em;
  display: block;
  margin-bottom: 6px;
}
.modus-card p { margin: 0; color: var(--text-soft); font-size: var(--fs-sm); line-height: 1.5; }

/* ------------------------------------------------------------ DETAILS — anomalías */
.anomalias { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); }
.anomalias details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 10px;
  background: var(--bg-elev);
  transition: border-color var(--t-fast);
}
.anomalias details[open] { border-color: var(--dorado); }
.anomalias summary {
  cursor: pointer;
  padding: 16px 20px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-base);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
}
.anomalias summary::-webkit-details-marker { display: none; }
.anomalias summary::after {
  content: "+";
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  color: var(--text-mute);
  transition: transform var(--t-fast);
}
.anomalias details[open] summary::after { content: "−"; color: var(--dorado); }
.anomalias .anom-id {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-mute);
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  flex: none;
}
.anomalias .anom-body {
  padding: 0 20px 20px;
  color: var(--text-soft);
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.anomalias .anom-body p { margin: 0 0 10px; }
.anomalias .anom-body .meta { display: block; margin-top: 8px; font-family: var(--font-mono); font-size: var(--fs-xs); }

/* ------------------------------------------------------------ TABLE — leads */
.leads { max-width: var(--measure-wide); margin: 0 auto; padding: 0 var(--gutter); overflow-x: auto; }
.leads table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-display);
  font-size: var(--fs-sm);
}
.leads th, .leads td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.leads th {
  font-weight: 700;
  font-size: var(--fs-xs);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-mute);
  border-bottom: 2px solid var(--line-strong);
}
.leads tr:hover td { background: color-mix(in srgb, var(--dorado-soft) 30%, transparent); }
.leads td:first-child { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-mute); white-space: nowrap; }
.leads td.prio { white-space: nowrap; }
.prio-alta  { color: var(--rojo);   font-weight: 700; }
.prio-media { color: var(--dorado); font-weight: 700; }
.prio-baja  { color: var(--text-mute); }

/* ------------------------------------------------------------ NARRATIVE BLOCKS */
.narrative { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); }
.narrative p { font-size: var(--fs-base); color: var(--text); line-height: 1.75; }
.narrative p.lede:first-of-type::first-letter {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 4em;
  float: left;
  line-height: .85;
  padding: 4px 8px 0 0;
  color: var(--rojo);
}
.narrative .key-facts {
  list-style: none;
  margin: 24px 0;
  padding: 18px 22px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-left: 4px solid var(--text);
  border-radius: var(--radius);
}
.narrative .key-facts li {
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  margin-bottom: 8px;
  padding-left: 18px;
  position: relative;
}
.narrative .key-facts li:last-child { margin-bottom: 0; }
.narrative .key-facts li::before {
  content: "▸";
  position: absolute; left: 0;
  color: var(--dorado);
}
.narrative .key-facts strong { color: var(--text); font-weight: 700; }

/* ------------------------------------------------------------ FUENTES */
.fuentes {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.fuentes-search {
  margin-bottom: 24px;
}
.fuentes-search input {
  width: 100%;
  max-width: 480px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
}
.fuentes-search input:focus { outline: 2px solid var(--dorado); outline-offset: 1px; }
.fuentes-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  list-style: none;
  margin: 0; padding: 0;
}
.fuentes-list li {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--bg-elev);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.fuentes-list .src-title { font-family: var(--font-display); font-weight: 600; color: var(--text); }
.fuentes-list .src-meta  { display: block; margin-top: 4px; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-mute); }
.fuentes-list a { text-decoration-color: var(--line-strong); }

/* ------------------------------------------------------------ misc */
.divider-ornament {
  display: block;
  width: 60px;
  height: 1px;
  background: var(--line-strong);
  margin: 32px auto;
  position: relative;
}
.divider-ornament::before, .divider-ornament::after {
  content: "";
  position: absolute; top: -2px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--dorado);
}
.divider-ornament::before { left: -10px; }
.divider-ornament::after  { right: -10px; }
