@import url("./fonts.css");
@import url("./colors.css");

/* -- Variables ----------------------------------------------- */

:root {
    --sans: "Roboto Flex", ui-sans-serif, sans-serif;
    --serif: "Source Serif 4", ui-serif;
    --mono: "Monaspace Argon", ui-monospace, monospace;

    --roboto-vars: "wdth" 115, "YOPQ" 55;

    --layout-content-width: 65ch;
    --layout-content-max-width: calc(100vw - 2rem);
    --layout-page-bottom-space: 10em;

    color-scheme: light;
    font: -apple-system-body;
    font-size: 18px;
    font-family: var(--serif);
    font-weight: 450;
    line-height: 1.5;
}

/* -- Layout -------------------------------------------------- */

body {
    margin: 0;
    position: relative;
    color: var(--color-tx);
    background-color: var(--color-bg);
    /* This matches macOS and iOS rendering: */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

header {
    border-bottom: 1px solid var(--color-ui);
    font-family: var(--sans);
    font-variation-settings: var(--roboto-vars);
    font-weight: 425;
}

.header-inner {
    max-width: var(--layout-content-width);
    margin: 0 auto;
    height: 2.6rem;
    padding: 1.4rem 1rem 0 1rem;
    display: flex;
    align-items: baseline;
    gap: 2rem;
}

.site-title {
    text-decoration: none;
    font-weight: 600;
}

main {
    max-width: var(--layout-content-width);
    margin: 0 auto var(--layout-page-bottom-space);
    padding: 0 1rem;
}

.smallcaps {
    font-variant-caps: all-small-caps;
}

h1 .smallcaps, h2 .smallcaps, h3 .smallcaps {
    font-variant-caps: normal;
    text-transform: uppercase;
}


/* -- Navigation ---------------------------------------------- */

.header-nav {
    margin-left: auto;
    display: flex;
}

.header-nav ul {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header-nav a {
    text-decoration: none;
}

.header-nav a.active {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-decoration-color: var(--color-ui-2);
}

/* -- Typography ---------------------------------------------- */

h1#hello-im-oliver-taylor {
    font-size: 1.5rem;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--sans);
    font-variation-settings: var(--roboto-vars);
    font-weight: 500;
}

h1 {
    font-size: 1.6rem;
    line-height: 1.25;
    margin: 4rem 0 4rem 0;
}

h2 {
    font-size: 1.3rem;
    margin: 4rem 0;
}

h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 4rem 0 0 0;
}

h2 + h3 {
    margin-top: 3rem;
}

p {
    margin-block-end: 1.5em;
}

b, strong {
    font-weight: 600;
}

a {
    color: inherit;
    text-decoration-color: var(--color-ln);
    text-decoration-style: underline;
    text-underline-offset: 2px;
}

a:hover {
    background-color: var(--color-bg-2);
}

a.en {
    text-decoration: none;
    font-family: var(--sans);
    font-variation-settings: var(--roboto-vars);
    font-size: 0.8rem;
    padding: 0 0.1rem 0;
    margin: 0 0.1rem;
    border: 1px solid var(--color-ln);
    border-radius: 3px;
    display: inline-block;
    position: relative;
    top: -0.25em;
}

dt {
    margin-top: 1em;
}

/* -- Content Elements ---------------------------------------- */

img {
    max-width: 100%;
}

code {
    font-family: var(--mono);
    font-size: 1rem;
    line-height: 0.5; /* needed for mono font */
    font-weight: 350;
    color: var(--color-bl);
}

pre {
    overflow-x: auto;
    padding: 7px 10px;
    line-height: 1.2;
}

pre code {
    font-size: .95rem;
}

blockquote {
    font-family: var(--serif);
    margin: 1rem;
    padding-left: 1.4rem;
}

.callout {
    margin: 0 1.4rem 0 1.4rem;
    font-style: italic;
}

.callout > :first-child {
    text-indent: -1em;
}
.callout > :first-child::before {
    content: "¶ \2008";
    color: var(--color-re);
}

time.permalink {
    font-family: var(--mono);
    font-weight: 400;
    color: var(--color-tx-2);
}

time.permalink:before {
    content: "∵ "
}

time.permalink a {
    text-decoration: none;
}

.date {
    font-family: var(--sans);
    font-variation-settings: var(--roboto-vars);
    color: var(--color-tx-3);
}

.date a {
    text-decoration: none;
}

.date a:hover {
    text-decoration: underline;
}

hr {
    border: none;
    height: 1px;
    background-color: var(--color-ui);
    margin: 2em;
}

figure {
    margin: 1em auto;
    padding: 0;
    border: 1px solid var(--color-ui);
    background-color: var(--color-bg-2);
    max-width: 100%;
    box-sizing: border-box;
    width: fit-content;
}

figure img {
    display: block;
}

figure p {
    margin-top: 0;
    margin-bottom: 0;
}

figure.small {
    max-width: 60%;
}

figcaption {
    font-family: var(--sans);
    font-variation-settings: var(--roboto-vars);
    font-weight: 400;
    font-size: 0.85rem;
    text-align: center;
    padding: 0.6rem 0 0.4rem 0;
}

.sans {
    font-family: var(--sans);
    font-variation-settings: var(--roboto-vars);
}

/* -- Links Page ---------------------------------------------- */

h2#links {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-ui);
    margin-bottom: 1.5em;
}

div.link {
    margin-bottom: 1.5em;
    padding-bottom: 1em;
    border-bottom: 1px solid var(--color-ui);
}


/* -- Global -------------------------------------------------- */

::selection {
    background-color: var(--color-bg-2);
    color: var(--color-tx);
}

/* -- Responsive ---------------------------------------------- */

@media (max-width: 480px) {
    .header-inner {
        height: auto;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.1rem;
        padding: 0.5rem 1rem;
    }

    .header-nav {
        margin-left: 0;
    }

    .header-nav ul {
        gap: 1rem;
    }
}
