/* paycheck styles. One file, no build step, no framework.
   The look: a ledger. Warm paper, ink-green figures, faint ruled lines, and
   numbers set in tabular figures so columns of wages line up.
   Rails frame: app/assets/stylesheets/application.css with Propshaft, minus
   the digest in the file name (Express serves it with a 7-day cache). */

:root {
  --paper: #f6f3ea; --paper-2: #efeadd; --card: #fffdf7;
  --ink: #1d2721; --muted: #5f6b63; --rule: #d9d2bf; --rule-faint: #e6e0cf;
  --green: #1f6b45; --green-ink: #ffffff; --green-soft: #d5e8d9; --green-band: #9ccaa9;
  --accent: #b5541b; /* the visitor's own wage */
  --error: #a3261b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121815; --paper-2: #18201b; --card: #1b241f;
    --ink: #e9efe9; --muted: #98a69c; --rule: #2f3b34; --rule-faint: #232d27;
    --green: #6fcf97; --green-ink: #0f1a14; --green-soft: #21382a; --green-band: #3f7a57;
    --accent: #ffa05c;
    --error: #ff8a7a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121815; --paper-2: #18201b; --card: #1b241f;
  --ink: #e9efe9; --muted: #98a69c; --rule: #2f3b34; --rule-faint: #232d27;
  --green: #6fcf97; --green-ink: #0f1a14; --green-soft: #21382a; --green-band: #3f7a57;
  --accent: #ffa05c;
  --error: #ff8a7a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  color: var(--ink); background: var(--paper);
  /* Ruled lines, like a ledger page. */
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule-faint) 31px 32px);
  font: 1.0625rem/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.figure, table, .stat { font-variant-numeric: tabular-nums; }

main { width: 100%; max-width: 46rem; margin: 0 auto; padding: 1.75rem 1rem 2.5rem; flex: 1; }
.brand { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 800; font-size: 1.125rem;
         letter-spacing: -0.01em; color: inherit; text-decoration: none; }
.brand img { width: 28px; height: 28px; }

h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); line-height: 1.1; font-weight: 800; letter-spacing: -0.025em; margin: 1.25rem 0 0.5rem; }
h2 { font-size: 1.25rem; letter-spacing: -0.01em; margin: 0 0 0.5rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.35rem; }
p { margin: 0 0 0.75rem; }
.lede { font-size: 1.1875rem; color: var(--muted); max-width: 36rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
a { color: inherit; text-decoration-color: var(--green); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--green); }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.error { color: var(--error); font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--rule); border-radius: 14px; padding: 1.5rem; margin-top: 1.25rem;
        box-shadow: 0 1px 0 var(--rule); }
.card > :last-child { margin-bottom: 0; }

/* Forms */
label, .label { display: block; font-weight: 700; margin-bottom: 0.35rem; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.875rem; }
.field-row + .field-row { margin-top: 1.25rem; }
input[type="text"], input[type="search"], select {
  width: 100%; font: inherit; color: inherit; background: var(--paper); border: 2px solid var(--rule); border-radius: 10px;
  padding: 0.7rem 0.85rem; font-size: 1.125rem;
}
input:focus, select:focus { outline: none; border-color: var(--green); }
.pay { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.pay input { flex: 1 1 10rem; }
.toggle { display: inline-flex; border: 2px solid var(--rule); border-radius: 10px; overflow: hidden; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle label { margin: 0; padding: 0.7rem 1rem; font-weight: 600; cursor: pointer; }
.toggle input:checked + label { background: var(--green); color: var(--green-ink); }
.toggle input:focus-visible + label { outline: 3px solid var(--green); outline-offset: -3px; }
.button { display: inline-block; margin-top: 1.5rem; padding: 0.85rem 1.5rem; border: 0; border-radius: 10px;
          background: var(--green); color: var(--green-ink); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.button:hover { filter: brightness(1.08); color: var(--green-ink); }
.button.secondary { background: transparent; color: var(--ink); border: 2px solid var(--rule); margin-top: 0.75rem; padding: 0.6rem 1rem; }
.inline-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: end; }
.inline-form select { flex: 1 1 16rem; font-size: 1rem; padding: 0.55rem 0.7rem; }
.inline-form .button { margin: 0; padding: 0.65rem 1rem; }

/* The one-line search: [job] in [place] [See the wages]. Wraps on phones. */
.search-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.search-line input { flex: 1 1 9rem; min-width: 0; }
.search-line .button { flex: 0 0 auto; }
.search-line .in { font-weight: 700; color: var(--muted); }
.search-line .button { margin: 0; }
.search-top { margin-top: 1rem; }
.search-top input { font-size: 1rem; padding: 0.55rem 0.75rem; }
.search-top .button { padding: 0.6rem 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.pay-form { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.pay-form .button { margin: 0; padding: 0.7rem 1.25rem; }
.pay-form + p, .pay-form + .note { margin-top: 1rem; }
@media (max-width: 600px) {
  .search-line .in { flex: 0 0 auto; }
  .search-line .button { flex: 1 1 100%; }
}

/* Results */
.crumbs { font-size: 0.9375rem; color: var(--muted); margin-top: 1rem; }
.headline { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; }
.stat .value { display: block; font-size: clamp(1.75rem, 6vw, 2.5rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; color: var(--green); }
.stat .what { display: block; color: var(--muted); font-size: 0.9375rem; }
.verdict { border-left: 4px solid var(--accent); padding: 0.25rem 0 0.25rem 1rem; font-size: 1.125rem; }
.verdict strong { color: var(--accent); }

/* The chart: 10th to 90th percentile as a bar, the middle half darker,
   the median as a line, the visitor's wage as a marker. Positions are
   percentages set by the server in --at custom properties. */
.chart { position: relative; height: 6rem; margin: 2.25rem 0 0.5rem; }
.chart .track { position: absolute; left: 0; right: 0; top: 1.5rem; height: 1.25rem; border-radius: 999px; background: var(--green-soft); }
.chart .band { position: absolute; top: 1.5rem; height: 1.25rem; background: var(--green-band); }
.chart .tick { position: absolute; top: 1.15rem; width: 3px; height: 1.95rem; margin-left: -1.5px; background: var(--green); border-radius: 2px; }
.chart .tick-label { position: absolute; top: 3.35rem; transform: translateX(-50%); font-size: 0.8125rem; color: var(--muted); white-space: nowrap; }
.chart .tick-label.median { top: 4.6rem; color: var(--green); font-weight: 700; }
.chart .tick-label.edge-left { transform: none; }
.chart .tick-label.edge-right { transform: translateX(-100%); }
.chart .you { position: absolute; top: -0.35rem; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; color: var(--accent);
              font-weight: 800; font-size: 0.8125rem; line-height: 1; }
.chart .you::after { content: ""; width: 0; height: 0; margin-top: 0.2rem; border: 7px solid transparent; border-top-color: var(--accent); border-bottom: 0; }

table { width: 100%; border-collapse: collapse; margin: 0.5rem 0 0; }
th, td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.current td { background: var(--green-soft); font-weight: 700; }
.up { color: var(--green); }
.down { color: var(--error); }
.note { font-size: 0.875rem; color: var(--muted); }
.pill { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--paper-2); color: var(--muted); }

.choices { list-style: none; padding: 0; margin: 0.75rem 0 0; }
.choices li + li { margin-top: 0.5rem; }
.choices button { width: 100%; text-align: left; font: inherit; color: inherit; background: var(--paper); border: 2px solid var(--rule); border-radius: 10px;
                  padding: 0.75rem 1rem; cursor: pointer; }
.choices button:hover { border-color: var(--green); }
.choices .desc { display: block; font-size: 0.875rem; color: var(--muted); }

details summary { cursor: pointer; font-weight: 700; }
details[open] summary { margin-bottom: 0.75rem; }

/* Footer: Made by and links on the left, BLS's statement on the right. */
footer { width: 100%; padding: 1rem; border-top: 1px solid var(--rule); background: var(--paper-2); color: var(--muted);
         display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 2rem; font-size: 0.875rem; }
footer p { margin: 0; }
footer .left { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
footer .links { display: flex; gap: 0.75rem; }
footer .source { flex: 1 1 22rem; max-width: 38rem; text-align: right; font-size: 0.75rem; line-height: 1.45; }
.theme { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; padding: 2px; }
.theme[hidden] { display: none; }
.theme button { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; }
.theme svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme button[aria-pressed="true"] { background: var(--green); color: var(--green-ink); }

.legal h2 { margin-top: 1.5rem; }
.legal .updated { color: var(--muted); font-size: 0.875rem; }

@media (max-width: 600px) {
  body { font-size: 1rem; }
  main { padding: 1rem 1rem 2rem; }
  .card { padding: 1.1rem; border-radius: 12px; }
  footer .source { text-align: left; flex-basis: 100%; }
  th, td { padding: 0.5rem 0.35rem; }
  .hide-narrow { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Results page, second pass: back link, description modal, collapsible pay
   form, spread columns, bar lists and the state tile map. */
.back { margin: 0.5rem 0 0; }
.back a { text-decoration: none; color: var(--muted); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer;
           text-decoration: underline; text-decoration-color: var(--green); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.linkish:hover { color: var(--green); }
.modal { max-width: min(36rem, calc(100vw - 2rem)); border: 1px solid var(--rule); border-radius: 12px;
         background: var(--card); color: var(--ink); padding: 1.5rem; }
.modal::backdrop { background: rgb(0 0 0 / 0.45); }
.modal form { margin: 0; text-align: right; }
.stat .vs { display: block; font-size: 0.875rem; color: var(--muted); margin-top: 0.25rem; }
.up { color: var(--green); } .down { color: var(--accent); }

.pay-box { margin-top: 1.25rem; border-top: 1px solid var(--rule); padding-top: 1rem; }
.pay-box summary { cursor: pointer; font-weight: 700; color: var(--green); width: fit-content; }
.pay-box .pay-form { margin-top: 0.75rem; padding-top: 0; border-top: 0; }

/* Hover and focus tips, from data-tip. CSS only. */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; z-index: 5; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  width: max-content; max-width: 16rem; padding: 0.4rem 0.6rem; border-radius: 6px; white-space: normal; text-align: left;
  background: var(--ink); color: var(--paper); font-size: 0.8125rem; font-weight: 500; line-height: 1.35; pointer-events: none;
}

/* The spread line chart. The SVG stretches to the plot; labels and dots are
   HTML on top, placed by percent. Left padding leaves room for the y labels. */
.linechart { margin: 2rem 0 0.75rem; padding: 0 1.5rem; }
.linechart .plot { position: relative; height: 13rem; }
.linechart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.linechart .grid { stroke: var(--rule); stroke-width: 1; }
.linechart .fill { fill: var(--green-soft); }
.linechart .middle { fill: var(--green-band); opacity: 0.8; }
.linechart .drop { stroke: var(--green); stroke-width: 1; opacity: 0.5; }
.linechart .peak-label { position: absolute; transform: translate(0.7rem, -50%); font-size: 0.75rem; font-weight: 700; color: var(--green); }
.linechart .line { fill: none; stroke: var(--green); stroke-width: 3; stroke-linejoin: round; }
.linechart .ref-us { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.linechart .ref-you { stroke: var(--accent); stroke-width: 2; }
.linechart .ytick { position: absolute; right: calc(100% + 0.75rem); transform: translateY(-50%); font-size: 0.75rem; color: var(--muted);
                    white-space: nowrap; font-variant-numeric: tabular-nums; }
.linechart .ref-label { position: absolute; bottom: 100%; margin-bottom: 0.2rem; margin-left: 0.3rem; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.linechart .ref-label.flip { margin-left: 0; transform: translateX(calc(-100% - 0.3rem)); }
.linechart .ref-label.us { color: var(--muted); }
.linechart .ref-label.you { color: var(--accent); }
.linechart .dot { position: absolute; width: 0.9rem; height: 0.9rem; margin: -0.45rem 0 0 -0.45rem; border-radius: 50%;
                  background: var(--card); border: 3px solid var(--green); cursor: default; }
.linechart .dot.is-median { background: var(--green); }
.linechart .dot:hover, .linechart .dot:focus-visible { transform: scale(1.3); }
.linechart .xaxis { position: relative; height: 1.5rem; margin-top: 0.5rem; }
.linechart .xaxis span { position: absolute; transform: translateX(-50%); font-size: 0.8125rem; color: var(--muted); white-space: nowrap; }


.bars { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.bars li a { display: grid; grid-template-columns: minmax(0, 14rem) 1fr auto; gap: 0.75rem; align-items: center;
             padding: 0.3rem 0.25rem; text-decoration: none; border-radius: 6px; }
.bars li a:hover, .bars li.current a { background: var(--green-soft); color: inherit; }
.bars li.current a { font-weight: 700; }
.bar-name { font-size: 0.9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 0.75rem; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--green-band); border-radius: 999px; }
.bars li.current .bar-fill { background: var(--green); }
.bar-value { font-size: 0.875rem; font-variant-numeric: tabular-nums; }
@media (max-width: 34rem) {
  .bars li a { grid-template-columns: 1fr auto; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
}

.tilemap { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; margin: 1rem 0 0.5rem; padding: 0; list-style: none; }
.tilemap li { display: grid; }
.tile { aspect-ratio: 1; display: grid; place-items: center; border-radius: 4px; font-size: clamp(0.5625rem, 1.8vw, 0.8125rem);
        font-weight: 700; text-decoration: none; color: var(--ink); }
a.tile:hover { outline: 2px solid var(--ink); color: var(--ink); }
.tile.current { outline: 3px solid var(--accent); outline-offset: 1px; }
.shade-0 { background: var(--paper-2); color: var(--muted); }
.shade-1 { background: color-mix(in srgb, var(--green) 14%, var(--card)); }
.shade-2 { background: color-mix(in srgb, var(--green) 32%, var(--card)); }
.shade-3 { background: color-mix(in srgb, var(--green) 52%, var(--card)); }
.shade-4 { background: color-mix(in srgb, var(--green) 86%, var(--card)); color: var(--green-ink); }
.shade-5 { background: var(--green); color: var(--green-ink); }
.legend { display: flex; align-items: center; gap: 4px; font-size: 0.8125rem; color: var(--muted); margin-bottom: 0.5rem; }
.legend i { width: 1.25rem; aspect-ratio: auto; height: 0.75rem; }
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.title-row h1 { flex: 1 1 auto; }
.job-info { flex: 0 0 auto; font-size: 0.8125rem; color: var(--muted); margin-bottom: 0.65rem; }
@media (max-width: 34rem) { .title-row { flex-direction: column; align-items: flex-start; gap: 0; } .job-info { margin-bottom: 0.5rem; } }
/* The US median: a dashed line through the bar, labelled above it. */
.chart .us-tick { position: absolute; top: 0.95rem; height: 2.15rem; margin-left: -1px; border-left: 2px dashed var(--muted); }
.chart .tick-label.us { top: -0.35rem; color: var(--muted); font-weight: 600; }
/* The US median label moves up a row when the visitor's "You" marker is near it. */
.chart:has(.tick-label.us.raised) { margin-top: 3.5rem; }
.chart .tick-label.us.raised { top: -1.6rem; }
.linechart:has(.ref-label.us.raised) { margin-top: 3.25rem; }
.linechart .ref-label.us.raised { margin-bottom: 1.3rem; }
/* About, Privacy and Terms in a modal: scrolls when long, closes with the × or Esc. */
.legal-modal { width: min(40rem, calc(100vw - 2rem)); max-height: min(85vh, 48rem); overflow: auto; padding-top: 1rem; }
.legal-modal .legal h1 { font-size: 1.5rem; margin-top: 0; }
.modal-close { position: sticky; top: 0; float: right; margin: 0; }
.modal-close button { background: var(--card); border: 1px solid var(--rule); border-radius: 50%; width: 2rem; height: 2rem;
                      font-size: 1.25rem; line-height: 1; color: var(--ink); cursor: pointer; }
.modal-close button:hover { color: var(--green); border-color: var(--green); }

/* "I want to make" search and its results. */
.or { text-align: center; color: var(--muted); font-size: 0.9375rem; margin: 1.25rem 0 -0.5rem; }
.earn-line #earn-pay { flex: 0 1 9rem; }
.earn-line .toggle label { padding: 0.55rem 0.8rem; }
.joblist li a { grid-template-columns: 1fr auto auto; }
.job-emp { font-size: 0.8125rem; white-space: nowrap; }
@media (max-width: 34rem) { .joblist li a { grid-template-columns: 1fr auto; } .job-emp { display: none; } }
.more summary { cursor: pointer; font-weight: 700; color: var(--green); margin-top: 0.5rem; width: fit-content; }
/* Two even lines: "I want to make [$] [period]" / "in [place] [Find jobs]". */
.earn-line .break { flex-basis: 100%; height: 0; }
.earn-line #earn-pay { flex: 1 1 9rem; }
.earn-line > .in:first-child, .earn-line .break + .in { min-width: 7.6rem; }
@media (max-width: 600px) { .earn-line > .in:first-child, .earn-line .break + .in { min-width: 0; } }
.joblist li a { grid-template-columns: minmax(0, 1fr) 8.5rem 6rem; }
.joblist .job-emp, .joblist .bar-value { text-align: right; }
@media (max-width: 34rem) { .joblist li a { grid-template-columns: minmax(0, 1fr) 6rem; } }
/* Sortable headers over the job lists; same columns as the rows. */
.joblist-head { display: grid; grid-template-columns: minmax(0, 1fr) 8.5rem 6rem; gap: 0.75rem; padding: 0 0.25rem 0.35rem;
                border-bottom: 1px solid var(--rule); margin-top: 0.75rem; font-size: 0.8125rem; font-weight: 700; }
.joblist-head a { color: var(--muted); text-decoration: none; }
.joblist-head a:nth-child(n+2) { text-align: right; }
.joblist-head a:hover, .joblist-head a.active { color: var(--green); }
@media (max-width: 34rem) { .joblist-head { grid-template-columns: minmax(0, 1fr) 6rem; } .joblist-head a:nth-child(2) { display: none; } }
.legal ul { padding-left: 1.25rem; margin: 0 0 0.75rem; }
.legal li { margin-bottom: 0.4rem; }
.legal code { font-size: 0.9em; background: var(--paper-2); padding: 0.05rem 0.3rem; border-radius: 4px; }

/* Contrast and touch fixes from a Lighthouse pass (2026-11-08). In dark mode
   the middle map shade is lightened so dark letters read on it; in light
   mode the fourth shade is darker so its white letters read. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shade-3 { background: color-mix(in srgb, var(--green) 68%, var(--card)); color: var(--green-ink); }
  :root:not([data-theme="light"]) .shade-4 { background: color-mix(in srgb, var(--green) 80%, var(--card)); }
}
:root[data-theme="dark"] .shade-3 { background: color-mix(in srgb, var(--green) 68%, var(--card)); color: var(--green-ink); }
:root[data-theme="dark"] .shade-4 { background: color-mix(in srgb, var(--green) 80%, var(--card)); }
.card p.small a, .back a { display: inline-block; padding: 0.3rem 0; }
