/* ============================================================
   DNSFilter 26 — Author Cards
   ------------------------------------------------------------
   White article cards with an author byline, 4 (or 3) across.
   Tokens come from css/dnsfilter-26/tokens.css via the .rd wrapper.

   Row alignment: each card is a SUBGRID of the row it sits in, so
   titles, excerpts, bylines and buttons line up across a row even
   when one title runs two lines and its neighbour runs four — the
   way the Figma frame lays them out. Browsers without subgrid fall
   back to an ordinary stacked card, which is still correct.
   ============================================================ */

.dnsf26-author-cards {
  position: relative;
  padding-block: var(--section-py);
  /* Standard 1440px container, same as the Form Hero above. At 1280 the
     cards drop to 282px and the titles break into 4-5 short lines. */

  --ac-col-gap: 24px;   /* Figma: 24px between cards */
  --ac-row-gap: 63px;   /* Figma: 63px between the two rows */
  --ac-pad:     30px;   /* Figma: 30px card gutter */
  /* Figma's cyan (#00C8FD) on white is 1.97:1 and fails WCAG AA for a 19px
     name. Darkened just enough to pass (4.58:1); same treatment as
     --color-magenta-cta in tokens.css. */
  --ac-name:    #007FA6;
  --ac-btn:     #00C8FD;  /* black label on this is 10.7:1, so the button keeps Figma's hue */
}

.dnsf26-author-cards--bg-black { background-color: var(--color-bg); }
.dnsf26-author-cards--bg-none  { background-color: transparent; }

.dnsf26-author-cards > .rd-container {
  width: 100%;
}

.rd .dnsf26-author-cards__heading {
  margin: 0 0 var(--space-12);
  font-family: inherit;
  font-size: var(--fs-h2);
  font-weight: var(--fw-medium);
  line-height: var(--lh-heading);
  color: var(--color-text);
}

/* ---- Grid ---- */

.dnsf26-author-cards__grid {
  display: grid;
  grid-template-columns: repeat(var(--ac-cols, 4), minmax(0, 1fr));
  column-gap: var(--ac-col-gap);
  /* Row spacing lives on the cards (margin-bottom), not here: a parent
     row-gap would also open up between the subgrid rows INSIDE each card.
     The negative margin cancels the last row's. */
  row-gap: 0;
  margin-bottom: calc(-1 * var(--ac-row-gap));
}

.dnsf26-author-cards__grid--4 { --ac-cols: 4; }
.dnsf26-author-cards__grid--3 { --ac-cols: 3; }

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

.dnsf26-author-card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  margin-bottom: var(--ac-row-gap);
  overflow: hidden;
  background-color: #FFFFFF;
  border-radius: 15px;
  color: var(--color-text-on-light);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

/* Fallback (no subgrid): push the byline and button to the foot of the
   card so they still line up across a row. */
.dnsf26-author-card__byline {
  margin-top: auto;
}

@supports (grid-template-rows: subgrid) {
  .dnsf26-author-card {
    display: grid;
    grid-row: span 5;
    grid-template-rows: subgrid;
    row-gap: 0;
  }
  /* The body wrapper steps aside so its children join the subgrid.
     Two classes: the base .__body rule (display:flex) comes later in this
     file and would otherwise win on source order, silently disabling the
     row alignment. */
  .dnsf26-author-card .dnsf26-author-card__body {
    display: contents;
  }
  .dnsf26-author-card__media   { grid-row: 1; }
  .dnsf26-author-card__title   { grid-row: 2; }
  .dnsf26-author-card__excerpt { grid-row: 3; }
  .dnsf26-author-card__byline  { grid-row: 4; }
  .dnsf26-author-card__action  { grid-row: 5; }
  /* The subgrid already lines bylines up; the fallback's auto margin would
     instead drop each one to the foot of its track, so a one-line role sat
     lower than a two-line one beside it. */
  .dnsf26-author-card__byline  { margin-top: 0; }
}

/* ---- Media ---- */

.dnsf26-author-card__media {
  position: relative;
  margin: 0;
  aspect-ratio: 338 / 214;
  overflow: hidden;
  /* The frame's backdrop, so a card with no image yet still looks finished. */
  background-image: linear-gradient(150deg, #0B0B0B 20%, rgba(153, 0, 248, 0.8) 116%);
}

.dnsf26-author-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;   /* keep heads in frame when cropped */
  transition: transform 0.4s ease;
}

/* ---- Body ---- */

.dnsf26-author-card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.dnsf26-author-card__body > * {
  margin: 0;
  padding-inline: var(--ac-pad);
}

/* Two classes deep, with font-family explicit: legacy templates style bare
   h3 in Montserrat and colour it, and that would otherwise win. */
.rd .dnsf26-author-card__title {
  padding-top: var(--ac-pad);
  font-family: inherit;
  font-size: var(--fs-card-title);
  font-weight: var(--fw-semibold);
  line-height: 1.22;
  color: var(--color-text-on-light);
  /* The kit balances every heading. In a 260px column that evens titles
     out into near-single-word lines; pretty only fixes the orphan. */
  text-wrap: pretty;
}

.dnsf26-author-card__excerpt {
  padding-top: var(--space-4);
  font-size: var(--fs-body);
  line-height: 1.45;
  color: #4D4D4D;   /* 8.45:1 on white */
}

.dnsf26-author-card__byline {
  display: flex;
  flex-direction: column;
  padding-top: var(--space-8);
  line-height: 1.5;
}

.dnsf26-author-card__name {
  font-size: 19px;
  font-weight: var(--fw-semibold);
  color: var(--ac-name);
}

.dnsf26-author-card__role {
  font-size: 14px;
  color: var(--color-text-on-light);
}

.dnsf26-author-card__action {
  padding-top: var(--space-5);
  padding-bottom: var(--ac-pad);
}

/* A card with no button still needs its bottom padding. */
.dnsf26-author-card__byline:last-child {
  padding-bottom: var(--ac-pad);
}

/* ---- Button ----
   Not .rd-btn: that is a 44px pill, and the design calls for a small 5px-
   radius tag. The tap target is the whole card (stretched link below), so
   the button's own size doesn't need to meet the 44px rule.
   Chained under .rd so the kit's zero-specificity anchor reset and the
   legacy theme's generic a / a:hover rules never repaint it. */
.rd .dnsf26-author-card__btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 15px;
  border-radius: 5px;
  background-color: var(--ac-btn);
  color: #000000;
  font-family: inherit;
  font-size: 12px;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.rd .dnsf26-author-card__btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

/* ---- Hover / focus ----
   Driven from the card: the stretched link means the pointer is never
   technically over the button, so its own :hover would never fire. */
.rd .dnsf26-author-card--linked:hover,
.rd .dnsf26-author-card--linked:focus-within {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}

.rd .dnsf26-author-card--linked:hover .dnsf26-author-card__media img,
.rd .dnsf26-author-card--linked:focus-within .dnsf26-author-card__media img {
  transform: scale(1.04);
}

.rd .dnsf26-author-card--linked:hover .dnsf26-author-card__btn,
.rd .dnsf26-author-card--linked:focus-within .dnsf26-author-card__btn {
  background-color: #000000;
  color: #FFFFFF;
  text-decoration: none;
}

.rd .dnsf26-author-card--linked:focus-within {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

.rd .dnsf26-author-card__btn:focus-visible {
  outline: none;   /* the card shows the ring instead */
}

@media (prefers-reduced-motion: reduce) {
  .rd .dnsf26-author-card,
  .rd .dnsf26-author-card__media img {
    transition: none;
  }
  .rd .dnsf26-author-card--linked:hover,
  .rd .dnsf26-author-card--linked:focus-within,
  .rd .dnsf26-author-card--linked:hover .dnsf26-author-card__media img,
  .rd .dnsf26-author-card--linked:focus-within .dnsf26-author-card__media img {
    transform: none;
  }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1279px) {
  .dnsf26-author-cards__grid--4 { --ac-cols: 3; }
  .dnsf26-author-cards { --ac-row-gap: 48px; }
}

@media (max-width: 1023px) {
  .dnsf26-author-cards__grid--4,
  .dnsf26-author-cards__grid--3 { --ac-cols: 2; }
}

@media (max-width: 639px) {
  .dnsf26-author-cards__grid--4,
  .dnsf26-author-cards__grid--3 { --ac-cols: 1; }
  .dnsf26-author-cards { --ac-row-gap: 32px; --ac-pad: 24px; }
}
