/* ============================================================
   Alignment Drift — violet palette, dense data dashboard
   ============================================================ */
:root {
  --bg:            #FBFBFE;
  --bg-soft:       #F4F1FB;
  --bg-elevated:   #FFFFFF;
  --fg:            #18102B;
  --fg-soft:       #2D1B59;
  --muted:         #6B617F;
  --border:        #E6E1F1;
  --border-strong: #CDC4E0;

  --brand:         #6D28D9;
  --brand-strong:  #5B21B6;
  --brand-soft:    #DDD6FE;
  --accent:        #A78BFA;

  /* Model colors — used on the chart legend + lines */
  --c-bart:        #6D28D9;
  --c-t5:          #06B6D4;
  --c-pegasus:     #F59E0B;

  --good:          #10B981;
  --warn:          #F59E0B;
  --danger:        #DC2626;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(24,16,43,0.06);
  --shadow-md: 0 8px 24px rgba(24,16,43,0.08), 0 2px 6px rgba(24,16,43,0.05);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --container: 1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--fg);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; transition: color 120ms, border-color 120ms; }
a:hover { color: var(--brand); }

h1, h2, h3 { font-family: var(--font-sans); font-weight: 800; letter-spacing: -0.02em; margin: 0 0 0.5em; color: var(--fg); }
h1 { font-size: clamp(2rem, 4vw + 1rem, 3.3rem); line-height: 1.06; }
h2 { font-size: clamp(1.4rem, 1.6vw + 1rem, 2.1rem); line-height: 1.15; }
h3 { font-size: 1.05rem; font-weight: 700; }

p { margin: 0 0 1em 0; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
code, .mono { font-family: var(--font-mono); font-size: 0.9em; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 1.25rem; }
.row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .row { padding: 0.85rem 0; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 0.7rem; color: var(--brand); }
.brand .mark {
  width: 40px; height: 40px; border-radius: 999px;
  border: 2px solid var(--brand);
  display: grid; place-items: center; background: var(--bg);
}
.brand .wordmark { line-height: 1.1; display: flex; flex-direction: column; }
.brand .wordmark span { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.01em; }
.brand .wordmark small { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--muted); font-weight: 600; }
.nav { display: flex; gap: 1.3rem; }
.nav a { color: var(--muted); font-weight: 500; font-size: 0.93rem; }
.nav a:hover { color: var(--brand); }

/* ===== Hero ===== */
.hero { padding: 4rem 0 3.5rem; text-align: center; }
.hero .eyebrow {
  display: inline-block; padding: 0.35em 0.95em;
  border: 1px solid var(--brand-soft); border-radius: 999px;
  background: rgba(109,40,217,0.06); color: var(--brand);
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.16em;
  margin-bottom: 1.25rem;
}
.hero h1 .accent {
  background: linear-gradient(120deg, var(--brand) 0%, var(--accent) 60%, var(--c-t5) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lede { max-width: 64ch; margin: 0 auto 1.5rem; color: var(--muted); font-size: 1.05rem; }
.hero-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.6em 1.25em;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; font-size: 0.92rem;
  cursor: pointer; transition: all 120ms;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.btn-secondary { background: #fff; color: var(--fg); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }

/* ===== Sections ===== */
.section { padding: 3.5rem 0; }
.section-muted { background: var(--bg-soft); }
.section-head { margin-bottom: 1.5rem; }
.section-head .eyebrow {
  display: inline-block;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--brand); margin-bottom: 0.45rem;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* ===== Picker bar ===== */
.picker-bar {
  padding: 1rem;
  display: grid; grid-template-columns: 1.6fr 1fr 0.9fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 900px) { .picker-bar { grid-template-columns: 1fr; } }
.picker { display: flex; flex-direction: column; gap: 0.4rem; }
.picker > label {
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted);
}
.seg { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.seg button {
  font: inherit; font-size: 0.84rem; font-weight: 600;
  background: #fff; color: var(--fg);
  border: 1.5px solid var(--border-strong);
  padding: 0.45em 0.9em;
  border-radius: var(--radius-pill);
  cursor: pointer; transition: all 120ms;
}
.seg button:hover { border-color: var(--brand); color: var(--brand); }
.seg button.active {
  background: var(--brand); color: #fff; border-color: var(--brand);
  box-shadow: 0 4px 14px rgba(109,40,217,0.3);
}
.seg-sm button { padding: 0.4em 0.85em; font-size: 0.82rem; }

/* ===== Dashboard grid ===== */
.dash-grid {
  display: grid; grid-template-columns: 1.4fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

.dash-conv { padding: 1.25rem; min-height: 380px; max-height: 480px; overflow: hidden; display: flex; flex-direction: column; }
.dash-conv h3 { margin: 0 0 0.15rem; }
.conv-list {
  list-style: none; padding: 0; margin: 0.5rem 0 0;
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.45rem;
}
.conv-list .turn {
  display: grid; grid-template-columns: 56px 1fr auto;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border-left: 3px solid var(--brand-soft);
  animation: turn-in 280ms ease;
  align-items: center;
}
@keyframes turn-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.conv-list .turn .lbl {
  font-family: var(--font-mono);
  font-size: 0.74rem; color: var(--brand);
  font-weight: 700;
}
.conv-list .turn .desc { font-size: 0.86rem; line-height: 1.4; }
.conv-list .turn .scs {
  font-family: var(--font-mono);
  font-size: 0.85rem; font-weight: 700;
}
.conv-list .turn.warn  { border-left-color: var(--warn); }
.conv-list .turn.danger { border-left-color: var(--danger); }
.conv-list .turn.warn .scs  { color: var(--warn); }
.conv-list .turn.danger .scs { color: var(--danger); }

/* ===== Metric cards ===== */
.dash-metrics {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.metric-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.95rem;
  display: flex; flex-direction: column; gap: 0.5rem;
  min-height: 110px;
}
.metric-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.4rem; }
.metric-head strong { font-size: 1.05rem; color: var(--brand); }
.metric-head span { font-size: 0.74rem; color: var(--muted); text-align: right; }
.metric-foot { font-size: 0.78rem; color: var(--muted); margin-top: auto; }
.bar { height: 8px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 360ms ease;
}
.metric-card[data-key="OAI"] .bar-fill { background: linear-gradient(90deg, var(--warn), var(--danger)); }
.metric-card[data-key="AHE"] .bar-fill { background: linear-gradient(90deg, var(--c-t5), var(--brand)); }

/* SCS gauge (radial) */
.gauge {
  --pct: 100;
  width: 90px; height: 90px;
  border-radius: 999px;
  background:
    conic-gradient(var(--brand) calc(var(--pct) * 1%), var(--bg-soft) 0);
  display: grid; place-items: center;
  position: relative;
  margin: 0 auto;
  transition: --pct 360ms ease;
}
.gauge::after {
  content: '';
  position: absolute; inset: 8px;
  background: var(--bg-elevated);
  border-radius: 999px;
}
.gauge-val {
  position: relative; z-index: 1;
  font-size: 1rem; font-weight: 700; color: var(--fg);
}

/* TPT */
.tpt-val { font-size: 2rem; font-weight: 800; color: var(--danger); line-height: 1; }
.tpt-val.pending { color: var(--good); font-size: 1.4rem; }

/* ===== Chart card ===== */
.chart-card { padding: 1.25rem; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.chart-head h3 { margin: 0; }
.legend { display: flex; gap: 0.85rem; flex-wrap: wrap; }
.legend .item {
  display: inline-flex; align-items: center; gap: 0.4em;
  font-size: 0.82rem; color: var(--muted); font-weight: 600;
}
.legend .item .swatch { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.legend .item.dim { opacity: 0.35; }
canvas#chart { width: 100%; height: auto; display: block; }

/* ===== Metric defs ===== */
.metric-defs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.def {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem;
}
.def strong { color: var(--brand); display: block; margin-bottom: 0.4rem; }
.def p { margin: 0; font-size: 0.92rem; color: var(--muted); }
.def code { background: var(--bg-soft); padding: 0.1em 0.4em; border-radius: 4px; }

/* ===== Footer ===== */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--border); }
.site-footer .legal { padding: 1rem 0 1.5rem; font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--border); }
.footlist { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.footlist li a { display: block; padding: 0.2rem 0; color: var(--muted); font-size: 0.9rem; }
.footlist li a:hover { color: var(--brand); }
