/* SK Hynix West Lafayette · Workforce Intelligence
   Design tokens from AGENTS.md · do not invent new colors. */

:root {
  --bg: #f6f9fc;
  --surface: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --border: #d7e2ee;
  --primary: #1f5f8b;          /* the only chart series color */
  --primary-65: #6d97b4;       /* primary tint (65% over white) */
  --primary-35: #b1c7d6;       /* primary tint (35% over white) */
  --primary-12: #e8f1f8;
  --accent: #1f5f8b;
  --positive: #2f7d5b;
  --warning: #b7791f;

  --max-w: 1180px;
  --gap-section: 24px;
  --gap-grid: 16px;
  --pad-card: 20px;
  --radius: 8px;

  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
}

.mono { font-family: var(--mono); }

/* Inter, self-hosted: the gated brief makes no third-party requests. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-var.woff2") format("woff2");
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: Inter, system-ui, sans-serif;
  background:
    linear-gradient(180deg, #ffffff 0, #ffffff 225px, var(--bg) 225px);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  font-feature-settings: "tnum" 1, "cv05" 1;
}

.page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 30px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: var(--gap-section);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

/* ---------- entrance: quiet staggered fade, ≤300ms ---------- */
.reveal { animation: rise 280ms ease-out both; }
.reveal:nth-child(2) { animation-delay: 40ms; }
.reveal:nth-child(3) { animation-delay: 80ms; }
.reveal:nth-child(4) { animation-delay: 120ms; }
.reveal:nth-child(5) { animation-delay: 160ms; }
.reveal:nth-child(6) { animation-delay: 200ms; }
.reveal:nth-child(7) { animation-delay: 240ms; }
.reveal:nth-child(8) { animation-delay: 280ms; }
@keyframes rise { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .reveal { animation: none; } }

/* ---------- 1 · masthead ---------- */
.masthead {
  display: block;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--primary);
}

.masthead__top {
  margin-bottom: 16px;
}

.kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
}

h1 {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.1;
}

.masthead__main { max-width: 760px; }

/* ---------- 2 · live filter console ---------- */
.console {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: none;
}

.console__controls {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: var(--gap-grid);
  flex-wrap: wrap;
}

.filter-group { display: flex; align-items: center; }

.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.seg__btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: none;
  border-right: 1px solid var(--border);
  padding: 7px 13px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.seg__btn:last-child { border-right: none; }
.seg__btn:hover { color: var(--text); }
.seg__btn.is-active {
  background: var(--primary);
  color: var(--surface);
  font-weight: 600;
}

.explore-toggle {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 7px 13px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.explore-toggle:hover {
  border-color: var(--primary);
}
.explore-toggle.is-active {
  background: var(--primary-12);
  border-color: var(--primary);
  color: var(--text);
}

/* ---------- profile explorer ---------- */
.explorer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px var(--pad-card);
}

.explorer.reveal { animation: none; }
.explorer[hidden] { display: none; }

.explorer__head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.explorer__head h2 {
  margin-top: 2px;
}

.explorer__count {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.explorer__tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) minmax(220px, 1.4fr);
  gap: 12px;
  padding: 14px 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field select,
.field input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 7px 9px;
}

.field select:disabled,
.field input:disabled {
  color: var(--muted);
  background: var(--bg);
}

.profile-empty {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  color: var(--muted);
  max-width: 74ch;
}

.profile-empty h3 {
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
  margin-bottom: 4px;
}

.profile-empty code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}

.profile-table-wrap {
  max-height: 440px;
  overflow: auto;
  border-top: 1px solid var(--border);
}

.profile-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.profile-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  padding: 10px 10px 8px 0;
  border-bottom: 1px solid var(--primary);
}

.profile-table td {
  padding: 10px 10px 10px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 13px;
}

.profile-table tr[data-profile-url] {
  cursor: pointer;
}

.profile-table tbody tr[data-profile-url]:hover td {
  background: var(--bg);
}

.profile-table strong {
  display: block;
  font-weight: 650;
}

.profile-table small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.profile-table a {
  font-weight: 600;
}

.profile-table__more td {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* ---------- employer footprint ---------- */
.employer-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 14px;
}

.employer-metrics p {
  background: var(--surface);
  padding: 12px 14px;
}

.employer-metrics strong {
  display: block;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.employer-metrics span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.company-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.company-tile {
  min-height: 72px;
  padding: 10px 12px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  isolation: isolate;
}

.company-tile__shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--primary) var(--company-shade), var(--surface));
}

.company-tile__count {
  font-size: 21px;
  line-height: 1;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.company-tile h3 {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 650;
}

.company-footnote {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- data sections ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px var(--pad-card);
}

.card__head {
  margin-bottom: 14px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.card__no {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.08em;
}

h2 { font-size: 20px; font-weight: 600; letter-spacing: 0; }

.card__sub { font-size: 13px; color: var(--muted); margin-top: 3px; }

.source {
  font-size: 12px;
  color: var(--muted);
  margin-top: 14px;
}

/* ---------- composition bars ---------- */
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.legend__item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.swatch--core { background: var(--primary); }
.swatch--commute { background: var(--primary-65); }
.swatch--indy { background: var(--primary-35); }

.compbars { display: flex; flex-direction: column; gap: 10px; }

.comprow {
  display: grid;
  grid-template-columns: 200px 1fr 64px;
  align-items: center;
  gap: 12px;
}

.comprow__label { font-size: 14px; }
.comprow__label small { display: block; color: var(--muted); font-size: 12px; }

.comprow__track { display: flex; gap: 2px; height: 18px; }
.comprow__seg {
  border-radius: 2px;
  min-width: 2px;
  animation: growbar 300ms ease-out both;
  transform-origin: left;
  transition: width 250ms ease;
}
@keyframes growbar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .comprow__seg { animation: none; transition: none; } }
.comprow__seg--core { background: var(--primary); border-radius: 4px 2px 2px 4px; }
.comprow__seg--commute { background: var(--primary-65); }
.comprow__seg--indy { background: var(--primary-35); border-radius: 2px 4px 4px 2px; }

.comprow__total {
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- ranked tables ---------- */
.ranktable { width: 100%; border-collapse: collapse; }

.ranktable th {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 0 10px 8px 0;
  border-bottom: 1px solid var(--primary);
}

.ranktable td {
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
}

.ranktable tbody tr:last-child td { border-bottom: none; }
.ranktable tbody tr:hover td { background: var(--bg); }

.ranktable .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ranktable td.num { font-weight: 650; }
.ranktable .bar-col { width: 42%; }

.rankbar {
  height: 12px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
}
.rankbar__fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px 4px 4px 2px;
  min-width: 2px;
  animation: growbar 300ms ease-out both;
  transform-origin: left;
  transition: width 250ms ease;
}
@media (prefers-reduced-motion: reduce) { .rankbar__fill { animation: none; transition: none; } }

tr.is-dimmed .rankbar__fill { background: var(--primary-35); }
tr.is-dimmed td, tr.is-dimmed .rowlabel small { color: var(--muted); }

.legend__item { transition: opacity 150ms; }
.legend__item.is-dimmed { opacity: 0.35; }

/* ---------- legacy selected-employer heatmap ---------- */
.account-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.account-tile {
  min-height: 112px;
  padding: 14px 16px;
  background:
    linear-gradient(
      0deg,
      rgba(31, 95, 139, var(--heat)),
      rgba(31, 95, 139, var(--heat))
    ),
    var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.account-tile__share {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.account-tile h3 {
  font-size: 15px;
  font-weight: 650;
  line-height: 1.25;
  margin-top: 10px;
}

.account-tile__count {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ---------- query ledger ---------- */
.ledger {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.ledger summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  padding: 12px var(--pad-card);
  list-style: none;
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}
.ledger summary::-webkit-details-marker { display: none; }
.ledger summary::before { content: "▸"; color: var(--accent); }
.ledger[open] summary::before { content: "▾"; }
.ledger summary:hover { background: var(--bg); border-radius: var(--radius); }

.ledger__hint { color: var(--muted); font-family: Inter, system-ui, sans-serif; font-size: 12px; }

.ledger__table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin: 0;
}
.ledger__table th:last-child, .ledger__table td:last-child { width: 100%; }
.ledger__table th, .ledger__table td {
  text-align: left;
  padding: 6px var(--pad-card) 6px 0;
  border-top: 1px solid var(--border);
  white-space: nowrap;
}
.ledger__table th:first-child, .ledger__table td:first-child { padding-left: var(--pad-card); }
.ledger__table th { color: var(--muted); font-weight: 500; }
.ledger__table .num { text-align: right; }
.ledger__table tbody tr:hover td { background: var(--bg); }
.ledger__table { display: block; overflow-x: auto; }

.rowlabel small { display: block; color: var(--muted); font-size: 12px; }

/* ---------- context strip ---------- */
.context__h {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.context__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-grid);
}

.ctx-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad-card);
}

.ctx-tile__value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.ctx-tile__unit { font-size: 14px; font-weight: 500; color: var(--muted); }

.ctx-tile__label { font-size: 13px; margin-top: 4px; }
.ctx-tile .source { margin-top: 8px; }

/* ---------- 8 · footer ---------- */
.foot {
  border-top: 2px solid var(--primary);
  padding-top: 20px;
}

.foot__h { font-size: 14px; font-weight: 600; margin-bottom: 8px; }

.foot__text { font-size: 13px; color: var(--muted); max-width: 92ch; }

.foot__mark {
  margin-top: 18px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .context__grid { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .comprow { grid-template-columns: 130px 1fr 56px; }
  .explorer__tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field--search { grid-column: 1 / -1; }
  .employer-metrics { grid-template-columns: 1fr; }
  .company-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  h1 { font-size: 28px; }
  .ranktable .bar-col { width: 26%; }
  .page { padding-inline: 24px; }
  .account-grid { grid-template-columns: 1fr; }
  .company-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .company-tile {
    min-height: 68px;
    padding: 9px 10px;
  }
  .company-tile h3 { font-size: 12px; }
  .company-tile__count { font-size: 19px; }
  .account-tile { min-height: 96px; }
  .masthead__top {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  .comprow {
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
  }
  .comprow__label {
    grid-column: 1 / -1;
  }
  .comprow__track {
    grid-column: 1;
    height: 16px;
  }
  .comprow__total {
    grid-column: 2;
    align-self: start;
    padding-top: 1px;
  }
  .seg {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .explore-toggle { width: 100%; min-height: 44px; }
  .filter-group { width: 100%; }
  .explorer__head {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
  .explorer__tools { grid-template-columns: 1fr; }
  .seg__btn {
    min-height: 48px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    line-height: 1.2;
  }
  .seg__btn:nth-child(2n) { border-right: none; }
  .seg__btn:nth-last-child(-n + 2) { border-bottom: none; }
}
