/* ==========================================================================
   1. GLOBAL RESET & BASE STYLES
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font: 18px/1.62 "Liberation Serif", "Noto Serif", "DejaVu Serif", Georgia, serif;
    font-style: normal;
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
    background: #f9f9f9;
}

main {
    color: #2c3e50;
}

/* ==========================================================================
   2. LINKS
   ========================================================================== */

a {
    color: rgb(43, 41, 41);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
}

a:hover {
    color: #6c757d;
}

a:focus-visible {
    outline: 2px solid #58a6ff;
    outline-offset: 2px;
}

ul {
    padding-left: 1rem;
}

/* ==========================================================================
   3. NAVIGATION
   ========================================================================== */

nav {
    display: flex;
    align-items: center;
    padding-bottom: 2rem;
    max-width: 100%;
    margin: 1rem auto 0 auto;
}

.nav-brand {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9rem;
    color: #596566; /* Original color was #7f8c8d */
    text-decoration: none;
    padding: 0.4rem 0.6rem;
    padding-left: 0;
}

.nav-links {
    margin-left: auto;
    display: flex;
    gap: 0.4rem;
}

.nav-links a {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9rem;
    text-decoration: none;
    color: #596566; /* Original color was #7f8c8d */
    padding: 0.4rem 0.6rem;
}

.nav-brand:hover,
.nav-links a:hover {
    color: rgb(31, 29, 29);
}

.nav-links a:last-child {
    padding-right: 0; /* Change from 0.6rem to 0 to align to the right card border */
}

/* ==========================================================================
   4. CONTENT CONTAINERS & TYPOGRAPHY
   ========================================================================== */

hr {
    margin-top: 1.2rem;
    margin-bottom: 1.4rem; /* Adjust by adding 1.2%+ to look visually correct */
    border: 0;
    border-top: 1px solid #ddd;
}

article,
.list-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    padding: 2.4rem;
    overflow-wrap: break-word;
}

article p,
article ul,
article ol,
.list-container p,
.list-container ul,
.list-container ol {
    font-size: 1.25rem;
    margin-top: 0;
    margin-bottom: 1.2rem;
    line-height: 1.65;
}

.title {
    text-transform: uppercase;
    color: #7f8c8d;
    text-align: center;
    letter-spacing: 2px;
    margin-top: 0;
    margin-bottom: 30px;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 15px;
    font-size: 1.3rem;
}

article h1,
article h2,
article h3,
article h4,
.list-container h1,
.list-container h2,
.list-container h3,
.list-container h4 {
    margin-top: 0;
}

/* Optional heading rhythm for Markdown content */

article h1,
.list-container h1 {
    font-size: 2rem;
    line-height: 1.2;
}

article h2,
.list-container h2 {
    font-size: 1.6rem;
    line-height: 1.3;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

article h3,
.list-container h3 {
    font-size: 1.3rem;
    line-height: 1.4;
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
}

article h4,
.list-container h4 {
    font-size: 1.1rem;
    line-height: 1.4;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

article > :first-child,
.list-container > :first-child {
    margin-top: 0;
}

article > :last-child,
.list-container > :last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   5. MEDIA
   ========================================================================== */

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================================================
   6. BLOCKQUOTES
   ========================================================================== */

blockquote {
    margin: 1em 0;
    padding: 0 2em;
    border-left: 3px solid #eee;
    font-style: italic;
}

blockquote p {
    margin: 0 0 0.6rem 0;
}

blockquote hr {
    margin: 0.8rem 0;
}

/* ==========================================================================
   7. CODE
   ========================================================================== */

pre {
    overflow-x: auto;
    padding: 1rem;
    border-radius: 6px;
    background: #f3f3f3;
    font-size: 0.95rem;
}

code {
    font-size: 0.9em;
}

pre code {
    font-size: inherit;
}

/* ==========================================================================
   8. TABLES
   ========================================================================== */

article table,
.list-container table {
    font-size: 1.25rem;
}

table {
    margin-left: 0;
    margin-top: 1.2rem;
    margin-bottom: 1.2rem;
    border-collapse: collapse;
}

th,
td {
    border: 1px solid rgb(102, 99, 99);
    padding-left: 10px;
    padding-right: 15px;
}

table.indented-table {
    margin-left: 1rem;
}

/* ==========================================================================
   9. UTILITIES
   ========================================================================== */

.list-style {
    margin-bottom: 0.5rem;
}

/* To equalize the padding at the top and bottom of the list (optional) */

.list-style:last-child {
    margin-bottom: 0;
}

.no-bullets {
    list-style-type: none;
    padding-left: 0;
}

.error-page-container {
    display: grid;
    place-content: center;
    height: 80vh;
    text-align: center;
}

/* ==========================================================================
   FOOTER / COPYRIGHT
   ========================================================================== */

.site-footer {
    text-align: center;
    margin-top: 2.5rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.site-footer p {
    font-size: 0.85rem;
    color: #596566;
    margin: 0;
    line-height: 1.4;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   10. DARK MODE
   ========================================================================== */

@media (prefers-color-scheme: dark) {

    body {
        color: #ccc;
        background: #1e1e1e;
    }

    main {
        color: #d5e0dd;
    }

    hr {
        border-top: 1px solid #3a3a3a;
    }

    article,
    .list-container {
        color: #d5e0dd;
        background: #272727;
    }

    .title {
        color: #a9afae;
        border-bottom: 2px solid #3a3a3a;
    }

    a {
        color: #58a6ff;
    }

    .nav-brand,
    .nav-links a {
        color: #a9afae;
    }

    .nav-brand:hover,
    .nav-links a:hover {
        color: #d5e0dd;
    }

    .site-footer p {
        color: #a9afae;
    }

    article a:hover,
    article a:focus,
    .list-container a:hover,
    .list-container a:focus {
        color: #8ab4f8;
    }

    blockquote {
        border-left: 3px solid #ccc;
    }

    pre {
        background: #1b1b1b;
    }
}

/* ==========================================================================
   11. MOBILE
   ========================================================================== */

@media (max-width: 480px) {

    body {
        background: #ffffff;
        padding: 18px;
    }

    article,
    .list-container {
        background: #ffffff;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
    }

    h2,
    .title {
        margin-bottom: 20px;
    }

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

    blockquote {
        padding: 0 1em;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        margin-left: 0;
    }

    table.indented-table {
        margin-left: 1rem;
    }

    a:active {
        color: rgb(43, 41, 41);
    }

    .site-footer {
        border-top: 1px solid #ddd;
        margin-top: 3rem;
        padding-top: 1rem;
    }
}

/* ==========================================================================
   12. MOBILE + DARK MODE
   ========================================================================== */

@media (max-width: 480px) and (prefers-color-scheme: dark) {

    body {
        background: #1e1e1e;
    }

    article,
    .list-container {
        background: #1e1e1e;
    }

    a:active,
    article ul a:active,
    article ol a:active,
    .list-container ul a:active,
    .list-container ol a:active {
        color: #8ab4f8;
    }

    .site-footer {
        border-top: 1px solid #3a3a3a;
    }
}
