/* styles/sections/logo-table.css
 * Customers and backers as one ruled table (frames GWGeW, EkOkW, c09ZZd: Social Proof).
 * 1440 and 1920: a 256px label cell, then four logo cells a row (112 high) with Border/soft
 * rules between them. 390: the label on its own row, then two cells a row (80 high).
 * Each mark sits at its drawn size and top inset (--logo-w, -h, -top; --logo-mw, -mh, -mtop on
 * 390) and, from 900px, at its drawn opacity (--logo-opacity), set per cell in the markup.
 * From 900px a cell narrower than the frame's 256 scales its mark with it, from the M frame's
 * width at the M cell to the D frame's at the D cell (--logo-a + --logo-b * cell, set by the
 * build), never past the drawn width and always 16px clear of the rules, centred on the drawn
 * mark's middle in its drawn proportions (--logo-ratio). */
@layer sections {
  .logo-table-section {
    padding-block: var(--section-lg) var(--section-sm);
    background: var(--white);
  }

  /* Table and group rules lie inside the frame's boxes, so they take no height */
  .logo-table {
    box-shadow: inset 0 -1px 0 var(--line);
  }

  .logo-table__group {
    box-shadow: inset 0 1px 0 var(--line);
  }

  .logo-table__label {
    margin: 0;
    padding: var(--space-20) 0 var(--space-4);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--ink-55);
  }

  .logo-table__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .logo-table__cell {
    --logo-w: auto;
    --logo-a: 0px;
    --logo-b: 1;
    --logo-ratio: auto;
    --logo-h: auto;
    --logo-top: 0px;
    --logo-opacity: 1;
    --logo-mw: auto;
    --logo-mh: auto;
    --logo-mtop: 0px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    height: 79px;
    padding-top: var(--logo-mtop);
  }

  .logo-table__cell:nth-child(-n + 2) {
    height: 80px;
  }

  .logo-table__cell:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .logo-table__cell:nth-child(even) {
    border-left: 1px solid var(--line);
  }

  .logo-table__cell img {
    display: block;
    width: var(--logo-mw);
    height: var(--logo-mh);
  }

  @media (width >= 900px) {
    .logo-table {
      box-shadow: inset 0 1px 0 var(--line);
    }

    .logo-table__group {
      display: grid;
      grid-template-columns: 256px minmax(0, 1fr);
      border-bottom: 1px solid var(--line);
      box-shadow: none;
    }

    .logo-table__label {
      padding: 48px 0 0;
      font-size: 14px;
      font-weight: 500;
      color: var(--ink-muted);
    }

    .logo-table__group + .logo-table__group .logo-table__label {
      padding-top: 46px;
    }

    .logo-table__grid {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .logo-table__cell,
    .logo-table__cell:nth-child(-n + 2) {
      display: grid;
      grid-template-rows: var(--logo-top) var(--logo-h);
      place-items: center;
      height: 111px;
      padding-top: 0;
      border-left: 1px solid var(--line);
    }

    .logo-table__group:first-child .logo-table__cell:nth-child(-n + 4) {
      height: 112px;
    }

    .logo-table__cell:nth-child(n + 3) {
      border-top: 0;
    }

    .logo-table__cell:nth-child(n + 5) {
      border-top: 1px solid var(--line);
    }

    .logo-table__cell img {
      grid-row: 2;
      width: min(
        var(--logo-w),
        calc(var(--logo-a) + var(--logo-b) * 100%),
        calc(100% - 2 * var(--space-16))
      );
      height: auto;
      aspect-ratio: var(--logo-ratio);
      opacity: var(--logo-opacity);
    }
  }

  /* 1920: the table keeps its 1280 width, centered (x 320 to 1600) */
  @media (width >= 1680px) {
    .logo-table-section {
      --container-max: 1280px;
    }
  }
}
