.post {
  background-color: rgb(var(--col-bg-0) / 1);

  display: grid;
  grid-template-areas:
    ".     reason"
    "aside post-main"
    "aside post-main";
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;

  align-items: stretch;
  padding: 1em;
  padding-bottom: 0.5em;

  &:not([data-no-link], .active) {
    cursor: pointer;
  }

  & > aside {
    grid-area: aside;
    margin-right: 1em;
  }
  & > .post-main {
    grid-area: post-main;
  }
  & > .reason {
    grid-area: reason;
    margin-bottom: 0.5em;
    color: rgb(var(--col-fg-muted) / 1);

    display: none;
    &:has(*) {
      display: flex;
      flex-direction: row;
      align-items: center;
    }

    .lucide {
      height: 1em;
      margin-right: 0.25ch;
      margin-left: -0.5ch;
    }

    .lucide-pin {
      margin-left: -0.75ch;
      margin-right: 0.25ch;
    }
  }

  .topline {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
  }

  .details {
    width: fit-content;
    white-space: nowrap;

    time {
      color: rgb(var(--col-fg-muted) / 1);
    }
  }

  .avatar {
    pointer-events: all;
    height: 46px;

    position: relative;
    z-index: 4;
  }

  .author strong {
    margin-right: 0.5ch;

    display: inline-flex;
    text-overflow: ellipsis;
    max-width: 30ch;
    overflow-x: hidden;
    white-space: nowrap;
  }

  & > section {
    flex: 1;
  }

  .reply-details {
    display: inline-block;
    color: rgb(var(--col-fg-muted) / 1);
    margin-bottom: 0.25em;
    margin-top: 0.25em;

    .lucide-reply {
      height: 1em;
      vertical-align: text-top;
      margin-left: -5px;
    }
  }

  & .post-body {
    overflow: clip;
    padding-top: 0.25em;
    padding-bottom: 0.25em;
  }
}

.post.active {
  background-color: rgb(var(--col-bg-2) / 1);
}

.timeline .post.top-reply {
  margin-top: 0;
}

.timeline.thread .reply-details {
  display: none;
}

.post.top-reply,
.post.has-reply {
  & > aside {
    position: relative;
    &::before {
      content: "";
      position: absolute;
      width: 4px;
      left: calc(50% - 4px / 2);
      background-color: rgb(var(--col-bg-2) / 1);
      z-index: 3;
    }
  }
}
.post.has-reply > aside::before {
  height: calc(100% + 1em);
  top: 0px;
}
.post.top-reply > aside::before {
  height: 16px;
  top: -16px;
}
.post.has-reply.top-reply > aside::before {
  height: calc(100% + 1em + 16px);
  top: -16px;
}

.post + .post {
  border-top: none;
}

.post .controls {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  font-size: smaller;

  button {
    --color: 255 255 255;

    all: unset;
    appearance: none;

    display: block;
    user-select: none;

    cursor: pointer;

    transition-timing-function: cubic-bezier(0.39, 0.575, 0.565, 1);
    transition-duration: 150ms;
    transition-property: color background-color;

    display: flex;
    align-items: center;
    padding: 0.5em;
    border-radius: 8px;

    &:hover {
      background-color: rgb(var(--color) / 0.1);
      color: rgb(var(--color) / 1);
    }

    & > svg {
      margin-left: -6px;
      height: 1.25em;
      margin-right: 0.25em;
    }

    &:not(:has(data)) > svg {
      margin: 0;
    }
  }

  .like {
    --color: 251 81 121;
    &[data-like] {
      color: rgb(var(--color) / 1);
      & > svg {
        fill: currentColor;
      }
    }
  }
  .repost {
    --color: 95 255 159;
    &[data-repost] {
      color: rgb(var(--color) / 1);
    }
  }
  .reply {
    --color: var(--col-accent);
  }
}

.thread .post .reason {
  display: none;
}
