/* ---------------------------------------------------------------------------
   Peltify — the public-profile editor.

   Owned by src/ui/profile.js and nothing else. Everything on this page is
   prefixed `.ep-`; the older `.pf-` rules in social.css now dress only the two
   popups this page opens (the photo chooser and the media search), which kept
   their markup.

   THE SHAPE, RESTYLED 2026-08-27. The editor is a SETTINGS PANE now, so it
   stops being a floating white sheet with a shadow and becomes what every
   other pane is: white cards on 1px hairlines, 16px radii, one violet button
   (Save) and nothing else in violet. `.ep-card` is the same recipe as
   `.stg-card` in settings.css — deliberately restated rather than reached for
   across files, because this file owns its own look.

   MOTION. `.rise` only, and only on entry — the shell gates it behind
   `.is-fresh`, so the repaints this page does while somebody types are still.
   --------------------------------------------------------------------------- */

.ep {
  width: 100%;
  display: grid;
  gap: 16px;
}

/* The pane's own card recipe. Rows inside are divided by hairlines, never by
   gaps, which is what makes a stack of facts read as one object. */
.ep-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--white);
  padding: 4px 20px;
}
.ep-card > * + * { border-top: 1px solid var(--line-soft); }

/* ---------------------------------------------------------- identity card -- */

.ep-idcard {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 16px 20px;
  background: var(--white);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}

.ep-idacts { display: flex; align-items: center; gap: 8px; flex: none; }

.ep-idwho { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }

.ep-idhandle {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ep-idname {
  font-size: 13.5px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Two quiet buttons, because Save is the pane's one primary. */
.ep-photo,
.ep-preview {
  flex: none;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.ep-photo:hover,
.ep-preview:hover { border-color: var(--ink-faint); background: var(--paper); }

/* ---------------------------------------------------------------- fields -- */

/* The three identity fields are one card of hairline-separated rows. */
.ep-fields { display: grid; }
.ep-field { display: grid; gap: 7px; padding: 16px 0; }

.ep-label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.ep-field-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color var(--fast) var(--ease);
}
.ep-field-box:focus-within { outline: 2px solid var(--violet); outline-offset: 1px; border-color: transparent; }

/* A textarea box carries its counter in the bottom-right corner, so it needs
   the room reserved for it rather than the text running underneath. */
.ep-field-box.is-area { display: block; padding: 10px 12px 26px; }

.ep-input,
.ep-textarea {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  border: 0;
  background: none;
  outline: none;
  font-size: 15px;
  color: var(--ink);
}
.ep-input { height: 40px; }
.ep-textarea { display: block; resize: vertical; line-height: 1.55; min-height: 84px; }
.ep-input::placeholder,
.ep-textarea::placeholder { color: var(--ink-faint); }

/* The fixed halves of the username field: typed over, never typed into. */
.ep-prefix,
.ep-suffix {
  flex: none;
  color: var(--ink-faint);
  font-weight: 700;
  font-size: 15px;
  user-select: none;
  pointer-events: none;
}
.ep-input-bare { padding-left: 0; }

/* The username field: a fixed "@" on the left, the account's fixed public id on
   the right, and only the middle is typed. */
.ep-affix { gap: 2px; }

.ep-count {
  position: absolute;
  right: 12px;
  bottom: 7px;
  font: 600 11.5px var(--font-mono);
  color: var(--ink-faint);
}

.ep-avail { margin: 0; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.ep-avail:empty { display: none; }
.ep-avail.is-ok { color: var(--ok); }
.ep-avail.is-warn { color: var(--warn); }

.ep-hint { margin: 0; font-size: 12.5px; color: var(--ink-faint); max-width: 60ch; }

.ep-empty { margin: 0; font-size: 13.5px; color: var(--ink-soft); max-width: 62ch; }

.ep-warn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--warn-wash);
  color: var(--warn);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}
.ep-warn.is-ok { background: var(--ok-wash); color: var(--ok); }

.ep-signin {
  display: flex;
  gap: 12px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--ink-soft);
}
.ep-signin b { display: block; font-size: 15px; color: var(--ink); }
.ep-signin span { display: block; margin-top: 3px; font-size: 13.5px; }
/* The block now carries the door itself rather than pointing at Settings for a
   flow that is not there (2026-08-27), so it needs room for a button. */
.ep-signin { align-items: center; flex-wrap: wrap; }
.ep-signin > div { flex: 1 1 240px; }

/* -------------------------------------------------------------- sections -- */

.ep-sections { display: grid; gap: 12px; }

.ep-sec {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--white);
  overflow: hidden;
}
.ep-sec.is-hidden { opacity: 0.62; }

/* REORDERING BY HAND (rebuilt 2026-08-27).
   The card used to carry `draggable="true"`, and a browser refuses to start a
   native drag on an <input> — so the only grabbable pixels were the slivers
   between the title field and the tool buttons. Nick: "It is clunky and
   doesn't move it unless I drag it in a super tight space between the
   different components." The whole title bar is the handle now. It is 46px
   tall so a finger can find it, `touch-action: none` so a touch drag is a
   drag rather than a page scroll, and it is the ONLY element in this file
   that takes touch-action away — the tiles and chips keep theirs so a finger
   can still scroll the pane over them. */
.ep-sec-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  padding: 8px 10px 8px 8px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--white);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.ep-sec-head:focus { outline: none; }
.ep-sec-head:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: -2px;
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.ep-sec.is-lifted .ep-sec-head { cursor: grabbing; }

/* The card in the air. Nothing else on the page moves under the pointer, so
   the shadow and the 2% are the whole signal that it is off the surface. */
.ep-sec.is-lifted,
.ep-chip.is-lifted,
.ep-tile.is-lifted {
  box-shadow: var(--raise-hi);
  border-color: var(--violet);
  transition: none;
  will-change: transform;
}

/* The hole it left. Same height as the card, so the list never jumps. */
/* ---------------------------------------------------------------------------
   COLLAPSED WHILE DRAGGING (2026-08-30, public-profile entry 2).
   "make it collapse into small horizontal rectangles when grabbing the drag
   option, which has the name on it such as 'Favourite genres' … Smooth
   animations, Smooth closing down." Only the header stays, so every rectangle
   still carries its own name and the destination is obvious.
   --------------------------------------------------------------------------- */
.ep-sec { transition: max-height 200ms var(--ease), box-shadow 200ms var(--ease); }
.ep-sections.is-collapsed .ep-sec {
  max-height: 46px;
  overflow: hidden;
}
.ep-sections.is-collapsed .ep-sec-body,
.ep-sections.is-collapsed .ep-sec-note { opacity: 0; pointer-events: none; }
.ep-sections.is-collapsed .ep-sec-head { min-height: 44px; }
.ep-sections.is-collapsed .ep-sec.is-lifted { box-shadow: 0 12px 30px rgba(24, 12, 40, 0.22); }
@media (prefers-reduced-motion: reduce) {
  .ep-sec { transition: none; }
}

.ep-drag-ph {
  border: 1.5px dashed var(--violet);
  border-radius: var(--r-md);
  background: var(--violet-wash);
  animation: ep-ph-in 160ms var(--ease) both;
}
@keyframes ep-ph-in { from { opacity: 0; } to { opacity: 1; } }

/* While something is in the air the cursor says so everywhere, and no drag
   across the page selects text behind it. */
body.is-reordering { cursor: grabbing; user-select: none; -webkit-user-select: none; }

.ep-grip { display: inline-flex; padding: 0 4px; color: var(--ink-faint); }
.ep-sec-head:hover .ep-grip { color: var(--violet); }

.ep-sec-title {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  padding: 4px 2px;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.ep-sec-title:focus { box-shadow: inset 0 -2px 0 var(--violet); }
/* The one part of the handle that is still a field. A press here focuses it;
   a press that MOVES picks the card up instead, and once the caret is in it a
   drag selects text again. */
.ep-sec-title { cursor: text; user-select: text; -webkit-user-select: text; }

.ep-sec-tools { display: flex; align-items: center; gap: 2px; }

.ep-tool {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-faint);
  font-size: 14px;
  line-height: 1;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.ep-tool:hover:not(:disabled) { background: var(--violet-wash); color: var(--violet); }
.ep-tool:disabled { opacity: 0.28; cursor: not-allowed; }
.ep-tool.is-on { color: var(--violet); }

.ep-sec-note {
  margin: 0;
  padding: 8px 12px 0;
  font-size: 12.5px;
  color: var(--ink-faint);
}

.ep-sec-body { display: grid; gap: 12px; padding: 12px; }

/* Chips — the genres. A chip is a name, never a picture of one. */
.ep-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.ep-chip {
  display: inline-flex;
  align-items: center;
  cursor: grab;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}

.ep-chip-open {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 4px 7px 11px;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 750;
  color: var(--ink);
}
.ep-chip-open:hover { color: var(--violet); }
.ep-chip-n { font: 600 11px var(--font-mono); color: var(--ink-faint); }

/* ---------------------------------------------------------------------------
   THE TWO TASTE SECTIONS on the editor (2026-08-30, public-profile entries
   1–2): the Dashboard's own picture, drawn live, and one row of chips for
   hiding individual names. A hidden name is struck through and dimmed rather
   than removed, so putting it back is the same press.
   --------------------------------------------------------------------------- */
.ep-sec-blurb { margin: 0; font-size: 12.5px; color: var(--ink-soft); }
.ep-taste { border: 1px solid var(--line); border-radius: var(--r-box); padding: 12px; background: var(--white); }
.ep-trim > summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); padding: 4px 0; }
.ep-trim > summary:hover { color: var(--ink); }
.ep-trim .ep-chips { margin-top: 8px; }
.ep-chip-trim { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
                border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--white);
                font: inherit; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.ep-chip-trim:hover { border-color: var(--ink); }
.ep-chip-trim.is-off { opacity: 0.5; }
.ep-chip-trim.is-off .ep-chip-t { text-decoration: line-through; }

/* Tiles — everything with artwork. */
.ep-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(184px, 1fr));
  gap: 8px;
}

.ep-tile {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 5px 4px 5px 5px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--white);
  cursor: grab;
}

.ep-tile-open {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
}

.ep-tile-art {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper-deep);
  color: var(--ink-faint);
}
.ep-tile-art img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ep-tile-copy { display: grid; gap: 1px; min-width: 0; }
.ep-tile-name {
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ep-tile-by {
  font-size: 11.5px;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ep-tile-open:hover .ep-tile-name { color: var(--violet); }

.ep-x {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink-faint);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.ep-x:hover { background: var(--coral-wash); color: var(--coral-dark); }

.ep-sec-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* The strays note: a sentence and the one button that acts on it. */
.ep-stray {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.ep-stray > span { flex: 1 1 220px; min-width: 0; }

.ep-add {
  display: grid;
  gap: 10px;
  padding: 16px 20px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--white);
}
.ep-add-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* The one secondary button shape on the page. */
.ep-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.ep-add-btn:hover { border-color: var(--ink-faint); background: var(--paper); }

/* ------------------------------------------------------------------ save -- */

.ep-save { display: grid; gap: 10px; padding-top: 4px; }

.ep-save-btn {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--violet);
  color: var(--white);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  transition: background var(--fast) var(--ease);
}
.ep-save-btn:hover:not(:disabled) { background: var(--spine); }
.ep-save-btn:disabled { opacity: 0.38; cursor: not-allowed; }

.ep-save-msg {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}
.ep-save-msg.is-ok { color: var(--ok); }
.ep-save-msg.is-warn { color: var(--warn); }
.ep-save-msg:empty { display: none; }

/* ---------------------------------------------------------------- popups -- */

/* The two popups keep their `.pf-` markup and social.css dressing; these are
   the only differences the new page asks for. */
.ep-pop .btn,
.ep-pop .btn-primary,
.ep-pop .btn-quiet { border-radius: 12px; }

.ep-searchbar {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink-faint);
}
.ep-searchbar:focus-within { border-color: var(--violet); }

.ep-search-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  border: 0;
  background: none;
  outline: none;
  font-size: 15px;
  color: var(--ink);
}
.ep-search-spin { flex: none; display: inline-flex; width: 14px; }

.ep-results { display: grid; gap: 10px; }

.ep-genre-list { display: grid; gap: 8px; }

.ep-genre-res {
  position: relative;
  padding: 12px 58px 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--white);
}
.ep-genre-res.is-added { opacity: 0.6; }
.ep-genre-copy { display: block; min-width: 0; }

.ep-genre-name { display: block; font-size: 14.5px; font-weight: 800; letter-spacing: -0.01em; }
.ep-genre-blurb {
  margin: 4px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 62ch;
}
.ep-genre-note { display: block; margin-top: 6px; font-size: 11.5px; color: var(--ink-faint); }

.ep-genre-res .pf-plus { top: 50%; bottom: auto; right: 12px; transform: translateY(-50%); }
.ep-genre-res .pf-plus:hover:not(:disabled) { transform: translateY(-50%) scale(1.1); }

/* ---------------------------------------------------------------- narrow -- */

@media (max-width: 560px) {
  .ep { gap: 12px; }
  .ep-tiles { grid-template-columns: 1fr; }
  .ep-card { padding-left: 16px; padding-right: 16px; }
  .ep-idcard { padding: 14px 16px; gap: 11px; }
  .ep-idacts { flex: 1 1 100%; }
  .ep-photo, .ep-preview { flex: 1 1 auto; padding: 0 12px; }
}

/* ===========================================================================
   13.11 — the section carries its weight (public-profile SPEC 2026-09-08,
   answer 26: "Every filled section is gradient-coded by importance on the pelt
   chips' scale (--rel)").

   THE SAME MIX AS `.sc-tag` IN chat.css: Peltify purple at --rel into the
   paper. It is drawn as a spine down the card's leading edge rather than as a
   wash behind the words, because a section is a page of text and text on a
   coloured field at --rel 0.9 stops being readable. An EMPTY section carries
   no --rel at all and gets no spine — "not filled" is not "least important".
   =========================================================================== */
.ep-sec.is-filled {
  border-left: 3px solid color-mix(in srgb, var(--violet) calc(var(--rel, 0) * 100%), var(--line));
}
.ep-sec.is-filled .ep-sec-head {
  background: color-mix(in srgb, var(--violet) calc(var(--rel, 0) * 9%), transparent);
}

/* The one per-section switch: public (an eye) or private (a lock). It replaced
   an eye here AND a toggle in Settings, which was two controls for one fact. */
.ep-pub.is-on { color: var(--violet); }
.ep-pub:not(.is-on) { color: var(--ink-faint); }
