/* Funding & Finance section only — tight, even card grid. */
.funding-series main {
  background: var(--paper, #f4efe6);
  position: relative;
  z-index: 1;
}
.funding-series .sec-hero {
  overflow: hidden;
  position: relative;
  padding-top: 1.35rem;
  padding-bottom: 1.35rem;
}
.funding-series .sec-hero h1 { margin: 0 0 .45rem; }
.funding-series .sec-hero .sec-hero-lede { margin: 0; max-width: 42rem; }
.funding-series .shell.sec-stack {
  gap: 1.15rem;
  padding: 1.15rem 0 1.75rem;
  background: var(--paper, #f4efe6);
}
.funding-series .sec-stack > * { margin: 0; }
.funding-series .ff-intro { padding: .85rem 1.1rem; }
.funding-series .ff-intro .as-lead { margin: 0; font-size: .95rem; line-height: 1.5; }
.funding-series .mag { gap: 1.35rem; display: grid; }
.funding-series .mag-top { align-items: start; gap: 1.15rem; }
@media (min-width: 980px) {
  .funding-series .mag-top {
    grid-template-columns: minmax(0, 1.15fr) minmax(18rem, .85fr);
  }
  .funding-series .mag-top {
    align-items: stretch;
  }
  .funding-series .mag-top .sec-lead.photo {
    height: 100%;
    min-height: 22rem;
    aspect-ratio: auto;
    max-height: none;
  }
  .funding-series .mag-picks {
    position: sticky;
    top: 5.25rem;
    align-self: start;
    max-height: calc(100vh - 6rem);
    overflow: auto;
  }
}
.funding-series .mag-picks { padding: 1rem 1.05rem 1.1rem; }
.funding-series .mag-picks h2 {
  letter-spacing: .16em;
  text-transform: uppercase;
  font-size: .72rem;
  margin: 0 0 .7rem;
}
.funding-series .series-group { margin: 0; padding: 0; }
.funding-series .series-group .rail-title { margin: 0 0 .7rem; }

/* Even card grid: 6-col desktop so remainders fill the row. */
.funding-series .ff-group-grid {
  display: grid;
  gap: 1rem;
  align-items: stretch;
  grid-template-columns: 1fr;
}
.funding-series .ff-group-grid > .mag-cell { min-width: 0; width: auto; }
.funding-series .ff-group-grid .sec-card,
.funding-series .mag-cell.wide .sec-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.funding-series .mag-cell.wide .sec-card h3 { font-size: 1.08rem; }
.funding-series .sec-card-media {
  display: block;
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #e6dfd2;
  line-height: 0;
}
.funding-series .sec-card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #e6dfd2;
}
.funding-series .sec-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: .9rem 1rem 1rem;
}
.funding-series .sec-card h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.28;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  min-height: calc(1.28em * 3);
}
.funding-series .sec-excerpt {
  margin: 0;
  font-size: .92rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  min-height: calc(1.45em * 3);
}
.funding-series .sec-date { margin-top: auto; }

@media (min-width: 700px) {
  .funding-series .ff-group-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .funding-series .ff-group-grid > .mag-cell:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .funding-series .ff-group-grid > .mag-cell:last-child:nth-child(odd) .sec-card {
    display: grid;
    grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr);
  }
  .funding-series .ff-group-grid > .mag-cell:last-child:nth-child(odd) .sec-card-media {
    aspect-ratio: auto;
    min-height: 100%;
  }
  .funding-series .ff-group-grid > .mag-cell:last-child:nth-child(odd) .sec-card h3,
  .funding-series .ff-group-grid > .mag-cell:last-child:nth-child(odd) .sec-excerpt {
    min-height: 0;
    -webkit-line-clamp: 2;
  }
}
@media (min-width: 1000px) {
  .funding-series .ff-group-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .funding-series .ff-group-grid > .mag-cell { grid-column: span 2; }
  /* Reset the tablet odd-span before applying desktop remainder rules */
  .funding-series .ff-group-grid > .mag-cell:last-child:nth-child(odd) {
    grid-column: span 2;
  }
  .funding-series .ff-group-grid > .mag-cell:last-child:nth-child(odd) .sec-card {
    display: flex;
    grid-template-columns: none;
  }
  .funding-series .ff-group-grid > .mag-cell:last-child:nth-child(odd) .sec-card-media {
    aspect-ratio: 16 / 9;
  }
  .funding-series .ff-group-grid > .mag-cell:last-child:nth-child(odd) .sec-card h3 {
    min-height: calc(1.28em * 3);
    -webkit-line-clamp: 3;
  }
  .funding-series .ff-group-grid > .mag-cell:last-child:nth-child(odd) .sec-excerpt {
    min-height: calc(1.45em * 3);
    -webkit-line-clamp: 3;
  }
  /* Four or two items: even two-column layout, not 3+1 */
  .funding-series .ff-group-grid[data-n="2"],
  .funding-series .ff-group-grid[data-n="4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .funding-series .ff-group-grid[data-n="2"] > .mag-cell,
  .funding-series .ff-group-grid[data-n="4"] > .mag-cell {
    grid-column: auto;
  }
  /* One leftover in a 3-column group (10, 7, 1): full-width horizontal card */
  .funding-series .ff-group-grid:not([data-n="2"]):not([data-n="4"]) > .mag-cell:last-child:nth-child(3n+1) {
    grid-column: 1 / -1;
  }
  .funding-series .ff-group-grid:not([data-n="2"]):not([data-n="4"]) > .mag-cell:last-child:nth-child(3n+1) .sec-card {
    display: grid;
    grid-template-columns: minmax(14rem, 20rem) minmax(0, 1fr);
  }
  .funding-series .ff-group-grid:not([data-n="2"]):not([data-n="4"]) > .mag-cell:last-child:nth-child(3n+1) .sec-card-media {
    aspect-ratio: auto;
    min-height: 100%;
  }
  .funding-series .ff-group-grid:not([data-n="2"]):not([data-n="4"]) > .mag-cell:last-child:nth-child(3n+1) .sec-card h3,
  .funding-series .ff-group-grid:not([data-n="2"]):not([data-n="4"]) > .mag-cell:last-child:nth-child(3n+1) .sec-excerpt {
    min-height: 0;
    -webkit-line-clamp: 2;
  }
  /* Two leftovers (5, 8, 11, 2 already handled): each takes half the row */
  .funding-series .ff-group-grid:not([data-n="2"]):not([data-n="4"]) > .mag-cell:nth-last-child(2):nth-child(3n+1),
  .funding-series .ff-group-grid:not([data-n="2"]):not([data-n="4"]) > .mag-cell:last-child:nth-child(3n+2) {
    grid-column: span 3;
  }
}
@media (max-width: 699px) {
  .funding-series .shell.sec-stack { gap: .9rem; padding: .9rem 0 1.25rem; }
  .funding-series .mag { gap: 1.1rem; }
  .funding-series .sec-card h3,
  .funding-series .sec-excerpt { min-height: 0; }
  .funding-series .ff-group-grid > .mag-cell:last-child:nth-child(odd) .sec-card {
    display: flex;
  }
}


@media (min-width: 700px) {
  .funding-series .ff-group-grid > .mag-cell:last-child:nth-child(odd) .sec-card-media {
    aspect-ratio: auto;
    min-height: 100%;
    height: 100%;
  }
}
@media (min-width: 1000px) {
  .funding-series .ff-group-grid:not([data-n="2"]):not([data-n="4"]) > .mag-cell:last-child:nth-child(3n+1) .sec-card-media {
    aspect-ratio: auto;
    min-height: 100%;
    height: 100%;
  }
}

/* t3: Browse the series + Programmes and windows fill the page width
   below the lead/rail, as even tiles with coloured accents and covers.
   They no longer sit inside the sticky rail (where they overflowed and
   stretched). Programmes stay visible on small screens. */
.funding-series .ff-index {
  display: grid;
  gap: 1.15rem;
  min-width: 0;
}
.funding-series .ff-topics,
.funding-series .ff-programmes {
  margin: 0;
  padding: 1rem 1.05rem 1.15rem;
  background: #fff;
  border: 1px solid #d9dfe8;
  border-top: 4px solid #e9b949;
  border-radius: 6px;
  box-sizing: border-box;
  min-width: 0;
}
.funding-series .ff-topics h3,
.funding-series .ff-programmes h3 {
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #14206b;
  font-size: .72rem;
  margin: 0 0 .85rem;
}
.funding-series .ff-topics ul,
.funding-series .ff-programmes ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .65rem;
  align-items: stretch;
}
.funding-series .ff-topics ul {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.funding-series .ff-topic {
  --ff-accent: #0a1a4f;
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 3.5rem;
  height: 100%;
  padding: .55rem .7rem .55rem .6rem;
  background: #f7f4ee;
  border: 1px solid #e2d8c8;
  border-left: 4px solid var(--ff-accent);
  border-radius: 6px;
  text-decoration: none;
  color: var(--ff-accent);
  box-sizing: border-box;
  min-width: 0;
}
.funding-series .ff-topic:hover,
.funding-series .ff-topic:focus-visible {
  background: #fffdf6;
  border-color: #e9b949;
  outline: none;
}
.funding-series .ff-topic-count {
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--ff-accent);
  color: #fff;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: 0;
  display: grid;
  place-items: center;
  line-height: 1;
}
.funding-series .ff-topic-name {
  font-family: var(--font-playfair), Georgia, serif;
  font-weight: 700;
  font-size: .98rem;
  line-height: 1.25;
  color: var(--ff-accent);
  min-width: 0;
}
.funding-series .ff-topic--loans { --ff-accent: #0a1a4f; }
.funding-series .ff-topic--grants { --ff-accent: #8a6a14; }
.funding-series .ff-topic--equity { --ff-accent: #1b3a8c; }
.funding-series .ff-topic--howto { --ff-accent: #0d5c63; }
.funding-series .ff-topic--scams { --ff-accent: #7a2e1f; }
.funding-series .ff-topic--money { --ff-accent: #3d4f2a; }

.funding-series .ff-programmes ul {
  grid-template-columns: 1fr;
}
.funding-series .ff-programmes a {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  height: 100%;
  background: #f7f4ee;
  border: 1px solid #e2d8c8;
  border-radius: 6px;
  overflow: hidden;
  text-decoration: none;
  color: #0a1a4f;
  min-width: 0;
  box-sizing: border-box;
}
.funding-series .ff-programmes a:hover,
.funding-series .ff-programmes a:focus-visible {
  border-color: #e9b949;
  background: #fffdf6;
  outline: none;
}
.funding-series .ff-programmes a img {
  flex: none;
  width: 6.75rem;
  height: 100%;
  min-height: 3.8rem;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #e6dfd2;
}
.funding-series .ff-programmes a span {
  padding: .55rem .7rem .6rem;
  font-family: var(--font-playfair), Georgia, serif;
  font-weight: 700;
  font-size: .92rem;
  line-height: 1.3;
  color: #0a1a4f;
  min-width: 0;
}
.funding-series .ff-programmes a:hover span,
.funding-series .ff-programmes a:focus-visible span {
  color: #14206b;
  text-decoration: underline;
  text-decoration-color: #e9b949;
}

@media (min-width: 700px) {
  .funding-series .ff-topics ul {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .funding-series .ff-programmes ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .funding-series .ff-programmes li:last-child {
    grid-column: 1 / -1;
  }
  .funding-series .ff-programmes li:last-child a {
    flex-direction: row;
  }
  .funding-series .ff-programmes li:last-child a img {
    width: 10rem;
  }
}
@media (min-width: 1000px) {
  /* 6 even topic tiles in two rows of three; programmes 4+3 with no holes. */
  .funding-series .ff-programmes ul {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
  .funding-series .ff-programmes li {
    grid-column: span 3;
  }
  .funding-series .ff-programmes li:nth-child(n+5) {
    grid-column: span 4;
  }
  .funding-series .ff-programmes li:last-child {
    grid-column: span 4;
  }
  .funding-series .ff-programmes a {
    flex-direction: column;
    align-items: stretch;
  }
  .funding-series .ff-programmes a img {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
  }
  .funding-series .ff-programmes li:last-child a {
    flex-direction: column;
  }
  .funding-series .ff-programmes li:last-child a img {
    width: 100%;
  }
}
@media (max-width: 699px) {
  .funding-series .ff-topics ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .funding-series .ff-topic-name { font-size: .9rem; }
}
