.blog-container {
    display: flex;
    flex-direction: column;

    width: max(min(800px, 80vw), 300px);
    padding-top: 40px;
}

.blog-margin-bottom { 
    margin-bottom: 40px;
}

.blog-margin-bottom.markdown-body {
    margin-bottom: 200px;
}

.blog-image {
    width: max(min(1100px, 80vw), 300px);
    align-self: center;
}

.blog-title {
    font-size: 30pt;
    font-weight: 500;
    color: var(--clr-secondary);
}

.blog-tags {
    font-size: 12pt;
    color: var(--clr-accent-2);
}

.blog-author-date-container {
    color: var(--clr-secondary);
    display: flex;
    font-size: 12pt;
    gap: 5px;
}

.blog-date {
    color: var(--clr-tertiary);
}

.blog-reading-time {
    color: var(--clr-accent-2);
    font-weight: 500;
}

.markdown-body {
    display: flex;
    flex-direction: column;
    color: var(--clr-secondary);
}

.markdown-body h1 {
    font-size: 27pt;
    font-weight: 500;
}

.markdown-body h2 {
    font-size: 24pt;
}

.markdown-body h3 {
    font-size: 21pt;
    font-weight: 300;
}

.markdown-body h4 {
    font-size: 21pt;
    font-weight: 200;
    color: var(--clr-tertiary)
}

.markdown-body h5 {
    font-size: 18pt;
    font-weight: 200;
    color: var(--clr-tertiary)
}

.markdown-body h6 {
    font-size: 15pt;
    font-weight: 200;
    color: var(--clr-tertiary)
}

.markdown-body strong {
    font-weight: 600;
}

.markdown-body code {
    background-color: #2d2d2d;
    color: #f8f8f8;
    padding: 0.2em 0.8em;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.95em;
}

.markdown-body pre {
    position: relative;
    background-color: #2d2d2d; /* dark background */
    color: #f8f8f2;            /* light text */
    padding: 2rem;
    border-radius: 6px;
    overflow-x: auto;           /* horizontal scroll if code is too wide */
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
}

.markdown-body pre .code-label {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #444;
    color: #fff;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 3px;
    text-transform: lowercase;
}

.markdown-body pre code {
  background: none;           /* remove inline bg since pre already has bg */
  color: inherit;
  font-family: inherit;
}

.markdown-body blockquote {
    --left-spacing: 24px;

    border-left: 2px solid var(--clr-accent-2);
    padding-left: var(--left-spacing);
    margin: 0px 0px;
    color: var(--clr-tertiary);
    background: #EFEFEF;
    font-style: italic;

    overflow: hidden;
}

.markdown-body > blockquote {
    margin: 16px 0px;
}

.markdown-body blockquote strong {
    color: var(--clr-secondary);
}

.markdown-body li {
    padding: 4px 0px;
}

.markdown-body li > ul > li {
    font-weight: 300;
}

.markdown-body li > ul > li > ul > li {
    font-weight: 200;
}

.markdown-body > p:has(img) {
    width: max(min(1100px, 80vw), 300px);
    display: flex;
    flex-direction: column;
    align-self: center;
}

.markdown-body p > img
{
    width: 100%;
    margin: 10px 0px;
    align-self: center;
}

.markdown-body a {
    color: var(--clr-accent-1);
    font-weight: 600;
    text-decoration: none;
}

/* TODO: Make anchor tags open in a new tab by making a custom renderer */
.markdown-body a:hover {
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

.markdown-body thead,
.markdown-body table
{
    border: 2px solid var(--clr-secondary);
    border-collapse: separate;
    border-spacing: 0;
}

.markdown-body th,
.markdown-body td
{
    white-space: nowrap;
    padding: 6px;
}

.markdown-body th {
    font-weight: 600;
    color: var(--clr-primary);
    background: var(--clr-secondary);
}

.markdown-body td {
    font-weight: 300;
    color: var(--clr-secondary);
    background: var(--clr-primary);
}

.markdown-body tr td:not(:first-child):not(:last-child),
.markdown-body tr th:not(:first-child):not(:last-child)
{
    --clr-inner-border: #00000010;
    border-right: 1px solid var(--clr-inner-border);
    border-left: 1px solid var(--clr-inner-border);
    border-spacing: 2px;
}

.markdown-body .table-wrapper {
    /* Ensure the table view can fit in the viewport */
    align-self: center;
    /* width: clamp(0px, 80vw, 100%); */
    max-width: 80vw;
    max-height: 60vh;

    overflow-x: scroll;
    overflow-y: scroll;
}

.markdown-body table {
    width: 100%;
}

.markdown-body hr {
    width: 100%;
    background: var(--clr-tertiary);
}

/* For mobile devices */
@media (max-width: 500px) {
    .blog-container {
        width: max(min(500px, 90vw), 100px);
    }

    .blog-title {
        font-size: 24pt;
    }

    .blog-tags {
        font-size: 10pt;
    }

    .blog-author-date-container {
        flex-direction: column;
        font-size: 10pt;
        gap: 0px;
    }

    .blog-author-date-container > :nth-child(even) {
        display: none;
    }

    .markdown-body h1 {
        font-size: 24pt;
    }

    .markdown-body h2 {
        font-size: 21pt;
    }

    .markdown-body h3 {
        font-size: 18pt;
    }

    .markdown-body h4 {
        font-size: 18pt;
    }

    .markdown-body h5 {
        font-size: 16pt;
    }

    .markdown-body h6 {
        font-size: 14pt;
    }

    .markdown-body p,
    .markdown-body li
    {
        font-size: 12pt;
    }

    .markdown-body code,
    .markdown-body td,
    .markdown-body th
    {
        font-size: 8pt;
    }

    .markdown-body pre div.code-label {
        font-size: 12pt;
    }
}
