/*
 * The connect page is the entire user-facing surface of this app. It asks people
 * to hand over access to their music library, so it should look deliberate.
 */

:root {
  --bg: #f6f6f7;
  --card: #ffffff;
  --ink: #16161a;
  --muted: #6b6b76;
  --line: #e4e4e9;
  --apple-music: #fa2d48;
  --claude: #D87757;
  --accent: var(--apple-music); /* Apple Music red */
  --error: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131316;
    --card: #1c1c21;
    --ink: #f2f2f4;
    --muted: #9a9aa6;
    --line: #2e2e36;
    --error: #f2b8b5;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.card {
  width: 100%;
  max-width: 27rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 2.25rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
}

h1 {
  margin: 0 0 1.25rem;
  font-size: 1.3rem;
  font-weight: 640;
  letter-spacing: -.02em;
}

h1 .accent {
  color: var(--accent);
  margin-left: .4rem;
}

.lede { margin: 0 0 1.5rem; color: var(--muted); }

.fine {
  margin: 1rem 0 0;
  font-size: .8125rem;
  line-height: 1.5;
  color: var(--muted);
}

.error { color: var(--error); }

.flash {
  margin: 0 0 1.25rem;
  padding: .7rem .9rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-size: .875rem;
}

.btn {
  display: block;
  width: 100%;
  padding: .8rem 1rem;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 560;
  cursor: pointer;
  transition: opacity .15s ease;
}

.btn:hover:not(:disabled) { opacity: .9; }
.btn:disabled { opacity: .45; cursor: default; }

.btn-quiet {
  margin-top: 1.5rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 460;
}

.meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .35rem 1.25rem;
  margin: 0;
  padding: 1rem 0 0;
  border-top: 1px solid var(--line);
  font-size: .875rem;
}

.meta dt { color: var(--muted); }
.meta dd { margin: 0; }

/* ---------------------------------------------------------------------------
   Doorkeeper consent screen.

   Deliberately conventional: the identity pair, plain-language scope list and
   Cancel/Authorize pairing are the pattern people already know from GitHub,
   Google and Slack. Familiarity is the security feature here — someone who
   didn’t start this flow should recognise the screen well enough to notice the
   destination is wrong.
   --------------------------------------------------------------------------- */

.authz { text-align: center; }

/* The signature element: two tiles joined by a lock, so the page says “these
   two things are being linked” before anyone reads a word. */
.authz-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .875rem;
  margin-bottom: 1.5rem;
}

.tile {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 14px;
  flex: none;
}

.tile svg {
  width: 2.5rem;
  height: 2.5rem;
}

.tile-client {
  background: var(--claude);
  color: var(--ink);
  fill: white;
  font-size: 1.375rem;
  font-weight: 620;
  line-height: 1;
}

.tile-service {
  background: var(--accent);
  fill: white;
  color: #fff;
}

/* The dotted rule runs behind the lock, so the lock reads as sitting *on* the
   connection rather than dangling beneath it. */
.authz-link {
  position: relative;
  flex: 1;
  max-width: 4.5rem;
  display: grid;
  place-items: center;
  height: 1.75rem;
}

.authz-link::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 50%;
  border-top: 2px dotted var(--line);
}

.authz-link svg {
  position: relative;
  width: 1.75rem;
  height: 1.75rem;
  fill: var(--muted);
  background: var(--card);
}

.authz-title {
  margin: 0 0 1.75rem;
  line-height: 1.35;
  letter-spacing: -.01em;
  text-wrap: balance;
}

/* Two lines, not one sentence: the client's self-chosen name, then the ask. */
.client {
  display: block;
  font-size: 1.25rem;
  font-weight: 680;
  overflow-wrap: anywhere;
}

.authz-ask {
  display: block;
  margin-top: .3rem;
  font-size: .9375rem;
  font-weight: 440;
  color: var(--muted);
}

.authz-label {
  margin: 0 0 .625rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 560;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.scopes {
  margin: 0 0 1.75rem;
  padding: .875rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  list-style: none;
  text-align: left;
  font-size: .9375rem;
}

.scopes li {
  display: flex;
  align-items: flex-start;
  gap: .625rem;
  padding: .3125rem 0;
  line-height: 1.45;
}

/* Ink, not accent. A row of red ticks reads as alarm rather than permission,
   and the accent is spent on the primary button. */
.tick {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
  margin-top: .125rem;
  color: var(--ink);
}

.actions {
  display: flex;
  gap: .625rem;
}

.actions form { flex: 1; }

/* Cancel sits left, Authorize right — the order these buttons appear in
   everywhere else. */
.actions .btn-quiet { margin-top: 0; }

.authz-redirect {
  margin: 1.25rem 0 0;
  font-size: .8125rem;
  line-height: 1.55;
  color: var(--muted);
}

/* On its own line: a URI set inline in centred prose wraps raggedly, and this
   is the one string on the page a suspicious user needs to actually read. */
.uri {
  display: block;
  margin: .25rem 0;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em;
  color: var(--ink);
}
