/* ============================================================
   Learn Venice — profiles: the public view (/u/<handle>) and settings
   (/profile). External stylesheet, like every other one here, because the
   production CSP (default-src https:, no 'unsafe-inline') drops inline styles.
   Loaded per-page after community.css, whose .t / .panel / .pd-back it reuses.
   ============================================================ */
.prof-wrap { max-width: 900px; margin: 0 auto; padding: 26px 0 40px; }

/* --- Public profile ------------------------------------------------------- */
.prof-hero { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; gap: 22px; align-items: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; }
.prof-av { width: 88px; height: 88px; border-radius: 20px; display: grid; place-items: center; background: linear-gradient(145deg, var(--surface-2), var(--midnight)); border: 1px solid var(--border-strong); font-family: var(--display); font-size: 36px; color: var(--stucco); }
.prof-id { min-width: 0; }
.prof-name { font-family: var(--display); font-weight: 400; font-size: 28px; margin: 0; line-height: 1.15; overflow-wrap: anywhere; }
.prof-handle { font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 13px; color: var(--ink-faint); margin: 4px 0 0; }
.prof-bio { color: var(--ink-dim); font-size: 14.5px; margin: 12px 0 0; max-width: 58ch; white-space: pre-wrap; overflow-wrap: anywhere; }
.prof-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.prof-aura { text-align: right; }
.prof-since { font-size: 12.5px; color: var(--ink-faint); margin: 6px 0 0; white-space: nowrap; }

/* Aura is profiles.karma. Only the label differs — the number is the same one
   the vote trigger maintains. */
.aura { display: flex; align-items: baseline; gap: 8px; justify-content: flex-end; }
.aura b { font-family: var(--display); font-size: 34px; font-weight: 400; color: var(--stucco); line-height: 1; font-variant-numeric: tabular-nums; }
.aura span { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.stat-card b { display: block; font-family: var(--display); font-weight: 400; font-size: 28px; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-card span { font-size: 12px; color: var(--ink-faint); letter-spacing: 0.04em; }
.stat-card .delta { display: block; margin-top: 6px; font-size: 11.5px; color: var(--stucco); }

.tabs { display: flex; gap: 4px; margin: 26px 0 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs a { font-size: 13.5px; color: var(--ink-faint); padding: 10px 14px; border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--venetian); }

.plist { list-style: none; margin: 0; padding: 0; }
.plist li { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--border); }
.plist .pv { display: flex; flex-direction: column; align-items: center; }
.plist .pv b { font-size: 16px; font-weight: 400; font-variant-numeric: tabular-nums; }
.plist .pv span { font-size: 10.5px; color: var(--ink-faint); }
.plist .pmain { min-width: 0; }
.plist h4 { font-family: var(--display); font-weight: 400; font-size: 18px; margin: 0 0 6px; line-height: 1.25; }
.plist h4 a:hover { color: var(--sea-light); }
.plist .pm { font-size: 12.5px; color: var(--ink-faint); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.plist .pm-accepted { color: #6fc28b; }

/* --- Settings ------------------------------------------------------------- */
.set-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px 20px; margin-bottom: 22px; }
.set-title { font-family: var(--display); font-weight: 400; font-size: 32px; margin: 0; }
.set-viewpublic { font-size: 13.5px; color: var(--sea-light); }
.set-viewpublic:hover { color: var(--ink); }

.set-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 36px; align-items: start; }
.set-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 92px; }
.set-nav a { font-size: 14px; color: var(--ink-faint); padding: 9px 12px; border-radius: 9px; }
.set-nav a:hover { color: var(--ink); }
.set-nav a.on { color: var(--ink); background: var(--surface-2); }

.set-identity { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.set-identity .prof-av { width: 64px; height: 64px; flex: 0 0 64px; font-size: 26px; border-radius: 16px; }
.set-identity-name { font-family: var(--display); font-size: 22px; font-weight: 400; margin: 0; }
.set-identity-sub { font-size: 13px; color: var(--ink-faint); margin: 3px 0 0; }

.set-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.set-card + .set-card, .set-identity + .set-card { margin-top: 20px; }
.set-card h3 { font-family: var(--display); font-weight: 400; font-size: 21px; margin: 0 0 4px; }
.set-card .sub { color: var(--ink-dim); font-size: 13.5px; margin: 0 0 20px; }
.set-card code { font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 0.9em; color: var(--ink-dim); }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.field label { font-size: 13px; color: var(--ink-dim); }
/* Text fields only. Without the :not(), this skins a checkbox as well — width
   100%, 11px padding and a 9px radius — which made the "don't forward my old
   username" box expand to the full row and squeeze its own label into a 79px
   column that overflowed the card. */
.field input:not([type="checkbox"]):not([type="radio"]),
.field textarea { background: var(--midnight); border: 1px solid var(--border-strong); border-radius: 9px; color: var(--ink); font-family: var(--sans); font-size: 15px; padding: 11px 14px; width: 100%; }
.field textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--venetian); box-shadow: 0 0 0 3px rgba(60,143,221,0.16); }
/* Size and colour come from the global .hint in site.css; overriding the
   font-size here is what kept settings hints bigger than composer hints. */
.field .hint { margin: 0; }
.field .hint b { color: var(--ink-dim); font-weight: 500; }
.field.is-locked input { color: var(--ink-faint); background: var(--surface-2); cursor: default; }

.set-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding-top: 2px; }
.set-actions .btn { justify-content: center; }

@media (max-width: 760px) {
  .prof-hero { grid-template-columns: 64px minmax(0, 1fr); }
  .prof-av { width: 64px; height: 64px; font-size: 26px; border-radius: 16px; }
  .prof-aura { grid-column: 1 / -1; text-align: left; }
  .aura { justify-content: flex-start; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .set-grid { grid-template-columns: 1fr; gap: 20px; }
  .set-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .plist li { grid-template-columns: 44px minmax(0, 1fr); }
  .plist li > .t { grid-column: 2; justify-self: start; }
}

/* ===========================================================================
   M7 — avatar upload and the username field.
   =========================================================================== */

.set-avrow { display: flex; gap: 16px; align-items: flex-start; }
.set-avactions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.set-avactions .hint { margin: 0; }

/* A label styled as a button, wrapping the real file input. The native control
   cannot be restyled reliably and its "No file chosen" text is wrong here. */
.set-avpick { cursor: pointer; position: relative; overflow: hidden; }
.set-avpick input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
  /* Full-size and transparent rather than hidden, so the label is genuinely the
     control — keyboard focus and the file dialog both land in the right place. */
  width: 100%; height: 100%;
}
.set-avdrop {
  border: 0; background: none; cursor: pointer; padding: 0;
  color: var(--ink-faint); font-size: 12.5px;
}
.set-avdrop:hover { color: var(--ink); }

/* The @ sits inside the field so the value reads as a handle while it is typed. */
.set-handle {
  display: flex; align-items: center; gap: 2px;
  background: var(--midnight); border: 1px solid var(--border); border-radius: 8px;
  padding-left: 11px;
}
.set-handle:focus-within { border-color: var(--venetian); }
.set-handle span { color: var(--ink-faint); font-size: 14px; }
/* The @ and the field share one bordered box (.set-handle), so the input inside
   has to give up every edge of its own — including the focus ring. `.field
   input:focus` paints a 3px glow at a 9px radius, which drew a second rounded
   box starting right where the @ ends, inside the wrapper's own focus border.
   The wrapper handles focus via :focus-within above. */
.set-handle input {
  flex: 1; border: 0 !important; background: none !important;
  padding-left: 2px !important; outline: none; box-shadow: none !important;
}
.set-handle input:disabled { color: var(--ink-faint); cursor: not-allowed; }

/* ===========================================================================
   One-card settings. The page was four cards, a side nav and a read-only
   "Account" panel wrapped around six fields.
   =========================================================================== */
.prof-wrap .set-card { padding: 0; }
.set-sec { padding: 22px 24px; }
.set-sec h3 { margin: 0 0 3px; font-size: 15px; }
.set-sec .sub { margin: 0 0 12px; }
.set-rule { height: 1px; margin: 0; border: 0; background: var(--border); }

.set-avrow { display: flex; gap: 18px; align-items: flex-start; }
.set-avactions { flex: 1; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.set-avbtns { display: flex; align-items: center; gap: 14px; margin: 2px 0 2px; }
.set-avactions .hint { margin: 0; }

/* Field + button on one line, so "Change" reads as belonging to the username. */
.set-inline { display: flex; align-items: stretch; gap: 10px; }
.set-inline .set-handle { flex: 1; }
.set-inline .btn { white-space: nowrap; }

@media (max-width: 560px) {
  .set-sec { padding: 18px 16px; }
  .set-avrow { gap: 14px; }
  .set-inline { flex-direction: column; align-items: stretch; }
}

/* ===========================================================================
   Avatar editor: the picture, centred and alone, with a pencil affordance.
   =========================================================================== */
.set-avsec { display: flex; justify-content: center; padding: 30px 24px 26px; }
.av-edit { position: relative; display: flex; flex-direction: column; align-items: center; }

/* The real file input never renders; the menu drives it. */
.av-edit-form input[type="file"] {
  position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}

.av-edit-btn {
  position: relative; padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 50%; line-height: 0;
}
.av-edit-btn:disabled { cursor: default; }
.av-edit-btn .av { transition: filter .15s; }
.av-edit-btn:hover .av { filter: brightness(.82); }
.av[data-size="112"] { width: 112px; height: 112px; font-size: 42px; }

.av-edit-pencil {
  position: absolute; right: -2px; bottom: -2px;
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--venetian); color: #fff;
  border: 3px solid var(--midnight);
}
.av-edit-pencil svg {
  width: 15px; height: 15px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.av-edit-busy {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.25); border-top-color: #fff;
  animation: av-spin .8s linear infinite;
}
@keyframes av-spin { to { transform: rotate(360deg); } }

.av-edit-menu {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  z-index: 40; min-width: 184px; padding: 6px;
  background: var(--midnight); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.45);
}
.av-edit-menu button {
  display: block; width: 100%; text-align: left;
  padding: 9px 10px; border: 0; background: none; cursor: pointer;
  border-radius: 6px; color: var(--ink); font-size: 13.5px; white-space: nowrap;
}
.av-edit-menu button:hover { background: rgba(255,255,255,.06); }
.av-edit-menu button.is-danger { color: #e5866a; }
.av-edit-menu button.is-danger:hover { background: rgba(194,96,63,.14); }

.av-edit-err { margin: 12px 0 0; font-size: 12.5px; color: #e5866a; text-align: center; }

/* Per-rename opt-out under the username field. */
.set-check {
  display: flex; gap: 9px; align-items: flex-start;
  margin: 10px 0 0; font-size: 12px; line-height: 1.5; color: var(--ink-dim);
  cursor: pointer;
}
.set-check input { margin-top: 2px; flex: 0 0 auto; width: auto; accent-color: var(--venetian); }
.set-check code { font-size: 11px; }
