/* ==========================================================================
   SmartAGM v2 — Completed
   Markup: templates/home/v2/partials/completed.html
   Heading + "View the full archive" toggle, then a two-column list of slim
   rows (one column on smaller screens): logo, name, date and a "Closed" pill.
   While the section is [data-collapsed] (set by completed.js), rows marked
   [data-extra] are hidden; without JS every row shows.
   Pill: components/status.css. Logical properties mirror in RTL.
   ========================================================================== */

.completed {
  padding-block: var(--space-18) var(--space-2);
}

/* ---- Heading ------------------------------------------------------------ */

.completed__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4) var(--space-8);
  margin-bottom: var(--space-7);
}

.completed__title {
  margin: 0;
  /* 28px on phones → 40px from ~1100px wide, like the other section headings. */
  font-size: clamp(28px, 1.6vw + 22px, var(--text-4xl));
  font-weight: var(--weight-medium);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-snug);
  text-wrap: balance;
}

/* A text link in looks (accent text, accent underline), a button in behaviour. */
.completed__toggle {
  padding: 0 0 2px;
  border: 0;
  border-bottom: 2px solid var(--color-accent);
  background: none;
  color: var(--color-accent-text);
  font: inherit;
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  cursor: pointer;
}

.completed__toggle:hover {
  color: var(--color-text);
}

.completed__toggle[hidden] {
  display: none;
}

.completed__toggle[aria-expanded="false"] .completed__toggle-less,
.completed__toggle[aria-expanded="true"] .completed__toggle-more {
  display: none;
}

/* ---- List --------------------------------------------------------------- */

.completed__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.completed[data-collapsed] .completed-row[data-extra] {
  display: none;
}

/* ---- Row ---------------------------------------------------------------- */

.completed-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.completed-row__logo {
  position: relative;
  display: flex;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-subtle);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
}

/* Behind the logo; shows when there is none, or when it fails to load (the img removes itself). */
.completed-row__mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.completed-row__logo img {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 3px;
  background: var(--color-surface);
  object-fit: contain;
}

/* Name and date share a line while they fit; the date drops below otherwise. */
.completed-row__text {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 18px;
  min-width: 0;
}

.completed-row__name {
  font-size: 16px;
  font-weight: var(--weight-semibold);
  overflow-wrap: anywhere;
}

.completed-row__date {
  color: var(--color-text-subtle);
  font-size: var(--text-base);
  white-space: nowrap;
}

/* ---- Smaller screens ---------------------------------------------------- */

@media (max-width: 800px) {
  .completed__grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 480px) {
  .completed {
    padding-block: var(--space-12) 0;
  }

  .completed-row {
    gap: 14px;
    padding: 14px var(--space-4);
  }

  .completed-row__date {
    font-size: var(--text-md);
  }
}
