/* ── Force timeline layout ─────────────────────────────── */
.forces-content {
  max-width: 62rem;
  margin: 0 auto;
  padding: 2.5rem 2rem 6rem;
}

.forces-intro {
  max-width: 44rem;
  margin-bottom: 2.5rem;
}

.forces-intro p {
  color: var(--text-dim);
  line-height: 1.7;
}

/* ── Legend ─────────────────────────────────────────────── */
.legend {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
  padding: 1rem 1.25rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 0.78rem;
}

.legend-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-swatch.german { background: var(--amber); }
.legend-swatch.allied { background: var(--accent); }
.legend-swatch.british { background: #70a0c0; }

/* ── Phase headers ─────────────────────────────────────── */
.phase-header {
  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-align: center;
  padding: 2rem 0 1rem;
  position: relative;
}

.phase-header::before,
.phase-header::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 60px;
  height: 1px;
  background: var(--border);
}

.phase-header::before { right: calc(50% + 8rem); }
.phase-header::after { left: calc(50% + 8rem); }

.phase-header:first-child { padding-top: 0; }

/* ── Day row (the core timeline unit) ──────────────────── */
.day-row {
  display: grid;
  grid-template-columns: 1fr 100px 1fr;
  gap: 0.5rem;
  padding: 1.2rem 0;
  position: relative;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.day-row.visible {
  opacity: 1;
  transform: translateY(0);
}

.day-row.initial {
  padding: 1.8rem 0 1.5rem;
}

/* Vertical line through the center */
.day-row::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
  transform: translateX(-50%);
}

.day-row:first-of-type::before { top: 50%; }
.day-row:last-of-type::before { bottom: 50%; }

/* ── Date column (center) ──────────────────────────────── */
.date-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 0.2rem;
  position: relative;
  z-index: 2;
}

.date-marker {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.day-row.key-day .date-marker {
  border-color: var(--accent);
  background: var(--accent);
  width: 16px;
  height: 16px;
}

.date-text {
  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-top: 0.4rem;
  white-space: nowrap;
  line-height: 1.3;
}

.day-label {
  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 0.62rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.15rem;
}

/* ── Force count ───────────────────────────────────────── */
.force-count {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.5rem;
  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
}

.fc-german {
  background: rgba(201, 160, 80, 0.15);
  color: var(--amber);
  border: 1px solid rgba(201, 160, 80, 0.3);
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
}

.fc-allied {
  background: rgba(124, 157, 219, 0.15);
  color: var(--accent);
  border: 1px solid rgba(124, 157, 219, 0.3);
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
}

/* ── Side columns ──────────────────────────────────────── */
.side {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.side.german {
  align-items: flex-end;
  text-align: right;
}

.side.allied {
  align-items: flex-start;
  text-align: left;
}

/* ── Army group header (for initial deployment) ────────── */
.army-header {
  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.5rem;
  margin-bottom: 0.15rem;
  padding-bottom: 0.15rem;
}

.side.german .army-header {
  color: var(--amber);
  border-bottom: 1px solid rgba(201, 160, 80, 0.25);
}

.side.allied .army-header {
  color: var(--accent);
  border-bottom: 1px solid rgba(124, 157, 219, 0.25);
}

.army-header:first-child { margin-top: 0; }

/* ── Unit cards ────────────────────────────────────────── */
.unit-card {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 0.79rem;
  line-height: 1.4;
  max-width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
}

.side.german .unit-card {
  border-left: 3px solid var(--amber);
  flex-direction: row-reverse;
}

.side.allied .unit-card {
  border-left: 3px solid var(--accent);
}

.unit-name {
  color: var(--text);
  font-weight: 600;
  font-size: 0.79rem;
}

.unit-note {
  color: var(--text-dim);
  font-size: 0.72rem;
  font-style: italic;
}

/* ── Type badges ───────────────────────────────────────── */
.unit-type {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.08rem 0.32rem;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.unit-type.pz   { background: rgba(201, 160, 80, 0.18); color: var(--amber); }
.unit-type.pg   { background: rgba(201, 160, 80, 0.12); color: var(--amber); }
.unit-type.vg   { background: rgba(180, 180, 180, 0.12); color: var(--text-dim); }
.unit-type.fj   { background: rgba(112, 160, 112, 0.15); color: var(--green); }
.unit-type.inf  { background: rgba(124, 157, 219, 0.12); color: var(--accent); }
.unit-type.arm  { background: rgba(124, 157, 219, 0.18); color: var(--accent); }
.unit-type.abn  { background: rgba(112, 160, 112, 0.18); color: var(--green); }
.unit-type.cav  { background: rgba(180, 160, 200, 0.15); color: #b0a0c0; }
.unit-type.sp   { background: rgba(201, 112, 112, 0.15); color: var(--red); }
.unit-type.bri  { background: rgba(112, 160, 192, 0.18); color: #70a0c0; }

/* ── Compact badge mode (for initial deployment) ──────── */
.unit-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.side.german .unit-badges {
  justify-content: flex-end;
}

.unit-badge {
  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  white-space: nowrap;
  color: var(--text);
}

.side.german .unit-badge {
  border-left: 2px solid var(--amber);
}

.side.allied .unit-badge {
  border-left: 2px solid var(--accent);
}

/* ── Event markers ─────────────────────────────────────── */
.event-note {
  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 0.72rem;
  font-style: italic;
  color: var(--text-dim);
  padding: 0.3rem 0.65rem;
  background: var(--bg-inset);
  border-radius: 4px;
  border: 1px dashed var(--border);
  max-width: 100%;
}

/* ── Key event banner ──────────────────────────────────── */
.event-banner {
  grid-column: 1 / -1;
  text-align: center;
  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  padding: 0.5rem 1rem;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 0.5rem 2rem;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
  .day-row {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .date-col {
    flex-direction: row;
    gap: 0.6rem;
  }

  .day-row::before { display: none; }

  .side.german {
    align-items: flex-start;
    text-align: left;
  }

  .side.german .unit-card {
    flex-direction: row;
    border-left: 3px solid var(--amber);
    border-right: none;
  }

  .side.german .unit-badges {
    justify-content: flex-start;
  }

  .phase-header::before,
  .phase-header::after { display: none; }
}

/* ── End-of-battle summary ─────────────────────────────── */
.battle-end {
  text-align: center;
  padding: 2.5rem 1.5rem;
  margin-top: 1rem;
}

.battle-end-line {
  display: block;
  width: 40px;
  height: 2px;
  background: var(--accent);
  margin: 0 auto 1.5rem;
}

.battle-end p {
  font-style: italic;
  color: var(--text-dim);
  max-width: 32rem;
  margin: 0 auto;
  line-height: 1.7;
}

.battle-end .final-count {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1.5rem;
  font-family: "Work Sans", system-ui, sans-serif;
}

.final-count .count-block {
  text-align: center;
}

.final-count .count-num {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.final-count .count-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

.count-block.german .count-num { color: var(--amber); }
.count-block.allied .count-num { color: var(--accent); }

/* ── Clickable units ───────────────────────────────────── */
a.unit-badge {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
a.unit-badge:hover {
  border-color: var(--accent);
  color: var(--accent);
}
a.unit-badge:hover em {
  color: var(--accent);
}

.unit-name a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}
.unit-name a:hover {
  color: var(--accent);
}
