@font-face {
    font-family: "Peix";
    src: url("assets/Peix.woff2") format("woff2-variations");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Doto";
    src: url("assets/Doto[ROND\,wght].woff2") format("woff2-variations");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Disket Mono";
    src: url("assets/Disket-Mono-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Disket Mono";
    src: url("assets/Disket-Mono-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --dark: rgb(0, 0, 0);
    --darkless: rgb(44, 44, 44);
    --lightless: rgb(211, 211, 211);
    --light: rgb(255, 255, 255);
    --accent: rgb(221, 140, 83);
    --bg-gradient: radial-gradient(ellipse at center, rgba(0,0,0,100) 33%, var(--darkless) 100%);
    --bg-gradient2: radial-gradient(ellipse at center, rgba(0,0,0,15) 0%, var(--darkless) 100%);
    --bg-gradient3: radial-gradient(ellipse at center, rgba(0,0,0,50) 0%, rgba(11, 11, 11, 88) 100%);
    --bg-gradient4: radial-gradient(ellipse at center, rgba(0,0,0,100) 25%, rgba(100, 100, 100, 50) 100%);
    --tools-height: 30dvh;
    --tools-width: 24rem;
}

*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}
  
ul, ol, figure, p, pre {
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5 {
    font-family: "Peix", sans-serif;
    font-variation-settings: "VOID" 0, "BLCK" 0, "LONG" 0, "ROND" 800;
    font-feature-settings: "ZERO" 1;
    color: var(--light);
    margin: 0;
    padding: 0;
    line-height: 1.1em;
    font-weight: 400;
    text-align: center;
}

h1 {
    font-size: min(4.5rem, 12vw);
    transition: color 500ms ease;
}

a {
    all: unset;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0) 33%, rgba(0,0,0,0) 100%);
    transition: background 200ms;
    
    img {
        min-width: 2rem;
    }
}

a:hover {
    /* font-variation-settings: "VOID" 20, "BLCK" 0, "LONG" 300, "ROND" 0; */
    background: var(--bg-gradient);
}

b {
    color: var(--light);
    font-weight: 800;
}

#bg {
    position: fixed;
    inset: 0;
    background: url(assets/bg3.webp) no-repeat center center fixed;
    background-size: cover;
    opacity: 0.2;
    z-index: -1;
}

body {
    font-family: "Doto", sans-serif;
    font-variation-settings: "ROND" 100;
    font-weight: 600;
    word-spacing: -0.3em;
    margin: 0;
    padding: 0;
    background:
        var(--dark);
    color: var(--lightless);
    font-size: 1.2em;
    line-height: 1.5em;
    letter-spacing: 0.05em;
    overflow: hidden;
    position: relative;
}

button {
    all: unset;
}

.button,
.button2 {
    width: max-content;
    cursor: pointer;
    transition: all 400ms;
}

.button {
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    background: var(--bg-gradient);
    color: var(--light);
    border-color: var(--light);
    border-width: 1px 0 1px 0;
    border-style: solid;
    box-shadow: 0 -0.5rem 0.75rem rgba(255,255,255,0);
}

.button:hover {
    box-shadow: 0 0 0.75rem var(--light);
}

.button2 {
    padding: 0.5rem 0;
}

.button2:hover {
    font-weight: 800;
}

canvas {
    object-fit: contain;
    height: calc(100dvh - var(--tools-height));
    cursor: pointer;
    image-rendering: pixelated;
    position: relative;
    will-change: transform, opacity;
    width: 100%;
}

.color {
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 -0.5rem 0.75rem rgba(221, 140, 83, 0);
}

.color:hover {
    box-shadow: 0 0 0.75rem var(--accent);
}


.divider {
    width: 100dvw;
    margin: 1rem 0;
    border-bottom: 1px solid var(--darkless);
}

.divider-v {
    border-left: 1px solid var(--light);
}

#editor {
    height: 100dvh;
    display: none;
}

form {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 20rem;
    font-size: 1rem;
    line-height: 1.2em;
    flex-wrap: wrap;

    > div {
        display: flex;
        gap: 0.5rem;
        width: 100%;
        align-items: center;
    }

    .button-reset {
        cursor: pointer;
        padding: 0.25rem;
        border-radius: 0.5rem;
        transition: background 400ms;
    }

    .button-reset:hover {
        background: var(--bg-gradient);
    }

    /* Inactive state (slider already at default) */
    .button-reset.inactive {
        opacity: 0.5;
        cursor: default;
        pointer-events: none;
    }

    .button-reset.inactive:hover {
        background: none;
    }

    label {
        /* flex: 0 0 100%; */
        width: auto;
    }
}

.form-text {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    padding-right: 40px;

    span {
        color: var(--accent);
    }
}

.form-title {
    color: var(--light);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    max-width: 20rem;
    width: 100%;

    div {
        width: 100%;
        border-bottom: 1px solid var(--light);
    }
}

#imageCanvas {
    touch-action: none;
    -ms-touch-action: none;
}

#image-container {
    display: flex;
    flex-flow: column;
    flex: 1 1 auto;
    height: auto;
    position: relative;
    justify-content: center;
    outline: 1px solid transparent;
    outline-offset: 0;
    transition: 200ms;
    z-index: 1;
    background: var(--bg-gradient);

    #batch,
    #exif {
        position: absolute;
        border: 1px solid var(--darkless);
        border-radius: 0.5rem;
        display: flex;
        flex-flow: column;
        opacity: 0;
        transition: opacity 200ms, translate 200ms;
        font-size: 0.9rem;
        background: var(--bg-gradient);
        pointer-events: none;
    }

    #batch {
        top: 1rem;
        left: 1rem;
        translate: 0 -2rem;
        gap: 1rem;
        padding: 0.5rem 1rem 1.5rem;

        #batch-list {
            display: flex;
            flex-flow: column;
            gap: 0.5rem;

            div {
                display: flex;
                gap: 1rem;
                font-size: 1rem;
            }
        }
    }

    #exif {
        bottom: 1rem;
        right: 1rem;
        translate: 0 2rem;
        padding: 0.5rem 1rem;
    }

    #exif.active {
        translate: 0;
        opacity: 1;
    }

    #batch.active {
        translate: 0;
        opacity: 1;
        pointer-events: auto;
    }

    #info {
        position: absolute;
        inset: auto auto 0.5rem 0.5rem;
        text-transform: uppercase;
        font-size: 0.8rem;
        /* font-weight: 900; */
        line-height: 1.5em;
        display: flex;
        gap: 0.5rem;

        span {
            padding: 0 2px 0 4px;
            background: var(--bg-gradient);
            outline: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 4px;
        }
    }
}

#image-container.drag-over {
    outline: 1px dashed var(--accent);
    outline-offset: -1rem;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 1rem;
}

input {
    all: unset;
    /* border-radius: 2rem; */
}

input[type="file"] {
  display: none;
}

.input-custom1 {
    display: flex;
    width: 100%;
    border-radius: 0.5rem;
    background: var(--bg-gradient);
    color: var(--light);
    border-color: var(--light);
    border-width: 1px 0 1px 0;
    border-style: solid;
    transition: all 400ms;
    overflow: hidden;

    button {
        width: min-content;
    }

    input {
        padding: 0.5rem;
        -moz-appearance: textfield;
        appearance: textfield;
    }

    .slider-value {
        width: 100%;
        padding-right: 1rem;
    }

    > * {
        transition: background 400ms;
    }

    > *:hover {
        background: var(--bg-gradient4);
    }
}

li {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    list-style-type: none;
    padding: 0.5rem 1rem 0.5rem 0;
    width: max-content;
    cursor: pointer;
    border-radius: 0.75rem;
    transition:
        background 400ms,
        padding 200ms;

    span {
        outline: 1px dotted var(--light);
        border-radius: 0.25rem;
        padding: 0 4px;
        font-size: 0.6rem;
        font-weight: 800;
    }
}

li:hover {
    background: var(--bg-gradient);
    outline: 1px solid rgba(255,255,255,0.2);
    padding: 0.5rem 1rem;
}

li.active {
    font-weight: 800;
    color: var(--light);
}

li.creator {
    font-weight: 800;
    color: var(--accent);
    border-radius: 0;
    border-top: 1px solid var(--accent);
    border-bottom: 1px solid transparent;
    padding: 0.5rem 0;
    margin: 1.5rem 0 0.25rem;

    a {
        padding: 0;
    }

    a:hover {
        background: none;
    }
}

li.creator:hover {
    background: none;
    padding: 0.5rem 1rem;
    border: 1px solid var(--accent);
    outline: none;
}

@keyframes loading-raw {
    to {
        opacity: 0.5;
    }
}

#loader-raw {
        position: absolute;
        right: 1rem;
        bottom: 1rem;
        background: var(--dark);
        outline: 1px solid var(--light);
        border-radius: 4px;
        padding: 0.25rem 0.5rem;
        font-size: 0.9rem;
        content: "Loading RAW data...";
        animation: loading-raw 1s linear infinite alternate;
        opacity: 1;
        pointer-events: none;
        visibility: hidden;
    }

main {
    width: 100dvw;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-flow: column;

    -ms-overflow-style: none;
    scrollbar-width: none;

    ::-webkit-scrollbar {
        display: none;
    }

}

nav {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    translate: -50% 0;
}

@keyframes processing {
    to {
        transform: rotate(360deg);
    }
}

.processing {
    position: absolute;
    left: 50%;
    top: 50%;
    translate: -50% -50%;
    width: 2rem;
    z-index: 10;
    visibility: hidden;
    pointer-events: none;
    animation: processing 1s linear infinite;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    width: 100%;
    background: var(--darkless);
    outline: 1px dotted var(--light);
    height: 3px;
    border-radius: 2px;
    transition: background 400ms;
    /* Make vertical swipes scroll instead of moving the slider */
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
}

.slider:hover {
    background: var(--light);
}

.slider::-moz-range-progress {
    background: var(--light);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    background: var(--bg-gradient4);
    border-width: 1px;
    border-style: solid;
    border-color: var(--light);
    border-radius: 0.25rem;
    outline-offset: -10px;
    outline: 1px solid var(--accent);
    height: 1.5rem;
    width: 1.5rem;
    cursor: pointer;
    transition: all 200ms;
    box-shadow: 0 0 0.5rem var(--dark);
}

.slider::-moz-range-thumb {
    position: relative;
    background: var(--bg-gradient4);
    border-width: 1px;
    border-style: solid;
    border-color: var(--light);
    border-radius: 0.25rem;
    outline-offset: -10px;
    outline: 1px solid var(--accent);
    height: 1.5rem;
    width: 1.5rem;
    cursor: pointer;
    transition: all 200ms;
    box-shadow: 0 0 0.5rem var(--dark);
    rotate: 0deg;
}

.slider::-webkit-slider-thumb:hover {
    width: 2rem;
    height: 2rem;
    outline-offset: 0.25rem;
    rotate: 45deg;
}

.slider::-moz-range-thumb:hover {
    width: 2rem;
    height: 2rem;
    outline-offset: 0.25rem;
    rotate: 45deg;
}

#start {
    height: 100%;
    max-width: 80rem;
    display: flex;
    flex-flow: column;
    align-self: center;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    gap: 2rem;
    padding: 1rem;
    transition: color 500ms ease;

    #logo {
        display: flex;
        flex-flow: column;
        gap: 0.5rem;
        position: fixed;
        top: 2rem;
        left: 50%;
        translate: -50%;
        /* clip-path: polygon(0 1rem,1rem 0,calc(100% - 1rem) 0,100% 1rem,100% calc(100% - 1rem),calc(100% - 1rem) 100%,1rem 100%,0 calc(100% - 1rem)); */

        img {
            width: 16rem;
        }
    }

    #intro {
        display: flex;
        flex-flow: column;
        align-items: center;
        gap: 2rem;

        p {
            font-size: 1rem;
            line-height: 1.4em;
            max-width: 28rem;
        }
    }
}

#start.drag-over {
        color: rgba(255, 255, 255, 0.5);

        h1 {
            color: rgba(255, 255, 255, 0.5);
        }
    }

#tools {
    position: relative;
    display: flex;
    flex-flow: column;
    overflow: hidden;
    flex-shrink: 0;
    image-rendering: pixelated;

    #tools-nav {
        position: relative;
        display: flex;
        gap: 2px;
        padding: 0.5rem;
        border-top: 1px solid var(--light);
        border-radius: 0.5rem;
        height: 4rem;
        width: 100%;
        overflow: hidden;
        flex-shrink: 0;
        background: var(--dark);
        z-index: 10;

        a {
            /* width: 1.5rem; */
            flex: 1 1 auto;
            font-size: 1rem;
            justify-content: center;
            position: relative;
        }

        a:hover {
            background: none;
        }

        a::before {
            content: "";
            position: absolute;
            inset: 1rem 0;
            border-radius: 0.5rem;
            background: var(--bg-gradient);
            opacity: 0;
            transition: opacity 200ms ease, inset 200ms ease;
            pointer-events: none;
            z-index: -1;
        }

        a:hover::before,
        a.active::before {
            inset: 0;
            opacity: 1;
        }

        a span {
            /* translate: 0 0.5rem; */
            opacity: 0.5;
            transition: opacity 200ms;
            /* pointer-events: none; */
            /* position: absolute; */
        }

        a.active {
            /* font-variation-settings: "VOID" 20, "BLCK" 0, "LONG" 300, "ROND" 0; */
            background: var(--bg-gradient);
            font-weight: 800;
            /* width: max-content; */
            
            span {
                /* translate: 0 0; */
                opacity: 1;
                /* position: relative; */
            }
        }
    }

    #tools-buttons {
        position: fixed;
        bottom: 4rem;
        right: 0;
        border: 1px solid var(--darkless);
        border-radius: 
            0.75rem 0.75rem 0 0.75rem;
        background: var(--dark);
        /* background: var(--bg-gradient); */
        z-index: 5;
        display: flex;
        padding: 0.25rem;
        transition: translate 200ms ease-out;
        /* translate: 0 2.25rem; */

        a {
            padding: 0.25rem;
            position: relative;
            transition: opacity 200ms ease, inset 200ms ease;
        }

        a:hover {
            background: none;
        }

        a::before {
            content: "";
            position: absolute;
            inset: 1rem 0;
            border-radius: 0.5rem;
            background: var(--bg-gradient);
            opacity: 0;
            transition: opacity 200ms ease, inset 200ms ease;
            pointer-events: none;
            z-index: -1;
        }

        a:hover::before {
            inset: 0;
            opacity: 1;
        }
    }

    #tools-buttons:hover {
        translate: 0;
    }

    #tools-content {
        position: relative;
        display: flex;
        overflow-x: auto;
        overflow-y: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        border-top: 1px solid var(--darkless);
        background: var(--bg-gradient3);
        align-items: flex-start;
    }

    #tools-content.no-snap {
        scroll-snap-type: none;
    }

    #tools-content > div {
        position: relative;
        scroll-snap-align: start;
        width: 100dvw;
        flex-shrink: 0;
        padding: 0 1rem;
    }

    #lut-select {
        display: flex;
        gap: 2rem;

        #luts {
            padding: 1rem;
            width: 100%;
        }
    }

    #refine {
        display: flex;
        flex-flow: column;
        gap: 1.5rem;
        align-items: center;
        padding: 2rem 2rem 5rem !important;
        -webkit-overflow-scrolling: touch; /* Momentum scrolling on iOS */
    }

    #output {
        display: flex;
        flex-flow: column;
        gap: 2rem;
        justify-content: center;
        padding: 2rem !important;

        > div {
            display: flex;
            gap: 0.5rem;
            align-items: center;
            flex-wrap: wrap;

            p {
                font-size: 1rem;
            }

            button {
                padding: 0.25rem 0.5rem;
            }

            span {
                font-size: 1rem;
                flex: 0 0 100%;
            }

        }
    }
}

.xy-slider {
    padding: 0.5rem 0;
    position: relative;
    width: 100%;
    height: 4rem;
}

.xy-slider-track {
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, #4A90E2 0%, #FFFFFF 50%, #FF6B35 100%),
                linear-gradient(to bottom, #00FF00 0%, transparent 50%, #FF00FF 100%);
    background-blend-mode: multiply;
    border: 1px dotted var(--light);
    border-radius: 8px;
    cursor: crosshair;
    position: relative;
    touch-action: none;
}

.xy-slider-thumb {
    position: absolute;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--bg-gradient4);
    border: 1px solid var(--light);
    border-radius: 0.25rem;
    outline-offset: -10px;
    outline: 1px solid var(--accent);
    cursor: grab;
    translate: -50% -50%;
    rotate: 45deg;
    transition: all 200ms;
    box-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.25);
}

.xy-slider-thumb:hover {
    height: 2rem;
    width: 2rem;
    rotate: -45deg;
}

.xy-slider-thumb:active {
    cursor: grabbing;
}

@media (orientation: landscape) {

    canvas{
        flex: 1 1 auto;
    }

    .divider {
        width: var(--tools-width);
        margin: 1rem 0 1rem -2rem;
    }

    #editor {
        flex-flow: row;
    }

    form {
        max-width: 100%;
    }

    #image-container {

        #exif {
            left: auto;
        }
    }

    #tools {
        width: var(--tools-width);
        flex-shrink: 0;
        height: 100%;
        border-left: 1px solid var(--darkless);

        #tools-content {
            border-top: none;
        }

        #tools-content > div {
            padding: 2rem;
            width: 100%;
            align-items: flex-start;
        }

        #lut-select {
            justify-content: initial;
        }

        #luts {
            padding: 0 !important;
        }

        #refine {
            padding: 2rem 2rem 4rem !important;
        }
    }
}

/* @media (orientation: landscape) and (hover: none) {
    #tools {
        #tools-buttons {
            translate: 0 2.25rem;
        }
    }
} */

@media (orientation: portrait) {
    #editor {
        flex-flow: column;
    }

    #start {

        #intro {
            margin-top: 2rem;
        }
    }

    #tools {
        height: var(--tools-height);
    }
}