/* --- Makro-Kachel und Kachelraster der Makro-Übersicht (DESIGN 5, 7; AP 4.3) --------------- */

/* Vier Spalten auf dem Desktop, zwei auf dem Tablet, eine auf dem Telefon (DESIGN 7 „Makro“). */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--grid-gap-compact);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 1100px) {
  .macro-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.macro-grid > li {
  display: flex;
  min-width: 0;
}

.macro-tile {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-tile);
  background: var(--gradient-card);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: border-color var(--ease);
}

.macro-tile:hover {
  border-color: var(--border-strong);
}

.macro-tile:has(.macro-tile__link:focus-visible) {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* Titel (höchstens zwei Zeilen) und darunter Takt und Einheit. Der Kopf hat Platz für zwei
   Titelzeilen, damit die Werte einer Reihe auf gleicher Höhe stehen – der freie Raum steht
   unter der Nebenzeile, nicht zwischen Titel und Nebenzeile. Einspaltig entfällt das. */
.macro-tile__head {
  display: grid;
  align-content: start;
  gap: 2px;
  min-height: calc(2.5rem + 2px + 1rem);
}

@media (max-width: 640px) {
  .macro-tile__head {
    min-height: 0;
  }
}

.macro-tile__title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.25rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.macro-tile__link {
  color: var(--text-1);
  text-decoration: none;
}

.macro-tile__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.macro-tile__link:focus-visible {
  outline: none;
}

.macro-tile__note {
  margin: 0;
  line-height: 1rem;
  overflow: hidden;
  color: var(--text-2);
  font-size: 0.75rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.macro-tile__reading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px var(--space-3);
  margin: var(--space-1) 0 0;
}

/* Bricht nur, wenn der Wert breiter ist als die Kachel (Grenzfall sehr großer Zahlen); Zahl und
   Einheit hält das geschützte Leerzeichen zusammen. */
.macro-tile__value {
  min-width: 0;
  max-width: 100%;
  font: var(--text-value);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.macro-tile__change {
  font-size: 0.875rem;
}

.macro-tile__spark {
  height: 48px;
  pointer-events: none;
}

.macro-tile__spark .sparkline {
  width: 100%;
  height: 100%;
}

.macro-tile__missing {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 100%;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-2);
  font-size: 0.8125rem;
  text-align: center;
}

/* So hoch wie Wert, Sparkline und Angaben einer gefüllten Kachel (eine Reihe bleibt bündig);
   einspaltig genügt weniger. */
.macro-tile__missing--value {
  min-height: 150px;
}

@media (max-width: 640px) {
  .macro-tile__missing--value {
    min-height: 88px;
  }
}

.macro-tile__facts {
  display: grid;
  gap: 2px;
  margin: auto 0 0;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
}

.macro-tile__facts > div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}

.macro-tile__facts dt {
  flex: none;
  color: var(--text-2);
}

.macro-tile__facts dd {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  text-overflow: ellipsis;
}
