/* Profiles (STE-55): the handle dialog (sign-in dialog style, stella-signin.css)
   and the public profile page (profile.html at /u/<handle>).
   Colours come from the hs4 tokens, so light and dark follow the site theme. */

/* ---- The handle dialog ---- */

.spf-dialog .ssi-card { gap: 16px; }
.spf-form { display: flex; flex-direction: column; gap: 16px; }

.spf-label {
  display: block;
  margin: 0 0 6px 4px;
  color: var(--hs4-text);
  font: 600 13px / 18px var(--hs4-font-inter);
}

.spf-handle-wrap { position: relative; }
.spf-at {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--hs4-muted-text);
  font: 400 16px var(--hs4-font-inter);
  pointer-events: none;
}
.spf-dialog .ssi-input.spf-handle { padding-left: 36px; }
.spf-handle[aria-invalid="true"] {
  border-color: var(--hs4-pink-text);
  box-shadow: 0 0 0 1px var(--hs4-pink-text);
}

.spf-check {
  min-height: 18px;
  margin: 6px 0 0 4px;
  color: var(--hs4-muted-text);
  font-size: 13px;
  line-height: 18px;
}
.spf-check[data-state="free"],
.spf-check[data-state="mine"] { color: var(--hs4-green-text); }
.spf-check[data-state="free"]::before,
.spf-check[data-state="mine"]::before { content: "✓ "; }
.spf-check[data-state="taken"],
.spf-check[data-state="bad"] { color: var(--hs4-pink-text); }

.spf-where { margin-top: 2px; overflow-wrap: anywhere; }
.spf-where strong { color: var(--hs4-text); font-weight: 600; }

/* "Private profile": a switch, not a button (a state, not an action). */
.spf-switch {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 2px 4px;
  cursor: pointer;
}
.spf-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.spf-switch-track {
  flex: 0 0 auto;
  position: relative;
  width: 42px;
  height: 24px;
  margin-top: 1px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hs4-text) 22%, transparent);
  transition: background 0.15s ease;
}
.spf-switch-track span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--hs4-surface, #fff);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}
.spf-switch input:checked + .spf-switch-track { background: var(--hs4-text); }
.spf-switch input:checked + .spf-switch-track span { transform: translateX(18px); }
.spf-switch input:focus-visible + .spf-switch-track {
  outline: 2px solid var(--hs4-focus);
  outline-offset: 2px;
}
.spf-switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.spf-switch-text strong { font: 600 15px / 22px var(--hs4-font-inter); }
.spf-switch-text span { color: var(--hs4-muted-text); font-size: 13px; line-height: 18px; }

@media (prefers-reduced-motion: reduce) {
  .spf-switch-track,
  .spf-switch-track span { transition: none; }
}

@media (max-width: 560px) {
  .spf-dialog .ssi-card { padding-top: 20px; }
}

/* ---- The profile page ---- */

/* The shared-list page's top bar, as wide as this page's content. */
.sls-shared-top.spf-top { max-width: 1120px; padding: 18px 24px 0; }

.spf-main {
  box-sizing: border-box;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px 24px 64px;
  outline: none;
}

.spf-head {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 12px 0 22px;
}
.spf-avatar {
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  background: color-mix(in srgb, var(--hs4-text) 8%, transparent);
}
.spf-avatar--initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--hs4-text);
  font: 400 34px / 1 var(--hs4-font-serif);
}
.spf-id { flex: 1 1 auto; min-width: 0; }
.spf-id h1 {
  margin: 0;
  font: 400 44px / 1.05 var(--hs4-font-serif);
  overflow-wrap: anywhere;
}
.spf-handle-line {
  margin: 6px 0 0;
  color: var(--smh-muted, var(--hs4-muted-text));
  font: 500 14px / 1.4 var(--hs4-font-inter);
}
.spf-share { flex: 0 0 auto; }

.spf-stats { display: inline-flex; margin: 0 0 8px; }
.spf-stats .smh-stat { cursor: default; }

.spf-rail > li { flex-basis: 132px; }
.spf-tile-link { display: block; color: inherit; border-radius: 6px; }
.spf-tile-link:focus-visible { outline: 2px solid var(--hs4-focus); outline-offset: 3px; }
.spf-tile .stella-poster { width: 100%; height: auto; aspect-ratio: 2 / 3; border-radius: 6px; }
.spf-stars { display: block; margin: 2px 0 1px; }

.spf-lists {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.spf-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  border: 1px solid var(--smh-line, rgba(0, 0, 0, 0.12));
  border-radius: 14px;
  color: var(--hs4-text);
  text-decoration: none;
}
.spf-list:hover,
.spf-list:focus-visible { border-color: var(--hs4-text); outline: none; }
.spf-list strong { font: 600 16px / 1.3 var(--hs4-font-inter); }
.spf-list span { color: var(--smh-muted, var(--hs4-muted-text)); font-size: 13px; line-height: 1.4; }
.spf-list .spf-list-note {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.spf-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  margin: 72px auto;
  text-align: center;
}
.spf-state h1 { margin: 0; font: 400 36px / 1.1 var(--hs4-font-serif); overflow-wrap: anywhere; }
.spf-state p { margin: 0 0 8px; color: var(--smh-muted, var(--hs4-muted-text)); }

@media (max-width: 720px) {
  .sls-shared-top.spf-top { padding: 14px 16px 0; }
  .spf-main { padding: 4px 16px 48px; }
  .spf-head { flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
  .spf-avatar { width: 64px; height: 64px; }
  .spf-avatar--initials { font-size: 26px; }
  .spf-id h1 { font-size: 32px; }
  .spf-share { order: 3; }
  .spf-stats { display: flex; width: 100%; box-sizing: border-box; }
  .spf-stats .smh-stat { flex: 1 1 0; min-width: 0; padding: 6px 8px; }
  .spf-stats .smh-stat b { font-size: 22px; }
  .spf-stats .smh-stat span { white-space: normal; }
  .spf-rail > li { flex-basis: 112px; }
}
