/* AI Infrastructure Jobs Outlook. Dark "instrument panel" first, light when the system asks. */
:root {
  --bg: #0b1016;
  --bg-2: #111821;
  --card: #151d27;
  --card-hi: #1b2531;
  --line: #263243;
  --ink: #f2f5f8;
  --ink-2: #b9c4d0;
  --ink-3: #8593a3;
  --accent: #ff9a3c;
  --track: #2a3646;
  --risk: #d03b3b;
  --cooling: #ec835a;
  --steady: #fab219;
  --growing: #0ca30c;
  --none: #5d6b7c;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --needle: #f2f5f8;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f5f8; --bg-2: #e9edf2; --card: #ffffff; --card-hi: #f7f9fb; --line: #dbe1e8;
    --ink: #0e1620; --ink-2: #3c4a5a; --ink-3: #5f6d7d; --accent: #c25a00; --track: #e3e8ee;
    --none: #9aa6b3; --needle: #0e1620;
    --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
    --shadow: 0 1px 2px rgba(15,25,40,.06), 0 6px 18px rgba(15,25,40,.06);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f3f5f8; --bg-2: #e9edf2; --card: #ffffff; --card-hi: #f7f9fb; --line: #dbe1e8;
  --ink: #0e1620; --ink-2: #3c4a5a; --ink-3: #5f6d7d; --accent: #c25a00; --track: #e3e8ee;
  --none: #9aa6b3; --needle: #0e1620;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-image: radial-gradient(1200px 500px at 80% -10%, rgba(255,154,60,.10), transparent 60%),
                    radial-gradient(900px 400px at -10% 10%, rgba(57,135,229,.10), transparent 60%);
  background-repeat: no-repeat;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.num { font-variant-numeric: tabular-nums; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand small { display: block; font: 600 .68rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent); margin-top: 3px; }
.live { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--ink-2); text-align: right; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--growing); flex: none; position: relative; }
.dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--growing);
  animation: ping 2s ease-out infinite; }
.live.pending .dot, .live.pending .dot::after { background: var(--steady); border-color: var(--steady); }
@keyframes ping { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.8); opacity: 0; } }

/* Hero */
.hero { padding: 36px 0 8px; }
.eyebrow { margin: 0; font: 600 .74rem ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent); }
h1 { font-size: clamp(1.75rem, 4.6vw, 3rem); line-height: 1.1; margin: .3em 0 .35em; letter-spacing: -.02em; max-width: 22ch; }
h1 em { font-style: normal; }
h1 em.g { color: var(--growing); } h1 em.r { color: var(--risk); }
.lede { color: var(--ink-2); max-width: 64ch; margin: 0; font-size: 1.05rem; }
.lede b { color: var(--ink); }
.key { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* Zone pills (status: always icon + label, never colour alone) */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: .78rem; font-weight: 700; line-height: 1.4; white-space: nowrap; color: #11161c; background: var(--none); }
.pill .ic { font-size: .72rem; }
.pill.risk { background: var(--risk); color: #fff; }
.pill.cooling { background: var(--cooling); }
.pill.steady { background: var(--steady); }
.pill.growing { background: var(--growing); color: #fff; }
.pill.none { background: var(--none); color: #fff; }
.key .pill { font-size: .8rem; }

/* Headline dials */
.headline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 26px 0 8px; }
@media (max-width: 860px) { .headline { grid-template-columns: 1fr; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px 18px; box-shadow: var(--shadow); }
.panel h2 { margin: 0; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.panel .sub { margin: 4px 0 0; color: var(--ink-2); font-size: .9rem; }
.hd { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.big-num { font-size: clamp(2.2rem, 6vw, 3.2rem); font-weight: 800; letter-spacing: -.03em; margin: 8px 0 0; line-height: 1; }
.seg-bars { margin-top: 14px; display: grid; gap: 8px; }

/* Tabs */
.tabs { display: flex; gap: 6px; margin: 30px 0 18px; padding: 5px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: 1 0 auto; border: 0; background: transparent; padding: 10px 14px; border-radius: 10px; cursor: pointer;
  font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.tabs button:focus-visible, .card:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.view-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.view-head h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.01em; }
.view-head p { margin: 4px 0 0; color: var(--ink-2); max-width: 70ch; font-size: .95rem; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--card); padding: 7px 12px; border-radius: 999px; cursor: pointer;
  font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Dial cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.card { position: relative; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 14px 12px; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease, background .15s; }
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); background: var(--card-hi); }
.card h3 { margin: 0; font-size: .95rem; line-height: 1.25; min-height: 2.5em; }
.card .meta { margin: 2px 0 0; font-size: .8rem; color: var(--ink-3); }
.card .row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; }
.card .val { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.card .more { position: absolute; top: 12px; right: 12px; color: var(--ink-3); font-size: .8rem; }
.card.flash { animation: flash 1.2s ease; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }

/* Gauge */
.gauge { display: block; width: 100%; max-width: 230px; height: auto; margin: 4px auto 0; overflow: visible; }
.gauge.lg { max-width: 300px; }
.gauge .zone { fill: none; stroke-linecap: butt; opacity: .28; transition: opacity .6s ease; }
.gauge .zone.on { opacity: 1; }
.gauge .tick { stroke: var(--ink-3); stroke-width: 1.2; }
.gauge .tick.mid { stroke: var(--ink-2); stroke-width: 2; }
.gauge .needle { transform-origin: 100px 100px; transition: transform 1.4s cubic-bezier(.34, 1.45, .5, 1); }
.gauge .needle path { fill: var(--needle); }
.gauge .hub { fill: var(--needle); }
.gauge .hub-in { fill: var(--card); }
.gauge .lbl { font: 600 9px ui-monospace, SFMono-Regular, Menlo, monospace; fill: var(--ink-3); }
.gauge.off .needle path, .gauge.off .hub { fill: var(--none); }
.gauge .ghost { transform-origin: 100px 100px; opacity: .55; }
.gauge .ghost path { fill: none; stroke: var(--needle); stroke-width: 1.5; stroke-dasharray: 3 3; }

.spark { display: block; width: 100%; height: 28px; margin-top: 6px; }
.spark path { fill: none; stroke: var(--ink-3); stroke-width: 1.5; }

/* Distribution strip */
.strip { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; margin: 10px 0 6px; }
.strip span { display: block; height: 100%; }
.strip-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .82rem; color: var(--ink-2); }

/* Scrubber */
.scrub { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin: 0 0 14px; }
.scrub input[type=range] { flex: 1; accent-color: var(--accent); min-width: 0; }
.scrub .when { font-weight: 800; min-width: 7.5em; text-align: right; }
.play { border: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #11161c; cursor: pointer; font-size: .95rem; flex: none; }

/* Bars */
.bar { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: .85rem; }
.bar .track { display: block; height: 10px; background: var(--track); border-radius: 5px; overflow: hidden; }
.bar .fill { display: block; height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; }
.bar .name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dialog */
dialog { overflow: auto; border: 0; padding: 0; background: transparent; color: var(--ink); max-width: min(980px, calc(100vw - 20px)); width: 100%; max-height: calc(100vh - 20px); }
dialog::backdrop { background: rgba(5, 8, 12, .7); backdrop-filter: blur(3px); }
.dlg { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: 20px; padding: 22px 20px 24px; }
.close { position: absolute; top: 10px; right: 12px; border: 0; background: var(--card); width: 36px; height: 36px; border-radius: 50%; font-size: 1.4rem; line-height: 1; cursor: pointer; z-index: 2; }
.d-top { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 20px; align-items: center; }
@media (max-width: 700px) { .d-top { grid-template-columns: 1fr; } }
.d-top h2 { margin: 0 0 6px; font-size: 1.5rem; padding-right: 40px; letter-spacing: -.01em; }
.d-top p { margin: 0 0 10px; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 1.35rem; letter-spacing: -.02em; }
.stat span { font-size: .78rem; color: var(--ink-3); }
.d-sec { margin-top: 22px; }
.d-sec h3 { margin: 0 0 10px; font-size: 1rem; }
.d-sec .note { color: var(--ink-3); font-size: .85rem; margin: 6px 0 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 700px) { .cols { grid-template-columns: 1fr; } }
.jobs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.jobs li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: .88rem; }
.jobs li a { color: var(--ink); font-weight: 600; text-decoration: none; }
.jobs li a:hover { color: var(--accent); }
.jobs li span { display: block; color: var(--ink-3); font-size: .8rem; }

/* Line chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .base { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .ax { font: 11px ui-sans-serif, system-ui, sans-serif; fill: var(--ink-3); }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dl { font: 600 11px ui-sans-serif, system-ui, sans-serif; fill: var(--ink-2); }
.chart .cross { stroke: var(--ink-3); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; color: var(--ink-2); margin: 0 0 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; font-size: .8rem; box-shadow: var(--shadow); min-width: 140px; }
.tip b { display: block; margin-bottom: 4px; }
.tip div { display: flex; justify-content: space-between; gap: 12px; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

/* Changing careers */
.switch-pick { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.switch-pick select { font: inherit; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; max-width: 100%; }
.path { display: grid; grid-template-columns: minmax(170px, 230px) 44px 1fr; gap: 10px; align-items: center; margin-bottom: 12px; }
.path .arrow { font-size: 1.8rem; color: var(--accent); text-align: center; }
@media (max-width: 640px) { .path { grid-template-columns: 1fr; } .path .arrow { transform: rotate(90deg); }
  .grid, .grid.small { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card { padding: 12px 10px 10px; } .card h3 { font-size: .85rem; } .card .val { font-size: 1.1rem; } .card .more { display: none; }
  .pill { font-size: .7rem; padding: 2px 8px 2px 6px; } .gauge.lg { max-width: 240px; } }
.story { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 12px 16px; margin: 0 0 18px; color: var(--ink-2); }
.story b { color: var(--ink); }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: 14px; padding: 18px; color: var(--ink-2); }

.foot { margin: 48px 0 40px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: .85rem; }
.foot p { margin: 0 0 8px; max-width: 90ch; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (prefers-reduced-motion: reduce) {
  .gauge .needle, .card { transition: none; }
  .dot::after, .card.flash { animation: none; }
}
@media (forced-colors: active) { .pill { border: 1px solid CanvasText; } }
