/* Party of Two — one stylesheet for the whole app.
   Palette: lilac mist + aubergine ink, with one color per person
   (saffron and iris). The two discs in the presence mark are the
   only bold element; everything else stays quiet. */

@font-face {
  font-family: "Young Serif";
  src: url("/static/fonts/young-serif-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/static/fonts/figtree-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/static/fonts/figtree-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/static/fonts/figtree-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/static/fonts/figtree-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #f1eef8;
  --surface: #ffffff;
  --ink: #231c3b;
  --muted: #6b6585;
  --line: #ddd7ec;
  --person-a: #e8a33d;
  --person-b: #6f63e8;
  --on-a: #231c3b;
  --on-b: #ffffff;
  --danger: #b8323d;
  --blend: multiply;
  --radius-lg: 18px;
  --radius-sm: 10px;
  --tap: 48px;
  --serif: "Young Serif", Georgia, serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17132b;
    --surface: #221d3c;
    --ink: #f1eef8;
    --muted: #a49ec2;
    --line: #362f57;
    --person-a: #f2b451;
    --person-b: #8d84f5;
    --on-a: #17132b;
    --on-b: #17132b;
    --danger: #ff7a85;
    --blend: screen;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--person-b);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---- shell ---- */

.shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 16px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 6px;
}

.wordmark {
  font-family: var(--serif);
  font-size: 19px;
  text-decoration: none;
}

.icon-link svg {
  width: 24px;
  height: 24px;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  margin-right: -12px;
  color: var(--muted);
  border-radius: 50%;
}

.view {
  flex: 1;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  max-width: 480px;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 0 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

.tab[aria-current="page"] {
  color: var(--ink);
}

.tab svg {
  width: 24px;
  height: 24px;
}

/* ---- presence mark: the signature element ---- */

.presence {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 0 0;
}

.discs {
  position: relative;
  width: 168px;
  height: 92px;
}

.disc {
  position: absolute;
  top: 0;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 28px;
  letter-spacing: -0.02em;
  mix-blend-mode: var(--blend);
  transition: transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 400ms;
}

.disc-a {
  left: 0;
  background: var(--person-a);
  color: var(--on-a);
}

.disc-b {
  right: 0;
  background: var(--person-b);
  color: var(--on-b);
}

/* Together: the discs overlap, each name kept on its own side.
   Apart: they drift to the edges. */
.discs[data-state="together"] .disc-a {
  transform: translateX(12px);
  justify-content: flex-start;
  padding-left: 9px;
}
.discs[data-state="together"] .disc-b {
  transform: translateX(-12px);
  justify-content: flex-end;
  padding-right: 9px;
}
.discs[data-state="apart"] .disc-a {
  transform: translateX(-18px);
}
.discs[data-state="apart"] .disc-b {
  transform: translateX(18px);
}
.disc[data-ready="false"] {
  opacity: 0.38;
}

.status-line {
  margin: 0;
  text-align: center;
  font-size: 15px;
  color: var(--muted);
  max-width: 34ch;
}

.status-line strong {
  color: var(--ink);
  font-weight: 600;
}

.countdown {
  font-family: var(--serif);
  font-size: 44px;
  line-height: 1;
}

/* ---- now playing ---- */

.now {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.track {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.art {
  width: min(220px, 62vw);
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  object-fit: cover;
  background: var(--line);
  display: block;
}

.track-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.12;
  margin: 0;
  overflow-wrap: anywhere;
}

.track-sub {
  margin: 6px 0 0;
  color: var(--muted);
}

.track-from {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.progress {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.bar {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.bar::-webkit-progress-bar {
  background: var(--line);
}

.bar::-webkit-progress-value {
  background: var(--ink);
}

.bar::-moz-progress-bar {
  background: var(--ink);
}

.controls {
  display: grid;
  grid-template-columns: 56px auto 56px;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.controls .btn {
  white-space: nowrap;
}

.round {
  justify-self: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.round svg {
  width: 24px;
  height: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

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

.btn-quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--line);
}

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

.btn-wide {
  width: 100%;
}

.btn[disabled],
.btn.htmx-request {
  opacity: 0.55;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reactions {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.react {
  flex: 1;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 22px;
  cursor: pointer;
}

.reaction-toast {
  text-align: center;
  font-size: 15px;
  color: var(--muted);
  min-height: 1.45em;
  margin: 0;
}

.reaction-toast .emoji {
  display: inline-block;
  animation: pop 900ms ease-out;
}

@keyframes pop {
  0% {
    transform: scale(0.4);
  }
  60% {
    transform: scale(1.35);
  }
  100% {
    transform: scale(1);
  }
}

/* ---- people ---- */

.people {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.person {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transform: translateY(1px);
}

.dot-a {
  background: var(--person-a);
}

.dot-b {
  background: var(--person-b);
}

.person p {
  margin: 0;
}

.person .detail {
  color: var(--muted);
  font-size: 14px;
}

/* ---- banners ---- */

.banner {
  border-radius: var(--radius-sm);
  background: var(--surface);
  border-left: 4px solid var(--person-b);
  padding: 12px 14px;
  font-size: 15px;
}

.banner p {
  margin: 0 0 8px;
}

.banner p:last-child {
  margin-bottom: 0;
}

.banner-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.error {
  color: var(--danger);
  font-size: 14px;
  margin: 0;
}

.flash {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.flash:empty {
  display: none;
}

.flash .error {
  display: block;
}

/* ---- lists (queue, search, history) ---- */

.page-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  margin: 6px 0 14px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 22px 0 6px;
}

.hint {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 12px;
}

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

.row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.row-art {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--line);
}

.row-text {
  min-width: 0;
}

.row-title {
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-actions {
  display: flex;
  gap: 4px;
}

.row-actions .round {
  width: 40px;
  height: 40px;
}

.row-actions .round svg {
  width: 20px;
  height: 20px;
}

.row-now .row-title::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--person-b);
  margin-right: 8px;
  transform: translateY(-2px);
}

.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 4px;
  color: var(--muted);
  font-size: 14px;
}

.group-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.added-by {
  color: var(--muted);
  font-size: 13px;
}

.search {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.search input {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0 18px;
  font-family: inherit;
  font-size: 16px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 36px 12px;
}

.empty p {
  margin: 0 0 14px;
}

.day {
  font-size: 14px;
  font-weight: 600;
  margin: 20px 0 2px;
  color: var(--muted);
}

.row-reactions {
  font-size: 18px;
  letter-spacing: 2px;
}

/* ---- sign-in ---- */

.signin {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
  text-align: center;
}

.signin h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 40px;
  margin: 0;
}

.signin p {
  margin: 0;
  color: var(--muted);
  max-width: 30ch;
}

/* ---- settings ---- */

.setting {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.setting h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
}

.setting > p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.steps {
  margin: 0 0 10px;
  padding-left: 20px;
  color: var(--muted);
  font-size: 14px;
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline;
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .disc,
  .reaction-toast .emoji {
    transition: none;
    animation: none;
  }
}
