/* Variables */
:root {
    --primary-color: #4f2b2b; /* Header and highlights primary color */
    --secondary-color: #f2eded; /* Default background color */
    --tertiary-color: #302c2c; /* Default background color */
    
    --text-foreground-color: black; /* Primary text background color */
    --text-background-color: #f4f0f0; /* Primary text background color */
    --highlight-background-color: #c7bdbd; /* Highlight background color */
    
    --link-background-color: #e8dede; /* Background color for links */
    --link-background-color-top: #502b2b; /* Background color for links */
    --link-hover-background-color: #bc1a1a; /* Background color for links on hover */
    --link-active-background-color: #a21616; /* Background color for links when clicked */
    
    --caption-color: #8e8080; /* Caption text color */
    --quote-color: #502b2b; /* Quote text color */
    --quote-background-color: #f2eded; /* Quote background color */
    
    --code-background-color: #f5f5f5; /* Code block background color */
    --code-border-color: #dbdbdb; /* Code block border color */

    --font-family-body: 'Merriweather', serif;
    --font-family-heading: 'Merriweather', serif;
    --font-family-monospace: 'Noto Sans Mono', monospace; /* Monospaced font */

    --fs-1: 1rem;
    --fs-2: 1.333rem;
    --fs-3: 1.777rem;
    --fs-4: 2.369rem;
    --fs-5: 3.157rem;
    --fs-small: 0.75rem;
}

/* Space */

body {
    font-family: var(--font-family-body);
    color: var(--text-foreground-color);
    background-image: url(bg-clockwork_and_soulsick-dark.webp);
    background-repeat: no-repeat;
    background-position-x: center;
    background-attachment: fixed;
    background-color: var(--tertiary-color);
    /* var(--primary-color);*/
    margin: 0;
    padding: 0;
}

.container {
    max-width: 80ch;
    /* Ensure both nav and main content share the same width */
    margin: 0 auto;
    /* Center the container */
    padding: 0 20px;
    /* Optional padding for spacing */
}

header {
    background-color: var(--tertiary-color);
    color: var(--secondary-color);
    padding: 1em 0;
}

nav {
    width: 100%;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-family-heading);
    color: var(--primary-color);
    text-wrap: balance;
}

.top-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: space-around;
    /* Ensure menu items are spaced evenly */
}

.top-menu li {
    margin-right: 15px;
}

.top-menu li a {
    color: var(--secondary-color);
    text-decoration: none;
    background-color: var(--link-background-color-top);
    padding: 5px 10px;
    border-radius: 3px;
}

.top-menu li a:hover {
    background-color: var(--link-hover-background-color);
}

.top-menu li a:active {
    background-color: var(--link-active-background-color);
}

main {
    display: flex;
    background-color: var(--text-background-color);
    margin-top: 20px;
    margin-bottom: 20px;
}

.content-area {
    flex: 3;
    margin-right: 20px;
}

article {
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 1em;
}

aside {
    flex: 1;
    width: 30ch;
    /* Limit the width to approximately 30 characters */
}

aside .highlight,
aside .sidebar,
.sidebar h1,
.sidebar h2,
.sidebar h3,
.sidebar h4,
.sidebar h5,
.sidebar h6 {
    background-color: var(--highlight-background-color);
    color: var(--primary-color);
}

aside .highlight {
    padding: 10px;
    margin-bottom: 10px;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    background-color: var(--link-background-color);
    padding: 3px 6px;
    border-radius: 3px;
}

article a,
aside a {
    padding: 1px 1px;
    border-radius: 3px;
}

a:hover {
    color: var(--secondary-color);
    background-color: var(--link-hover-background-color);
}

a:active {
    background-color: var(--link-active-background-color);
}

footer {
    background-color: var(--tertiary-color);
    color: var(--secondary-color);
    text-align: center;
    padding: 1em 0;
    margin-top: 0px;
}

footer p {
    margin: 0px;
    padding: 0px;
}

/* Size */

article h1 {
    font-size: var(--fs-5);
}

article h2 {
    font-size: var(--fs-4);
}

article h3 {
    font-size: var(--fs-3);
}

article h4,
aside h2 {
    font-size: var(--fs-2);
}

article p,
article li,
nav li,
aside p {
    font-size: var(--fs-1);
}

article ul,
article ol {
    margin: 16px 0;
    padding-left: 16px;
    /* Ensure the list aligns with the paragraph indent */
    list-style-position: outside;
    /* Ensures the bullet/number is within the text block */
}

article ul {
    list-style-type: disc;
}

article ul ul {
    list-style-type: circle;
    /* Nested unordered list style */
    padding-left: 20px;
}

article ol {
    list-style-type: decimal;
}

article ol ol {
    list-style-type: lower-alpha;
    /* Nested ordered list style */
    padding-left: 20px;
}

article li {
    margin: 8px 0;
}

footer p {
    font-size: var(--fs-1);
}

/* Image and Caption Styling */

article img,
.article-image {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
    display: block;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.figure {
    display: inline-block;
    max-width: 100%;
    margin: 20px 0;
    text-align: center;
}

.figure img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.figcaption {
    margin-top: 8px;
    font-size: 0.9em;
    color: var(--caption-color);
    font-style: italic;
    text-align: center;
    max-width: 100%;
}

/* Monospaced (Code) Area Styling */
article pre {
    font-family: var(--font-family-monospace);
    background-color: var(--code-background-color);
    border: 1px solid var(--code-border-color);
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    color: var(--primary-color);
    max-width: 60ch;
    /* Ensure code block does not exceed 80 characters */
    word-wrap: break-word;
    tab-width: 4;
    white-space: pre-wrap;
}

article code {
    font-family: var(--font-family-monospace);
    background-color: var(--code-background-color);
    padding: 2px 5px;
    font-size: 0.95em;
    border-radius: 3px;
    color: var(--primary-color);
    max-width: 60ch;
    /* Ensure code block does not exceed 80 characters */
    word-wrap: break-word;
}

/* Quote Styling */
article blockquote {
    margin: 20px 0;
    padding: 15px 20px;
    background-color: var(--quote-background-color);
    border-left: 5px solid var(--primary-color);
    color: var(--quote-color);
    font-style: italic;
    border-radius: 5px;
    max-width: 80ch;
    /* Ensure code block does not exceed 80 characters */
}

article blockquote p {
    margin: 0;
    margin-bottom: 1em;
}