:root {
    --primary: #249A27;
    --secondary: #5cb75f;
    --toolbar: #436d16;
    --accent: #ff6b6b;
    --accent-hover: #ff5252;
    --text: #333333;
    --light: #e3dbd3;
    --white: #ffffff;
    --bgmain: #f4f7f6;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100vh;
    max-width: 100%;
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background-color: var(--light);
    line-height: 1.6;
    display: grid;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "header"
        "main"
        "footer";
    height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Common Layout - subpages */
.page-header {
    padding: 3rem 2rem;
    background: var(--primary);
    color: var(--white);
    text-align: center;
}

.page-header h1 {
    margin-bottom: 0.5rem;
    font-size: 2.4rem;
}

.page-header p {
    font-size: 1.1rem;
    opacity: 0.85;
}

.content {
    max-width: 860px;
    margin: 3rem auto;
    padding: 0 2rem;
}

.content a {
    color: var(--primary);
}

.site-header {
    grid-area: header;
    background-color: var(--toolbar);
    color: var(--white);
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 1rem 2rem;
    position: relative;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.logo span {
    color: var(--accent);
}

.active-link {
    color: var(--accent) !important;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* Hamburger Menu */
.menu-toggle {
    display: none;
}

.hamburger-label {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    grid-column: 2;
}

.hamburger-label span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: var(--white);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.menu-toggle:checked~.hamburger-label span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.menu-toggle:checked~.hamburger-label span:nth-child(2) {
    opacity: 0;
}

.menu-toggle:checked~.hamburger-label span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

.site-nav {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 200;
    width: min(18rem, 85vw);
    max-height: none;
    overflow: hidden;
    background-color: var(--toolbar);
    box-shadow: -4px 8px 16px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s ease-out;
}

.site-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    padding-top: 1rem;
}

.site-nav a {
    display: block;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 500;
    transition: color 0.2s;
    margin-left: 1rem;
}

.site-nav a:hover {
    color: var(--accent);
}

.site-nav ul.submenu {
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    height: 0px;
    position: absolute;
    background-color: var(--toolbar);
    box-shadow: -4px 8px 16px rgba(0, 0, 0, 0.2);
    text-align: left;

    /* Koppel aan het gedefinieerde anker */
    position-anchor: --menuAnchor;

    /* Plaats het submenu direct onder het anker, uitgelijnd aan de linkerkant */
    position-area: bottom left;

    /* Optioneel: zorg dat het submenu minimaal net zo breed is als de knop */
    min-width: anchor-size(width);

}

.has-submenu:hover .submenu,
.has-submenu:focus-within .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    height: fit-content;
    anchor-name: --menuAnchor;
    padding-left: 0px;

    a {
        margin-left: auto;
    }
}

@media (max-width: 768px) {

    .has-submenu:hover .submenu,
    .has-submenu:focus-within .submenu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        height: fit-content;
        anchor-name: --menuAnchor;
        padding-left: 0px;

        a {
            margin-left: auto;
        }
    }
}


/*@media (hover: none) , */
@media (max-width: 768px) {
    .has-submenu.is-focused-within .submenu {
        opacity: 1;
        visibility: visible;
        transform: translateY(-100%);
        height: fit-content;
        anchor-name: --menuAnchor;
        position-anchor: --menuAnchor;
        bottom: anchor(bottom);
        padding-left: 0px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        right: 1%;

        a {
            margin-left: auto;
        }

    }
}

.menu-toggle:checked~.site-nav {
    transform: translateX(0);
    visibility: visible;
}

@media (min-width: 768px) {
    .site-header {
        display: flex;
        justify-content: space-between;
        padding: 1.2rem 2rem;
    }

    .hamburger-label {
        display: none;
    }

    .site-nav {
        position: static;
        width: auto;
        background-color: transparent;
        box-shadow: none;
        transform: none;
        visibility: visible;
        max-height: none;
        overflow: visible;
        display: block;
    }

    .site-nav ul:not(.submenu) {
        flex-direction: row;
        gap: 2rem;
        padding-top: 0;
    }

    .site-nav a {
        border-bottom: none;
        padding: 0;
    }
}

.main-content {
    grid-area: main;
    padding: 0.5rem;
    max-width: 3000px;
    margin: 0 auto;
    width: 100%;
    overflow: auto;
    background-color: var(--bgmain);
}

@media (min-width: 768px) {
    #file-selector {
        top: 4.5rem;
    }
}

#file-selector {
    position: fixed;
    top: 4rem;
    right: 1rem;
    left: 1rem;
    z-index: 150;
    display: none;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: transparent;

}

#file-selector button {
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--toolbar);
    border-radius: 0.4rem;
    background: var(--white);
    color: var(--toolbar);
    cursor: pointer;
}

#file-selector button.active,
#file-selector button:not(:disabled):hover {
    background: var(--toolbar);
    color: var(--white);
}

#file-selector button:disabled {
    background: #e5e7eb;
    border-color: #c7cbd1;
    color: #8a9099;
    cursor: not-allowed;
    opacity: 0.7;
}

#file-selector button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@media (max-width: 767px) {
    #file-selector {
        left: 1rem;
        right: auto;
        width: calc(100vw - 2rem);
        max-width: calc(100vw - 2rem);
        box-sizing: border-box;

        gap: 0.35rem;
    }

    #file-selector button {
        width: 2.4rem;
        height: 2.4rem;
        padding: 0;
        border-radius: 50%;
        font-size: 0;
        line-height: 2.4rem;
        text-align: center;
    }

    #file-selector button::before {
        content: attr(data-icon);
        font-size: 1rem;
        font-weight: 700;
    }
}

.hero-section {
    text-align: center;
    margin-bottom: 3rem;
}

.hero-section h1 {
    color: #E17326;
    font-size: 2.2rem;
    margin-bottom: 1rem;
}

/* Home Card */
.card {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    border-left: 4px solid var(--primary);
}

.card h2 {
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.card p {
    color: #555;
}

.icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Contact Form */
.contact-form {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    margin-bottom: 2rem;
}

.contact-form h2 {
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #444;
    font-size: 0.95rem;
}

input,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid #ddd;
    border-radius: 7px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #fafafa;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

textarea {
    height: 130px;
    resize: vertical;
}

.btn-submit {
    width: 100%;
    padding: 0.9rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 7px;
    font-size: 1.05rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-submit:hover {
    background: var(--accent-hover);
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.info-card {
    background: white;
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.info-card .icon {
    font-size: 1.8rem;
    margin-bottom: 0.4rem;
}

.info-card h3 {
    color: var(--primary);
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.info-card p {
    font-size: 0.9rem;
    color: #666;
}

/* Footer */
.site-footer {
    grid-area: footer;
    background-color: var(--toolbar);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 0.5rem;
    font-size: 0.5rem;
    border-top: 3px solid var(--accent);
}

.site-footer .user-status {
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

#create-msg-btn {
    position: fixed;
    right: 1rem;
    bottom: 5rem;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid black;
    border-radius: 50%;
    background-color: var(--secondary);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: none;
    font-size: 2rem;
    line-height: 1.6rem;
    text-align: center;
    z-index: 1000;
}