@import '../../_variables.scss';
@import '../../_logical.scss';

.StatusBody {
  display: flex;
  flex-direction: column;

  .translation {
    border: 1px solid var(--accent, $fallback--link);
    border-radius: var(--panelRadius, $fallback--panelRadius);
    margin-block-start: 1em;
    padding: 0.5em;
  }
  .emoji {
    --_still_image-label-scale: 0.5;
    --emoji-size: 38px;
  }

  .emoji:hover {
    transform: scale(1.4);
    transition: 0.05s;
  }

  ._mfm_x2_ {
    .emoji {
      inline-size: 100px;
      block-size: 100px;
    }
  }

  ._mfm_x3_ {
    .emoji {
      inline-size: 150px;
      block-size: 150px;
    }
  }

  ._mfm_x4_ {
    .emoji {
      inline-size: 200px;
      block-size: 200px;
    }
  }

  .attachments {
    margin-block-start: 0.5em;
  }

  & .text,
  & .summary {
    font-family: var(--postFont, sans-serif);
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    line-height: var(--post-line-height);
  }

  .summary {
    display: block;
    font-style: italic;
    padding-block-end: 0.5em;
  }

  .text {
    & > * {
      white-space: pre-wrap;
    }
    &.-single-line {
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
      block-size: 1.4em;
    }
  }

  .summary-wrapper {
    margin-block-end: 0.5em;
    border-style: solid;
    border-width: 0 0 1px 0;
    border-color: var(--border, $fallback--border);
    flex-grow: 0;

    &.-tall {
      position: relative;

      .summary {
        max-block-size: 2em;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
    }
  }

  .text-wrapper {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;

    &.-tall-status {
      position: relative;
      block-size: 220px;
      @include overflow-inline(hidden);
      @include overflow-block(hidden);
      z-index: 1;

      .media-body-wrapper {
        min-block-size: 0;
        mask:
          linear-gradient(to top, white, transparent) bottom/100% 70px no-repeat,
          linear-gradient(to top, white, white);

        /* Autoprefixed seem to ignore this one, and also syntax is different */
        -webkit-mask-composite: xor;
        mask-composite: exclude;
        .#{$writing-mode-vertical}lr & {
          mask:
            linear-gradient(to left, white, transparent) right/70px 100% no-repeat,
            linear-gradient(to left, white, white);
          mask-composite: exclude;
        }
        .#{$writing-mode-vertical}rl & {
          mask:
            linear-gradient(to right, white, transparent) left/70px 100% no-repeat,
            linear-gradient(to right, white, white);
          mask-composite: exclude;
        }
      }
    }
  }

  & .tall-status-hider,
  & .tall-subject-hider,
  & .status-unhider,
  & .cw-status-hider {
    display: inline-block;
    word-break: break-all;
    inline-size: 100%;
    text-align: center;
  }

  .tall-status-hider {
    position: absolute;
    block-size: 70px;
    margin-block-start: 150px;
    line-height: 110px;
    z-index: 2;
  }

  .tall-subject-hider {
    // position: absolute;
    padding-block-end: 0.5em;
  }

  & .status-unhider,
  & .cw-status-hider {
    word-break: break-all;

    svg {
      color: inherit;
    }
  }

  .greentext {
    color: $fallback--cGreen;
    color: var(--postGreentext, $fallback--cGreen);
  }

  .cyantext {
    color: var(--postCyantext, $fallback--cBlue);
  }

  &.-compact {
    align-items: top;
    flex-direction: row;

    --emoji-size: 16px;

    & .body:not(:active),
    & .attachments {
      max-block-size: 3.25em;
    }

    .body {
      white-space: normal;
      min-inline-size: 5em;
      flex: 5 1 auto;
    }

    .body:not(:active) {
      overflow: hidden;
      mask-size: auto 3.5em, auto auto;
      mask-position: 0 0, 0 0;
      mask-repeat: repeat-x, repeat;
      mask-image: linear-gradient(to bottom, white 2em, transparent 3em);

      /* Autoprefixed seem to ignore this one, and also syntax is different */
      -webkit-mask-composite: xor;
      mask-composite: exclude;
      .#{$writing-mode-vertical}lr & {
        mask-image: linear-gradient(to right, white 2em, transparent 3em);
        mask-size: 3.5em auto, auto auto;
      }
      .#{$writing-mode-vertical}rl & {
        mask-image: linear-gradient(to left, white 2em, transparent 3em);
        mask-size: 3.5em auto, auto auto;
      }
    }

    .attachments {
      margin-block-start: 0;
      flex: 1 1 0;
      min-inline-size: 5em;
      block-size: 100%;
      margin-inline-start: 0.5em;
    }

    .summary-wrapper {
      .summary::after {
        content: ': ';
      }

      line-height: inherit;
      margin: 0;
      border: none;
      display: inline-block;
    }

    .text-wrapper {
      display: inline-block;
    }
  }
}

