/*
 * profiles.css - user profiles: the "Who's watching?" picker (.screen--profiles), avatars, the Home header chip,
 * the Home "Switch profile" tile and the avatar dot on Settings -> Profiles rows. Markup: js/ui/screens/profiles.js.
 * Uses css/tokens.css only. Local tokens (not in tokens.css): the avatar palette --profile-c1..7 (built from the
 * semantic tokens) and the picker sizes --prof-avatar / --prof-card-w.
 */
:root {
  --profile-c1: var(--c-accent);      /* Violet */
  --profile-c2: var(--c-blue);        /* Blue */
  --profile-c3: var(--c-catchup);     /* Cyan */
  --profile-c4: var(--c-ok);          /* Green */
  --profile-c5: var(--c-yellow);      /* Yellow */
  --profile-c6: var(--c-warn);        /* Orange */
  --profile-c7: var(--c-live);        /* Red */
  --prof-avatar: 9.5rem;
  --prof-card-w: 13rem;
}
.prof-c-1 { --prof-c: var(--profile-c1); --prof-fg: var(--c-accent-fg); }
.prof-c-2 { --prof-c: var(--profile-c2); --prof-fg: var(--c-accent-fg); }
.prof-c-3 { --prof-c: var(--profile-c3); --prof-fg: var(--c-bg); }
.prof-c-4 { --prof-c: var(--profile-c4); --prof-fg: var(--c-bg); }
.prof-c-5 { --prof-c: var(--profile-c5); --prof-fg: var(--c-bg); }
.prof-c-6 { --prof-c: var(--profile-c6); --prof-fg: var(--c-bg); }
.prof-c-7 { --prof-c: var(--profile-c7); --prof-fg: var(--c-accent-fg); }

/* ---------- avatar ---------- */
.profile-avatar {
  position: relative; flex: none; display: flex; align-items: center; justify-content: center;
  width: 3rem; height: 3rem; border-radius: 50%;
  background-color: var(--prof-c, var(--c-accent));
  background-image: linear-gradient(160deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 55%, rgba(0, 0, 0, 0.18) 100%);
  color: var(--prof-fg, var(--c-accent-fg)); box-shadow: inset 0 0 0 0.0625rem rgba(255, 255, 255, 0.12);
}
.profile-avatar__initial { font-weight: var(--fw-heavy); line-height: 1; letter-spacing: -0.02em; font-size: 1.35rem; }

/* ---------- picker screen ---------- */
.screen--profiles { background: var(--c-bg); }
.screen--profiles .screen__title:empty { display: none; }
.profiles { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-5); padding-bottom: var(--header-h); }
.profiles__title { font-size: var(--fs-xxl); font-weight: var(--fw-bold); letter-spacing: -0.02em; line-height: var(--lh-tight); color: var(--c-fg); }
.profiles__cards { display: flex; justify-content: center; flex-wrap: nowrap; gap: var(--sp-4); max-width: 100%; padding: var(--sp-3) var(--sp-2); }
.profile-card {
  position: relative; flex: none; width: var(--prof-card-w); display: flex; flex-direction: column; align-items: center; gap: var(--sp-1);
  cursor: default;
}
.profile-card__avatar { width: var(--prof-avatar); height: var(--prof-avatar); margin-bottom: var(--sp-2);
  transition: transform var(--dur) var(--ease); }
.profile-card__avatar .profile-avatar__initial { font-size: calc(var(--prof-avatar) * 0.42); }
/* the shared selected state: accent ring + glow on a pseudo-element faded with opacity, slight scale */
.profile-card__avatar::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: var(--focus-shadow); opacity: 0; transition: opacity var(--dur) var(--ease); }
.profile-card.is-focused { outline: none; background-color: transparent !important; }   /* base.css generic box; the ring is on the avatar */
.profile-card.is-focused .profile-card__avatar { transform: scale(var(--focus-scale)); }
.profile-card.is-focused .profile-card__avatar::after { opacity: 1; }
.profile-card__name { max-width: 100%; font-size: var(--fs-l); font-weight: var(--fw-semibold); color: var(--c-fg-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color var(--dur-fast) var(--ease); }
.profile-card.is-focused .profile-card__name { color: var(--c-fg); }
.profile-card__sub { min-height: 1.35em; font-size: var(--fs-s); font-weight: var(--fw-medium); color: var(--c-muted); }
.profile-card.is-current .profile-card__sub { color: var(--c-accent-hi); }
/* PIN badge on the avatar's top-right edge */
.profile-card__lock {
  position: absolute; top: calc(var(--sp-3) * 0.2); left: calc(50% + var(--prof-avatar) * 0.26); z-index: 1;
  width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--c-surface-2); box-shadow: 0 0 0 0.2rem var(--c-bg), var(--sh-1);
}
.profile-card__lock::before { content: ""; position: absolute; inset: 0.55rem; background: var(--c-fg-2);
  -webkit-mask: var(--prof-ico-lock) center / contain no-repeat; mask: var(--prof-ico-lock) center / contain no-repeat; }
.profile-card.is-focused .profile-card__lock { transform: translate(0.3rem, -0.3rem); transition: transform var(--dur) var(--ease); }
:root { --prof-ico-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4.5' y='10.5' width='15' height='10' rx='2'/%3E%3Cpath d='M8 10.5V7.5a4 4 0 018 0v3'/%3E%3C/svg%3E"); }
/* many profiles: smaller cards so the row still fits a 16:9 screen */
.screen--profiles.is-many { --prof-avatar: 7rem; --prof-card-w: 9.5rem; }
.screen--profiles.is-many .profiles__cards { gap: var(--sp-3); }
.profiles__actions { display: flex; justify-content: center; gap: var(--sp-3); min-height: 3.4rem; }
.profiles__actions:empty { display: none; }
.profiles__btn { background: transparent; background-image: none; color: var(--c-fg-2); box-shadow: inset 0 0 0 0.0625rem var(--c-line-strong); }
.profiles__btn.is-focused { color: var(--c-fg); }

/* ---------- Home header chip ---------- */
.profile-chip {
  flex: none; display: inline-flex; align-items: center; gap: var(--sp-2); height: 2.75rem; padding: 0 var(--sp-3) 0 0.3rem;
  border-radius: var(--r-pill); background: var(--c-surface-2); box-shadow: inset 0 0 0 0.0625rem var(--c-line);
  position: relative; transition: transform var(--dur) var(--ease);
}
.profile-chip.is-hidden { display: none; }
.profile-chip::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: var(--focus-shadow); opacity: 0; transition: opacity var(--dur) var(--ease); }
.profile-chip.is-clickable { cursor: pointer; }
.profile-chip.is-clickable:hover { background: var(--c-surface-3); transform: scale(var(--focus-scale)); }
.profile-chip.is-clickable:hover::after { opacity: 1; }
.profile-chip__avatar { width: 2.15rem; height: 2.15rem; }
.profile-chip__avatar .profile-avatar__initial { font-size: 1rem; }
.profile-chip__name { font-size: var(--fs-s); font-weight: var(--fw-semibold); color: var(--c-fg-2); max-width: 14rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Home "Switch profile" tile: person icon in the profile's colour ---------- */
.tile--profile { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8.5' r='3.5'/%3E%3Cpath d='M2.5 20a6.5 6.5 0 0113 0'/%3E%3Cpath d='M16 5.2a3.5 3.5 0 010 6.6M18.5 14.3a6.5 6.5 0 013 5.7'/%3E%3C/svg%3E"); }
.screen--home .home-tile.tile--profile::before { background: var(--prof-c, var(--c-accent-hi)); }

/* ---------- Settings -> Profiles: avatar-colour dot before each profile name ---------- */
.set-row--profile .set-row__label::before { content: ""; display: inline-block; width: 1.1rem; height: 1.1rem; margin-right: var(--sp-2);
  vertical-align: -0.12em; border-radius: 50%; background: var(--prof-c, var(--c-accent));
  box-shadow: inset 0 0 0 0.0625rem rgba(255, 255, 255, 0.15); }
.set-row--profile.is-current .set-row__value { color: var(--c-accent-hi); }
