* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-feature-settings: "kern" on, "liga" on;
    text-rendering: optimizeLegibility;
}

@font-face {
    font-family: 'Times New Bastard';
    src: url('fonts/TimesNewBastard-RegularWeb.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Times New Bastard';
    src: url('fonts/TimesNewBastard-BoldWeb.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'Times New Bastard';
    src: url('fonts/TimesNewBastard-ItalicWeb.ttf') format('truetype');
    font-weight: normal;
    font-style: italic;
}

@font-face {
    font-family: 'Times New Bastard';
    src: url('fonts/TimesNewBastard-BoldItalicWeb.ttf') format('truetype');
    font-weight: bold;
    font-style: italic;
}
@font-face {
    font-family: 'Arial Black';
    src: url('fonts/ArialBlack.ttf') format('truetype');
    font-weight: bold;
    font-style: italic;
}

body {
    font-family: 'Times New Bastard', 'Times New Roman', Times, serif;
    background-image: url('background.jpg');
    background-position: right top;
    background-size: cover;
    background-attachment: fixed;
    overflow-x: hidden;
}

.logo-container {
    position: fixed;
    top: 40px;
    left: 95px;
    z-index: 100;
}

.logo-container a {
    display: block;
    text-decoration: none;
}

.logo-bg {
    position: absolute;
    top: 5px;
    left: 8px;
    width: 370px;
    height: 75px;
    background: #f8f5e6;
    transform: rotate(-0.4deg);
    z-index: -1;
}

.logo {
    width: 380px;
    height: auto;
    position: relative;
    z-index: 1;
}

nav {
    position: fixed;
    top: 150px;
    left: 95px;
    display: flex;
    flex-direction: column;
    gap: 0;
    z-index: 100;
    font-family: 'Times New Bastard', 'Times New Roman', Times, serif;
}

nav a {
    display: inline-block;
    background: #f8f5e6;
    color: #364ca0;
    text-decoration: none;
    font-size: 22px;
    font-weight: bold;
    margin-bottom: -4px;
    position: relative;
    transition: background-color 0.2s;
    cursor: pointer;
    background-clip: content-box;
}

nav a::before {
    content: '';
    position: absolute;
    background: #f8f5e6;
    z-index: -1;
}

nav a:hover::before {
    background: #f0f0f0;
}

nav a.active {
    background: #364ca0;
    color: white;
}

nav a.active::before {
    background: #364ca0;
}

nav a.active:hover::before {
    background: #2d3d80;
}

/* Subsection styles */
.subsection {
    display: none;
    flex-direction: column;
    margin-left: 20px;
    margin-top: 2px;
    margin-bottom: 2px;
}

.subsection.active {
    display: flex;
}

.subsection a {
    font-size: 18px;
    font-weight: normal;
    margin-bottom: -3px;
}

/* Chaotic, inconsistent sizes and positioning */
nav a:nth-child(1) {
    width: 110px;
    padding: 6px 10px 8px 14px;
    transform: rotate(1.5deg);
    margin-left: 3px;
}

nav a:nth-child(1)::before {
    top: 4px;
    left: 8px;
    right: 8px;
    bottom: 5px;
}

nav .subsection:nth-child(2) a {
    padding: 5px 8px 6px 12px;
}

nav .subsection:nth-child(2) a:nth-child(1) {
    width: 95px;
    transform: rotate(-2deg);
    margin-left: 2px;
}

nav .subsection:nth-child(2) a:nth-child(1)::before {
    top: 3px;
    left: 7px;
    right: 7px;
    bottom: 4px;
}

nav .subsection:nth-child(2) a:nth-child(2) {
    width: 98px;
    transform: rotate(-0.3deg);
    margin-left: -1px;
}

nav .subsection:nth-child(2) a:nth-child(2)::before {
    top: 4px;
    left: 6px;
    right: 8px;
    bottom: 3px;
}

nav .subsection:nth-child(2) a:nth-child(3) {
    width: 115px;
    transform: rotate(0.1deg);
    margin-left: 4px;
}

nav .subsection:nth-child(2) a:nth-child(3)::before {
    top: 3px;
    left: 8px;
    right: 6px;
    bottom: 4px;
}

nav a:nth-child(3) {
    width: 210px;
    padding: 9px 8px 7px 16px;
    transform: rotate(-2deg);
    margin-left: -2px;
}

nav a:nth-child(3)::before {
    top: 5px;
    left: 7px;
    right: 7px;
    bottom: 4px;
}

nav .subsection:nth-child(4) a {
    padding: 5px 9px 6px 11px;
    transform: rotate(-3deg);
}

nav .subsection:nth-child(4) a:nth-child(1) {
    width: 165px;
    transform: rotate(-3deg);
    margin-left: 1px;
}

nav .subsection:nth-child(4) a:nth-child(1)::before {
    top: 3px;
    left: 6px;
    right: 8px;
    bottom: 4px;
}

nav .subsection:nth-child(4) a:nth-child(2) {
    width: 180px;
    transform: rotate(0.4deg);
    margin-left: 3px;
}

nav .subsection:nth-child(4) a:nth-child(2)::before {
    top: 4px;
    left: 7px;
    right: 6px;
    bottom: 3px;
}

nav .subsection:nth-child(4) a:nth-child(3) {
    width: 205px;
    transform: rotate(-2deg);
    margin-left: -2px;
}

nav .subsection:nth-child(4) a:nth-child(3)::before {
    top: 3px;
    left: 8px;
    right: 6px;
    bottom: 4px;
}

nav a:nth-child(5) {
    width: 168px;
    padding: 8px 14px 10px 11px;
    transform: rotate(-1deg);
    margin-left: 7px;
}

nav a:nth-child(5)::before {
    top: 5px;
    left: 8px;
    right: 8px;
    bottom: 6px;
}

nav a:nth-child(6) {
    width: 135px;
    margin-top: 5px;
    padding: 2px 4px;
    transform: rotate(-3deg);
    margin-left: -4px;
}

nav a:nth-child(6)::before {
    top: 4px;
    left: 7px;
    right: 7px;
    bottom: 5px;
}

nav a:nth-child(7) {
    width: 80px;
    padding: 2px 2px 2px 2px;
    transform: rotate(3deg);
    margin-top: 8px;
    margin-left: 20px;
}

nav a:nth-child(7)::before {
    top: 6px;
    left: 8px;
    right: 7px;
    bottom: 4px;
}

nav a:nth-child(8) {
    width: 145px;
    padding: 8px 16px 8px 10px;
    transform: rotate(-3deg);
    margin-left: 1px;
}

nav a:nth-child(8)::before {
    top: 5px;
    left: 7px;
    right: 9px;
    bottom: 5px;
}

.home-link {
    display: block;
    text-align: center;
    padding: 40px 20px;
    font-family: 'Times New Bastard', 'Times New Roman', Times, serif;
    font-size: 24px;
    color: #364ca0;
    text-decoration: none;
}

.home-link:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .logo-container {
        position: fixed;
        top: 20px;
        left: 20px;
        z-index: 200;
    }

    .logo {
        width: 220px;
    }

    .logo-bg {
        width: 220px;
        height: 45px;
    }

    nav {
        position: relative;
        top: auto;
        left: auto;
        margin-top: 80px;
        margin-left: 20px;
        margin-bottom: 40px;
    }

    nav a {
        font-size: 24px;
    }

    .subsection a {
        font-size: 18px;
    }

    nav a:nth-child(1),
    nav a:nth-child(5),
    nav a:nth-child(6),
    nav a:nth-child(7),
    nav a:nth-child(8) {
        width: auto;
        min-width: max-content;
        max-width: max-content;
        padding: 6px 10px;
        margin-left: 0;
        align-self: flex-start;
    }

    nav a:nth-child(3) {
        width: auto;
        min-width: max-content;
        max-width: max-content;
        padding: 9px 8px 7px 16px;
        margin-left: 0;
        align-self: flex-start;
    }

    nav a:nth-child(1)::before {
        top: 4px;
        left: 8px;
        right: 8px;
        bottom: 5px;
    }

    nav a:nth-child(3)::before {
        top: 5px;
        left: 7px;
        right: 7px;
        bottom: 4px;
    }

    nav a:nth-child(5)::before {
        top: 5px;
        left: 8px;
        right: 8px;
        bottom: 6px;
    }

    nav a:nth-child(6)::before {
        top: 4px;
        left: 7px;
        right: 7px;
        bottom: 5px;
    }

    nav a:nth-child(7)::before {
        top: 6px;
        left: 8px;
        right: 7px;
        bottom: 4px;
    }

    nav a:nth-child(8)::before {
        top: 5px;
        left: 7px;
        right: 9px;
        bottom: 5px;
    }

    .subsection {
        margin-left: 10px;
    }

    .subsection a {
        width: auto !important;
        min-width: max-content !important;
        max-width: max-content !important;
        padding: 5px 8px !important;
        margin-left: 0 !important;
        align-self: flex-start !important;
    }

    .subsection a::before {
        top: 3px !important;
        left: 6px !important;
        right: 6px !important;
        bottom: 3px !important;
    }

    nav .subsection:nth-child(2) a:nth-child(2) {
        padding: 5px 8px 6px 10px !important;
    }

    nav .subsection:nth-child(4) a:nth-child(1) {
        padding: 5px 9px 6px 11px !important;
    }

    nav .subsection:nth-child(4) a:nth-child(2) {
        padding: 5px 9px 6px 10px !important;
    }

    nav .subsection:nth-child(4) a:nth-child(3) {
        padding: 5px 12px 6px 12px !important;
    }

    .home-link {
        display: block;
        text-align: center;
        padding: 20px 20px 40px 20px;
        font-family: 'Times New Bastard', 'Times New Roman', Times, serif;
        font-size: 24px;
        color: #364ca0;
        text-decoration: none;
    }

    .home-link:hover {
        text-decoration: underline;
    }
}
