krz/world-incarceration

An interactive map of world incarceration statistics. data-viz incarceration interactive maps

Commit 92c574a2f4

92c574a2f415f50115831e4a125ce1ca95135be3

parent: 623ae07eba

Verified · cmc

cmc <hello@cleberg.net> · 2026-04-18 00:51 UTC

revamp UI/UX with dark design system and modern layout

Replace Bootstrap color utilities and legacy layout patterns with a
cohesive dark-mode design system. Key changes:

- CSS: full rewrite using custom property tokens (--bg, --surface,
  --accent, --text-muted, etc.), Inter font, glassmorphism modals
  (backdrop-filter + semi-transparent backgrounds), and a fixed
  pill-bar metric selector centered at the bottom of the viewport
- Navbar: unified nav-icon-btn style for all icon buttons, removed
  the gradient-toggle collapse button, settings dropdown aligned end
- Metric bar: promoted from Bootstrap collapse to always-visible
  fixed pill bar; metric-btn replaces btn; active-metric pre-applied
  to match default currentMetric
- Modals: removed inline bg overrides, h4 → h5, custom close buttons
  (nav-icon-btn + SVG), btn-modal-primary / btn-modal-ghost / ref-btn
  replace Bootstrap color variants
- Dropped Font Awesome dependency (all icons are inline SVGs)

Layout: unified · split

assets/css/app.css +385 −88
@@ -1,145 +1,442 @@
1html {
1@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');
2
3/* ── Design tokens ───────────────────────────────────────────────────── */
4:root {
5 --bg: #0d0d14;
6 --surface: #13131e;
7 --surface-2: #1c1c2a;
8 --surface-3: #252535;
9 --border: rgba(255, 255, 255, 0.08);
10 --border-2: rgba(255, 255, 255, 0.14);
11 --accent: #24ab48;
12 --accent-dim: rgba(36, 171, 72, 0.14);
13 --accent-glow: rgba(36, 171, 72, 0.25);
14 --text: #e2e2ef;
15 --text-muted: #5e5e78;
16 --text-soft: #9898b0;
17 --danger: #ef4444;
18 --danger-dim: rgba(239, 68, 68, 0.12);
19 --nav-h: 52px;
20 --radius-sm: 6px;
21 --radius: 10px;
22 --radius-lg: 14px;
23 --radius-pill: 100px;
24 --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
25 --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
26 --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.7);
27}
28
29/* ── Reset ───────────────────────────────────────────────────────────── */
30*, *::before, *::after { box-sizing: border-box; }
31
32html, body {
233 height: 100%;
334 margin: 0;
35 background: var(--bg);
36 color: var(--text);
37 font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
38 font-size: 14px;
39 line-height: 1.5;
40 -webkit-font-smoothing: antialiased;
41 -moz-osx-font-smoothing: grayscale;
442}
543
6body {
7 background: #161616;
44a { text-decoration: none; color: inherit; }
45
46/* Bootstrap resets we override */
47.btn { border-radius: var(--radius-sm) !important; }
48.modal-content { border-radius: var(--radius-lg) !important; }
49
50/* ── Navbar ──────────────────────────────────────────────────────────── */
51.navbar {
52 height: var(--nav-h);
53 min-height: var(--nav-h);
54 padding: 0 20px;
55 background: rgba(13, 13, 20, 0.9);
56 backdrop-filter: blur(20px);
57 -webkit-backdrop-filter: blur(20px);
58 border-bottom: 1px solid var(--border);
59 position: sticky;
60 top: 0;
61 z-index: 1000;
62 margin-bottom: 0;
863}
964
10a,
11.fa-question-circle {
12 text-decoration: none;
65.navbar-brand {
66 font-size: 14px;
67 font-weight: 600;
68 letter-spacing: 0.02em;
69 color: var(--text) !important;
70 opacity: 0.9;
1371}
1472
15.btn,
16.nav-link,
17.dropdown-menu,
18.dropdown-item,
19.modal-content {
20 border-radius: 0;
73.navbar-nav {
74 gap: 4px;
75 align-items: center;
2176}
2277
23.navbar {
24 background: #161616;
25 margin-bottom: 0;
78/* ── Navbar icon buttons ─────────────────────────────────────────────── */
79.nav-icon-btn {
80 width: 36px;
81 height: 36px;
82 padding: 0;
83 display: flex;
84 align-items: center;
85 justify-content: center;
86 background: transparent;
87 border: 1px solid transparent;
88 border-radius: var(--radius-sm) !important;
89 color: var(--text-muted);
90 transition: background 0.15s, color 0.15s, border-color 0.15s;
91 cursor: pointer;
92}
93
94.nav-icon-btn svg path { fill: currentColor; }
95.navbar path { fill: currentColor; }
96
97.nav-icon-btn:hover {
98 background: var(--surface-2);
99 border-color: var(--border);
100 color: var(--text);
101}
102
103.nav-icon-btn:focus-visible {
104 outline: 2px solid var(--accent);
105 outline-offset: 2px;
106}
107
108/* ── Dropdown ────────────────────────────────────────────────────────── */
109.dropdown-menu {
110 background: var(--surface) !important;
111 border: 1px solid var(--border-2) !important;
112 border-radius: var(--radius) !important;
113 padding: 6px !important;
114 box-shadow: var(--shadow) !important;
115 min-width: 160px;
116}
117
118.dropdown-item {
119 border-radius: var(--radius-sm) !important;
120 padding: 9px 12px !important;
121 font-size: 13px;
122 font-weight: 500;
123 color: var(--text-soft) !important;
124 transition: background 0.12s, color 0.12s;
125}
126
127.dropdown-item:hover, .dropdown-item:focus {
128 background: var(--surface-2) !important;
129 color: var(--text) !important;
26130}
27131
28.modal-title path,
29.navbar path {
30 fill: white;
132/* ── Navbar toggler (mobile) ─────────────────────────────────────────── */
133.navbar-toggler {
134 border: 1px solid var(--border) !important;
135 border-radius: var(--radius-sm) !important;
136 padding: 6px 10px;
31137}
32138
33#settings-icon {
34 fill: black;
139.navbar-toggler-icon {
140 background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28226,226,239,0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
35141}
36142
143/* ── Map container ───────────────────────────────────────────────────── */
144#map-container {
145 height: calc(100vh - var(--nav-h));
146 width: 100%;
147 background: var(--bg);
148 position: relative;
149}
150
151/* ── Metric pill bar ─────────────────────────────────────────────────── */
152#gbar {
153 position: fixed;
154 bottom: 28px;
155 left: 50%;
156 transform: translateX(-50%);
157 display: flex !important;
158 align-items: center;
159 gap: 3px;
160 padding: 5px;
161 background: rgba(19, 19, 30, 0.94);
162 backdrop-filter: blur(20px);
163 -webkit-backdrop-filter: blur(20px);
164 border: 1px solid var(--border-2);
165 border-radius: var(--radius-pill);
166 box-shadow: var(--shadow), 0 2px 8px rgba(0, 0, 0, 0.4);
167 z-index: 500;
168 white-space: nowrap;
169 /* allow horizontal scroll on very small screens */
170 max-width: calc(100vw - 32px);
171 overflow-x: auto;
172 scrollbar-width: none;
173}
174
175#gbar::-webkit-scrollbar { display: none; }
176
177.metric-btn {
178 padding: 7px 18px;
179 border: none;
180 border-radius: var(--radius-pill);
181 background: transparent;
182 color: var(--text-muted);
183 font-family: inherit;
184 font-size: 12px;
185 font-weight: 500;
186 letter-spacing: 0.025em;
187 cursor: pointer;
188 transition: background 0.15s, color 0.15s;
189 white-space: nowrap;
190}
191
192.metric-btn:hover {
193 background: var(--surface-3);
194 color: var(--text-soft);
195}
196
197.metric-btn.active-metric {
198 background: var(--accent);
199 color: #000;
200 font-weight: 600;
201}
202
203/* ── Tooltip ─────────────────────────────────────────────────────────── */
204.map-tooltip {
205 position: fixed;
206 background: rgba(13, 13, 20, 0.96);
207 color: var(--text);
208 padding: 9px 14px;
209 border: 1px solid var(--border-2);
210 border-radius: var(--radius);
211 pointer-events: none;
212 font-size: 13px;
213 font-weight: 500;
214 font-family: 'Inter', system-ui, sans-serif;
215 opacity: 0;
216 transition: opacity 0.1s;
217 z-index: 9999;
218 box-shadow: var(--shadow);
219}
220
221/* ── Modals ──────────────────────────────────────────────────────────── */
37222.modal-content {
38 border: 1px solid #fff;
223 background: rgba(13, 13, 20, 0.98) !important;
224 border: 1px solid var(--border-2) !important;
225 border-radius: var(--radius-lg) !important;
226 overflow: hidden;
227 box-shadow: var(--shadow-lg);
228 color: var(--text);
229 backdrop-filter: blur(24px);
230 -webkit-backdrop-filter: blur(24px);
39231}
40232
41233.modal-header {
42 background-color: #24ab48;
43 border-bottom: #000;
44 color: white;
234 background: transparent !important;
235 border-bottom: 1px solid var(--border) !important;
236 padding: 20px 24px;
237}
238
239.modal-title {
240 font-size: 15px !important;
241 font-weight: 600;
242 color: var(--text) !important;
243 letter-spacing: 0.01em;
244}
245
246/* Country modal — accent title */
247#country-modal-title {
248 color: var(--accent) !important;
249}
250
251.modal-body {
252 background: transparent !important;
253 padding: 24px !important;
254 color: var(--text);
45255}
46256
47.modal-body,
48257.modal-footer {
49 background-color: #000;
50 color: #ffffff;
258 background: transparent !important;
259 border-top: 1px solid var(--border) !important;
260 padding: 16px 24px !important;
261 gap: 8px;
51262}
52263
53.alert {
54 background-color: rgb(66, 133, 244);
55 background-color: rgba(66, 133, 244, 0.5);
56 color: #ffffff;
57 margin: 1.5rem auto;
58 width: 90%;
264/* Modal body typography */
265.modal-body p {
266 margin-bottom: 14px;
267 font-size: 14px;
268 line-height: 1.7;
59269}
60270
61#gradientbtn {
62 background-color: #9966ff;
63 color: #ffffff;
271.modal-body p:last-child { margin-bottom: 0; }
272
273.modal-body p b {
274 color: var(--text-soft);
275 font-weight: 500;
276 margin-right: 4px;
64277}
65278
66#totPop,
67#perCapita,
68#women,
69#juveniles,
70#occupancy {
71 background-color: #9966ff;
72 color: #ffffff;
73 margin: 5px;
74 padding: 10px;
279.modal-body hr {
280 border: none;
281 border-top: 1px solid var(--border);
282 margin: 20px 0;
283}
284
285/* ── Modal buttons ───────────────────────────────────────────────────── */
286.btn-modal-primary {
287 padding: 9px 20px;
288 background: var(--accent);
289 color: #000;
290 border: none;
291 border-radius: var(--radius-sm) !important;
292 font-family: inherit;
293 font-size: 13px;
294 font-weight: 600;
295 cursor: pointer;
296 transition: opacity 0.15s;
297}
298
299.btn-modal-primary:hover { opacity: 0.85; }
300
301.btn-modal-ghost {
302 padding: 9px 20px;
303 background: transparent;
304 color: var(--text-soft);
305 border: 1px solid var(--border-2);
306 border-radius: var(--radius-sm) !important;
307 font-family: inherit;
308 font-size: 13px;
309 font-weight: 500;
310 cursor: pointer;
311 transition: background 0.15s, color 0.15s;
312}
313
314.btn-modal-ghost:hover {
315 background: var(--surface-2);
316 color: var(--text);
317}
318
319.btn-modal-link {
320 padding: 9px 20px;
321 background: transparent;
322 color: var(--accent);
323 border: none;
324 border-radius: var(--radius-sm) !important;
325 font-family: inherit;
326 font-size: 13px;
327 font-weight: 500;
328 cursor: pointer;
329 text-decoration: none;
330 display: inline-flex;
331 align-items: center;
332}
333
334/* ── Alert ───────────────────────────────────────────────────────────── */
335.alert-danger {
336 background: var(--danger-dim) !important;
337 border: 1px solid rgba(239, 68, 68, 0.25) !important;
338 border-radius: var(--radius) !important;
339 color: #fca5a5 !important;
340 padding: 12px 16px;
341 margin-bottom: 16px;
342 font-size: 13px;
75343}
76344
345.text-danger { color: var(--danger) !important; }
346
347/* ── Selects ─────────────────────────────────────────────────────────── */
77348select {
78 -webkit-appearance: none;
79 -moz-appearance: none;
80349 appearance: none;
81 background: url(../images/down-arrow.png) no-repeat #24ab48;
82 background-color: #000;
83 background-position: 95%;
84 border: 1px solid #24ab48;
85 border-radius: 0;
86 color: white;
350 -webkit-appearance: none;
351 background-color: var(--surface-2);
352 background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%235e5e78' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
353 background-repeat: no-repeat;
354 background-position: right 12px center;
355 border: 1px solid var(--border-2);
356 border-radius: var(--radius);
357 color: var(--text);
87358 cursor: pointer;
88 font-size: 16px;
89 overflow: hidden;
90 padding: 0.5rem;
359 font-family: inherit;
360 font-size: 13px;
361 padding: 10px 36px 10px 12px;
91362 width: 100%;
363 transition: border-color 0.15s;
92364}
93365
94select::-ms-expand {
95 display: none;
366select:focus {
367 outline: none;
368 border-color: var(--accent);
369 box-shadow: 0 0 0 3px var(--accent-dim);
96370}
97371
372select option { background: var(--surface); }
373
374/* ── Table ───────────────────────────────────────────────────────────── */
98375.table {
99 color: #ddd;
376 color: var(--text);
377 border-collapse: collapse;
378 width: 100%;
379 font-size: 13px;
100380}
101381
102th {
103 color: #fff;
104 font-size: 16px;
382.table th {
383 color: var(--text-muted);
384 font-size: 11px;
385 font-weight: 600;
386 text-transform: uppercase;
387 letter-spacing: 0.07em;
388 padding: 0 12px 10px;
389 border-bottom: 1px solid var(--border-2);
105390}
106391
107#map-container {
108 height: calc(100vh - 56px);
109 width: 100%;
110 background: #161616;
392.table td {
393 padding: 12px;
394 border-bottom: 1px solid rgba(255, 255, 255, 0.04);
395 vertical-align: top;
396 line-height: 1.5;
111397}
112398
113.map-tooltip {
114 position: absolute;
115 background: #1a1a1a;
116 color: #fff;
117 padding: 8px 12px;
118 border: 1px solid #24ab48;
119 border-radius: 0;
120 pointer-events: none;
121 font-size: 13px;
122 opacity: 0;
123 transition: opacity 0.1s;
124 z-index: 9999;
399.table td:first-child {
400 color: var(--text-soft);
401 font-size: 12px;
402 font-weight: 500;
403 white-space: nowrap;
404 padding-right: 20px;
125405}
126406
127/* chart containers inside graph modal */
407.table tbody tr:last-child td { border-bottom: none; }
408
409/* ── Chart containers ────────────────────────────────────────────────── */
128410#myChart2,
129411#myNextChart {
130 min-height: 300px;
131 background: #000;
132}
133
134/* active metric button highlight */
135.active-metric {
136 outline: 2px solid #fff;
412 min-height: 340px;
413 background: transparent;
137414}
138415
139/* D3 axis lines */
416/* D3 chart axis styling */
140417#myChart2 .domain,
141418#myNextChart .domain,
142419#myChart2 .tick line,
143420#myNextChart .tick line {
144 stroke: #555;
421 stroke: var(--border-2);
422}
423
424/* ── Info modal reference links ──────────────────────────────────────── */
425.modal-body .ref-btn {
426 display: block;
427 padding: 10px 16px;
428 background: var(--surface-2);
429 border: 1px solid var(--border);
430 border-radius: var(--radius);
431 color: var(--text-soft);
432 font-size: 13px;
433 font-weight: 500;
434 text-align: center;
435 transition: background 0.15s, color 0.15s, border-color 0.15s;
436}
437
438.modal-body .ref-btn:hover {
439 background: var(--surface-3);
440 border-color: var(--border-2);
441 color: var(--text);
145442}
index.html +99 −85
@@ -24,17 +24,23 @@
2424 <link rel="manifest" href="./assets/images/icons/manifest.json" />
2525 <meta name="msapplication-TileColor" content="#ffffff" />
2626 <meta name="msapplication-TileImage" content="./assets/images/icons/ms-icon-144x144.png" />
27 <meta name="theme-color" content="#ffffff" />
27 <meta name="theme-color" content="#0d0d14" />
28
29 <!-- Fonts -->
30 <link rel="preconnect" href="https://fonts.googleapis.com" />
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap" rel="stylesheet" />
33
2834 <link rel="stylesheet" href="./assets/css/bootstrap-5.0.0.min.css" />
29 <link rel="stylesheet" href="./assets/css/fontawesome-5.1.10.min.css" />
3035 <link rel="stylesheet" href="./assets/css/app.css" />
3136 </head>
3237
3338 <body>
34 <!-- navbar -->
35 <nav class="navbar navbar-expand-lg navbar-dark">
39 <!-- ── Navbar ──────────────────────────────────────────────────────── -->
40 <nav class="navbar navbar-expand-lg">
3641 <div class="container-fluid">
37 <a class="navbar-brand mx-2" href="./">World Incarceration</a>
42 <a class="navbar-brand" href="./">World Incarceration</a>
43
3844 <button
3945 class="navbar-toggler"
4046 type="button"
@@ -46,53 +52,41 @@
4652 >
4753 <span class="navbar-toggler-icon"></span>
4854 </button>
55
4956 <div class="collapse navbar-collapse" id="navbarSupportedContent">
5057 <ul class="navbar-nav ms-auto me-0 mb-2 mb-lg-0">
5158
5259 <!-- settings dropdown -->
5360 <li class="nav-item dropdown">
5461 <button
55 class="btn btn-warning"
62 class="nav-icon-btn"
5663 data-bs-toggle="dropdown"
5764 aria-expanded="false"
65 title="Settings"
5866 >
59 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
60 <path id="settings-icon" d="M24 14.187v-4.374c-2.148-.766-2.726-.802-3.027-1.529-.303-.729.083-1.169 1.059-3.223l-3.093-3.093c-2.026.963-2.488 1.364-3.224 1.059-.727-.302-.768-.889-1.527-3.027h-4.375c-.764 2.144-.8 2.725-1.529 3.027-.752.313-1.203-.1-3.223-1.059l-3.093 3.093c.977 2.055 1.362 2.493 1.059 3.224-.302.727-.881.764-3.027 1.528v4.375c2.139.76 2.725.8 3.027 1.528.304.734-.081 1.167-1.059 3.223l3.093 3.093c1.999-.95 2.47-1.373 3.223-1.059.728.302.764.88 1.529 3.027h4.374c.758-2.131.799-2.723 1.537-3.031.745-.308 1.186.099 3.215 1.062l3.093-3.093c-.975-2.05-1.362-2.492-1.059-3.223.3-.726.88-.763 3.027-1.528zm-4.875.764c-.577 1.394-.068 2.458.488 3.578l-1.084 1.084c-1.093-.543-2.161-1.076-3.573-.49-1.396.581-1.79 1.693-2.188 2.877h-1.534c-.398-1.185-.791-2.297-2.183-2.875-1.419-.588-2.507-.045-3.579.488l-1.083-1.084c.557-1.118 1.066-2.18.487-3.58-.579-1.391-1.691-1.784-2.876-2.182v-1.533c1.185-.398 2.297-.791 2.875-2.184.578-1.394.068-2.459-.488-3.579l1.084-1.084c1.082.538 2.162 1.077 3.58.488 1.392-.577 1.785-1.69 2.183-2.875h1.534c.398 1.185.792 2.297 2.184 2.875 1.419.588 2.506.045 3.579-.488l1.084 1.084c-.556 1.121-1.065 2.187-.488 3.58.577 1.391 1.689 1.784 2.875 2.183v1.534c-1.188.398-2.302.791-2.877 2.183zm-7.125-5.951c1.654 0 3 1.346 3 3s-1.346 3-3 3-3-1.346-3-3 1.346-3 3-3zm0-2c-2.762 0-5 2.238-5 5s2.238 5 5 5 5-2.238 5-5-2.238-5-5-5z"/>
67 <!-- gear icon -->
68 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="currentColor">
69 <path d="M24 14.187v-4.374c-2.148-.766-2.726-.802-3.027-1.529-.303-.729.083-1.169 1.059-3.223l-3.093-3.093c-2.026.963-2.488 1.364-3.224 1.059-.727-.302-.768-.889-1.527-3.027h-4.375c-.764 2.144-.8 2.725-1.529 3.027-.752.313-1.203-.1-3.223-1.059l-3.093 3.093c.977 2.055 1.362 2.493 1.059 3.224-.302.727-.881.764-3.027 1.528v4.375c2.139.76 2.725.8 3.027 1.528.304.734-.081 1.167-1.059 3.223l3.093 3.093c1.999-.95 2.47-1.373 3.223-1.059.728.302.764.88 1.529 3.027h4.374c.758-2.131.799-2.723 1.537-3.031.745-.308 1.186.099 3.215 1.062l3.093-3.093c-.975-2.05-1.362-2.492-1.059-3.223.3-.726.88-.763 3.027-1.528zm-4.875.764c-.577 1.394-.068 2.458.488 3.578l-1.084 1.084c-1.093-.543-2.161-1.076-3.573-.49-1.396.581-1.79 1.693-2.188 2.877h-1.534c-.398-1.185-.791-2.297-2.183-2.875-1.419-.588-2.507-.045-3.579.488l-1.083-1.084c.557-1.118 1.066-2.18.487-3.58-.579-1.391-1.691-1.784-2.876-2.182v-1.533c1.185-.398 2.297-.791 2.875-2.184.578-1.394.068-2.459-.488-3.579l1.084-1.084c1.082.538 2.162 1.077 3.58.488 1.392-.577 1.785-1.69 2.183-2.875h1.534c.398 1.185.792 2.297 2.184 2.875 1.419.588 2.506.045 3.579-.488l1.084 1.084c-.556 1.121-1.065 2.187-.488 3.58.577 1.391 1.689 1.784 2.875 2.183v1.534c-1.188.398-2.302.791-2.877 2.183zm-7.125-5.951c1.654 0 3 1.346 3 3s-1.346 3-3 3-3-1.346-3-3 1.346-3 3-3zm0-2c-2.762 0-5 2.238-5 5s2.238 5 5 5 5-2.238 5-5-2.238-5-5-5z"/>
6170 </svg>
6271 </button>
63 <div class="dropdown-menu">
64 <a class="dropdown-item" href="#" data-action="labels">Labels</a>
72 <div class="dropdown-menu dropdown-menu-end">
73 <a class="dropdown-item" href="#" data-action="labels">Toggle Labels</a>
6574 <a class="dropdown-item" href="#" data-action="reset">Reset Map</a>
6675 </div>
6776 </li>
6877
69 <!-- gradient toggle -->
70 <li class="nav-item">
71 <button
72 id="gradientbtn"
73 type="button"
74 class="btn selected"
75 data-bs-toggle="collapse"
76 data-bs-target="#gbar"
77 title="Gradient Maps"
78 >
79 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
80 <path d="M13.144 8.171c-.035-.066.342-.102.409-.102.074.009-.196.452-.409.102zm-2.152-3.072l.108-.031c.064.055-.072.095-.051.136.086.155.021.248.008.332-.014.085-.104.048-.149.093-.053.066.258.075.262.085.011.033-.375.089-.304.171.096.136.824-.195.708-.176.225-.113.029-.125-.097-.19-.043-.215-.079-.547-.213-.68l.088-.102c-.206-.299-.36.362-.36.362zm13.008 6.901c0 6.627-5.373 12-12 12-6.628 0-12-5.373-12-12s5.372-12 12-12c6.627 0 12 5.373 12 12zm-8.31-5.371c-.006-.146-.19-.284-.382-.031-.135.174-.111.439-.184.557-.104.175.567.339.567.174.025-.277.732-.063.87-.025.248.069.643-.226.211-.381-.355-.13-.542-.269-.574-.523 0 0 .188-.176.106-.166-.218.027-.614.786-.614.395zm6.296 5.371c0-1.035-.177-2.08-.357-2.632-.058-.174-.189-.312-.359-.378-.256-.1-1.337.597-1.5.254-.107-.229-.324.146-.572.008-.12-.066-.454-.515-.605-.46-.309.111.474.964.688 1.076.201-.152.852-.465.992-.038.268.804-.737 1.685-1.251 2.149-.768.694-.624-.449-1.147-.852-.275-.211-.272-.66-.55-.815-.124-.07-.693-.725-.688-.813l-.017.166c-.094.071-.294-.268-.315-.321 0 .295.48.765.639 1.001.271.405.416.995.748 1.326.178.178.858.914 1.035.898.193-.017.803-.458.911-.433.644.152-1.516 3.205-1.721 3.583-.169.317.138 1.101.113 1.476-.029.433-.37.573-.693.809-.346.253-.265.745-.556.925-.517.318-.889 1.353-1.623 1.348-.216-.001-1.14.36-1.261.007-.094-.256-.22-.45-.353-.703-.13-.248-.015-.505-.173-.724-.109-.152-.475-.497-.508-.677-.002-.155.117-.626.28-.708.229-.117.044-.458.016-.656-.048-.354-.267-.646-.53-.851-.389-.299-.188-.537-.097-.964 0-.204-.124-.472-.398-.392-.564.164-.393-.44-.804-.413-.296.021-.538.209-.813.292-.346.104-.7-.082-1.042-.125-1.407-.178-1.866-1.786-1.499-2.946.037-.19-.114-.542-.048-.689.158-.352.48-.747.762-1.014.158-.15.361-.112.547-.229.287-.181.291-.553.572-.781.4-.325.946-.318 1.468-.388.278-.037 1.336-.266 1.503-.06 0 .038.191.604-.019.572.433.023 1.05.749 1.461.579.211-.088.134-.736.567-.423.262.188 1.436.272 1.68.069.15-.124.234-.93.052-1.021.116.115-.611.124-.679.098-.12-.044-.232.114-.425.025.116.055-.646-.354-.218-.667-.179.131-.346-.037-.539.107-.133.108.062.18-.128.274-.302.153-.53-.525-.644-.602-.116-.076-1.014-.706-.77-.295l.789.785c-.039.025-.207-.286-.207-.059.053-.135.02.579-.104.347-.055-.089.09-.139.006-.268 0-.085-.228-.168-.272-.226-.125-.155-.457-.497-.637-.579-.05-.023-.764.087-.824.11-.07.098-.13.201-.179.311-.148.055-.287.126-.419.214l-.157.353c-.068.061-.765.291-.769.3.029-.075-.487-.171-.453-.321.038-.165.213-.68.168-.868-.048-.197 1.074.284 1.146-.235.029-.225.046-.487-.313-.525.068.008.695-.246.799-.36.146-.168.481-.442.724-.442.284 0 .223-.413.354-.615.131.053-.07.376.087.507-.01-.103.445.057.489.033.104-.054.684-.022.594-.294-.1-.277.051-.195.181-.253-.022.009.34-.619.402-.413-.043-.212-.421.074-.553.063-.305-.024-.176-.52-.061-.665.089-.115-.243-.256-.247-.036-.006.329-.312.627-.241 1.064.108.659-.735-.159-.809-.114-.28.17-.509-.214-.364-.444.148-.235.505-.224.652-.476.104-.178.225-.385.385-.52.535-.449.683-.09 1.216-.041.521.048.176.124.104.324-.069.19.286.258.409.099.07-.092.229-.323.298-.494.089-.222.901-.197.334-.536-.374-.223-2.004-.672-3.096-.672-.236 0-.401.263-.581.412-.356.295-1.268.874-1.775.698-.519-.179-1.63.66-1.808.666-.065.004.004-.634.358-.681-.153.023 1.247-.707 1.209-.859-.046-.18-2.799.822-2.676 1.023.059.092.299.092-.016.294-.18.109-.372.801-.541.801-.505.221-.537-.435-1.099.409l-.894.36c-1.328 1.411-2.247 3.198-2.58 5.183-.013.079.334.226.379.28.112.134.112.712.167.901.138.478.479.744.74 1.179.154.259.41.914.329 1.186.108-.178 1.07.815 1.246 1.022.414.487.733 1.077.061 1.559-.217.156.33 1.129.048 1.368l-.361.093c-.356.219-.195.756.021.982 1.818 1.901 4.38 3.087 7.22 3.087 5.517 0 9.989-4.472 9.989-9.989zm-11.507-6.357c.125-.055.293-.053.311-.22.015-.148.044-.046.08-.1.035-.053-.067-.138-.11-.146-.064-.014-.108.069-.149.104l-.072.019-.068.087.008.048-.087.106c-.085.084.002.139.087.102z"/>
81 </svg>
82 </button>
83 </li>
84
8578 <!-- compare -->
8679 <li class="nav-item">
8780 <button
8881 id="comparebtn"
8982 type="button"
90 class="btn btn-success text-white"
83 class="nav-icon-btn"
9184 data-bs-toggle="modal"
9285 data-bs-target="#compareModal"
93 title="Compare"
86 title="Compare Countries"
9487 >
95 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
88 <!-- compare arrows icon -->
89 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="currentColor">
9690 <path d="M6 11v-4l-6 5 6 5v-4h12v4l6-5-6-5v4z"/>
9791 </svg>
9892 </button>
@@ -103,12 +97,13 @@
10397 <button
10498 id="graphsbtn"
10599 type="button"
106 class="btn btn-secondary text-dark"
100 class="nav-icon-btn"
107101 data-bs-toggle="modal"
108102 data-bs-target="#graphModal"
109 title="Graphs"
103 title="Charts"
110104 >
111 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
105 <!-- pie/chart icon -->
106 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="currentColor">
112107 <path d="M13.012 5.007v-1.668l2.802-2.771c.409.136.809.293 1.197.471l-3.999 3.968zm7.089-1.93l-7.089 7.058v.853h.877l7.044-7.076c-.263-.292-.541-.57-.832-.835zm-7.089-1.468l1.437-1.406c-.46-.094-.96-.163-1.437-.203v1.609zm10.789 7.962l-1.386 1.417h1.585c-.04-.47-.106-.964-.199-1.417zm-.363-1.366c-.135-.41-.292-.81-.469-1.199l-3.951 3.982h1.668l2.752-2.783zm-1.063-2.337c-.205-.346-.426-.682-.664-1.004l-6.093 6.124h1.668l5.089-5.12zm-3.225-3.57c-.322-.238-.657-.459-1.003-.665l-5.135 5.104v1.668l6.138-6.107zm-8.15 10.702v-13c-6.161.519-11 5.683-11 11.978 0 6.639 5.382 12.022 12.021 12.022 6.296 0 11.46-4.839 11.979-11h-13z"/>
113108 </svg>
114109 </button>
@@ -119,12 +114,13 @@
119114 <button
120115 id="infobtn"
121116 type="button"
122 class="btn btn-primary text-white"
117 class="nav-icon-btn"
123118 data-bs-toggle="modal"
124119 data-bs-target="#infoModal"
125120 title="Information"
126121 >
127 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
122 <!-- info circle icon -->
123 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="currentColor">
128124 <path d="M13.25 7c0 .69-.56 1.25-1.25 1.25s-1.25-.56-1.25-1.25.56-1.25 1.25-1.25 1.25.56 1.25 1.25zm10.75 5c0 6.627-5.373 12-12 12s-12-5.373-12-12 5.373-12 12-12 12 5.373 12 12zm-2 0c0-5.514-4.486-10-10-10s-10 4.486-10 10 4.486 10 10 10 10-4.486 10-10zm-13-2v2h2v6h2v-8h-4z"/>
129125 </svg>
130126 </button>
@@ -135,12 +131,13 @@
135131 <button
136132 id="alertbtn"
137133 type="button"
138 class="btn btn-danger text-white"
134 class="nav-icon-btn"
139135 data-bs-toggle="modal"
140136 data-bs-target="#alertModal"
141137 title="Precautions"
142138 >
143 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
139 <!-- warning triangle icon -->
140 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="currentColor">
144141 <path d="M12 5.177l8.631 15.823h-17.262l8.631-15.823zm0-4.177l-12 22h24l-12-22zm-1 9h2v6h-2v-6zm1 9.75c-.689 0-1.25-.56-1.25-1.25s.561-1.25 1.25-1.25 1.25.56 1.25 1.25-.561 1.25-1.25 1.25z"/>
145142 </svg>
146143 </button>
@@ -151,44 +148,51 @@
151148 </div>
152149 </nav>
153150
154 <!-- gradient bar menu -->
155 <nav id="gbar" class="collapse-navbar collapse">
156 <div class="d-flex flex-row-reverse">
157 <button id="totPop" type="button" class="btn" title="Total Prison Populations">Total Prison Population</button>
158 <button id="perCapita" type="button" class="btn" title="Prisoners Per Capita">Prisoners Per Capita</button>
159 <button id="women" type="button" class="btn" title="Percent Women Imprisoned">Percent Women Imprisoned</button>
160 <button id="juveniles" type="button" class="btn" title="Percent Juveniles Imprisoned">Percent Juveniles Imprisoned</button>
161 <button id="occupancy" type="button" class="btn" title="Prison Occupancy Level">Prison Occupancy Level</button>
162 </div>
163 </nav>
151 <!-- ── Map ─────────────────────────────────────────────────────────── -->
152 <div id="map-container"></div>
164153
165 <!-- ── MODALS ─────────────────────────────────────────────────────── -->
154 <!-- ── Metric pill bar ─────────────────────────────────────────────── -->
155 <div id="gbar">
156 <button id="totPop" type="button" class="metric-btn active-metric" title="Total Prison Populations">Total Population</button>
157 <button id="perCapita" type="button" class="metric-btn" title="Prisoners Per Capita">Per Capita</button>
158 <button id="women" type="button" class="metric-btn" title="Percent Women Imprisoned">% Women</button>
159 <button id="juveniles" type="button" class="metric-btn" title="Percent Juveniles Imprisoned">% Juveniles</button>
160 <button id="occupancy" type="button" class="metric-btn" title="Prison Occupancy Level">Occupancy</button>
161 </div>
162
163 <!-- ── MODALS ──────────────────────────────────────────────────────── -->
166164
167165 <!-- country detail modal (populated by modal.js) -->
168 <div class="modal fade" id="countryModal" role="dialog">
166 <div class="modal fade" id="countryModal" tabindex="-1" role="dialog">
169167 <div class="modal-dialog">
170168 <div class="modal-content">
171169 <div class="modal-header">
172 <h4 class="modal-title" id="country-modal-title"></h4>
170 <h5 class="modal-title" id="country-modal-title"></h5>
171 <button type="button" class="nav-icon-btn ms-auto" data-bs-dismiss="modal" aria-label="Close">
172 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M23.954 21.03l-9.184-9.095 9.092-9.174-2.832-2.807-9.09 9.179-9.176-9.088-2.81 2.81 9.186 9.105-9.1 9.179 2.81 2.81 9.074-9.185 9.19 9.075z"/></svg>
173 </button>
173174 </div>
174175 <div class="modal-body" id="country-modal-body"></div>
175176 <div class="modal-footer">
176 <button type="button" class="btn btn-outline-success" data-bs-dismiss="modal">Close</button>
177 <button type="button" class="btn-modal-ghost" data-bs-dismiss="modal">Close</button>
177178 </div>
178179 </div>
179180 </div>
180181 </div>
181182
182183 <!-- compare: country selection -->
183 <div class="modal fade" id="compareModal" role="dialog">
184 <div class="modal fade" id="compareModal" tabindex="-1" role="dialog">
184185 <div class="modal-dialog modal-lg">
185186 <div class="modal-content">
186 <div class="modal-header" style="background-color:#24ab48;">
187 <h4 class="modal-title">Country Comparison</h4>
187 <div class="modal-header">
188 <h5 class="modal-title">Country Comparison</h5>
189 <button type="button" class="nav-icon-btn ms-auto" data-bs-dismiss="modal" aria-label="Close">
190 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M23.954 21.03l-9.184-9.095 9.092-9.174-2.832-2.807-9.09 9.179-9.176-9.088-2.81 2.81 9.186 9.105-9.1 9.179 2.81 2.81 9.074-9.185 9.19 9.075z"/></svg>
191 </button>
188192 </div>
189193 <div class="modal-body">
190194 <div id="compare-alert"></div>
191 <div class="row">
195 <div class="row g-3">
192196 <div class="col-md-6">
193197 <select id="compare-select-1"></select>
194198 </div>
@@ -198,19 +202,22 @@
198202 </div>
199203 </div>
200204 <div class="modal-footer">
201 <button type="button" class="btn btn-success" id="compare-go-btn">Compare!</button>
202 <button type="button" class="btn btn-outline-success" data-bs-dismiss="modal">Close</button>
205 <button type="button" class="btn-modal-ghost" data-bs-dismiss="modal">Cancel</button>
206 <button type="button" class="btn-modal-primary" id="compare-go-btn">Compare</button>
203207 </div>
204208 </div>
205209 </div>
206210 </div>
207211
208212 <!-- compare: side-by-side result -->
209 <div class="modal fade" id="compareResultModal" role="dialog">
213 <div class="modal fade" id="compareResultModal" tabindex="-1" role="dialog">
210214 <div class="modal-dialog modal-lg">
211215 <div class="modal-content">
212 <div class="modal-header" style="background-color:#24ab48;">
213 <h4 class="modal-title">Side-By-Side Comparison</h4>
216 <div class="modal-header">
217 <h5 class="modal-title">Side-by-Side Comparison</h5>
218 <button type="button" class="nav-icon-btn ms-auto" data-bs-dismiss="modal" aria-label="Close">
219 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M23.954 21.03l-9.184-9.095 9.092-9.174-2.832-2.807-9.09 9.179-9.176-9.088-2.81 2.81 9.186 9.105-9.1 9.179 2.81 2.81 9.074-9.185 9.19 9.075z"/></svg>
220 </button>
214221 </div>
215222 <div class="modal-body">
216223 <table class="table">
@@ -225,81 +232,88 @@
225232 </table>
226233 </div>
227234 <div class="modal-footer">
228 <button type="button" class="btn btn-outline-success" data-bs-dismiss="modal">Close</button>
235 <button type="button" class="btn-modal-ghost" data-bs-dismiss="modal">Close</button>
229236 </div>
230237 </div>
231238 </div>
232239 </div>
233240
234241 <!-- information modal -->
235 <div class="modal fade" id="infoModal" role="dialog">
242 <div class="modal fade" id="infoModal" tabindex="-1" role="dialog">
236243 <div class="modal-dialog modal-lg">
237244 <div class="modal-content">
238 <div class="modal-header bg-primary">
239 <h4 class="modal-title">Information</h4>
245 <div class="modal-header">
246 <h5 class="modal-title">Information</h5>
247 <button type="button" class="nav-icon-btn ms-auto" data-bs-dismiss="modal" aria-label="Close">
248 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M23.954 21.03l-9.184-9.095 9.092-9.174-2.832-2.807-9.09 9.179-9.176-9.088-2.81 2.81 9.186 9.105-9.1 9.179 2.81 2.81 9.074-9.185 9.19 9.075z"/></svg>
249 </button>
240250 </div>
241251 <div class="modal-body">
242 <p>Hover over any country to view its name and click to see its statistics!</p>
243 <p>To reset the map, please click the <b>Reset Map</b> button.</p>
244 <p>If you'd like to compare two countries' statistics, please use the <b>Compare</b> button.</p>
245 <p>In the <b>Graphs</b> modal, click any pie slice to see that country's incarceration metrics. Click <b>← Back</b> to return to the pie chart.</p>
252 <p>Hover over any country to view its name and click to see its statistics.</p>
253 <p>Use the <b>Settings</b> menu to toggle country labels or reset the map view.</p>
254 <p>To compare two countries, click the <b>Compare</b> button in the navbar.</p>
255 <p>In the <b>Charts</b> modal, click any pie slice to drill into that country's incarceration metrics. Click <b>← Back</b> to return.</p>
246256 <hr />
247 <p><b>References:</b></p>
248 <div class="row">
257 <p><b>References</b></p>
258 <div class="row g-2">
249259 <div class="col-sm-6">
250 <a class="btn btn-primary w-100" href="http://www.prisonstudies.org" target="_blank">World Prison Brief</a>
260 <a class="ref-btn" href="http://www.prisonstudies.org" target="_blank" rel="noopener">World Prison Brief</a>
251261 </div>
252262 <div class="col-sm-6">
253 <a class="btn btn-primary w-100" href="https://en.wikipedia.org/wiki/List_of_countries_by_system_of_government" target="_blank">Wikipedia</a>
263 <a class="ref-btn" href="https://en.wikipedia.org/wiki/List_of_countries_by_system_of_government" target="_blank" rel="noopener">Wikipedia — Governments</a>
254264 </div>
255265 </div>
256266 </div>
257267 <div class="modal-footer">
258 <button type="button" class="btn btn-outline-primary" data-bs-dismiss="modal">Close</button>
268 <button type="button" class="btn-modal-ghost" data-bs-dismiss="modal">Close</button>
259269 </div>
260270 </div>
261271 </div>
262272 </div>
263273
264274 <!-- alert / precautions modal -->
265 <div class="modal fade" id="alertModal" role="dialog">
275 <div class="modal fade" id="alertModal" tabindex="-1" role="dialog">
266276 <div class="modal-dialog modal-lg">
267277 <div class="modal-content">
268 <div class="modal-header bg-danger">
269 <h4 class="modal-title">Precautions</h4>
278 <div class="modal-header">
279 <h5 class="modal-title">Precautions</h5>
280 <button type="button" class="nav-icon-btn ms-auto" data-bs-dismiss="modal" aria-label="Close">
281 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M23.954 21.03l-9.184-9.095 9.092-9.174-2.832-2.807-9.09 9.179-9.176-9.088-2.81 2.81 9.186 9.105-9.1 9.179 2.81 2.81 9.074-9.185 9.19 9.075z"/></svg>
282 </button>
270283 </div>
271284 <div class="modal-body">
272 <p>If any part of this site is inaccurate or confusing, <a class="text-danger" href="#">send me an email</a>!</p>
285 <p>Data is sourced from the <a class="btn-modal-link p-0" href="http://www.prisonstudies.org" target="_blank" rel="noopener">World Prison Brief</a> and may not reflect the most current figures. Always consult primary sources for research purposes.</p>
286 <p>If any part of this site is inaccurate or confusing, please reach out.</p>
273287 </div>
274288 <div class="modal-footer">
275 <button type="button" class="btn btn-outline-danger" data-bs-dismiss="modal">Close</button>
289 <button type="button" class="btn-modal-ghost" data-bs-dismiss="modal">Close</button>
276290 </div>
277291 </div>
278292 </div>
279293 </div>
280294
281295 <!-- graph modal -->
282 <div class="modal fade" id="graphModal" role="dialog">
296 <div class="modal fade" id="graphModal" tabindex="-1" role="dialog">
283297 <div class="modal-dialog modal-lg">
284298 <div class="modal-content">
285 <div class="modal-header bg-secondary text-dark">
286 <h4 class="modal-title">Top Five Prison Populations</h4>
299 <div class="modal-header">
300 <h5 class="modal-title">Top 5 by Current Metric</h5>
301 <button type="button" class="nav-icon-btn ms-auto" data-bs-dismiss="modal" aria-label="Close">
302 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M23.954 21.03l-9.184-9.095 9.092-9.174-2.832-2.807-9.09 9.179-9.176-9.088-2.81 2.81 9.186 9.105-9.1 9.179 2.81 2.81 9.074-9.185 9.19 9.075z"/></svg>
303 </button>
287304 </div>
288305 <div class="modal-body">
289306 <div id="myChart2"></div>
290307 <div id="myNextChart" style="display:none;"></div>
291308 </div>
292309 <div class="modal-footer">
293 <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
310 <button type="button" class="btn-modal-ghost" data-bs-dismiss="modal">Close</button>
294311 </div>
295312 </div>
296313 </div>
297314 </div>
298315
299 <!-- map area -->
300 <div id="map-container"></div>
301
302 <!-- js -->
316 <!-- ── Scripts ─────────────────────────────────────────────────────── -->
303317 <script src="./assets/js/bootstrap.bundle.min.js"></script>
304318 <script type="module" src="./assets/js/app.js"></script>
305319 </body>