/* Profile page: hero + progress, section rail, section cards, form controls,
   builds and the build editor. Everything here is prefixed pf-. */

main.wide { padding-bottom: 40px; }

/* ---------- hero + progress ---------- */
.pf-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 40px; margin-top: 36px; }
.pf-hero-text { flex: 1 1 420px; min-width: 0; }
.pf-hero h1 { margin: 0; font-size: 38px; line-height: 1.1; letter-spacing: -.01em; }
.lede { margin: 10px 0 0; color: var(--muted); max-width: 560px; }
.pf-progress { flex: 0 1 340px; min-width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; }
.pf-progress[hidden] { display: none; }
.pf-progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-weight: 600; }
.pf-progress-head span + span { font-weight: 400; color: var(--muted); font-size: 13px; text-align: right; }
.pf-bar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; margin-top: 12px; }
.pf-bar span { height: 6px; border-radius: 3px; background: var(--border-strong); }
.pf-bar span.done { background: var(--ok); }
.pf-progress p { margin: 10px 0 0; font-size: 13px; color: var(--warn); }
.pf-progress p.ok { color: var(--ok); }

/* ---------- layout + section rail ---------- */
.pf-layout { display: flex; flex-wrap: wrap; gap: 32px; margin-top: 36px; align-items: flex-start; }
.pf-layout[hidden] { display: none; }
.pf-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.pf-rail { flex: 1 1 220px; max-width: 260px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.pf-rail a { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px; border-radius: 12px; color: var(--text); text-decoration: none; border: 1px solid transparent; }
.pf-rail a:hover { background: var(--surface); border-color: var(--border); }
.pf-rail a.is-active { background: var(--surface); border-color: var(--border-strong); box-shadow: inset 3px 0 0 var(--accent-fill); }
.pf-mark { width: 26px; height: 26px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.rail-text { display: flex; flex-direction: column; min-width: 0; }
.rail-name { font-weight: 600; }
.rail-status { font-size: 13px; color: var(--muted); }
.is-done .pf-mark { background: var(--ok-bg); color: var(--ok); }
.is-done .rail-status { color: var(--ok); }
.is-todo .pf-mark { background: var(--warn-bg); color: var(--warn); }
.is-todo .rail-status { color: var(--warn); }

/* ---------- section card + pager ---------- */
.pf-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; }
.pf-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 24px 28px 20px; }
.pf-card-head h2 { margin: 0; font-size: 24px; font-weight: 600; }
.pf-card-head h2:focus { outline: none; }
.pf-why { flex: 1 1 100%; margin: 0; font-size: 13px; color: var(--muted); }
.pf-body { padding: 0 28px 28px; display: flex; flex-direction: column; gap: 24px; }
.pf-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.pf-status.done { color: var(--ok); }
.pf-status.todo { color: var(--warn); }
.pf-status.opt { color: var(--muted); border: 1px solid var(--border-strong); border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.pf-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- fields ---------- */
.pf-field { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pf-field > label { font-weight: 600; font-size: 14px; }
.pf-field > legend { float: left; width: 100%; padding: 0; margin-bottom: 10px; font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; gap: 12px; }
.pf-field > legend + * { clear: both; }
.pf-sub { font-weight: 400; color: var(--muted); }
.pf-sub.warn { color: var(--warn); }
.pf-sub.ok { color: var(--ok); }
.pf-hint { margin: 0; font-size: 13px; color: var(--muted); }
.pf-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.pf-stack { display: flex; flex-direction: column; gap: 8px; }
.pf-input { width: 100%; min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--sunken); color: var(--text); font: inherit; }
textarea.pf-input { padding: 10px 14px; min-height: 88px; resize: vertical; }
.pf-callout { display: flex; gap: 14px; padding: 16px 18px; border-radius: 12px; background: var(--note-bg); border: 1px solid var(--note-border); }
.pf-callout svg { flex: none; margin-top: 2px; color: var(--accent); }
.pf-callout p { margin: 0; font-size: 14px; }

/* ---------- choice controls (real inputs, visually hidden) ---------- */
.pf-chip, .pf-opt, .pf-seg label { position: relative; display: block; }
.pf-chip input, .pf-seg input, .pf-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.pf-chip input:focus-visible + span, .pf-seg input:focus-visible + span, .pf-opt input:focus-visible + .pf-opt-body { outline: 2px solid var(--accent); outline-offset: 2px; }

/* chips */
.pf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pf-chip span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--chip-fg); font-size: 14px; cursor: pointer; user-select: none; }
.pf-chips.small .pf-chip span { min-height: 40px; padding: 0 12px; font-size: 13px; }
.pf-chip input:checked + span { background: var(--chip-on-bg); border-color: var(--chip-on-border); color: var(--chip-on-fg); font-weight: 600; }
.pf-chip input:disabled + span { opacity: .45; cursor: not-allowed; }

/* segmented */
.pf-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-radius: 12px; background: var(--sunken); border: 1px solid var(--border); align-self: flex-start; }
.pf-seg span { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; min-width: 64px; padding: 0 16px; border-radius: 9px; color: var(--muted); cursor: pointer; user-select: none; }
.pf-seg input:checked + span { background: var(--accent-fill); color: var(--on-accent); font-weight: 600; }
.pf-seg.tiers span { min-width: 38px; padding: 0 6px; font-size: 13px; font-weight: 600; }

/* option cards */
.pf-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pf-opt-body { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 16px; border-radius: 12px; border: 1px solid var(--border-strong); cursor: pointer; color: var(--chip-fg); }
.pf-opt input:checked + .pf-opt-body { background: var(--chip-on-bg); border-color: var(--chip-on-border); color: var(--chip-on-fg); }
.pf-box { width: 20px; height: 20px; flex: none; border-radius: 6px; border: 1.5px solid var(--border-strong); display: flex; align-items: center; justify-content: center; color: var(--on-accent); }
.pf-opt input[type="radio"] + .pf-opt-body .pf-box { border-radius: 50%; }
.pf-box svg { opacity: 0; }
.pf-opt input:checked + .pf-opt-body .pf-box { background: var(--accent-fill); border-color: var(--accent-fill); }
.pf-opt input:checked + .pf-opt-body .pf-box svg { opacity: 1; }
.pf-opt-text { display: flex; flex-direction: column; }
.pf-opt-text b { font-weight: 600; }
.pf-opt-sub { font-size: 13px; color: var(--muted); }

/* rating rows */
.pf-rates { display: flex; flex-direction: column; gap: 10px; }
.pf-rate { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }

/* ---------- save bar + notes ---------- */
.pf-save { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; padding-top: 20px; border-top: 1px solid var(--border); }
.pf-note { font-size: 13px; color: var(--muted); }
.pf-note.dirty, .pf-note.todo { color: var(--warn); }
.pf-note.ok { color: var(--ok); }
.pf-note.err { color: var(--err); }

/* ---------- builds ---------- */
.pf-builds { display: flex; flex-direction: column; gap: 10px; padding-top: 22px; border-top: 1px solid var(--border); }
.pf-builds-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.pf-builds-head h3 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: 0; color: var(--text); }
.pf-build-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 16px; border-radius: 12px; background: var(--sunken); border: 1px solid var(--border-strong); }
.pf-build-info { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; }
.pf-build-info b { font-weight: 600; }
.pf-build-info span { font-size: 13px; color: var(--muted); }
.pf-main-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .04em; text-transform: uppercase; }
.btn.add { width: 100%; min-height: 52px; border: 1.5px dashed var(--border-strong); background: transparent; color: var(--accent); border-radius: 12px; }

/* build editor */
.pf-editor { border: 1px solid var(--chip-on-border); border-radius: 16px; padding: 22px; background: var(--sunken); display: flex; flex-direction: column; gap: 22px; }
.pf-editor-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; }
.pf-editor-head h4 { margin: 2px 0 0; font-size: 21px; font-weight: 600; }
.pf-editor-head .eyebrow { font-size: 12px; margin: 0; }
.btn.pf-main-toggle[aria-pressed="true"] { background: var(--chip-on-bg); border: 1px solid var(--chip-on-border); color: var(--chip-on-fg); cursor: default; }
.pf-weapon { display: flex; flex-direction: column; gap: 8px; }
.pf-art { align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--chip-on-fg); background: var(--chip-on-bg); border-radius: 999px; padding: 2px 10px; }
.pf-art:empty { display: none; }
.pf-iw { display: flex; flex-direction: column; gap: 8px; }
.pf-iw-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.pf-iw-row .n { width: 22px; text-align: center; color: var(--muted); font-size: 13px; }
.pf-iw-row select { flex: 1 1 220px; min-width: 0; width: auto; }
.pf-editor .pf-save { padding-top: 18px; }
.pf-editor .pf-save .btn.danger-text { margin-right: auto; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .pf-hero h1 { font-size: 30px; }
  .pf-layout { gap: 20px; margin-top: 24px; }
  /* the rail becomes a sideways chip row */
  .pf-rail { flex: 1 1 100%; max-width: none; flex-direction: row; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .pf-rail::-webkit-scrollbar { display: none; }
  .pf-rail a { flex: none; min-height: 44px; padding: 6px 14px 6px 8px; border: 1px solid var(--border-strong); border-radius: 999px; }
  .pf-rail a.is-active { box-shadow: none; background: var(--chip-on-bg); border-color: var(--chip-on-border); color: var(--chip-on-fg); }
  .pf-rail .rail-status { display: none; }
  .pf-card-head { padding: 18px 18px 16px; }
  .pf-body { padding: 0 18px 20px; }
  .pf-pager .pf-note { display: none; }
  .pf-editor { padding: 16px; }
}
@media (max-width: 560px) {
  .pf-two, .pf-opts { grid-template-columns: 1fr; }
  .pf-progress { flex: 1 1 100%; }
}
