/*
  The accessibility fact tiles, as a bento on 12 columns.  Every size is in
  units of 'u', 1 px when the grid is 1200 px wide, so the tiles, their type
  and their drawings scale together.  The unit is also capped by the
  screen's height (the grid is 680 tall), so both bands fit in one view
  under the header, and the grid is centered when the cap makes it narrower.
  In those units: a 16 gap, a 216 row (a 3-column tile is 4:3), and 24 of
  padding, which is also the corner radius.  Tiles are flat: one fill, no
  edge and no shadow.  A label sits top left with the title under it; a
  number and its caption stack up from the foot.
  The drawings are in fact-drawings.css, loaded before this file.
*/
#sustainability-items {
  --u: min((100vw - var(--site-padding-x) * 4) / 1200, var(--vh, 1vh) * 100 / 810);
  --wide: 1200;
  --gap: calc(var(--u) * 16);
  --pad: calc(var(--u) * 24);
  --tile: #1a1815;
  --ink: var(--color-white);
  --ink-2: rgb(243 235 220 / 0.6); /* Labels, units, captions. */
  --accent: var(--color-accent);
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: calc(var(--u) * 216);
  gap: var(--gap);
  width: calc(var(--u) * var(--wide));
  margin: calc(var(--site-padding-y) * 2) auto 0;
  padding: 0 0 calc(var(--site-padding-y) * 2);
  font-family: 'Inter Tight', Arial, sans-serif;
  font-weight: 400;
  color: var(--ink);
}
.fact-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: var(--pad);
  border-radius: var(--pad);
  background: var(--tile);
  overflow: hidden;
}
.fact-tile.w3 {
  grid-column: span 3;
}
.fact-tile.w4 {
  grid-column: span 4;
}
.fact-tile.w5 {
  grid-column: span 5;
}
.fact-tile.h2 {
  grid-row: span 2;
}
/* The one tile in the opposite scheme. */
.fact-tile.is-inverted {
  --ink: var(--color-black);
  --ink-2: rgb(15 13 10 / 0.62);
  --accent: var(--color-accent-deep); /* The deep accent, to read on cream. */
  background: var(--color-white);
  color: var(--ink);
}
.fact-label {
  font-size: max(11px, calc(var(--u) * 13));
  line-height: 1.25;
  color: var(--ink-2);
}
.fact-title {
  font-family: inherit;
  margin: calc(var(--u) * 6) 0 0;
  font-size: calc(var(--u) * 22);
  font-weight: 500;
  line-height: 1.14;
  letter-spacing: -0.02em;
}
.fact-tile.h2 .fact-title {
  font-size: calc(var(--u) * 28);
  line-height: 1.12;
}
.fact-value {
  display: flex;
  align-items: baseline;
  font-size: calc(var(--u) * 72);
  font-weight: 500;
  line-height: 0.82;
  letter-spacing: -0.03em;
}
.fact-value small {
  margin-left: 0.14em;
  font-size: 0.4em;
  letter-spacing: -0.01em;
  color: var(--ink-2);
}
.fact-caption {
  margin: calc(var(--u) * 13) 0 0;
  font-size: max(12px, calc(var(--u) * 14));
  line-height: 1.25;
  color: var(--ink-2);
}
.fact-caption b {
  font-weight: 400;
  color: var(--ink);
}
/* A drawing over the whole tile, under its text. */
.fact-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/*
  (The font is set on the drawing, not on its text, and the text tile's
  rules name one class each: its glass shows the drawing again through a
  'use', whose copy a rule reaching in from an ancestor doesn't match.)
*/
.fact-art {
  font-family: 'Inter Tight', Arial, sans-serif;
}

/*
  Between a phone and a desktop the bands are planned again, on a unit of
  the width over 800, so the type keeps its size: 7 and 5, then the
  phone, 4 wide and 2 tall, beside 8 over two of 4.  At the desktop's spans
  a 3-column tile was 215 px wide at 1024 px, with its label at the 11 px
  floor.  A drawing's labels are set larger in its own units here, as its
  box is smaller, to stay 11 px or more.
*/
@media (min-width: 768px) and (max-width: 1179.98px) {
  #sustainability-items {
    --u: calc((100vw - var(--site-padding-x) * 4) / 800);
    --wide: 800;
  }
  .fact-tile.is-lead {
    grid-column: span 7;
    order: 1;
  }
  .fact-tile.is-color {
    grid-column: span 5;
    order: 2;
  }
  .fact-tile.is-phone {
    grid-column: span 4;
    order: 3;
  }
  .fact-tile.is-contrast {
    grid-column: span 8;
    order: 4;
  }
  .fact-tile.is-keys {
    grid-column: span 4;
    order: 5;
  }
  .fact-tile.is-dial {
    grid-column: span 4;
    order: 6;
  }
  /* The stopwatch's tile is 32 narrower here, so the watch moves right. */
  .fact-art.dial {
    transform: translate(calc(var(--u) * 41), calc(var(--u) * -9));
  }
  /* A narrower tile: its title at the small size. */
  .fact-tile.is-phone .fact-title {
    font-size: calc(var(--u) * 22);
  }
  /* Three keys fit; the space bar is left out. */
  .keys i {
    width: calc(var(--u) * 62);
  }
  /* The rendered caps at this width. */
  .keys.is-rendered i:nth-child(1) {
    --cap: -webkit-image-set(
      url('../assets/accessibility/keys/key-tab-tablet-1x.webp?v=3') 1x,
      url('../assets/accessibility/keys/key-tab-tablet-2x.webp?v=3') 2x,
      url('../assets/accessibility/keys/key-tab-tablet-3x.webp?v=3') 3x
    );
  }
  .keys.is-rendered i:nth-child(2) {
    --cap: -webkit-image-set(
      url('../assets/accessibility/keys/key-esc-tablet-1x.webp?v=3') 1x,
      url('../assets/accessibility/keys/key-esc-tablet-2x.webp?v=3') 2x,
      url('../assets/accessibility/keys/key-esc-tablet-3x.webp?v=3') 3x
    );
  }
  .keys.is-rendered i:nth-child(3) {
    --cap: -webkit-image-set(
      url('../assets/accessibility/keys/key-enter-tablet-1x.webp?v=3') 1x,
      url('../assets/accessibility/keys/key-enter-tablet-2x.webp?v=3') 2x,
      url('../assets/accessibility/keys/key-enter-tablet-3x.webp?v=3') 3x
    );
  }
  .keys .is-space {
    display: none;
  }
  /* A narrower tile: the specimens at 0.878, their baseline kept. */
  .contrast-ladder {
    top: calc(var(--u) * 117.55);
    width: calc(var(--u) * 280);
  }
  .ladder-ratio {
    font-size: 16px;
  }
  .type-size {
    font-size: 15px;
  }
}

/* A phone: one column, each tile as tall as its content or its drawing. */
@media (max-width: 767.98px) {
  #sustainability-items {
    --u: calc((100vw - var(--site-padding-x) * 4) / 311);
    --wide: 311;
    --gap: calc(var(--u) * 12);
    --pad: calc(var(--u) * 20);
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: auto;
  }
  .fact-tile.w3,
  .fact-tile.w4,
  .fact-tile.w5 {
    grid-column: auto;
    grid-row: auto;
    min-height: calc(var(--u) * 180);
  }
  /* Taller than its drawing, which keeps to the foot, clear of the title. */
  .fact-tile.is-lead {
    aspect-ratio: 491 / 530;
  }
  .fact-tile.is-color {
    aspect-ratio: 389 / 448;
  }
  .fact-tile.is-phone {
    aspect-ratio: 288 / 448;
  }
  .fact-tile.h2 .fact-title {
    font-size: calc(var(--u) * 22);
  }
  .fact-value {
    font-size: calc(var(--u) * 64);
  }
  /* Drawn at 0.63 here, so its labels are set at 18 to show at 11 px. */
  .type-size {
    font-size: 18px;
  }
  /* Three keys fit; squeezed to 31 units, the space bar would not. */
  .keys .is-space {
    display: none;
  }
  /* The specimens take a row of their own, between the label and number. */
  .contrast-ladder {
    position: static;
    width: calc(100% + var(--pad));
    margin: calc(var(--u) * 14) 0 calc(var(--u) * 6);
  }
}
