/* fhg-member.css — the member page frame: one header, one page-title block,
 * one state component. Release 53, 13 Nov 2026 (the member review's redesign
 * M6, approved by the owner on 13 Nov 2026).
 *
 * Only member pages load this file (scripts/sync-member-shell.mts lists them),
 * and every rule is scoped to a class only those pages use (.member-head,
 * .mh-*, .mp-*, .mstate*), so nothing public can change through it. Colors,
 * type and radii come from the tokens in assets/style.css, which every page
 * loads first; there is no color of its own here. All three themes (Bronze,
 * the default; Paper; Gold) read from the same tokens.
 *
 * What it does not do: decide anything. The header's markup is written by the
 * generator, its behavior (the menu, the skip link) is assets/fhg-member.js,
 * and what a state says comes from /api/session's lapse view.
 */

/* ---------------------------------------------------------- skip link */
.mh-skip {
  position: absolute; left: 12px; top: -60px; z-index: 300;
  padding: 10px 16px; border-radius: 8px;
  background: var(--bg-elev); color: var(--text); border: 1px solid var(--gold-dim);
  font-family: var(--serif); font-size: var(--fs-body); text-decoration: none;
  transition: top .15s ease;
}
.mh-skip:focus { top: 10px; outline: 2px solid var(--gold); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .mh-skip { transition: none; } }

/* ---------------------------------------------------------- the header */
/* Three columns, the outer two equal, so the groups sit at the true center
   and nothing moves when the streak or the account fills in after the session
   is read (review T17: the dashboard's header shifted as it painted). */
nav.site-nav.member-head .inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 20px;
}
.member-head .logo { justify-self: start; }
.member-head .logo { text-decoration: none; }
.member-head .mh-groups { display: flex; justify-content: center; align-items: center; gap: 6px; min-width: 0; }
/* Hidden for a closed membership (review T30): the space stays on a wide
   screen, so nothing shifts; a phone drops the row. */
.member-head .mh-groups[hidden] { visibility: hidden; }
.member-head .mh-group {
  position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
  font-family: var(--serif); font-size: var(--fs-body); color: var(--text-dim); text-decoration: none;
  border-radius: 8px; white-space: nowrap; transition: color .2s ease;
}
.member-head .mh-group:hover { color: var(--gold); }
.member-head .mh-group.is-current { color: var(--text); }
.member-head .mh-group.is-current::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2px; border-radius: 2px; background: var(--gold);
}
.member-head .mh-group:focus-visible,
.member-head .mh-signin:focus-visible,
.member-head .mh-avatar:focus-visible,
.member-head .mh-theme:focus-visible,
.member-head .logo:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.member-head .mh-end { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.member-head .mh-theme {
  width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-elev); border: 1px solid var(--border); cursor: pointer; padding: 0; flex-shrink: 0;
}
.member-head .mh-signin { font-family: var(--serif); font-size: var(--fs-body); color: var(--gold); text-decoration: none; padding: 8px 6px; }
.member-head .mh-acct { position: relative; }
/* The account keeps its place while hidden (no shift when it appears). */
.member-head .mh-acct[hidden] { display: block; visibility: hidden; width: 36px; height: 36px; }
.member-head .mh-signin[hidden],
.member-head .avatar-picker[hidden], .member-head .avatar-menu-item[hidden], .member-head .avatar-rank-badge[hidden] { display: none; }
.member-head .mh-avatar {
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; padding: 0;
  background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-dim);
  font-family: var(--serif); font-size: var(--fs-body); font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.member-head .avatar-rank-badge {
  position: absolute; right: -4px; bottom: -4px; font-size: var(--fs-label); line-height: 1;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 50%; padding: 2px; pointer-events: none;
}

/* The avatar menu. Hidden by the attribute; the script toggles it. */
.member-head .mh-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 200;
  min-width: 220px; padding: 6px; border-radius: 10px;
  background: var(--bg-elev); border: 1px solid var(--border);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .55);
  text-align: left;
}
.member-head .mh-menu[hidden] { display: none; }
.member-head .mh-menu .avatar-menu-item {
  display: block; width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 6px;
  font-family: var(--serif); font-size: var(--fs-body); color: var(--text-dim); text-decoration: none;
}
/* Release 56: an item the page has hidden stays hidden. The rule above (same
   specificity as line 69's [hidden] rule, and later) drew every hidden item:
   FHG Compass and What's coming showed on every member page, to every member,
   though only the dashboard reveals them, and only when they apply. */
.member-head .mh-menu .avatar-menu-item[hidden], .member-head .mh-menu .avatar-menu-label[hidden] { display: none; }
.member-head .mh-menu .avatar-menu-item:hover,
.member-head .mh-menu .avatar-menu-item:focus-visible { background: var(--gold-soft); color: var(--text); outline: none; }
.member-head .mh-menu .avatar-menu-label {
  margin: 8px 12px 2px; font-family: var(--serif); font-size: var(--fs-label); letter-spacing: .08em;
  text-transform: uppercase; color: var(--gold);
}
.member-head .avatar-picker { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }
.member-head .avatar-picker-label { margin: 0 12px 6px; font-size: var(--fs-small); color: var(--text-faint); }
.member-head .avatar-picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 6px 6px; }

/* Phones: the wordmark and the account on one row, the three groups on the
   next, one equal third each, at a 44px touch height. */
@media (max-width: 760px) {
  nav.site-nav.member-head .inner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "logo end" "groups groups";
    row-gap: 10px;
  }
  .member-head .logo { grid-area: logo; }
  .member-head .mh-end { grid-area: end; }
  .member-head .mh-groups { grid-area: groups; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .member-head .mh-groups[hidden] { display: none; }
  .member-head .mh-group { justify-content: center; min-height: 44px; padding: 0 6px; font-size: var(--fs-body); }
  .member-head .mh-group.is-current::after { left: 22%; right: 22%; }
}
@media (prefers-reduced-motion: reduce) { .member-head .mh-group { transition: none; } }

/* ------------------------------------------------- the page-title block */
.mp-head { max-width: 860px; margin: 0 auto; padding: 40px 20px 8px; text-align: center; }
.mp-kicker {
  margin: 0 0 10px; font-family: var(--serif); font-size: var(--fs-label); letter-spacing: .14em;
  text-transform: uppercase; color: var(--gold);
}
.mp-kicker a { color: inherit; text-decoration: none; }
.mp-kicker a:hover { text-decoration: underline; }
.mp-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: var(--fs-4); line-height: 1.15; color: var(--text); }
.mp-sub { margin: 12px auto 0; max-width: 62ch; font-size: var(--fs-body); line-height: 1.6; color: var(--text-dim); }
@media (max-width: 640px) { .mp-head { padding: 28px 4px 4px; } }

/* --------------------------------------------- the state component */
.mstate {
  max-width: 560px; margin: 40px auto; padding: 32px 28px; box-sizing: border-box;
  text-align: center; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
}
.mstate[hidden] { display: none; }
.mstate-icon { font-size: var(--fs-3); line-height: 1; margin-bottom: 12px; }
.mstate-title { margin: 0 0 10px; font-family: var(--serif); font-weight: 400; font-size: var(--fs-2); color: var(--text); }
.mstate-msg { margin: 0 auto 10px; max-width: 46ch; font-size: var(--fs-body); line-height: 1.6; color: var(--text-dim); }
.mstate-saved { margin: 0 auto 22px; max-width: 46ch; font-size: var(--fs-body); line-height: 1.6; color: var(--text); }
.mstate-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.mstate-actions .btn { min-height: 44px; }
.mstate-more { margin: 16px 0 0; font-size: var(--fs-body); color: var(--text-faint); }
.mstate-more a { color: var(--gold); }
/* Release 54 (accessibility): style.css colors every link in a .state-banner
   gold, which turned a gold button's label gold on gold (1:1) in Bronze and
   Gold wherever the state painted into a banner. A button keeps its own label
   color here, as account settings already did for itself (release 45). */
.state-banner a.btn { text-decoration: none; }
.state-banner a.btn-gold, .state-banner a.btn-gold:hover { color: #1a1410; }
html[data-theme="paper"] .state-banner a.btn-gold, html[data-theme="paper"] .state-banner a.btn-gold:hover { color: var(--bg); }
.mstate:focus { outline: none; }
.mstate:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

/* ---------------------------------------------- the dashboard's header */
/* Release 56 (owner ruling, 15 Nov 2026; design decision DD31): the dashboard
   carries release 47's header. The wordmark at the left; the streak and the
   account at the right, with the theme switch inside the account menu; no
   Learn / Practice / Career tools row. On a phone one menu button opens the
   streak and the account, as in release 47. The generator writes it
   (scripts/sync-member-shell.mts, HEAD_VARIANT). */
nav.site-nav.member-head.mh-dash .inner { grid-template-columns: minmax(0, 1fr) auto; }
.member-head.mh-dash .mh-dash-toggle { display: none; }
.member-head .mh-streak {
  position: relative; cursor: help; border-radius: 6px; padding: 4px 2px;
  font-family: var(--serif); font-size: var(--fs-small); color: var(--text-dim); white-space: nowrap;
}
.member-head .mh-streak[hidden] { display: none; }
.member-head .mh-streak:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.member-head .mh-streak-tip {
  display: none; position: absolute; top: calc(100% + 10px); right: 0; z-index: 210; width: min(300px, calc(100vw - 32px));
  padding: 12px 14px; border-radius: 8px; background: var(--bg-elev); border: 1px solid var(--border);
  font-size: var(--fs-body); line-height: 1.55; color: var(--text-dim); text-align: left; white-space: normal;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .55);
}
.member-head .mh-streak:hover .mh-streak-tip, .member-head .mh-streak:focus .mh-streak-tip { display: block; }
.member-head .mh-menu .mh-theme-item { display: flex; align-items: center; gap: 10px; background: none; border: 0; text-align: left; cursor: pointer; }
@media (max-width: 760px) {
  nav.site-nav.member-head.mh-dash .inner { position: relative; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "logo toggle"; }
  .member-head.mh-dash .mh-dash-toggle {
    grid-area: toggle; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
    border-radius: 8px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text);
    font-size: var(--fs-1); line-height: 1; cursor: pointer; padding: 0;
  }
  .member-head.mh-dash .mh-dash-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
  .member-head.mh-dash .mh-end {
    display: none; position: absolute; top: calc(100% + 8px); left: -16px; right: -16px; z-index: 60;
    flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 32px 20px;
    background: var(--bg-elev); border-bottom: 1px solid var(--border-soft);
  }
  .member-head.mh-dash .mh-end.open { display: flex; }
  .member-head.mh-dash .mh-acct[hidden] { display: none; }
  .member-head.mh-dash .mh-menu { left: 0; right: auto; }
  .member-head .mh-streak-tip { right: auto; left: 0; }
}
