/*
 * Responsible for: the inside of the landing page's tabbed container: two rows of pictures (what is in the inbox, and how it
 * is sorted into folders), the bold arrow, the equals sign and the three trailing dots the page draws between and under them,
 * and the torn bottom edge of the third picture.
 *
 * Must never: change the size or place of a picture when a tab is chosen (every picture box has a fixed height of its own),
 * let a picture's mail app stop short of the bottom of its box, let the torn edge be cut off through a word, or let anything
 * on a phone run off the side.
 */

@layer screens {
  /* The tabbed container. Every picture box has a height of its own, so choosing a tab redraws the mail apps inside the boxes
     and moves nothing. A phone shows the pictures one under another; a wide window shows them in rows. */
  .ia-landing__stage {
    --ia-pic-h: 440px;
    --ia-torn-h: 480px;
    /* Under the Map of five: the room for the three dots. */
    --ia-dots-h: calc(var(--s-7) + var(--s-2));
    --ia-equals-y: 330px;
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    padding: var(--s-4) var(--s-4) var(--s-5);
  }

  .ia-landing__stage .ia-landing__heading {
    margin: 0;
  }

  .ia-landing__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: var(--s-3);
    margin-bottom: var(--s-4);
  }

  .ia-landing__figure {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    min-width: 0;
    margin: 0;
  }

  .ia-landing__caption,
  .ia-landing__sentence {
    color: var(--muted);
    font-size: var(--t-md);
  }

  /* A picture's box: a fixed height, and its picture fills it to the very edge. */
  .ia-landing__step-picture {
    height: var(--ia-pic-h);
    min-width: 0;
    border-radius: var(--r-lg);
  }

  .ia-landing__step-picture > * {
    width: 100%;
    height: 100%;
  }

  .ia-landing__map {
    overflow: hidden;
    border: 1px solid var(--rule);
    background: var(--sunken);
    box-shadow: var(--shadow-1);
  }

  /* The Map of five stands as tall as picture 3, and the dots hang under its foot. */
  .ia-landing__row--sorted .ia-landing__map {
    height: var(--ia-torn-h);
  }

  .ia-landing__row--sorted .ia-landing__mail-box {
    height: var(--ia-torn-h);
  }

  /* The bold arrow and equals sign are drawn by the page, in the product's ink. */
  .ia-landing__mark {
    display: grid;
    place-items: center;
    color: var(--accent);
  }

  .ia-landing__arrow {
    height: var(--s-7);
  }

  .ia-landing__arrow svg {
    width: var(--s-8);
    height: auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform: rotate(90deg);
  }

  .ia-landing__equals {
    align-content: center;
    gap: var(--s-2);
    height: var(--s-7);
  }

  .ia-landing__bar {
    width: var(--s-7);
    height: var(--s-2);
    border-radius: var(--r-pill);
    background: currentColor;
  }

  /* Three dots trailing downwards under the Map: more folders follow. */
  .ia-landing__dots {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s-2);
    height: var(--ia-dots-h);
    padding-top: var(--s-2);
    color: var(--accent);
  }

  .ia-landing__dot {
    width: var(--s-3);
    height: var(--s-3);
    border-radius: var(--r-pill);
    background: currentColor;
  }

  .ia-landing__row--sorted .ia-landing__figure:has(.ia-landing__dots) {
    gap: 0;
  }

  /* The bottom edge of the third picture is torn: more folders follow below. The tear stays shallow (at most 11 px, and 7 px
     over the folder column) so the junk row at the foot of the column is never cut into. The shadow is drawn round the torn shape. */
  .ia-landing__figure--torn {
    filter: drop-shadow(0 var(--s-1) var(--s-2) color-mix(in srgb, var(--ink) 16%, transparent));
  }

  .ia-landing__mail-box--torn {
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), 97% calc(100% - 3px), 94% calc(100% - 9px), 91% calc(100% - 4px), 87% calc(100% - 10px), 84% calc(100% - 5px), 80% calc(100% - 9px), 76% calc(100% - 2px), 72% calc(100% - 8px), 68% calc(100% - 11px), 64% calc(100% - 5px), 60% calc(100% - 9px), 55% calc(100% - 3px), 51% calc(100% - 8px), 47% calc(100% - 4px), 43% calc(100% - 10px), 39% calc(100% - 3px), 35% calc(100% - 7px), 31% calc(100% - 2px), 27% calc(100% - 6px), 23% calc(100% - 7px), 19% calc(100% - 3px), 15% calc(100% - 7px), 11% calc(100% - 2px), 7% calc(100% - 6px), 3% calc(100% - 3px), 0 calc(100% - 6px));
  }

  @media (min-width: 640px) {
    .ia-landing__stage {
      --ia-pic-h: 540px;
      --ia-torn-h: 580px;
      gap: var(--s-5);
      padding: var(--s-5) var(--s-5) var(--s-6);
    }

    .ia-landing__stage .ia-landing__heading + .ia-landing__row {
      margin-top: var(--s-2);
    }
  }

  /* A wide window: the pictures stand in rows, the arrow and the equals sign between them. */
  @media (min-width: 1000px) {
    .ia-landing__stage {
      padding: var(--s-6) var(--s-6) var(--s-7);
    }

    .ia-landing__row {
      align-items: start;
      gap: var(--s-5);
      margin-bottom: var(--s-5);
    }

    .ia-landing__row--today {
      grid-template-columns: minmax(0, 1.8fr) auto minmax(0, 1fr);
    }

    .ia-landing__row--sorted {
      grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.8fr);
    }

    .ia-landing__arrow {
      height: var(--ia-pic-h);
    }

    /* The equals sign is level with the folders of picture 3's column, in either look: 330 px down from the top of the pictures
       is where the folder rows stand in the Gmail look (they begin at about 270) and in the Outlook look (about 235 to 370). */
    .ia-landing__equals {
      align-self: start;
      margin-top: calc(var(--ia-equals-y) - var(--s-7) / 2);
    }

    .ia-landing__arrow svg {
      transform: none;
    }
  }
}
