/* /- CSS RESET -/ */
* { margin: 0; padding: 0; }
*, *::before, *::after { box-sizing: border-box; }

body { min-height: 100dvh; }
input, button { font: inherit; }

img, svg { height: auto; max-width: 100%; }
/* /- CSS RESET -/ */

:root {
  --r-white: #e5e4d1;
  --r-black: light-dark(#343232, #111111);

  --selection-rgb: rgb(221 182 49 / 0.1);
  --selection: #ddb631;

  --magnifier-opacity: 0;
  --magnifier-top: 0;
  --magnifier-left: 0;

  --bg: light-dark(var(--r-white), var(--r-black));
  --text: light-dark(var(var(--r-black)), var(var(--r-white)));
  --gradient: linear-gradient(120deg,
        light-dark(rgb(229 228 209 / 0.2), rgb(17 17 17 / 0.1)),
        var(--selection-rgb));
}

html {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  color-scheme: light dark;
}

* {
  scrollbar-color: var(--selection) transparent;
  scrollbar-width: thin;
}

body {
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--text);
}

footer, header {
  background-color: light-dark(var(--r-black), var(--r-white));
  color: light-dark(var(--r-white), var(--r-black));
  padding: 24px 0;
  position: relative;
  transition: background 150ms;

  & div:not(.loading-bar) {
    margin: 0 auto;
    max-width: 1280px;

    & p {
      width: 100%;
      font-size: 0.875rem;
      line-height: 1.25rem;
      text-align: center;
    }
  }

  & .loading-bar {
    display: flex;
    position: absolute;
    bottom: 0;
    width: 100%;

    & .bar {
      width: 4%;
      height: 6px;
    }
  }
}

header .loading-bar {
  top: 0;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.5rem 0.75rem;
}

.container section:not(.info) {
  margin-top: 4rem;
  display: grid;
  place-items: center;
  max-width: 100%;
  height: clamp(fit-content, 32rem, 100dvh);

  & #mainCanvas {
    border-radius: 0.125rem;
    margin: 0 auto;
    width: 100%;
    height: auto;
    background-image: var(--gradient);
  }

  & #magnifierContainer {
    z-index: 50;
    position: absolute;
    width: 5.5rem;
    height: 5.5rem;
    background-color: transparent;
    border: 2px solid #484848;
    border-radius: 9999px;
    transition: opacity 150ms;
    opacity: var(--magnifier-opacity);
    overflow: hidden;
    top: var(--magnifier-top);
    left: var(--magnifier-left);

    #magnifier {
      height: 100%;
      width: 100%;
    }
  }
}

.info {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  height: 16rem;
  border-radius: 1.5rem;
  position: relative;
  margin: 4rem 0;

  background-color: transparent;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  background-image: var(--gradient);
  
  & #colorDisplay {
    height: 100%;
    width: 5rem;
    border-radius: 0.5rem;
    background-color: var(--selection);
  }

  & .color-conversion {
    height: 100%;
    width: min(fit-content, 100%);
    & .list {
      height: 100%;
      width: 100%;
      text-wrap: pretty;
      display: flex;
      flex-direction: column;
      justify-content: space-evenly;

      & li {
        width: 100%;
        list-style: none;
        font-size: 1.125rem;
        line-height: 1.75rem;
        display: flex;
        flex-direction: row;
        gap: 1rem;

        & button {
          margin-left: auto;
          border: none;
          background: none;
          border-radius: 0;
          padding: 0.25rem 0.50rem;
          border-bottom: 2px solid transparent;
          display: inline-flex;
          align-items: center;
          gap: 0.25rem;
          transition-property: border, transform;
          transition-duration: 150ms;
          
          & svg {
            width: 1.5rem;
            height: 1.5rem;
          }

          &:hover {
            border-block-color: var(--text);
            transform: scaleX(1.1) scaleY(1.1);
          }

          &:active {
            transition-duration: 100ms;
            transform: scaleX(0.95) scaleY(0.95);
          }
        }
      }
    }
  }
}

.dropzone {
  height: 100%;
  & label {
    cursor: pointer;
    border-radius: 0.75rem;
    padding: 1.25rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 1.125rem;
    line-height: 1.75rem;
    row-gap: 0.25rem;
    border: 2px;
    border-style: dashed;
    border-color: var(--selection);
    transition: transform 150ms;
    
    &:hover {
      transform: scale(1.02);
    }
    
    &:active {
      transform: scale(0.98);
    }

    & svg {
      width: 2.5rem;
      height: 2.5rem;
    }
  }

  & input {
    display: none;
  }
}

@media (min-width: 768px) {
  .container section:not(.info) {
    & #mainCanvas {
      width: 80%;
    }
  }
}

@media (max-width: 768px) {
  .info {
    flex-direction: column;
    height: 28rem;
    justify-content: space-between;
    padding: 1.25rem 1rem;

    & #colorDisplay {
      min-height: 3.5rem;
      width: 100%;
      margin-bottom: 0.25rem;
    }

    & .color-conversion {
      width: 100%;
      height: fit-content;
      & .list {
        margin-top: 1rem;
        padding: 0 0.25rem;
        width: 100%;
        height: fit-content;
  
        & li {
          width: 100%;
          font-size: 1rem;
          line-height: 1.5rem;
          margin-top: 0.25rem;
  
          & button {
            & svg {
              width: 1.5rem;
              height: 1.5rem;
            }
          }
        }
      }
    }

    .dropzone {
      min-width: 100%;
      height: auto;
      & label {
        min-width: 100%;
        margin-top: 2rem;
        height: 100px;
        font-size: 1rem;
        line-height: 1.5rem;
      }
    }
  }
}