/* The Souk · character pages: the picture and Personality editors, and the
   "In the Journal" references that close every profile. Tokens only. */

.profile-editor-sr{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.profile-picture-editor [hidden],.profile-personality-editor [hidden]{display:none!important}

/* ── Picture: the portrait itself is the control ────────────────────────── */
.profile-picture-editor{display:flex;flex-direction:column;align-items:flex-start;gap:var(--s-3);min-width:0;max-width:100%;margin:0}
.profile-picture-target{position:relative;display:block;min-width:96px;min-height:96px;max-width:100%;padding:0;border-radius:var(--r-3);overflow:hidden;isolation:isolate;background:var(--night-3);color:inherit;transition:box-shadow var(--dur-3) var(--ease-out)}
.profile-picture-target [data-portrait-current]{display:block;min-width:96px;min-height:96px}
.profile-picture-target [data-portrait-current]>.portrait{display:flex;width:128px;height:128px;margin:0;border-radius:0}
.profile-picture-hint{position:absolute;inset:auto 0 0;z-index:5;display:flex;align-items:center;justify-content:center;gap:var(--s-2);padding:var(--s-6) var(--s-2) var(--s-3);background:linear-gradient(180deg,transparent,color-mix(in srgb,var(--night-0) 90%,transparent) 62%);font:600 var(--text-2xs)/1.3 var(--font-ui);font-stretch:82%;letter-spacing:var(--label-tracking);text-transform:uppercase;color:var(--bone-0);pointer-events:none;transition:color var(--dur-2)}
.profile-picture-hint::before{content:'';flex:none;width:7px;height:7px;border-radius:50%;background:var(--accent);box-shadow:0 0 10px var(--accent)}
.profile-picture-target:hover,.profile-picture-target:focus-visible,.profile-picture-target.is-dragging{box-shadow:var(--glow),var(--e-3)}
.profile-picture-target:hover .profile-picture-hint,.profile-picture-target:focus-visible .profile-picture-hint,.profile-picture-target.is-dragging .profile-picture-hint{color:var(--accent-strong)}
.profile-picture-target:focus-visible{outline:2px solid var(--focus);outline-offset:4px;border-radius:var(--r-3)}
.profile-picture-target.is-dragging{outline:2px dashed var(--accent);outline-offset:4px}
.character-hero.is-memorial .profile-picture-hint::before{background:var(--bone-3);box-shadow:none}
.character-hero.is-memorial .profile-picture-target:hover .profile-picture-hint,.character-hero.is-memorial .profile-picture-target:focus-visible .profile-picture-hint{color:var(--bone-0)}
.profile-picture-help{max-width:240px;margin:0;font-size:var(--text-xs);line-height:1.5;color:var(--muted)}
.profile-picture-editor .portrait-upload-preview{max-width:100%;gap:var(--s-3);margin:0;padding:var(--s-2);border:1px solid var(--accent-line);border-radius:var(--r-2);background:var(--accent-wash)}
.profile-picture-editor .portrait-upload-preview img{width:72px;height:72px}
.profile-picture-editor .portrait-upload-actions,.profile-personality-actions{display:flex;flex-wrap:wrap;gap:var(--s-2);max-width:100%;margin:0}
.profile-picture-editor progress{appearance:none;display:block;width:100%;max-width:240px;height:6px;border:0;border-radius:var(--r-pill);overflow:hidden;background:var(--night-4);accent-color:var(--accent)}
.profile-picture-editor progress::-webkit-progress-bar{background:var(--night-4)}
.profile-picture-editor progress::-webkit-progress-value{border-radius:var(--r-pill);background:var(--accent)}
.profile-picture-editor progress::-moz-progress-bar{background:var(--accent)}
.profile-picture-editor .portrait-upload-status,.profile-personality-editor [role=status]{max-width:520px;margin:0;font-size:var(--text-sm);line-height:1.5;color:var(--text-soft);overflow-wrap:anywhere}
.profile-personality-editor [role=status]:empty{display:none}
.profile-picture-editor .portrait-upload-status.is-error{color:var(--bad)}

/* Editor buttons carry the shared button look without the shared class. */
.profile-picture-editor button:not(.profile-picture-target),.profile-personality-editor button{display:inline-flex;align-items:center;justify-content:center;min-height:var(--tap);padding:10px 18px;border:1px solid var(--line-strong);border-radius:var(--r-pill);background:var(--panel);font:600 var(--text-sm)/1.2 var(--font-ui);letter-spacing:.01em;color:var(--text);transition:background var(--dur-2) var(--ease-out),border-color var(--dur-2) var(--ease-out),color var(--dur-2) var(--ease-out)}
.profile-picture-editor button:not(.profile-picture-target):hover:not(:disabled),.profile-personality-editor button:hover:not(:disabled){background:var(--panel2);border-color:var(--accent-line);color:var(--text-strong)}
.profile-picture-editor button[type=submit],.profile-personality-editor button[type=submit]{border-color:var(--accent);background:var(--accent);color:var(--accent-ink)}
.profile-picture-editor button[type=submit]:hover:not(:disabled),.profile-personality-editor button[type=submit]:hover:not(:disabled){border-color:var(--accent-strong);background:var(--accent-strong);color:var(--accent-ink)}

/* ── Personality ────────────────────────────────────────────────────────── */
.profile-personality-editor{display:grid;gap:var(--s-3);max-width:720px;min-width:0;margin:var(--s-4) 0 var(--s-5)}
.profile-personality-editor>label{font:600 var(--text-xs)/1.4 var(--font-ui);font-stretch:82%;letter-spacing:var(--label-tracking);text-transform:uppercase;color:var(--muted)}
.profile-personality-editor textarea{display:block;width:100%;min-height:160px;padding:var(--s-3) var(--s-4);border:1px solid var(--line-strong);border-radius:var(--r-2);background:var(--night-0);color:var(--text);font:400 1.0625rem/1.6 var(--font-read);resize:vertical;transition:border-color var(--dur-2),box-shadow var(--dur-2)}
.profile-personality-editor [data-personality-latest]{margin:0;padding:var(--s-3) var(--s-4);border:1px solid var(--line);border-left:3px solid var(--accent);border-radius:var(--r-2);background:var(--panel);font:400 var(--text-md)/1.6 var(--font-read);color:var(--text-soft);white-space:pre-wrap;overflow-wrap:anywhere}

/* ── In the Journal: where this character is on the record ──────────────── */
.character-journal{max-width:980px;margin:var(--s-7) 0 0}
.character-journal-heading{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:var(--s-3) var(--s-5);padding-bottom:var(--s-3);border-bottom:2px solid var(--line-strong)}
.character-journal h2{font-size:var(--text-2xl)}
.character-journal-heading p{margin-top:var(--s-1);font-size:var(--text-sm);font-variant-numeric:tabular-nums;color:var(--accent)}
.character-journal-heading label{display:grid;gap:var(--s-2);flex:0 1 240px;min-width:190px;font:600 var(--text-xs)/1.4 var(--font-ui);font-stretch:82%;letter-spacing:var(--label-tracking);text-transform:uppercase;color:var(--muted)}
.character-journal-heading .input{letter-spacing:0;text-transform:none}
.character-journal>.context-note{margin:var(--s-3) 0 0;font-size:var(--text-sm)}
.character-journal>h2+.context-note{font:italic 400 var(--text-lg)/1.5 var(--font-read)}
.character-journal-row{display:grid;grid-template-columns:230px minmax(0,1fr);grid-template-rows:auto 1fr;column-gap:var(--s-5);padding:var(--s-3) 0;border-bottom:1px solid var(--line)}
.character-journal-row>a{grid-column:1;display:flex;flex-direction:column;justify-content:center;min-height:var(--tap);font:500 var(--text-lg)/1.25 var(--font-read);font-variant-numeric:tabular-nums;color:var(--text-strong)}
.character-journal-row>a span{font:600 var(--text-xs)/1.5 var(--font-ui);color:var(--link)}
.character-journal-row>a:hover{color:var(--accent-strong)}
.character-journal-row>a:hover span{text-decoration:underline;text-underline-offset:.24em}
.character-journal-basis{grid-column:1;display:flex;flex-wrap:wrap;align-content:flex-start;gap:0 var(--s-2);font:600 var(--text-2xs)/1.6 var(--font-ui);font-stretch:82%;letter-spacing:var(--label-tracking);text-transform:uppercase;color:var(--muted)}
.character-journal-basis span+span::before{content:'·';margin-right:var(--s-2);color:var(--faint)}
.character-journal-row p{grid-column:2;grid-row:1/3;align-self:center;max-width:var(--measure);font:400 1.0625rem/1.6 var(--font-read);color:var(--text-soft);overflow-wrap:anywhere}
.character-journal>.hint{margin-top:var(--s-3);font-variant-numeric:tabular-nums}
.character-journal>.btn{margin-top:var(--s-2)}

@media (max-width:700px){
  .character-journal-heading label{flex:1 1 100%}
  .character-journal-row{grid-template-columns:minmax(0,1fr);grid-template-rows:none;padding:var(--s-3) 0 var(--s-4)}
  .character-journal-row>a{flex-direction:row;align-items:baseline;justify-content:space-between;gap:var(--s-3)}
  .character-journal-row p{grid-column:1;grid-row:auto;margin-top:var(--s-2)}
  .profile-personality-actions>button{flex:1 1 140px}
}
