/*  ***********************************
    CSS METHODOLGY
    Base
    - Only base level elements (eg: div, a, ul, li)

    Layout
    - Core templating elements (eg: main, footer)

    Page
    - Page specific styles get pushed into the css stack at the top of the blade template, if styles get too long, load it as an external css file under css/pages/{page blade name}.css

    Components
    - Standard compnants also live in the compants folder, but will be a single word file (eg: button.css)
    - Custom componants load its own assets (js, css, etc) in pushOnce directive, and will be named with two words and dash (-) (eg:system-message)

    Utitily
    - Utitily classes should be kept to a minimum and be either very reusable (eg: pt-1) or decoration (eg: underscore)
    *********************************** */

@layer reset, base, layout, page, components, utilities;

@property --columns {
    syntax: "*";
    inherits: false;
}

@property --tablet-columns {
    syntax: "*";
    inherits: false;
}

@property --gap {
    syntax: "<length> | <percentage>";
    inherits: false;
    initial-value: 0;
}

@property --bg {
    syntax: "*";
    inherits: false;
}

/*
@property --color {
    syntax: "<color>";
    inherits: false;
    initial-value: transparent;
}
*/

@property --marker {
    syntax: "<image>";
    inherits: false;
    initial-value: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="0.8em" height="0.8em" viewBox="0 0 20 20"><path d="M5 20c-0.128 0-0.256-0.049-0.354-0.146-0.195-0.195-0.195-0.512 0-0.707l8.646-8.646-8.646-8.646c-0.195-0.195-0.195-0.512 0-0.707s0.512-0.195 0.707 0l9 9c0.195 0.195 0.195 0.512 0 0.707l-9 9c-0.098 0.098-0.226 0.146-0.354 0.146z" fill="hsl(215 20% 45%)"></path></svg>');
}

@property --large-marker {
    syntax: "<image>";
    inherits: false;
    initial-value: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="1.2em" height="1.2em" viewBox="0 0 20 20"><path d="M5 20c-0.128 0-0.256-0.049-0.354-0.146-0.195-0.195-0.195-0.512 0-0.707l8.646-8.646-8.646-8.646c-0.195-0.195-0.195-0.512 0-0.707s0.512-0.195 0.707 0l9 9c0.195 0.195 0.195 0.512 0 0.707l-9 9c-0.098 0.098-0.226 0.146-0.354 0.146z" fill="hsl(215 20% 45%)"></path></svg>');
}

@view-transition {
    navigation: auto;
}

/* Outside layers so it has high specicifity */
[hidden] {
    display: none !important;
}

/* debugging */

a[href="#"] {
    text-decoration-style: wavy;
    text-decoration-color: var(--color-brick);
}

@layer reset {

    *,
    *::before,
    *::after {
        box-sizing: border-box;
    }

    body {
        margin: 0;
    }
}

@layer base {
    :where(html) {
        --border-size-1: 1px;
        --border-size-2: 2px;
        --border-size-3: 5px;
        --border-size-4: 10px;
        --border-size-5: 25px;
        --radius-1: 2px;
        --radius-2: 5px;
        --radius-3: 1rem;
        --radius-4: 2rem;
        --radius-5: 4rem;
        --radius-6: 8rem;
        --radius-round: 1e5px;
    }

    body {
        display: grid;

        margin: 0;

        min-height: 100vh;
        grid-template-rows: min-content auto min-content;

        font-family: Inter, 'Noto Sans', Roboto, Ubuntu, sans-serif;
        font-size: 16px;
        font-weight: 400;
        line-height: var(--font-lineheight-2);

        color: var(--color-midnight);

        /* Desktop */
        @media screen and (min-width: 768px) {
            font-size: 14px;
        }

        /* sitewidealert offset */
        &.sitewidealert {
            grid-template-rows: min-content min-content auto min-content;
        }
    }

    main {
        display: grid;
        grid-template-rows: max-content max-content max-content auto;
        grid-auto-rows: auto;
    }

    menu {
        display: grid;
        margin: 0;
        padding: 0;
        list-style-type: none;
    }

    details {
        &[name] {
            border: 1px solid var(--color-bordergrey);

            &:first-of-type {
                border-bottom: none;
                border-radius: var(--radius-2) var(--radius-2) 0 0;
            }

            &:last-of-type {
                border-radius: 0 0 var(--radius-2) var(--radius-2);
            }

            > summary {
                padding: var(--size-2);

                font-size: var(--font-size-3);
                font-weight: var(--font-weight-4);
                color: var(--color-steel);

                [open] > & {
                    border-bottom: 1px solid var(--color-bordergrey);
                }

                &:before {
                    font-size: 1.2em;
                    content: var(--large-marker);
                }
            }

            section {
                padding: var(--size-3);
                overflow-y: auto;
                max-height: 55lvh;
            }
        }
    }

    summary {
        display: flex;
        cursor: pointer;
        align-items: center;
        gap: var(--size-1);
        list-style-type: none;

        &::before {
            display: grid;
            justify-content: center;
            align-content: center;
            padding: 0;
            width: 1em;
            height: 1em;
            content: var(--marker);
            font-size: var(--font-size-0);
        }

        details[open] > &::before {
            rotate: 90deg;
        }

        /* remove default marker from <summary> in Safari */
        &::-webkit-details-marker {
            display: none;
        }
    }

    ul,
    ol {
        li {
            padding: 0 0 10px 0;
        }

        &.unlist {
            list-style-type: none;
            padding: 0;
            margin: 0;
        }
    }

    hr {
        width: 100%;
        height: 0px;
        border-color: color-mix(in srgb, var(--color-bordergrey) 20%, transparent);
    }

    button {
        text-transform: capitalize;
    }

    footer {
        display: block;
        padding: var(--size-2) 0;

        font-size: var(--font-size-0);
        color: var(--color-steel);
        text-align: center;
    }

    .webpush-notifications {
        inset: unset;

        position: absolute;
        right: var(--size-3);
        top: var(--size-3);

        padding: 0;

        border: none;
        border-radius: var(--radius-2);
        background: white;
    }
}
