/* La cronología (ver linea.py). Va aparte de style.css porque solo la usa
   esta página. */

.ln-page main { max-width: none; padding-left: 2rem; padding-right: 2rem; }
.ln { max-width: 1560px; margin: 0 auto; }

.ln-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: 1.1rem;
}
.ln-head h1 { font-size: clamp(2.3rem, 4.4vw, 3.3rem); line-height: 1.02; margin: 0 0 0.5rem; }
.ln-kicker { margin: 0 0 0.7rem; font-size: 0.82rem; color: var(--muted); }
.ln-kicker a { color: var(--ink); font-weight: 600; text-decoration: none; }
.ln-lede { margin: 0; max-width: 46rem; color: var(--text); }
.ln-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.ln-tools input { margin: 0; width: 14rem; border-radius: 999px; }
.ln-zoom { display: inline-flex; align-items: center; gap: 0.2rem; padding: 3px; border-radius: 999px; background: var(--soft); }
.ln-zoom button {
  margin: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1;
  box-shadow: 0 1px 2px var(--shadow);
}
.ln-zoom span { min-width: 6.5rem; text-align: center; font-size: 0.82rem; color: var(--muted); }

.ln-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.4rem;
}
.ln-show, .ln-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ln-show button, .ln-tabs button {
  margin: 0;
  padding: 0.32rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
}
.ln-show button[aria-pressed="true"], .ln-tabs button[aria-selected="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
}
.ln-tabs { display: none; }
.ln-key { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.8rem; color: var(--muted); }
.ln-key i { display: inline-block; vertical-align: middle; margin-right: 0.3rem; }
.k-life { width: 16px; border-top: 2.5px solid var(--ink); opacity: 0.55; }
.k-guess { width: 16px; border-top: 2.5px dashed var(--ink); opacity: 0.45; }
.k-kin { width: 16px; border-top: 1.2px solid var(--edge-strong); }
.k-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--card); border: 2px solid var(--ink); }
.k-couple { width: 16px; height: 4px; border-top: 1.2px solid var(--edge-strong); border-bottom: 1.2px solid var(--edge-strong); }

/* --- El gráfico: lo que pasó | el eje | quién vivía --------------------------- */
.ln-chart {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 38fr) 76px minmax(0, 62fr);
  align-items: start;
}
/* el año de arriba de la pantalla: una píldora pegada al eje mientras se baja */
.ln-now {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: 76px;
  z-index: 7;
  height: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  pointer-events: none;
}
.ln-now[hidden] { display: none; }
.ln-now span {
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.3;
  box-shadow: 0 2px 8px var(--shadow-md);
}
.ln-left, .ln-spine, .ln-right { grid-row: 1; position: relative; }
.ln-left { grid-column: 1; }
.ln-spine { grid-column: 2; }
.ln-right { grid-column: 3; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.ln-lines { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
.ln-right .ln-lines { pointer-events: auto; }

/* el eje */
.ln-spine::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  border-left: 1px solid var(--edge);
}
.ln-tick { position: absolute; left: 0; right: 0; height: 0; }
.ln-tick::before {
  content: "";
  position: absolute;
  left: calc(50% - 3px);
  width: 6px;
  border-top: 1px solid var(--edge);
}
.ln-tick.is-five::before { left: calc(50% - 6px); width: 12px; }
.ln-tick.is-decade::before { left: calc(50% - 10px); width: 20px; border-color: var(--edge-strong); }
.ln-tick b {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 0.05rem 0.4rem;
  background: var(--paper);
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink);
}
.ln-tick.is-today b {
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--on-ink);
  border-radius: 999px;
}

/* --- La izquierda: lo que pasó ---------------------------------------------------- */
.ln-items { position: absolute; inset: 0; }
/* Plegadas por defecto: una línea cada una. Los eventos, en tarjeta y con
   contraste; los nacimientos y las fotos, en gris y sin caja. Al pasar por
   encima (.is-open) se despliegan por encima de las demás. */
.ln-item {
  position: absolute;
  right: 18px;
  width: max-content;
  max-width: min(calc(100% - 30px), 31rem);
  padding: 0.32rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 0.86rem;
  line-height: 1.4;
  outline: none;
  transition: opacity 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.ln-item p { margin: 0; }
.ln-sum { display: flex; align-items: center; gap: 0.45rem; min-width: 0; white-space: nowrap; }
.ln-sum a { overflow: hidden; text-overflow: ellipsis; }
.ln-more { display: none; }
.ln-item.is-open {
  z-index: 10;
  width: min(calc(100% - 30px), 31rem);
  border-color: var(--edge);
  box-shadow: 0 14px 34px var(--shadow-md);
}
.ln-item.is-open .ln-more { display: block; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--line); }
.ln-item:focus-visible { box-shadow: 0 0 0 2px var(--ink); }

/* los eventos: lo que más se ve */
.is-event .ln-sum a { color: var(--ink); font-weight: 600; text-decoration: none; }
.is-event .ln-sum a:hover { text-decoration: underline; }
.is-event .ln-sum b { flex: none; font-weight: 500; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ln-badge { flex: none; color: var(--ink); }

/* nacimientos, bodas y muertes de una década, y las fotos: en segundo plano */
.ln-item.is-life, .ln-item.is-photos { background: transparent; border-color: transparent; padding: 0.1rem 0.75rem; }
.is-life .ln-sum, .is-photos .ln-sum { font-size: 0.8rem; color: var(--muted); }
.ln-item.is-life.is-open, .ln-item.is-photos.is-open { background: var(--card); border-color: var(--edge); padding: 0.5rem 0.8rem; }
.ln-stack { display: inline-flex; }
.ln-stack img {
  width: 22px;
  height: 22px;
  object-fit: cover;
  border-radius: 5px;
  border: 2px solid var(--paper);
  margin-left: -9px;
}
.ln-stack img:first-child { margin-left: 0; }

.ln-item-year { font-size: 0.8rem; color: var(--muted); }
.ln-item-year a { color: var(--ink); font-weight: 600; }
.ln-life { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; font-size: 0.82rem; }
.ln-life li { display: flex; align-items: baseline; gap: 0.5rem; color: var(--text); }
.ln-life li b { flex: none; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--muted); }
.ln-life li.is-death { color: var(--muted); }
.ln-life em { font-style: normal; color: var(--muted); }
.ln-life a, .ln-who a { color: var(--ink); text-decoration: none; font-weight: 500; }
.ln-life a:hover, .ln-who a:hover { text-decoration: underline; }
.ln-chip { padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--soft); font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.ln-event-text { margin-top: 0.4rem !important; color: var(--text); }
.ln-who { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; margin-top: 0.5rem !important; font-size: 0.82rem; }
.ln-who .ln-face { margin-right: -0.25rem; }
.ln-others { color: var(--muted); }
.ln-thumbs { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.4rem !important; }
.ln-thumbs a { display: block; width: 4.2rem; height: 4.2rem; border-radius: 8px; overflow: hidden; background: var(--photo); }
.ln-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ln-thumbs .ln-extra { display: grid; place-items: center; color: var(--muted); text-decoration: none; font-size: 0.86rem; background: var(--soft); }
.ln-link { fill: none; stroke: var(--edge); stroke-width: 1; }
.ln-link.is-life { stroke-dasharray: 2 3; }

/* --- La derecha: las vidas --------------------------------------------------------- */
.ln-lives { position: relative; }
.ln-life { fill: none; stroke: var(--ink); stroke-opacity: 0.42; stroke-width: 2.5; stroke-linecap: round; transition: stroke-opacity 0.15s; }
.ln-life.is-guess { stroke-dasharray: 3 5; stroke-opacity: 0.3; }
.ln-life.is-alive { stroke-opacity: 0.42; }
.ln-end { fill: none; stroke: var(--ink); stroke-opacity: 0.5; stroke-width: 1.5; }
.ln-hit { fill: none; stroke: transparent; stroke-width: 14; cursor: pointer; pointer-events: stroke; }
.ln-kin { fill: none; stroke: var(--edge-strong); stroke-opacity: 0.55; stroke-width: 1.2; transition: stroke-opacity 0.15s; }
.ln-kin.is-guess { stroke-dasharray: 2 4; }
.ln-couple { fill: none; stroke: var(--edge-strong); stroke-width: 1.2; }
.ln-dot { fill: var(--card); stroke: var(--ink); stroke-width: 2; cursor: pointer; transition: r 0.15s; }
.ln-card {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 13rem;
  padding: 0 0.7rem 0 0;
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 0 0 1px var(--line), 0 2px 6px var(--shadow);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.15s, box-shadow 0.15s, transform 0.15s;
}
.ln-card:hover { z-index: 4; box-shadow: 0 0 0 1.5px var(--ink), 0 6px 16px var(--shadow-md); }
.ln-card-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; padding: 0.15rem 0; }
.ln-card-text b { font-size: 0.8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.ln-card-text small { font-size: 0.8rem; color: var(--muted); }
.ln-face {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--soft-hover);
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 600;
  box-shadow: 0 0 0 2px var(--card);
}
.ln-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ln-face.is-small { width: 20px; height: 20px; font-size: 0.5rem; }
.ln-card.is-found { animation: ln-found 0.6s ease 3; }
@keyframes ln-found { 50% { transform: scale(1.12); } }
/* sin latido para quien ha pedido que nada se mueva: un aro quieto */
@media (prefers-reduced-motion: reduce) {
  .ln-card.is-found { animation: none; box-shadow: 0 0 0 3px var(--ink); }
}
.ln-ages { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.ln-ages span {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 1.35rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 0.8rem;
  line-height: 1.25rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* --- Encender a alguien: lo demás se apaga --------------------------------------- */
.ln-chart.is-focus .ln-life:not(.is-on):not(.is-kin),
.ln-chart.is-focus .ln-end:not(.is-on):not(.is-kin) { stroke-opacity: 0.1; }
.ln-chart.is-focus .ln-life.is-on { stroke-opacity: 0.95; stroke-width: 3.5; }
.ln-chart.is-focus .ln-life.is-kin { stroke-opacity: 0.6; }
.ln-chart.is-focus .ln-kin:not(.is-on), .ln-chart.is-focus .ln-couple:not(.is-on) { stroke-opacity: 0.12; }
.ln-kin.is-on, .ln-couple.is-on { stroke: var(--ink); stroke-opacity: 0.9; stroke-width: 1.8; }
.ln-chart.is-focus .ln-dot:not(.is-on) { opacity: 0.2; }
.ln-dot.is-on { fill: var(--ink); r: 6; }
.ln-chart.is-focus .ln-card:not(.is-on):not(.is-kin) { opacity: 0.3; }
.ln-card.is-on { z-index: 5; box-shadow: 0 0 0 2px var(--ink), 0 6px 16px var(--shadow-md); }
.ln-chart.is-focus .ln-item:not(.is-on) { opacity: 0.4; }
.ln-item.is-event.is-on { border-color: var(--ink); box-shadow: 0 4px 14px var(--shadow); }
.ln-item.is-life.is-on .ln-sum, .ln-item.is-photos.is-on .ln-sum { color: var(--ink); }

/* --- El año que se señala ------------------------------------------------------------ */
.ln-cross {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px dashed var(--edge-strong);
  pointer-events: none;
  z-index: 6;
}
.ln-cross[hidden] { display: none; }
.ln-cross span {
  position: absolute;
  left: var(--spine, 50%);
  transform: translate(-50%, -50%);
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* lo que no tiene fecha: abajo, en una lista */
.ln-undated { margin: 2rem 0 0; padding: 1.1rem 1.2rem; border: 1px dashed var(--edge); border-radius: 14px; font-size: 0.88rem; color: var(--text); }
.ln-undated[hidden] { display: none; }
.ln-undated h2 { margin: 0 0 0.7rem; font-size: 0.8rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.ln-undated p { margin: 0.6rem 0 0; }
.ln-loose { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.ln-loose li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.ln-loose a { color: var(--ink); font-weight: 600; text-decoration: none; }
.ln-loose span { color: var(--muted); }
.ln-go { margin-top: 0.5rem !important; }
.ln-summary { margin: 0.6rem 0 0; font-size: 0.88rem; color: var(--muted); }
.ln-empty { margin: 1.5rem 0; padding: 2.5rem 1.5rem; border: 1px dashed var(--edge); border-radius: 18px; text-align: center; }
.ln-empty p { margin: 0.3rem auto; max-width: 34rem; }
.ln-plain { margin: 1rem 0; padding-left: 1.2rem; display: grid; gap: 0.4rem; }
.ln-bar[hidden], .ln-chart[hidden], .ln-tools[hidden] { display: none; }

/* --- Pantallas estrechas: una columna cada vez ------------------------------------- */
@media (max-width: 860px) {
  .ln-page main { padding-left: 1rem; padding-right: 1rem; }
  .ln-tabs { display: flex; }
  .ln-key { display: none; }
  .ln-chart { grid-template-columns: minmax(0, 1fr) 54px; }
  .ln-right { display: none; }
  .ln-chart.show-right { grid-template-columns: 54px minmax(0, 1fr); }
  .ln-chart.show-right .ln-left { display: none; }
  .ln-chart.show-right .ln-spine, .ln-chart.show-right .ln-now { grid-column: 1; }
  .ln-chart.show-right .ln-right { display: block; grid-column: 2; }
  .ln-item { right: 10px; max-width: calc(100% - 14px); }
  .ln-item.is-open { width: calc(100% - 14px); }
  .ln-tools input { width: 100%; }
  .ln-tools { width: 100%; }
}
