/* Variables*/
:root {
    --primary-color: #7e9ccf; 
    --secondary-color: #8fc1a9; 
    --accent-color: #b97ecf; 
    --text-color: #cbc6c0;
    --background-color: #1b1d1e;
    --card-background: #181a1b;
    --monospace-font: monospace;
    --sans-serif-font: sans-serif;
}

body {
    margin: 0;
    font-family: var(--sans-serif-font);
    background-color: #181a1b;
    color: var(--text-color);
    line-height: 1.6;
}

.page-wrapper {
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--background-color);
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

header {
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    margin-bottom: 30px;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

nav img {
    width: 70px;
    height: auto;
    object-fit: cover;
}

nav ul {
    display: flex;
    gap: 25px;
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.link, a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: bold;
    transition: color 0.3s ease;
}

.link:hover, a:hover,
.link:focus, a:focus {
    color: var(--accent-color);
    text-decoration: underline;
}

h1,
h2 {
    text-align: center;
    color: var(--primary-color);
    margin-top: 0;
}

h1 {
    padding: 30px 0;
    font-size: 2.5em;
    margin-bottom: 20px;
}

h2 {
    margin-top: 40px;
    margin-bottom: 20px;
    font-size: 1.8em;
}


h3, h4 {
    padding: 20px 0 10px 0;
    font-size: 1.5em;
    color: var(--secondary-color);
}

.container { 
    display: flex;
    gap: 30px; 
    flex-wrap: wrap; 
    justify-content: center;
    margin-top: 30px;
}

.introduction {
    flex-direction: column;
    gap: 15px;
}

.introduction p, .introduction ul, .introduction ol {
    margin-bottom: 15px;
}

.card {
    background-color: var(--card-background);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden; 
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: calc(33.333% - 20px);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card p {
    text-align: center;
    margin: 0; 
    padding: 15px;
    font-weight: bold;
    background-color: var(--primary-color);
    color: white;
}

.card a.link p {
    color: white;
}
.card a.link:hover p {
    background-color: var(--accent-color);
}


pre {
    background-color: #2d2d2d;
    color: #f0f0f0;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    font-family: var(--monospace-font);
    font-size: 0.9em;
    white-space: pre-wrap;
    word-wrap: break-word;
}

code {
    font-family: var(--monospace-font);
    background-color: rgba(0,0,0,0.05);
    padding: 2px 4px;
    border-radius: 3px;
}

pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid #eee;
    font-size: 0.9em;
    color: #777;
}

main > section:not(.container) {
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

main > section:not(.container) h2 {
    margin-top: 0;
    color: var(--primary-color);
}

main > section:not(.container) ul {
    padding-left: 20px;
}

.active-nav-link {
    color: var(--accent-color) !important;
    font-weight: bold;
    text-decoration: underline;
}

#backToTop {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    display: none;
    opacity: 0.8;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}
#backToTop:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* --- Media Queries--- */

/* Tablets*/
@media screen and (max-width: 1024px) {
    .page-wrapper {
        padding: 15px;
    }

    .card {
        width: calc(50% - 15px);
    }

    .title {
        font-size: 2em;
    }
    h2 {
        font-size: 1.6em;
    }
}

/* Mobiles */
@media screen and (max-width: 768px) {
    nav {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    nav ul {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        width: 100%;
    }
    nav ul li a {
        display: block;
        padding: 8px 0;
        text-align: center;
    }

    .container {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .card {
        width: 90%;
        max-width: 400px;
    }

    .card img {
        height: 180px;
    }

    .title {
        font-size: 1.8em;
        padding: 20px 0;
    }

    h2 {
        font-size: 1.4em;
    }
    h3.subtitle, h4.subtitle {
        font-size: 1.2em;
    }

    pre {
        font-size: 0.85em;
    }

    main > section:not(.container) {
        padding: 15px;
    }
}