/* ==========================================================================
   MOBILE STYLES (0-767px)
   ========================================================================== */

@media (max-width: 767px) {
    div#wrapper {
        /*width: 100%;*/
        margin-top: 60px; /* Reduced from 110px */
        padding: 0 15px; /* Add horizontal padding */
    }

    /* === HEADER/LOGO === */
    div#root {
        position: static;
        top: 65px;
        left: 15px;
        width: auto;
        height: auto;
        z-index: 1000;
        /*font-size: 11px;*/
    }

    div#logo_img {
        position: fixed;
        top: 10px;
        left: 20px;
        width: 50px;
        height: 50px;
        z-index: 1001;
    }

    div#logo_img img {
        width: 100%;
        height: auto;
    }

    /* === NAVIGATION === */
    div#menubar {
        position: static; /* Remove fixed positioning */
        width: 100%;
        height: auto;
        left: 0;
        top: 0;
        overflow: visible;
        padding: 70px 0 20px 0;
    }

    div#menu {
        display: block;
        width: 100%;
        padding-bottom: 20px;
    }

    /* === HEADING === */
    div#heading {
        position: static;
        width: 100%;
        margin-left: 0;
        left: 0;
        top: auto;
        padding: 20px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* === CONTENT AREA === */
    div#show {
        position: static;
        width: 100%;
        margin-left: 0;
        left: 0;
        top: auto;
        height: auto;
    }

    /* === IMAGES === */
    .show_img {
        width: 100% !important;
        margin-bottom: 20px;
    }

    .show_img img {
        width: 100%;
        height: auto;
    }

    /* === TEXT CONTENT === */
    div#show p,
    div#show div {
        width: 100%;
        padding: 0;
    }

    /* === TYPOGRAPHY === */
    body {
        /*font-size: 14px;*/
        line-height: 1.6;
    }

    h1, h2, h3 {
        font-size: 18px;
        margin-bottom: 10px;
    }

    /* === LINKS === */
    /*a {*/
    /*    padding: 12px 0; !* Increase touch target *!*/
    /*    display: block;*/
    /*}*/

    div#menu a {
        padding: 5px 0;
        font-size: 16px; /*!* Larger for easier tapping *!*/
    }

    /* === FOLDERS/CATEGORIES === */
    .folder {
        margin-bottom: 20px;
    }

    .folder a {
        padding: 12px 0;
    }

    div#heading_logo > div {
        display: none;
        /*position: fixed;*/
        /*bottom: 10px;*/
        /*left: 15px;*/
        /*right: 15px;*/
        /*width: auto;*/
        /*height: auto;*/
        /*text-align: left;*/
        /*font-size: 10px;*/
    }

    div#descr {
        position: static;
        width: 100%;
        left: 0;
        bottom: auto;
        margin-top: 20px;
        padding: 15px;
        background-color: #FFFFFF;
    }

    /* === INFO PAGE STYLES (MOBILE) === */
    /* Hide cornice image */
    #info > img {
        display: none;
    }

    /* Use CSS Grid on parent #info for proper alignment */
    div#info {
        position: static;
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "foto folders"
            "form form";
        align-items: start;
        column-gap: 20px;
        row-gap: 20px;
        margin-left: 0;
        padding: 15px 0;
    }

    /* Foto on the left, top-aligned */
    div#foto {
        position: static;
        grid-area: foto;
        align-self: start;

        margin: 0;
    }

    div#foto img {
        max-width: 150px;
        height: auto;
    }

    /* Folders on the right, top-aligned with foto */
    div#folders {
        position: static;
        grid-area: folders;
        align-self: start;
        display: grid;
        grid-template-columns: auto auto;
        grid-template-rows: auto auto;
        gap: 5px 20px;

        margin: 0;

    }

    /* Position folder icons in first row */
    div#folderCurr {
        position: static;
        grid-column: 1;
        grid-row: 1;
    }

    div#folderPort {
        position: static;
        grid-column: 2;
        grid-row: 1;
    }

    /* Position text labels in second row, under their respective folders */
    div#textCurr {
        position: static;
        grid-column: 1;
        grid-row: 2;
    }

    div#textPort {
        position: static;
        grid-column: 2;
        grid-row: 2;
    }

    /* Form spans full width below foto and folders */
    div#form_info {
        position: static;
        grid-area: form;
        width: 100%;
        margin: 0;

    }

    /* Stack form fields vertically */
    form {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    #column_1,
    #column_2 {
        margin: 0;
        width: 100%;
    }

    .full {
        width: 100%;
    }

    .btn {
        width: 100%;
    }
}

/* ==========================================================================
   TABLET STYLES (768px-1023px)
   ========================================================================== */

@media (min-width: 768px) and (max-width: 1023px) {
    div#wrapper {
        width: 100%;
        padding: 0 20px;
        /*margin-top: 80px;*/
    }

    /* === LOGO === */
    div#root {
        position: fixed;
        top: 100px;
        left: 30px;
        width: auto;
        height: auto;
        /*font-size: 11px; TODO: ???*/
    }

    div#logo_img {
        position: fixed;
        top: 15px;
        left: 20px;
        width: 70px;
        height: 70px;
        z-index: 1001;
    }

    div#logo_img img {
        width: 100%;
        height: auto;
    }

    /* === NAVIGATION === */
    div#menubar {
        position: fixed;
        width: 180px;
        height: auto;
        max-height: calc(100vh - 120px);
        left: 20px;
        top: 160px;
        overflow-y: auto;
    }

    /* === HEADING === */
    div#heading {
        position: relative;
        width: calc(100% - 200px);
        margin-left: 200px;
        padding-right: 20px;
    }

    /* === CONTENT === */
    div#show {
        position: relative;
        width: calc(100% - 200px);
        margin-left: 200px;
        height: auto;
    }

    /* === IMAGES === */
    .show_img {
        width: 100%;
        max-width: 600px;
    }

    /* === TYPOGRAPHY === */
    /*body {*/
    /*    font-size: 15px;*/
    /*}*/

    div#heading_logo > div {
        display: none;
        /*position: fixed;*/
        /*bottom: 10px;*/
        /*left: 200px;*/
        /*right: 20px;*/
        /*width: auto;*/
        /*max-width: 300px;*/
        /*height: auto;*/
        /*text-align: left;*/
        /*font-size: 10px;*/
    }

    div#descr {
        position: fixed;
        bottom: 10px;
        left: 200px;
        right: 20px;
        width: auto;
        max-width: calc(100% - 220px);
        background-color: #FFFFFF;
        padding: 10px;
    }

    /* === INFO PAGE STYLES (TABLET) === */
    /* Hide cornice image */
    #info > img {
        display: none;
    }

    /* Use CSS Grid on parent #info for proper alignment */
    div#info {
        position: static;
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "foto folders"
            "form form";
        align-items: start;
        column-gap: 30px;
        row-gap: 25px;
        margin-left: 200px;
        padding: 20px 0;
    }

    /* Foto on the left, top-aligned */
    div#foto {
        position: static;
        grid-area: foto;
        align-self: start;

        margin: 0;
    }

    div#foto img {
        max-width: 200px;
        height: auto;
    }

    /* Folders on the right, top-aligned with foto */
    div#folders {
        position: static;
        grid-area: folders;
        align-self: start;
        display: grid;
        grid-template-columns: auto auto;
        grid-template-rows: auto auto;
        gap: 5px 20px;

        margin: 0;

    }

    /* Position folder icons in first row */
    div#folderCurr {
        position: static;
        grid-column: 1;
        grid-row: 1;
    }

    div#folderPort {
        position: static;
        grid-column: 2;
        grid-row: 1;
    }

    /* Position text labels in second row, under their respective folders */
    div#textCurr {
        position: static;
        grid-column: 1;
        grid-row: 2;
    }

    div#textPort {
        position: static;
        grid-column: 2;
        grid-row: 2;
    }

    /* Form spans full width below foto and folders */
    div#form_info {
        position: static;
        grid-area: form;
        width: 100%;
        margin: 0;

    }

    /* Stack form fields vertically */
    form {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    #column_1,
    #column_2 {
        margin: 0;
        width: 100%;
    }

    .full {
        width: 100%;
    }

    .btn {
        width: 100%;
    }
}

/* ==========================================================================
   DESKTOP ADJUSTMENTS (1024px+)
   ========================================================================== */

@media (min-width: 1024px) {
    div#heading_logo {
        /*display: block;*/
        position: static;
        top: 0px;
        right: 20px;
        width: auto;
        /*max-width: 226px;*/
        /*height: 12px;*/
        text-align: right;
    }

    div#descr {
        position: fixed;
        bottom: 10px;
        left: 211px;
        width: auto;
        max-width: 936px;
        right: 20px;
        background-color: #FFFFFF;
    }
}

/* === HAMBURGER MENU === */
#mobile-menu-toggle {
    display: none; /* Hidden by default */
    position: fixed;
    top: 20px;
    right: 15px;
    z-index: 1001;
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    padding: 8px;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-around;
}

.hamburger-line {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #000;
    transition: all 0.3s ease;
}

@media (max-width: 767px) {

    :root {
        --space-xs: 0.5rem;
        --space-sm: 0.75rem;
        --space-md: 1rem;
        --space-lg: 1.5rem;
        --space-xl: 2rem;
    }

    div#wrapper {
        padding: var(--space-md) var(--space-sm);
    }

    #mobile-menu-toggle {
        display: flex;
    }

    /* Hide menu by default on mobile */
    div#menubar {
        display: none;
    }

    /* Show menu when active */
    div#menubar.active {
        display: block;
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: #fff;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        padding: 20px;
    }

    /* Animate hamburger to X */
    #mobile-menu-toggle.active .hamburger-line:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    #mobile-menu-toggle.active .hamburger-line:nth-child(2) {
        opacity: 0;
    }

    #mobile-menu-toggle.active .hamburger-line:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }
}

/* === SPACING VARIABLES === */
:root {
    --space-xs: clamp(0.5rem, 1vw, 0.75rem);
    --space-sm: clamp(0.75rem, 1.5vw, 1rem);
    --space-md: clamp(1rem, 2vw, 1.5rem);
    --space-lg: clamp(1.5rem, 3vw, 2rem);
    --space-xl: clamp(2rem, 4vw, 3rem);
}

/* Apply fluid spacing */
div#wrapper {
    padding: var(--space-md);
}

div#show {
    padding: var(--space-md) 0;
}

.show_img {
    margin-bottom: var(--space-lg);
}

/*div#menu a {*/
/*    padding: var(--space-sm) 0;*/
/*}*/

h1, h2, h3 {
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
}

p {
    margin-bottom: var(--space-md);
}
