/* Reset */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
    scroll-padding: 16vh;
    font-synthesis: none;
}

:root {
    font-size: 14px;
}

@media (max-width: 512px) {
    :root {
        font-size: 12px;
    }
}

/* Variables */

:root {
    --primary-color: #f6f6f6;
    --secondary-color: #060606;
    --accent-color: #ebdbb3;

    --primary-color-light: #fafafa;
    --secondary-color-light: #767676;
}

/* Fonts */

@font-face {
    font-family: "Space Grotesk";
    src: url("../assets/fonts/space-grotesk/SpaceGrotesk-VariableFont_wght.ttf")
        format("truetype");

    font-style: normal;
    font-display: swap;
}
/* Layout */

body {
    font-family: "Space Grotesk", sans-serif;
    text-align: justify;
    text-justify: auto;

    color: var(--secondary-color);
    background-color: var(--primary-color);

    max-width: 640px;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto;
    padding: 1.5rem 1.5rem;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    width: 100%;
}

nav > a {
    font-size: 1.25rem;
    text-decoration: none;
    color: var(--secondary);
}

nav > ul {
    display: flex;
    flex-direction: row;
    gap: 2rem;
}

nav > ul > li {
    list-style-type: none;
    list-style-position: inside;
}

nav > ul > li > a {
    cursor: pointer;
    text-decoration: none;
    color: var(--secondary-color);
}

nav a {
    transition: opacity 0.5s ease-in-out;
}

nav a:hover {
    opacity: 0.6;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0;
}

main > * {
    width: 100%;
}

footer {
    margin-top: 2rem;
    color: var(--secondary-color-light);
    font-size: 0.875rem;
}

footer a {
    color: inherit;
    text-decoration: none;
}

footer span {
    padding: 0 0.5rem;
}
/* Headings */

h1,
h2,
h3,
h4 {
    margin-top: 1rem;
}

h1 {
    font-size: 1.25rem;
}

h2 {
    font-weight: 600;
    font-size: 1rem;
}

h3 {
    font-weight: 500;
    font-size: 1rem;
}

h4 {
    font-weight: 300;
    font-size: 1rem;
}

h1 + h2,
h2 + h3,
h3 + h4 {
    margin-top: 0.5rem;
}

/* Horizontal Rules */

hr {
    margin-top: 0.5rem;
    border-style: solid;
    border-color: var(--secondary-color-light);
}

/* Section Heads */

.sec-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-top: 2rem;

    h1,
    h2 {
        margin-top: 0;
    }

    hr {
        flex: 1;
        min-width: 2rem;
        margin: 0 0 0 0.5rem;
        border: none;
        border-top: 1px solid var(--secondary-color);
    }
}

.sec-num {
    font-size: 0.875rem;
    font-weight: 300;
    font-variant-numeric: tabular-nums;
    color: var(--secondary-color-light);
}

.sec-num::after {
    content: ".";
}

/* Paragraphs */

p {
    margin: 0.5rem 0;
}

/* Text */

::target-text {
    color: var(--secondary-color);
}

/* Mark */

::selection,
mark {
    background-color: var(--accent-color);
    padding: 0rem 0.25rem;
    border-radius: 0.25rem;
}

mark::selection {
    background-color: var(--secondary-color-light);
}

/* Lists */

ol,
ul {
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding-left: 1rem;

    li {
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
        padding-left: 0.5rem;
    }
}

/* Description Lists */

.dl-label {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--secondary-color-light);
}

dl {
    display: grid;
    grid-template-columns: minmax(2.5rem, max-content) 1fr;
    column-gap: 1.5rem;
    row-gap: 0.5rem;
    margin: 0.5rem 0 1rem;
    padding-left: 1rem;

    dt {
        grid-column: 1;
    }

    dd {
        grid-column: 2;
    }

    dd small {
        display: block;
        margin-top: 0.125rem;
        font-size: 0.875rem;
        font-weight: 300;
        color: var(--secondary-color-light);
    }
}

/* Links */

a {
    color: var(--secondary-color);
    text-decoration-style: underline;

    :visited {
        color: var(--secondary-color-light);
    }
}

a:is(.anchor),
a:is(.anchor):visited {
    font-size: inherit;
    font-weight: inherit;
    color: var(--secondary-color);
    text-decoration: none;
}

/* Quotes */

blockquote {
    margin: 0.5rem 0;
    padding-left: 1rem;
    border-left: 2px solid var(--secondary-color-light);

    ol,
    ul {
        padding-left: 1rem;
    }

    code {
        display: block;
        text-align: center;
        white-space-collapse: preserve-breaks;
        overflow-wrap: break-word;
        font-size: 1rem;
    }
}

/* Footnotes & References */

.footnote {
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--secondary-color);
}

.reference {
    font-weight: 300;
    text-decoration: none;
}

.footnote-table,
.reference-table {
    width: 100%;
    margin: 0.5rem 0;

    tbody {
        border: none;
    }

    td:first-child {
        padding-right: 0.5rem;
    }

    td {
        vertical-align: top;
    }
}

.footnote-target-id,
.reference-target-id {
    font-weight: 300;
    color: var(--secondary-color);
}

/* Tables */

table {
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.875rem;
}

thead {
    border-top: 1px solid var(--secondary-color);
}

tbody {
    border-top: 1px solid var(--secondary-color);
    border-bottom: 1px solid var(--secondary-color);
}

tr:is(:first-child),
tr:is(:last-child) {
    th,
    td {
        padding: 0.25rem 0;
    }
}

/* Images */

img {
    max-width: 100%;
    height: auto;
    margin: 0.5rem;
    background-color: inherit;
}

img:is(.full-image) {
    border-radius: 0.5rem;
    box-shadow: 0 0 0.75rem rgba(0, 0, 0, 0.1);
}

/* Citations and Captions */

cite,
figcaption {
    display: block;
    text-align: right;
    margin: 0.25rem 0;

    font-size: 0.875rem;
    font-weight: 300;
    color: var(--secondary-color);

    a {
        font-size: inherit;
        font-weight: inherit;
        font-style: inherit;
        color: var(--secondary-color);
        text-decoration: none;
    }
}
