/* ════════════════════════════════════════════════════════
   Vistes alternatives de la línia de temps
   ════════════════════════════════════════════════════════ */

/* ── Selector de vista ──────────────────────────────────── */
.view-switcher {
  display: flex;
  gap: 4px;
  align-items: center;
}
.view-btn {
  background: transparent;
  border: 1px solid rgba(27,26,23,.18);
  border-radius: 2px;
  min-width: 36px; height: auto;
  padding: 5px 7px 3px;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  transition: background .15s, color .15s, border-color .15s;
  line-height: 1;
}
.view-btn::after {
  content: attr(data-label);
  font-family: 'Manrope';
  font-size: 7px;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .55;
  display: block;
  white-space: nowrap;
}
.view-btn:hover { background: var(--paper-deep); color: var(--ink); }
.view-btn.on {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.view-btn.on::after { opacity: .8; }

/* ════════════════════════════════════════════════════════
   VISTA HORITZONTAL
   ════════════════════════════════════════════════════════ */
.h-scroll-wrap {
  overflow-x: auto;
  overflow-y: visible;
  padding: 160px 0 120px;
  cursor: grab;
  -webkit-overflow-scrolling: touch;
}
.h-scroll-wrap:active { cursor: grabbing; }

.h-inner {
  position: relative;
  height: 340px;
}

.h-line {
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--line) 5%, var(--line) 95%, transparent);
  transform: translateY(-50%);
}

.h-decade-mark {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center;
}
.h-decade-mark::before {
  content: '';
  width: 1px; height: 24px;
  background: var(--line);
  display: block;
}
.h-decade-mark span {
  font-family: 'Manrope'; font-size: 10px;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-faint); margin-top: 4px;
}

.h-era {
  position: absolute;
  top: calc(50% - 18px);
  height: 36px;
  border-top: 2px solid;
  border-bottom: 2px solid;
  display: flex; align-items: center; padding: 0 8px;
  font-family: 'Manrope'; font-size: 10px; color: var(--ink-soft);
  overflow: hidden; white-space: nowrap;
  pointer-events: none;
}

.h-event {
  position: absolute;
  width: 140px;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
}
.h-event.top {
  bottom: 50%;
  flex-direction: column-reverse;
}
.h-event.bottom {
  top: 50%;
}

.h-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid;
  flex-shrink: 0; z-index: 1;
  background: var(--paper);
}
.h-dot.positive    { background: var(--positive); border-color: var(--positive); }
.h-dot.challenging { background: var(--challenging); border-color: var(--challenging); }
.h-dot.milestone   { background: var(--milestone); border-color: var(--milestone); }
.h-dot.neutral     { background: var(--paper); border-color: var(--ink-faint); }

.h-stem {
  width: 1px; height: 32px;
  background: var(--line);
  flex-shrink: 0;
}

.h-card {
  background: var(--card, var(--paper));
  border: 1px solid var(--line);
  border-top: 3px solid;
  padding: 8px 10px;
  width: 100%;
  box-shadow: var(--shadow);
}
.h-year {
  font-family: 'Manrope'; font-size: 11px;
  color: var(--ink-faint); margin-bottom: 3px;
}
.h-year em { font-style: normal; color: var(--ink-faint); opacity: .7; }
.h-title {
  font-family: 'Fraunces', serif; font-size: 13px;
  color: var(--ink); line-height: 1.3; margin-bottom: 4px;
}
.h-cat { font-family: 'Manrope'; font-size: 10px; margin-bottom: 6px; }
.h-actions { display: flex; gap: 6px; }
.h-actions button {
  font-family: 'Manrope'; font-size: 10px;
  background: none; border: 1px solid var(--line);
  padding: 2px 6px; cursor: pointer; color: var(--ink-soft);
  border-radius: 2px;
}
.h-actions button:hover { background: var(--ink); color: var(--paper); }

/* ════════════════════════════════════════════════════════
   VISTA HEATMAP
   ════════════════════════════════════════════════════════ */
.hm-wrap { padding: 8px 0; }

.hm-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-bottom: 20px;
  font-family: 'Manrope'; font-size: 11px; color: var(--ink-soft);
}
.hm-leg-item { display: flex; align-items: center; gap: 5px; }
.hm-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}

.hm-grid { display: flex; flex-direction: column; gap: 4px; }

.hm-row {
  display: grid;
  grid-template-columns: 48px 1fr 28px;
  gap: 8px; align-items: center;
  min-height: 28px;
}
.hm-empty-year { opacity: .35; }

.hm-year-lbl {
  font-family: 'Manrope'; font-size: 11px;
  color: var(--ink-faint); text-align: right;
  letter-spacing: .02em;
}

.hm-dots { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }

.hm-ev-dot {
  width: 20px; height: 20px;
  border-radius: 3px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  flex-shrink: 0;
}
.hm-ev-dot:hover {
  transform: scale(1.3);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  z-index: 2; position: relative;
}

.hm-no-ev {
  font-family: 'Manrope'; font-size: 11px; color: var(--ink-faint);
}

.hm-count {
  font-family: 'Manrope'; font-size: 11px;
  color: var(--ink-faint); text-align: right;
}

/* ════════════════════════════════════════════════════════
   VISTA RIU
   ════════════════════════════════════════════════════════ */
.rv-wrap { display: flex; flex-direction: column; gap: 2px; }

.rv-decade {
  font-family: 'Manrope'; font-size: 9px;
  letter-spacing: .28em; text-transform: uppercase;
  color: var(--ink-faint);
  padding: 12px 0 4px;
  border-bottom: 1px solid rgba(27,26,23,.07);
  margin-bottom: 4px;
}

.rv-row {
  display: grid;
  grid-template-columns: 68px 80px 1fr;
  gap: 8px; align-items: center;
  min-height: 32px;
  padding: 3px 0;
}
.rv-quiet { opacity: .3; grid-template-columns: 68px 1fr; }

.rv-year-col {
  display: flex; align-items: baseline; gap: 4px;
  flex-shrink: 0;
}
.rv-year-num {
  font-family: 'Manrope'; font-size: 12px;
  color: var(--ink-soft); font-weight: 600;
}
.rv-age {
  font-family: 'Manrope'; font-size: 10px;
  color: var(--ink-faint);
}

.rv-bar-wrap {
  height: 10px; background: rgba(27,26,23,.06);
  border-radius: 2px; overflow: hidden;
  flex-shrink: 0;
}
.rv-bar {
  height: 100%; border-radius: 2px;
  transition: width .3s ease;
  min-width: 4px;
  opacity: .75;
}

.rv-chips {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.rv-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'Manrope'; font-size: 11px;
  color: var(--ink-soft);
  background: var(--paper-deep);
  border: 1px solid;
  border-radius: 999px;
  padding: 3px 9px 3px 6px;
  cursor: pointer;
  transition: background .14s, color .14s;
  white-space: nowrap;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis;
}
.rv-chip:hover { background: var(--ink); color: var(--paper); }
.rv-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.rv-dot.positive    { background: var(--positive); }
.rv-dot.challenging { background: var(--challenging); }
.rv-dot.milestone   { background: var(--milestone); }
.rv-dot.neutral     { background: var(--ink-faint); }

/* ════════════════════════════════════════════════════════
   VISTA DÈCADES
   ════════════════════════════════════════════════════════ */
.dc-wrap { display: flex; flex-direction: column; gap: 36px; }

.dc-section {}

.dc-header {
  display: flex; align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink);
}
.dc-decade-num {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 28px;
  font-weight: 300;
  color: var(--ink);
}
.dc-count {
  font-family: 'Manrope'; font-size: 10px;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-faint);
}

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

.dc-card {
  background: var(--card, var(--paper));
  border: 1px solid var(--line);
  border-top: 3px solid var(--cat-color, var(--line));
  padding: 12px;
  box-shadow: var(--shadow);
  transition: transform .14s, box-shadow .14s;
}
.dc-card:hover { transform: translateY(-2px); }

.dc-card-top {
  display: flex; justify-content: space-between;
  align-items: baseline; margin-bottom: 6px;
}
.dc-year {
  font-family: 'Manrope'; font-size: 11px;
  color: var(--ink-faint);
}
.dc-year small { opacity: .8; }
.dc-age {
  font-family: 'Manrope'; font-size: 10px;
  color: var(--ink-faint);
}
.dc-card-title {
  font-family: 'Fraunces', serif;
  font-size: 14px; line-height: 1.3;
  color: var(--ink); margin-bottom: 5px;
}
.dc-card-desc {
  font-family: 'Manrope'; font-size: 11px;
  color: var(--ink-soft); line-height: 1.4;
  margin-bottom: 6px;
}
.dc-card-cat {
  font-family: 'Manrope'; font-size: 10px;
  letter-spacing: .1em; text-transform: uppercase;
  margin-bottom: 8px;
}
.dc-card-actions {
  display: flex; gap: 5px;
}
.dc-card-actions button {
  font-family: 'Manrope'; font-size: 10px;
  background: none; border: 1px solid var(--line);
  padding: 2px 7px; cursor: pointer;
  color: var(--ink-soft); border-radius: 2px;
}
.dc-card-actions button:hover {
  background: var(--ink); color: var(--paper);
}

/* ── Llegenda d'eres (heatmap / riu / dècades) ─────────── */
.era-legend-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 18px;
  padding: 10px 14px;
  background: rgba(251,246,234,.5);
  border: 1px solid rgba(27,26,23,.1);
  border-radius: 2px;
}
.era-leg-label {
  font-family: 'Manrope'; font-size: 9px;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-faint); align-self: center;
  margin-right: 4px; flex-shrink: 0;
}
.era-leg-item {
  display: flex; align-items: center; gap: 5px;
  font-family: 'Manrope'; font-size: 11px;
  color: var(--ink-soft);
  padding: 3px 8px 3px 6px;
  border: 1px solid;
  border-radius: 999px;
}
.era-leg-dot {
  width: 7px; height: 7px;
  border-radius: 50%; flex-shrink: 0;
}
.era-leg-range {
  font-size: 10px; color: var(--ink-faint);
  margin-left: 2px;
}

/* Markers d'era al riu ─────────────────────────────────── */
.rv-era-marker {
  padding: 6px 14px 4px;
  margin: 10px 0 2px;
  border-left: 3px solid;
  display: flex; align-items: baseline; gap: 8px;
  opacity: .85;
}
.rv-era-name {
  font-family: 'Fraunces', serif;
  font-style: italic; font-size: 14px;
  color: var(--ink);
}
.rv-era-years {
  font-family: 'Manrope'; font-size: 10px;
  letter-spacing: .12em; color: var(--ink-faint);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .rv-row { grid-template-columns: 56px 60px 1fr; }
  .dc-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .h-card { width: 120px; }
  .h-title { font-size: 11px; }
}
