/* Header Styles */
header {
  width: 100%;
  text-align: center;
  flex-direction: column;

  @media (min-width: 550px) {
    z-index: 100;
    top: 0;
    position: sticky;
    flex-direction: row;
    height: var(--header-lg);
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding-block: 15px;
    padding-inline: 20px 15px;
    overflow: visible;
    background: var(--body-bg);
    border-bottom: 1px solid #ffffff20;
    box-shadow: 0 0 0 #00000090;
    transition:
      box-shadow var(--duration-fast) ease,
      filter var(--duration-fast) ease;

    html[data-scrolled-past="true"] & {
      box-shadow:
        0 15px 15px -15px #00000060,
        0 0 25px #00000050;
      transition: box-shadow var(--duration-slow) ease;
    }
  }

  #title {
    position: relative;
    transition:
      opacity var(--duration-fast),
      filter var(--duration-fast);
    align-items: center;
    gap: 5px;

    @media (min-width: 550px) {
      text-align: left;
      align-items: flex-start;
      gap: 4px;
    }

    p {
      font-size: 12px;
      opacity: 0.7;
      line-height: 1.2;
      @media (min-width: 550px) {
        margin-bottom: -0.3em;
      }
    }
  }

  h1 {
    position: relative;
    font-family: "Climate Crisis", sans-serif;
    font-variation-settings: "YEAR" 1979;
    text-transform: uppercase;
    font-weight: bold;
    font-size: clamp(22px, 4vw, 26px);
    line-height: 0.75;
    color: var(--highlight);

    span {
      position: relative;
      left: -0.2em;
      text-shadow: none;
      opacity: 0.6;
      background: -webkit-linear-gradient(
        180deg,
        var(--highlight) 80%,
        #f0ece550 100%
      );
      background-clip: text;
      -webkit-text-fill-color: transparent;
    }
  }
  p {
    font-size: clamp(0.8em, 3vw, 1em);
    text-wrap: balance;
    a {
      border-bottom: 1px dotted;
      padding-bottom: 0.1em;
      &:hover {
        text-decoration: none;
        border-bottom-style: solid;
      }
    }
  }
}

.header-main {
  width: 100%;
  min-width: max-content;
  z-index: 10;
  top: 0;
  left: 0;
  position: fixed;
  height: 56px;
  text-align: center;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  padding-block: 10px;
  padding-inline: 10px;
  overflow: hidden;
  background: var(--body-bg);
  box-shadow: 0 0 0 #00000090;
  transition:
    box-shadow var(--duration-fast) ease,
    filter var(--duration-fast) ease;

  html[data-scrolled-past="true"] & {
    box-shadow:
      0 15px 15px -15px #00000060,
      0 0 25px #00000050;
    transition: box-shadow var(--duration-slow) ease;
  }

  @media (min-width: 550px) {
    padding-inline: 25px;
    position: static;
    display: contents;
    height: auto;
  }
}

.header-spacer {
  display: none;
}

@media (width < 550px) {
  .header-spacer {
    display: block;
    height: 56px;
  }
}

#settings {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  visibility: hidden;
  gap: 2px;

  @media (min-width: 800px) {
    opacity: 1;
    visibility: visible;
    display: flex;
    animation: fadeIn var(--duration-fast) forwards;
  }
}

#size-toggle {
  align-items: center;
  border-radius: 10em 0 0 10em;
  padding: 0;
  font-size: 13px;
  font-weight: bold;
  border: none;
  background-color: #00000040;

  &:focus-within {
    outline: 1px solid white;
  }

  input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    &:focus-visible + label {
      outline: 2px solid var(--body-bg);
    }
    &:hover + label {
      background-color: #ffffff20;
      .size-icon {
        opacity: 1;
      }
    }
  }
  label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    cursor: pointer;
    border: 1px solid transparent;
    line-height: 1;
    transition: background-color var(--duration-fast);

    &[for="size-s"] {
      border-radius: 50% 0 0 50%;
      .size-icon {
        width: 4px;
      }
    }
    &[for="size-l"] {
      .size-icon {
        width: 8px;
      }
    }
  }

  .size-icon {
    display: block;
    width: 6px;
    aspect-ratio: 1;
    background-color: var(--highlight);
    opacity: 0.4;
    border-radius: 2px;
    box-shadow: 0 0 0 1px var(--body-bg);
  }

  input:checked + label {
    color: var(--body-bg);
    pointer-events: none;
    position: relative;
    overflow: hidden;

    .size-icon {
      opacity: 1;
    }
  }
}

.btn-filter {
  cursor: pointer;
  padding: 0;
  padding-inline: 0.75em;
  background-color: #00000040;
  border: none;
  color: #ffffff99;
  font-size: 12px;
  transition:
    background-color var(--duration-fast),
    color var(--duration-fast);
  &:hover,
  &:focus-visible {
    background-color: #ffffff20;
    color: white;
  }
  &.active {
    color: white;
  }
  svg {
    width: 10px;
  }
}

#style-filter-container {
  position: relative;
}

#open-style-filters {
  border-radius: 0 10em 10em 0;
}

#open-style-filters-count {
  font-weight: normal;
}

#main-clear-style-filters {
  position: absolute;
  right: -8px;
  top: -4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: white;
  color: var(--body-bg);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  transition: transform var(--duration-fast);
  box-shadow: 0 2px 3px #00000060;
  svg {
    width: 12px;
    height: 12px;
  }
}

/* FORMATS */
#format-filter {
  border-radius: 0;
  max-width: 55px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 1em;
}

/* CONTROLS */
#controls {
  box-sizing: content-box;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 220px;
  transition: opacity var(--duration-fast) ease-in-out;
  @media (width<550px) {
    min-width: 100%;
    box-sizing: border-box;
    padding: 0 25px 10px;
    background: var(--body-bg);
    border-bottom: 1px solid #ffffff20;
  }

  &:before {
    pointer-events: none;
    content: "Discogs username:";
    text-transform: uppercase;
    font-weight: bold;
    position: absolute;
    font-size: 10px;
    opacity: 0;
    transition: opacity var(--duration-fast);
    @media (width<550px) {
      bottom: calc(100% + 5px);
      left: 50%;
      transform: translateX(-50%);
    }
    @media (min-width: 550px) {
      top: 50%;
      right: calc(100% + 5px);
      transform: translateY(-50%);
      min-width: max-content;
    }
  }

  &:has(#collection-url:focus) {
    &:before {
      opacity: 1;
    }
  }
}

#input {
  position: relative;
  width: 100%;
  &:before {
    content: "";
    background: url(./icn-user.svg) center no-repeat;
    background-size: 1em;
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 1em;
    height: 1em;
  }
  @media (width<550px) {
    max-width: 260px;
  }
}

#collection-url {
  width: 100%;
  position: relative;
  background: #ffffff10;
  border: 1px solid #ffffff00;
  border-radius: 10em;
  padding: 10px 40px 10px 40px;
  outline: none;
  transition: all var(--duration-slow);
  color: white;
  font-size: 14px;
  @media (width<550px) {
    font-size: 16px;
  }
  &:hover {
    border-color: #ffffff50;
  }
  &:focus {
    border-color: white;
    background: rgba(0, 0, 0, 0.25);
    box-shadow:
      inset 0 2px 6px #00000040,
      0 0 50px #ffffff30;
  }
  &::placeholder {
    color: rgba(255, 255, 255, 0.5);
  }
  &:placeholder-shown + #controls-ui {
    pointer-events: none;
    opacity: 0.5;
  }
}

#controls-ui {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  gap: 2px;
  z-index: 1;
}

#pick-btn {
  padding: 0.5em;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-slow);
  width: 30px;
  height: 30px;

  @media (pointer: fine) {
    &:hover:not(:disabled) {
      background: white;
      border-color: white;
      transform: scale(1.05);
      box-shadow: 0 1px 5px #00000050;
    }
  }

  &:disabled {
    cursor: wait;
    transform: scale(0.9);
    opacity: 0.6;
    .btn-icon {
      animation: rotate forwards 1s infinite;
    }
  }
}

#scroll-top {
  display: none;
  @media (width < 550px) {
    position: fixed;
    bottom: 20px;
    left: 50%;
    z-index: 50;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--highlight);
    color: var(--body-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: transform var(--duration-slow) ease-in-out;
    box-shadow: 0 2px 25px 5px #00000090;
    transform: translate(-50%, 100px);

    svg {
      width: 20px;
      height: 20px;
    }
  }

  html[data-scrolled-past="true"] & {
    transform: translate(-50%, 0);
    pointer-events: auto;
  }
}
