/* Benchmark demo — shared styles (consistent with Velocity) */
:root {
  --accent: #0A3655;
  --accent-dark: #072540;
  --accent-light: #eef4f9;
  --alert: #A8313F;
  --alert-light: #fef2f2;
  --ink: #1f2937;
  --ink-light: #4b5563;
  --muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --bg: #f9fafb;
  --card: #ffffff;
  --good: #10b981;
  --warn: #f59e0b;
  --bad: var(--alert);
  --neutral: #6b7280;
  --serif: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.beta-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--accent);
  color: white;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 6px;
}

.brand {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand::before {
  content: "";
  width: 22px;
  height: 14px;
  background: url("optro-mark.svg") center/contain no-repeat;
  display: inline-block;
  flex-shrink: 0;
}

/* Optro brand mark — use in topbar slot before brand wordmark */
.pip {
  width: 28px;
  height: 18px;
  background: url("optro-mark.svg") center/contain no-repeat;
  display: inline-block;
  vertical-align: middle;
}
.pip.sm {
  width: 22px;
  height: 14px;
}

.accent { color: var(--accent); }
.bg-accent { background: var(--accent); color: white; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: white;
  color: var(--ink);
  text-decoration: none;
  transition: all 0.15s;
  font-family: inherit;
}
.btn:hover { background: #f3f4f6; }
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-dark); }

.demo-nav {
  border-bottom: 1px solid var(--border);
  background: white;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
.demo-nav a { color: var(--muted); text-decoration: none; font-size: 13px; }
.demo-nav a:hover { color: var(--ink); }

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* Filter chips */
.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 4px;
}
.filter-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  background: white;
  font-family: inherit;
  cursor: pointer;
}
.filter-select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.cohort-chip {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  background: #f3f4f6;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: monospace;
  font-weight: 500;
}
.cohort-chip.warn {
  background: #fef3c7;
  color: #92400e;
}

/* Metric cards */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .metric-grid { grid-template-columns: 1fr 1fr; } }

.metric-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.metric-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 12px -4px rgba(0,0,0,0.08);
}
.metric-card.behind { border-color: #fecaca; background: linear-gradient(135deg, var(--alert-light) 0%, white 60%); }
.metric-card.even   { border-color: var(--border); }
.metric-card.ahead  { border-color: #a7f3d0; background: linear-gradient(135deg, #ecfdf5 0%, white 60%); }

.metric-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}
.metric-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.metric-value .num {
  font-size: 36px;
  font-weight: 700;
  font-family: var(--serif);
  line-height: 1;
  letter-spacing: -0.02em;
}
.metric-value .unit { font-size: 14px; color: var(--muted); font-weight: 500; }
.metric-value.behind .num { color: var(--alert); }
.metric-value.ahead  .num { color: var(--good); }

.metric-vs {
  font-size: 12px;
  color: var(--ink-light);
  line-height: 1.5;
  margin-bottom: 12px;
}
.metric-vs strong { color: var(--ink); font-weight: 600; }

.metric-spark {
  height: 36px;
  margin: 12px 0 4px;
}

.metric-percentile {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}
.pct-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.pct-pill.bad     { background: var(--alert-light); color: var(--alert); }
.pct-pill.neutral { background: #f3f4f6; color: var(--ink-light); }
.pct-pill.good    { background: #ecfdf5; color: var(--good); }

/* Trajectory arrows */
.traj { font-size: 11px; font-weight: 600; }
.traj.down { color: var(--alert); }
.traj.up   { color: var(--good); }
.traj.flat { color: var(--muted); }

/* Detail drawer */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, 0.4);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0; right: 0;
  width: 720px;
  max-width: 100%;
  height: 100vh;
  background: white;
  z-index: 51;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
  box-shadow: -8px 0 32px -16px rgba(0,0,0,0.2);
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.drawer-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.drawer-body { padding: 24px; }

/* Charts */
.chart-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.chart-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

/* Peer commentary */
.peer-callout {
  padding: 16px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}
.peer-callout strong { font-weight: 600; }
.peer-callout .qty { color: var(--alert); font-weight: 600; font-family: var(--serif); }

/* Gate */
#gate-overlay {
  position: fixed;
  inset: 0;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  flex-direction: column;
  gap: 16px;
}
#gate-overlay.hidden { display: none; }
#gate-form { display: flex; gap: 8px; align-items: center; }
#gate-input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  outline: none;
}
#gate-input:focus { border-color: var(--accent); }
#gate-error {
  color: var(--alert);
  font-size: 12px;
  height: 16px;
}

/* Tables */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: #fafafa;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
table.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}
table.data-table tr:hover td { background: #fafafa; }

/* Print */
@media print {
  body { background: white; }
  .demo-nav, .drawer-backdrop, .drawer, button:not(.print-keep), .filter-bar select { display: none !important; }
  .card, .metric-card, .chart-card { break-inside: avoid; box-shadow: none; }
}

/* ============================================================
   REFINED POLISH — single layer, modern-minimalist quality
   Replaces all prior polish iterations. Scoped, non-destructive,
   focused on type rendering, focus rings, and transition easing.
   No universal border overrides. No layered shadows. No heavy
   chrome. Inspired by Harvey / Linear / Vercel design vocabulary.
   ============================================================ */

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-feature-settings: "ss01", "cv11", "cv02";
  letter-spacing: -0.005em;
}

h1, h2, h3, h4, h5, h6 {
  font-feature-settings: "ss01", "cv11", "cv02";
  letter-spacing: -0.022em;
  font-weight: 600;
}

h1 { line-height: 1.08; }
h2 { line-height: 1.2; }
h3 { line-height: 1.3; }

/* Subtle focus rings on interactive elements only */
*:focus { outline: none; }
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(10, 54, 85, 0.12);
}
a:focus-visible {
  outline: 2px solid rgba(10, 54, 85, 0.35);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Mono ligatures on code */
code, kbd, samp, pre,
.mono, [class*="mono"], [class*="-mono"] {
  font-feature-settings: "ss01", "cv01", "cv02", "cv11";
}

/* Smoother default easing on every transition */
* {
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Disable text-selection highlight on interactive nav chrome */
nav, button, .btn, [role="button"] {
  -webkit-tap-highlight-color: transparent;
}
