/* Prevent layout shift caused by scrollbar appearing/disappearing */
html {
    scrollbar-gutter: stable;
    min-height: 100%;
    background-color: #111; /* Ensure background always fills viewport */
}

body {
    margin: 0;
    min-height: 100vh; /* IMPORTANT */
    font-family: Arial, sans-serif;
    color: #fff;
    background-color: #111;
    overflow-x: hidden;
}

/* =========================
   Navbar
========================= */
.topnav-wrapper {
    position: sticky;
    top: 0;
    width: 100%;
    backdrop-filter: blur(10px) brightness(50%);
    border-bottom: 1px solid rgb(134,0,134);
    box-shadow: 0 0 10px rgb(134,0,134);
    z-index: 1000;
}

.topnav {
    width: 800px;
    max-width: 90%;
    margin: 0 auto;
    display: flex;
    gap: 30px;
    padding: 20px 0;
    align-items: center;
}

.topnav a {
    color: rgb(200, 200, 255);
    text-decoration: none;
    position: relative;
}

.topnav a.active {
    color: rgb(134,0,134);
}

.topnav a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    height: 2px;
    width: 0;
    background: rgb(134,0,134);
    box-shadow: 0 0 10px rgb(134,0,134);
    transition: width 0.3s;
}

.topnav a:hover::after {
    width: 100%;
}

/* =========================
   Topnav "Light Mode" Button
========================= */
.topnav-action {
    position: absolute; /* position relative to topnav-wrapper */
    top: 50%; /* vertically center */
    transform: translateY(-50%) translateX(700px); /* half of .content width (800px / 2) */
    /* You can adjust 400px if max-width kicks in on smaller screens */
    padding: 0.6rem 20px;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid rgb(134,0,134);
    background: transparent;
    color: rgb(200,200,255);
    cursor: pointer;
    box-shadow: 0 0 10px rgb(134,0,134);
    transition: background 0.2s, box-shadow 0.2s;
}

.topnav-action:hover {
    background: rgba(134,0,134,0.2);
    box-shadow: 0 0 15px rgb(134,0,134);
}

/* =========================
   Layout
========================= */
.layout {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =========================
   Sidebar
========================= */
.sidemenu {
    position: fixed;
    top: 100px;
    left: calc(50% - 475px - 220px);
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    width: 200px;
    backdrop-filter: blur(5px) brightness(90%);
    border: 1px solid rgb(134,0,134);
    border-radius: 15px;
    box-shadow: 0 0 10px rgb(134,0,134);
    z-index: 5;
}

.sidemenu a {
    color: rgb(200, 200, 255);
    text-decoration: none;
    position: relative;
    padding-left: 10px;
}

.sidemenu a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: rgb(134,0,134);
    box-shadow: 0 0 10px rgb(134,0,134);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.3s ease;
}

.sidemenu a:hover::before,
.sidemenu a.active::before {
    transform: scaleY(1);
}

.sidemenu a.active {
    color: rgb(134,0,134);
}

/* =========================
   Main Content
========================= */
.content {
    position: relative;
    width: 800px;
    max-width: 90%;
    padding: 20px;
    margin: 40px auto;
    border-radius: 15px;
    backdrop-filter: blur(5px) brightness(90%);
    border: 1px solid rgb(134,0,134);
    box-shadow: 0 0 10px rgb(134,0,134);
    z-index: 10;
}

.content a {
    color: rgb(200, 200, 255);
    text-decoration: none;
}

.content a:hover {
    text-decoration: underline;
}

h1, h2 {
    color: rgb(200, 200, 255);
}

p {
    line-height: 1.6;
}

/* =========================
   Responsive
========================= */
@media (max-width: 900px) {
    .sidemenu {
        position: relative;
        top: 0;
        left: 0;
        width: 100%;
        margin-bottom: 20px;
    }

    .content {
        margin-top: 20px;
        width: 95%;
    }

    .topnav {
        width: 95%;
    }

    /* Keep button usable on mobile */
    .topnav-action {
        margin-left: 0;
    }
}
