/* The profile page. The stage is the person's own card; below it, tabs keep one page from becoming a long stack. */
:root[data-route="profile"][data-profile-tab="you"] [data-profile-tab]:not([data-profile-tab="you"]),
:root[data-route="profile"][data-profile-tab="assistant"] [data-profile-tab]:not([data-profile-tab="assistant"]),
:root[data-route="profile"][data-profile-tab="security"] [data-profile-tab]:not([data-profile-tab="security"]) { display: none; }

.profile-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-5); padding: var(--space-6);
  border-radius: var(--radius-lg); background: var(--stage); box-shadow: var(--shadow-card); color: #fff;
}
.profile-card .avatar { inline-size: 76px; block-size: 76px; font-size: 1.75rem; font-weight: var(--weight-bold); box-shadow: 0 0 0 3px rgb(255 255 255 / 24%); }
.profile-identity { display: grid; gap: var(--space-1); min-inline-size: 0; }
.profile-name { font-size: var(--text-title1); font-weight: var(--weight-bold); line-height: var(--leading-tight); overflow-wrap: anywhere; }
.profile-detail-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); color: rgb(255 255 255 / 86%); font-size: var(--text-subhead); }
.profile-verified { display: inline-flex; align-items: center; gap: 2px; padding-inline: var(--space-2) var(--space-2); border-radius: var(--radius-full); background: rgb(255 255 255 / 16%); font-size: var(--text-caption); }
.profile-verified[hidden] { display: none; }
.profile-verified .icon { inline-size: 14px; block-size: 14px; }
.profile-since { color: rgb(255 255 255 / 76%); font-size: var(--text-caption); }
.profile-credit { display: grid; justify-items: end; gap: var(--space-2); }
.profile-credit strong { font-size: var(--text-title3); font-weight: var(--weight-bold); white-space: nowrap; }
.profile-credit .button.primary { background: #fff; color: #1d1d1f; --color-glow: rgb(0 0 0 / 8%); }
@media (hover: hover) and (pointer: fine) { .profile-credit .button.primary:hover { background: #f0f0f2; } }

.avatar-colors { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-block-start: var(--space-2); }
.avatar-color { position: relative; inline-size: 18px; block-size: 18px; padding: 0; border: 0; border-radius: 50%; background: oklch(.6 .14 var(--hue, 250)); box-shadow: 0 0 0 1px rgb(255 255 255 / 40%); transition: transform var(--motion-fast) var(--spring); }
.avatar-color[data-hue="null"] { background: transparent; box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / 70%); }
.avatar-color[aria-pressed="true"] { box-shadow: 0 0 0 2px #fff; }
.avatar-color:active { transform: scale(.9); transition-duration: 80ms; }
.avatar-color::after { content: ""; position: absolute; inset: -6px -3px; }
@media (hover: hover) and (pointer: fine) { .avatar-color:hover { transform: scale(1.15); } }
/* On touch each swatch owns a whole 44px square: 28px drawn, 16px apart, the rest invisible. */
@media (pointer: coarse) { .avatar-colors { gap: var(--space-4); } .avatar-color { flex: none; inline-size: 28px; block-size: 28px; } .avatar-color::after { inset: -8px; } }

.profile-tabs { display: flex; gap: 2px; inline-size: fit-content; padding: 3px; border-radius: var(--radius-full); background: var(--color-fill); }
.profile-tabs a { display: flex; align-items: center; min-block-size: 34px; padding-inline: var(--space-4); border-radius: var(--radius-full); color: var(--color-ink); font-size: var(--text-subhead); font-weight: var(--weight-medium); text-decoration: none; transition: background-color var(--motion-fast) ease, transform 80ms ease; }
.profile-tabs a:active { transform: scale(.96); }
.profile-tabs a[aria-current="true"] { background: var(--color-surface); box-shadow: var(--hairline), 0 1px 3px rgb(0 0 0 / 10%); }
:root[data-theme="dark"] .profile-tabs a[aria-current="true"] { background: var(--color-elevated); }
@media (hover: hover) and (pointer: fine) { .profile-tabs a:not([aria-current="true"]):hover { background: var(--color-fill); } }
@media (pointer: coarse) { .profile-tabs a { min-block-size: 44px; } }

.profile-checklist { gap: var(--space-3); }
.profile-checklist:not([data-ready]) { display: none; }
.profile-checklist-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.profile-checklist-head h2 { font-size: var(--text-title3); }
.profile-checklist-head span { color: var(--color-muted); font-size: var(--text-caption); font-variant-numeric: var(--numeric); white-space: nowrap; }
.profile-checklist-bar { block-size: 4px; overflow: hidden; border-radius: var(--radius-full); background: var(--color-fill); }
.profile-checklist-bar::before { content: ""; display: block; block-size: 100%; border-radius: inherit; background: var(--color-accent-fill); transform: scaleX(var(--done, 0)); transform-origin: right; transition: transform var(--motion-slow) var(--ease-out); }
[dir="ltr"] .profile-checklist-bar::before { transform-origin: left; }
#profile-checklist-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-1) var(--space-3); margin: 0; padding: 0; list-style: none; }
#profile-checklist-list li { display: flex; align-items: center; gap: var(--space-2); min-block-size: 32px; font-size: var(--text-subhead); }
#profile-checklist-list li::before { content: ""; flex: none; inline-size: 16px; block-size: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--color-fill-strong); }
#profile-checklist-list li[data-done="true"]::before { background: var(--color-success); box-shadow: none; -webkit-mask: var(--check-mask) center / contain no-repeat; mask: var(--check-mask) center / contain no-repeat; }
#profile-checklist-list li { --check-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1a11 11 0 1 0 0 22 11 11 0 0 0 0-22Zm5.2 8.2-6.3 6.4a1 1 0 0 1-1.4 0L6.8 13a1 1 0 1 1 1.4-1.4l2 2 5.6-5.8a1 1 0 0 1 1.4 1.4Z'/%3E%3C/svg%3E"); }
#profile-checklist-list li[data-done="true"] span { color: var(--color-muted); }
#profile-checklist-list button { padding: 0; border: 0; background: none; color: var(--color-accent); font: inherit; font-weight: var(--weight-medium); text-align: start; }
@media (hover: hover) and (pointer: fine) { #profile-checklist-list button:hover { text-decoration: underline; text-underline-offset: 3px; } }
@media (pointer: coarse) { #profile-checklist-list li { min-block-size: 44px; } #profile-checklist-list button { min-block-size: 44px; } }

/* Name beside number, so the card isn't a tall column of short fields. */
@media (min-width: 700px) {
  #profile-form .profile-fields { grid-template-rows: repeat(3, auto); grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: column; gap: var(--space-2) var(--space-5); }
}
#profile-form[data-unchanged] .profile-form-actions { display: none; }
#profile-phone { padding-inline: 0; background: transparent; cursor: default; pointer-events: none; }
[dir="rtl"] #profile-phone { text-align: right; }
.profile-fields [hidden] { display: none; }

.profile-email { display: grid; gap: var(--space-2); padding-block-start: var(--space-4); border-block-start: 1px solid var(--color-separator); }
.profile-email[hidden], .profile-email form[hidden] { display: none; }
.profile-email-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3); font-size: var(--text-subhead); }
.profile-email-value[hidden] { display: none; }
.profile-email-value span:first-child { color: var(--color-muted); }
.profile-email-note:empty, #email-link-status:empty { display: none; }
.email-link-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.email-link-row[hidden] { display: none; }
.email-link-row input { flex: 1 1 220px; min-inline-size: 0; }

.profile-sign-out { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); padding: var(--space-4) var(--space-6); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-card); }
.profile-sign-out p { flex: 1 1 240px; color: var(--color-muted); font-size: var(--text-footnote); }
.profile-sign-out .button { flex: none; color: var(--color-danger); }

@media (max-width: 599px) {
  .profile-card { grid-template-columns: auto minmax(0, 1fr); gap: var(--space-4); padding: var(--space-5); }
  .profile-card .avatar { inline-size: 60px; block-size: 60px; font-size: 1.375rem; align-self: start; }
  .profile-name { font-size: var(--text-title2); }
  .profile-credit { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) auto; align-items: center; justify-items: start; }
  .profile-tabs { inline-size: 100%; }
  .profile-tabs a { flex: 1; justify-content: center; padding-inline: var(--space-2); }
}
