/* card.css — карточка и её части, бейдж, метрика, прогресс, скелетон, плитки, погода */

.c-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}

.c-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}

.c-card__titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.c-card__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
}

.c-card__meta {
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
  color: var(--text-muted);
}

.c-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.c-card__foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: auto;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

.c-card__foot .c-link--bare {
  margin-right: auto;
}

/* ── Бейдж статуса: всегда иконка + текст ─────────────────────────────── */
.c-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  min-height: 24px;
  padding: 2px var(--sp-2);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  white-space: nowrap;
}

.c-badge svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.c-badge--ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.c-badge--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.c-badge--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ── Главная цифра карточки ───────────────────────────────────────────── */
.c-metric {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.c-metric__value {
  font-size: var(--fs-metric);
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.c-metric__unit {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* ── Прогресс: нативный <progress>, без инлайн-стилей ─────────────────── */
.c-progress {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.c-progress::-webkit-progress-bar {
  background: var(--surface-3);
  border-radius: inherit;
}

.c-progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: inherit;
  transition: width var(--dur-2) var(--ease);
}

.c-progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: inherit;
}

.c-progress--warn::-webkit-progress-value {
  background: var(--warn);
}

.c-progress--warn::-moz-progress-bar {
  background: var(--warn);
}

.c-progress--danger::-webkit-progress-value {
  background: var(--danger);
}

.c-progress--danger::-moz-progress-bar {
  background: var(--danger);
}

/* ── Плитки инструментов ──────────────────────────────────────────────── */
.c-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
}

.c-tile {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 64px;
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
  text-decoration: none;
}

.c-tile svg {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--accent-text);
}

@media (hover: hover) {
  .c-tile:hover {
    border-color: var(--border-strong);
  }
}

/* ── Погода ───────────────────────────────────────────────────────────── */
.c-weather {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.c-weather__temp {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.c-weather__desc {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.c-weather__icon {
  width: 52px;
  height: 52px;
  flex: none;
  color: var(--accent);
}

.c-forecast {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

.c-forecast__day {
  font-size: var(--fs-2xs);
  color: var(--text-muted);
}

.c-forecast__val {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
}

/* ── Скелетон загрузки ────────────────────────────────────────────────── */
.c-skel {
  height: 14px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  animation: c-skel-pulse 1.4s var(--ease) infinite;
}

.c-skel--line {
  width: 100%;
}

.c-skel--short {
  width: 55%;
}

.c-skel--value {
  height: 32px;
  width: 40%;
}

.c-skel--field {
  height: 48px;
  border-radius: var(--r-md);
}

@keyframes c-skel-pulse {
  50% {
    opacity: 0.55;
  }
}

/* На десктопе плитки инструментов — в четыре колонки */
@media (min-width: 900px) {
  .c-tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ── Города (погода) ──────────────────────────────────────────────────── */
.c-cities {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
}

@media (min-width: 600px) {
  .c-cities {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.c-city {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 72px;
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  color: var(--text);
  text-decoration: none;
}

.c-city[aria-current="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-text);
}

.c-city__name {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
}

.c-city__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-1);
}

.c-city__temp {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}

.c-city__icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--accent);
}

@media (hover: hover) {
  .c-city:hover {
    border-color: var(--border-strong);
  }
}

/* ── Прогноз по дням ──────────────────────────────────────────────────── */
.c-days {
  display: flex;
  flex-direction: column;
}

.c-day {
  display: grid;
  grid-template-columns: 4.5rem 1.25rem minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-2);
  padding-block: var(--sp-2);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
}

.c-day:first-child {
  border-top: 0;
}

.c-day__name {
  color: var(--text-muted);
}

.c-day__icon {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--accent);
}

.c-day__desc {
  overflow: hidden;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.c-day__temp {
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-medium);
  white-space: nowrap;
}

.c-day__min {
  color: var(--text-muted);
  font-weight: var(--fw-regular);
}

/* ── Параметры погоды (2×2) ───────────────────────────────────────────── */
.c-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2) var(--sp-3);
}

.c-stat__label {
  font-size: var(--fs-2xs);
  color: var(--text-muted);
}

.c-stat__value {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}

/* ── Блок результата калькулятора ─────────────────────────────────────── */
.c-result {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.c-result__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-3);
}
