@use "variables";

.post-title {
  font-size: 2rem;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 12px;
}

.post-meta {
  display: block;
  margin-bottom: 20px;
}

.hero {
  display: block;
  width: 100%;
  height: 180px;
  background-size: cover;
  aspect-ratio: 1;
  border-radius: 8px;
  margin: 16px 0;
}

.post-container {
  max-width: variables.$breakpoint;
  display: flex;
  padding: 20px;
  box-sizing: border-box;

  flex-direction: column;
  .toc-drawer {
    display: block;
    summary {
      font-weight: bold;
    }
  }
  .toc-list {
    display: none;
  }

  p,
  ul {
    margin-block: 12px;
  }

  p > img {
    max-width: 100%;
    height: auto;

    border-radius: 8px;
    border: 1px solid var(--hr-color);
  }

  pre > code,
  pre.Agda {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--hr-color);
    // background-color: var(--astro-code-color-background);

    a {
      background-color: unset;

      &:not([href]):hover {
      }

      &[href]:hover {
        text-decoration: underline;
      }
    }
  }

  /*
    @media screen and (max-width: 520px) {
        flex-direction: column;
        .toc-drawer { display: block; }
        .toc-list { display: none; }
    }

    @media screen and (min-width: 520px) {
        flex-direction: row;
        align-items: flex-start;
        gap: 12px;

        .toc-drawer { display: none; }
        .toc-list {
            top: 0;
            display: block;
            position: sticky;
            min-width: 160px;
        }
    }
    */

  .post-content {
    ul:not(.tabs) {
      padding-left: 1.5rem;
    }

    min-width: 1px;

    details {
      border: 1px solid var(--hr-color);
      border-radius: 8px;
      // padding: 10px 30px;
      font-size: 0.9rem;
      padding: 0 16px;
      line-height: 1.5;
      position: relative;

      p:nth-of-type(1) {
        padding-top: 0;
        margin-top: 0;
      }

      summary {
        cursor: pointer;
        padding: 10px 0;
        transition: margin 150ms ease-out;

        position: sticky;
        top: 0;
        background-color: var(--background-color);
        z-index: 2;
      }

      &[open] summary {
        border-bottom: 1px dotted var(--hr-color);
        margin-bottom: 15px;
      }
    }

    hr {
      border-width: 1px 0 0 0;
      border-color: var(--hr-color);
      margin: 32px auto;
      width: 20%;
    }

    .highlight {
      .lntd:first-child {
        // border-right: 1px solid lightgray;
        padding-right: 2px;
      }
      .lntd:last-child {
        padding-left: 12px;
      }
    }

    .highlight,
    details {
      margin-top: 16px;
      margin-bottom: 16px;
    }
  }

  &.logseq-post {
    .post-content {
      > ul {
        list-style-type: none;
        padding: 0;

        > li {
          margin-bottom: 1em;
        }
      }
    }
  }

  .toc-draw #TableOfContents,
  .toc-list #TableOfContents {
    ul {
      list-style-type: "\25B8\00A0";
      padding-left: 1rem;

      li {
        margin-bottom: 0.5rem;
      }
    }

    li ul {
      margin-top: 0.5rem;
    }
  }

  table {
    border-collapse: collapse;
    border: 1px solid var(--hr-color);
    border-radius: 4px;

    thead {
      background-color: var(--hr-color);
      // color: var(--background-color);
    }

    td,
    th {
      padding: 5px 10px;
    }
  }
}

@media screen and (min-width: variables.$breakpoint) {
  .post-container {
    padding-left: 30px;
    padding-right: 30px;
  }
}

.division .post-content,
.post-content {
  .heading {
    font-weight: 500;

    a {
      color: var(--heading-color);
    }
  }

  > p {
    line-height: 1.25;
  }

  > p > img {
    display: block;
    margin: auto;
  }

  .footnotes {
    font-size: 0.9em;
    line-height: 1.05;
  }
}

hr.endline {
  margin-top: 30px;
  border-width: 1px 0 0 0;
  border-color: var(--hr-color);
}

.tags {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;

  .tag {
    font-size: 0.75rem;
    background-color: var(--tag-color);
    padding: 2px 7px;
    border-radius: 4px;

    &.draft {
      background-color: orange;
      color: black;
    }

    .text {
      text-decoration: none;
    }

    &:hover {
      text-decoration: none;
    }
  }
}

.admonition {
  // TODO: Figure out how to distinguish admonitions
  --admonition-color: var(--note-color);

  background-color: var(--note-background-color);
  border-left: 4px solid var(--admonition-color);
  padding: 8px;
  font-size: 0.9rem;
  border-radius: 8px;

  .admonition-title {
    color: var(--admonition-color);
  }

  p {
    margin: 8px auto;
  }

  :first-child {
    margin-top: 0;
  }

  :last-child {
    margin-bottom: 0;
  }
}
