@font-face {
    font-family: "Courier Prime";
    src:
        local("Courier Prime Regular"),
        local("CourierPrime-Regular"),
        url("./fonts/CourierPrime-Regular.woff2") format("woff2");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Courier Prime";
    src:
        local("Courier Prime Bold"),
        local("CourierPrime-Bold"),
        url("./fonts/CourierPrime-Bold.woff2") format("woff2");
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

:root {
    --text: black;
    --bg: white;
    --faint: gray;
}

[data-theme="blue"] {
    --text: hsl(200 50% 20%);
    --bg: hsl(200 50% 95%);
    --faint: hsl(200 10% 45%);
}

[data-theme="sepia"] {
    --text: hsl(45 25% 10%);
    --bg: hsl(45 25% 95%);
    --faint: hsl(45 10% 45%);
}

[data-font="monospace"] {
    font-family: monospace;
}

[data-font="sans-serif"] {
    font-family: sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Courier Prime", Courier, monospace;
    line-height: 1.3;
}

/* container styles */

nav {
    background: var(--text);
    color: var(--bg);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

nav div:has(#logout_form) {
    display: inline-flex;
    gap: 1rem;
}

main {
    max-width: 420px;
    margin: auto;
    padding: 8rem 0;
}

nav + main {
    padding: 6rem 0;
}

@media only screen and (max-width: calc(420px + 2rem)) {
    main {
        padding: 3rem 1rem;
    }

    nav + main {
        padding: 2rem 1rem;
    }
}

main header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
}

main header:has(.editing) {
    padding-bottom: 2rem;
}

.content {
    padding-bottom: 1rem;
}

/* text styles */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-size: inherit;
}

h1.editing {
    color: var(--faint);
    font-style: italic;
    font-weight: normal;
}

nav a {
    display: inline;
}

a {
    color: inherit;
    text-decoration-thickness: 1px;
}

p {
    padding-bottom: 1rem;
}

main header a {
    font-weight: bold;
    text-decoration: none;
}

/* list styles */

main ul {
    padding-left: 1rem;
}

main ul.drafts {
    margin-bottom: 1rem;
    list-style-type: circle;
}

main ul.drafts li a {
    color: var(--faint);
}

main ul:not(.drafts) {
    font-weight: bold;
}

main ul li a {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* form styles */

#login_form input {
    font-weight: normal;
    border: 1px solid;
    border-radius: 12px;
    box-shadow: inset 1px 1px var(--faint);
    padding: 8px 12px;
}

#login_form input[type="password"] {
    margin-bottom: 1rem;
}

#logout_form {
    display: inline-block;
}

label[for="intro"] {
    display: inline-block;
    margin-bottom: 1rem;
}

#intro {
    border: 1px solid;
    border-radius: 12px;
    box-shadow: inset 1px 1px lightgray;
    min-height: 100px;
    padding: 8px 12px;
}

fieldset {
    border: none;
    margin-bottom: 1rem;
}

fieldset legend {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

fieldset label {
    display: block;
}

fieldset input[type="radio"] {
    display: inline;
    width: auto;
    margin-right: 0.5rem;
    font-weight: normal;
}

.actions {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
}

form input,
form textarea,
form button {
    background: inherit;
    border: none;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

form input,
form textarea {
    background: white;
}

#blog_post_form input,
#blog_post_form textarea {
    background: inherit;
}

form input:focus,
form textarea:focus,
form button:focus {
    outline: none;
}

form input,
form textarea {
    width: 100%;
}

form input {
    display: block;
    font-weight: bold;
    margin-bottom: 1rem;
}

form textarea {
    resize: vertical;
    field-sizing: content;
    margin-bottom: 1rem;
    overflow: hidden;
    padding-bottom: 1rem;
}

form textarea[name="title"] {
    padding-bottom: 0;
    font-weight: bold;
    resize: none;
}

form button {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

/* icons */

.back-arrow {
    display: inline-block;
    font-weight: bold;
    text-decoration: none;
    margin-bottom: 2rem;
}
