@layer base{
     :where(*, :before, :after) {
        box-sizing: border-box;
        margin: 0;
        padding: 0
    }

    html, body {
        height: 100%;
        max-height: 100dvh;
        overflow-x: hidden;
        overflow-y: auto;
    }

    :where(a) {
        color: inherit;
        text-decoration: inherit
    }

    :where(img, video, audio) {
        width: 100%
    }

    :where(img, video, svg, canvas) {
        height: auto
    }

    :where([role=list]) {
        list-style: none
    }
}

@layer tokens{
    :root{
        /* --- Palette --- */
        --color-bg: #5D3744 ;
        --color-bg-track: #5D3744 ;
        --color-accent: #FFF67E;
        --color-accent-light: #FFF67E ;

        --color-glow: #FFF67Ebf;
        --color-glow-accent: #FFF67Ef2;
        --color-glow-light: #FFF67E;

        --color-shadow: #000000;
        
        --color-beam-edge:  transparent;
        --color-beam-center:  #fff67ed4;
    }
}

@layer layout{
    body {
    background-color: var(--color-bg);
    color: var(--color-accent);
    font-family: "Lucida Console", "Courier New", Courier, Monaco, monospace;
    position: relative;
    text-shadow: 0 0 6px currentColor, 0 0 12px  rgb(from var(--color-glow-light) r g b / .3), 2px 0 8px  rgb(from var(--color-glow-light) r g b / .2);
    }

    /*======================================
    =              HEADER                  =
    ======================================*/
    header {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 20px;
        width: 100%;
    }

    header h1 {
        margin: 0 0 15px 0; 
    }

    .navbar ul {
        list-style: none;         
        display: flex;           
        flex-direction: row;
        justify-content: center; 
        align-items: center;
        gap: 24px;               
    }

    .navbar a {
        font-size: 1rem;
        transition: opacity 0.2s ease;
    }

    .navbar a:hover {
        opacity: 0.7;      
    }
}

@layer components{
    /*======================================
    =            NAVIGATION                =
    ======================================*/
    /* Container */
    .icons {
        position: fixed;
        inset: 0;
        width: 100%;
        padding-block: 60px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;

        overflow-y: auto;
        overflow-x: hidden;

    }
    /* Grid */
    .icons-list {
        display: grid;
        grid-template-columns: repeat(1, 1fr);
        gap: 96px;
    }
    /* Item */
    .icons-item {
        position: relative;
    }
    /* Icon */
    .icons-icon {
        position: relative;
        display: flex;
        align-items: flex-end;
        background-color: transparent;
        box-shadow: none;
        overflow: visible;
        width: 100px;
        height: 100px;
    }

    .icons-icon svg {
        display: none;
    }

    
    /* Icon Overlay */
    .icons-icon::before{
        content: "";
        position: absolute;
        inset: 0;
        
        background-color: var(--color-accent); 
        opacity: .5;

        -webkit-mask-image: var(--icon-url);
        mask-image: var(--icon-url);

        -webkit-mask-mode: luminance;
        mask-mode: luminance;

        -webkit-mask-composite: xor; 
        mask-composite: exclude;

        -webkit-mask-size: contain;
        mask-size: contain;

        -webkit-mask-repeat: no-repeat;
        mask-repeat: no-repeat;

        -webkit-mask-position: bottom center;
        mask-position: bottom center;
        
        transition: background-color 0.2s ease, filter 0.2s ease, transform 0.4s ease;
    }
    /* Links */
    .icons-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-end;
        text-align: center;
        gap: 22px;
        text-transform: uppercase;
        width: max-content;
        height: auto;
    }
    /* Hover */
    .icons-link:hover .icons-icon::before {
        opacity: 0.95;
        transform: translateY(-4px);
    }

    /*======================================
    =             GALLERY                  =
    ======================================*/
    /* Grid */
    .portfolio-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 450px));
    gap: 30px;
    padding: 40px;

    justify-content: center; 
    align-items: center;
    }
    /* Card */
    .gallery-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 12px;
    aspect-ratio: 1 / 1; 
    }
    /* Image */
    .gallery-item img {
    width: 100%;
    height: 100%;

    object-fit: cover; 
    
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    }
    /* Overlay */
    .item-overlay {
    position: absolute;
    inset:0;
    background: rgba(0, 0, 0, 0.6);
    color: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    }
    /* Hover */
    .gallery-item:hover img {
        transform: scale(1.03);
    }

    .gallery-item:hover .item-overlay {
    opacity: 1;
    }

    /*======================================
    =              MODAL                   =
    ======================================*/
    /* Overlay */
    .modal {
    z-index: 55;
    display: none; 
    position: fixed;
    inset: 0;
    background: #000000d9;
    justify-content: center;
    align-items: center;
    }
    /* Window */
    .modal-content {
    background: var(--color-bg);
    padding: 10px;
    max-width: 700px;
    width: 90vw;
    max-height: 90vh;
    border-radius: 5px;
    position: relative;
    display: flex;
    flex-direction:column;
    align-items:center;
    justify-content: center;
    gap:10px;
    }
    /* Image */
    .modal-content img {
    background: #00000080;
    width: 100%;
    height: auto;
    max-height: 65vh;
    object-fit: contain;
    border-radius: 5px;
    z-index:55;
    }
    /* Info */
    .modal-info-sidebar {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
    max-height: 40vh;
    gap: 10px;
    overflow-y: auto; 
    flex-grow: 1;
    }
    /* Typography */
    #modalTitle {
    font-size: 1.5rem;
    color: var(--color-accent-light);
    border-bottom: 1px dashed var(--color-accent);
    padding-bottom: 8px;
    }

    #modalDesc {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-accent);
    opacity: 0.85;
    }
    /* Close */
    .close-btn {
     position: absolute;
    top: 15px; right: 20px;
    font-size: 30px;
    cursor: pointer;
    z-index: 3;
    }

   

    
}

@layer effects{
    /*======================================
    =            CRT-EFFECTS               =
    ======================================*/
    .noise,.os_rgb,.beam {
        position: fixed;
        inset: 0;
        width: 100dvw;
        height: 100dvh;
        pointer-events: none;
    }

    .os_rgb {
        z-index: 10;
        opacity: .2;
        mix-blend-mode: multiply;
        background-image: url(/Images/rgb.svg);
        background-position: 50%;
        background-repeat: repeat;
        background-size: .5rem;
    }

    .noise {
        z-index: 20;
        opacity: .05;
        mix-blend-mode: luminosity;
        background-image: url(/Images/noise.gif);
        background-size: 15rem;
    }

    .beam {
        z-index: 30;
        
        mix-blend-mode: screen; 
        opacity: .1;

        background: repeating-linear-gradient(
            to bottom,
            var(--color-beam-edge) 0%,
            var(--color-beam-edge) 10%,
            var(--color-beam-center) 40%,
            var(--color-beam-center) 60%,
            var(--color-beam-edge) 90%, 
            var(--color-beam-edge) 100%        
        );
        
        background-size: 100% 400px; 
        animation: beam-sweep 4s linear infinite;
    }
    /* --- Scanline & Vignette --- */
    body::before {
        content: " ";
        position: fixed;
        inset:0;
        background: repeating-linear-gradient(
                rgb(from var(--color-shadow) r g b / .25) 2px,
                rgb(from var(--color-shadow) r g b / 0) 2px,
                rgb(from var(--color-shadow) r g b / .25) 4px);
        background-size: 100% 4px;
        z-index: 40;
        pointer-events: none;
        animation: crt-flicker 0.15s infinite;

        box-shadow: 
        inset 0 0 300px rgb(from var(--color-shadow) r g b / .85), 
        inset 0 0 100px var(--color-shadow);
    }
}

@layer utilities{
    /*======================================
    =            SCROLL-BAR                =
    ======================================*/
    *::-webkit-scrollbar{
        width: 8px;
    }

    *::-webkit-scrollbar-track{
        background: var(--color-bg-track); 
        box-shadow: inset 0 0 4px rgb(from var(--color-shadow) r g b / .8);
        border-left: 1px solid  rgb(from var(--color-accent) r g b / 0.1);
    }

     *::-webkit-scrollbar-thumb {
        background: var(--color-accent);
        border-radius: 4px;
        box-shadow: 0 0 8px rgb(from var(--color-accent) r g b / 0.6); 
    }

    *::-webkit-scrollbar-thumb:hover {
        background: var(--color-accent-light);
        box-shadow: 0 0 12px rgb(from var(--color-accent) r g b / 0.9);
    }

    .no-webgpu :is(.icons-icon svg) {
        display: unset;
    } 
    @media (min-width: 800px) {
        .icons {
            position: relative;
            inset: unset;
            padding-block: 0;
            height: 100dvh;

             justify-content: center;
            overflow-y: hidden;
        }

        .icons-list {
            display: flex;
            align-items: center;
            gap: 72px;
        }
    }
}

@layer animations{
    /*======================================
    =             ANIMATIONS               =
    ======================================*/
    @keyframes crt-flicker {
        0% {opacity: 0.99;}
        50% {opacity: 1;}
        100% { opacity: 0.99;}
    }
    @keyframes beam-sweep {
        0% { background-position-y: 0px; }
        100% { background-position-y: -400px;}
    }
}


