@charset "UTF-8";
/* ==================================================================
   CompareAIHardware — r3 "Instrument Panel" design system
   Ported from the approved frontend-redesign reference implementation
   (dark instrument-panel shell) with a variable-driven light theme.
   Loaded AFTER tokens.css on every page via partials/tokens.blade.php.
   Legacy content keeps working: body anchors + typography restyle.
   ================================================================== */

/* ------------------------------------------------------------------ */
/* 1. Tokens                                                           */
/* ------------------------------------------------------------------ */
:root {
  --paper: #07090e;
  --surface: #0d1118;
  --surface-2: #141a24;
  --surface-3: #1b2331;
  --surface-elevated: #222b3b;

  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.15);

  --ink: #f7fafc;
  --ink-2: #97a3b6;
  --ink-3: #616e82;

  --accent: #ff5500;
  --accent-ink: #ff7a33;
  --accent-soft: rgba(255, 85, 0, 0.12);

  --ok: #10b981;
  --ok-soft: rgba(16, 185, 129, 0.13);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.13);
  --bad: #ef4444;
  --bad-soft: rgba(239, 68, 68, 0.13);
  --info: #22d3ee;
  --info-soft: rgba(34, 211, 238, 0.13);

  /* theme-aware fills (components reference these, not raw rgba) */
  --fill-1: rgba(255, 255, 255, 0.045);
  --fill-2: rgba(255, 255, 255, 0.08);
  --well: rgba(0, 0, 0, 0.35);
  --topbar-bg: rgba(7, 9, 14, 0.82);
  --thead-bg: rgba(11, 15, 22, 0.96);
  --panel-grad-a: rgba(20, 26, 36, 0.7);
  --panel-grad-b: rgba(13, 17, 24, 0.92);
  --sidebar-grad-a: #0b0f16;
  --sidebar-grad-b: #080b11;
  --scroll-thumb: var(--surface-3);
  --selection-ink: #ffffff;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 16px 40px -12px rgba(0, 0, 0, 0.8);
  --shadow-pop: 0 28px 70px -20px rgba(0, 0, 0, 0.92);
  --focus-glow: rgba(255, 85, 0, 0.16);

  --sb-w: 252px;
  --sb-w-collapsed: 74px;
  --topbar-h: 56px;

  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --wrap-max: 1360px;
}

html[data-theme="light"] {
  --paper: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede6;
  --surface-3: #e5e2d8;
  --surface-elevated: #ffffff;

  --line: rgba(19, 19, 17, 0.12);
  --line-strong: rgba(19, 19, 17, 0.24);

  --ink: #131311;
  --ink-2: #4a493f;
  --ink-3: #76746a;

  --accent: #d4370c;
  --accent-ink: #a32a08;
  --accent-soft: rgba(212, 55, 12, 0.1);

  --ok: #1e7a4c;
  --ok-soft: rgba(30, 122, 76, 0.12);
  --warn: #b05a09;
  --warn-soft: rgba(176, 90, 9, 0.12);
  --bad: #b3261e;
  --bad-soft: rgba(179, 38, 30, 0.1);
  --info: #2b5aa6;
  --info-soft: rgba(43, 90, 166, 0.1);

  --fill-1: rgba(19, 19, 17, 0.04);
  --fill-2: rgba(19, 19, 17, 0.07);
  --well: #efede6;
  --topbar-bg: rgba(246, 245, 241, 0.86);
  --thead-bg: #efede6;
  --panel-grad-a: #ffffff;
  --panel-grad-b: #fbfaf7;
  --sidebar-grad-a: #efede6;
  --sidebar-grad-b: #e9e6dd;
  --scroll-thumb: #d6d2c6;
  --selection-ink: #ffffff;

  --shadow-1: 0 1px 2px rgba(19, 19, 17, 0.06);
  --shadow-2: 0 16px 40px -16px rgba(19, 19, 17, 0.25);
  --shadow-pop: 0 28px 70px -24px rgba(19, 19, 17, 0.35);
  --focus-glow: rgba(212, 55, 12, 0.14);
}

/* ------------------------------------------------------------------ */
/* 2. Base                                                             */
/* ------------------------------------------------------------------ */
html { color-scheme: dark; scroll-behavior: smooth; }
html[data-theme="light"] { color-scheme: light; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* hard body anchors so legacy page CSS cannot fight the theme */
html[data-theme="dark"] body,
html[data-theme="light"] body {
  background: var(--paper) !important;
  color: var(--ink) !important;
}

::selection { background: var(--accent); color: var(--selection-ink); }
a { color: inherit; text-decoration: none; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { filter: brightness(1.2); background-clip: content-box; }

/* ------------------------------------------------------------------ */
/* 3. App shell — fixed sidebar + topbar                               */
/* ------------------------------------------------------------------ */
.r3-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sb-w);
  z-index: 60;
  display: none;
  flex-direction: column;
  background: linear-gradient(180deg, var(--sidebar-grad-a) 0%, var(--sidebar-grad-b) 100%);
  border-right: 1px solid var(--line);
}
@media (min-width: 1024px) {
  .r3-sidebar { display: flex; }
  body { padding-left: var(--sb-w); }
  body.r3-sb-collapsed { padding-left: var(--sb-w-collapsed); }
  body.r3-sb-collapsed .r3-sidebar { width: var(--sb-w-collapsed); }
}

.r3-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  background: var(--topbar-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--line);
}

.r3-mainwrap { min-height: 60vh; }

/* brand */
.r3-brand-ico {
  display: flex;
  height: 32px;
  width: 32px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: linear-gradient(to bottom right, var(--surface-2), var(--surface));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.12);
  color: var(--accent);
  transition: border-color 150ms, box-shadow 150ms;
}
.r3-brand:hover .r3-brand-ico {
  border-color: rgba(255, 85, 0, 0.55);
  box-shadow: 0 0 16px var(--focus-glow);
}
html[data-theme="light"] .r3-brand-ico { box-shadow: inset 0 1px 1px rgba(255,255,255,.6); }

/* rail nav */
.r3-rail-section { padding: 4px 10px 10px; }
.r3-rail-label {
  display: block;
  padding: 12px 10px 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-family: var(--font-mono);
}
body.r3-sb-collapsed .r3-rail-label { text-align: center; padding: 14px 0 6px; }
body.r3-sb-collapsed .r3-rail-label::after {
  content: "";
  display: block;
  height: 1px;
  background: var(--line);
  margin-top: 6px;
}

.r3-rail-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 38px;
  padding: 0 10px;
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 140ms, color 140ms;
  white-space: nowrap;
  overflow: hidden;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: var(--font-body);
}
.r3-rail-link:hover { background: var(--fill-1); color: var(--ink); }
.r3-rail-link[data-active="true"] {
  background: linear-gradient(90deg, var(--accent-soft), transparent);
  color: var(--ink);
  font-weight: 600;
}
.r3-rail-link[data-active="true"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2.5px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.r3-rail-link[data-active="true"] .r3-rail-ico { color: var(--accent-ink); }

.r3-rail-ico { display: flex; width: 20px; justify-content: center; flex-shrink: 0; color: var(--ink-3); }
.r3-rail-text { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.r3-rail-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }

body.r3-sb-collapsed .r3-rail-text,
body.r3-sb-collapsed .r3-rail-meta { display: none; }
body.r3-sb-collapsed .r3-rail-link { justify-content: center; padding: 0; }

/* sidebar live-index box */
.r3-liveindex {
  border: 1px solid var(--line);
  background: var(--fill-1);
  border-radius: var(--r-md);
  padding: 10px 12px;
}
body.r3-sb-collapsed .r3-liveindex { display: none; }

/* ------------------------------------------------------------------ */
/* 4. Typography + labels                                              */
/* ------------------------------------------------------------------ */
.headline {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.12;
}
.label-caps {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-family: var(--font-mono);
}
.stat-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.tnum { font-variant-numeric: tabular-nums; }
.font-mono { font-family: var(--font-mono); }

/* legacy content typography restyle (inner pages keep their markup) */
main h1, .r3-prose h1 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.12;
  color: var(--ink);
}
main h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; color: var(--ink); scroll-margin-top: 84px; }
main h3 { font-family: var(--font-display); font-weight: 600; color: var(--ink); scroll-margin-top: 84px; }
main p, main li, main td, main th { line-height: 1.6; }
main a:not(.btn):not(.chip):not(.rail-link):not(.r3-rail-link) { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent-soft); text-underline-offset: 3px; transition: color 140ms, text-decoration-color 140ms; }
main a:not(.btn):not(.chip):not(.rail-link):not(.r3-rail-link):hover { color: var(--accent-ink); text-decoration-color: var(--accent); }

/* ------------------------------------------------------------------ */
/* 5. Layout helpers (replacing Tailwind utilities in ported markup)   */
/* ------------------------------------------------------------------ */
.r3-wrap { max-width: var(--wrap-max); margin: 0 auto; padding-left: 20px; padding-right: 20px; }
@media (min-width: 1024px) { .r3-wrap { padding-left: 32px; padding-right: 32px; } }
.r3-section { padding-top: 56px; padding-bottom: 56px; }
@media (min-width: 768px) { .r3-section { padding-top: 72px; padding-bottom: 72px; } }
.r3-section-alt { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--fill-1); }
.r3-grid { display: grid; gap: 20px; }
.r3-grid-2 { grid-template-columns: 1fr; }
.r3-grid-3 { grid-template-columns: 1fr; }
.r3-grid-4 { grid-template-columns: 1fr; }
@media (min-width: 640px) { .r3-grid-2, .r3-grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .r3-grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1024px) { .r3-grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .r3-grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.r3-split { display: grid; gap: 40px; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .r3-split { grid-template-columns: 1.3fr 1fr; gap: 56px; } }
.r3-flex { display: flex; }
.r3-flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.r3-flex-center { display: flex; align-items: center; gap: 8px; }
.r3-mt-2 { margin-top: 8px; } .r3-mt-3 { margin-top: 12px; } .r3-mt-4 { margin-top: 16px; }
.r3-mt-6 { margin-top: 24px; } .r3-mt-8 { margin-top: 32px; } .r3-mt-10 { margin-top: 40px; } .r3-mt-14 { margin-top: 56px; }
.r3-mb-2 { margin-bottom: 8px; } .r3-mb-3 { margin-bottom: 12px; } .r3-mb-4 { margin-bottom: 16px; } .r3-mb-6 { margin-bottom: 24px; }
.r3-muted { color: var(--ink-2); }
.r3-dim { color: var(--ink-3); }
.r3-accent { color: var(--accent-ink); }
.r3-t-center { text-align: center; }
.r3-clip2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.r3-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.r3-section-head { margin-bottom: 28px; }
.r3-section-head .label-caps { color: var(--accent-ink); }
.r3-section-head h2 { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 8px; color: var(--ink); }
@media (min-width: 768px) { .r3-section-head h2 { font-size: 34px; } }
.r3-section-head p { color: var(--ink-2); max-width: 760px; margin: 0; }

/* ------------------------------------------------------------------ */
/* 6. Panels, cards                                                    */
/* ------------------------------------------------------------------ */
.panel {
  background: linear-gradient(180deg, var(--panel-grad-a) 0%, var(--panel-grad-b) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--fill-1);
}

.card {
  background: linear-gradient(180deg, var(--panel-grad-a) 0%, var(--panel-grad-b) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), border-color 220ms, box-shadow 220ms;
}
.card-hover:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-2);
}

/* ------------------------------------------------------------------ */
/* 7. Buttons, chips, segmented, inputs                                */
/* ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-body);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 160ms cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}
.btn:active { transform: scale(0.975); }
.btn-primary {
  background: linear-gradient(135deg, #ff6a1a 0%, #e0430a 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(255, 85, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
html[data-theme="light"] .btn-primary {
  background: linear-gradient(135deg, #e04a12 0%, #c23108 100%);
  box-shadow: 0 2px 10px rgba(212, 55, 12, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover { box-shadow: 0 6px 24px rgba(255, 85, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35); transform: translateY(-1px); }
.btn-secondary { background: var(--fill-1); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--fill-2); border-color: var(--line-strong); }
.btn-tertiary { color: var(--ink-2); padding: 0 10px; }
.btn-tertiary:hover { color: var(--ink); background: var(--fill-1); }
.btn-ghost {
  height: 36px; min-width: 36px; width: auto; padding: 0 8px;
  color: var(--ink-2); background: transparent; border-radius: var(--r-md);
  gap: 6px;
}
.btn-ghost:hover { background: var(--fill-1); color: var(--ink); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: var(--r-sm); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 13px;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--fill-1);
  color: var(--ink-2);
  transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); background: var(--fill-2); }
.chip-on { border-color: rgba(255, 85, 0, 0.5); background: var(--accent-soft); color: var(--accent-ink); }
html[data-theme="light"] .chip-on { border-color: rgba(212, 55, 12, 0.45); }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.segmented > * {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 13px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  transition: all 150ms;
  white-space: nowrap;
}
.segmented > *:hover { color: var(--ink); background: var(--fill-1); }
.segmented > .seg-on {
  background: var(--surface-elevated);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
html[data-theme="light"] .segmented > .seg-on { box-shadow: var(--shadow-1); }

.input-field {
  width: 100%;
  height: 38px;
  padding: 0 14px;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--well);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: all 150ms;
  font-family: var(--font-body);
}
.input-field::placeholder { color: var(--ink-3); }
.input-field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-glow); outline: none; }

/* badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-2); background: var(--fill-1);
  white-space: nowrap;
}
.badge-ok { color: var(--ok); border-color: transparent; background: var(--ok-soft); }
.badge-warn { color: var(--warn); border-color: transparent; background: var(--warn-soft); }
.badge-bad { color: var(--bad); border-color: transparent; background: var(--bad-soft); }
.badge-info { color: var(--info); border-color: transparent; background: var(--info-soft); }
.badge-accent { color: var(--accent-ink); border-color: transparent; background: var(--accent-soft); }

/* ------------------------------------------------------------------ */
/* 8. Data tables                                                      */
/* ------------------------------------------------------------------ */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 16px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--thead-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: middle;
}
.data-table tbody th { padding: 12px 16px; text-align: left; color: var(--ink); font-weight: 600; }
.data-table tbody tr { transition: background-color 130ms; }
.data-table tbody tr:hover { background: var(--fill-1); }
.data-table .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--fill-1); }

/* generic restyle for legacy tables that don't use .data-table */
.table-cards .data-table thead { display: none; }
@media (max-width: 767px) {
  .table-cards .data-table thead { display: none; }
  .table-cards .data-table,
  .table-cards .data-table tbody,
  .table-cards .data-table tr,
  .table-cards .data-table td,
  .table-cards .data-table tbody th { display: block; width: 100%; }
  .table-cards .data-table tr {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    margin-bottom: 10px;
    padding: 4px 14px;
  }
  .table-cards .data-table td {
    border: 0;
    padding: 9px 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    text-align: right;
  }
  .table-cards .data-table td::before {
    content: attr(data-th);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
    text-align: left;
  }
}

/* ------------------------------------------------------------------ */
/* 9. Meters, pulse, backgrounds                                       */
/* ------------------------------------------------------------------ */
.meter { height: 5px; background: var(--fill-2); border-radius: 999px; overflow: hidden; }
.meter > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--focus-glow);
  animation: meter-in 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.meter > span[data-tone="line"] { background: var(--line-strong); box-shadow: none; }
.meter > span[data-tone="info"] { background: var(--info); box-shadow: none; }
@keyframes meter-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.pulse-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 9px var(--ok);
  animation: pulse-glow 2.2s infinite;
  flex-shrink: 0;
}
@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

.bg-tech-grid {
  background-image:
    linear-gradient(to right, var(--fill-1) 1px, transparent 1px),
    linear-gradient(to bottom, var(--fill-1) 1px, transparent 1px);
  background-size: 36px 36px;
}
.hero-glow {
  background:
    radial-gradient(900px 420px at 22% -8%, var(--accent-soft), transparent 65%),
    radial-gradient(760px 380px at 88% 8%, var(--info-soft), transparent 60%);
}

/* ------------------------------------------------------------------ */
/* 10. Prose                                                           */
/* ------------------------------------------------------------------ */
.prose-cai, .r3-prose { font-size: 15.5px; line-height: 1.78; color: var(--ink-2); }
.prose-cai h2, .r3-prose h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 46px 0 18px;
  scroll-margin-top: 88px;
}
.prose-cai h3, .r3-prose h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18.5px;
  color: var(--ink);
  margin: 34px 0 12px;
  scroll-margin-top: 88px;
}
.prose-cai p, .r3-prose p { margin: 0 0 18px; }
.prose-cai ul, .prose-cai ol, .r3-prose ul, .r3-prose ol { margin: 0 0 18px; padding-left: 22px; }
.prose-cai li, .r3-prose li { margin: 7px 0; }
.prose-cai ul li, .r3-prose ul li { list-style: square; }
.prose-cai li::marker, .r3-prose li::marker { color: var(--accent); }
.prose-cai strong, .r3-prose strong { color: var(--ink); font-weight: 600; }
.prose-cai blockquote, .r3-prose blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 16px 20px;
  margin: 26px 0;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--ink);
}
.prose-cai code, .r3-prose code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: var(--r-sm);
  color: var(--accent-ink);
}
.prose-cai a, .r3-prose a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: rgba(255, 85, 0, 0.45);
  text-underline-offset: 4px;
  transition: all 150ms;
}
html[data-theme="light"] .prose-cai a, html[data-theme="light"] .r3-prose a { text-decoration-color: rgba(212, 55, 12, 0.4); }
.prose-cai a:hover, .r3-prose a:hover { color: var(--accent-ink); text-decoration-color: var(--accent); }

/* ------------------------------------------------------------------ */
/* 11. Hero (homepage)                                                 */
/* ------------------------------------------------------------------ */
.r3-hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); padding-top: 48px; padding-bottom: 72px; }
@media (min-width: 768px) { .r3-hero { padding-top: 76px; padding-bottom: 104px; } }
.r3-hero h1 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.025em; line-height: 1.05; font-size: 40px; margin: 0; color: var(--ink); }
@media (min-width: 768px) { .r3-hero h1 { font-size: 68px; } }
.r3-hero h1 .r3-grad {
  background: linear-gradient(90deg, var(--accent), var(--accent-ink), #ffb066);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
html[data-theme="light"] .r3-hero h1 .r3-grad { background: linear-gradient(90deg, #d4370c, #ff6a1a, #b3540c); -webkit-background-clip: text; background-clip: text; }

.r3-searchbar {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 8px 8px 8px 20px;
  box-shadow: var(--shadow-2);
  transition: border-color 150ms, box-shadow 150ms;
}
.r3-searchbar:focus-within { border-color: var(--accent); box-shadow: 0 0 30px var(--focus-glow); }
.r3-searchbar input {
  height: 46px; width: 100%;
  background: transparent; border: 0; outline: none;
  font-size: 16px; font-weight: 500; color: var(--ink); font-family: var(--font-body);
}
.r3-searchbar input::placeholder { color: var(--ink-3); }
.r3-searchbar .btn { height: 46px; padding: 0 22px; }

.r3-statcard { border: 1px solid var(--line); background: var(--fill-1); border-radius: var(--r-lg); padding: 20px; }
.r3-statcard .stat-num { font-size: 32px; color: var(--ink); }
@media (min-width: 768px) { .r3-statcard .stat-num { font-size: 36px; } }

/* ------------------------------------------------------------------ */
/* 12. Search palette + compare tray + mobile drawer (overlays)        */
/* ------------------------------------------------------------------ */
.r3-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(2, 4, 8, 0.66);
  backdrop-filter: blur(4px);
  display: none;
}
html[data-theme="light"] .r3-overlay { background: rgba(19, 19, 17, 0.35); }
.r3-overlay[data-open="true"] { display: block; }

.r3-palette {
  position: fixed; z-index: 130;
  left: 50%; top: 90px; transform: translateX(-50%);
  width: min(640px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  display: none;
  overflow: hidden;
}
.r3-palette[data-open="true"] { display: block; animation: palette-pop 190ms cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes palette-pop { from { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(0.98); } to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); } }
.r3-palette-input {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.r3-palette-input input {
  flex: 1; height: 30px; background: transparent; border: 0; outline: none;
  font-size: 15.5px; color: var(--ink); font-family: var(--font-body);
}
.r3-palette-input input::placeholder { color: var(--ink-3); }
.r3-palette-results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.r3-palette-group { padding: 10px 12px 4px; }
.r3-palette-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--r-md);
  color: var(--ink-2); font-size: 14px;
}
.r3-palette-item:hover, .r3-palette-item[aria-selected="true"] { background: var(--fill-1); color: var(--ink); }
.r3-palette-item .r3-pal-name { color: var(--ink); font-weight: 600; }
.r3-palette-item .r3-pal-meta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-left: auto; white-space: nowrap; }
.r3-palette-empty { padding: 24px; text-align: center; color: var(--ink-3); font-size: 14px; }

.r3-tray {
  position: fixed; right: 20px; bottom: 20px; z-index: 110;
  width: min(380px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  display: none;
}
.r3-tray[data-open="true"] { display: block; animation: drawer-in 200ms cubic-bezier(0.16, 1, 0.3, 1) both; }

@keyframes drawer-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

/* mobile drawer nav */
.r3-mobiledrawer {
  position: fixed; inset: 0; z-index: 130;
  display: none;
}
.r3-mobiledrawer[data-open="true"] { display: block; }
.r3-mobiledrawer .r3-md-panel {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: min(320px, 86vw);
  background: linear-gradient(180deg, var(--sidebar-grad-a), var(--sidebar-grad-b));
  border-right: 1px solid var(--line-strong);
  overflow-y: auto;
  padding: 14px 12px 28px;
  animation: drawer-in 200ms cubic-bezier(0.16,1,0.3,1) both;
}
.r3-mobiledrawer .r3-md-backdrop {
  position: absolute; inset: 0;
  background: rgba(2, 4, 8, 0.6);
  animation: overlay-in 160ms ease-out both;
}
@media (min-width: 1024px) { .r3-mobile-only { display: none !important; } }
.r3-desktop-only { display: none !important; }
@media (min-width: 1024px) { .r3-desktop-only { display: inline-flex !important; } }

/* breadcrumbs in topbar */
.r3-crumbs { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 12px; min-width: 0; flex: 1; }
.r3-crumbs a, .r3-crumbs span { color: var(--ink-3); }
.r3-crumbs a:hover { color: var(--ink); }
.r3-crumbs .r3-crumb-sep { color: var(--ink-3); opacity: 0.7; flex-shrink: 0; }
.r3-crumbs [aria-current="page"] { color: var(--ink); font-weight: 600; }
.r3-crumb-chip {
  border: 1px solid var(--line); background: var(--fill-1);
  padding: 1px 7px; border-radius: var(--r-sm);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent-ink);
}

/* kbd hint */
.r3-kbd {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); background: var(--fill-1);
  padding: 3px 8px; border-radius: var(--r-sm);
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3);
}

/* ------------------------------------------------------------------ */
/* 13. Floating dock restyle (keeps existing feature, matches r3)      */
/* ------------------------------------------------------------------ */
.daihudock {
  background: var(--surface) !important;
  border: 1px solid var(--line-strong) !important;
  box-shadow: var(--shadow-2) !important;
}
.daihudock .dock-btn { background: var(--fill-1) !important; border: 1px solid var(--line) !important; color: var(--ink-2) !important; }
.daihudock .dock-btn:hover { background: var(--fill-2) !important; color: var(--ink) !important; }
.daihudock-tab { background: var(--surface) !important; border: 1px solid var(--line-strong) !important; color: var(--ink-2) !important; }

/* legacy header hidden when r3 shell active */
body.r3-shell .site-header { display: none !important; }

/* legacy stat/hero sections on inner pages get palette anchors */
html[data-theme="dark"] main, html[data-theme="light"] main { background: transparent; }

/* ------------------------------------------------------------------ */
/* 14. Reduced motion                                                  */
/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* ------------------------------------------------------------------ */
/* 15. r3 QA fixes (2026-09-12 vision pass)                            */
/* ------------------------------------------------------------------ */

/* legacy page tables: contain + restyle sitewide (prevents viewport overflow).
   Cells WRAP (long tokens like URLs break) so tables shrink to fit; anything
   still wider is wrapped by r3.js into .r3-tscroll with a visible edge fade. */
main table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
main table td, main table th { overflow-wrap: break-word; }

/* scrollable-table wrapper (built by r3.js when a table overflows) */
.r3-tscroll {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.r3-tscroll > table { display: table; width: max-content; min-width: 100%; border: 0; border-radius: 0; }
.r3-tscroll::after,
.r3-tscroll::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 56px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms;
  z-index: 1;
}
.r3-tscroll::after {
  right: 0;
  background: linear-gradient(90deg, transparent, var(--paper));
}
.r3-tscroll::before {
  left: 0;
  background: linear-gradient(270deg, transparent, var(--paper));
}
.r3-tscroll.can-right::after { opacity: 1; }
.r3-tscroll.can-left::before { opacity: 1; }
main table:not(.data-table) { border: 1px solid var(--line); border-radius: var(--r-md); }
main table:not(.data-table) th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--thead-bg);
  text-align: left;
  padding: 10px 14px;
}
main table:not(.data-table) td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
main table:not(.data-table) tr:hover td { background: var(--fill-1); }

/* skip link (was styled by nav.css, which r3 pages no longer load) */
.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 200;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--r-md);
  font-weight: 600;
  transition: top 150ms;
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

/* rail link breathing room so count badges never clip */
.r3-rail-link { padding-right: 14px; }
.r3-rail-meta { margin-left: 2px; }

/* floating dock: bottom-right at all widths; body reserves space on mobile */
.daihudock { top: auto !important; bottom: 20px !important; right: 14px !important; }
@media (max-width: 640px) {
  body { padding-bottom: 96px; }
}

/* filter/tool bars on legacy pages: wrap instead of overflowing */
main form, main .filters, main .filter-bar, main .toolbar { max-width: 100%; flex-wrap: wrap; }


/* ------------------------------------------------------------------ */
/* 16. r3 QA fix round 2                                               */
/* ------------------------------------------------------------------ */

/* badges must wrap — long Min/Rec strings must never overflow cards */
.badge { white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
/* …but badges inside table cells are short labels: keep them on one line */
td .badge, th .badge { white-space: nowrap; overflow-wrap: normal; max-width: none; }
.card { min-width: 0; overflow-wrap: anywhere; }

/* sidebar rail: immune to legacy page css that inflates link metrics */
.r3-sidebar nav ul, .r3-sidebar nav li { margin: 0 !important; padding: 0 !important; list-style: none !important; }
.r3-sidebar .r3-rail-link {
  height: 38px !important;
  line-height: 1.2 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  font-size: 13.5px !important;
  display: flex !important;
  box-sizing: border-box;
}
.r3-sidebar .r3-rail-label { line-height: 1.2 !important; }
