/*
 * dashboard.css — what only the projects dashboard looks like.
 *
 * The pieces this screen shares with the rest of the app are not here and are
 * not restated here: the black full-width pill button, the status pill, the
 * slim budget bar, the tabular-figure number and the tokens they are all built
 * from belong to the base stylesheet. This file is the arrangement of them —
 * the search row, the grid of cards, and the two cards themselves.
 *
 * Sized for a phone held in one hand first. The grid is one column until there
 * is room for two, nothing has a fixed width, and every tappable thing clears
 * 44px on its own rather than by sitting next to something that does.
 */

.dashboard__head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-block-end: 20px;
}

/* The first search box in the app; the clients list will want the same one.
   When it does, this rule moves to the shared stylesheet rather than being
   copied into a second screen. */
.search-field {
  inline-size: 100%;
  min-block-size: 48px;
  box-sizing: border-box;
  padding-inline: 16px;
  border: none;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: start;
}

.search-field::placeholder { color: var(--text-muted); }

/* Safari puts its own clear button inside a search input and it lands on the
   wrong side of an RTL field. The state below already offers a way to clear. */
.search-field::-webkit-search-decoration,
.search-field::-webkit-search-cancel-button { appearance: none; }

/* ---- The list ------------------------------------------------------------ */

.project-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

@media (min-width: 600px) {
  .project-list { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

/* ---- A card -------------------------------------------------------------- */

.project-card {
  display: block;
  inline-size: 100%;
  box-sizing: border-box;
  min-block-size: 44px;
  padding: 18px;
  border: none;
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.project-card:active { transform: translateY(1px); }

.project-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  /* The house card-baseline rule: a fixed zone for the title, so that in a
     two-column layout a job whose name wraps does not push its figures below
     the ones next to it. */
  min-block-size: 3.2rem;
}

.project-card__title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-inline-size: 0;
}

.project-card__name {
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.project-card__client {
  color: var(--text-muted);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

/* ---- The owner's card ---------------------------------------------------- */

.project-card__money {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-block-start: 12px;
}

.card-figure {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-figure__label {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.card-figure__value {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--value);
}

.card-figure__value.is-positive { color: var(--pos); }
.card-figure__value.is-negative { color: var(--neg); }

.project-card__budget {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-card__budget-caption {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* ---- The member's card --------------------------------------------------- */

.project-card__dates {
  margin-block-start: 12px;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* ---- Waiting, and the two kinds of nothing ------------------------------- */

.project-card--skeleton {
  block-size: 108px;
  animation: dashboard-pulse 1.4s ease-in-out infinite;
}

@keyframes dashboard-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
  .project-card--skeleton { animation: none; }
}

.dashboard__state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 20px;
  border-radius: 20px;
  background: var(--surface);
  text-align: center;
}

.dashboard__state-title {
  margin: 0;
  font-weight: 500;
}

.dashboard__state-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.dashboard__state .btn { margin-block-start: 12px; }
