:root {
  --text-color: white;
  --body-bg: #222;
  --highlight: #f0ece5;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.3);
  --max-width: 500px;
  --media-size: 300px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "IBM Plex Sans", sans-serif;
  background-color: var(--body-bg);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(15px, 5vw, 20px);
  overscroll-behavior: none;
  font-size: 18px;
  font-size: clamp(18px, 2vw, 20px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
  &:hover {
    text-decoration: underline;
  }
}

.d-flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.visually-hidden {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Background */
#background {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  img {
    position: relative;
    left: -10%;
    top: -10%;
    width: 120%;
    height: 120%;
    object-fit: cover;
    opacity: 0.6;
    filter: blur(20px);
  }
}

#main-card {
  width: 100%;
  max-width: var(--max-width);
  /* background: #00000000; */
  /* backdrop-filter: blur(20px); */
  border-radius: 20px;
  padding-block: clamp(25px, 5vw, 35px);
  /* padding-inline: clamp(15px, 5vw, 25px); */
  position: relative;
  overflow: hidden;
  gap: 20px;
}

/* Header Styles */
header {
  text-align: center;
  align-items: center;
  h1 {
    font-family: "Climate Crisis", sans-serif;
    font-variation-settings: "YEAR" 1979;
    text-transform: uppercase;
    font-size: clamp(2.5em, 10vw, 3em);
    font-weight: bold;
    line-height: 0.75;
    margin-bottom: 0.2em;
    color: var(--highlight);
    max-width: 9ch;
    span {
      background: -webkit-linear-gradient(
        var(--highlight) 60%,
        transparent 100%
      );
      background-clip: text;
      -webkit-text-fill-color: transparent;
    }
  }
  p {
    font-size: 0.8em;
  }
}

#update-collection-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
}

#controls {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: var(--media-size);

  &.loading {
    opacity: 0.6;
    pointer-events: none;
  }
}

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

input {
  flex: 1;
  background: rgba(0, 0, 0, 0.15);
  /* backdrop-filter: blur(10px); */
  border: 1px solid transparent;
  border-radius: 10em;
  padding: 10px 100px 10px 15px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  color: white;
  &:focus {
    border-color: white;
    background: rgba(0, 0, 0, 0.25);
    box-shadow: inset 0 2px 5px #00000030;
  }
  &::placeholder {
    color: rgba(255, 255, 255, 0.5);
  }
  &:placeholder-shown + .btn-small {
    display: none;
  }
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-left: 0.5rem;
}

select {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid transparent;
  border-radius: 10em;
  padding: 0.5em 2em 0.5em 1em;
  backdrop-filter: blur(10px);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  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;
  min-width: 8ch;
  transition: all 0.15s;
  &:focus {
    border-color: white;
    background-color: rgba(255, 255, 255, 0.2);
  }
}

/* Primary Dig Button */
.btn-primary {
  padding: 0.5em;
  background: var(--highlight);
  border: none;
  border-radius: 10em;
  color: var(--body-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  width: 30px;

  &:after {
    display: inline-flex;
    content: attr(aria-label);
    position: absolute;
    min-width: max-content;
    bottom: 120%;
    background-color: #ffffffcc;
    font-size: 11px;
    font-weight: bold;
    line-height: 1;
    padding: 0.2em 0.5em;
    border-radius: 0.25em;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    box-shadow: 0 2px 3px #00000060;
  }

  &:hover:not(:disabled) {
    background: white;
    border-color: white;

    &:after {
      transition: opacity 0.15s ease 1s;
      opacity: 1;
    }
  }

  &:disabled {
    cursor: wait;
    .btn-icon {
      animation: rotate forwards 1s infinite;
    }
  }
}

@keyframes rotate {
  0% {
    transform: rotate(0);
  }
  100% {
    transform: rotate(360deg);
  }
}

.btn-icon {
  width: 1em;
}

/* Record Result Styles */
#display-area {
  align-items: center;
  width: 100%;
  gap: 15px;
  background-color: #ffffff20;
  backdrop-filter: blur(10px);
  padding: clamp(20px, 3vw, 25px);
  border-radius: 15px;
}

#result {
  gap: 10px;
  align-items: center;
}

.art-container {
  position: relative;
}

#album-art-link {
  width: 100%;
  aspect-ratio: 1;
  max-width: var(--media-size);
  display: inline-block;
  margin-inline: auto;
  border: 1px solid #ffffff10;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.15s ease;
  background-color: #ffffff20;
  box-shadow:
    0 10px 20px #00000060,
    0 15px 10px -10px #00000030;
  &:hover {
    transform: scale(0.98);
    opacity: 0.9;
  }
}

.album-art {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

#result-info {
  text-align: center;
  width: 100%;
  max-width: var(--media-size);
  gap: 3px;
}

.album-link {
  text-decoration: none;
  display: block;
}

.album-title {
  font-size: 1em;
  font-weight: 700;
  line-height: 1.2;
  transition: color 0.2s;
}

.album-link:hover {
  .album-title {
    text-decoration: underline;
  }
}

.artist-name {
  font-size: 0.7em;
}

#tag-container {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 3px;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 0.3em 0.75em;
  background: rgba(255, 255, 255, 0.1);
  /* border: 1px solid rgba(255, 255, 255, 0.1); */
  border-radius: 5em;
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
}

/* Placeholder & Loading */
@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

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

#loading {
  width: 100%;
  max-width: var(--media-size);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.skeleton-art {
  width: 100%;
  max-width: var(--media-size);
  border: 1px solid #ffffff10;
  aspect-ratio: 1;
  margin: 0 auto;
}
.skeleton-title {
  height: 1.3em;
  width: 90%;
  margin: 0 auto;
}
.skeleton-artist {
  height: 0.8em;
  width: 50%;
  margin: 0 auto;
}

.skeleton-tags {
  height: 0.75em;
  width: 30%;
  margin: 0 auto;
}

footer {
  text-align: center;
  font-size: 11px;
  opacity: 0.6;
  margin-top: 10px;
}

#error-box {
  position: fixed;
  bottom: 20px;
  font-size: 15px;
  font-weight: bold;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(193, 1, 1, 0.65);
  backdrop-filter: blur(10px);
  padding: 1em 1.5em;
  border-radius: 1em;
  color: white;
  z-index: 50;
  transition:
    transform 0.25s ease 0.25s,
    opacity 0.25s ease;
  opacity: 0;

  &.on-screen {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.hidden {
  display: none !important;
}
