html {
    font-family: 'regular', sans-serif;
    font-size: 18px;
}

@media(max-width: 572px) {
    html {
        font-size: 16px;
    }
}

body {
    background-color: $base;
    color: $text;
    width: 100%;
}

.column {
    max-width: 64ch;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

h1 {
    font-family: 'title', sans-serif;
    font-weight: bold;
    color: $text;

    &.latest {
        border-bottom: 4px dotted $surface2;
        margin-block-start: 0;
        margin-block-end: 1rem;
    }
}

h2 {
    font-family: 'title', sans-serif;
    font-weight: bold;
    color: $subtext1;
    margin-block: 2rem 1.5rem;
}

h3 {
    font-family: 'title', sans-serif;
    font-weight: bold;
    font-size: 1.25rem;
    color: $overlay1;
    margin-block: 1.5rem 1rem;
}

a {
    color: $blue;
    &:hover {
        color: $pink;
    }
}

hr {
    border-top: 4px;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    border-style: dotted;
    border-color: $surface2;
    margin-top: 2em;
    margin-bottom: 2em;
}

.header {
    background-color: #ea76cb;
    padding-top: 20px;
    padding-bottom: 40px;
    --a: 90deg; // the angle of the spikes
    --s: 40px;  // the size of spikes
    --mask: conic-gradient(from calc(var(--a)/-2) at bottom, #0000,#000 1deg var(--a),#0000 calc(var(--a) + 1deg)) 50%/var(--s);
    -webkit-mask: var(--mask);
    mask: var(--mask);

    .title {
        color: $base;
        .main {
            font-family: 'title', sans-serif;
            font-size: 2rem;
            a {
                text-decoration: none;
                color: $base;
                &:hover {
                    color: $blue;
                }
            }
        }
        .sub {
            font-family: 'title', sans-serif;
            font-size: 1.5rem;
        }
    }
    .menu {
        a {
            text-decoration: none;
            color: $base;
            font-weight: bold;
            &:hover {
                color: $blue;
            }
        }
    }
}

.about {
    display: flex;
    align-items: center;
    margin-bottom: 2em;

    > div:first-child {
        margin-right: 20px;
    }

    .blurb {
        flex: 1;
        font-family: 'title', sans-serif;
        font-size: 1.1rem;
        line-height: 1.3em;

        position: relative;
        border-radius: 40px;
        border: 4px solid $pink;
        padding-left: 20px;
        padding-right: 20px;
    }
    .blurb::after {
        content: '';
        position: absolute;
        right: 0;
        top: 50%;
        width: 0;
        height: 0;
        border: 20px solid transparent;
        border-left-color: $pink;
        border-right: 0;
        border-bottom: 0;
        margin-top: -10px;
        margin-right: -20px;
    }

    .portrait {
        width: 200px;
        height: 200px;
        > img {
            border-radius: 50%;
        }
    }
}

.projects {
    display: flex;
    margin-top: 1em;
    margin-bottom: 1em;

    a {
        opacity: 0.8;
    }

    a:not(:first-child) {
        margin-left: 10px;
    }

    a:hover {
        opacity: 1.0;
        transition: opacity 0.25s, background 0.25s;
    }

    img {
        border-radius: 20px;
    }
}

@media not (max-width: 572px) {
    .header {
        .column {
            display: flex;
            align-items: center;
        }
        .title {
            flex: 1;
        }
        .menu {
            .links {
                .link {
                    display: flex;
                    flex-direction: row-reverse;
                    i { margin-left: 10px; }
                }
            }
            a { font-size: 1.1rem; }
            i { font-size: 1.1rem; }
        }
    }
}

@media(max-width: 572px) {
    .header {
        .column { display: block; }
        .title {
            text-align: center;
        }
        .menu {
            text-align: center;
            .links {
                display: inline-block;
                margin-top: 10px;
                .link {
                    display: inline-block;
                    text-align: center;
                    &:not(:last-child) {
                        margin-right: 20px;
                    }
                }
            }
            a {
                font-size: 1.2rem;
                line-height: 1.5rem;
            }
            i { font-size: 1.5rem; }
        }
    }
    .about {
        .blurb {
            font-size: 1.05rem;
            line-height: 1.0rem;
            border-radius: 30px;
            border: 2px solid $pink;
            padding: 1px 15px 1px 15px;
            text-align: center;
        }
        .portrait {
            width: 80px;
            height: 80px;
        }
    }
}

.page {
    min-height: calc(100vh - 250px);
}

.content {
    margin-top: 2em;
    margin-bottom: 2em;

    p {
        margin-block: 1rem 1rem;

        code {
            background-color: $crust;
            font-style: normal;
            font-size: 0.9rem;
            padding-left: 5px;
            padding-right: 5px;
            border-radius: 4px;
        }
    }

    img {
        border-radius: 5px;
        margin-block: 1.5rem 1.5rem;
    }

    figure {
        margin-block: 1.5rem 1.5rem;
    }

    figure > img {
        margin: 0 auto;
    }

    figcaption {
        text-align: center;
        font-style: italic;
        font-size: 0.95rem;
        padding-top: 5px;
        color: $subtext1;
    }
}

.footer {
    border-top: 10px dotted $pink;
    color: $subtext1;
    text-align: center;

    p {
        font-style: italic;
    }

    > div {
        margin-top: 2em;
        margin-bottom: 2em;
    }

    a {
        text-decoration: none;
    }

    i {
        margin-left: 5px;
    }

    .theme i {
        font-size: 1.5rem;
    }
}

pre:has(code) {
    //background-color: $base !important;
    font-size: 0.9rem;
    border: 2px solid $surface0;
    border-radius: 10px;
    padding: 10px;
    margin-block: 0 1em;

    overflow-x: auto;
}

@media(max-width: 572px) {
    pre:has(code) {
        font-size: 0.8rem;
    }
}

blockquote+pre {
    border-top-left-radius: 0;
}

blockquote:has(+pre) {
    display: inline-block;

    font-family: 'code' !important;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0;
    margin-block: 0 0;

    background-color: $surface0;
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
    padding-left: 0.75rem;
    padding-right: 0.75rem;

    position: relative;
    top: 3px;

    p {
        margin-block: 0 0 !important;
        margin: 0 !important;
        position: inherit;
    }
}

blockquote:not(:has(+pre)) {
    background-color: $mantle;
    //padding: 1px 20px 1px 20px;
    padding: 1px 1rem 1px 1rem;
    border-radius: 10px;
    margin-block: 1rem 1rem;
    font-style: italic;

    :not(pre) code {
        //background-color: $surface0 !important;
        background-color: transparent !important;
        border: 1px dotted $text;
    }

    h1, h2 {
        font-family: 'regular';
        font-style: normal;
        font-size: 1rem;
        font-weight: 700;
        opacity: 75%;
        line-height: 1em;
        margin-block: 1rem 1rem;

        &:first-child {
            font-size: 1.1rem;
        }
    }

    p:has(cite) {
        text-align: right;
        font-weight: 500;
        color: $subtext0;

        cite::before {
            content: "— ";
        }
    }

    &:has(i:first-child) {
        background-color: transparent;
        color: $subtext1;
    }

    &:has(i.ri-error-warning-line) {
        color: $red;
        a, h1 { color: $red; }
        a:hover { color: $text; }
        code { border-color: $red; }
    }

    &:has(i.ri-lightbulb-line) {
        color: $blue;
        a, h1 { color: $blue; }
        a:hover { color: $text; }
        code { border-color: $blue; }
    }

    &:has(h2:first-child) {
        background-color: transparent;
        color: $blue;
        a, h2 {
            color: $blue;
        }
        a:hover {
            color: $text;
        }
        code {
            border-color: $blue;
        }
    }
}

.post {
    margin-block-start: 1rem;
    margin-block-end: 2rem;

    h1 {
        font-size: 1.5rem;
        a { text-decoration: none; }
    }
}

.post-meta {
    font-size: 0.9rem;
    color: $subtext0;
    font-style: italic;
    i {
        font-size: 0.95rem;
    }
    .item {
        margin-right: 0.5rem;
    }
    .tag {
        font-family: 'regular';
        font-weight: 500;
        text-decoration: none;
        margin-right: 0.5rem;
        i {
            margin-right: 4px;
        }
        a {
            text-decoration: none;
        }
    }
    a {
        text-decoration: none;
    }
}

.pages {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
    color: $text;

    > div {
        display: inline;
    }

    .number {
        span {
            padding-left: 8px;
            padding-right: 8px;
        }
        &:not(:has(a)) {
            background-color: $crust;
            border-radius: 5px;
        }
    }

    a {
        text-decoration: none;
    }
}

.feedback {
    font-style: italic;
    color: $subtext0;
    font-size: 0.9rem;
    a {
        white-space: nowrap;
    }
}

.prev-next {
    display: flex;
    margin-top: 2em;
    margin-bottom: 2em;
    a {
        text-decoration: none;
    }
    i {
        font-size: 1.5rem;
    }
    .upper {
        font-size: 0.9rem;
    }
    .prev {
        display: flex;
        align-items: center;
        i {
            margin-right: 10px;
        }
    }
    .mid {
        flex: 1;
        min-width: 20px;
    }
    .next {
        text-align: right;
        display: flex;
        align-items: center;
        i {
            margin-left: 10px;
        }
    }
    .lower {
        font-weight: bold;
    }
}

.tag-page {
    display: flex;

    h1 {
        margin-top: 0;
    }

    .tag-nav {
        font-weight: 600;
        margin-right: 20px;

        .tag-link {
            padding-left: 20px;
            padding-right: 20px;
            margin-bottom: 5px;

            &:not(:has(a)) {
                background-color: $crust;
                color: $text;
                border-radius: 10px;
            }
        }

        a {
            text-decoration: none;
        }
    }

    .tag-posts {
        flex: 1;
    }
}

.archive-posts {
    margin-left: 20px;
    font-weight: 500;

    .archive-item {
        display: flex;

        .short-date {
            min-width: 6ch;
            color: $overlay2;
        }

        a {
            text-decoration: none;
        }
    }
}

.more-posts {
    text-align: right;
    font-weight: 500;
    font-size: 1.1rem;
}


@media(max-width: 572px) {
    .tag-page {
        display: block;
        .tag-nav {
            display: flex;
            margin-bottom: 1rem;
            .tag-link {
                flex: 1;
                padding: 10px 10px 10px 10px;
                text-align: center;
                line-height: 1.2rem;

                i {
                    display: block;
                    padding-bottom: 4px;
                }
            }
        }
        .tag-posts {
            padding-bottom: 0.5rem;
        }
    }
    .archive-posts {
        font-size: 1.2rem;
    }
    .feedback {
        i {
            font-size: 0.9rem;
        }
    }
}

.toc-title {
    font-size: 1.1em;
    font-weight: bold;
    color: $subtext0;
}

.toc {
    ul {
        font-weight: 700;
        ul {
            font-weight: 500;
        }
    }
    a {
        text-decoration: none;
    }
}

ul {
    list-style-type: disc;
    ul > li::marker {
        color: $overlay1;
    }
}

ul {
    margin-block: 1rem 1rem;
    ul {
        margin-block: 0 0;
    }
}

ul:has(i) {
    padding-inline-start: 20px;
}

li:has(i:first-child) {
    list-style: none;
    i {
        margin-right: 2px;
    }
}

iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 0;
    padding: 0;
    //margin-block: 1rem 1rem;
}

/*
iframe:not(+p) {
    margin-block-end: 1rem;
}*/

.red { color: $red; }

.blue { color: $blue; }

table {
    border-collapse: collapse;
    -webkit-border-spacing: 0;
    border-spacing: 0;
    border-radius: 10px;
    overflow: hidden;
    margin-block: 1rem 1rem;

    code {
        font-size: 0.9rem;
        padding-left: 5px;
        padding-right: 5px;
        border-radius: 4px;
        border: 1px dotted $text;
    }

    td, th {
        padding: 5px 20px 5px 20px;
        text-align: left;
    }

    thead {
        background-color: $surface0;
    }
    tbody {
        tr:nth-child(odd) {
            background-color: $mantle;
        }
        tr:nth-child(even) {
            background-color: $crust;
        }
    }
}