/**
 * @file
 * "What we do" thematic card grid.
 *
 * Every colour, face and step is read from css/tokens.css. The fallbacks in
 * each var() are there so the section renders correctly the moment it is
 * uploaded; once the token names are confirmed, the fallbacks can be dropped.
 * No component rule below should ever hard-code a new hex value.
 */

/* Section shell
   ------------------------------------------------------------------------ */

.what-we-do {
  padding-block: var(--swalim-section-pad);
  background-color: var(--swalim-color-surface-muted);
}

.what-we-do__inner {
  width: min(100% - 2.5rem, var(--swalim-container, 76rem));
  margin-inline: auto;
}

.what-we-do__header {
  max-width: 46rem;
  margin-block-end: var(--swalim-section-header-gap);
}

.what-we-do__eyebrow {
  margin: 0 0 var(--swalim-space-xs, 0.5rem);
  font-family: var(--swalim-font-mono, 'IBM Plex Mono', ui-monospace, monospace);
  font-size: var(--swalim-text-xs, 0.75rem);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--swalim-color-blue);
}

.what-we-do__heading {
  margin: 0;
  font-family: var(--swalim-font-display, Archivo, system-ui, sans-serif);
  font-size: var(--swalim-text-3xl, clamp(1.75rem, 1.2rem + 2vw, 2.75rem));
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--swalim-color-ink);
}

.what-we-do__intro {
  margin: var(--swalim-space-sm, 0.75rem) 0 0;
  font-family: var(--swalim-font-body, Inter, system-ui, sans-serif);
  font-size: var(--swalim-text-lg, 1.125rem);
  line-height: 1.6;
  color: var(--swalim-color-ink-body);
}

/* Grid
   Five cards reflow from 5 → 3 → 2 → 1 with no media queries.
   ------------------------------------------------------------------------ */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
  gap: var(--swalim-space-md, 1.1rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.card-grid__item {
  display: flex;
}

/* Card
   ------------------------------------------------------------------------ */

.theme-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--swalim-space-sm, 0.75rem);
  width: 100%;
  padding: var(--swalim-space-lg, 1.75rem) var(--swalim-space-lg, 1.5rem)
           var(--swalim-space-md, 1.25rem);
  background-color: var(--swalim-color-surface);
  border: 1px solid var(--swalim-color-rule);
  border-radius: var(--swalim-radius-md, 4px);
  transition: border-color 160ms ease, transform 160ms ease,
              box-shadow 160ms ease;
}

/* The top rule is the one moving part: a hairline in brand green that runs
   the full card width and switches to the alert accent on interaction. */
.theme-card__rule {
  position: absolute;
  inset-block-start: -1px;
  inset-inline-start: -1px;
  inline-size: 3.5rem;
  block-size: 3px;
  background-color: var(--swalim-color-blue);
  transition: inline-size 220ms cubic-bezier(0.2, 0.7, 0.3, 1),
              background-color 160ms ease;
}

.theme-card__glyph {
  inline-size: 1.75rem;
  block-size: 1.75rem;
  color: var(--swalim-color-blue);
}

.theme-card__title {
  margin: 0;
  font-family: var(--swalim-font-display, Archivo, system-ui, sans-serif);
  font-size: var(--swalim-text-xl, 1.25rem);
  font-weight: 600;
  line-height: 1.25;
  color: var(--swalim-color-ink);
}

/* Whole card is the hit area; the anchor stays the accessible name. */
.theme-card__link {
  color: inherit;
  text-decoration: none;
}

.theme-card__link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.theme-card__summary {
  margin: 0;
  font-family: var(--swalim-font-body, Inter, system-ui, sans-serif);
  font-size: var(--swalim-text-sm, 0.9375rem);
  line-height: 1.6;
  color: var(--swalim-color-ink-body);
}

/* Pushed to the foot of the card so the signal lines align across the row,
   whatever length the summaries run to. */
.theme-card__signal {
  margin: auto 0 0;
  padding-block-start: var(--swalim-space-sm, 0.75rem);
  border-block-start: 1px solid var(--swalim-color-rule);
  font-family: var(--swalim-font-mono, 'IBM Plex Mono', ui-monospace, monospace);
  font-size: var(--swalim-text-xs, 0.75rem);
  letter-spacing: 0.02em;
  color: var(--swalim-color-brown);
}

/* States
   ------------------------------------------------------------------------ */

.theme-card:hover,
.theme-card:focus-within {
  border-color: var(--swalim-color-blue);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -14px rgb(28 71 103 / 0.35);
}

.theme-card:hover .theme-card__rule,
.theme-card:focus-within .theme-card__rule {
  inline-size: calc(100% + 2px);
  background-color: var(--swalim-color-accent);
}

.theme-card:focus-within {
  outline: 2px solid var(--swalim-color-blue);
  outline-offset: 3px;
}

.theme-card__link:focus-visible {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .theme-card,
  .theme-card__rule {
    transition: none;
  }

  .theme-card:hover,
  .theme-card:focus-within {
    transition: none;
    transform: none;
  }
}
