/* ===========================================================================
   POLICY LAB — the theme.

   This one is a newspaper graphics desk, not an application. The reader is a
   Secretary or a Finance officer with a question they want answered in eight
   seconds: if we move the line here, how many people and how much money.

   So the rules are the rules of a printed data page:
   - Light ground, heavy ink. The opposite of Ops Wall on purpose - these two
     sit next to each other in a portfolio and must not look related.
   - One enormous number per answer, set in a display weight, with the unit
     beside it in a whisper. A Secretary reads the number; the caption is
     there for the second look.
   - The map is a hex cartogram, not a geographic outline. Thirty districts
     where each one is the same size, because the question is about people,
     and drawing Mayurbhanj eight times the size of Jharsuguda answers a
     question nobody asked.
   - A single sequential ramp for coverage, one warm accent for the thing the
     user is dragging, and nothing else coloured at all.
   =========================================================================== */
:root{
  --bg:#FCFCFA;
  --panel:#FFFFFF;
  --ink:#141518;
  --ink-2:#3E434B;
  --mut:#666C75;
  --line:#E4E5E1;
  --line-2:#CBCDC7;
  --hot:#BD431B;                 /* the live control */
  --hot-soft:#FBEDE7;
  --cool:#1C4E80;
  /* the coverage ramp: pale sand to deep ink-blue, five steps */
  --r1:#F2EDE3;
  --r2:#CFDCE3;
  --r3:#9BBCCF;
  --r4:#5A8FB4;
  --r5:#1C4E80;
  --out:#EDEDEA;                 /* a district with nobody eligible */
  --ui:var(--f-text);
  --mono:var(--f-data);
}
*{box-sizing:border-box}
body{
  margin:0;min-height:100vh;color:var(--ink);
  font:14.5px/1.55 var(--ui);-webkit-font-smoothing:antialiased;
  /* GROUND: newsprint. A warm wash from the masthead corner over a 28px
     baseline rule at 2.5% - the grid a printed data page is set on. */
  background:
    radial-gradient(64% 42% at 8% 0%,rgba(196,69,28,.055),transparent 60%),
    repeating-linear-gradient(0deg,rgba(20,21,24,.025) 0 1px,transparent 1px 28px),
    var(--bg);
}
button,input,select{font:inherit;color:inherit}

.wrap{max-width:1480px;margin:0 auto;padding:26px 30px 60px}

/* -------------------------------------------------------------- the masthead */
.mast{border-bottom:2.5px solid var(--ink);padding-bottom:13px;margin-bottom:22px}
.mast .kick{
  font:700 11px var(--ui);letter-spacing:.2em;text-transform:uppercase;
  color:var(--hot);margin-bottom:6px;
}
.mast h1{
  margin:0;font-size:clamp(25px,3.4vw,40px);line-height:1.08;letter-spacing:-.03em;
  font-weight:700;max-width:19ch;text-wrap:balance;
}
.mast p{margin:9px 0 0;font-size:15px;color:var(--ink-2);max-width:62ch;line-height:1.6}

/* ---------------------------------------------------------------- the answer */
.answer{
  display:grid;grid-template-columns:repeat(4,1fr);gap:0;margin:24px 0 26px;
  border-top:1px solid var(--line);border-bottom:1px solid var(--line);
}
.ans{padding:17px 20px 18px;border-right:1px solid var(--line)}
.ans:last-child{border-right:0}
.ans .k{
  font:700 10.5px var(--ui);letter-spacing:.15em;text-transform:uppercase;
  color:var(--mut);margin-bottom:9px;
}
.ans .v{
  font:700 clamp(29px,3.6vw,44px)/1 var(--ui);letter-spacing:-.035em;
  font-variant-numeric:tabular-nums;display:flex;align-items:baseline;gap:7px;
}
.ans .v small{font:600 15px var(--ui);letter-spacing:-.01em;color:var(--ink-2)}
.ans .d{
  font-size:12.5px;color:var(--mut);margin-top:8px;line-height:1.45;
  display:flex;align-items:center;gap:6px;
}
.ans .d .dl{font-weight:650;font-variant-numeric:tabular-nums}
.dl.up{color:var(--hot)}
.dl.dn{color:var(--cool)}
.ans.live .v{color:var(--hot)}

/* ------------------------------------------------------------------- layout */
.cols{display:grid;grid-template-columns:352px 1fr;gap:28px;align-items:start}

/* ----------------------------------------------------------------- controls */
.dials{position:sticky;top:20px}
.dial{border-bottom:1px solid var(--line);padding:16px 0}
.dial:first-child{padding-top:0}
.dial .lab{display:flex;align-items:baseline;gap:9px;margin-bottom:11px}
.dial .lab b{font-size:14px;font-weight:650}
.dial .lab .now{
  margin-left:auto;font:700 16px var(--mono);font-variant-numeric:tabular-nums;
  letter-spacing:-.02em;color:var(--hot);
}
.dial .hint{font-size:12px;color:var(--mut);line-height:1.5;margin:9px 0 0}
input[type=range]{
  -webkit-appearance:none;appearance:none;width:100%;height:22px;background:none;
  margin:0;cursor:pointer;
}
input[type=range]::-webkit-slider-runnable-track{
  height:4px;background:var(--line-2);border-radius:2px}
input[type=range]::-moz-range-track{height:4px;background:var(--line-2);border-radius:2px}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;width:20px;height:20px;border-radius:50%;
  background:var(--hot);border:3px solid #fff;box-shadow:0 1px 5px rgba(0,0,0,.28);
  margin-top:-8px;
}
input[type=range]::-moz-range-thumb{
  width:20px;height:20px;border-radius:50%;background:var(--hot);border:3px solid #fff;
  box-shadow:0 1px 5px rgba(0,0,0,.28);
}
input[type=range]:focus-visible{outline:2px solid var(--cool);outline-offset:4px}
.ticks{display:flex;justify-content:space-between;font:600 10.5px var(--mono);
  color:var(--mut);margin-top:3px}
.toggles{display:flex;flex-wrap:wrap;gap:7px;margin-top:4px}
.tg{
  padding:6px 12px;border:1px solid var(--line-2);border-radius:20px;background:#fff;
  cursor:pointer;font-size:12.5px;font-weight:600;transition:.13s;
}
.tg[aria-pressed=true]{background:var(--ink);border-color:var(--ink);color:#fff}
.tg:hover{border-color:var(--ink)}
.presets{display:grid;gap:7px;margin-top:4px}
.pre{
  text-align:left;padding:10px 12px;border:1px solid var(--line-2);border-radius:7px;
  background:#fff;cursor:pointer;transition:.13s;
}
.pre:hover{border-color:var(--ink);background:#FAFAF8}
.pre b{display:block;font-size:13px;font-weight:650;margin-bottom:2px}
.pre span{font-size:11.5px;color:var(--mut);line-height:1.45;display:block}
.pre[aria-pressed=true]{border-color:var(--hot);background:var(--hot-soft)}

/* ---------------------------------------------------------------- the map */
.mapcard{background:var(--panel);border:1px solid var(--line);border-radius:10px;
  padding:18px 20px 16px}
.mapcard .mh{display:flex;align-items:baseline;gap:12px;margin-bottom:6px;
  flex-wrap:wrap}
.mapcard h2{margin:0;font-size:17px;font-weight:700;letter-spacing:-.02em}
.mapcard .mh p{margin:0;font-size:12.5px;color:var(--mut)}
.mapcard .mh .leg{margin-left:auto;display:flex;align-items:center;gap:8px;
  font-size:11.5px;color:var(--mut)}
.mapcard .mh .leg i{width:22px;height:11px;display:block;border:1px solid rgba(0,0,0,.09)}
.hexes{width:100%;height:auto;display:block;margin-top:6px}
.hex{cursor:pointer;transition:opacity .12s}
.hex polygon{stroke:#fff;stroke-width:1.6;transition:fill .2s}
.hex:hover polygon{stroke:var(--ink);stroke-width:2.2}
.hex.on polygon{stroke:var(--hot);stroke-width:3}
.hex text{font:700 9.5px var(--ui);pointer-events:none;letter-spacing:.02em}
.hex .sub{font:600 8px var(--mono);opacity:.72}

/* ------------------------------------------------------------- the margin */
.margin{margin-top:22px;display:grid;grid-template-columns:1fr 1fr;gap:20px}
.card{background:var(--panel);border:1px solid var(--line);border-radius:10px;
  padding:17px 19px}
.card h3{margin:0 0 3px;font-size:15px;font-weight:650;letter-spacing:-.015em}
.card .cs{margin:0 0 13px;font-size:12.5px;color:var(--mut);line-height:1.5}
table.tb{width:100%;border-collapse:collapse;font-size:13px}
table.tb th{
  text-align:left;font:700 10.5px var(--ui);letter-spacing:.11em;text-transform:uppercase;
  color:var(--mut);padding:0 8px 7px 0;border-bottom:1px solid var(--line);
}
table.tb th.n,table.tb td.n{text-align:right;padding-right:0}
table.tb td{padding:7px 8px 7px 0;border-bottom:1px solid #F2F2EF;
  font-variant-numeric:tabular-nums}
table.tb td.n{font-family:var(--mono);font-size:12.5px}
table.tb tr:last-child td{border-bottom:0}
.hh{display:flex;gap:10px;padding:9px 0;border-bottom:1px solid #F2F2EF;
  align-items:baseline}
.hh:last-child{border-bottom:0}
.hh .nm{font-weight:600;font-size:13px;min-width:0;flex:1}
.hh .nm span{display:block;font-weight:400;font-size:11.5px;color:var(--mut)}
.hh .st{font:700 11px var(--ui);letter-spacing:.06em;text-transform:uppercase;
  padding:3px 8px;border-radius:3px;flex:none}
.st-in{background:#E7F0E9;color:#1B6B3A}
.st-out{background:var(--hot-soft);color:var(--hot)}
.why{font-size:11.5px;color:var(--mut);flex:1 1 100%;margin-top:-4px}

.foot{margin-top:24px;font-size:12px;color:var(--mut);line-height:1.6;
  border-top:1px solid var(--line);padding-top:14px;max-width:80ch}
.foot b{color:var(--ink-2)}

@media(max-width:1080px){
  .cols{grid-template-columns:1fr}
  .dials{position:static}
  .answer{grid-template-columns:repeat(2,1fr)}
  .ans:nth-child(2){border-right:0}
  .ans:nth-child(1),.ans:nth-child(2){border-bottom:1px solid var(--line)}
  .margin{grid-template-columns:1fr}
}
@media(max-width:620px){
  .wrap{padding:20px 16px 44px}
  .answer{grid-template-columns:1fr}
  .ans{border-right:0;border-bottom:1px solid var(--line)}
  .ans:last-child{border-bottom:0}
  .mapcard{padding:14px}
  .mapcard .mh .leg{margin-left:0;width:100%}
}
@media(prefers-reduced-motion:reduce){*{transition:none!important}}

/* ------------------------------------------------------- touch, on a phone
   A 22px slider cannot be dragged with a thumb. The track stays 4px; the
   input grows round it. */
@media(max-width:620px) and (pointer:coarse){
  input[type=range]{height:44px}
  input[type=range]::-webkit-slider-thumb{margin-top:-8px}
  .tg{min-height:44px}
  .pre{min-height:56px}
}
