/* ═══════════════════════════════════════════════════════════════════════════
   friends.css — the /friends/ page sheet.

   STRUCTURE comes from dominion.css, the LOOK from haven.css, which is loaded
   AFTER this file on purpose (build.py). Only page-local classes live here,
   every colour is a token, and gold is light, never ink: the one lit label on
   this page (`.ctx.online`) uses `--ember-ink`, the token the ladder records
   for "live labels" — never `--ember` (a paint token; check_contrast refuses
   it as running text).

   The live sheet is live_capture/pjs/friends_friends.css. Its composition is
   kept (page column, intro + toggle, three stacked panels, the dropdown under
   the search box, the row line shared by every list, a toast at the foot, a
   modal over everything); its palette is this tree's.

   Two of its class names are renamed because dominion.css already owns them
   for the CHROME (`.switch` is a full-width bordered button row, `.who` is the
   profile pill): `.vswitch` and `.s-who`. Everything else keeps its live name.
   ═══════════════════════════════════════════════════════════════════════════ */

/* the page column: the live sheet caps the page at 860px and centres it */
.friends-main { max-width: 920px; }
/* one rule for every [hidden] this page toggles (groups, empties, results, the
   toggle wrap, the modal): the attribute wins over any display set below */
#gd-friends [hidden] { display: none !important; }

/* ── the map-visibility master toggle, under the intro ───────────────────── */
.vis-toggle {
  display: flex; align-items: center; gap: 14px;
  max-width: 460px; margin: 24px auto 0; padding: 13px 16px;
  text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r);
  background: rgba(6,5,6,.6);
}
.vis-copy { display: grid; gap: 4px; min-width: 0; }
.vis-label { color: var(--t-hi); font: 600 11px/1 var(--data); text-transform: uppercase; letter-spacing: .12em; }
.vis-hint { color: var(--t-sec); font-size: 11.5px; line-height: 1.45; }
/* the checkbox shell. 44x24 so the real <input> clears the 22px target floor */
.vswitch { position: relative; flex: 0 0 auto; width: 44px; height: 24px; }
.vswitch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.vswitch .knob {
  position: absolute; inset: 0; pointer-events: none;
  border-radius: var(--r-pill); background: var(--void); border: 1px solid var(--line-hot);
  transition: background var(--quick), border-color var(--quick);
}
.vswitch .knob::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--t-ter);
  transition: transform var(--quick), background var(--quick);
}
.vswitch input:checked + .knob { background: rgba(232,144,26,.18); border-color: var(--ember); }
.vswitch input:checked + .knob::after { transform: translateX(20px); background: var(--ember-core); box-shadow: 0 0 10px rgba(232,144,26,.7); }
.vswitch input:focus-visible + .knob { outline: 2px solid var(--ember-core); outline-offset: 2px; }

/* ── scenes: loading | noauth | main, keyed off the page root ────────────── */
.scene { display: none; }
#gd-friends[data-scene="loading"] #scene-loading { display: block; }
#gd-friends[data-scene="noauth"] #scene-noauth { display: block; }
#gd-friends[data-scene="main"] #scene-main { display: grid; gap: 18px; }
#scene-main > .panel { margin: 0; }
.scene-card {
  display: grid; place-items: center; gap: 18px;
  min-height: 320px; padding: 48px 24px; text-align: center;
}
.scene-card h2 { font-size: clamp(18px, 2.2vw, 26px); }
.scene-card p { margin: 0; max-width: 46ch; color: var(--t-sec); font-size: 14px; line-height: 1.55; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line-up); border-top-color: var(--ember);
  animation: gd-fr-spin .9s linear infinite;
}
@keyframes gd-fr-spin { to { transform: rotate(360deg); } }

/* ── the panels ──────────────────────────────────────────────────────────── */
/* the live page's three panel anchors, kept as semantic hooks; under the
   sticky chrome a deep link must not land with its header hidden */
.add-panel, .requests-panel, .friends-panel { scroll-margin-top: 120px; }
.panel-h .sub {
  margin-left: auto; flex: 0 0 auto; text-align: right;
  color: var(--t-dim); font: 500 10px/1.4 var(--data); letter-spacing: .14em; text-transform: uppercase;
}
.add-method { display: grid; gap: 7px; }
.add-method label { color: var(--t-dim); font: 500 10px/1 var(--data); letter-spacing: .18em; text-transform: uppercase; }
.add-columns { margin-top: 18px; }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1 1 auto; min-width: 0; }
.input-row .btn { flex: 0 0 auto; }
#gd-friends .hint { margin: 7px 0 0; color: var(--t-ter); font-size: 12px; line-height: 1.5; }
.mycode-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mycode-row code {
  padding: 4px 9px; border: 1px solid var(--line-up); border-radius: 6px;
  background: var(--void); color: var(--t-hi);
  font: 700 12px/1.6 var(--data); letter-spacing: .08em;
}

/* ── the search dropdown ─────────────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  display: grid; gap: 2px; padding: 6px;
  border: 1px solid var(--line-up); border-radius: var(--r);
  background: var(--panel-up); box-shadow: var(--crush);
}
.search-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 11px; border-radius: 7px;
}
.search-item:hover { background: var(--panel-hi); }
.search-item .s-who { display: grid; gap: 3px; min-width: 0; }
.search-item .nm { color: var(--t-hi); font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item .ctx { color: var(--t-dim); font: 600 9.5px/1 var(--data); text-transform: uppercase; letter-spacing: .08em; }
/* the live channel on a live label: the raw "Online now" marker, the class
   test the script keeps on the RAW string (friends.js showResults) */
.search-item .ctx.online { color: var(--ember-ink); }
.search-empty { padding: 12px; color: var(--t-sec); font-size: 12.5px; text-align: center; }

/* ── the row line shared by requests + friends (rowEl) ───────────────────── */
.rows { display: grid; gap: 8px; }
.rowline {
  display: flex; flex-wrap: wrap; align-items: center; gap: 13px;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r);
  background: rgba(6,5,6,.55);
}
.rowline .avatar {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line-up); background: var(--panel-hi) center/cover no-repeat;
}
.rowline .meta { flex: 1 1 160px; min-width: 0; display: grid; gap: 4px; justify-items: start; }
.rowline .nm { max-width: 100%; color: var(--t-hi); font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rowline .stat { display: flex; align-items: center; gap: 7px; color: var(--t-dim); font: 600 9.5px/1 var(--data); text-transform: uppercase; letter-spacing: .08em; }
.rowline .dot { width: 7px; height: 7px; }
/* online: the WORD says it, the dot lights, the text goes bone — never gold body ink */
.rowline.online .dot { background: var(--ember-core); border-color: var(--ember-core); box-shadow: 0 0 0 3px rgba(232,144,26,.18), 0 0 10px 1px rgba(232,144,26,.8); }
.rowline.online .stat { color: var(--t-hi); }
.rowline .ops { display: flex; gap: 7px; flex: 0 0 auto; margin-left: auto; }
.tag.onmap { color: var(--t-hi); border-color: rgba(255,198,77,.45); background: rgba(232,144,26,.10); }

.req-group h3 { margin: 0 0 9px; font-size: 11px; letter-spacing: .18em; color: var(--t-sec); }
.req-group + .req-group { margin-top: 16px; }
#gd-friends .empty { margin: 0; padding: var(--s5) var(--s4); font-size: 13px; line-height: 1.55; color: var(--t-ter); }

/* ── toast + modal (the live-page pattern) ───────────────────────────────── */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--livebar-h, 34px) + 18px); z-index: 120;
  max-width: min(90vw, 480px); padding: 11px 18px;
  border: 1px solid var(--line-up); border-radius: var(--r);
  background: var(--panel-up); color: var(--t-hi); font-size: 13px; text-align: center;
  box-shadow: var(--crush);
  opacity: 0; pointer-events: none;
  transform: translateX(-50%) translateY(20px);
  transition: opacity var(--quick), transform var(--quick);
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { border-color: rgba(255,198,77,.55); box-shadow: var(--glow-2), var(--crush); }
/* an error is a solid bar and the word, not a red sentence */
#toast.err { border-color: var(--t-ter); border-left: 4px solid var(--t-sec); }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 150;
  display: grid; place-items: center; padding: 18px;
  background: rgba(4,2,7,.74);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-card { width: min(440px, 100%); padding: 22px; display: grid; gap: 14px; }
.modal-card h3 { font-size: 18px; }
.modal-card p { margin: 0; color: var(--t-body); font-size: 13.5px; line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }

/* ── responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .input-row { flex-wrap: wrap; }
  .input-row .btn { width: 100%; }
  .rowline .ops { margin-left: 0; width: 100%; }
  .rowline .ops .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  #toast { transition: none; }
}
