/* Salary transparency observatory
   Colors: validated reference palette (dataviz skill), a single blue accent.
   Shapes: 6px controls; bars with a 4px rounded data end and a square base (dataviz spec). */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;          /* darker than the reference muted: small text above 4.5:1 */
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;         /* series 1, validated on #fcfcfb */
  --accent-ink: #1c5cab;     /* links and accent text: AA text contrast */
  --range-lo: #86b6ef;       /* dumbbell: minimum (ordinal, validated) */
  --range-hi: #256abf;       /* dumbbell: maximum */
  --wp-onsite: #2a78d6;      /* work arrangement: categorical slots 1-3, validated (adjacent CVD dE >= 9.2) */
  --wp-hybrid: #eb6834;
  --wp-remote: #1baf7a;      /* below 3:1 on the light surface: legend, tooltip and table carry the values */
  --wp-none: #d6d5cf;        /* "not stated": a neutral, not a category */
  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f4f4f1;
    --ink-2: #c3c2b7;
    --muted: #9c9a93;
    --grid: #2c2c2a;
    --axis: #383835;
    --ring: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-ink: #86b6ef;
    --range-lo: #184f95;
    --range-hi: #6da7ec;
    --wp-onsite: #3987e5;
    --wp-hybrid: #d95926;
    --wp-remote: #199e70;
    --wp-none: #44443f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --ink: #f4f4f1;
  --ink-2: #c3c2b7;
  --muted: #9c9a93;
  --grid: #2c2c2a;
  --axis: #383835;
  --ring: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --accent-ink: #86b6ef;
  --range-lo: #184f95;
  --range-hi: #6da7ec;
  --wp-onsite: #3987e5;
  --wp-hybrid: #d95926;
  --wp-remote: #199e70;
  --wp-none: #44443f;
}

* { box-sizing: border-box; }
/* text grows a little on large screens: 16px on laptops, up to 19px on wide monitors */
html { scroll-behavior: smooth; scroll-padding-top: 72px; font-size: clamp(16px, 0.45vw + 10.5px, 19px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 1rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
/* display title: tight tracking and leading; balance keeps the lines even when it wraps */
h1 { font-size: clamp(2.2rem, 4.2vw, 4.4rem); font-weight: 680; line-height: 1.04; letter-spacing: -0.025em;
     text-wrap: balance; }
h2 { font-size: 1.25rem; font-weight: 620; }
h3 { font-size: 1rem; font-weight: 620; margin-top: 1.25rem; }
p { margin: 0; }

.wrap { width: 100%; max-width: 1480px; margin: 0 auto; padding: 0 clamp(24px, 3vw, 56px); }
@media (max-width: 767px) { .wrap { padding: 0 16px; } }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;          /* the only layer above the content (besides the tooltip) */
  background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ring);
}
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { color: var(--ink); text-decoration: none; font-weight: 650; white-space: nowrap; }
.topbar nav { display: flex; gap: 20px; margin-left: auto; }
.topbar nav a { color: var(--ink-2); text-decoration: none; font-size: 0.95rem; }
.topbar nav a:hover { color: var(--ink); }
@media (max-width: 860px) { .topbar nav { display: none; } .theme-toggle { margin-left: auto; } }

button, select, input {
  font: inherit; color: var(--ink);
  border-radius: var(--radius);
}
.theme-toggle, .ghost {
  background: transparent; border: 1px solid var(--axis);
  padding: 6px 12px; cursor: pointer; white-space: nowrap;
}
.theme-toggle:hover, .ghost:hover { background: var(--surface); }
.ghost:active, .theme-toggle:active { transform: translateY(1px); }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* intro */
.intro { padding-top: 56px; padding-bottom: 24px; }
/* subtitle under the title: grows with the screen, line length capped at ~65 characters for reading */
.lede { margin-top: 20px; font-size: clamp(1.15rem, 0.5vw + 0.95rem, 1.4rem); line-height: 1.5;
        color: var(--ink-2); max-width: 65ch; text-wrap: pretty; }
.stamp { margin-top: 12px; color: var(--muted); font-size: 0.9rem; }

/* filters: one row above everything they filter */
.filters { padding-top: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--ring); }
/* five filters in equal columns, the reset button at the end of the same row */
#filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: 10px 12px; align-items: end; }
#filters label { display: grid; gap: 4px; font-size: 0.8rem; color: var(--ink-2); }
#filters label.grow { flex: 1 1 200px; }
#filters select, #filters input {
  background: var(--surface); border: 1px solid var(--axis);
  padding: 6px 8px; font-size: 0.9rem; min-width: 0; width: 100%;
}
#filters input { width: 100%; max-width: none; }
#filters input::placeholder { color: var(--muted); }
@media (max-width: 1279px) { #filters { grid-template-columns: repeat(3, minmax(0, 1fr)); } #filters .ghost { justify-self: start; } }
@media (max-width: 1023px) {
  #filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #filters .ghost { justify-self: start; }
}
@media (max-width: 599px) { #filters { grid-template-columns: minmax(0, 1fr); } }   /* one filter per row: option text is never cut */

/* updating state: keep the previous drawing, dimmed */
.results { transition: opacity 0.2s ease; }
.results.is-loading { opacity: 0.45; }
@media (prefers-reduced-motion: reduce) { .results { transition: none; } }

/* headline numbers */
.headline {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 32px; align-items: end; padding-top: 40px; padding-bottom: 40px;
}
.hero-value { font-size: clamp(3.5rem, 8vw, 5.5rem); font-weight: 650; line-height: 1; letter-spacing: -0.02em; }
.hero-label { margin-top: 8px; color: var(--ink-2); }
/* the salary range is the widest value: it gets a wider column, and a full row on narrow screens */
.kpis { display: grid; grid-template-columns: minmax(0, 1.7fr) repeat(3, minmax(0, 1fr)); gap: 24px; margin: 0; }
.kpis div { border-top: 1px solid var(--axis); padding-top: 12px; }
.kpis dt { font-size: 0.85rem; color: var(--ink-2); }
.kpis dd { margin: 6px 0 0; font-size: 1.35rem; font-weight: 620; white-space: nowrap; }
@media (max-width: 900px) {
  .headline { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis div:first-child { grid-column: 1 / -1; }
}

.error { padding: 32px 24px; color: var(--ink-2); }
.error { color: var(--ink); background: var(--surface); border: 1px solid var(--axis); border-radius: var(--radius); }

/* charts */
/* charts stacked one under the other, in three groups; every chart shares the same label column
   and the same right gutter for the tip value, so all plot areas and axes line up vertically */
.charts { --label-w: 15rem; --tip: 64px; display: grid; gap: 88px; padding-bottom: 24px; }
.chart-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 56px; }
.group-head { border-top: 2px solid var(--ink); padding-top: 16px; }
.group-head h2 { font-size: clamp(1.5rem, 1vw + 1.1rem, 2rem); font-weight: 650; letter-spacing: -0.015em; }
.group-head p { margin-top: 6px; color: var(--ink-2); max-width: 72ch; }
.chart { margin: 0; min-width: 0; }
.chart h3 { margin: 0; font-size: 1.05rem; font-weight: 620; }
.chart figcaption p { margin-top: 4px; color: var(--ink-2); font-size: 0.9rem; max-width: 72ch; }
.chart-body { margin-top: 14px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.visually-hidden + .chart-body { margin-top: 0; }
.group-head + .chart:has(> .visually-hidden) { margin-top: -24px; }   /* no title of its own: closer to the group header */

.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0; margin: 12px 0 0; font-size: 0.85rem; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.key { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.key-lo { background: var(--range-lo); }
.key-hi { background: var(--range-hi); }
/* stacked segments use square keys (the marks are rectangles), dumbbells round keys (dots) */
.key-onsite, .key-hybrid, .key-remote, .key-not_stated, .key-hidden { border-radius: 2px; }
.key-onsite { background: var(--wp-onsite); }
.key-hybrid { background: var(--wp-hybrid); }
.key-remote { background: var(--wp-remote); }
.key-not_stated { background: var(--wp-none); }
.key-hidden, .seg-hidden {
  background: repeating-linear-gradient(135deg, var(--axis) 0 2px, transparent 2px 5px);
  box-shadow: inset 0 0 0 1px var(--axis);
}

/* horizontal bars: label | plot area | value at the tip */
.bars { display: grid; gap: 6px; }
.bar-row {
  display: grid; grid-template-columns: var(--label-w) minmax(0, 1fr);
  align-items: center; gap: 16px; border-radius: 4px; padding: 2px 0;
}
.bar-row:hover, .bar-row:focus-visible { background: color-mix(in srgb, var(--accent) 6%, transparent); }
/* labels wrap instead of being cut with an ellipsis: a truncated category name is unreadable */
.bar-label { font-size: 0.88rem; line-height: 1.25; color: var(--ink); overflow-wrap: anywhere; }
/* the right gutter holds the tip value: bars, dumbbells, grid and axis share the same width */
.bar-plot { position: relative; height: 22px; display: flex; align-items: center; padding-right: var(--tip); }
.bar-plot .gridlines { right: var(--tip); }
.axis-scale { margin-right: var(--tip); }
.dumb-plot { margin-right: var(--tip); }
.bar {
  height: 14px; background: var(--accent);
  border-radius: 0 4px 4px 0;            /* rounded data end, square base */
  min-width: 2px;
  flex: none;                            /* the bar does not shrink: length = value */
}
.bar-value { margin-left: 8px; font-size: 0.85rem; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

.axis { display: grid; grid-template-columns: var(--label-w) minmax(0, 1fr); gap: 16px; margin-top: 6px; }
.axis-scale { position: relative; height: 18px; border-top: 1px solid var(--axis); }
.axis-scale span {
  position: absolute; top: 4px; transform: translateX(-50%);
  font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums;
}
.axis-scale span:first-child { transform: none; }
.axis-scale span:last-child { transform: translateX(-100%); }
.gridlines { position: absolute; inset: 0; pointer-events: none; }
.gridlines i { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--grid); }
.bar-plot > .bar, .bar-plot > .bar-value { position: relative; }

/* dumbbell: line from minimum to maximum, dots with a ring in the background color */
.dumb-plot { position: relative; height: 22px; }
.dumb-line { position: absolute; top: 10px; height: 2px; background: var(--axis); border-radius: 1px; }
.dot {
  position: absolute; top: 5px; width: 12px; height: 12px; border-radius: 50%;
  transform: translateX(-50%); box-shadow: 0 0 0 2px var(--page);
}
.dot-lo { background: var(--range-lo); }
.dot-hi { background: var(--range-hi); }

/* emphasis: a filtered value stays in color and its label turns bold, the others recede */
.bar-row.is-selected .bar-label { font-weight: 650; }
.bar-row.is-muted .dot { background: var(--axis); }
.bar-row.is-muted .bar-label { color: var(--ink-2); }

/* 100% stacked bars: 2px surface gaps between segments, rounded only at the data end */
.mix-plot .stack { position: relative; display: flex; gap: 2px; width: 100%; height: 14px; }
.seg { display: block; height: 100%; min-width: 0; }
.seg:last-child { border-radius: 0 4px 4px 0; }
.seg-onsite { background: var(--wp-onsite); }
.seg-hybrid { background: var(--wp-hybrid); }
.seg-remote { background: var(--wp-remote); }
.seg-not_stated { background: var(--wp-none); }
.seg.is-muted:not(.seg-hidden) { opacity: 0.28; }
.bar-row.is-total { margin-bottom: 10px; }
.bar-row.is-total .bar-label { font-weight: 650; }

/* tables */
.table-view { margin-top: 12px; font-size: 0.85rem; }
.table-view summary { cursor: pointer; color: var(--accent-ink); }
.table-scroll { overflow-x: auto; margin-top: 12px; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th {
  text-align: left; font-weight: 600; color: var(--ink-2); font-size: 0.8rem;
  padding: 8px 10px; border-bottom: 1px solid var(--axis); white-space: nowrap;
}
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr:hover { background: var(--surface); }

.block { padding-top: 48px; padding-bottom: 8px; }
.note { margin-top: 6px; color: var(--ink-2); font-size: 0.9rem; }


/* methodology */
.method { padding-bottom: 80px; margin-top: 32px; border-top: 1px solid var(--ring); }
.method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; margin-top: 8px; }
.method-grid p, .method-grid li { color: var(--ink-2); max-width: 75ch; margin-top: 8px; }
.method-grid ul { padding-left: 18px; margin: 0; }
@media (max-width: 900px) { .method-grid { grid-template-columns: 1fr; gap: 0; } }

/* tooltip: value first, label after */
.tooltip {
  position: fixed; z-index: 20; pointer-events: none;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--ring); border-radius: var(--radius);
  box-shadow: 0 6px 24px color-mix(in srgb, var(--ink) 12%, transparent);
  padding: 8px 10px; font-size: 0.85rem; max-width: 280px;
}
.tooltip strong { display: block; font-size: 1rem; }
.tooltip span { color: var(--ink-2); }

/* emphasis: the selected sector keeps the accent color, the others turn grey */
.bar-muted { background: var(--axis); }
.chart-empty { color: var(--ink-2); font-size: 0.9rem; max-width: 52ch; }
.headline-empty { grid-column: 1 / -1; color: var(--ink-2); max-width: 72ch; }
.filters .note { margin-top: 10px; }
.download a { font-weight: 600; }

/* narrow screens: the label goes above the bar so it is not cut off */
@media (max-width: 600px) {
  .bar-row, .axis { grid-template-columns: 1fr; gap: 2px; }
  .bar-label { white-space: normal; }
  .axis > span:first-child { display: none; }
}
