/* ============================================================
   Compliance Architecture of AI Agents
   Light, editorial research theme. Hand-rolled, no framework.
   ============================================================ */
:root {
  --bg:        #ffffff;
  --bg-alt:    #f6f7f9;
  --bg-tint:   #f0f4fb;
  --ink:       #14171f;
  --ink-2:     #2c333f;
  --muted:     #5c6573;
  --muted-2:   #8a92a0;
  --line:      #e4e7ec;
  --line-2:    #d4d9e0;

  --blue:      #1f6fe5;   /* compliant / primary accent */
  --blue-d:    #1457b8;
  --indigo:    #3a4ed6;   /* interactive UI */
  --red:       #e23b4e;   /* violation */
  --red-d:     #c01f33;
  --amber:     #f59e0b;   /* urgency / caution */
  --teal:      #0e9384;   /* group I */
  --violet:    #6b46e0;   /* group II */

  --radius:    16px;
  --radius-s:  10px;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --serif:'Source Serif 4', Georgia, 'Times New Roman', serif;
  --shadow:   0 1px 2px rgba(16,24,40,.04), 0 8px 24px -12px rgba(16,24,40,.12);
  --shadow-l: 0 12px 40px -16px rgba(16,24,40,.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); line-height: 1.62; font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4 { margin: 0 0 .5em; line-height: 1.14; font-weight: 600; }
h1,h2 { font-family: var(--serif); letter-spacing: -.012em; }
p { margin: 0 0 1em; color: var(--ink-2); }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-d); }
.mono { font-family: var(--mono); }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 760px; }
.muted { color: var(--muted); }
.eyebrow {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--indigo); font-weight: 600; margin-bottom: 12px;
}
b, strong { font-weight: 650; color: var(--ink); }

/* ---------- top accent + nav ---------- */
.accentbar { height: 3px; background: linear-gradient(90deg, var(--red), var(--amber) 40%, var(--blue)); }
nav.top {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
nav.top .wrap { display: flex; align-items: center; gap: 18px; height: 58px; }
nav.top .navdot { width: 11px; height: 11px; border-radius: 50%;
  background: conic-gradient(var(--red), var(--amber), var(--blue), var(--red)); flex:0 0 auto; }
nav.top .links { display: flex; gap: 18px; margin: 0 auto; flex-wrap: wrap; }
nav.top .links a { color: var(--muted); font-size: .83rem; font-weight: 500; }
nav.top .links a:hover { color: var(--ink); }
@media (max-width: 940px){ nav.top .links { display:none; } }

/* ---------- hero ---------- */
header.hero { padding: 84px 0 44px; text-align: center; }
.hero h1 { font-size: clamp(1.7rem, 4.4vw, 3.1rem); max-width: none; margin: 0 auto; font-weight: 600; }
@media (min-width: 720px){ .hero h1 { white-space: nowrap; } }
.hero h1 .u { background: linear-gradient(transparent 64%, rgba(31,111,229,.22) 64%); }
.hero .lede { font-size: 1.2rem; color: var(--ink-2); max-width: 62ch; margin: 22px auto 0; }
.hero .authors { margin: 20px 0 0; font-size: .98rem; color: var(--ink-2); font-weight: 500; }
.hero .authors a { color: var(--ink); border-bottom: 1px solid var(--line-2); }
.hero .authors a:hover { color: var(--blue); border-bottom-color: var(--blue); }
.hero .authors .sep { color: var(--blue); margin: 0 10px; font-size: .8rem; vertical-align: 1px; }
.hero .cta { display: flex; gap: 12px; margin: 26px 0 0; flex-wrap: wrap; justify-content: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem;
  padding: 11px 18px; border-radius: 10px; border: 1px solid var(--line-2);
  background: #fff; color: var(--ink); cursor: pointer; transition: .15s;
}
.btn:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-1px); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-d); color:#fff; box-shadow: 0 10px 24px -10px rgba(31,111,229,.6); }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin: 48px auto 0; max-width: 900px; text-align:left; }
@media (max-width: 760px){ .stats { grid-template-columns: 1fr; } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 20px; box-shadow: var(--shadow); position: relative; }
.stat .num { font-family: var(--serif); font-size: 2.3rem; font-weight: 600; line-height: 1; letter-spacing: -.01em; }
.stat .num .unit { font-size: 1.1rem; color: var(--muted); font-family: var(--mono); }
.stat.warn .num { color: var(--red-d); }
.stat.blue .num { color: var(--blue-d); }
.stat.amber .num { color: #b76e00; }
.stat .lbl { font-size: .9rem; color: var(--muted); margin-top: 10px; }

/* ---------- sections ---------- */
section { padding: 60px 0; }
section.alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
section .head { max-width: 72ch; margin-bottom: 28px; }
section h2 { font-size: clamp(1.55rem, 3vw, 2.15rem); }
section .head p { font-size: 1.05rem; }

/* ---------- cards ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 16px; }
@media (max-width: 820px){ .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* setup compact bits */
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th, table.data td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }
table.data th { color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
table.data td.no  { color: var(--red-d); font-weight: 600; }
table.data td.yes { color: var(--blue-d); font-weight: 600; }
table.data tr.dom td { background: #fdf2f3; }
.setup-tag { font-family: var(--mono); font-size:.68rem; letter-spacing:.08em; color: var(--indigo); text-transform: uppercase; font-weight:600; }
.pill-row { display:flex; flex-wrap:wrap; gap:7px; margin-top:7px; }
.pill { font-family:var(--mono); font-size:.74rem; padding:4px 10px; border-radius:999px; border:1px solid var(--line-2); color:var(--ink-2); background:#fff; }
.grouplist .gl-label { display:inline-block; font-size:.78rem; font-weight:700; padding:3px 10px; border-radius:7px; margin:4px 0 6px; }
.grouplist .gl-label.I  { background: rgba(14,147,132,.12); color: var(--teal); }
.grouplist .gl-label.II { background: rgba(107,70,224,.12); color: var(--violet); }
.grouplist .gl-label.II { margin-top:16px; }
.grouplist .gl-names { font-size:.92rem; color:var(--ink); font-weight:500; line-height:1.6; }
.grouplist .gl-names .gm { cursor:help; border-bottom:1px dotted var(--line-2); }
.grouplist .gl-names .gm:hover { color:var(--indigo); border-bottom-color:var(--indigo); }
.pill { cursor:help; }
.grouplist .gl-sub { font-size:.82rem; color:var(--muted); margin-top:3px; }

/* ---------- dashboard chrome ---------- */
.dash { background:#fff; border:1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow:hidden; }
.dash + .dash { margin-top: 20px; }
.dash + .grid-2 { margin-top: 32px; }
.grid-2 > .dash { margin-top: 0; height: 100%; }
.grid-2 > .dash .dash-head { min-height: 92px; }
.dash-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display:flex; flex-wrap:wrap; align-items:center; gap:14px; }
.dash-head h3 { margin:0; font-size: 1.06rem; font-family: var(--sans); font-weight:650; display:flex; align-items:center; gap:8px; }
.dash-head .sub { margin:0; color: var(--muted); font-size:.85rem; }
.info { display:inline-flex; align-items:center; justify-content:center; width:16px; height:16px; border-radius:50%;
  border:1px solid var(--line-2); color:var(--muted); font-size:.66rem; font-style:italic; font-weight:700;
  font-family:var(--serif); cursor:help; flex:0 0 auto; }
.info:hover { border-color: var(--indigo); color: var(--indigo); }
.dash-body { padding: 20px; }
.controls { display:flex; flex-wrap:wrap; gap:16px; align-items:flex-end; margin-left:auto; }
.ctl { display:flex; flex-direction:column; gap:6px; }
.ctl > span { font-size:.64rem; text-transform:uppercase; letter-spacing:.1em; color:var(--muted-2); font-family:var(--mono); }
.seg { display:inline-flex; background: var(--bg-alt); border:1px solid var(--line-2); border-radius:9px; padding:3px; }
.seg button { border:none; background:transparent; color:var(--muted); font-family:var(--sans); font-size:.82rem; font-weight:600; padding:6px 12px; border-radius:6px; cursor:pointer; transition:.14s; white-space:nowrap; }
.seg button:hover { color:var(--ink); }
.seg button.active { background:#fff; color:var(--indigo); box-shadow: 0 1px 3px rgba(16,24,40,.14); }

/* model chips */
.modelbar { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.modelbar .glabel { font-family:var(--mono); font-size:.66rem; letter-spacing:.1em; color:var(--muted-2); margin-right:2px; }
.chip { display:inline-flex; align-items:center; gap:6px; font-size:.78rem; font-weight:600; padding:5px 10px; border-radius:999px; cursor:pointer; user-select:none; border:1px solid var(--line-2); background:#fff; color:var(--muted); transition:.14s; }
.chip .gd { width:7px; height:7px; border-radius:50%; background: currentColor; opacity:.5; }
.chip.g1 { color: var(--teal); } .chip.g2 { color: var(--violet); }
.chip.on { color:#fff; border-color: transparent; }
.chip.g1.on { background: var(--teal); } .chip.g2.on { background: var(--violet); }
.chip.on .gd { opacity:1; background:#fff; }
.chip.preset { color:var(--muted); border-style:dashed; }
.chip.preset:hover { color:var(--indigo); border-color: var(--indigo); }

/* ---------- heatmap ---------- */
.heat-wrap { display:flex; gap:16px; align-items:stretch; justify-content:center; }
.heat { flex:0 1 auto; overflow-x:auto; }
.heat table { border-collapse: separate; border-spacing: 3px; }
/* group brackets on the left */
.heat th.brk { vertical-align:middle; padding:0 9px 0 0; border-right:3px solid; text-align:center; }
.heat th.brk.I  { border-color: var(--teal); }
.heat th.brk.II { border-color: var(--violet); }
.heat th.brk .brk-txt { writing-mode:vertical-rl; transform:rotate(180deg); display:block;
  font-size:.65rem; font-weight:700; letter-spacing:.08em; text-transform:uppercase; white-space:nowrap; margin:0 auto; }
.heat th.brk.I  .brk-txt { color: var(--teal); }
.heat th.brk.II .brk-txt { color: var(--violet); }
.heat th.grp { font-size:.72rem; font-weight:700; color:var(--ink-2); padding:0 4px 5px; text-align:center; letter-spacing:.02em; border-bottom:2px solid var(--line-2); }
.heat th.col { width:48px; min-width:48px; max-width:48px; font-size:.69rem; color:var(--muted); font-weight:600; padding:6px 2px 8px; text-align:center; line-height:1.15; }
.heat th.rowh { text-align:right; padding-right:11px; font-size:.84rem; font-weight:600; color:var(--ink); white-space:nowrap; width:122px; }
.heat td.cell { width:48px; min-width:48px; max-width:48px; height:36px; text-align:center; border-radius:6px;
  border:1px solid rgba(20,23,31,.07); font-family:var(--mono); font-size:.8rem; font-weight:600; cursor:default; transition: transform .1s; }
.heat td.cell:hover { transform: scale(1.09); outline:2px solid var(--ink); z-index:2; position:relative; }
.heat td.cell.na { background:#fbfbfc !important; border-style:dashed !important; color:var(--muted-2) !important; }
.heat td.spacer, .heat th.spacer { width:10px; min-width:10px; max-width:10px; background:transparent !important; border:none !important; }
.grp-divider td { border-top:1px dashed var(--line-2); height:1px; padding:0; border:none; }

/* vertical legend, right of heatmap */
.vlegend { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:7px; flex:0 0 auto; padding:18px 2px; }
.vlegend .vl-bar { width:15px; flex:1; min-height:150px; border-radius:8px; border:1px solid var(--line-2);
  background: linear-gradient(to top, #a50026, #f46d43, #ffd25a, #91bfdb, #27398c); }
.vlegend span { font-size:.78rem; font-weight:600; color:var(--muted); }

/* legend */
.legend { display:flex; align-items:center; gap:18px; flex-wrap:wrap; margin-top:18px; font-size:.86rem; color:var(--muted); }
.legend.big { font-size:.92rem; gap:22px; }
.legend .scale { display:flex; align-items:center; gap:9px; }
.legend .swatch { width:14px; height:14px; border-radius:4px; display:inline-block; vertical-align:middle; margin-right:6px; }
.legend.big .swatch { width:16px; height:16px; }

/* svg charts */
.chartwrap { width:100%; overflow-x:auto; text-align:center; }
svg.chart { display:block; margin:0 auto; max-width:100%; font-family: var(--sans); }
svg.chart text { fill: var(--muted); font-size: 11px; }
svg.chart .axislbl { fill: var(--muted-2); font-size: 10.5px; font-family: var(--mono); }
svg.chart .gridline { stroke: var(--line); stroke-width:1; }
svg.chart .axis { stroke: var(--line-2); stroke-width:1; }

/* tooltip */
#tip { position: fixed; z-index: 300; pointer-events:none; opacity:0; transition: opacity .1s;
  background:#fff; border:1px solid var(--line-2); border-radius:10px; padding:11px 13px;
  font-size:.8rem; box-shadow: var(--shadow-l); max-width: 300px; color: var(--ink-2); }
#tip .t-title { font-weight:700; margin-bottom:6px; color:var(--ink); }
#tip .t-row { display:flex; justify-content:space-between; gap:18px; }
#tip .t-row b { color:var(--ink); font-family:var(--mono); }
#tip .t-desc { color:var(--muted); margin-top:6px; font-size:.78rem; line-height:1.45; }
#tip .t-prompt { margin-top:7px; padding-top:7px; border-top:1px solid var(--line); font-style:italic; color:var(--muted); font-size:.76rem; }

/* callout */
.callout { display:flex; gap:13px; align-items:flex-start; margin-top:18px; padding:15px 17px; border-radius:12px; border:1px solid var(--line-2); background: var(--bg-alt); }
.callout.urgency { background: #fff8ec; border-color:#f4d79a; }
.callout.blue { background: var(--bg-tint); border-color:#c5d9f7; }
.callout .ico { font-size:1.15rem; line-height:1.3; }
.callout p { margin:0; font-size:.92rem; color:var(--ink-2); }

/* disclosure */
details.more { margin-top:18px; border:1px solid var(--line); border-radius:12px; background:#fff; box-shadow: var(--shadow); overflow:hidden; }
details.more > summary { cursor:pointer; list-style:none; padding:15px 18px; font-weight:650; font-size:.96rem; display:flex; align-items:center; gap:10px; color:var(--ink); }
details.more > summary::-webkit-details-marker { display:none; }
details.more > summary .tri { color: var(--indigo); transition: transform .2s; display:inline-block; }
details.more[open] > summary .tri { transform: rotate(90deg); }
details.more > summary .more-sub { color: var(--muted); font-weight:500; font-size:.85rem; margin-left:auto; }
details.more > .more-body { padding: 0 18px 20px; }

/* multi-turn layout with side model list */
.mt-layout { display:flex; gap:18px; align-items:stretch; }
.mt-models { flex:0 0 150px; display:flex; flex-direction:column; gap:2px; padding-top:24px; max-height:340px; overflow-y:auto; }
.mt-models .mtm { display:flex; align-items:center; gap:7px; font-size:.8rem; color:var(--ink-2); padding:3px 7px; border-radius:6px; cursor:pointer; }
.mt-models .mtm:hover { background: var(--bg-alt); }
.mt-models .mtm .sw { width:9px; height:9px; border-radius:50%; flex:0 0 auto; }
@media (max-width:760px){ .mt-layout{flex-direction:column;} .mt-models{flex-basis:auto;flex-direction:row;flex-wrap:wrap;padding-top:0;} }

/* response explorer */
.explbl { font-family:var(--mono); font-size:.64rem; color:var(--muted-2); letter-spacing:.08em; text-transform:uppercase; }
.explorer-controls { display:flex; flex-wrap:wrap; gap:14px; align-items:flex-end; margin-bottom:16px; }
select.sel, input.search { background:#fff; border:1px solid var(--line-2); color:var(--ink); border-radius:9px; padding:9px 12px; font-family:var(--sans); font-size:.86rem; min-width:150px; }
select.sel:focus, input.search:focus { outline:none; border-color: var(--blue); }
.resp-list { display:flex; flex-direction:column; gap:13px; max-height: 760px; overflow-y:auto; padding-right:6px; }
.resp { flex:0 0 auto; border:1px solid var(--line); border-radius:12px; background:#fff; overflow:hidden; }
.resp-head { display:flex; flex-wrap:wrap; gap:9px; align-items:center; padding:11px 15px; border-bottom:1px solid var(--line); background: var(--bg-alt); }
.resp .mname { font-weight:700; font-size:.9rem; }
.resp .exptag { font-family:var(--mono); font-size:.66rem; color:var(--muted); }
.resp .verdict { font-family:var(--mono); font-size:.68rem; padding:3px 8px; border-radius:999px; font-weight:700; letter-spacing:.03em; }
.resp .verdict.ok  { background: rgba(31,111,229,.1); color: var(--blue-d); }
.resp .verdict.bad { background: rgba(226,59,78,.1); color: var(--red-d); }
.resp .meta-tags { display:flex; gap:5px; flex-wrap:wrap; margin-left:auto; }
.resp .mt { font-family:var(--mono); font-size:.66rem; color:var(--muted); background:#fff; border:1px solid var(--line); padding:2px 7px; border-radius:6px; }
.resp .resp-body { padding:13px 16px; font-size:.88rem; color:var(--ink-2); }
.resp .resp-body p { margin: 0 0 .6em; }
.resp .resp-body ul { margin:.2em 0 .7em; padding-left:1.2em; }
.resp .resp-body li { margin-bottom:.2em; }
.resp .resp-body strong { color: var(--ink); }
.resp .vcert { color: var(--blue-d); font-weight:600; background: rgba(31,111,229,.1); border-radius:4px; padding:0 3px; }
.resp .vbad  { color: var(--red-d);  font-weight:600; background: rgba(226,59,78,.1);  border-radius:4px; padding:0 3px; }
.resp .turn { padding:13px 16px; }
.resp .turn + .turn { border-top:1px dashed var(--line-2); }
.resp .turn .who { font-family:var(--mono); font-size:.66rem; letter-spacing:.05em; color:var(--muted-2); margin-bottom:6px; text-transform:uppercase; }
.resp .turn.user .who { color: var(--indigo); }
.count-note { font-size:.82rem; color:var(--muted); margin-bottom:10px; }

/* footer */
footer { padding: 26px 0; border-top:1px solid var(--line); color:var(--muted); font-size:.88rem; background: var(--bg-alt); }
footer .wrap { display:flex; gap:26px; justify-content:center; align-items:center; }
footer a { font-weight:600; }

.note { font-size:.8rem; color:var(--muted-2); margin-top:12px; }
.hl-blue { color: var(--blue-d); font-weight:600; }
.hl-red  { color: var(--red-d); font-weight:600; }

/* ============================================================
   Mobile / small-screen refinements
   ============================================================ */
@media (max-width: 720px){
  body { font-size: 15.5px; }
  .wrap { padding: 0 16px; }

  /* tighter vertical rhythm */
  section { padding: 40px 0; }
  header.hero { padding: 48px 0 32px; }
  .hero .lede { font-size: 1.06rem; margin-top: 16px; }
  .hero .cta { margin-top: 22px; }
  .hero .stats { margin-top: 32px; }
  section .head { margin-bottom: 22px; }
  section .head p { font-size: 1rem; }

  /* full-width tap targets for the primary actions */
  .hero .cta { gap: 10px; }
  .btn { padding: 12px 18px; }

  /* dashboard header: stack title and controls, let controls breathe */
  .dash-head { padding: 14px 16px; gap: 12px; }
  .grid-2 > .dash .dash-head { min-height: 0; }
  .controls { margin-left: 0; width: 100%; gap: 12px; }
  .ctl { flex: 1 1 auto; }
  .seg { width: 100%; }
  .seg button { flex: 1 1 0; padding: 8px 6px; }
  .dash-body { padding: 16px 14px; }

  /* charts: scroll horizontally at a legible size rather than shrinking text */
  .chartwrap { text-align: left; -webkit-overflow-scrolling: touch; }
  .chartwrap svg.chart { min-width: 460px; }

  /* heatmaps already scroll; nudge the legend below instead of beside */
  .heat-wrap { flex-direction: column; gap: 8px; }
  .vlegend { flex-direction: row; padding: 4px 0; gap: 10px; }
  .vlegend .vl-bar { width: 100%; height: 14px; min-height: 0; flex: 1;
    background: linear-gradient(to right, #27398c, #91bfdb, #ffd25a, #f46d43, #a50026); }

  /* explorer: full-width selects */
  .explorer-controls { gap: 10px; }
  .explorer-controls .ctl { flex: 1 1 140px; }
  select.sel, input.search { min-width: 0; width: 100%; }
  .resp-head { gap: 7px; }
  .resp .meta-tags { margin-left: 0; width: 100%; }

  /* tooltips must not exceed the viewport */
  #tip { max-width: calc(100vw - 24px); }

  .legend.big { gap: 14px; font-size: .86rem; }
  .callout { padding: 13px 14px; }
}

@media (max-width: 420px){
  .seg button { font-size: .78rem; }
  .chartwrap svg.chart { min-width: 380px; }
}
