/* ============================================================
   HealthCompass - "Atlas" navigation styles (v2.55.0).
   ONE stylesheet for ONE renderer (js/nav.js) on every page, the
   homepage included. The bar and its panels are dark in BOTH themes
   (as before), so every colour here is a dark-surface colour and no
   body.dark override is needed.
   Group colour = group (Measure / Fuel / Move / Mind hue).
   Shape = item (HCIcons mark per guide/tool, never repeated in a panel).
   Layers: bar 9000 · panels 8999 · scrim 8995 · sheet/search 9050.
   Drawers (9100) and the Calm Space (9500) still sit above.
   ============================================================ */

.hcx-root, #hc-nav {
  --x-bg: var(--hc-ink-850, #050C1A);
  --x-panel: #0A1426;
  --x-line: rgba(255,255,255,.09);
  --x-line-2: rgba(255,255,255,.14);
  --x-text: #FFFFFF;
  --x-dim: rgba(255,255,255,.74);    /* 10.9:1 on --x-panel */
  --x-faint: rgba(255,255,255,.62);  /* 7.6:1 on --x-panel  */
  --x-teal: #5FE0CF;
  --x-ease: cubic-bezier(.25,1,.5,1);
  --x-measure: #4FC3E8;
  --x-fuel: #3FD07F;
  --x-move: #FF8A5C;
  --x-mind: #ADA2EA;
  --x-h: var(--hc-nav-h, 64px);
}

/* ---------- bar --------------------------------------------------- */
.hcx {
  position: relative; z-index: 9000;
  background: var(--x-bg);
  border-bottom: 1px solid rgba(0,180,162,.22);
  font-family: 'Inter', system-ui, sans-serif;
}
.hcx-bar {
  height: calc(var(--x-h) - 1px);   /* + 1px border = exactly --hc-nav-h */
  max-width: 1440px; margin: 0 auto;
  padding: 0 1.25rem;
  display: flex; align-items: center; gap: .25rem;
}
.hcx-brand {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  text-decoration: none; margin-right: 1rem; border-radius: 10px; flex-shrink: 0;
}
.hcx-glyph { display: inline-flex; width: 34px; height: 34px; }
.hcx-bt { display: flex; flex-direction: column; gap: 3px; }
.hcbname { font-family: 'Fraunces', Georgia, serif; font-size: 1.12rem; font-weight: 700; color: #fff; letter-spacing: -.02em; line-height: 1; }
.hcbsub { font-size: .58rem; color: var(--x-teal); text-transform: uppercase; letter-spacing: .12em; line-height: 1; }

.hcx-links { display: flex; align-items: center; gap: .15rem; }
.hcx-flex { flex: 1; }
.hcx-acts { display: flex; align-items: center; gap: .35rem; }

.hcx-tab, .hcx-link, .hcx-flag {
  display: inline-flex; align-items: center; gap: .4rem;
  min-height: 44px; padding: 0 .8rem; border-radius: 9px;
  background: none; border: 0; cursor: pointer;
  font: 500 .86rem/1 'Inter', system-ui, sans-serif;
  color: var(--x-dim); text-decoration: none; white-space: nowrap;
  transition: color .2s var(--x-ease), background-color .2s var(--x-ease);
}
.hcx-tab:hover, .hcx-link:hover, .hcx-flag:hover { color: #fff; background: rgba(255,255,255,.06); }
.hcx-tab.on, .hcx-tab[aria-expanded="true"] { color: #fff; background: rgba(0,180,162,.16); }
.hcx-link[aria-current="page"] { color: #fff; box-shadow: inset 0 -2px 0 var(--x-teal); border-radius: 9px 9px 2px 2px; }
.hcx-car { font-size: .62rem; opacity: .75; transition: transform .22s var(--x-ease); }
.hcx-tab[aria-expanded="true"] .hcx-car { transform: rotate(180deg); }

.hcx-div { width: 1px; height: 22px; background: var(--x-line-2); margin: 0 .5rem; }
.hcx-flag { color: #fff; font-weight: 600; }
.hcx-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--fa); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fa) 22%, transparent); }
.hcx-flag.on { box-shadow: inset 0 -2px 0 var(--fa); border-radius: 9px 9px 2px 2px; }

.hcx-sbtn {
  display: inline-flex; align-items: center; gap: .55rem;
  min-height: 44px; min-width: 196px; padding: 0 .55rem 0 .8rem;
  background: rgba(255,255,255,.05); border: 1px solid var(--x-line-2); border-radius: 10px;
  color: var(--x-dim); font: 500 .84rem/1 'Inter', system-ui, sans-serif; cursor: pointer;
  transition: border-color .2s var(--x-ease), background-color .2s var(--x-ease), color .2s var(--x-ease);
}
.hcx-sbtn:hover { border-color: rgba(95,224,207,.5); background: rgba(255,255,255,.08); color: #fff; }
.hcx-sb-t { flex: 1; text-align: left; }
.hcx-kbd {
  font: 600 .7rem/1 ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color: var(--x-dim); border: 1px solid var(--x-line-2); border-radius: 5px; padding: .25rem .4rem;
}
.hcx .hc-theme-toggle { width: 44px; height: 44px; margin-left: .2rem; }

.hcx-ic { display: inline-flex; flex-shrink: 0; line-height: 1; }
.hcx-ic svg { display: block; }

.hcx-mob { display: none; align-items: center; gap: .35rem; margin-left: auto; }
.hcx-ibtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,.05); border: 1px solid var(--x-line-2); color: #fff;
  transition: background-color .2s var(--x-ease);
}
.hcx-ibtn:hover { background: rgba(255,255,255,.1); }

/* ---------- panels ------------------------------------------------ */
.hcx-panel {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 8999;
  background: var(--x-panel);
  border-bottom: 1px solid var(--x-line-2);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.6);
  max-height: calc(100vh - var(--x-h)); overflow-y: auto; overscroll-behavior: contain;
  opacity: 0; transform: translateY(-8px);
  transition: opacity .22s var(--x-ease), transform .22s var(--x-ease);
}
.hcx-panel.is-open { opacity: 1; transform: none; }
.hcx-panel[hidden] { display: none; }
.hcx-pin { max-width: 1240px; margin: 0 auto; padding: 2rem 1.5rem 1.5rem; display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 2.5rem; }
.hcx-pin-foot { display: block; padding-top: 0; padding-bottom: 1.25rem; }

.hcx-phead { display: flex; align-items: baseline; flex-wrap: wrap; gap: .4rem 1.25rem; margin-bottom: 1.5rem; }
.hcx-pt { font-family: 'Fraunces', Georgia, serif; font-size: 1.9rem; font-weight: 600; color: #fff; letter-spacing: -.025em; line-height: 1; }
.hcx-pp { margin: 0; font-size: .86rem; color: var(--x-dim); flex: 1; min-width: 260px; line-height: 1.5; }
.hcx-all { color: var(--x-teal); font-size: .84rem; font-weight: 600; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.hcx-all:hover { text-decoration: underline; text-underline-offset: 3px; }

.hcx-ggrid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 2rem; }
.hcx-gcol { display: flex; flex-direction: column; gap: 1.35rem; min-width: 0; }
.hcx-grp-h {
  display: flex; align-items: center; gap: .55rem;
  padding-bottom: .6rem; margin-bottom: .35rem; border-bottom: 1px solid var(--x-line);
  font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
}
.hcx-grp[data-ig="measure"] { --gh: var(--x-measure); }
.hcx-grp[data-ig="fuel"]    { --gh: var(--x-fuel); }
.hcx-grp[data-ig="move"]    { --gh: var(--x-move); }
.hcx-grp[data-ig="mind"]    { --gh: var(--x-mind); }
.hcx-grp-nm { color: var(--gh); }
.hcx-grp-n { color: var(--x-faint); font-weight: 600; letter-spacing: .04em; }
.hcx-grp-list { display: grid; grid-template-columns: 1fr; }
.hcx-grp-list.two { grid-template-columns: 1fr 1fr; column-gap: 1.5rem; }

[data-ig="measure"] { --gh: var(--x-measure); }
[data-ig="fuel"]    { --gh: var(--x-fuel); }
[data-ig="move"]    { --gh: var(--x-move); }
[data-ig="mind"]    { --gh: var(--x-mind); }

.hcx-g {
  display: flex; align-items: flex-start; gap: .7rem;
  min-height: 44px; padding: .6rem .55rem; margin: 0 -.55rem; border-radius: 10px;
  text-decoration: none; color: #fff;
  transition: background-color .2s var(--x-ease);
}
.hcx-g:hover { background: rgba(255,255,255,.055); }
.hcx-g .hcx-ic { color: var(--gh); margin-top: 1px; }
.hcx-g-tx { display: flex; flex-direction: column; gap: .28rem; min-width: 0; }
.hcx-g-nm { font-size: .9rem; font-weight: 600; line-height: 1.25; }
.hcx-g.on .hcx-g-nm { color: var(--x-teal); }
.hcx-g.on .hcx-g-nm::after { content: "You are here"; margin-left: .5rem; font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--x-faint); }
.hcx-g-sub { font-size: .76rem; line-height: 1.45; color: var(--x-dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.hcx-bars { display: inline-flex; gap: 2px; margin-right: .45rem; vertical-align: 1px; }
.hcx-bars i { display: inline-block; width: 4px; height: 9px; border-radius: 1px; background: rgba(255,255,255,.2); }
.hcx-bars i.on { background: var(--x-teal); }
.hcx-bars[data-tier="debated"] i { background: rgba(255,200,87,.35); }

.hcx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* tools grid: hairline 4-col */
.hcx-tgrid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border-top: 1px solid var(--x-line); border-left: 1px solid var(--x-line); }
.hcx-t {
  display: flex; flex-direction: column; gap: .45rem; padding: 1rem;
  border-right: 1px solid var(--x-line); border-bottom: 1px solid var(--x-line);
  text-decoration: none; color: #fff; min-height: 44px;
  transition: background-color .2s var(--x-ease);
}
.hcx-t:hover { background: rgba(255,255,255,.05); }
.hcx-t-top { display: flex; align-items: center; justify-content: space-between; color: var(--x-teal); }
.hcx-t-tag { font-size: .62rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--x-faint); }
.hcx-t-nm { font-size: .9rem; font-weight: 600; }
.hcx-t-ds { font-size: .76rem; line-height: 1.45; color: var(--x-dim); }

/* "Start here" rail */
.hcx-rail { display: flex; flex-direction: column; gap: .75rem; padding-left: 2rem; border-left: 1px solid var(--x-line); }
.hcx-lab { font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--x-faint); padding-bottom: .1rem; }
.hcx-fc {
  position: relative; display: flex; flex-direction: column; gap: .4rem;
  padding: 1rem 1.1rem 1.1rem; border-radius: 14px; text-decoration: none; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--fa) 14%, transparent), rgba(255,255,255,.02) 70%);
  border: 1px solid color-mix(in srgb, var(--fa) 30%, transparent);
  transition: transform .25s var(--x-ease), border-color .25s var(--x-ease);
}
.hcx-fc:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--fa) 60%, transparent); }
.hcx-fc-k { display: inline-flex; align-items: center; gap: .4rem; color: var(--fa); font-size: .66rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.hcx-fc-t { font-family: 'Fraunces', Georgia, serif; font-size: 1.3rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.hcx-fc-p { font-size: .78rem; line-height: 1.5; color: var(--x-dim); padding-right: 1.4rem; }
.hcx-fc-go { position: absolute; right: 1rem; bottom: .9rem; color: var(--fa); font-size: 1rem; transition: transform .25s var(--x-ease); }
.hcx-fc:hover .hcx-fc-go { transform: translateX(3px); }

.hcx-pfoot { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; padding-top: .9rem; border-top: 1px solid var(--x-line); }
.hcx-plink {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 44px;
  color: var(--x-dim); font: 500 .82rem/1 'Inter', system-ui, sans-serif; text-decoration: none;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.hcx-plink .hcx-ic { color: var(--x-teal); }
.hcx-plink:hover { color: #fff; }

.hcx-scrim {
  position: fixed; left: 0; right: 0; bottom: 0; top: var(--x-h); z-index: 8995;
  background: rgba(3,8,18,.55); opacity: 0; pointer-events: none;
  transition: opacity .22s var(--x-ease);
}
.hcx-scrim.is-on { opacity: 1; pointer-events: auto; }

/* ---------- search palette --------------------------------------- */
.hcx-search {
  position: fixed; inset: 0; z-index: 9050;
  background: rgba(3,8,18,.62);
  display: flex; justify-content: center; align-items: flex-start;
  padding: 10vh 1rem 1rem;
  opacity: 0; transition: opacity .2s var(--x-ease);
  font-family: 'Inter', system-ui, sans-serif;
}
.hcx-search.is-open { opacity: 1; }
.hcx-search[hidden] { display: none; }
.hcx-sbox {
  width: 100%; max-width: 680px; max-height: 76vh; display: flex; flex-direction: column;
  background: var(--x-panel); border: 1px solid var(--x-line-2); border-radius: 16px;
  box-shadow: 0 40px 90px -20px rgba(0,0,0,.75); overflow: hidden;
  transform: translateY(-8px) scale(.99); transition: transform .22s var(--x-ease);
}
.hcx-search.is-open .hcx-sbox { transform: none; }
.hcx-sfield { display: flex; align-items: center; gap: .75rem; padding: 0 .75rem 0 1.1rem; border-bottom: 2px solid var(--x-line); color: var(--x-teal); transition: border-color .2s var(--x-ease); }
.hcx-sin {
  flex: 1; min-height: 60px; background: none; border: 0; outline: none;
  color: #fff; font: 500 1.05rem/1 'Inter', system-ui, sans-serif;
}
/* The palette input is focused the whole time the dialog is open; the
   sitewide :focus-visible box (css/a11y.css, !important) would frame it
   permanently. Its focus indicator is the field's 2px teal underline. */
#hc-nav .hcx-sin:focus-visible { outline: none !important; }
#hc-nav .hcx-sin { background: transparent; border: 0; box-shadow: none; padding: 0; margin: 0; border-radius: 0; width: auto; height: auto; }
.hcx-sfield:focus-within { border-bottom-color: var(--x-teal); }
.hcx-sin::placeholder { color: var(--x-faint); }
.hcx-sin::-webkit-search-cancel-button { display: none; }
.hcx-sclose { min-width: 44px; min-height: 44px; background: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.hcx-slist { overflow-y: auto; overscroll-behavior: contain; padding: .5rem; }
.hcx-sgrp + .hcx-sgrp { margin-top: .35rem; }
.hcx-sgh { padding: .7rem .7rem .35rem; font-size: .66rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--x-faint); }
.hcx-sgh[data-ig] { color: var(--gh); }
.hcx-opt {
  display: flex; align-items: center; gap: .7rem; min-height: 44px; padding: 0 .7rem; border-radius: 9px;
  color: #fff; text-decoration: none; font-size: .9rem;
}
.hcx-opt .hcx-ic { color: var(--gh, var(--x-teal)); }
.hcx-opt-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hcx-opt mark { background: none; color: var(--x-teal); font-weight: 700; }
.hcx-opt:hover, .hcx-opt.is-act { background: rgba(0,180,162,.16); }
.hcx-opt.is-act { box-shadow: inset 2px 0 0 var(--x-teal); }
.hcx-opt .hcx-bars { margin: 0; }
.hcx-sempty { padding: 1.5rem 1rem; color: var(--x-dim); font-size: .88rem; line-height: 1.5; }
.hcx-sfoot { padding: .7rem 1.1rem; border-top: 1px solid var(--x-line); font-size: .72rem; color: var(--x-faint); }

/* ---------- mobile sheet ------------------------------------------ */
.hcx-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; top: var(--x-h); z-index: 9050;
  background: var(--x-bg); overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  transform: translateY(-12px); opacity: 0;
  transition: transform .26s var(--x-ease), opacity .26s var(--x-ease);
  font-family: 'Inter', system-ui, sans-serif;
}
.hcx-sheet.is-open { transform: none; opacity: 1; }
.hcx-sheet[hidden] { display: none; }
.hcx-sheet-in { max-width: 640px; margin: 0 auto; padding: 1rem 1rem 3rem; display: flex; flex-direction: column; gap: 1rem; }
.hcx-sfield-btn {
  display: flex; align-items: center; gap: .65rem; min-height: 50px; padding: 0 1rem;
  background: rgba(255,255,255,.05); border: 1px solid var(--x-line-2); border-radius: 12px;
  color: var(--x-dim); font: 500 .95rem/1 'Inter', system-ui, sans-serif; cursor: pointer; text-align: left;
}
.hcx-sfield-btn .hcx-ic { color: var(--x-teal); }
.hcx-mflags { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.hcx-mflags.one { grid-template-columns: 1fr; }
.hcx-mflags .hcx-fc { padding: .9rem; }
.hcx-mflags .hcx-fc-t { font-size: 1.1rem; }
.hcx-mflags .hcx-fc-p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; padding-right: 0; font-size: .74rem; }
.hcx-mflags .hcx-fc-go { display: none; }
.hcx-seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; gap: 4px; background: rgba(255,255,255,.05); border: 1px solid var(--x-line); border-radius: 12px; }
.hcx-segb {
  min-height: 44px; border: 0; border-radius: 9px; cursor: pointer; background: none;
  color: var(--x-dim); font: 600 .88rem/1 'Inter', system-ui, sans-serif;
  transition: background-color .2s var(--x-ease), color .2s var(--x-ease);
}
.hcx-segb[aria-pressed="true"] { background: rgba(0,180,162,.22); color: #fff; }
.hcx-mlist[hidden] { display: none; }
.hcx-mh { padding: 1.1rem .25rem .45rem; font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gh); }
.hcx-mlist > .hcx-mh:first-child { padding-top: .25rem; }
.hcx-mrow {
  display: flex; align-items: center; gap: .8rem; min-height: 50px; padding: 0 .35rem;
  border-bottom: 1px solid var(--x-line); color: #fff; text-decoration: none; font-size: .95rem;
}
.hcx-mrow .hcx-ic { color: var(--gh, var(--x-teal)); }
.hcx-mrow-t { flex: 1; }
.hcx-mrow.on .hcx-mrow-t { color: var(--x-teal); font-weight: 600; }
.hcx-chev { color: var(--x-faint); font-size: 1.2rem; }
.hcx-mfoot .hcx-pfoot { flex-direction: column; align-items: flex-start; gap: 0; }
.hcx-mtheme { margin-top: 0; }

/* ---------- focus ------------------------------------------------- */
.hcx-brand:focus-visible, .hcx-tab:focus-visible, .hcx-link:focus-visible, .hcx-flag:focus-visible,
.hcx-sbtn:focus-visible, .hcx-ibtn:focus-visible, .hcx-g:focus-visible, .hcx-t:focus-visible,
.hcx-fc:focus-visible, .hcx-plink:focus-visible, .hcx-all:focus-visible, .hcx-opt:focus-visible,
.hcx-sclose:focus-visible, .hcx-sfield-btn:focus-visible, .hcx-segb:focus-visible, .hcx-mrow:focus-visible {
  outline: 3px solid var(--x-teal); outline-offset: 2px; box-shadow: 0 0 0 5px rgba(255,255,255,.18);
}

/* ---------- responsive -------------------------------------------- */
@media (max-width: 1180px) {
  .hcx-acts .hcx-link { display: none; }           /* Methodology -> panel footers */
  .hcx-sbtn { min-width: 0; }
  .hcx-sbtn .hcx-sb-t { display: none; }
  .hcx-pin { grid-template-columns: minmax(0,1fr) 250px; gap: 1.75rem; }
  .hcx-rail { padding-left: 1.5rem; }
  .hcx-ggrid { grid-template-columns: 1fr 1fr; gap: 1.5rem 1.75rem; }
  .hcx-gcol.wide { grid-column: 1 / -1; }
  .hcx-tgrid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 1024px) {
  .hcx-bar .hcbsub { display: none; }
  .hcx-tab, .hcx-flag { padding: 0 .6rem; }
}
@media (max-width: 860px) {
  .hcx-links, .hcx-acts .hcx-sbtn, .hcx-acts .hcx-link { display: none; }
  .hcx-mob { display: flex; }
  .hcx-acts { display: none; }                     /* theme lives in the sheet footer */
  .hcx-flex { display: none; }
  .hcx-bar { padding: 0 .75rem 0 1rem; }
  .hcx .hcbsub { display: block; }
  .hcx-panel, .hcx-scrim { display: none !important; }
  .hcx-search { padding: 0; align-items: stretch; }
  .hcx-sbox { max-width: none; max-height: none; border-radius: 0; border: 0; }
}
@media (max-width: 400px) {
  .hcx .hcbsub { display: none; }
}

/* ---------- reduced motion: no transforms, instant ---------------- */
@media (prefers-reduced-motion: reduce) {
  .hcx-panel, .hcx-sheet, .hcx-search, .hcx-sbox, .hcx-scrim, .hcx-fc, .hcx-car, .hcx-fc-go,
  .hcx-tab, .hcx-link, .hcx-flag, .hcx-sbtn, .hcx-g, .hcx-t { transition: none !important; transform: none !important; }
}

@media print { #hc-nav { display: none !important; } }
