/* Bar1 jukebox: shared tokens and components.
   Kept to syntax old Samsung TV browsers understand: hsl() with commas, no oklch, no clamp. */

@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("../fonts/figtree-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("../fonts/figtree-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --hue: 32;
  --accent: #f2b34b;
  --on-accent: hsl(var(--hue), 40%, 9%);

  /* Ground and raised surfaces: lightness steps on the theme hue, never neutral grey. */
  --bg: hsl(var(--hue), 14%, 7%);
  --surface-1: hsl(var(--hue), 11%, 11%);
  --surface-2: hsl(var(--hue), 9%, 15%);
  --surface-3: hsl(var(--hue), 8%, 20%);
  --line: hsl(var(--hue), 9%, 22%);
  --line-strong: hsl(var(--hue), 8%, 32%);

  --text: hsl(var(--hue), 24%, 95%);
  --text-2: hsl(var(--hue), 10%, 74%);
  --text-3: hsl(var(--hue), 7%, 60%);

  --danger: #ff6b5e;
  --danger-bg: hsla(5, 100%, 68%, 0.12);

  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 16px;
  --cover-radius: 6px;

  --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-raise: 0 10px 30px -8px rgba(0, 0, 0, 0.55), 0 2px 6px -2px rgba(0, 0, 0, 0.4);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

h1, h2, h3, h4, p {
  margin: 0;
}

h1, h2, h3 {
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--text-2);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- icons */

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-fill {
  fill: currentColor;
  stroke: none;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px; /* unslop-ignore: pill controls are the chosen music-app reference (Spotify/Sonos), see DESIGN.md */
  background: var(--surface-3);
  color: var(--text);
  font-weight: 650;
  font-size: 1rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms var(--ease-out), opacity 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.btn > .icon + span,
.btn > span + .icon {
  margin-left: 8px;
}

.btn:hover {
  background: var(--line-strong);
}

.btn:active {
  transform: scale(0.97);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent);
  filter: brightness(1.08);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.btn-danger:hover {
  background: hsla(5, 100%, 68%, 0.2);
}

.btn-block {
  width: 100%;
}

.btn-small {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.9375rem;
}

.btn-icon {
  width: 48px;
  min-width: 48px;
  padding: 0;
}

.btn-icon.btn-small {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
}

.btn.is-busy {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.is-busy::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2px solid var(--on-accent);
  border-right-color: transparent;
  animation: spin 700ms linear infinite;
}

.btn:not(.btn-primary).is-busy::after {
  border-color: var(--text);
  border-right-color: transparent;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------------------------------------------------------- fields */

.field {
  display: block;
}

.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-2);
}

.field input,
.field select,
.field textarea,
.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-1);
  color: var(--text);
  caret-color: var(--accent);
  transition: border-color 140ms ease, background-color 140ms ease;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 1.4;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-2);
}

.field input::placeholder,
.input::placeholder {
  color: var(--text-3);
}

/* `.field > .field-hint` beats the label rule `.field > span`, so help text never looks like a second label. */
.field-hint,
.field > .field-hint {
  display: block;
  margin: 6px 0 0;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-3);
}

/* ---------------------------------------------------------------- song rows */

.cover {
  position: relative;
  flex: none;
  width: 56px;
  height: 56px;
  overflow: hidden;
  border-radius: var(--cover-radius);
  background: var(--surface-3);
}

.cover img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 178%;
  max-width: none;
  height: auto;
  transform: translate(-50%, -50%);
}

.song {
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 8px 0;
}

.song > .cover {
  margin-right: 14px;
}

.song-text {
  flex: 1;
  min-width: 0;
}

.song-sub {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Two lines, so "Live", "Acoustic" and "Remix" versions can be told apart. */
.song-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow-wrap: anywhere;
}

.song-title {
  font-weight: 650;
  font-size: 1.0625rem;
}

.song-sub {
  margin-top: 2px;
  font-size: 0.9375rem;
  color: var(--text-2);
}

.song-actions {
  flex: none;
  display: flex;
  align-items: center;
  margin-left: 10px;
}

.song-actions > * + * {
  margin-left: 6px;
}

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5;
  vertical-align: 1px;
  margin-right: 6px;
}

.tag-quiet {
  background: var(--surface-3);
  color: var(--text-2);
}

/* ---------------------------------------------------------------- notices */

.notice {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9375rem;
}

.notice-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.snackbar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  display: flex;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  box-shadow: var(--shadow-raise);
  transform: translateY(140%);
  opacity: 0;
  transition: transform 380ms var(--ease-out), opacity 200ms ease;
  pointer-events: none;
}

.snackbar.is-shown {
  transform: none;
  opacity: 1;
}

.snackbar.is-error {
  background: var(--danger);
  color: #1a0806;
}

.snackbar .icon {
  margin-right: 10px;
}

/* ---------------------------------------------------------------- progress */

.progress {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 2px;
  background: var(--accent);
  /* Moved by scaleX, not width, so a tick never triggers layout (old TVs decode video at the same time). */
  -webkit-transform: scaleX(0);
  transform: scaleX(0);
  -webkit-transform-origin: left center;
  transform-origin: left center;
}

/* ---------------------------------------------------------------- sheets (bottom panels, native <dialog>) */

dialog.sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  margin: 0 auto;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  border: 0;
  overflow-y: auto;
  border-radius: var(--radius-l) var(--radius-l) 0 0;
  background: var(--surface-1);
  color: var(--text);
  box-shadow: var(--shadow-raise);
  transform: translateY(100%);
  transition: transform 360ms var(--ease-out);
}

dialog.sheet:modal {
  /* Scroll inside the sheet must not move the page behind it. */
  overscroll-behavior: contain;
}

dialog.sheet::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 240ms ease;
}

dialog.sheet.is-open {
  transform: none;
}

dialog.sheet.is-open::backdrop {
  opacity: 1;
}

.sheet::before {
  content: "";
  display: block;
  width: 40px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 2px;
  background: var(--line-strong);
}

.sheet h1,
.sheet h2 {
  font-size: 1.3125rem;
  margin: 0 0 6px;
}

.sheet-actions {
  margin-top: 18px;
}

.sheet-actions > * + * {
  margin-top: 10px;
}

.menu-list {
  margin: 8px -8px 0;
  padding: 0;
  list-style: none;
}

.menu-list button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
  font-weight: 600;
  cursor: pointer;
}

.menu-list button:hover {
  background: var(--surface-2);
}

.menu-list .icon {
  margin-right: 14px;
  color: var(--text-2);
}

.menu-list .is-danger,
.menu-list .is-danger .icon {
  color: var(--danger);
}

/* ---------------------------------------------------------------- shared list, search and playing pieces (guest + admin) */

.loading-dot {
  width: 10px;
  height: 10px;
  margin: 0 5px;
  border-radius: 50%;
  background: var(--text-3);
  animation: pulse 1.1s ease-in-out infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.15s; }
.loading-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}


/* Equalizer bars: the "this is playing" signal instead of a label. */
.eq {
  display: inline-flex;
  align-items: flex-end;
  width: 14px;
  height: 12px;
  margin-right: 8px;
  flex: none;
}

.eq i {
  display: block;
  width: 3px;
  height: 100%;
  margin-right: 2px;
  border-radius: 1px;
  background: var(--accent);
  transform-origin: bottom;
  animation: eq 1s ease-in-out infinite;
}

.eq i:nth-child(2) { animation-delay: -0.35s; animation-duration: 0.8s; }
.eq i:nth-child(3) { animation-delay: -0.6s; animation-duration: 1.15s; margin-right: 0; }

.eq.is-paused i {
  animation: none;
  transform: scaleY(0.3);
}

@keyframes eq {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}


.search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 60px;
  padding: 6px 6px 6px 16px;
  border-radius: 999px; /* unslop-ignore: pill controls are the chosen music-app reference (Spotify/Sonos), see DESIGN.md */
  border: 1.5px solid var(--line-strong);
  background: var(--surface-1);
  transition: border-color 160ms ease, background-color 160ms ease;
}

.search-box:focus-within {
  border-color: var(--accent);
  background: var(--surface-2);
}

.search-icon {
  width: 22px;
  height: 22px;
  color: var(--text-2);
}

.search-box input {
  flex: 1;
  min-width: 0;
  height: 46px;
  margin: 0 6px 0 10px;
  padding: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 1.125rem;
  caret-color: var(--accent);
  -webkit-appearance: none;
  appearance: none;
}

.search-box input::placeholder {
  color: var(--text-3);
}

.search-box input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: 4px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}

.search-clear:hover {
  color: var(--text);
  background: var(--surface-3);
}


.now-times {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--text-3);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 32px 0 6px;
}

.section-head h2 {
  font-size: 1.375rem;
  font-weight: 800;
}

.count {
  font-size: 0.9375rem;
  color: var(--text-3);
}

.list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.list .song {
  border-bottom: 1px solid var(--line);
}

.list > li:last-child .song,
.list > .song:last-child {
  border-bottom: 0;
}

.pos {
  flex: none;
  width: 26px;
  margin-right: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-3);
}


.empty {
  padding: 18px 0;
  color: var(--text-2);
  font-size: 1rem;
}


.btn-done {
  background: transparent;
  color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}


/* ---------------------------------------------------------------- scrollbars */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 10px;
  background: var(--line-strong) padding-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* Less movement, not none: things still fade so state changes stay visible. */
@media (prefers-reduced-motion: reduce) {
  .snackbar,
  dialog.sheet {
    transform: none;
    transition: opacity 200ms ease;
  }

  dialog.sheet {
    opacity: 0;
  }

  dialog.sheet.is-open {
    opacity: 1;
  }

  .btn:active {
    transform: none;
  }

  .btn.is-busy::after {
    animation-duration: 1.6s;
  }

  .loading-dot,
  .eq i {
    animation: none;
    opacity: 0.7;
  }
}
