File size: 52,741 Bytes
5469a93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HIR × OAM — Pre-Carceral Due-Process Integrity Layer</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Courier+Prime:ital,wght@0,400;0,700;1,400&family=IM+Fell+English:ital@0;1&display=swap" rel="stylesheet">
<style>
  :root {
    --page-bg: #0f0f0f;
    --panel-bg: #161410;
    --panel-border: #2a2520;
    --gold: #C48A3A;
    --gold-dim: #8a6128;
    --gold-bright: #e0a84a;
    --parchment: #F2EBDD;
    --parchment-dim: #c9bfa8;
    --bark: #4F3826;
    --text-main: #d8ccb8;
    --text-dim: #7a7060;
    --text-muted: #4a4438;
    --red-warn: #c0392b;
    --amber: #e67e22;
    --green-ok: #6aab7a;
    --hir-bg: #1a1610;
    --oam-bg: #120f0c;
    --serif: 'Playfair Display', Georgia, serif;
    --mono: 'Courier Prime', 'Courier New', monospace;
    --fell: 'IM Fell English', Georgia, serif;
  }

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

  body {
    background: var(--page-bg);
    color: var(--text-main);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.65;
    min-height: 100vh;
  }

  /* ── TOP HEADER ── */
  .masthead {
    border-bottom: 1px solid var(--gold-dim);
    padding: 28px 36px 20px;
    background: #0a0906;
    position: relative;
  }
  .masthead::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
      0deg, transparent, transparent 39px, rgba(196,138,58,0.04) 40px
    );
    pointer-events: none;
  }
  .masthead-inner { position: relative; max-width: 960px; margin: 0 auto; }
  .masthead-tag {
    font-size: 10px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--gold-dim);
    margin-bottom: 6px;
  }
  .masthead-title {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 700;
    color: var(--parchment);
    letter-spacing: 0.02em;
    line-height: 1.2;
  }
  .masthead-subtitle {
    font-family: var(--fell);
    font-style: italic;
    color: var(--gold);
    font-size: 13px;
    margin-top: 4px;
  }
  .masthead-meta {
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-dim);
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
  }
  .masthead-meta span { display: flex; align-items: center; gap: 6px; }
  .masthead-meta span::before { content: '◆'; font-size: 7px; color: var(--gold-dim); }

  /* ── DISCLAIMER BANNER ── */
  .disclaimer-banner {
    background: #1a0f0a;
    border: 1px solid #5a2a1a;
    border-left: 4px solid #c0392b;
    padding: 10px 16px;
    margin: 16px 36px;
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
    font-size: 11px;
    color: #d08070;
    line-height: 1.5;
  }
  .disclaimer-banner strong { color: #e08070; font-size: 11.5px; }

  /* ── MAIN LAYOUT ── */
  .main-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 36px 60px;
  }

  /* ── SECTION HEADERS ── */
  .section-label {
    font-size: 10px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--gold-dim);
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 6px;
    margin: 28px 0 16px;
  }

  /* ── FRAMEWORK SUMMARY STRIP ── */
  .framework-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--panel-border);
    border: 1px solid var(--panel-border);
    margin-bottom: 24px;
    font-size: 11px;
  }
  .fw-cell {
    background: var(--hir-bg);
    padding: 10px 14px;
  }
  .fw-cell .fw-eq {
    font-family: var(--serif);
    color: var(--gold);
    font-size: 13px;
    margin-bottom: 3px;
  }
  .fw-cell .fw-desc { color: var(--text-dim); font-size: 10.5px; line-height: 1.4; }

  /* ── DOCUMENT TABS ── */
  .doc-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 0;
    flex-wrap: wrap;
  }
  .tab-btn {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-bottom: none;
    color: var(--text-dim);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    padding: 7px 14px;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: uppercase;
  }
  .tab-btn:hover { color: var(--text-main); border-color: var(--gold-dim); }
  .tab-btn.active {
    background: var(--hir-bg);
    border-color: var(--gold);
    color: var(--gold);
  }

  /* ── DOC PANEL ── */
  .doc-panel-wrap {
    border: 1px solid var(--panel-border);
    background: var(--hir-bg);
    padding: 20px 22px;
    display: none;
  }
  .doc-panel-wrap.active { display: block; }

  .doc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--panel-border);
  }
  .doc-title {
    font-family: var(--serif);
    font-size: 16px;
    color: var(--parchment);
  }
  .doc-fidelity-badge {
    font-size: 11px;
    font-family: var(--mono);
    padding: 4px 10px;
    border: 1px solid var(--gold-dim);
    color: var(--gold);
    background: rgba(196,138,58,0.07);
    white-space: nowrap;
  }

  /* ── HIR SLIDERS ── */
  .hir-row {
    display: grid;
    grid-template-columns: 120px 1fr 44px 90px;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(42,37,32,0.5);
  }
  .hir-row:last-of-type { border-bottom: none; }
  .hir-var {
    font-family: var(--serif);
    font-size: 15px;
    color: var(--gold);
  }
  .hir-var span { font-size: 10px; font-family: var(--mono); color: var(--text-dim); display: block; }
  .hir-question { font-size: 11.5px; color: var(--text-main); line-height: 1.4; }

  input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--gold) 0%, var(--gold) var(--fill), var(--panel-border) var(--fill), var(--panel-border) 100%);
    border-radius: 2px;
    cursor: pointer;
    outline: none;
  }
  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gold-bright);
    border: 2px solid var(--page-bg);
    cursor: pointer;
  }
  input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gold-bright);
    border: 2px solid var(--page-bg);
    cursor: pointer;
    box-shadow: none;
  }

  .score-val {
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 700;
    text-align: right;
    color: var(--parchment);
  }
  .score-label {
    font-size: 10px;
    color: var(--text-dim);
    text-align: right;
  }

  .hir-key-explanation {
    background: rgba(42,37,32,0.4);
    border-left: 2px solid var(--gold-dim);
    padding: 8px 12px;
    font-size: 10.5px;
    color: var(--text-dim);
    margin-top: 14px;
    line-height: 1.5;
  }

  /* ── OAM PRESSURE PANEL ── */
  .oam-panel {
    background: var(--oam-bg);
    border: 1px solid #2a1f10;
    padding: 18px 20px;
    margin-bottom: 24px;
  }
  .oam-panel-title {
    font-family: var(--serif);
    color: var(--amber);
    font-size: 15px;
    margin-bottom: 4px;
  }
  .oam-panel-desc {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 14px;
    line-height: 1.5;
  }
  .oam-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  @media (max-width: 600px) { .oam-grid { grid-template-columns: 1fr; } }

  .oam-flag {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid #2a1f10;
    background: #0f0d0a;
    cursor: pointer;
    transition: border-color 0.15s;
  }
  .oam-flag:hover { border-color: var(--amber); }
  .oam-flag.flagged { border-color: #c0392b; background: #1a0f08; }

  .oam-checkbox {
    width: 14px;
    height: 14px;
    border: 1px solid var(--text-muted);
    flex-shrink: 0;
    margin-top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    background: transparent;
  }
  .oam-flag.flagged .oam-checkbox {
    border-color: #c0392b;
    background: rgba(192,57,43,0.2);
  }
  .oam-checkbox::after {
    content: '';
    width: 6px;
    height: 6px;
    background: #c0392b;
    display: none;
  }
  .oam-flag.flagged .oam-checkbox::after { display: block; }

  .oam-flag-text {}
  .oam-flag-var {
    font-family: var(--serif);
    font-size: 13px;
    color: var(--amber);
    margin-bottom: 2px;
  }
  .oam-flag.flagged .oam-flag-var { color: #e05030; }
  .oam-flag-desc { font-size: 10.5px; color: var(--text-dim); line-height: 1.4; }

  /* ── SCORES PANEL ── */
  .scores-outer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
  }
  @media (max-width: 640px) { .scores-outer { grid-template-columns: 1fr; } }

  .score-block {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    padding: 16px 18px;
  }
  .score-block-title {
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 10px;
  }

  .score-meter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
  }
  .score-meter-label {
    width: 80px;
    font-family: var(--fell);
    font-size: 12px;
    color: var(--parchment-dim);
    flex-shrink: 0;
  }
  .score-meter-bar {
    flex: 1;
    height: 6px;
    background: var(--panel-border);
    border-radius: 3px;
    overflow: hidden;
  }
  .score-meter-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease, background 0.4s ease;
  }
  .score-meter-num {
    width: 36px;
    text-align: right;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--parchment);
  }

  /* ── RESONANCE GAUGE ── */
  .resonance-gauge-wrap {
    text-align: center;
    padding: 16px;
    background: var(--oam-bg);
    border: 1px solid var(--panel-border);
    margin-bottom: 24px;
  }
  .rg-title {
    font-family: var(--serif);
    font-size: 14px;
    color: var(--parchment-dim);
    margin-bottom: 14px;
    letter-spacing: 0.05em;
  }
  .rg-arc-wrap {
    position: relative;
    width: 200px;
    height: 110px;
    margin: 0 auto 10px;
  }
  .rg-arc-wrap svg { width: 200px; height: 110px; }
  .rg-value {
    font-family: var(--serif);
    font-size: 32px;
    font-weight: 700;
    color: var(--parchment);
    line-height: 1;
    margin-bottom: 2px;
  }
  .rg-status {
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dim);
  }
  .rg-status.green { color: var(--green-ok); }
  .rg-status.amber { color: var(--amber); }
  .rg-status.red { color: var(--red-warn); }

  /* ── FLAGS PANEL ── */
  .flags-panel {
    background: #0d0a08;
    border: 1px solid var(--panel-border);
    padding: 18px 20px;
    margin-bottom: 24px;
  }
  .flags-title {
    font-family: var(--serif);
    font-size: 15px;
    color: var(--parchment);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .flags-badge {
    font-family: var(--mono);
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(192,57,43,0.2);
    border: 1px solid #c0392b;
    color: #e08070;
  }
  .flag-item {
    display: flex;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 4px;
    border-left: 3px solid transparent;
    font-size: 11.5px;
    line-height: 1.5;
  }
  .flag-item.severity-high { border-color: var(--red-warn); background: rgba(192,57,43,0.06); }
  .flag-item.severity-med { border-color: var(--amber); background: rgba(230,126,34,0.05); }
  .flag-item.severity-low { border-color: var(--gold-dim); background: rgba(196,138,58,0.04); }
  .flag-code {
    font-family: var(--mono);
    font-size: 10px;
    padding: 1px 5px;
    border: 1px solid currentColor;
    white-space: nowrap;
    height: fit-content;
    margin-top: 2px;
    flex-shrink: 0;
  }
  .severity-high .flag-code { color: var(--red-warn); }
  .severity-med .flag-code { color: var(--amber); }
  .severity-low .flag-code { color: var(--gold-dim); }
  .flag-text { color: var(--text-main); }
  .no-flags {
    color: var(--text-dim);
    font-style: italic;
    font-size: 12px;
    padding: 8px 10px;
  }

  /* ── INTEGRITY STATEMENT ── */
  .integrity-statement {
    background: var(--hir-bg);
    border: 1px solid var(--panel-border);
    padding: 18px 20px;
    margin-bottom: 24px;
  }
  .is-title {
    font-size: 10px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--gold-dim);
    margin-bottom: 10px;
  }
  .is-body {
    font-family: var(--fell);
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-main);
  }
  .is-body em { color: var(--gold); font-style: italic; }
  .is-body strong { color: var(--parchment); }

  /* ── METHODOLOGY NOTE ── */
  .method-note {
    background: transparent;
    border: 1px dashed var(--panel-border);
    padding: 14px 16px;
    font-size: 11px;
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 24px;
  }
  .method-note strong { color: var(--text-main); }

  /* ── PRINT BUTTON ── */
  .action-row {
    display: flex;
    gap: 10px;
    margin-top: 8px;
  }
  .btn-dossier {
    background: transparent;
    border: 1px solid var(--gold-dim);
    color: var(--gold);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    padding: 8px 16px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.15s;
  }
  .btn-dossier:hover {
    background: rgba(196,138,58,0.08);
    border-color: var(--gold);
  }
  .btn-reset {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-dim);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    padding: 8px 16px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.15s;
  }
  .btn-reset:hover { border-color: var(--text-main); color: var(--text-main); }

  /* ── FOOTER ── */
  .page-footer {
    border-top: 1px solid var(--panel-border);
    padding: 16px 36px;
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    max-width: 960px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ── RESPONSIVE ── */
  @media (max-width: 640px) {
    .masthead { padding: 20px 18px 14px; }
    .main-wrap { padding: 0 18px 40px; }
    .hir-row { grid-template-columns: 100px 1fr 36px; }
    .hir-row .score-label { display: none; }
    .framework-strip { grid-template-columns: 1fr; }
    .scores-outer { grid-template-columns: 1fr; }
  }

  @media print {
    body { background: white; color: #111; }
    .tab-btn, .btn-dossier, .btn-reset { display: none; }
    .doc-panel-wrap { display: block !important; }
  }

  /* scrollbar */
  ::-webkit-scrollbar { width: 6px; }
  ::-webkit-scrollbar-track { background: var(--page-bg); }
  ::-webkit-scrollbar-thumb { background: var(--panel-border); border-radius: 3px; }
</style>
</head>
<body>

<!-- MASTHEAD -->
<header class="masthead">
  <div class="masthead-inner">
    <div class="masthead-tag">Primordial Calculus / OSF Canonical Package v1.0 — Applied Framework</div>
    <div class="masthead-title">HIR × OAM — Pre-Carceral Due-Process Integrity Layer</div>
    <div class="masthead-subtitle">A bounded integrity-review instrument for documentation coherence and agency-preservation</div>
    <div class="masthead-meta">
      <span>Framework by Collin D. Weber</span>
      <span>Bedrock: Honesty · Integrity · Respect</span>
      <span>Fault Model: Outsourced Agency (OAM)</span>
      <span>Non-legal · Human-reviewed · Non-punitive</span>
    </div>
  </div>
</header>

<!-- DISCLAIMER -->
<div class="disclaimer-banner">
  <strong>⚠ NOT LEGAL ADVICE — BOUNDED REVIEW INSTRUMENT ONLY.</strong> This tool is a structured integrity-review aid grounded in the Primordial Calculus (HIR × OAM) framework. It does not constitute legal advice, legal analysis, or a finding of wrongdoing. It does not determine guilt, innocence, or liability. All outputs require qualified human review. No automated score generated here should be used as a standalone basis for any legal, investigative, or carceral decision. Use in conjunction with proper legal counsel, oversight bodies, or civilian review processes.
</div>

<div class="main-wrap">

  <!-- FRAMEWORK STRIP -->
  <div class="section-label">Framework Architecture (Primordial Calculus — Canonical)</div>
  <div class="framework-strip">
    <div class="fw-cell">
      <div class="fw-eq">H + I → Fidelity (F)</div>
      <div class="fw-desc">Honesty + Integrity → document accuracy, factual alignment, no fabrication or omission</div>
    </div>
    <div class="fw-cell">
      <div class="fw-eq">R + I → Cohesion (C)</div>
      <div class="fw-desc">Respect + Integrity → cross-source consistency, dignity preservation, rights integrity</div>
    </div>
    <div class="fw-cell">
      <div class="fw-eq">F + C → Resonance (Rn)</div>
      <div class="fw-desc">Overall due-process integrity signal. OAM pressure load subtracts from net Rn.</div>
    </div>
  </div>

  <!-- METHODOLOGY NOTE -->
  <div class="method-note">
    <strong>How to use this instrument:</strong> For each document type, rate its HIR dimensions (H, I, R) on a 0–1 scale using the diagnostic questions as guides. Then flag any present OAM pressure conditions. The instrument computes Fidelity (F), Cohesion (C), and Resonance (Rn) per document and overall, weights them against OAM degradation load, and surfaces specific human-review flags. <strong>This is a coherence-check, not a verdict.</strong> A low score means "review warranted" — not guilt, not liability, not legal finding.
  </div>

  <!-- DOCUMENT TABS -->
  <div class="section-label">Document Integrity Assessment — HIR Scoring</div>
  <div class="doc-tabs" id="docTabs">
    <button class="tab-btn active" onclick="showTab('warrant', this)">Warrant</button>
    <button class="tab-btn" onclick="showTab('report', this)">Police Report</button>
    <button class="tab-btn" onclick="showTab('bodycam', this)">Bodycam / Recording</button>
    <button class="tab-btn" onclick="showTab('evidence', this)">Evidence Chain</button>
  </div>

  <!-- WARRANT PANEL -->
  <div class="doc-panel-wrap active" id="panel-warrant">
    <div class="doc-header">
      <div>
        <div class="doc-title">Warrant</div>
        <div style="font-size:11px; color:var(--text-dim); margin-top:3px;">Probable cause documentation · Judicial authorization · Scope integrity</div>
      </div>
      <div>
        <div class="doc-fidelity-badge" id="badge-warrant">F = — &nbsp;|&nbsp; C = —</div>
      </div>
    </div>
    <div class="hir-row">
      <div class="hir-var">H <span>Honesty</span></div>
      <div>
        <div class="hir-question" style="margin-bottom:6px;">Does the warrant accurately describe probable cause using verifiable, specific facts — no fabricated, embellished, or copy-pasted assertions?</div>
        <input type="range" min="0" max="100" value="70" id="w_H" oninput="updateDoc('warrant')" style="--fill: 70%">
      </div>
      <div>
        <div class="score-val" id="w_H_val">0.70</div>
        <div class="score-label">H</div>
      </div>
    </div>
    <div class="hir-row">
      <div class="hir-var">I <span>Integrity</span></div>
      <div>
        <div class="hir-question" style="margin-bottom:6px;">Is the warrant procedurally complete — signed by authorized judge, properly dated, specific in scope, not overbroad or rubber-stamped?</div>
        <input type="range" min="0" max="100" value="70" id="w_I" oninput="updateDoc('warrant')" style="--fill: 70%">
      </div>
      <div>
        <div class="score-val" id="w_I_val">0.70</div>
        <div class="score-label">I</div>
      </div>
    </div>
    <div class="hir-row">
      <div class="hir-var">R <span>Respect</span></div>
      <div>
        <div class="hir-question" style="margin-bottom:6px;">Does the warrant properly limit intrusion on the person's rights, dignity, and property — scoped to need, not used as pretext for broad search?</div>
        <input type="range" min="0" max="100" value="70" id="w_R" oninput="updateDoc('warrant')" style="--fill: 70%">
      </div>
      <div>
        <div class="score-val" id="w_R_val">0.70</div>
        <div class="score-label">R</div>
      </div>
    </div>
    <div class="hir-key-explanation">
      <strong>Warrant integrity note:</strong> In the HIR model, a degraded warrant is a Fidelity (H+I) failure — the state is asserting facts it cannot honestly or procedurally sustain. Low Respect (R) here maps to OAM variable <em>M</em> (coercive enforcement) — warrant as instrument of pressure rather than truthful authorization.
    </div>
  </div>

  <!-- POLICE REPORT PANEL -->
  <div class="doc-panel-wrap" id="panel-report">
    <div class="doc-header">
      <div>
        <div class="doc-title">Police Report</div>
        <div style="font-size:11px; color:var(--text-dim); margin-top:3px;">Narrative accuracy · Internal consistency · Dignity of account</div>
      </div>
      <div>
        <div class="doc-fidelity-badge" id="badge-report">F = — &nbsp;|&nbsp; C = —</div>
      </div>
    </div>
    <div class="hir-row">
      <div class="hir-var">H <span>Honesty</span></div>
      <div>
        <div class="hir-question" style="margin-bottom:6px;">Is the narrative consistent with available corroborating evidence — no selective omissions, fabricated details, or reframing that distorts sequence of events?</div>
        <input type="range" min="0" max="100" value="70" id="r_H" oninput="updateDoc('report')" style="--fill: 70%">
      </div>
      <div>
        <div class="score-val" id="r_H_val">0.70</div>
        <div class="score-label">H</div>
      </div>
    </div>
    <div class="hir-row">
      <div class="hir-var">I <span>Integrity</span></div>
      <div>
        <div class="hir-question" style="margin-bottom:6px;">Is the officer account internally consistent across timeline, physical description, and sequence — and consistent with the bodycam and other documentation?</div>
        <input type="range" min="0" max="100" value="70" id="r_I" oninput="updateDoc('report')" style="--fill: 70%">
      </div>
      <div>
        <div class="score-val" id="r_I_val">0.70</div>
        <div class="score-label">I</div>
      </div>
    </div>
    <div class="hir-row">
      <div class="hir-var">R <span>Respect</span></div>
      <div>
        <div class="hir-question" style="margin-bottom:6px;">Is the subject described without dehumanizing, racializing, or prejudicial language — framed as a person with rights, not pre-convicted by the narrative?</div>
        <input type="range" min="0" max="100" value="70" id="r_R" oninput="updateDoc('report')" style="--fill: 70%">
      </div>
      <div>
        <div class="score-val" id="r_R_val">0.70</div>
        <div class="score-label">R</div>
      </div>
    </div>
    <div class="hir-key-explanation">
      <strong>Report integrity note:</strong> A degraded police report is a Fidelity failure when H is low (dishonest narrative) and a Cohesion failure when I is low (internal contradictions). Low R here activates OAM variable <em>R_sat</em> (dogmatic/presumptive guilt saturation) — the report function has become a conviction instrument rather than a factual record.
    </div>
  </div>

  <!-- BODYCAM PANEL -->
  <div class="doc-panel-wrap" id="panel-bodycam">
    <div class="doc-header">
      <div>
        <div class="doc-title">Bodycam / Recording</div>
        <div style="font-size:11px; color:var(--text-dim); margin-top:3px;">Footage integrity · Protocol compliance · Cross-document alignment</div>
      </div>
      <div>
        <div class="doc-fidelity-badge" id="badge-bodycam">F = — &nbsp;|&nbsp; C = —</div>
      </div>
    </div>
    <div class="hir-row">
      <div class="hir-var">H <span>Honesty</span></div>
      <div>
        <div class="hir-question" style="margin-bottom:6px;">Does the footage content align with the written narrative in the police report — no material discrepancies in sequence, words used, or actions taken?</div>
        <input type="range" min="0" max="100" value="70" id="b_H" oninput="updateDoc('bodycam')" style="--fill: 70%">
      </div>
      <div>
        <div class="score-val" id="b_H_val">0.70</div>
        <div class="score-label">H</div>
      </div>
    </div>
    <div class="hir-row">
      <div class="hir-var">I <span>Integrity</span></div>
      <div>
        <div class="hir-question" style="margin-bottom:6px;">Was recording activated per protocol — no unexplained gaps, late activation, or missing footage for critical encounter windows?</div>
        <input type="range" min="0" max="100" value="70" id="b_I" oninput="updateDoc('bodycam')" style="--fill: 70%">
      </div>
      <div>
        <div class="score-val" id="b_I_val">0.70</div>
        <div class="score-label">I</div>
      </div>
    </div>
    <div class="hir-row">
      <div class="hir-var">R <span>Respect</span></div>
      <div>
        <div class="hir-question" style="margin-bottom:6px;">Does the footage show dignified, rights-respecting treatment of the subject — no unrecorded coercion, threats, or procedural violations in visible conduct?</div>
        <input type="range" min="0" max="100" value="70" id="b_R" oninput="updateDoc('bodycam')" style="--fill: 70%">
      </div>
      <div>
        <div class="score-val" id="b_R_val">0.70</div>
        <div class="score-label">R</div>
      </div>
    </div>
    <div class="hir-key-explanation">
      <strong>Bodycam integrity note:</strong> Bodycam discrepancies are a direct Cohesion failure — the cross-source structure (C = f(R,I)) breaks when footage and report diverge. Low I here (protocol violation, gaps) is a high-severity flag because it introduces an unfillable epistemic void that forecloses honest review.
    </div>
  </div>

  <!-- EVIDENCE CHAIN PANEL -->
  <div class="doc-panel-wrap" id="panel-evidence">
    <div class="doc-header">
      <div>
        <div class="doc-title">Evidence Chain</div>
        <div style="font-size:11px; color:var(--text-dim); margin-top:3px;">Completeness · Chain of custody · Rights compliance</div>
      </div>
      <div>
        <div class="doc-fidelity-badge" id="badge-evidence">F = — &nbsp;|&nbsp; C = —</div>
      </div>
    </div>
    <div class="hir-row">
      <div class="hir-var">H <span>Honesty</span></div>
      <div>
        <div class="hir-question" style="margin-bottom:6px;">Is all materially relevant evidence documented — including exculpatory evidence — with no selective presentation or suppression of contradicting items?</div>
        <input type="range" min="0" max="100" value="70" id="e_H" oninput="updateDoc('evidence')" style="--fill: 70%">
      </div>
      <div>
        <div class="score-val" id="e_H_val">0.70</div>
        <div class="score-label">H</div>
      </div>
    </div>
    <div class="hir-row">
      <div class="hir-var">I <span>Integrity</span></div>
      <div>
        <div class="hir-question" style="margin-bottom:6px;">Is the chain of custody intact and fully documented — no unaccounted handling, contamination risk, or procedural custody gaps?</div>
        <input type="range" min="0" max="100" value="70" id="e_I" oninput="updateDoc('evidence')" style="--fill: 70%">
      </div>
      <div>
        <div class="score-val" id="e_I_val">0.70</div>
        <div class="score-label">I</div>
      </div>
    </div>
    <div class="hir-row">
      <div class="hir-var">R <span>Respect</span></div>
      <div>
        <div class="hir-question" style="margin-bottom:6px;">Was evidence gathered in a manner that respected the person's rights and boundaries — no warrantless seizure, coerced consent, or constitutional overreach?</div>
        <input type="range" min="0" max="100" value="70" id="e_R" oninput="updateDoc('evidence')" style="--fill: 70%">
      </div>
      <div>
        <div class="score-val" id="e_R_val">0.70</div>
        <div class="score-label">R</div>
      </div>
    </div>
    <div class="hir-key-explanation">
      <strong>Evidence integrity note:</strong> Brady violations (suppressed exculpatory evidence) are a compound H + I failure and the most direct activation of OAM variable <em>N</em> (agency loss) — the accused person's ability to mount a defense is structurally amputated by documentation choices.
    </div>
  </div>

  <!-- OAM PRESSURE PANEL -->
  <div class="section-label">OAM Pressure Scan — Degradation Load Assessment</div>
  <div class="oam-panel">
    <div class="oam-panel-title">Outsourced Agency Model — Institutional Fault Detection</div>
    <div class="oam-panel-desc">Flag any conditions currently present in this case's institutional context. OAM variables measure the outsourced-agency and coercive-degradation pressure acting against HIR integrity. Each flagged condition reduces the net Resonance (Rn) and elevates the human-review urgency. This is not a finding — it is a pressure map.</div>
    <div class="oam-grid">
      <div class="oam-flag" id="oam_M" onclick="toggleOAM('M')">
        <div class="oam-checkbox"></div>
        <div class="oam-flag-text">
          <div class="oam-flag-var">M — Coercive Enforcement Pressure</div>
          <div class="oam-flag-desc">There is institutional or supervisory pressure to make an arrest, file charges, or proceed — regardless of documentation quality or evidence completeness.</div>
        </div>
      </div>
      <div class="oam-flag" id="oam_K" onclick="toggleOAM('K')">
        <div class="oam-checkbox"></div>
        <div class="oam-flag-text">
          <div class="oam-flag-var">K — Compliance Rigidity</div>
          <div class="oam-flag-desc">The institution resists correcting documentation errors, acknowledging gaps, or revisiting officer accounts — treating the record as fixed rather than reviewable.</div>
        </div>
      </div>
      <div class="oam-flag" id="oam_Ii" onclick="toggleOAM('Ii')">
        <div class="oam-checkbox"></div>
        <div class="oam-flag-text">
          <div class="oam-flag-var">Ii — Institutional Penetration</div>
          <div class="oam-flag-desc">Enforcement culture norms have penetrated the oversight or review function — reviewers are unable or unwilling to act independently of the filing institution.</div>
        </div>
      </div>
      <div class="oam-flag" id="oam_N" onclick="toggleOAM('N')">
        <div class="oam-checkbox"></div>
        <div class="oam-flag-text">
          <div class="oam-flag-var">N — Agency Loss (Subject)</div>
          <div class="oam-flag-desc">The person affected cannot access, review, or contest their own documentation record — their agency in the process has been structurally removed or suppressed.</div>
        </div>
      </div>
      <div class="oam-flag" id="oam_D" onclick="toggleOAM('D')">
        <div class="oam-checkbox"></div>
        <div class="oam-flag-text">
          <div class="oam-flag-var">D — Accumulated Degradation</div>
          <div class="oam-flag-desc">Multiple compounding discrepancies, gaps, or inconsistencies exist across documents — each individually explainable but collectively forming a pattern of degradation.</div>
        </div>
      </div>
      <div class="oam-flag" id="oam_R" onclick="toggleOAM('R')">
        <div class="oam-checkbox"></div>
        <div class="oam-flag-text">
          <div class="oam-flag-var">R_sat — Dogmatic / Presumptive-Guilt Saturation</div>
          <div class="oam-flag-desc">The documentation or institutional framing operates from presumptive guilt — the record is constructed backward from a conclusion rather than built forward from facts.</div>
        </div>
      </div>
    </div>
  </div>

  <!-- SCORES -->
  <div class="section-label">Computed Integrity Scores — HIR Derivation</div>
  <div class="scores-outer">
    <div class="score-block">
      <div class="score-block-title">Fidelity (F = H + I) per document</div>
      <div class="score-meter-row">
        <div class="score-meter-label">Warrant</div>
        <div class="score-meter-bar"><div class="score-meter-fill" id="mf_warrant" style="width:70%"></div></div>
        <div class="score-meter-num" id="mfn_warrant">0.70</div>
      </div>
      <div class="score-meter-row">
        <div class="score-meter-label">Police Report</div>
        <div class="score-meter-bar"><div class="score-meter-fill" id="mf_report" style="width:70%"></div></div>
        <div class="score-meter-num" id="mfn_report">0.70</div>
      </div>
      <div class="score-meter-row">
        <div class="score-meter-label">Bodycam</div>
        <div class="score-meter-bar"><div class="score-meter-fill" id="mf_bodycam" style="width:70%"></div></div>
        <div class="score-meter-num" id="mfn_bodycam">0.70</div>
      </div>
      <div class="score-meter-row">
        <div class="score-meter-label">Evidence</div>
        <div class="score-meter-bar"><div class="score-meter-fill" id="mf_evidence" style="width:70%"></div></div>
        <div class="score-meter-num" id="mfn_evidence">0.70</div>
      </div>
    </div>
    <div class="score-block">
      <div class="score-block-title">Cohesion (C = R + I) per document</div>
      <div class="score-meter-row">
        <div class="score-meter-label">Warrant</div>
        <div class="score-meter-bar"><div class="score-meter-fill" id="mc_warrant" style="width:70%"></div></div>
        <div class="score-meter-num" id="mcn_warrant">0.70</div>
      </div>
      <div class="score-meter-row">
        <div class="score-meter-label">Police Report</div>
        <div class="score-meter-bar"><div class="score-meter-fill" id="mc_report" style="width:70%"></div></div>
        <div class="score-meter-num" id="mcn_report">0.70</div>
      </div>
      <div class="score-meter-row">
        <div class="score-meter-label">Bodycam</div>
        <div class="score-meter-bar"><div class="score-meter-fill" id="mc_bodycam" style="width:70%"></div></div>
        <div class="score-meter-num" id="mcn_bodycam">0.70</div>
      </div>
      <div class="score-meter-row">
        <div class="score-meter-label">Evidence</div>
        <div class="score-meter-bar"><div class="score-meter-fill" id="mc_evidence" style="width:70%"></div></div>
        <div class="score-meter-num" id="mcn_evidence">0.70</div>
      </div>
    </div>
  </div>

  <!-- RESONANCE GAUGE -->
  <div class="resonance-gauge-wrap">
    <div class="rg-title">Net Due-Process Resonance (Rn) — after OAM pressure load</div>
    <div class="rg-arc-wrap">
      <svg viewBox="0 0 200 110" id="gaugesvg">
        <!-- background arc -->
        <path d="M 15 100 A 85 85 0 0 1 185 100" fill="none" stroke="#2a2520" stroke-width="10" stroke-linecap="round"/>
        <!-- colored arc -->
        <path id="gaugeArc" d="M 15 100 A 85 85 0 0 1 185 100" fill="none" stroke="#C48A3A" stroke-width="10" stroke-linecap="round" stroke-dasharray="267" stroke-dashoffset="80"/>
        <!-- tick marks -->
        <text x="10" y="108" fill="#4a4438" font-size="9" font-family="monospace">0</text>
        <text x="93" y="18" fill="#4a4438" font-size="9" font-family="monospace" text-anchor="middle">0.5</text>
        <text x="183" y="108" fill="#4a4438" font-size="9" font-family="monospace" text-anchor="end">1</text>
      </svg>
    </div>
    <div class="rg-value" id="rnDisplay">0.70</div>
    <div class="rg-status amber" id="rnStatus">REVIEW RECOMMENDED</div>
  </div>

  <!-- INTEGRITY FLAGS -->
  <div class="section-label">Human-Review Flags — Integrity Triggers</div>
  <div class="flags-panel">
    <div class="flags-title">
      Active Flags
      <span class="flags-badge" id="flagCount">0 flags</span>
    </div>
    <div id="flagsList">
      <div class="no-flags">Adjust the HIR sliders and OAM pressure flags above. Integrity triggers will appear here when conditions warrant human review.</div>
    </div>
  </div>

  <!-- INTEGRITY STATEMENT -->
  <div class="section-label">Bounded Integrity Statement — For Human Review</div>
  <div class="integrity-statement">
    <div class="is-title">Generated Integrity Assessment — Not a Legal Finding</div>
    <div class="is-body" id="integrityStatement">
      Adjust the instrument above to generate a bounded integrity assessment for human review.
    </div>
  </div>

  <!-- ACTIONS -->
  <div class="action-row">
    <button class="btn-dossier" onclick="window.print()">⊞ Print / Export Dossier</button>
    <button class="btn-reset" onclick="resetAll()">↺ Reset All Inputs</button>
  </div>

  <!-- FRAMEWORK PROVENANCE NOTE -->
  <div class="method-note" style="margin-top:24px;">
    <strong>Framework provenance:</strong> This instrument derives from Primordial Calculus v1.0 (OSF Canonical Package), created and developed by Collin D. Weber. Core architecture: HIR (Honesty · Integrity · Respect) as regenerative bedrock triad producing Fidelity (F = H+I), Cohesion (C = R+I), and Resonance (Rn = F+C), recursively reinforced. OAM (Outsourced Agency Model) is the zero-tolerance hard-fault degradation model built after HIR. Variables M (coercive enforcement), K (compliance rigidity), Ii (institutional penetration), N (agency loss), D (accumulated degradation), and R_sat (dogmatic saturation) are drawn directly from the canonical OAM variable set. Application to pre-carceral due-process context is a derived use of the framework.
  </div>

</div>

<footer class="page-footer">
  <span>HIR × OAM — Pre-Carceral Due-Process Integrity Layer</span>
  <span>Based on Primordial Calculus OSF Canonical Package v1.0 · Collin D. Weber</span>
  <span>NOT LEGAL ADVICE · Human review required for all outputs</span>
</footer>

<script>
// ── State ──
const docs = ['warrant','report','bodycam','evidence'];
const oamFlags = { M: false, K: false, Ii: false, N: false, D: false, R: false };
const docKeys = { warrant:'w', report:'r', bodycam:'b', evidence:'e' };
const docNames = { warrant:'Warrant', report:'Police Report', bodycam:'Bodycam/Recording', evidence:'Evidence Chain' };

// ── Tab switching ──
function showTab(docId, btn) {
  docs.forEach(d => {
    document.getElementById('panel-'+d).classList.remove('active');
  });
  document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
  document.getElementById('panel-'+docId).classList.add('active');
  btn.classList.add('active');
}

// ── Update range fill ──
function updateRangeStyle(el) {
  const pct = ((el.value - el.min) / (el.max - el.min)) * 100;
  el.style.setProperty('--fill', pct + '%');
}

// ── Compute per-doc scores ──
function getDocScores(docId) {
  const k = docKeys[docId];
  const H = parseInt(document.getElementById(k+'_H').value) / 100;
  const I = parseInt(document.getElementById(k+'_I').value) / 100;
  const R = parseInt(document.getElementById(k+'_R').value) / 100;
  const F = (H + I) / 2;
  const C = (R + I) / 2;
  const Rn = (F + C) / 2;
  return { H, I, R, F, C, Rn };
}

// ── Update a document's display ──
function updateDoc(docId) {
  const k = docKeys[docId];
  const sliders = ['H','I','R'];
  sliders.forEach(v => {
    const el = document.getElementById(k+'_'+v);
    updateRangeStyle(el);
    const val = parseInt(el.value)/100;
    document.getElementById(k+'_'+v+'_val').textContent = val.toFixed(2);
  });
  const s = getDocScores(docId);
  document.getElementById('badge-'+docId).textContent =
    'F = '+s.F.toFixed(2)+' \u00a0|\u00a0 C = '+s.C.toFixed(2);
  // Update meters
  updateMeter('mf_'+docId, 'mfn_'+docId, s.F);
  updateMeter('mc_'+docId, 'mcn_'+docId, s.C);
  computeOverall();
}

function updateMeter(fillId, numId, val) {
  const fill = document.getElementById(fillId);
  const num = document.getElementById(numId);
  fill.style.width = (val*100)+'%';
  fill.style.background = scoreColor(val);
  num.textContent = val.toFixed(2);
  num.style.color = scoreColor(val);
}

function scoreColor(v) {
  if (v >= 0.75) return '#6aab7a';
  if (v >= 0.55) return '#e0a84a';
  if (v >= 0.40) return '#e67e22';
  return '#c0392b';
}

// ── OAM toggle ──
function toggleOAM(key) {
  oamFlags[key] = !oamFlags[key];
  const el = document.getElementById('oam_'+key);
  el.classList.toggle('flagged', oamFlags[key]);
  computeOverall();
}

// ── Compute overall ──
function computeOverall() {
  const scores = docs.map(d => getDocScores(d));
  const avgF = scores.reduce((a,s)=>a+s.F,0)/scores.length;
  const avgC = scores.reduce((a,s)=>a+s.C,0)/scores.length;
  const baseRn = (avgF + avgC) / 2;

  // OAM load: weighted penalty
  const oamWeights = { M:0.07, K:0.05, Ii:0.06, N:0.08, D:0.07, R:0.06 };
  let oamLoad = 0;
  Object.keys(oamFlags).forEach(k => { if (oamFlags[k]) oamLoad += oamWeights[k]; });
  const netRn = Math.max(0, baseRn - oamLoad);

  updateGauge(netRn);
  updateFlags(scores, netRn, avgF, avgC, oamLoad);
  updateStatement(scores, netRn, avgF, avgC, oamLoad);
}

// ── Gauge update ──
function updateGauge(rn) {
  const el = document.getElementById('rnDisplay');
  const st = document.getElementById('rnStatus');
  const arc = document.getElementById('gaugeArc');
  el.textContent = rn.toFixed(2);
  el.style.color = scoreColor(rn);
  // Arc: full semicircle dasharray ≈ 267, offset = 267*(1-rn)
  const arcLen = 267;
  const offset = arcLen * (1 - rn);
  arc.setAttribute('stroke-dashoffset', offset.toFixed(1));
  arc.setAttribute('stroke', scoreColor(rn));
  st.className = 'rg-status';
  if (rn >= 0.75) { st.textContent = 'COHERENCE CONDITIONS PRESENT'; st.classList.add('green'); }
  else if (rn >= 0.55) { st.textContent = 'REVIEW RECOMMENDED'; st.classList.add('amber'); }
  else if (rn >= 0.40) { st.textContent = 'REVIEW REQUIRED — MULTIPLE DEFICITS'; st.classList.add('amber'); }
  else { st.textContent = 'SYSTEMIC REVIEW REQUIRED — CRITICAL'; st.classList.add('red'); }
}

// ── Generate flags ──
function updateFlags(scores, netRn, avgF, avgC, oamLoad) {
  const flags = [];
  const docLabels = ['warrant','report','bodycam','evidence'];
  const k = docKeys;

  docLabels.forEach(d => {
    const s = scores[docs.indexOf(d)];
    if (s.H < 0.45) flags.push({
      sev: 'high', code: d.toUpperCase().slice(0,3)+'/H',
      text: docNames[d]+': Honesty score critically low ('+s.H.toFixed(2)+'). Document may contain materially inaccurate, fabricated, or selectively omitted information. Fidelity chain is compromised at source. Human factual review required before any proceeding.'
    });
    else if (s.H < 0.60) flags.push({
      sev: 'med', code: d.toUpperCase().slice(0,3)+'/H',
      text: docNames[d]+': Honesty score below integrity threshold ('+s.H.toFixed(2)+'). Review narrative for accuracy, selective omissions, or inconsistencies with known facts.'
    });
    if (s.I < 0.45) flags.push({
      sev: 'high', code: d.toUpperCase().slice(0,3)+'/I',
      text: docNames[d]+': Integrity score critically low ('+s.I.toFixed(2)+'). Procedural consistency is substantially compromised. Internal contradictions or protocol violations present. Review required before reliance on this document.'
    });
    else if (s.I < 0.60) flags.push({
      sev: 'med', code: d.toUpperCase().slice(0,3)+'/I',
      text: docNames[d]+': Integrity score below threshold ('+s.I.toFixed(2)+'). Check for procedural inconsistencies, gaps, or deviations from required documentation standards.'
    });
    if (s.R < 0.45) flags.push({
      sev: 'high', code: d.toUpperCase().slice(0,3)+'/R',
      text: docNames[d]+': Respect score critically low ('+s.R.toFixed(2)+'). Dignity and rights of the subject may not be reflected in the record. Potential rights violation embedded in the document structure requires human review.'
    });
    else if (s.R < 0.60) flags.push({
      sev: 'med', code: d.toUpperCase().slice(0,3)+'/R',
      text: docNames[d]+': Respect score below threshold ('+s.R.toFixed(2)+'). Review for rights-respecting treatment, absence of dehumanizing framing, and proper boundary adherence.'
    });
  });

  // Cross-document cohesion check
  const minF = Math.min(...scores.map(s=>s.F));
  const maxF = Math.max(...scores.map(s=>s.F));
  if (maxF - minF > 0.3) flags.push({
    sev: 'med', code: 'CROSS/F',
    text: 'Fidelity gap of '+(maxF-minF).toFixed(2)+' detected across documents. High variance in document-to-document accuracy signals inconsistent record-keeping or selective documentation. Cross-source reconciliation required.'
  });

  // OAM flags
  if (oamFlags.M) flags.push({
    sev: 'high', code: 'OAM/M',
    text: 'Coercive enforcement pressure (M) is active. External pressure to arrest or charge — independent of evidence quality — degrades due-process integrity by forcing procedural momentum against the evidentiary record. This is a primary HIR/Rn suppressor.'
  });
  if (oamFlags.K) flags.push({
    sev: 'high', code: 'OAM/K',
    text: 'Compliance rigidity (K) is active. Institutional resistance to error correction removes the system\'s reparative capacity. In HIR terms: the corrective coupling functions (β₁, β₂) are blocked. Errors compound without restoring path.'
  });
  if (oamFlags.Ii) flags.push({
    sev: 'high', code: 'OAM/Ii',
    text: 'Institutional penetration (Ii) is active. The review function has been colonized by the filing institution\'s enforcement norms. Independent review of this record should be sourced from an oversight body structurally separated from the filing agency.'
  });
  if (oamFlags.N) flags.push({
    sev: 'high', code: 'OAM/N',
    text: 'Agency loss (N) is active. The subject cannot access, review, or contest their own record. This is a structural Brady-adjacent condition. Access to documentation must be restored before any proceeding. Human rights review indicated.'
  });
  if (oamFlags.D) flags.push({
    sev: 'med', code: 'OAM/D',
    text: 'Accumulated degradation (D) is active. Multiple compounding discrepancies — each potentially individually explainable — form a pattern consistent with systemic documentation failure. Pattern-level human review (not just document-by-document) is warranted.'
  });
  if (oamFlags.R) flags.push({
    sev: 'med', code: 'OAM/R',
    text: 'Dogmatic saturation (R_sat) is active. The documentation or framing reflects presumptive guilt orientation — the record appears constructed backward from a conclusion. Factual forward-reconstruction from source evidence is required.'
  });

  // Net resonance flag
  if (netRn < 0.40) flags.push({
    sev: 'high', code: 'NET/Rn',
    text: 'Net due-process Resonance (Rn = '+netRn.toFixed(2)+') is critically below threshold. The combined weight of documentation deficits and OAM pressure load places this record in systemic-review territory. Proceeding to carceral action on this documentation basis carries substantial wrongful-criminalization risk. Full independent human review of all documents and institutional pressures is required before any further action.'
  });
  else if (netRn < 0.55) flags.push({
    sev: 'med', code: 'NET/Rn',
    text: 'Net due-process Resonance (Rn = '+netRn.toFixed(2)+') is below adequate threshold. Multiple integrity deficits are interacting. This record requires directed human review of flagged areas before proceeding.'
  });

  // Count and display
  const container = document.getElementById('flagsList');
  const badge = document.getElementById('flagCount');
  badge.textContent = flags.length + (flags.length===1?' flag':' flags');
  if (flags.length === 0) {
    container.innerHTML = '<div class="no-flags">No integrity triggers active. Continue monitoring as conditions develop. Adjust sliders to reflect actual document quality.</div>';
    return;
  }
  // Sort: high first
  flags.sort((a,b) => a.sev==='high'&&b.sev!=='high'?-1:b.sev==='high'&&a.sev!=='high'?1:0);
  container.innerHTML = flags.map(f =>
    `<div class="flag-item severity-${f.sev}">
      <span class="flag-code">${f.code}</span>
      <span class="flag-text">${f.text}</span>
    </div>`
  ).join('');
}

// ── Generate integrity statement ──
function updateStatement(scores, netRn, avgF, avgC, oamLoad) {
  const oamActive = Object.values(oamFlags).filter(Boolean).length;
  const critDocs = docs.filter(d=>{
    const s=scores[docs.indexOf(d)];
    return s.F<0.5||s.C<0.5;
  }).map(d=>docNames[d]);

  let stmt = '';
  if (netRn >= 0.75) {
    stmt = `<strong>Documentation coherence is within acceptable range</strong> (Net Rn = ${netRn.toFixed(2)}). 
    Fidelity and Cohesion scores across the four document types are broadly consistent with HIR integrity conditions. 
    ${oamActive===0 ? 'No OAM degradation pressures are currently flagged.' : `<em>${oamActive} OAM pressure condition(s) are noted and should be monitored.</em>`} 
    This assessment does not indicate the absence of error — it indicates that no major integrity triggers are currently active. 
    Standard human review protocols should continue.`;
  } else if (netRn >= 0.55) {
    stmt = `<strong>Documentation coherence is below recommended threshold</strong> (Net Rn = ${netRn.toFixed(2)}). 
    ${critDocs.length > 0 ? `Integrity deficits are present in: <em>${critDocs.join(', ')}</em>. ` : ''}
    ${oamActive > 0 ? `<em>${oamActive} OAM pressure factor(s) are active</em>, contributing approximately ${(oamLoad).toFixed(2)} degradation load to the net resonance. ` : ''}
    The identified deficits in Fidelity (H+I) and/or Cohesion (R+I) warrant directed human review of the flagged documents before any carceral proceeding. 
    This is not a legal finding. It is a coherence-review signal.`;
  } else if (netRn >= 0.40) {
    stmt = `<strong>Significant documentation integrity deficits are present</strong> (Net Rn = ${netRn.toFixed(2)}). 
    ${critDocs.length > 0 ? `The following document types show critical or near-critical HIR failure: <em>${critDocs.join(', ')}</em>. ` : ''}
    ${oamActive > 0 ? `<em>${oamActive} active OAM pressure condition(s)</em> are compounding baseline documentation deficits, creating a multi-layer integrity failure. ` : ''}
    <strong>Human review of all flagged areas is required before any further action.</strong> 
    The compound effect of these deficits creates material wrongful-criminalization risk. 
    This assessment is bounded and non-punitive — it identifies areas where the documentation record cannot sustain honest due-process scrutiny. It is not a legal finding.`;
  } else {
    stmt = `<strong>Critical due-process integrity failure detected</strong> (Net Rn = ${netRn.toFixed(2)}). 
    The documentation record as currently assessed falls substantially below HIR coherence thresholds. 
    ${critDocs.length > 0 ? `Critical deficits are present in: <em>${critDocs.join(', ')}</em>. ` : ''}
    ${oamActive > 0 ? `<em>${oamActive} active OAM degradation factors</em> (including ${Object.keys(oamFlags).filter(k=>oamFlags[k]).join(', ')}) indicate that institutional pressures are actively suppressing the corrective capacity of the system. ` : ''}
    <strong>Proceeding to any carceral outcome on this documentation basis carries a high risk of wrongful criminalization.</strong> 
    Full independent human review — structurally separated from the filing institution — is required for all documents, timelines, and institutional pressures identified in the flags above. 
    This is a bounded integrity-review signal, not a legal finding, and requires qualified human oversight to interpret and act upon.`;
  }

  document.getElementById('integrityStatement').innerHTML = stmt;
}

// ── Reset ──
function resetAll() {
  docs.forEach(d => {
    const k = docKeys[d];
    ['H','I','R'].forEach(v => {
      const el = document.getElementById(k+'_'+v);
      el.value = 70;
      updateRangeStyle(el);
      document.getElementById(k+'_'+v+'_val').textContent = '0.70';
    });
  });
  Object.keys(oamFlags).forEach(k => {
    oamFlags[k] = false;
    document.getElementById('oam_'+k).classList.remove('flagged');
  });
  docs.forEach(d => updateDoc(d));
}

// ── Init ──
docs.forEach(d => updateDoc(d));
</script>
</body>
</html>