:root {
  --fw-darker: #1b1c1d;
  --fw-dark: #2f3030;
  --fw-light: #666666;
  --fw-primary: #f2711c;
  --fw-text: #fff;
}

*, *::before, *::after {
  box-sizing: border-box;
}

audio,
[v-cloak] {
  display: none;
}

body {
  margin: 0;

  font-family: sans-serif;

  background-color: var(--fw-darker);
  color: var(--fw-text);

  overflow-x: hidden;
}

main {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
}

/*
  Error
*/

.error {
  padding-left: 8px;
  line-height: 50px;
  font-weight: bold;
  text-align: center;
}

.error:first-letter {
  text-transform: uppercase;
}

.error .logo-link {
  position: absolute;
  top: 0;
  right: 0;
}

/*
  Player
*/

.player {
  display: grid;
  grid-template-areas: 'cover content content' 'cover controls logo';
  grid-template-columns: clamp(72px, 22%, 166px) 1fr clamp(32px, 10%, 50px);
  align-items: flex-end;
}

img {
  display: block;
  object-fit: contain;
  object-position: center;
  aspect-ratio: 1;
}

h1, h2 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cover-image {
  grid-area: cover;
  background-color: var(--fw-dark);
  width: 100%;
}

.player-content {
  grid-area: content;
  min-width: 0;
  margin-left: 16px;
}

.player-controls {
  grid-area: controls;
  height: 36px;
  min-width: 0;
  margin: 0 16px 8px 8px;
  display: grid;
  grid-template-columns: auto auto auto 1fr auto clamp(48px, 20%, 100px);
  gap: 8px;
}

button {
  color: var(--fw-primary);
  background-color: transparent;
  border: none;
  font-size: 2em;
  padding: 0;
  display: flex;
  align-items: center;
  cursor: pointer;
}

button:hover {
  color: var(--fw-light);
}

button.play {
  font-size: 2.5em;
}

button > span {
  display: inline-flex;
}

button svg.icon {
  height: 1em;
  width: 1em;
}

.logo-link {
  display: block;
  width: 42px;
  height: 42px;
  background-color: var(--fw-primary);
  padding: 4px;
}

.logo-icon {
  display: block;
  width: 100%;
  height: 100%;
  background-color: var(--fw-primary-contrast, #fff);
  -webkit-mask-image: url(/logo-white.svg);
  mask-image: url(/logo-white.svg);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.player .logo-wrapper {
  margin: 8px 0px 0px 8px;
}

/*
  Track list
*/

.track-list {
  background-color: var(--fw-dark);
  padding: 16px 8px;
}

table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
}

tr {
  font-weight: bold;
  cursor: pointer;
  background: var(--entry-bg, transparent);
}

tr.current {
  --entry-bg: var(--fw-darker);
}

tr:hover {
  color: var(--fw-light);
}

td {
  padding: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td:first-child {
  padding-left: 16px;
  width: 1em;
}

td:nth-child(2) {
  width: 35%;
}

td:nth-child(3) {
  width: 20%;
}

td:nth-child(4) {
  width: 40%;
}

td:last-child {
  text-align: right;
  width: 5.1em;
}

@media (max-width: 600px) {
  td:nth-child(4) {
    display: none;
  }

  td:nth-child(2) {
    width: 55%;
  }

  td:nth-child(3) {
    width: 35%;
  }
  .volume {
    display: none;
  }
}

/*
  Sliders
*/

input[type=range] {
  background: transparent;
  appearance: none;
  height: 100%;
  margin: 0;

  --range-color: var(--fw-light);
  --range-size: 0.6em;

  --min: 0;
  --max: 100;
  --value: 50;
  --range: calc(var(--max) - var(--min));
  --ratio: calc((var(--value) - var(--min)) / var(--range));
  --sx: calc(0.5 * var(--range-size) + var(--ratio) * (100% - var(--range-size)));
}

input[type=range]::-webkit-slider-thumb {
  appearance: none;
  width: var(--range-size);
  height: var(--range-size);
  border-radius: calc(var(--range-size) / 2);
  background: var(--range-color);
  border: none;
  box-shadow: none;
}

input[type=range]::-moz-range-thumb {
  appearance: none;
  width: var(--range-size);
  height: var(--range-size);
  border-radius: calc(var(--range-size) / 2);
  background: var(--range-color);
  border: none;
  box-shadow: none;
}

input[type=range]::-moz-range-track {
  appearance: none;
  height: var(--range-size);
  border: none;
  border-radius: calc(var(--range-size) / 2);
  box-shadow: none;
  background: linear-gradient(var(--range-color),var(--range-color)) 0/var(--sx) 100% no-repeat, var(--fw-dark);
}

input[type=range]::-webkit-slider-runnable-track {
  appearance: none;
  height: var(--range-size);
  border: none;
  border-radius: calc(var(--range-size) / 2);
  box-shadow: none;
  background: linear-gradient(var(--range-color),var(--range-color)) 0/var(--sx) 100% no-repeat, var(--fw-dark);
}
