/* ============================================================================
   Where the instrument is aimed — /aim
   2026 Indiana Workforce Summit, October 14. Invest Hamilton County with the
   Indiana Business Research Center.

   The occupational layer: every occupation Indiana's 584 traded-driver
   industries employ, with the state's two formal workforce instruments beside
   it. Separate surface from /web, which renders capabilities.

   Tokens only, from /styles/tokens.css. No hex outside that file.
   Built for a projector first and a phone second.
   ============================================================================ */

:root {
  /* Semantic layer the canvas reads. The script never names a brand colour, so
     a theme swap is pure CSS and the drawing code does not change. */
  --am-bg:          var(--color-bg);
  --am-ink:         var(--color-ink);
  --am-grid:        var(--color-border);
  --am-axis:        var(--color-muted);
  --am-halo:        var(--color-bg);
  --am-label:       var(--color-ink);
  --am-ghost:       0.13;
  --am-fill:        0.62;
  --am-ring:        var(--color-purple);
  /* The instrument ring is deliberately NOT a family colour. Drawn in purple it
     vanished against every production node, which is exactly the set the scene
     exists to separate. */
  --am-mark:        var(--color-ink);
  --am-focus:       var(--color-gold);

  /* Six families. Charcoal is reserved for chrome, never for an occupation. */
  --am-production:  var(--color-purple);
  --am-logistics:   var(--color-blue);
  --am-maintenance: var(--color-gold);
  --am-technical:   var(--color-green);
  --am-business:    var(--color-pink);
  --am-other:       var(--color-charcoal);

  /* The age scale. Deliberately one hue, light to dark, because red is an
     industry family here and green is another. A diverging red-green ramp
     would also invite "good" and "bad" readings of a share that is neither. */
  --am-age-low:     var(--color-purple-10);
  --am-age-mid:     var(--color-purple-33);
  --am-age-high:    var(--color-purple);
}

/* Stage theme for a dark ballroom. T toggles it. Light ships as the default:
   thin marks on a dark field turn to mud on a mediocre projector in a lit room.
   The hex values below are the only ones in this file and they are all token
   definitions inside a root block, never a colour written into a rule. They
   exist because the brand has no dark-surface ramp: a purple-tinted near-black
   and its greys have to be stated somewhere, and the same eight values already
   appear in web.html's stage block. If a dark ramp lands in tokens.css, these
   should point at it instead. */
:root[data-theme="stage"] {
  --am-bg:     var(--color-ink);
  --am-ink:    var(--color-bg);
  --am-grid:   #3a3a55;
  --am-axis:   #a9a9c2;
  --am-halo:   var(--color-ink);
  --am-label:  var(--color-bg);
  --am-ghost:  0.10;
  --am-fill:   0.72;
  --am-ring:   var(--color-gold);
  --am-mark:   var(--color-gold);
  --am-age-low:  #2e2b4d;
  --am-age-mid:  var(--color-purple-66);
  --am-age-high: var(--color-purple-33);
  --color-surface: #24243a;
  --color-surface-alt: #1f1f33;
  --color-border: #3a3a55;
  --color-border-strong: #4a4a68;
  --color-muted: #a9a9c2;
}

* { box-sizing: border-box; }
/* .am-group is a flex row, and display:flex beats the UA's [hidden] rule. The
   scene controls swap on the hidden attribute, so without this the reach
   controls sit in the bar during every other scene. */
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }

body.su-body {
  background: var(--am-bg);
  color: var(--am-ink);
  font-family: var(--font-body);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  overflow: hidden;
}

.su-skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--color-purple); color: #fff;
  padding: var(--sp-3) var(--sp-5); z-index: 100;
  font-family: var(--font-ui); font-weight: var(--fw-semibold);
  border-radius: 0 0 var(--radius) 0;
}
.su-skip:focus { left: 0; }
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
      overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------------------------------------------------------------- masthead */
.am-top {
  display: flex; align-items: baseline; gap: var(--sp-4); flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}
.am-brand { display: flex; align-items: baseline; gap: var(--sp-2); font-family: var(--font-ui); }
.am-brand [data-alex-brand-mark] {
  color: var(--color-purple); font-size: var(--fs-lg);
  font-weight: var(--fw-black); letter-spacing: var(--tracking-tight);
}
:root[data-theme="stage"] .am-brand [data-alex-brand-mark] { color: var(--color-purple-33); }
.am-brand [data-alex-brand-wording] {
  color: var(--color-muted); font-size: var(--fs-xs);
  font-weight: var(--fw-semibold); letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.am-kicker { margin: 0; color: var(--color-muted); font-family: var(--font-ui); font-size: var(--fs-xs); }
.am-sib { margin-left: auto; font-family: var(--font-ui); font-size: var(--fs-xs); }
.am-sib a { color: var(--color-purple); text-decoration: none; border-bottom: 1px solid transparent; }
:root[data-theme="stage"] .am-sib a { color: var(--color-gold); }
.am-sib a:hover, .am-sib a:focus-visible { border-bottom-color: currentColor; }

/* ------------------------------------------------------------------ the bar */
.am-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-5);
  padding: var(--sp-2) var(--sp-5);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  font-family: var(--font-ui); font-size: var(--fs-xs);
}
.am-group { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.am-group.am-right { margin-left: auto; }
.am-rail h2.am-listhead { font-size: var(--fs-base); margin-top: var(--sp-5); }
.am-group > .lab { color: var(--color-muted); font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide); text-transform: uppercase; font-size: var(--fs-2xs); }

.am-scene {
  border: 1px solid var(--color-border-strong); background: transparent;
  color: var(--am-ink); border-radius: 999px;
  padding: 4px 11px; font: var(--fw-semibold) var(--fs-xs)/1.2 var(--font-ui);
  cursor: pointer; transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.am-scene .n { color: var(--color-muted); margin-right: 5px; font-variant-numeric: tabular-nums; }
.am-scene[aria-pressed="true"] {
  background: var(--color-purple); border-color: var(--color-purple); color: #fff;
}
.am-scene[aria-pressed="true"] .n { color: var(--color-purple-33); }
:root[data-theme="stage"] .am-scene[aria-pressed="true"] {
  background: var(--color-gold); border-color: var(--color-gold); color: var(--color-ink);
}
:root[data-theme="stage"] .am-scene[aria-pressed="true"] .n { color: var(--color-ink); opacity: .6; }

.am-bar select, .am-bar input[type="range"] { font: var(--fs-xs) var(--font-ui); accent-color: var(--color-purple); }
.am-bar select {
  padding: 3px 7px; border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  background: var(--am-bg); color: var(--am-ink);
}
.am-btn {
  border: 1px solid var(--color-border-strong); background: var(--am-bg); color: var(--am-ink);
  border-radius: var(--radius-sm); padding: 4px 9px;
  font: var(--fw-semibold) var(--fs-xs) var(--font-ui); cursor: pointer;
}
.am-toggle { display: inline-flex; align-items: center; gap: 5px; color: var(--color-muted); cursor: pointer; }
.am-floor { display: inline-flex; align-items: center; gap: 6px; }
.am-floor output { font-variant-numeric: tabular-nums; font-weight: var(--fw-bold); color: var(--am-ink); min-width: 4ch; }

:where(button, select, input, a, .am-web):focus-visible {
  outline: 3px solid var(--am-focus); outline-offset: 2px;
}

/* ---------------------------------------------------------------- the stage */
.am-stage { display: grid; grid-template-columns: 1fr 336px; min-height: 0; }
.am-web { position: relative; min-height: 0; background: var(--am-bg); cursor: crosshair; }
.am-web canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.am-tip {
  position: absolute; pointer-events: none; z-index: 5; max-width: 268px;
  background: var(--am-bg); color: var(--am-ink);
  border: 1px solid var(--color-border-strong);
  border-left: 4px solid var(--tipc, var(--color-purple));
  padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm);
  font: var(--fs-sm)/1.4 var(--font-body);
  box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(4px);
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.am-tip.on { opacity: 1; transform: none; }
.am-tip b { display: block; font: var(--fw-bold) var(--fs-sm) var(--font-ui); margin-bottom: 3px; }
.am-tip dl { display: grid; grid-template-columns: auto 1fr; gap: 1px var(--sp-3); margin: var(--sp-2) 0 0; }
.am-tip dt { color: var(--color-muted); font: var(--fs-2xs) var(--font-ui); }
.am-tip dd { margin: 0; font: var(--fw-semibold) var(--fs-xs) var(--font-ui); font-variant-numeric: tabular-nums; }
.am-tip .note { display: block; margin-top: var(--sp-2); color: var(--color-muted);
  font: italic var(--fs-2xs)/1.35 var(--font-body); }

/* ------------------------------------------------------------------- the rail */
.am-rail {
  border-left: 1px solid var(--color-border);
  background: var(--color-surface);
  overflow-y: auto; padding: var(--sp-4) var(--sp-4) var(--sp-6);
  font-size: var(--fs-sm);
}
.am-rail h2 {
  font: var(--fw-bold) var(--fs-md)/1.25 var(--font-heading);
  margin: 0 0 var(--sp-2); letter-spacing: var(--tracking-tight);
}
.am-caption { margin: 0 0 var(--sp-4); color: var(--color-charcoal); font-size: var(--fs-sm); line-height: var(--lh-normal); }
:root[data-theme="stage"] .am-caption { color: var(--color-muted); }
.am-caption strong { color: var(--am-ink); font-weight: var(--fw-bold); }

.am-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); margin: 0 0 var(--sp-4); padding: 0; }
.am-stats div {
  background: var(--am-bg); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); padding: var(--sp-2) var(--sp-3);
}
.am-stats dt { color: var(--color-muted); font: var(--fw-semibold) var(--fs-2xs) var(--font-ui);
  letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.am-stats dd { margin: 2px 0 0; font: var(--fw-bold) var(--fs-lg)/1 var(--font-heading);
  font-variant-numeric: tabular-nums; letter-spacing: var(--tracking-tight); }
.am-stats dd small { display: block; font: var(--fw-regular) var(--fs-2xs)/1.3 var(--font-ui);
  color: var(--color-muted); margin-top: 3px; letter-spacing: 0; }

.am-legend { list-style: none; margin: 0 0 var(--sp-4); padding: 0;
  display: flex; flex-wrap: wrap; gap: 4px var(--sp-3); font: var(--fs-2xs) var(--font-ui); }
.am-legend li { display: flex; align-items: center; gap: 5px; color: var(--color-muted); }
.am-legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--sw); display: block; }
.am-legend i.ring { background: transparent; border: 2px solid var(--am-mark); }

.am-card {
  border: 1px solid var(--color-border-strong); border-left: 4px solid var(--cardc, var(--color-purple));
  border-radius: var(--radius-sm); background: var(--am-bg);
  padding: var(--sp-3); margin: 0 0 var(--sp-4);
}
.am-card h3 { font: var(--fw-bold) var(--fs-base)/1.25 var(--font-heading); margin: 0 0 2px; }
.am-card .prep { color: var(--color-muted); font: var(--fs-2xs) var(--font-ui); margin: 0 0 var(--sp-3); }
.am-card dl { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--sp-3); margin: 0; }
.am-card dt { color: var(--color-muted); font: var(--fs-2xs) var(--font-ui); }
.am-card dd { margin: 0; font: var(--fw-semibold) var(--fs-xs) var(--font-ui); font-variant-numeric: tabular-nums; }
.am-card .flag { margin: var(--sp-3) 0 0; padding: var(--sp-2) var(--sp-3);
  background: var(--color-surface); border-radius: var(--radius-sm);
  font: italic var(--fs-2xs)/1.4 var(--font-body); color: var(--color-charcoal); }
:root[data-theme="stage"] .am-card .flag { color: var(--color-muted); }

.am-list { list-style: none; margin: 0; padding: 0; font-size: var(--fs-xs); font-family: var(--font-ui); }
.am-list li { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2);
  padding: 5px 0; border-bottom: 1px solid var(--color-border); align-items: baseline; }
.am-list li:last-child { border-bottom: 0; }
.am-list button {
  all: unset; cursor: pointer; font: inherit; color: var(--am-ink);
  border-bottom: 1px solid transparent; text-align: left;
}
.am-list button:hover { border-bottom-color: var(--color-purple); }
.am-list .v { font-variant-numeric: tabular-nums; font-weight: var(--fw-bold); white-space: nowrap; }
.am-list .none { color: var(--color-red); font-weight: var(--fw-bold); }
:root[data-theme="stage"] .am-list .none { color: var(--color-gold); }

.am-src { margin: var(--sp-5) 0 0; color: var(--color-muted);
  font: var(--fs-2xs)/1.45 var(--font-ui); border-top: 1px solid var(--color-border); padding-top: var(--sp-3); }
.am-src p { margin: 0 0 var(--sp-3); }
.am-src h3 {
  font: var(--fw-semibold) var(--fs-2xs) var(--font-ui); text-transform: uppercase;
  letter-spacing: var(--tracking-wider); color: var(--color-muted);
  margin: 0 0 var(--sp-2);
}
.am-src h3 + p { margin-bottom: var(--sp-4); }
.am-src p + h3 { margin-top: var(--sp-4); }

/* -------------------------------------------------------------- the footer */
.am-foot {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-5);
  border-top: 1px solid var(--color-border); background: var(--color-surface);
  font-family: var(--font-ui); font-size: var(--fs-xs);
}
.am-foot .now { color: var(--color-muted); }
.am-foot .now b { color: var(--am-ink); font-weight: var(--fw-semibold); }
.am-ticks { display: flex; gap: 5px; margin-left: auto; }
.am-ticks span { width: 20px; height: 3px; border-radius: 2px; background: var(--color-border-strong); }
.am-ticks span.on { background: var(--color-purple); }
:root[data-theme="stage"] .am-ticks span.on { background: var(--color-gold); }

/* The arrow. The one thing still moving when the field is at rest. */
.am-arrow {
  position: relative; width: 92px; height: 40px; padding: 0;
  border: 0; background: transparent; color: var(--color-purple); cursor: pointer;
}
:root[data-theme="stage"] .am-arrow { color: var(--color-gold); }
.am-arrow:disabled { color: var(--color-border-strong); cursor: default; }
.am-arrow .shaft {
  position: absolute; left: 6px; right: 20px; top: 50%; height: 2px;
  background: currentColor; transform-origin: left center;
  transition: transform var(--duration-lg) var(--ease-out);
}
.am-arrow .head {
  position: absolute; right: 8px; top: 50%; width: 13px; height: 13px;
  border-top: 2px solid currentColor; border-right: 2px solid currentColor;
  transform: translate(0, -50%) rotate(45deg);
  transition: transform var(--duration-lg) var(--ease-out);
}
.am-arrow .dot {
  position: absolute; top: 50%; left: 6px; width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%; background: currentColor;
  animation: am-travel 2.4s var(--ease) infinite;
}
@keyframes am-travel {
  0%   { transform: translateX(0);    opacity: 0; }
  12%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateX(62px); opacity: 0; }
}
.am-arrow:hover:not(:disabled) .shaft, .am-arrow:focus-visible:not(:disabled) .shaft { transform: scaleX(1.12); }
.am-arrow:hover:not(:disabled) .head,  .am-arrow:focus-visible:not(:disabled) .head  { transform: translate(6px, -50%) rotate(45deg); }
.am-arrow.press .head { transform: translate(14px, -50%) rotate(45deg); }
.am-arrow:disabled .dot { display: none; }

/* ------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .am-arrow .dot { display: none; }
}
body.still .am-arrow .dot { display: none; }

/* -------------------------------------------------------------------- phone */
@media (max-width: 900px) {
  /* The page scrolls here instead of filling the viewport. Leaving body at
     height:100% made the grid squeeze its auto rows to fit, which shrank the
     figure below its own min-height and cut the wage axis off the bottom. */
  html, body { height: auto; }
  body.su-body { min-height: 100%; overflow: visible; grid-template-rows: none; display: block; }
  .am-stage { grid-template-columns: 1fr; }
  .am-web { height: 62vh; min-height: 360px; }
  .am-rail { border-left: 0; border-top: 1px solid var(--color-border); overflow: visible; }
  .am-sib { margin-left: 0; width: 100%; }
  .am-foot { position: sticky; bottom: 0; z-index: 20; }
  .am-top { position: static; }
}
