@font-face {
    font-family: 'Roboto Slab';
    src: url('../fonts/RobotoSlab-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
}

@font-face {
    font-family: 'Audiowide';
    src: url('../fonts/Audiowide-Regular.ttf') format('truetype');
    font-style: normal;
}
/* Debug outline removed */


* {
    box-sizing: border-box;
}

/* Prevent oversized media from causing horizontal overflow */
img, svg, video, canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Wrap long words/URLs in main content to avoid overflow without affecting header */
.main-content p,
.main-content li,
.main-content h1,
.main-content h2,
.main-content h3,
.main-content h4,
.main-content h5,
.main-content h6,
.main-content a {
    overflow-wrap: anywhere;
    word-break: break-word;
}

body{
    display: grid;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    grid-template-columns: 18em 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas: 
        "header header"
        "sidebar main";
    background-color: #fafafa;
}

header {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: left;
    align-items: center;
    position: sticky;
    width: 100%;
    height: 100%;
    grid-area: header;
    background-color: #f2f3f3;
    box-shadow: 0 0px 10px #00000050; 
    top: 0;
    z-index: 2;
}
.logo {
    margin: 0.2em;
    margin-left: 2em;
    color: #69a03d;
    font-family: 'Audiowide';
    font-size: 3em;
}

#btn-sidebar {
    display: none;
    padding-left: 8px;
    padding-right: 8px;
    width: fit-content;
    height: fit-content;
    border: none;
    background-color: #f2f3f3;
    font-size: xx-large;   
}

main {
    display: flex;
    justify-content: center;
    transition: margin-left 0.3s ease;
    width: 100%;
    grid-area: main;
    padding: 0;
    overflow-y: auto;
    height: 100%;
    min-width: 0; /* allow grid item to shrink and avoid overflow */
}
.main-content {
    max-width: 900px;
    width: 100%;
    min-width: 0;
    padding: 2em 3em;
    padding-bottom: 6em;
    margin: 0 auto;
}
.main-content::after {
    content: "";
    display: block;
    height: 3em; /* global bottom spacer across all pages */
}
.main-content h1 {
    text-align: center;
}

.main-content h1::after {
    content: "";
    display: block;
    width: 96px;
    height: 4px;
    background-color: #69a03d;
    border-radius: 2px;
    margin: 1em auto 1em;
}

#sidebar {
    display: block;
    width: inherit;
    position: sticky;
    top: 60;
    height: 100%;
    background-color: #f2f3f3;
    box-shadow: 0 0px 10px #00000050; 
    z-index: 1;
    grid-area: sidebar;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    position: sticky;
    width: inherit;
    height: fit-content;
    top: 0px;
    height: calc(100% - 60px);
    margin-top: 4em;
}

.sidebar-content h2 {
    margin-top: 90px;
    margin-left: 5px;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 5px solid #69a03d;
}

.sidebar-content nav {
    margin-top: 0px;
    padding-left: 10px;
}

.sidebar-content nav ul {
    padding-left: 0;
    list-style: none;
}

.sidebar-content nav li {
    margin-top: 0px;
    margin-bottom: 30px;
    border-bottom: 3px solid #ccc;
    padding-bottom: 5px;
    color: #aa515123;
}

.sidebar-content nav a {
    color: #0000008c;
    text-decoration: none;
    font-size: 20px;
    font-weight: 500;
}

.sidebar-content nav a:hover {
    text-decoration: underline;
    color: #69a03d;
}

.sidebar-content .legal{
    margin-top: auto;
    padding-left: 10px;
    padding-bottom: 10px;
}

.sidebar-content .legal ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-content .legal a {
    color: #777777;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
}

.sidebar-content .legal a:hover {
    text-decoration: underline;
    color: #69a03d;
}

button {
    display: flex;
    justify-content: center;
    align-items: center;
}
button:disabled {
    color: #666;
}

label {
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
    width: fit-content;
}

input {
    min-width: 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    height: 2.5em;
    padding-left: 0.25em;
}

textarea {
    min-width: 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    font-family: 'Roboto Slab', Helvetica, Arial, sans-serif;
} 

textarea:focus, select:focus, input:focus {
    border-color: #69a03d;
    outline: none;
    box-shadow: 0 0 5px #69a03d66;
}

select {
    min-width: 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    height: 2.2em;
    background-color: white;
    justify-content: center;
}

.info-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5em;
    height: 1.5em;
    margin-left: 8px;
    background-color: #69a03d;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9em;
}

.info-text {
    inset: unset;
    background-color: #ffffff;
    max-width: 20em;
    border-radius: 5px;
    border: 1px solid #aaa;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    top:0;
}

@media (max-width: 1024px) {
    body {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "header"
            "main";
    }
    header {
        grid-template-columns: 5em 1fr 5em;
        justify-items: center;
        z-index: 10;
    }
    #btn-sidebar {
        display: block; 
        z-index: 10;
    }
    #btn-sidebar:hover {
        background-color: #e0e0e0;
    }
    #sidebar {
        display: none;
    }
    #sidebar.open {
        display: block;
        position: fixed;
        width: 16em;
        justify-self: left;
    }
    .sidebar-content {
        margin-top: 4em;
    }
    .logo {
        font-size: 2em;
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1.5em 1em;
        padding-bottom: 3em;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 1em 0.75em;
        padding-bottom: 2em;
    }
        header {
        grid-template-columns: 4em 1fr 4em;
        justify-items: center;
        z-index: 10;
    }
}