/* ══════════════════════════════════════════════════════════════════════════
   sections.css — the Vitalité section shell.
   --------------------------------------------------------------------------
   One skin (gold/blue), three section-INTERFACES — the same role-split idea
   as the investor/entrepreneur surfaces:

       🩺 Infirmary  ·  📚 Knowledge  ·  💬 Social

   This file styles the shared chrome the split needs:
     · the section switcher pills (every page header, incl. admin.html)
     · the infirmary dashboard strip (recovery status cards)
     · hub polish on the landing doors

   Sidebar SCOPING is done by sections.js with inline styles, so the
   no-JS fallback is the current single-rail behaviour. Everything here is
   decoration on top of each page's own theme variables.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Section switcher — three pills in every header ── */

.sec-switcher{
  /* HARDENED: the pills are a single horizontal row, always. Older themes
     and stale cached stylesheets styled this as a column/block, which
     stacked the three pills over the account chip. flex-direction:row +
     nowrap + width:max-content make a stacked render impossible even if a
     stale .sec-switcher rule from an old sections.css is still applied. */
  display:flex;flex-direction:row;align-items:center;gap:2px;
  width:max-content;max-width:none;
  margin-left:.25rem;
  background:var(--surface2);
  border:1px solid var(--border);
  border-radius:99px;padding:2px;
  /* Never shrink or stretch: the pills must stay fully visible with every
     element to their left pushed over, not squeezed off the bar. The base
     themes' generic `nav` rules would otherwise stretch this box and blow
     the header height (a 48px-tall switcher wrapping a ~27px pill row). */
  flex:0 0 auto;
  align-self:center;
  line-height:1.2;
}
/* Generic nav rules in the origin themes paint their own backdrop on any
   <nav> — beat them so the pill capsule keeps its own surface + border. */
header .sec-switcher{background:var(--surface2);border:1px solid var(--border)}
.sec-pill{
  display:inline-flex;align-items:center;gap:.35rem;
  padding:.3rem .65rem;border-radius:99px;
  font-size:.78rem;font-weight:700;line-height:1.2;
  color:var(--text2);text-decoration:none;white-space:nowrap;
  flex:0 0 auto;
  transition:background .15s,color .15s;
}
.sec-pill:hover{color:var(--accent);background:var(--surface);text-decoration:none}
.sec-pill.active{background:var(--accent);color:#fff}
body.dark .sec-pill.active{color:#1a1300}
.sec-ico{font-size:.85rem;line-height:1}

/* ── Placement: the switcher lives INSIDE .header-actions ───────────────
   sections.js appends the pills into the account cluster (after the bell +
   profile). On the shell bar that cluster is the RIGHT flank of the centred
  -search layout, so the pills ride at the bar's far-right corner by
   construction — no margin/order juggling needed, and nothing ever sits
   under the field. Base (non-shell) headers keep the plain right-aligned
   cluster. */
header .header-inner > .header-actions{margin-left:auto}
/* On the shell bar the pills are the last element inside the right flank
   (header-actions), so they ride at the far-right corner by construction.
   The uniform 14px gap comes from the clone's gap — cap the capsule height
   so a small sub-pixel stretch never shows as a tall pill on the bar. */
body.lin-v2 .header-actions .sec-switcher{
  align-self:center;flex:0 0 auto;position:relative;z-index:20;
  margin-left:0;
}

/* Labels only where they fit. The search field is centred across the whole
   header (window centre = rail offset), so on skin pages a labelled
   switcher slides under it below ~1280px; icon-only pills clear it down to
   ~700px. Icon mode keeps aria-labels from sections.js. */
@media (max-width:1280px){
  .sec-pill-label{display:none}
  .sec-pill{padding:.3rem .45rem}
  .sec-ico{font-size:.95rem}
}

/* Tap targets. Icon-only, a pill paints at ~32x26px, which is under the 40px
   minimum the rest of the site holds. Sizing the pill itself is simpler and
   more robust here than a ::before halo: shapes-fx already paints a ::before
   on the icon span inside, and a max()-based halo resolved to 7px. The bar is
   48px tall and the switcher adds 2px of padding, so a 40px pill still fits
   with room to spare, and four icon-only pills measure ~170px - still no
   collision with the centred search field down to the 900px cut-off. */
.sec-pill{min-width:40px;min-height:40px;justify-content:center}

/* Below 950px the bar has only ~350–500px to serve the centred search field,
   the toggles, the bell and the account pill — the pill capsule (icon-only it
   is ~172px with four sections) does not fit beside a centred field. It is
   hidden under 950px; the sidebar still carries the section links at those
   widths (and is its big 224px label state there), so switching sections
   stays one click away. Non-shell pages are untouched. */
/* The cut-off was 900px with three pills; a fourth icon-only pill measures
   172px and no longer fits between 900 and 939, which pushed the bar 16px
   wide and gave the page a horizontal scrollbar. Measured: 172px is clear
   from 940 up. Raising the cut-off to 950 removes the whole broken band and
   costs a 10px sliver that had no room for the capsule anyway. */
@media (max-width:950px){
  body.lin-v2 .header-actions .sec-switcher{display:none}
}

/* ── Flat section rail — subcategories listed, no collapsible header ──
   The current section's sidebar shows its links flat. The part-toggle is
   the accordion header — redundant when exactly one group is visible, and
   clickable, which would collapse the whole section's links. It is hidden
   everywhere EXCEPT the desktop rail's rest state, where the toggle IS the
   rail icon (re-shown in the media query below). */
body.sec-knowledge .sidebar-group.part[data-part="vitalite-knowledge"] > .part-toggle,
body.sec-infirmary .sidebar-group.part[data-part="vitalite-infirmary"] > .part-toggle,
body.sec-social .sidebar-group.part[data-part="vitalite-social"] > .part-toggle{display:none}
body.sec-knowledge .sidebar-group.part[data-part="vitalite-knowledge"] > .part-body,
body.sec-infirmary .sidebar-group.part[data-part="vitalite-infirmary"] > .part-body,
body.sec-social .sidebar-group.part[data-part="vitalite-social"] > .part-body{max-height:none;overflow:visible}
/* Developer Tools group: same escape hatch, but not tied to a section —
   admin.html carries no sec-* class and must show Moderation/Site Designer/
   Content Editor links on hover (admin inline .part-body{max-height:0} would
   otherwise crush this group's body to nothing on every page). */
body .sidebar-group.part[data-part="vitalite-dev"] > .part-body{max-height:none;overflow:visible}

/* Desktop rail, rest state: the section toggle is the rail icon — show it
   again; the body stays hidden by the rail's own display rules. */
@media (hover:hover) and (min-width:901px){
  body .sidebar .sidebar-group.part[data-part="vitalite-knowledge"] > .part-toggle,
  body .sidebar .sidebar-group.part[data-part="vitalite-infirmary"] > .part-toggle,
  body .sidebar .sidebar-group.part[data-part="vitalite-social"] > .part-toggle{display:flex}
  body .sidebar .sidebar-group.part[data-part="vitalite-knowledge"] > .part-body,
  body .sidebar .sidebar-group.part[data-part="vitalite-infirmary"] > .part-body,
  body .sidebar .sidebar-group.part[data-part="vitalite-social"] > .part-body{max-height:0;overflow:hidden}
  body .sidebar:hover .sidebar-group.part[data-part="vitalite-knowledge"] > .part-toggle,
  body .sidebar:hover .sidebar-group.part[data-part="vitalite-infirmary"] > .part-toggle,
  body .sidebar:hover .sidebar-group.part[data-part="vitalite-social"] > .part-toggle,
  body .sidebar:focus-within .sidebar-group.part[data-part="vitalite-knowledge"] > .part-toggle,
  body .sidebar:focus-within .sidebar-group.part[data-part="vitalite-infirmary"] > .part-toggle,
  body .sidebar:focus-within .sidebar-group.part[data-part="vitalite-social"] > .part-toggle{display:none}
  body .sidebar:hover .sidebar-group.part[data-part="vitalite-knowledge"] > .part-body,
  body .sidebar:hover .sidebar-group.part[data-part="vitalite-infirmary"] > .part-body,
  body .sidebar:hover .sidebar-group.part[data-part="vitalite-social"] > .part-body,
  body .sidebar:focus-within .sidebar-group.part[data-part="vitalite-knowledge"] > .part-body,
  body .sidebar:focus-within .sidebar-group.part[data-part="vitalite-infirmary"] > .part-body,
  body .sidebar:focus-within .sidebar-group.part[data-part="vitalite-social"] > .part-body{max-height:none;overflow:visible}
}

/* Study tabs are the Knowledge identity — keep them off other sections. */
body.sec-infirmary .lin-pagetabs,
body.sec-social .lin-pagetabs{display:none}

/* ── Infirmary dashboard strip — recovery status cards ── */

.dash-strip{
  display:grid;grid-template-columns:repeat(3,1fr);gap:.75rem;
  max-width:760px;margin:1.5rem auto 0;text-align:left;
}
.dash-card{
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius-sm);padding:.85rem 1rem;
  box-shadow:var(--shadow-sm);
}
.dash-label{
  font-size:.68rem;font-weight:700;text-transform:uppercase;
  letter-spacing:.07em;color:var(--text3);margin-bottom:.25rem;
}
.dash-value{font-size:.95rem;font-weight:800;color:var(--accent);line-height:1.35}
.dash-value small{font-weight:600;color:var(--text2);font-size:.8rem}
.dash-ok{color:var(--green)}
.dash-empty{color:var(--text3);font-weight:600}

@media (max-width:640px){
  .dash-strip{grid-template-columns:1fr}
}

/* ── Hub — the landing fork is a three-door split ── */

.landing .fork-ico{font-size:2rem}