/* ==========================================================================
   SmartAGM v2 — Meetings open now
   Markup: templates/home/v2/partials/meetings.html
   Heading and lead, then a grid of meeting cards (3 → 2 → 1
   columns). Each card: logo and status pill, name and date, a countdown
   (days / hours / minutes / seconds) and a full-width button. The card's
   status (data-status) tints the countdown label. The cards
   (partials/cards/meeting_card.html) also show in the company search, where
   a closed one has a note instead of the countdown and button.
   Status pills: components/status.css. Logical properties mirror in RTL.
   ========================================================================== */

.meetings {
  padding-block: var(--space-18) var(--space-2);
}

/* ---- Heading ------------------------------------------------------------ */

.meetings__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);
}

.meetings__title {
  margin: 0 0 10px;
  /* 28px on phones → 40px from ~1100px wide, like the steps heading. */
  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;
}

.meetings__lead {
  max-width: 62ch;
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  line-height: var(--leading-normal);
  text-wrap: pretty;
}

/* Arabic: letter-spacing breaks the joined letters. */
.meetings:lang(ar),
.meetings :lang(ar) {
  letter-spacing: 0;
}

/* ---- Grid --------------------------------------------------------------- */

.meetings__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---- Card --------------------------------------------------------------- */

.meeting-card {
  --meeting-tone: var(--color-status-open-text);

  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  transition:
    border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

.meeting-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-card-hover);
}

.meeting-card[data-status="closing"] {
  --meeting-tone: var(--color-status-closing-text);
}

.meeting-card[data-status="soon"] {
  --meeting-tone: var(--color-status-soon-text);
}

.meeting-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.meeting-card__logo {
  position: relative;
  display: flex;
  flex: none;
  width: 56px;
  height: 56px;
  padding: 3px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-subtle);
  font-size: var(--text-base);
  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). */
.meeting-card__mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.meeting-card__logo img {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 3px;
  background: var(--color-surface);
  object-fit: contain;
}

.meeting-card__name {
  margin: 0 0 var(--space-2);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-snug);
  overflow-wrap: anywhere;
}

.meeting-card__meta {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-base);
}

.meeting-card__type:not(:first-child)::before {
  content: "· ";
}

/* ---- Countdown ---------------------------------------------------------- */

.meeting-card__clock {
  margin-top: auto; /* keeps countdowns and buttons aligned across a row */
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}

.meeting-card__clock-label {
  margin: 0 0 var(--space-3);
  color: var(--meeting-tone);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.meeting-card__timer {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.meeting-card__unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.meeting-card__value {
  font-size: 26px;
  font-weight: var(--weight-semibold);
  line-height: 1.05;
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
}

.meeting-card__unit-label {
  color: var(--color-text-subtle);
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.meeting-card__deadline {
  margin: 10px 0 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.meeting-card__cta {
  width: 100%;
  margin-top: auto; /* without a countdown, the button still sits at the bottom */
}

.meeting-card__clock + .meeting-card__cta {
  margin-top: 0;
}

/* Closed (company search): a note where the countdown and button would be. */
.meeting-card__closed {
  margin: auto 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--text-base);
}

/* ---- Smaller screens ---------------------------------------------------- */

@media (max-width: 1024px) {
  .meetings__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .meetings {
    padding-block: var(--space-12) 0;
  }

  .meetings__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
  }

  .meeting-card {
    padding: var(--space-5);
  }
}
