/* A1: six raised tiles, three to a row. Each shows a tiny scene of a game built in that tool. */
@layer sections {
  .onboarding-tools {
    block-size: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: 14px;
  }

  .onboarding-tool {
    position: relative;
    min-block-size: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-header);
    border-radius: 8px;
    background: var(--white);
    box-shadow: var(--card-shadow);
    transition: box-shadow 120ms cubic-bezier(0.2, 0, 0, 1), border-color 120ms;

    &:hover {
      border-color: var(--selection);
      box-shadow: var(--card-shadow-raised);
    }

    &[data-selected] {
      outline: 2px solid var(--selection);
      outline-offset: -1px;

      /* The fill handle, on the picked tile. */
      &::after {
        content: "";
        position: absolute;
        inset-inline-end: -5px;
        inset-block-end: -5px;
        inline-size: 10px;
        block-size: 10px;
        border: 2px solid var(--white);
        border-radius: 50%;
        background: var(--selection);
      }
    }
  }

  .onboarding-tool__button {
    flex: 1;
    min-block-size: 0;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    text-align: start;
    font-family: var(--font-cell);
    cursor: pointer;

    &:focus-visible {
      outline: 2px solid var(--blue-700);
      outline-offset: 2px;
    }
  }

  .onboarding-tool__strip {
    --icon-size: 24px;

    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px 12px 14px;

    [data-editing] & {
      display: none;
    }
  }

  .onboarding-tool__label {
    flex: 1;
    min-inline-size: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .onboarding-tool__name,
  .onboarding-tool__tracker {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .onboarding-tool__name {
    font: 700 18px/1.2 var(--font-cell);
  }

  /* Where the hours come from: Lapse, or the Hackatime plugin. */
  .onboarding-tool__tracker {
    font: 12px/1.3 var(--font-chrome);
    color: var(--text-secondary);
  }

  .onboarding-tool__go {
    color: var(--text-secondary);

    [data-selected] & {
      display: none;
    }
  }

  .onboarding-tool__picked {
    color: var(--selection);

    .onboarding-tool:not([data-selected]) & {
      display: none;
    }
  }

  /* "Other", once tapped: its scene makes way for quick answers and Clippy's verdict on what you type, and its name
     strip becomes a field. */
  .onboarding-tool__advice {
    flex: 1;
    min-block-size: 0;
    display: none;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 12px 0;
    overflow: hidden;

    [data-editing] > & {
      display: flex;
    }
  }

  [data-editing] > .onboarding-tool__button {
    display: none;
  }

  .onboarding-tool__chips {
    min-block-size: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    overflow: hidden;
  }

  .onboarding-tool__chip {
    block-size: 26px;
    padding: 0 10px;
    border: 1px solid var(--grey-600);
    border-radius: 13px;
    background: var(--white);
    font: 500 12px var(--font-chrome);
    color: var(--text-primary);
    white-space: nowrap;
    cursor: pointer;

    &:hover {
      border-color: var(--selection);
      background: #f1f4f9;
    }
  }

  .onboarding-tool__verdict {
    flex: none;
    font: 13px/1.35 var(--font-chrome);
    color: var(--text-primary);

    &[data-kind="engine"] {
      color: var(--red-800);
    }

    &:empty {
      display: none;
    }
  }

  .onboarding-tool__mood {
    flex: none;
    font: 11px var(--font-mono);
    color: var(--text-secondary);

    &:empty {
      display: none;
    }
  }

  .onboarding-tool__other {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 9px 12px 11px;

    :not([data-editing]) > & {
      display: none;
    }
  }

  .onboarding-tool__other-label {
    font: 12px var(--font-chrome);
    color: var(--text-secondary);
  }

  .onboarding-tool__other-row {
    display: flex;
    gap: 6px;
  }

  .onboarding-tool__other-input {
    flex: 1;
    min-inline-size: 0;
    block-size: 36px;
    padding: 0 10px;
    border: 1px solid var(--grey-600);
    border-radius: 4px;
    outline: none;
    font: 15px var(--font-cell);
    color: var(--text-primary);

    &:focus {
      border-color: var(--selection);
      box-shadow: inset 0 0 0 1px var(--selection);
    }
  }

  /* Scenes. Pieces are placed from the top left with --x, --y, --w and --h. */
  .onboarding-preview {
    position: relative;
    flex: 1;
    min-block-size: 0;
    display: block;
    overflow: hidden;
    border-block-end: 1px solid var(--border-grid);
    border-radius: 8px 8px 0 0;

    > * {
      position: absolute;
      inset-inline-start: var(--x);
      inset-block-start: var(--y);
      inline-size: var(--w);
      block-size: var(--h);
    }
  }

  .onboarding-preview--spreadsheet {
    background: linear-gradient(var(--grey-200) 1px, transparent 1px) 0 0 / 64px 22px,
                linear-gradient(90deg, var(--grey-200) 1px, transparent 1px) 0 0 / 64px 22px var(--white);
    font: 11px/22px var(--font-mono);
  }

  .onboarding-preview__block {
    background: var(--bg);
  }

  .onboarding-preview__ribbon {
    inset-inline: 0;
    inset-block-start: 0;
    block-size: 21px;
    background: var(--green-header);
  }

  .onboarding-preview__text--up {
    color: var(--green);
  }

  .onboarding-preview__formula {
    padding-inline-start: 6px;
    border: 2px solid var(--selection);
    background: var(--white);
    line-height: 19px;
    white-space: nowrap;
  }

  .onboarding-preview--figma {
    background: var(--grey-75);
  }

  .onboarding-preview__caption {
    font: 10px var(--font-mono);
    color: var(--grey-600);
  }

  .onboarding-preview__frame {
    border: 1px solid var(--border-header);
    background: var(--white);
  }

  .onboarding-preview__hotspot {
    border: 1px solid var(--selection);
    background: var(--blue-100);
  }

  .onboarding-preview--email {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--white);
    font: 12px/1 var(--font-cell);

    > * {
      position: static;
    }
  }

  .onboarding-preview__mail {
    block-size: 34px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    color: var(--text-secondary);

    & + & {
      border-block-start: 1px solid var(--border-grid);
    }
  }

  .onboarding-preview__mail--unread {
    font-weight: 700;
    color: var(--text-primary);
  }

  .onboarding-preview__from {
    inline-size: 74px;
  }

  .onboarding-preview--ssh {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 22px 16px;
    background: var(--grey-900);
    font: 12px/1.3 var(--font-mono);
    color: #3fbf73;

    > * {
      position: static;
    }
  }

  .onboarding-preview--shaders {
    background: var(--grey-900);
  }

  .onboarding-preview__moon {
    inset-inline-start: 58%;
    inset-block-start: 32%;
    inline-size: 44px;
    block-size: 44px;
    border-radius: 50%;
    background: var(--white);
  }

  .onboarding-preview__dither {
    inset: 0;
    inline-size: auto;
    block-size: auto;
    background: repeating-conic-gradient(rgb(0 0 0 / 55%) 0 25%, transparent 0 50%) 0 0 / 4px 4px;
  }

  .onboarding-preview--other {
    display: grid;
    place-items: center;
    background: repeating-linear-gradient(135deg, #ececec 0 8px, #f6f6f6 8px 16px);

    > * {
      position: static;
    }
  }

  .onboarding-preview__error {
    padding: 2px 10px;
    background: var(--white);
    font: 600 28px var(--font-mono);
    color: var(--red-800);
  }
}

/* Phones: two tiles to a row, each a fixed height, and the stage grows to fit them. */
@layer sections {
  @media (width <= 600px) {
    /* A tile's too short for the quick answers and a verdict both: once there's a verdict, the answers go. */
    .onboarding-tool__advice:has(.onboarding-tool__verdict:not(:empty)) .onboarding-tool__chips {
      display: none;
    }

    .onboarding-tools {
      block-size: auto;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      grid-auto-rows: 176px;
      gap: 10px;
    }

    .onboarding-tool__strip {
      padding: 8px 10px 10px;
    }

    .onboarding-tool__name {
      font-size: 15px;
    }

    .onboarding-tool__tracker {
      font-size: 11px;
    }
  }
}
