/* styles/sections/dm-thread.css
 * DM thread with notes (Personas "Conversation" OxonI, gffM8, KT3ls): a Slack direct message in an
 * elevated artifact window, mono indexes 01 to 03 in its left gutter, and three ruled notes that
 * carry the same indexes. From D the window and the notes share one grid and the window is a
 * subgrid, so each note starts level with the message it describes (the invitation, the PM's ask
 * spanning the refine below it, the summary) at any width, as the frames draw them at 1440 and
 * 1920. Columns are 820 : 396 with a 64 gap at 1440 and shrink together below; at 1920 the
 * window holds 820 and the notes keep 396. On M, and wherever the row is under 1100 wide (a
 * container query, so a note column never drops under 300), the notes follow the window, 32
 * below.
 * The window is product UI transcribed from the frame in Slack's face and colors (--font-slack,
 * --slack-*). Its buttons, pills and mentions are not links. */
@layer sections {
  .dm-conversation {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-32);
  }

  .dm-window {
    padding-bottom: var(--space-12);
    font-family: var(--font-slack);
    line-height: normal;
    color: var(--slack-ink);
  }

  .dm-window p {
    margin: 0;
  }

  .dm-bar {
    display: flex;
    align-items: center;
    gap: var(--space-10);
    height: 52px;
    padding-inline: var(--space-16);
    border-bottom: 1px solid var(--slack-line);
  }

  /* Title and tab share a baseline, centred beside the avatar as one (BRI-7805 J22) */
  .dm-bar__label {
    display: flex;
    align-items: baseline;
    gap: var(--space-10);
  }

  /* Brief AI avatar instances (board ghgVZ) the DM draws besides the shared 36 (.brief-avatar--lg):
     the 24 square in the bar and the 20 square on the replies row */
  .dm-bar .brief-avatar {
    --brief-avatar-size: 24px;
    --brief-avatar-radius: 6px;
    --brief-avatar-mark: 18px;
  }

  .dm-replies .brief-avatar {
    --brief-avatar-size: 20px;
    --brief-avatar-radius: var(--radius-sm);
    --brief-avatar-mark: 14px;
  }

  .dm-bar__title {
    font-size: 17px;
    font-weight: 900;
  }

  .dm-bar__tab {
    font-size: 13px;
    color: var(--slack-ink-2);
  }

  .dm-msg {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: var(--space-10);
    padding: var(--space-16) var(--space-16) var(--space-8) 40px;
  }

  .dm-msg__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: var(--space-6);
    min-width: 0;
  }

  .dm-msg--summary .dm-msg__body {
    gap: var(--space-10);
  }

  /* The index in the window's gutter, on the baseline of the message's name line (of the
     summary's first bullet on M; BRI-7805 J49) */
  .dm-marker {
    position: absolute;
    top: 21px;
    left: var(--space-10);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    line-height: 13px;
    color: var(--fern);
  }

  .dm-marker--summary {
    top: 52px;
  }

  .dm-initials {
    display: grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--ink-muted);
    font-size: 12px;
    font-weight: 700;
    color: var(--white);
  }

  /* One line, as Slack sets it: a long name ellipsizes before the badge and time wrap */
  .dm-window .dm-meta {
    display: flex;
    align-items: baseline;
    gap: var(--space-8);
    white-space: nowrap;
  }

  .dm-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 16px;
    font-weight: 900;
  }

  .dm-app,
  .dm-time {
    flex: none;
  }

  .dm-app {
    padding: 1px var(--space-4);
    border-radius: 3px;
    background: var(--slack-badge);
    font-size: 10px;
    font-weight: 700;
    color: var(--slack-ink-2);
  }

  .dm-time {
    font-size: 12px;
    color: var(--slack-ink-2);
  }

  .dm-text {
    font-size: 16px;
    line-height: 24px;
  }

  /* The PM's one-line ask sits on Lato's own line height (19), as the frames draw it */
  .dm-text--line {
    line-height: normal;
  }

  .dm-mention {
    margin-inline-start: -2px;
    padding-inline: 2px;
    border-radius: 3px;
    background: var(--slack-mention);
    color: var(--slack-link);
  }

  .dm-button {
    display: inline-block;
    padding: 7px var(--space-12);
    border-radius: var(--radius-sm);
    background: var(--slack-green);
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
  }

  .dm-replies {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    padding-top: 2px;
    font-size: 13px;
    font-weight: 700;
    color: var(--slack-link);
  }

  .dm-bullets {
    display: flex;
    flex-direction: column;
    gap: var(--space-10);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .dm-bullets > li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: var(--space-4) var(--space-10);
    justify-items: start;
  }

  .dm-bullets > li::before {
    content: "•";
    grid-row: 1;
    font-size: 16px;
    line-height: 24px;
  }

  .dm-bullets > li > * {
    grid-column: 2;
  }

  .dm-source {
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--slack-source);
    font-size: 14px;
    color: var(--slack-link);
  }

  .dm-view {
    display: inline-flex;
    align-items: center;
    gap: var(--space-6);
    padding: var(--space-6) var(--space-12);
    border-radius: var(--radius-sm);
    outline: 1px solid var(--slack-edge);
    outline-offset: -1px;
    font-size: 14px;
    font-weight: 700;
  }

  .dm-view > img {
    width: 16.5px;
    height: auto;
  }

  .dm-notes {
    display: flex;
    flex-direction: column;
    gap: var(--space-20);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .dm-note {
    display: flex;
    flex-direction: column;
    gap: var(--space-10);
    padding-top: 18px;
    box-shadow: inset 0 1px 0 var(--line-2);
  }

  .dm-note__head {
    display: flex;
    align-items: baseline;
    gap: var(--space-12);
  }

  .dm-note .index,
  .call-state .index {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    line-height: 13px;
    letter-spacing: 0;
  }

  .dm-note__title {
    font-size: 20px;
    line-height: 21px;
    letter-spacing: -0.01em;
  }

  .dm-note__body {
    margin: 0;
    font-size: 15px;
    line-height: 23px;
    color: var(--ink-2);
  }

  .walkthrough-section--reach {
    container: dm-row / inline-size;
  }

  @container dm-row (width >= 1100px) {
    .dm-conversation {
      grid-template-columns: minmax(0, 820fr) minmax(0, 396fr);
      grid-template-rows: repeat(5, auto);
      gap: 0 var(--space-64);
      align-items: start;
    }

    .dm-window {
      display: grid;
      grid-template-rows: subgrid;
      grid-row: 1 / span 5;
      align-self: stretch;
    }

    .dm-notes {
      display: grid;
      grid-template-rows: subgrid;
      grid-row: 1 / span 5;
      gap: 0;
    }

    .dm-note:nth-child(1) { grid-row: 2; }
    .dm-note:nth-child(2) { grid-row: 3 / span 2; }
    .dm-note:nth-child(3) { grid-row: 5; }

    .dm-note {
      align-self: start;
    }
  }

  @media (min-width: 900px) {
    .dm-bar {
      height: 56px;
      padding-inline: 52px;
    }

    .dm-msg {
      gap: var(--space-12);
      padding: 18px var(--space-32) var(--space-6) 52px;
    }

    .dm-marker,
    .dm-marker--summary {
      top: 23px;
      left: 18px;
    }

    .dm-mention {
      margin-inline-start: 0;
    }

    .dm-note__title {
      font-size: 24px;
      line-height: 25px;
    }

    .dm-note__body {
      font-size: 16px;
      line-height: 24px;
    }
  }

  @media (min-width: 1680px) {
    .dm-conversation {
      grid-template-columns: 820px minmax(0, 1fr);
    }

    .dm-note {
      max-width: 396px;
    }

    .dm-note__title {
      font-size: 28px;
      line-height: 29px;
      letter-spacing: -0.015em;
    }
  }

  /* The rule is an inset shadow, inside the box as Pencil draws it; a border in forced colors */
  @media (forced-colors: active) {
    .dm-note {
      border-top: 1px solid CanvasText;
    }
  }
}
