/* =========================================================================
   Residence Health and Organization Health showcases (November 2026).
   Built by dev-tools/site/health.mjs, driven by assets/js/cco-health.js.
   A compact summary card beside a larger trend panel on one navy stage that
   continues the site's square grid. Fictional demonstration data only.
   ========================================================================= */
.hx {
  --hx-text: #EEF2F8;
  --hx-muted: #A9B6CB;
  --hx-faint: #8494AF;
  --hx-line: rgba(160,190,230,.12);
  --hx-surface: linear-gradient(170deg, rgba(27,50,88,.96) 0%, rgba(18,36,66,.97) 100%);
  --hx-gold: #D9BE80;
  --hx-ease: cubic-bezier(.22,.61,.36,1);
  --hx-r: 14px;
  position: relative;
  padding: clamp(14px, 2vw, 22px);
  border-radius: 20px;
  border: 1px solid rgba(200,161,74,.22);
  background:
    linear-gradient(90deg, var(--grid-line, rgba(134,168,214,.05)) var(--grid-weight, 1px), transparent var(--grid-weight, 1px)) 0 0 / var(--grid-size, 80px) var(--grid-size, 80px),
    linear-gradient(180deg, var(--grid-line, rgba(134,168,214,.05)) var(--grid-weight, 1px), transparent var(--grid-weight, 1px)) 0 0 / var(--grid-size, 80px) var(--grid-size, 80px),
    radial-gradient(110% 80% at 0% 0%, rgba(200,161,74,.06), transparent 55%),
    linear-gradient(165deg, #12274A 0%, #0D1E3A 60%, #0A1830 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 24px 48px -30px rgba(3,9,22,.55), 0 2px 4px rgba(3,9,22,.12);
  font-family: var(--sans);
  color: var(--hx-text);
  text-align: left;
}
.hx p { margin: 0; }
.hx button { font: inherit; margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hx :focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.hx__grid { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: clamp(12px, 1.6vw, 18px); align-items: stretch; }

/* ---------- Summary card ---------- */
.hx-card {
  position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 0;
  min-width: 0; padding: 22px 22px 18px; border-radius: var(--hx-r);
  border: 1px solid rgba(160,190,230,.14); background: var(--hx-surface); color: inherit; text-align: left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
  transition: border-color .35s var(--hx-ease), box-shadow .35s var(--hx-ease), transform .35s var(--hx-ease);
}
.hx-card:hover { border-color: rgba(200,161,74,.42); }
.hx[data-state="detail"] .hx-card { border-color: rgba(200,161,74,.55); box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 0 0 1px rgba(200,161,74,.12); }
/* The connector: a fine gold rule from the card into the panel. */
.hx-card::after { content: ""; position: absolute; top: 50%; right: -19px; width: 18px; height: 1px; background: linear-gradient(90deg, rgba(200,161,74,.0), rgba(200,161,74,.55)); opacity: .45; transition: opacity .35s var(--hx-ease); }
.hx[data-state="detail"] .hx-card::after { opacity: 1; }
.hx-card__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hx-kicker { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-light); }
.hx-chip { padding: 2px 8px; border: 1px solid rgba(160,190,230,.2); border-radius: 999px; font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--hx-muted); white-space: nowrap; }
.hx-card__name { margin-top: 10px; font-size: 14px; color: var(--hx-muted); }
.hx-score { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.hx-score__v { font-family: var(--serif); font-size: clamp(52px, 5vw, 64px); font-weight: 600; line-height: 1; color: #fff; font-variant-numeric: lining-nums tabular-nums; }
.hx-score__of { font-size: 18px; font-weight: 600; color: var(--hx-muted); }
.hx-class { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 15px; font-weight: 600; color: #DCE6F4; }
.hx-class__dot { width: 7px; height: 7px; border-radius: 50%; background: #77DEBF; box-shadow: 0 0 0 3px rgba(119,222,191,.14); }
.hx-spark { display: block; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--hx-line); }
.hx-spark__l { display: block; margin-bottom: 8px; font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--hx-faint); }
.hx-spark__svg { display: block; width: 100%; height: 44px; overflow: visible; }
.hx-spark__line { fill: none; stroke: #9EC4F6; stroke-width: 1.8; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.hx-spark__area { fill: rgba(158,196,246,.1); }
.hx-card__cta { display: inline-flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 18px; font-size: 14px; font-weight: 600; color: var(--gold-light); }
.hx-card__arrow { transition: transform .3s var(--hx-ease); }
.hx-card:hover .hx-card__arrow { transform: translateX(3px); }
.hx[data-state="detail"] .hx-card__arrow { transform: rotate(0deg); }

/* ---------- Trend panel ---------- */
.hx-panel { position: relative; min-width: 0; border-radius: var(--hx-r); border: 1px solid rgba(160,190,230,.12); background: var(--hx-surface); box-shadow: inset 0 1px 0 rgba(255,255,255,.04); overflow: hidden; }
.hx-panel__body { display: flex; flex-direction: column; height: 100%; padding: 20px 22px 16px; transition: opacity .4s var(--hx-ease), filter .4s var(--hx-ease); }
.hx-panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; }
.hx-panel__heading { min-width: 0; }
.hx-panel__title { font-family: var(--serif); font-size: clamp(21px, 1.8vw, 25px); font-weight: 600; line-height: 1.15; color: #fff; }
.hx-panel__sub { margin-top: 4px !important; font-size: 13px; line-height: 1.45; color: var(--hx-muted); }
.hx-panel__sub [data-hx-range] { font-variant-numeric: tabular-nums; white-space: nowrap; }

.hx-seg { display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 3px; border-radius: 10px; border: 1px solid rgba(160,190,230,.14); background: rgba(5,12,26,.4); }
.hx-seg__b { min-height: 36px; padding: 0 13px; border: 0; border-radius: 7px; background: transparent; color: var(--hx-muted); font-size: 13px !important; font-weight: 600 !important; white-space: nowrap; transition: color .3s var(--hx-ease), background-color .3s var(--hx-ease), box-shadow .3s var(--hx-ease); }
.hx-seg__b:hover { color: #fff; background: rgba(255,255,255,.05); }
.hx-seg__b[aria-pressed="true"] { color: #F4E6C4; background: linear-gradient(180deg, rgba(200,161,74,.24), rgba(200,161,74,.12)); box-shadow: inset 0 0 0 1px rgba(200,161,74,.45); }

.hx-chart { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) 34px; column-gap: 10px; margin-top: 18px; flex: 1 1 auto; }
.hx-chart__y { position: relative; grid-column: 1; }
.hx-chart__y span { position: absolute; right: 0; top: var(--y); transform: translateY(-50%); font-size: 12px; color: var(--hx-faint); font-variant-numeric: tabular-nums; }
.hx-chart__plot { position: relative; grid-column: 2; height: clamp(190px, 20vw, 250px); touch-action: pan-y; cursor: crosshair; border-radius: 4px; }
.hx-chart__plot svg { display: block; width: 100%; height: 100%; overflow: hidden; }
.hx-grid { stroke: rgba(160,190,230,.1); stroke-width: 1; stroke-dasharray: 2 5; vector-effect: non-scaling-stroke; }
.hx-grid--base { stroke: rgba(160,190,230,.22); stroke-dasharray: none; }
.hx-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.hx-line--dash { stroke-dasharray: 6 5; stroke-width: 2.2; }
.hx--single .hx-line { stroke-width: 2.6; }
.hx-end { position: absolute; left: 100%; top: var(--y); width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; background: var(--c); pointer-events: none; }
.hx-end--circle { border-radius: 50%; }
.hx-end--square { border-radius: 1.5px; }
.hx-end--diamond { transform: rotate(45deg) scale(.85); }
.hx-end--triangle { clip-path: polygon(50% 0, 100% 100%, 0 100%); width: 11px; height: 10px; margin: -5px 0 0 -5.5px; }
.hx-end--dash { width: 10px; height: 3px; margin: -1.5px 0 0 -5px; border-radius: 2px; }
.hx--single .hx-end { width: 12px; height: 12px; margin: -6px 0 0 -6px; border: 2px solid #0F2140; box-shadow: 0 0 0 3px rgba(158,196,246,.18); }
.hx-val { position: absolute; left: calc(100% + 12px); top: var(--y); transform: translateY(-50%); font-size: 12.5px; font-weight: 700; color: var(--c); font-variant-numeric: tabular-nums; pointer-events: none; transition: opacity .3s var(--hx-ease); }
.hx-val--badge { left: auto; right: 0; top: calc(var(--y) - 20px); transform: translate(0, -100%); padding: 3px 8px; border-radius: 6px; background: #9EC4F6; color: #0E1F3A; font-size: 13px; }
.hx--single .hx-chart { grid-template-columns: 28px minmax(0, 1fr) 6px; }

.hx-cursor { position: absolute; top: 0; bottom: 0; left: var(--x, 0); width: 1px; background: linear-gradient(180deg, rgba(226,199,136,.55), rgba(226,199,136,.08)); opacity: 0; pointer-events: none; transition: opacity .2s var(--hx-ease); }
.hx-cursor i { position: absolute; left: 0; top: var(--y, 0); width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--c); border: 2px solid #0F2140; }
.hx-tip { position: absolute; top: 6px; left: var(--x, 0); z-index: 2; display: grid; gap: 4px; min-width: 150px; padding: 10px 12px; border-radius: 10px; background: rgba(247,243,234,.97); color: #0E1F3A; box-shadow: 0 14px 30px -12px rgba(0,0,0,.6); opacity: 0; pointer-events: none; transform: translateX(var(--tx, -50%)); transition: opacity .2s var(--hx-ease); white-space: nowrap; }
.hx-tip.is-low { top: auto; bottom: 6px; }
.hx-tip__d { font-size: 12px; font-weight: 600; color: #5E6878; }
.hx-tip__r { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 12.5px; }
.hx-tip__k { display: inline-flex; align-items: center; gap: 7px; }
.hx-tip__k svg { width: 10px; height: 10px; flex: 0 0 auto; }
.hx-tip__k svg[viewBox="0 0 16 10"] { width: 14px; }
.hx-tip__r b { font-size: 14px; font-variant-numeric: tabular-nums; }
.hx-tip svg [fill="#AEE4EE"], .hx-tip svg[fill="#AEE4EE"] { fill: #4A9BB0; }
.hx-tip svg path[stroke="#AEE4EE"] { stroke: #4A9BB0; }
.hx-tip svg[fill="#F7CE64"] { fill: #C99A1E; }
.hx-tip svg[fill="#77DEBF"] { fill: #2FA582; }
.hx-chart__plot.is-probing .hx-tip, .hx-chart__plot.is-probing .hx-cursor { opacity: 1; }

.hx-chart__x { position: relative; grid-column: 2; height: 18px; margin-top: 10px; font-size: 12px; color: var(--hx-faint); font-variant-numeric: tabular-nums; transition: opacity .18s var(--hx-ease); }
.hx-chart__x span { position: absolute; left: var(--x, 0); transform: translateX(-50%); white-space: nowrap; }
.hx-chart__x span:first-child { transform: none; }
.hx-chart__x span:last-child { transform: translateX(-100%); }
.hx-chart__x.is-swapping { opacity: 0; }

.hx-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: #C9D3E2; }
.hx-legend li { display: inline-flex; align-items: center; gap: 7px; }
.hx-legend svg { width: 10px; height: 10px; flex: 0 0 auto; }
.hx-legend svg[viewBox="0 0 16 10"] { width: 16px; }

.hx-panel__foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 18px; margin-top: auto; padding-top: 14px; }
.hx-note { flex: 1 1 260px; font-size: 11.5px; line-height: 1.5; color: rgba(226,199,136,.82); }
.hx-back { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid rgba(160,190,230,.18); border-radius: 8px; background: transparent; color: var(--hx-muted); font-size: 13px !important; font-weight: 600 !important; transition: color .25s var(--hx-ease), border-color .25s var(--hx-ease); }
.hx-back:hover { color: #fff; border-color: rgba(200,161,74,.45); }

/* Summary state: the panel is a quiet preview behind a single invitation. */
.hx-veil { display: none; }
.hx.is-ready .hx-veil {
  position: absolute; inset: 0; z-index: 3; display: flex; align-items: flex-end; justify-content: center; padding: 0 0 26px;
  border: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(13,30,58,.05) 0%, rgba(13,30,58,.35) 45%, rgba(13,30,58,.88) 100%);
  color: inherit; opacity: 1; transition: opacity .4s var(--hx-ease), visibility 0s linear 0s;
}
.hx-veil__b { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid rgba(200,161,74,.5); background: rgba(10,24,48,.85); color: var(--gold-light); font-size: 14px; font-weight: 600; box-shadow: 0 10px 24px -14px rgba(0,0,0,.8); transition: background-color .25s var(--hx-ease), border-color .25s var(--hx-ease); }
.hx-veil:hover .hx-veil__b { background: rgba(200,161,74,.16); border-color: rgba(200,161,74,.8); }
.hx.is-ready[data-state="summary"] .hx-panel__body { opacity: .5; }
.hx.is-ready[data-state="summary"] .hx-seg, .hx.is-ready[data-state="summary"] .hx-back { visibility: hidden; }
.hx.is-ready[data-state="detail"] .hx-veil { opacity: 0; visibility: hidden; transition: opacity .4s var(--hx-ease), visibility 0s linear .4s; }

/* ---------- Tablet and mobile: stacked, the chart expands below the card ---------- */
@media (max-width: 960px) {
  .hx__grid { grid-template-columns: minmax(0, 1fr); }
  .hx-card::after { display: none; }
  .hx-spark__svg { height: 40px; }
}
@media (max-width: 760px) {
  .hx { padding: 12px; border-radius: 16px; }
  .hx-card { padding: 18px; }
  .hx.is-ready[data-state="summary"] .hx-panel { display: none; }
  .hx.is-ready .hx-veil { display: none; }
  .hx.is-ready[data-state="detail"] .hx-panel { animation: hx-expand .4s var(--hx-ease) both; }
  .hx-panel__body { padding: 16px 14px 14px; }
  .hx-seg { width: 100%; grid-auto-columns: 1fr; }
  .hx-seg__b { min-height: 40px; padding: 0 6px; }
  .hx-chart { grid-template-columns: 24px minmax(0, 1fr) 26px; column-gap: 6px; }
  .hx--single .hx-chart { grid-template-columns: 24px minmax(0, 1fr) 6px; }
  .hx-chart__plot { height: 190px; }
  .hx-chart__x span:nth-child(2), .hx-chart__x span:nth-child(4) { display: none; }
  .hx-val { left: calc(100% + 8px); font-size: 11.5px; }
  .hx-val--badge { left: auto; }
  .hx-legend { gap: 6px 14px; font-size: 12px; }
  .hx-back { width: 100%; justify-content: center; min-height: 44px; }
}
@keyframes hx-expand { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .hx *, .hx *::before, .hx *::after { animation: none !important; transition: none !important; }
}

/* ---------- Placement: platform hub panels and the Residential Care page ---------- */
.hub-feature { display: grid; gap: 16px; }
.hub-support { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px 24px; padding: 16px 20px; border: 1px solid var(--line, rgba(14,31,58,.12)); border-radius: 14px; background: #fff; }
.hub-support__t { margin: 0 0 4px; font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-ink); }
.hub-support__list { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 8px 0 0; padding: 0; list-style: none; }
.hub-support__list li { padding: 4px 10px; border-radius: 999px; background: rgba(14,31,58,.05); font-size: 13px; color: #33405A; }
.hub-support p { margin: 0; font-size: 15px; line-height: 1.5; color: #46526A; }
.hub-support__open { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 14px 6px 6px; border: 1px solid rgba(14,31,58,.14); border-radius: 10px; background: #F7F4EC; color: var(--navy, #0E1F3A); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: border-color .25s, background-color .25s; }
.hub-support__open:hover { border-color: var(--gold); background: #fff; }
.hub-support__open img { width: 92px; height: 56px; object-fit: cover; object-position: 0 0; border-radius: 6px; border: 1px solid rgba(14,31,58,.12); }
@media (max-width: 760px) {
  .hub-support { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .hub-support__open { justify-self: start; }
}
.health-section .section-head { margin-bottom: clamp(24px, 3vw, 36px); }

/* Card facts, read from the same demonstration data as the chart. */
.hx-meta { display: grid; gap: 0; margin-top: 16px; }
.hx-meta__r { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid rgba(160,190,230,.08); font-size: 13px; color: var(--hx-muted); }
.hx-meta__r b { font-size: 14px; font-weight: 600; color: #E6ECF5; font-variant-numeric: tabular-nums; }
.hx-meta__r--note { font-size: 12px; color: var(--hx-faint); }
.hx-spark__svg { height: 52px; }
.hx-card__cta-hide { display: none; }
.hx[data-state="detail"] .hx-card__cta-open { display: none; }
.hx[data-state="detail"] .hx-card__cta-hide { display: inline; }
.hx[data-state="detail"] .hx-card__arrow { transform: rotate(180deg); }
.hx[data-state="detail"] .hx-card:hover .hx-card__arrow { transform: rotate(180deg) translateX(3px); }
@media (max-width: 760px) {
  .hx[data-state="detail"] .hx-card__arrow { transform: rotate(-90deg); }
  .hx[data-state="summary"] .hx-card__arrow { transform: rotate(90deg); }
}
.hx-kicker { letter-spacing: .13em; }
.hx-grid { stroke: rgba(160,190,230,.14); }
