/* =====================================================================
   LAYOUT LIBRARY
   Orientation strategy:
   - Landscape is the default (no landscape media query).
   - Portrait changes are applied only inside @media (orientation: portrait).
   - fx- widths remain unchanged in both orientations.
   - var- widths may be overridden in Portrait.
   - port- widths exist only in Portrait.
   ===================================================================== */


/* 01. BASE
   --------------------------------------------------------------------- */

body {
    width: 100%;
    margin: auto;
}


/* 02. MAIN CONTAINERS
   --------------------------------------------------------------------- */

.main_container,
.container {
    width: 90%;
    margin: 0 auto;
    padding: 3% 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.container {
    justify-content: space-evenly;
    padding: 0;
}


/* 03. SECTIONS
   --------------------------------------------------------------------- */

.section {
    padding: inherit;
    flex-grow: 1;
    flex-basis: 90%;
}


/* 04. FLEX DIRECTIONS
   Landscape values are declared here as the defaults.
   The matching Portrait values are declared in the Portrait media query.
   --------------------------------------------------------------------- */
.l-flex
{
    display: flex;
}

.l-flex {
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    align-content: center;
    align-items: center;
}

/* Same direction in Landscape and Portrait */
.l-row {
    flex-direction: row;
}

.l-row-reverse {
    flex-direction: row-reverse;
}

.l-column {
    flex-direction: column;
}

.l-column-reverse {
    flex-direction: column-reverse;
}

/* Different direction in Portrait: Landscape -> Portrait */
.l-row-p-row-reverse,
.l-row-p-column,
.l-row-p-column-reverse {
    flex-direction: row;
}

.l-row-reverse-p-row,
.l-row-reverse-p-column,
.l-row-reverse-p-column-reverse {
    flex-direction: row-reverse;
}

.l-column-p-row,
.l-column-p-row-reverse,
.l-column-p-column-reverse {
    flex-direction: column;
}

.l-column-reverse-p-row,
.l-column-reverse-p-row-reverse,
.l-column-reverse-p-column {
    flex-direction: column-reverse;
}


/* 05. FLEX ALIGNMENT
   --------------------------------------------------------------------- */

.l-justify-start {
    justify-content: flex-start;
}

.l-justify-center {
    justify-content: center;
}

.l-justify-end {
    justify-content: flex-end;
}

.l-justify-between {
    justify-content: space-between;
}

.l-justify-around {
    justify-content: space-around;
}

.l-justify-evenly {
    justify-content: space-evenly;
}

.l-items-start {
    align-items: flex-start;
}

.l-items-center {
    align-items: center;
}

.l-items-end {
    align-items: flex-end;
}

.l-items-stretch {
    align-items: stretch;
}

.l-items-baseline {
    align-items: baseline;
}

.l-content-start {
    align-content: flex-start;
}

.l-content-center {
    align-content: center;
}

.l-content-end {
    align-content: flex-end;
}

.l-content-between {
    align-content: space-between;
}

.l-content-around {
    align-content: space-around;
}

.l-content-evenly {
    align-content: space-evenly;
}


/* 06. FLEX WRAPPING
   --------------------------------------------------------------------- */

.l-wrap {
    flex-wrap: wrap;
}

.l-nowrap {
    flex-wrap: nowrap;
}

.l-wrap-reverse {
    flex-wrap: wrap-reverse;
}


/* 07. FIXED WIDTHS (fx-)
   These values are not changed by Orientation.
   --------------------------------------------------------------------- */

.fx-w-45 {
    width: 45%;
}

.fx-w-47 {
    width: 47%;
}

.fx-w-48 {
    width: 48%;
}

.fx-w-49 {
    width: 49%;
}


/* 08. VARIABLE WIDTHS (var-)
   Landscape defaults. Selected values are overridden in Portrait below.
   --------------------------------------------------------------------- */

.var-w-100 {
    width: 100%;
}

.var-w-99 {
    width: 99%;
}

.var-w-98 {
    width: 98%;
}

.var-w-90 {
    width: 90%;
}

.var-w-80 {
    width: 80%;
}

.var-w-70 {
    width: 70%;
}

.var-w-60 {
    width: 60%;
}

.var-w-50 {
    width: 50%;
}

.var-w-49 {
    width: 49%;
}

.var-w-48 {
    width: 48%;
}

.var-w-45 {
    width: 45%;
}

.var-w-42 {
    width: 42%;
}

.var-w-40 {
    width: 40%;
}

.var-w-33 {
    width: 33%;
}

.var-w-32 {
    width: 32%;
}

.var-w-31 {
    width: 31%;
}

.var-w-30 {
    width: 30%;
}

.var-w-20 {
    width: 20%;
}


/* 09. SPACING & MARGINS
   Layout spacing only; no decorative or text styling is included.
   --------------------------------------------------------------------- */

.l-m-0 {
    margin: 0;
}

.l-p-0 {
    padding: 0;
}

.l-m-0-important {
    margin: 0 !important;
}

.l-p-0-important {
    padding: 0 !important;
}

.l-mt-10-important {
    margin-top: 10px !important;
}

.l-mt-20-important {
    margin-top: 20px !important;
}

.l-mt-30-important {
    margin-top: 30px !important;
}

.l-mb-10-important {
    margin-bottom: 10px !important;
}

.l-m-auto {
    margin: auto;
}

.l-my-1vh {
    margin: 1vh auto;
}

.l-my-05vh {
    margin: 0.5vh auto;
}


/* 10. PORTRAIT OVERRIDES
   All Orientation-dependent changes belong in this media query.
   --------------------------------------------------------------------- */

@media (orientation: portrait) {

    /* Flex directions: Portrait values */
    .l-row-p-row-reverse {
        flex-direction: row-reverse;
    }

    .l-row-p-column {
        flex-direction: column;
    }

    .l-row-p-column-reverse {
        flex-direction: column-reverse;
    }

    .l-row-reverse-p-row {
        flex-direction: row;
    }

    .l-row-reverse-p-column {
        flex-direction: column;
    }

    .l-row-reverse-p-column-reverse {
        flex-direction: column-reverse;
    }

    .l-column-p-row {
        flex-direction: row;
    }

    .l-column-p-row-reverse {
        flex-direction: row-reverse;
    }

    .l-column-p-column-reverse {
        flex-direction: column-reverse;
    }

    .l-column-reverse-p-row {
        flex-direction: row;
    }

    .l-column-reverse-p-row-reverse {
        flex-direction: row-reverse;
    }

    .l-column-reverse-p-column {
        flex-direction: column;
    }


    /* Variable widths: values that change in Portrait */
    .var-w-20,
    .var-w-30,
    .var-w-40,
    .var-w-42,
    .var-w-45,
    .var-w-48,
    .var-w-49,
    .var-w-50,
    .var-w-60,
    .var-w-70,
    .var-w-80,
    .var-w-90 {
        width: 98%;
        margin: 0.5vh auto;
    }

}

/* Portrait-only widths. The original 1000px upper breakpoint is retained. */
@media (orientation: portrait) and (max-width: 1000px) {
    .port-w-23 {
        width: 23%;
    }

    .port-w-32 {
        width: 32%;
    }

    .port-w-49 {
        width: 49%;
    }

    .port-w-45 {
        width: 45%;
    }

    .port-w-40 {
        width: 40%;
    }
}

/* Narrow Portrait screens: these breakpoints remain Portrait-only. */
@media (orientation: portrait) and (max-width: 750px) {
    .port-w-23,
    .port-w-32,
    .port-w-49,
    .port-w-45,
    .port-w-40 {
        width: 49%;
    }
}

@media (orientation: portrait) and (max-width: 500px) {
    .port-w-23,
    .port-w-32,
    .port-w-49,
    .port-w-45,
    .port-w-40 {
        width: 100%;
    }
}
