/* Palette adapted from AstroPaper by Sat Naing. See astropaper.LICENSE.txt. */
@font-face {
    font-family: "Google Sans Code";
    font-style: normal;
    font-weight: 300 800;
    font-display: swap;
    src: url("../fonts/google-sans-code/google-sans-code-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C4,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
    font-family: "Google Sans Code";
    font-style: normal;
    font-weight: 300 800;
    font-display: swap;
    src: url("../fonts/google-sans-code/google-sans-code-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
    color-scheme: dark;
    --background: #212737;
    --foreground: #eaedf3;
    --accent: #ff6b01;
    --muted: #afb9ca;
    --rule: #ab4b08;
    --surface: #1a1f2d;
    --border: #52617b;
    background: var(--background);
    color: var(--foreground);
    font-family: "Google Sans Code", ui-monospace, Consolas, monospace;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

a {
    color: var(--accent);
    text-underline-offset: 0.22em;
}

:focus-visible {
    outline: 2px dashed var(--accent);
    outline-offset: 4px;
}

img {
    max-width: 100%;
    height: auto;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
}

h1 {
    margin: 0 0 1.6rem;
    font-size: clamp(1.7rem, 4vw, 2.05rem);
    font-weight: 700;
}

.muted {
    color: var(--muted);
}

.site-shell {
    width: min(46rem, calc(100% - 2rem));
    margin-inline: auto;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1;
    padding: 0.5rem 0.75rem;
    transform: translateY(-150%);
    background: var(--surface);
}

.skip-link:focus {
    transform: none;
}

.site-header,
.site-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem 1rem;
}

.site-header {
    min-height: 5rem;
    padding-block: 0.85rem;
    border-bottom: 1px solid var(--rule);
}

.brand {
    color: var(--foreground);
    font-size: 1.4rem;
    font-weight: 700;
    text-decoration: none;
}

.site-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav a {
    display: block;
    padding-block: 0.45rem;
    color: var(--foreground);
    text-decoration: none;
}

.site-nav a[aria-current] {
    text-decoration-line: underline;
    text-decoration-style: wavy;
    text-underline-offset: 0.36em;
}

.site-nav a:hover,
.brand:hover {
    color: var(--accent);
}

main.site-shell {
    flex: 1;
    padding-block: 2.05rem 3.5rem;
}

.post-list {
    display: grid;
    gap: 1.6rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.post-preview h2 {
    margin: 0 0 0.25rem;
    font-size: 1.125rem;
    font-weight: 600;
}

.post-preview h2 a {
    text-decoration: none;
}

.post-preview h2 a:hover {
    text-decoration: underline;
}

.post-preview p {
    margin: 0.15rem 0 0;
    line-height: 1.55;
}

.post-date {
    display: block;
    color: var(--muted);
    font-size: 0.875rem;
}

.archive-link {
    display: inline-block;
    margin-top: 2rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 0.65rem;
    color: var(--muted);
    text-decoration: none;
}

.back-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.article-header {
    margin-bottom: 1.85rem;
}

.article-header h1 {
    margin-bottom: 0.45rem;
    color: var(--accent);
}

.article-cover {
    display: block;
    width: 100%;
    margin-bottom: 1.85rem;
    border: 1px solid var(--rule);
}

.rich-content {
    overflow-x: auto;
    line-height: 1.75;
}

.rich-content > :first-child {
    margin-top: 0;
}

.rich-content > :last-child {
    margin-bottom: 0;
}

.rich-content :is(h2, h3, h4, h5, h6) {
    margin: 1.9em 0 0.55em;
}

.rich-content :is(p, ul, ol, figure, blockquote, pre, table) {
    margin-block: 1em;
}

.rich-content ul {
    padding-inline-start: 1.6em;
}

.rich-content ol {
    padding-inline-start: 3em;
}

.rich-content blockquote {
    margin-inline: 0;
    padding-inline-start: 1em;
    border-inline-start: 2px solid var(--rule);
    color: var(--muted);
}

.rich-content figure {
    margin-inline: 0;
}

.rich-content img {
    max-width: 100% !important;
    height: auto !important;
}

.rich-content figcaption {
    color: var(--muted);
    font-size: 0.875rem;
}

.rich-content :is(pre, code) {
    font: inherit;
    background: var(--surface);
}

.rich-content :not(pre) > code {
    padding: 0.1em 0.35em;
    border-radius: 0.2em;
}

.rich-content pre {
    overflow-x: auto;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    font-size: 0.9rem;
    overflow-wrap: normal;
}

.rich-content pre code {
    background: transparent;
}

.rich-content table {
    max-width: 100%;
    border-collapse: collapse;
}

.rich-content :is(th, td) {
    padding: 0.5em 0.7em;
    border: 1px solid var(--border);
}

.rich-content hr {
    border: 0;
    border-top: 1px solid var(--border);
}

.contact-details {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.4rem 1.15rem;
    margin: 0 0 2rem;
}

.contact-details dt {
    color: var(--muted);
}

.contact-details dd {
    margin: 0;
}

.contact-form,
.form-grid {
    display: grid;
    gap: 1rem;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.contact-form label {
    display: grid;
    gap: 0.35rem;
}

.contact-form :is(input, textarea, button) {
    font: inherit;
    border-radius: 0.25rem;
}

.contact-form :is(input, textarea) {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--foreground);
}

.contact-form textarea {
    resize: vertical;
}

.contact-form button {
    justify-self: start;
    padding: 0.55rem 1rem;
    border: 1px solid transparent;
    background: var(--accent);
    color: #1a1f2d;
    font-weight: 700;
    cursor: pointer;
}

.contact-form button:hover {
    background: #ff8b38;
}

.flash {
    padding: 0.65rem 0.85rem;
    margin: 1rem 0 0;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    background: var(--surface);
}

.flash-success {
    border-color: #6bac8a;
}

.flash-error {
    border-color: #e38882;
}

.site-footer {
    padding-block: 1.15rem;
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 0.875rem;
}

.site-footer small {
    font-size: inherit;
}

@media (max-width: 40rem) {
    .site-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.25rem;
    }

    .site-nav ul {
        gap: 0.1rem 0.8rem;
        font-size: 0.9rem;
    }

    main.site-shell {
        padding-block: 1.6rem 2.5rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}
