@charset "UTF-8";
/*
:filename: wexa_statics.css.layout.css
:author: Brigitte Bigi
:contact: contact@sppas.org
:summary: Layouts and size classes.

-------------------------------------------------------------------------

This file is part of Whakerexa: https://github.com/brigitte-bigi/Whakerexa

Copyright (C) 2023-2026 Brigitte Bigi, CNRS
Laboratoire Parole et Langage, Aix-en-Provence, France

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

This banner notice must not be removed.

-------------------------------------------------------------------------

*/

@layer reset, base, theme, accessibility;


/* =======================================================================
                    @layer base — structure, layout, sizing
   ======================================================================== */

@layer base {

    /* ------------------------------------------------------------------ */
    /* Variable definitions — sizes and spacing only (no color values)     */
    /* ------------------------------------------------------------------ */

    :root {
        --card-max-width:     15rem;
        --card-border-width:  0;
        --card-border-radius: 8px;
        --card-padding:       0.6rem;
    }

    /* ------------------------------------------------------------------ */
    /* Utility display classes                                              */
    /* ------------------------------------------------------------------ */

    .hidden {
        display: none;
    }

    .block {
        display: block;
    }

    /* Centers the element and its text in a block, a flex line or a grid. */
    .center {
        align-self: center;
        justify-self: center;
        text-align: center;
        margin-left: auto;
        margin-right: auto;
    }

    /* ------------------------------------------------------------------ */
    /* Classes for sizes                                                    */
    /* ------------------------------------------------------------------ */

    .width_10 {
        min-width: 8%;
    }

    .width_20 {
        min-width: 18%;
    }

    .width_30 {
        min-width: 28%;
    }

    .width_40 {
        width: 38%;
    }

    .width_50 {
        width: 48%;
    }

    .width_60 {
        width: 58%;
    }

    .width_70 {
        width: 68%;
    }

    .width_80 {
        width: 78%;
    }

    .width_90 {
        width: 88%;
    }

    .width_95 {
        width: 95%;
    }

    .width_full {
        width: 100%;
    }

    /* ------------------------------------------------------------------ */
    /* Panel — simple container                                             */
    /* ------------------------------------------------------------------ */

    .panel {
        border: 0;
        padding: 0;
        margin: 0;
        position: relative;
    }

    .panel:after, .panel:before {
        content: "";
        display: table;
        clear: both;
    }

    main.panel-item {
        padding: 0;
        margin: 0;
    }

    /* ------------------------------------------------------------------ */
    /* Flex panel — responsive flexible container                          */
    /* ------------------------------------------------------------------ */

    .flex-panel {
        display: flex;
        justify-content: space-evenly;
        row-gap: 0.5rem;
        column-gap: 0.5rem;
        flex-wrap: wrap;
    }

    .flex-panel > * {
        flex-grow: 0;
        flex-shrink: 1;
        flex-basis: auto;
    }

    .flex-item {
        margin: 0;
    }

    @media only screen and (min-width: 1024px) {

        .flex-panel {
            flex-direction: row;
        }

        .flex-item {
            margin-right: var(--typography-spacing-horizontal);
            margin-bottom: 0;
        }

        .flex-border-left {
            border-left-style: solid;
            padding-left: var(--typography-spacing-horizontal);
        }

    }

    @media only screen and (max-width: 1023.98px) {

        .flex-panel {
            flex-direction: column;
            text-align: center;
        }

        .flex-panel > * {
            flex-grow: 1;
            width: 100%;
        }

        .width_10, .width_20, .width_30, .width_40,
        .width_50, .width_60, .width_70, .width_80,
        .width_90, .width_95 {
            width: 100%;
            min-width: 0;
        }

        nav.flex-panel {
            flex-direction: row;
        }

        nav.flex-panel > * {
            flex-grow: 0;
            width: auto;
        }

        .flex-item {
            margin-bottom: 0;
        }

        .flex-border-left {
            border-top-style: solid;
        }

    }

    /* ------------------------------------------------------------------ */
    /* Wrap panel — space-driven flexible container                        */
    /* ------------------------------------------------------------------ */

    :root {
        --wrap-panel-gap: 0.5rem;
    }

    .wrap-panel {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        row-gap: var(--wrap-panel-gap);
        column-gap: var(--wrap-panel-gap);
    }

    .wrap-item {
        flex: 0 1 auto;
        max-width: 100%;
        margin: 0;
    }

    /* ------------------------------------------------------------------ */
    /* Grid panel                                                           */
    /* ------------------------------------------------------------------ */

    .grid-panel {
        margin: auto;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
        gap: var(--typography-spacing-horizontal);
        justify-content: space-evenly;
        align-items: center;
    }

    .grid-item {
        margin-bottom: 0;
    }

    /* ------------------------------------------------------------------ */
    /* Scrollable panel                                                     */
    /* ------------------------------------------------------------------ */

    .scrolled-panel {
        border: 0;
        padding: 0;
        margin: 0;
        position: relative;
        overflow: auto;
    }

    .scrolled-panel:after, .scrolled-panel:before {
        content: "";
        display: table;
        clear: both;
    }

    .scrolled-panel[hidden] {
        display: none;
    }

    /* ------------------------------------------------------------------ */
    /* Cards panel                                                          */
    /* ------------------------------------------------------------------ */

    .cards-panel {
        margin: auto;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(min(var(--card-max-width), 100%), 1fr));
        grid-column-gap: calc(0.1 * var(--card-max-width));
        grid-row-gap: calc(0.1 * var(--card-max-width));
    }

    .full-cards-panel {
        margin: auto;
        display: grid;
        grid-template-columns: 1fr;
        grid-column-gap: calc(0.1 * var(--card-max-width));
        grid-row-gap: calc(0.1 * var(--card-max-width));
    }

    /* ------------------------------------------------------------------ */
    /* Card — structure                                                     */
    /* ------------------------------------------------------------------ */

    .card {
        position: relative;
        padding: var(--card-padding);
        margin: 0.4rem;
        border-radius: var(--card-border-radius);
        display: flex;
        flex-direction: column;
        cursor: default;
    }

    .card-horiz {
        flex-direction: row;
    }

    /* Remove card padding where header/footer bleed to the border */
    .card:has(> .card-header) {
        padding-top: 0;
    }

    .card:has(> .card-footer) {
        padding-bottom: 0;
    }

    /* Collapse margins at card edges */
    .card > *:first-child,
    .card .card-body > *:first-child {
        margin-top: 0;
    }

    .card > *:last-child,
    .card .card-body > *:last-child {
        margin-bottom: 0;
    }

    /* Reset background on all card children (wexa.css sets * { background-color: var(--bg-color) }) */
    .card * {
        background-color: transparent;
    }

    @media only screen and (max-width: 1023.98px) {
        .card {
            max-width: 75%;
            overflow: auto;
        }
        .full-card {
            max-width: 100%;
        }
    }

    @media only screen and (min-width: 1024px) {
        .card {
            max-width: var(--card-max-width);
        }
        .full-card {
            max-width: 100%;
        }
    }

    .card .card-header {
        text-align: center;
        margin: 0 calc(-1 * var(--card-padding));
        min-height: calc(3rem * var(--size-divisor));
        max-height: calc(8rem * var(--size-divisor));
        width: calc(100% + 2 * var(--card-padding));
        padding: 0.4rem;
        border-top-right-radius: var(--card-border-radius);
        border-top-left-radius: var(--card-border-radius);
        display: inline-flex;
        justify-content: center;
        flex-direction: column;
        align-items: center;
    }

    .card .card-header img,
    .card .card-header svg {
        border-top-right-radius: var(--card-border-radius);
        border-top-left-radius: var(--card-border-radius);
        max-width: 90%;
        max-height: 90%;
    }

    .card .card-body {
        padding: 0.4rem;
        flex: 1 0 auto;
        display: flex;
        flex-direction: column;
        background: transparent;
    }

    .card > .card-body > * {
        border: none;
        background: transparent;
    }

    .card .card-footer {
        text-align: center;
        margin: 0 calc(-1 * var(--card-padding));
        min-height: calc(2rem * var(--size-divisor));
        max-height: calc(6rem * var(--size-divisor));
        width: calc(100% + 2 * var(--card-padding));
        border-bottom-right-radius: var(--card-border-radius);
        border-bottom-left-radius: var(--card-border-radius);
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: row;
    }

    .card .card-footer *:not(img) {
        font-size: 80%;
        margin: 0.4rem;
    }

    .card .card-footer a {
        display: inline-block;
        padding: 0.3rem 1rem;
        border-radius: var(--card-border-radius);
        font-weight: var(--font-weight-semibold);
        text-decoration: underline;
        text-underline-offset: 0.2rem;
        border: none;
    }

    .card .card-footer a:hover {
        transform: translateY(-2px);
    }

    /* ------------------------------------------------------------------ */
    /* Enumerate cards                                                      */
    /* ------------------------------------------------------------------ */

    ol.enumerate-cards {
        list-style: none;
        padding: 0;
        counter-reset: list-item;
    }

    li.enumerate-cards-item + li {
        margin-top: calc(var(--font-size) * 0.8);
    }

    li.enumerate-cards-item {
        font-weight: var(--font-weight-black);
        font-size: calc(var(--font-size) * 1.1);
        margin: auto;
        max-width: 80%;
        display: flex;
        align-items: center;
        gap: var(--font-size);
        padding: calc(var(--font-size) * 1.1);
        border-radius: var(--border-radius);
        width: calc(100% - 2 * var(--typography-spacing-horizontal));
    }

    @media only screen and (max-width: 1023.98px) {
        /* The card stands up: its number above its text. */
        li.enumerate-cards-item {
            flex-direction: column;
            text-align: center;
            max-width: calc(100% - 2 * var(--typography-spacing-horizontal));
        }

        li.enumerate-cards-item::before {
            margin-left: 0;
        }
    }

    li.enumerate-cards-item::before {
        counter-increment: list-item;
        content: counter(list-item);
        font-size: calc(var(--font-size) * 2);
        font-weight: var(--font-weight-black);
        width: calc(var(--font-size) * 3);;
        height: calc(var(--font-size) * 3);
        flex: 0 0 auto;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-left: calc(var(--font-size) * 0.5);
    }

} /* end @layer base */


/* =======================================================================
                    @layer accessibility — contrast mode overrides
   ======================================================================== */

@layer accessibility {

    .contrast {
        --card-max-width:     20rem;
        --card-border-width:  2px;
        --card-border-radius: 0.8rem;
    }

} /* end @layer accessibility */


/* =======================================================================
                    @layer theme — color values
   ======================================================================== */

@layer theme {

    /* ------------------------------------------------------------------ */
    /* Color variables for cards and layout                                 */
    /* ------------------------------------------------------------------ */

    :root {
        --card-box-shadow:   -0.1rem 0.1rem 0.4rem 0.1rem var(--shadow-color);
        --columns-sep-color: rgba(128, 128, 128, 0.5);

        /* Neutral aliases: capture the root pair so panels can swap it */
        --panel-bg-color:     var(--bg-color);
        --panel-fg-color:     var(--fg-color);
        --panel-bg-color-alt: var(--bg-color-alt);
        --panel-fg-color-alt: var(--fg-color-alt);
    }

    /* ------------------------------------------------------------------ */
    /* Alternating panel-item colors: the whole pair is swapped, so nested  */
    /* elements keep a valid contrast between main and alternate colors.    */
    /* ------------------------------------------------------------------ */

    main > .panel-item:nth-child(odd) {
        --bg-color:     var(--panel-bg-color);
        --fg-color:     var(--panel-fg-color);
        --bg-color-alt: var(--panel-bg-color-alt);
        --fg-color-alt: var(--panel-fg-color-alt);
    }

    main > .panel-item:nth-child(even) {
        --bg-color:     var(--panel-bg-color-alt);
        --fg-color:     var(--panel-fg-color-alt);
        --bg-color-alt: var(--panel-bg-color);
        --fg-color-alt: var(--panel-fg-color);
    }

    /* A panel carries the ground of the palette it swapped: what it holds
       inherits the colours, and the panel itself is what is painted. */
    main > .panel-item {
        background-color: var(--bg-color);
    }

    /* ------------------------------------------------------------------ */
    /* Border separator color for flex panels                              */
    /* ------------------------------------------------------------------ */

    @media only screen and (min-width: 1024px) {
        .flex-border-left {
            border-color: var(--columns-sep-color);
        }
    }

    @media only screen and (max-width: 1023.98px) {
        .flex-border-left {
            border-color: var(--columns-sep-color);
        }
    }

    /* ------------------------------------------------------------------ */
    /* Card colors: resolved on the card itself, not on :root, so that a    */
    /* panel-level redefinition of --bg-color-alt is honored.               */
    /* ------------------------------------------------------------------ */

    .card {
        border: var(--card-border-width) solid var(--border-color-alt);
        background: var(--card-bg-color, var(--bg-color-alt));
        color: var(--card-fg-color, var(--fg-color));
        box-shadow: var(--card-box-shadow);
    }

    .card .card-header > svg,
    .card .card-header > svg * {
        color: var(--li-color);
    }

    .card .card-footer *:not(button, [role=button], a, [role=link]) {
        color: inherit;
    }

    .card > * > a[role=button],
    .card > * > button {
        border: calc(var(--border-width) / 2) solid var(--a-color);
    }

    .card > * > a[role=button]:hover,
    .card > * > button:enabled:hover {
        border: calc(var(--border-width) / 2) dashed var(--a-color);
    }

    /* ------------------------------------------------------------------ */
    /* Enumerate cards colors                                               */
    /* ------------------------------------------------------------------ */

    li.enumerate-cards-item {
        background: linear-gradient(
            120deg,
            var(--bg-color-alt) 0%,
            var(--bg-color) 50%,
            var(--bg-color-alt) 100%
        );
        color: var(--fg-color-alt);
        box-shadow: 0.3rem 0.3rem 0.6rem var(--shadow-color);
    }

    main > .panel-item:nth-child(2n) li.enumerate-cards-item {
        background: linear-gradient(
            120deg,
            var(--bg-color) 0%,
            var(--bg-color-alt) 50%,
            var(--bg-color) 100%
        );
        color: var(--fg-color);
    }

    li.enumerate-cards-item::before {
        background: var(--li-color);
        color: rgb(255, 255, 255);
    }

} /* end @layer theme */
