/* DETAILS */
#detail-container {
  visibility: hidden;
  position: relative;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  @media (width<1000px) {
    position: fixed;
    left: 0;
    z-index: 100;
    pointer-events: none;
  }
  @media (min-width: 1000px) {
    width: 100%;
    max-width: 0;
    transition: max-width var(--duration-slow) ease;
    overflow: hidden;
  }
  &.active {
    visibility: visible;
    @media (width<500px) {
      backdrop-filter: blur(10px);
    }
    @media (width<1000px) {
      transition: background var(--duration-fast);
      background: #1a1a1acc;
      pointer-events: all;
    }
    @media (min-width: 1000px) {
      max-width: var(--panel-width-current);
      overflow: auto;
    }
  }
}

#detail-panel {
  position: absolute;
  color: white;
  background-color: var(--body-bg);
  backdrop-filter: blur(10px);
  pointer-events: none;
  width: var(--panel-width);
  @media (width<1000px) {
    width: calc(100% - 20px);
    max-width: var(--panel-width);
    bottom: -120vh;
    left: 50%;
    transform: translate(-50%, 50%);
    max-height: calc(100% - 20px);
    border-radius: 15px;
    transition: bottom var(--duration-panel) cubic-bezier(0.6, -0.5, 0.2, 1);
    box-shadow:
      0 10px 30px #00000050,
      0 10px 25px #00000099,
      inset 0 0 0 1px #ffffff10;
  }
  @media (min-width: 1000px) {
    width: var(--panel-width-current);
    right: calc(var(--panel-width-current) * -1);
    bottom: 0;
    top: var(--header-lg);
    position: fixed;
    transition: right var(--duration-fast) ease;
    border-left: 1px solid #ffffff20;
  }

  .active & {
    pointer-events: all;
    @media (width<1000px) {
      bottom: 50%;
      transition: bottom var(--duration-slow) ease-in-out;
    }
    @media (min-width: 1000px) {
      right: 0;
    }
  }

  @media (min-width: 500px) and (width<1000px) {
    left: auto;
    transform: none;
    right: 20px;
    width: calc(100% - 40px);
    max-height: calc(100vh - 40px);

    .active & {
      bottom: 20px;
    }
  }
}

#panel-bg {
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  @media (width<1000px) {
    border-radius: 15px;
  }
}

#panel-resize-handle {
  display: none;

  @media (min-width: 1000px) {
    display: block;
    position: absolute;
    left: -10px;
    top: 0;
    bottom: 0;
    width: 20px;
    cursor: col-resize;
    z-index: 20;
    background: transparent;
    &::after {
      content: "";
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      top: 0;
      bottom: 0;
      width: 1.5px;
      background-color: transparent;
      opacity: 0;
      transition:
        opacity var(--duration-fast),
        background-color var(--duration-fast);
    }
    &:hover::after,
    &:active::after {
      opacity: 1;
    }
    &:hover::after {
      background-color: #ccc;
      box-shadow: 0 0 0 1px #00000050;
    }
    &:active::after {
      background-color: #eee;
      box-shadow: 0 0 0 1px #00000099;
    }
    &:before {
      content: "";
      z-index: 21;
      display: block;
      position: absolute;
      width: 8px;
      height: 30px;
      background-color: #ccc;
      box-shadow:
        0 0 0 1px #00000050,
        0 3px 10px #00000050;
      border-radius: 10px;
      top: 50%;
      transform: translate(-50%, -50%);
      left: 50%;
      opacity: 0;
      transition: opacity var(--duration-fast);
    }
    &:hover::before,
    &:active::before {
      opacity: 1;
    }
    &:active::before {
      background-color: white;
    }
  }
}

.panel-resizing {
  #detail-panel {
    transition: none !important;
  }
}

#panel-bg-img {
  position: absolute;
  width: 120%;
  height: 120%;
  left: -10%;
  top: -10%;
  object-fit: cover;
  filter: blur(15px);
  transform-origin: center;
}

#panel-header {
  position: relative;
  z-index: 11;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  h2 {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px;
    text-transform: uppercase;
    text-align: center;
  }
}

.panel-nav {
  display: flex;
  gap: 5px;
}

.panel-btn {
  background: none;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
  height: 25px;
  width: 25px;
  line-height: 0;
  border-radius: 5px;
  transition: opacity var(--duration-fast);
  &:hover,
  &:active {
    color: #ffffff50;
  }
  svg {
    width: 100%;
    height: 100%;
  }
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

#panel-img-container {
  position: relative;
  background-color: #ffffff10;
  width: 100%;
  max-width: 600px;
  margin-inline: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 15px;
  overflow: hidden;
  box-shadow:
    0 10px 20px #00000060,
    0 15px 10px -10px #00000030;

  .loading & {
    background: linear-gradient(
      90deg,
      #eeeeee10 25%,
      #eeeeee20 50%,
      #eeeeee10 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
  }
}

.loading-icon {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 5px solid #ffffff50;
  border-bottom-color: transparent;
  border-radius: 50%;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;

  .loading & {
    display: inline-block;
  }
}

@keyframes rotation {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

#panel-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#panel-content {
  z-index: 11;
  padding: 0 25px 40px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
  overscroll-behavior: none;
  opacity: 0;
  transition: opacity var(--duration-slow) ease var(--duration-slow);
  .active & {
    opacity: 1;
  }
}

.panel-info {
  font-size: 16px;
  line-height: 1.3;
}

#panel-title {
  font-size: 18px;
  line-height: 1.2;
  margin-bottom: 0.15em;
  @media (width<1000px) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  &:focus {
    outline: none;
  }
}

#panel-artist {
  font-size: 15px;
  @media (width<1000px) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

#panel-year {
  font-size: 15px;
  font-style: normal;
  opacity: 0.6;
  padding-bottom: 10px;
}

.panel-meta {
  border-top: 1px dotted #ffffff20;
  list-style: none;
  padding-top: 10px;
  font-size: 12px;
  gap: 5px;
  min-height: 90px;
  align-items: flex-start;

  li {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 1.3em;
    max-width: 100%;
    color: #ffffffcc;
    transition: opacity var(--duration-fast) ease;

    &:empty {
      display: none;
    }
    .loading & {
      opacity: 0;
    }
  }
}

#panel-link,
#panel-link-yt {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 0.25em;
  margin-top: 25px;
  font-size: 14px;

  img {
    height: 1em;
  }
}

#panel-link-yt {
  margin-top: 8px;
}

#swipe-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #00000090;
  backdrop-filter: blur(10px);
  color: var(--highlight);
  font-size: 13px;
  line-height: 1;
  padding: 0.5em 0.75em;
  border-radius: 10em;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity var(--duration-slow) ease;
  &.visible {
    opacity: 1;
  }
}
