/* Which Metrics Get You Hired — the portfolio metric scale, Golden Hour.
   Scoped under .ms. One selected metric drives a detail panel. Two presentations
   of that selection, switched by container width:

     • Wide  — a decorative SVG value-scale (aria-hidden): a warm gradient axis
       line with an arrowhead, a tick + angled label + dot per metric, and
       "Low value → High value" poles. A transparent-button layer over the dots
       is the real radiogroup, positioned by the same viewBox percentages.
     • Narrow — the scale hides; a vertical list radiogroup (low → high) takes over.

   Only one presentation is in the accessibility tree at a time. Selection wiring
   (roving tabindex, arrow keys, aria-checked, ?metric= sync) lives in
   res-metrics.js. All detail panels render server-side for SEO + a no-JS fallback.

   Golden Hour rules: honey/--teal is STRUCTURAL only (axis, ticks, dots, arcs,
   chart strokes) — never text; --clay is the text-safe interactive accent;
   --brick is secondary emphasis; --amber is fill/reward. No emoji. */

.ms {
  --ms-pad: clamp(20px, 2.5vw, 32px);
  container-type: inline-size;
  container-name: ms;
}

/* The instrument reads as one object — a bordered card holding the scale (or
   list), then the detail region. Mirrors the Levels board chrome. */
.ms-card {
  margin-top: clamp(30px, 5vw, 44px);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  overflow: hidden;
}

/* ─── Wide: the value scale ─────────────────────────────────────────────── */

.ms-graph-wrap { padding: var(--ms-pad); }

.ms-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
/* Right-edge fade when the scale is wider than its column. */
.ms-scroll::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 40px;
  background: linear-gradient(to left, var(--card), transparent);
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
}

.ms-graph { position: relative; min-width: 760px; }

.ms-svg { display: block; width: 100%; height: auto; }

/* The axis value gradient runs across the warm ramp: muted → honey → clay. */
.ms-grad-0 { stop-color: var(--muted); }
.ms-grad-1 { stop-color: var(--honey); }
.ms-grad-2 { stop-color: var(--clay); }

.ms-track { stroke: url(#ms-grad); stroke-width: 3; stroke-linecap: round; }
.ms-arrow { fill: var(--clay); }
.ms-endcap { stroke: var(--muted); stroke-width: 1.5; }
.ms-tick { stroke: color-mix(in srgb, var(--honey) 45%, transparent); stroke-width: 1; }

.ms-pole {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  fill: var(--muted);
}

.ms-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 400;
  fill: var(--muted);
  cursor: pointer;
}
/* The label is a mouse shortcut for its dot — underline on hover so it reads as
   interactive. The dot itself carries a hover ring on the button overlay. */
.ms-node[data-selected="false"]:hover .ms-label {
  fill: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Resting dot: honey, structural. Selected: clay dot + halo + lifted label. */
.ms-dot {
  fill: var(--honey);
  stroke: var(--card);
  stroke-width: 2;
  transition: r 120ms ease;
}
.ms-halo { fill: color-mix(in srgb, var(--clay) 16%, transparent); display: none; }
.ms-node[data-selected="true"] .ms-halo { display: block; }
.ms-node[data-selected="true"] .ms-dot {
  r: 6.5;
  fill: var(--clay);
  stroke: var(--clay);
  stroke-width: 3;
  stroke-opacity: 0.3;
}
.ms-node[data-selected="true"] .ms-label {
  fill: var(--clay);
  font-weight: 600;
}

/* ─── The interactive overlay (the real radiogroup) ─────────────────────── */

.ms-hit-layer {
  position: absolute;
  inset: 0;
  pointer-events: none; /* only the buttons take events */
}
.ms-hit {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
}
.ms-hit::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 22px; height: 22px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color 120ms ease;
}
.ms-hit:hover::after { border-color: color-mix(in srgb, var(--clay) 50%, transparent); }
.ms-hit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--clay);
}

/* ─── Narrow: vertical list ─────────────────────────────────────────────── */

.ms-list { display: none; flex-direction: column; }
.ms-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 12px var(--ms-pad);
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--hair);
  cursor: pointer;
  font-family: var(--font-display);
}
.ms-row:last-child { border-bottom: 0; }
.ms-row-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--honey); }
.ms-row-name { flex: 1; font-size: 15px; font-weight: 400; color: var(--ink); }
.ms-row-zone {
  flex: none;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.ms-row[aria-checked="true"] { background: color-mix(in srgb, var(--clay) 8%, transparent); }
.ms-row[aria-checked="true"] .ms-row-dot { background: var(--clay); }
.ms-row[aria-checked="true"] .ms-row-name { color: var(--clay); font-weight: 500; }
.ms-row:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--card), inset 0 0 0 4px var(--clay);
}

/* Show the scroll fade once the column is narrow enough to clip the scale. */
@container ms (max-width: 900px) {
  .ms-scroll::after { opacity: 1; }
}
/* Below 640 the scale can't stay legible; the vertical list takes over. */
@container ms (max-width: 640px) {
  .ms-graph-wrap { display: none; }
  .ms-list { display: flex; }
}

/* ─── Detail region ─────────────────────────────────────────────────────── */

.ms-detail {
  padding: var(--ms-pad);
  border-top: 1px solid var(--border);
  container-type: inline-size;
  container-name: ms-panel;
}

.ms-panel { display: none; }
.ms-panel[data-active="true"] {
  display: block;
  animation: ms-panel-in 200ms ease;
}
@keyframes ms-panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ms-panel[data-active="true"] { animation: none; }
}

.ms-panel-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 20px;
}
.ms-panel-title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(24px, 2.4vw, 32px);
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
}

.ms-zone-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.ms-zone-chip[data-zone="vanity"] {
  color: var(--muted);
  background: var(--paper-2);
  border-color: var(--border);
}
.ms-zone-chip[data-zone="context"] {
  color: var(--clay);
  background: var(--label);
  border-color: color-mix(in srgb, var(--honey) 40%, transparent);
}
.ms-zone-chip[data-zone="actionable"] {
  color: var(--brick);
  background: color-mix(in srgb, var(--amber) 22%, transparent);
  border-color: color-mix(in srgb, var(--amber) 60%, transparent);
}

/* What + How stack in a left column; Why gets the wider right column, because
   it's the richest content on the page. */
.ms-facts {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  grid-template-areas: "what why" "how why";
  gap: clamp(18px, 2.4vw, 26px) clamp(24px, 3vw, 44px);
  margin: 0;
}
.fact-what { grid-area: what; min-width: 0; }
.fact-how { grid-area: how; min-width: 0; }
.fact-why { grid-area: why; min-width: 0; }

.ms-facts dt {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--clay);
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--hair);
}
.ms-facts dd {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
}

@container ms-panel (max-width: 620px) {
  .ms-facts {
    grid-template-columns: 1fr;
    grid-template-areas: "what" "how" "why";
  }
}

/* ─── "What a strong version looks like" — chart + example + framing ─────── */

.ms-example {
  margin-top: clamp(20px, 2.4vw, 28px);
  padding-top: 20px;
  border-top: 1px solid var(--hair);
  display: grid;
  grid-template-columns: 172px 1fr;
  gap: clamp(18px, 2.6vw, 32px);
  align-items: center;
}
/* The mini chart sits on a faint warm card so it reads as a figure. */
.ms-viz {
  background: color-mix(in srgb, var(--honey) 5%, var(--card));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 8px;
}

.ms-example-figure {
  margin: 0 0 14px;
  font-family: var(--font-serif);
  font-size: clamp(17px, 1.9vw, 21px);
  line-height: 1.35;
  color: var(--ink);
}

.ms-framing { display: flex; flex-direction: column; gap: 8px; }
.framing-weak, .framing-strong {
  margin: 0;
  display: flex;
  gap: 9px;
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.5;
}
.framing-weak > span:first-child, .framing-strong > span:first-child {
  flex: none;
  font-weight: 700;
}
.framing-weak { color: var(--muted); }
.framing-weak > span:first-child { color: var(--brick); }
.framing-strong { color: var(--ink); }
.framing-strong > span:first-child { color: var(--clay); }
.framing-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-right: 6px;
}
.framing-weak .framing-tag { color: var(--brick); }
.framing-strong .framing-tag { color: var(--clay); }

/* ── Mini-chart marks — structural honey fills; ink numbers; muted labels. ── */
.viz-svg { display: block; width: 100%; height: auto; }

.viz-bar-before { fill: color-mix(in srgb, var(--muted) 32%, var(--paper-2)); }
.viz-bar-after { fill: var(--honey); }
.viz-bar-val {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500; fill: var(--ink);
}
.viz-bar-lbl {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 0.06em;
  text-transform: uppercase; fill: var(--muted);
}

.viz-gauge-track { fill: none; stroke: color-mix(in srgb, var(--ink) 12%, transparent); stroke-width: 10; stroke-linecap: round; }
.viz-gauge-fill { fill: none; stroke: var(--honey); stroke-width: 10; stroke-linecap: round; }
.viz-gauge-value {
  font-family: var(--font-mono);
  font-size: 22px; fill: var(--ink);
}
.viz-gauge-unit {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 0.06em;
  text-transform: uppercase; fill: var(--muted);
}

.viz-axis { stroke: var(--border); stroke-width: 1; }
.viz-curve-before { fill: none; stroke: color-mix(in srgb, var(--muted) 40%, var(--paper-2)); stroke-width: 2; }
.viz-curve-after { fill: none; stroke: var(--honey); stroke-width: 2; }

.viz-stat { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 10px 4px; }
.viz-stat-value {
  font-family: var(--font-mono);
  font-size: clamp(24px, 3vw, 32px); line-height: 1.1; color: var(--ink);
}
.viz-stat-caption {
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
}

@container ms-panel (max-width: 560px) {
  .ms-example { grid-template-columns: 1fr; }
  .ms-viz { max-width: 200px; }
}

/* ─── Closing coda ──────────────────────────────────────────────────────── */

.ms-coda {
  max-width: 66ch;
  margin-top: clamp(28px, 3vw, 44px);
  padding-top: clamp(20px, 2.4vw, 30px);
  border-top: 1px solid var(--hair);
}
.ms-coda p {
  margin: 0 0 14px;
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
}
.ms-coda p:last-child { margin-bottom: 0; }
.ms-coda em { font-style: italic; }
.ms-coda strong { font-weight: 700; color: var(--clay); }

@media (max-width: 640px) {
  .ms-card { border-radius: 14px; }
}
