@font-face {
  font-family: "BaarMetanoia";
  src: url("font/BaarMetanoia-BWZ8.ttf");
}

:root {
  --primary: oklch(0.3843 0.1412 306.49);
  --on-primary: oklch(0.9676 0.0192 306.49);
  --border-primary: oklch(0.65 0.1412 306.49);
  --border-section: oklch(0.65 0.1412 306.49 / .5);
  --hover-primary: oklch(0.3071 0.1412 306.49);
  --on-bg: oklch(0.0559 0.0291 306.49);
  --interact: oklch(0.3635 0.136 258.36);
  --bg-soft: oklch(0.9154 0.035 306.49);
}

* {
  box-sizing: border-box;
}

body {
  background-color: #fff;
  color: var(--on-bg);
  font-family: "BaarMetanoia", sans-serif; 
  font-size: 16px;
}

main {
  color: var(--on-bg);
  max-width: 1200px;
  margin: auto;
}

input, button {
  font-size: 24px;
  border-radius: 8px;
  font-family: "BaarMetanoia", sans-serif; 
}

*:focus-visible {
  outline: 2px dashed black !important;
  box-shadow: 0 0 0 2px white !important;
}

input[type=text] {
  padding: .5em .75em;
  border: 1px solid var(--border-primary);

  &:hover {
    border: 1px solid var(--hover-primary);
  }
}

.accordion-toggle {
  background-color: white;
  border: none;
  cursor: pointer;
  color: var(--interact);

  &::before {
    content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="oklch(0.3635 0.136 258.36)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-up"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 15l6 -6l6 6" /></svg>');
    vertical-align: sub;
    padding-right: .25em;
  }

  &.closed::before {
    content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="oklch(0.3635 0.136 258.36)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 9l6 6l6 -6" /></svg>');
  }

  &.closed + .accordion-content {
    display: none !important;
  }

  &.closed + .accordion-tags-content .tag {
    display: none !important;
  }
}

.primary {
  background-color: var(--primary);
  color: var(--on-primary);
  border: none;
  outline: none;
  font-weight: bold;
  padding: .5em .75em;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  &:hover {
    background-color: var(--hover-primary);
  }
}

.link-list a {
  text-decoration: none;
  color: var(--interact);

  &:hover {
    text-decoration: underline;
  }
}

.search-index {
  display: flex;
  gap: 1em;
  flex-wrap: wrap;

  button {
    flex: 1;
  }

  input[type=text] {
    flex-grow: 10000;
    min-width: 240px;
  }
}

.tag-list {
  font-size: 20px;
  margin-left: 1em;
  margin-top: .5em;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em .5em;

  a:not(:last-child)::after {
    content: ",";
  }
}

.tag-selection-index {
  .category {
    margin-bottom: 1em;

    h2 {
      font-weight: normal;
      font-size: 1.5em;
    }
  }
}

.link-card {
  text-decoration: none;
  display: block;

  .title {
    color: var(--interact);
  }

  &:hover .title {
    text-decoration: underline;
  }

  .desc {
    color: var(--on-bg);
  }
}

@media(min-width: 900px) {
  .catalogue {
    display: flex;
    gap: 1rem;
  }

  .song .desc {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1em;

    p {
      flex: 1;
      min-width: 34%;
    }
  }
}

.catalogue {
  .songs {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 1rem 0;
  }

  .song {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    border: 1px solid var(--border-section);
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 0 0.25rem #0001;
    transition: all 0.1s;

    &:hover {
      border: 1px solid var(--border-primary);
      box-shadow: 0 0 0.5rem #0003;
      z-index: 1;
    }

    > h2 { width: 100%; }
    > .desc { flex: 3; }
    > img {
      max-height: 8rem;
      max-width: 8rem;
      object-fit: contain;
    }

    p, h2 {
      margin: 8px 0;
    }
  }

  .song-tag:not(:last-child) {
    margin-right: .25em;
    &::after {
      content: ",";
    }
  }

  .tag-selection {
    flex: 1;
    border: 1px solid var(--border-section);
    padding: 1rem;
    border-radius: 0.5rem;
    gap: 0.1rem;
    display: flex;
    flex-direction: column;

    .accordion-toggle {
      text-align: left;
      background-color: var(--bg-soft);

      margin-bottom: 0.5rem;
      &.closed { margin-bottom: 0; }

      & + .accordion-tags-content { margin-bottom: 0.5rem; }
      &.closed + .accordion-tags-content { margin-bottom: 0; }
    }

    input[type=text], button.primary {
      width: 100%;
    }

    .tag.selected {
      display: block !important;
      font-weight: bold;
    }

    .tag {
      font-size: 20px;

      input[type=checkbox] {
        appearance: none;
        width: 1em;
        height: 1em;
        border: 1px solid var(--border-primary);
        border-radius: 6px;
        margin: 0 .25em;
        vertical-align: -16%;

        &:hover {
          border-color: var(--on-bg);
        }

        &:checked {
          background-color: var(--primary);
          background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-check"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 12l5 5l10 -10" /></svg>');
          border-color: var(--primary);
        }
      }
    }
  }
}

.detail {
  .song-tag:not(:last-child) {
    margin-right: .25em;
    &::after {
      content: ",";
    }
  }

  .pdf {
    font-size: 24px;
    border-radius: 8px;
    text-decoration: none;
    width: fit-content;
  }

  display: flex;
  flex-wrap: wrap;
  gap: 1rem;

  > .information {
    flex: 2;
    border: 1px solid var(--border-section);
    padding: 1rem;
    border-radius: 0.5rem;
  }

  > .preview {
    flex: 1;
    img {
      width: 100%;
    }
  }
}

@media(max-width: 900px) {
  .detail {
    flex-direction: column;
  }
}

img.thumbnail {
  object-fit: contain;
  box-shadow: 0 0 8px 0 #0002;
  border-radius: 2px;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
