@charset "utf-8";

:root {
  --aspect-ratio: 1 / 1;
}

body {
  overflow-x: hidden;
  background: #1f1f1f;
  user-select: none;
  font-family: var(--font-family);
  font-size: 14px;

  &.grabbing {

    *,
    *::before,
    *::after {
      cursor: grabbing !important;
    }
  }
}

.mask {
  position: fixed;
  inset: 0;
  background: #0009;
  z-index: 100;

  &.hidden {
    display: none;
  }
}

.drag-card-img {
  position: fixed;
  opacity: 0.5;
  pointer-events: none;
  z-index: 20;

  &.hidden {
    display: none;
  }
}

.container {
  max-width: 1200px;
  width: calc(100% - 8px);
  margin: 0 auto;
}

header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  background: inherit;
  border-bottom: 1px solid #2a2b2c;
  padding: 4px 0;

  .container {
    display: flex;
    align-items: center;

    .logo-link {
      @media (hover: hover) {
        &:hover {
          filter: brightness(1.1);
        }
      }
    }

    .checkbox-label.toggle {
      width: 32px;
      justify-content: center;

      [type="checkbox"] {
        &:not(:checked)~.bi:first-of-type {
          display: none;
        }

        &:checked~.bi:last-of-type {
          display: none;
        }
      }
    }

    .slim-checkbox-label {
      margin-left: auto;
    }

    .pin-checkbox-label {
      margin-left: 2px;
    }

    .lock-checkbox-label {
      margin-left: 2px;
    }

    .size-radio-label-container {
      display: flex;
      gap: 2px;
      margin-left: 8px;

      .size-radio-label {
        width: 32px;
        justify-content: center;
      }
    }
  }
}

main {
  margin-top: 41px;
  padding-bottom: 4px;
}

.hero-section {
  color: #ccc;
  padding-top: 8px;

  h1 {
    font-size: 14px;
  }

  a {
    color: #4e94ce;
    text-decoration: none;

    @media (hover: hover) {
      &:hover {
        color: #63afee;
      }
    }
  }

  .mt-16 {
    margin-top: 16px;
  }

  .flex {
    display: flex;
    align-items: center;

    .separator {
      margin: 0 4px;
    }

    .bi {
      margin-right: 3px;

      &.bi-clock {
        font-size: 12px;
      }
    }
  }
}

.main-section {
  padding-top: 16px;
}

body.preview {
  .main-section {
    display: none;
  }
}

.preview-section {
  display: none;
}

body.preview {
  .preview-section {
    color: #ccc;
    padding-top: 16px;
    display: block;

    p+p {
      margin-top: 4px;
    }

    .preview-message {
      margin-top: 12px;
    }

    .canvas {
      display: block;
      max-width: 100%;
      margin-top: 12px;
    }
  }
}

.btn-container {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tier-list {
  display: grid;
  grid-template-columns: auto 1fr;
  margin-top: 4px;
  border: 1px solid #181818;
  width: calc(100% - 28px);

  &:empty {
    display: none;
  }

  .tier-item {
    position: relative;
    grid-column: span 2;
    display: grid;
    grid-template-columns: subgrid;

    .tier-main-container {
      grid-column: span 2;
      display: grid;
      grid-template-columns: subgrid;

      .tier-main-container-inner {
        grid-column: span 2;
        display: grid;
        grid-template-columns: subgrid;

        .tier-label-container {
          display: grid;
          border-right: 1px solid #181818;

          .tier-label {
            display: grid;
            place-items: center;
            text-align: center;
            min-width: 48px;
            padding: 2px 4px;
            color: #2f2f2f;
            font-size: 14px;

            @media (width < 1200px) {
              font-size: max(1.2vw, 0.75rem);
              min-width: max(3.8vw, 32px);
            }
          }
        }
      }
    }

    &.active {
      .tier-main-container-inner {
        z-index: 101;
        pointer-events: none;
        outline: 1px solid #fff;
      }
    }

    &+.tier-item {
      .tier-main-container {
        border-top: 1px solid #181818;
      }
    }

    .tier-menu-btn-container {
      position: absolute;
      right: -32px;
      width: 32px;
      height: 100%;
      display: grid;
      place-items: center;

      .tier-menu-btn {
        all: unset;
        cursor: pointer;
        color: #ccc;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        transition: background-color 0.1s;

        @media (hover: hover) {
          &:hover {
            background-color: #fff1;
          }
        }

        .bi {
          display: grid;
          place-items: center;
        }
      }
    }
  }
}

.tier-list.slim {
  .tier-item {
    .tier-main-container {
      .tier-main-container-inner {
        .tier-label-container {
          .tier-label {
            width: 48px;

            @media (width < 1200px) {
              width: max(3.8vw, 32px);
            }
          }
        }
      }
    }
  }
}

body[data-locked] {
  .tier-list {
    width: 100%;

    .tier-item {
      .tier-main-container {
        .tier-main-container-inner {
          .tier-label-container {
            .tier-label {
              pointer-events: none;
            }
          }
        }
      }

      .tier-menu-btn-container {
        display: none;
      }
    }
  }
}

.card-list {
  display: grid;
  align-content: start;
  background: #1b1b1b;

  &:empty {
    &::before {
      content: '';
      aspect-ratio: var(--aspect-ratio);
      pointer-events: none;
    }
  }

  .card-item {
    cursor: grab;
    position: relative;
    aspect-ratio: var(--aspect-ratio);

    &.dragging {
      opacity: 0.3;
    }

    .card-img {
      pointer-events: none;
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
}

body {
  &[data-size-idx="-2"] {
    .card-list {
      grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    }
  }

  &[data-size-idx="-1"] {
    .card-list {
      grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    }
  }

  &[data-size-idx="0"] {
    .card-list {
      grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
  }

  &[data-size-idx="1"] {
    .card-list {
      grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    }
  }

  &[data-size-idx="2"] {
    .card-list {
      grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    }
  }
}

body[data-locked] {
  .card-list {
    .card-item {
      pointer-events: none;
    }
  }
}

.card-list-container {
  border: 1px solid #181818;
}

.bottom-container {
  margin-top: 4px;

  .book-card-list-container {
    margin-right: 28px;
  }

  .void-card-list-container {
    margin: 4px 28px 0 0;

    &.hidden {
      display: none;
    }

    .void-card-list {
      .card-item {
        .card-img {
          opacity: 0.3;
        }
      }
    }
  }

  .void-checkbox-label {
    margin-top: 4px;

    .void-checkbox:not(:checked)~.bi-eye {
      display: none;
    }

    .void-checkbox:checked~.bi-eye-slash {
      display: none;
    }
  }
}

body[data-locked] {
  .bottom-container {
    .book-card-list-container {
      margin-right: 0;
    }
  }

  .void-card-list-container {
    margin-right: 0;
  }
}

body.pin:not(.preview) {
  main {
    position: fixed;
    inset: 0 0 calc(36% + 4px);
    overflow-y: auto;
    padding-bottom: 0;

    .main-section {
      .top-container {
        overflow-x: hidden;
        overflow-y: auto;
      }

      .bottom-container {
        position: fixed;
        inset: 64% 0 0;
        margin-top: 0;
        overflow-y: auto;
        background: var(--color-bg);
        padding-bottom: 4px;
      }
    }
  }
}

@media (width < 720px) {
  body {
    &[data-size-idx="-2"] {
      .card-list {
        grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
      }
    }

    &[data-size-idx="-1"] {
      .card-list {
        grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
      }
    }

    &[data-size-idx="0"] {
      .card-list {
        grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
      }
    }

    &[data-size-idx="1"] {
      .card-list {
        grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
      }
    }

    &[data-size-idx="2"] {
      .card-list {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
      }
    }
  }
}
