/* ============================================
   Reset & Base
   ============================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition-duration: 150ms;
    transition-timing-function: ease-out;
}

::selection {
    background: #fff7b1;
}

/* ============================================
   Root & Typography Scale
   ============================================ */

:root {
    --text-column: 20rlh;
    --text-column-wider: 22rlh;
    --media-column: 28rlh;

    --color-bg: #fff;
    --color-text: #474747;
    --color-text-light: #999;
    --color-line: #eee;
    --color-mark: #bbb;
    --color-media-bg: #f9f9f9;
    --color-brand: #fff7b1;
    --color-brand-alt: #ffee50;
}

html {
    font-size: clamp(14px, 0.45vi + 12.42px, 26px);
    line-height: clamp(26px, 0.72vi + 22.75px, 48px);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family:
        "Iowan", "Iowan Old Style", "Iowan BT", "Palatino Linotype",
        "URW Palladio L", P052, serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.85;
    color: var(--color-text);
    background: var(--color-bg);
    padding: 5rlh 1rlh 1rlh;
    font-feature-settings: "kern", "liga", "clig", "calt";
    transition-duration: 150ms;
    transition-timing-function: ease-out;
}

/* ============================================
   Layout
   ============================================ */

main {
    max-width: var(--text-column);
    margin: 0 auto;
}

article {
    max-width: var(--text-column);
    margin: 0 auto;
}

/* ============================================
   Headings
   ============================================ */

h1 {
    font:
        700 1.6rem/1.5 "Iowan",
        "Iowan Old Style",
        "Iowan BT",
        "Palatino Linotype",
        "URW Palladio L",
        P052,
        serif;
    color: var(--color-text);
    margin-bottom: 1.5em;
}

h1 a {
    color: inherit;
    text-decoration: none;
    background: none;
}

h1 a:hover {
    background: none;
}

h2 {
    font:
        700 1.3rem/1.6 "Iowan",
        "Iowan Old Style",
        "Iowan BT",
        "Palatino Linotype",
        "URW Palladio L",
        P052,
        serif;
    color: var(--color-text);
    text-align: center;
    margin-top: 3em;
    margin-bottom: 1em;
}

h3 {
    font:
        700 1.15rem/1.7 "Iowan",
        "Iowan Old Style",
        "Iowan BT",
        "Palatino Linotype",
        "URW Palladio L",
        P052,
        serif;
    color: var(--color-text);
    text-align: center;
    margin-top: 2em;
    margin-bottom: 1em;
}

/* ============================================
   Paragraphs & Text
   ============================================ */

p {
    margin-bottom: 0.5rlh;
}

p + p {
    text-indent: 2ch;
}

small {
    font-size: 0.889rem;
    line-height: 0.889rlh;
}

/* ============================================
   Links
   ============================================ */

a {
    color: var(--color-text);
    text-decoration: underline;
    text-decoration-thickness: 0.5em;
    text-underline-offset: -0.25em;
    text-decoration-color: var(--color-brand);
    text-decoration-skip-ink: none;
    background-image: linear-gradient(
        to right,
        var(--color-brand),
        var(--color-brand-alt)
    );
    background-size: 300% 40%;
    background-position: 0% 100%;
    background-repeat: no-repeat;
    transition: background-position 150ms ease-out;
}

a:hover {
    background-position: 100% 100%;
}

/* ============================================
   Lists
   ============================================ */

ul,
ol {
    padding-left: 2ch;
    margin-bottom: 0.5rlh;
}

li {
    margin-bottom: 0.25em;
}

li::marker {
    color: #888;
}

/* ============================================
   Blockquotes
   ============================================ */

blockquote {
    max-width: var(--text-column-wider);
    margin: 1.5rlh auto;
    padding: 1rlh;
    border: 1px solid var(--color-line);
    border-radius: 2px;
    box-shadow: rgba(33, 35, 38, 0.1) 0px 10px 10px -10px;
    font-style: italic;
    position: relative;
}

blockquote::before {
    content: "❊ ❈ ❊";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-bg);
    padding: 0 0.25rem;
    text-align: center;
    color: var(--color-mark);
    font-style: normal;
}

blockquote:nth-child(odd)::before {
    content: "❈ ❊ ❈";
}

blockquote p:last-child {
    margin-bottom: 0;
}

/* ============================================
   Horizontal Rules (Decorative Dividers)
   ============================================ */

hr {
    border: none;
    margin: 2rlh 0;
    text-align: center;
    color: var(--color-mark);
}

hr::after {
    content: "✽ ✽ ✽";
    font-size: 0.86rem;
    letter-spacing: 0.5em;
}

/* ============================================
   Images & Media
   ============================================ */

figure.media {
    max-width: var(--media-column);
    margin: 2rlh auto;
    position: relative;
}

.media-content {
    padding: 1rlh;
    background: var(--color-media-bg);
    border-radius: 3px;
}

.media-content img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 4rlh);
    margin: auto;
    border-radius: 3px;
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.15);
}

figcaption {
    font:
        400 0.86rem/1.85 "Iowan",
        "Iowan Old Style",
        "Iowan BT",
        "Palatino Linotype",
        "URW Palladio L",
        P052,
        serif;
    font-style: italic;
    text-align: center;
    color: var(--color-text-light);
    margin-top: 1rem;
}

/* ============================================
   Code
   ============================================ */

code {
    font-family:
        ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas,
        "DejaVu Sans Mono", monospace;
    font-size: 0.86rem;
    line-height: 1.85;
    background: var(--color-media-bg);
    padding: 0.1em 0.3em;
    border-radius: 2px;
}

pre {
    margin: 1rlh 0;
    padding: 1rlh;
    background: var(--color-media-bg);
    border: 2px dashed #ccc;
    border-radius: 3px;
    overflow: auto;
}

pre code {
    background: none;
    padding: 0;
}

/* ============================================
   Responsive adjustments
   ============================================ */

@media (max-width: 600px) {
    body {
        padding: 3rlh 1rlh 1rlh;
    }
}
