/* =====================================================================
   Triago — Design System
   Pure CSS. No frameworks. Flat. Editorial. AI-native.
   ===================================================================== */

/* ---------- Tokens ---------- */
:root {
  --paper:        #F5F4F1;
  --surface:      #FFFFFF;
  --ink:          #0A0A0A;
  --ink-2:        #3A3A3A;
  --ink-3:        #7A7770;
  --line:         #E5E2DC;
  --line-2:       #D8D4CC;
  --line-strong:  #1A1A1A;
  --signal:       #E0431F;
  --signal-ink:   #7A1E0A;
  --ok:           #0F6B3A;
  --warn:         #A66A00;

  --container:    1200px;
  --reading:      68ch;

  --r-sm: 6px;
  --r-md: 10px;

  --s-1: 4px;   --s-2: 8px;   --s-3: 12px; --s-4: 16px;
  --s-5: 24px;  --s-6: 32px;  --s-7: 48px; --s-8: 64px;
  --s-9: 96px;  --s-10: 128px;

  --font-display: "Inter Tight", "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-body:    "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-7) 0; }
::selection { background: var(--ink); color: var(--paper); }

/* ---------- Type ---------- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s-4);
  color: var(--ink);
  line-height: 1.15;
}
h1 { font-size: clamp(2.25rem, 4.5vw + 0.5rem, 4.25rem); letter-spacing: -0.03em; line-height: 1.05; }
h2 { font-size: clamp(1.625rem, 2.2vw + 0.6rem, 2.5rem); }
h3 { font-size: clamp(1.25rem, 1vw + 0.9rem, 1.5rem); }
h4 { font-size: 1.125rem; }
p  { margin: 0 0 var(--s-4); color: var(--ink-2); }
small { color: var(--ink-3); font-size: 0.875rem; }
strong { color: var(--ink); font-weight: 600; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--signal);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--signal);
  border-radius: 50%;
  display: inline-block;
}
.kicker { color: var(--ink-3); font-size: 1.0625rem; max-width: 60ch; }
.mono { font-family: var(--font-mono); }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--s-5);
}
.section { padding: var(--s-9) 0; border-top: 1px solid var(--line); }
.section.tight { padding: var(--s-7) 0; }
.section.paper { background: var(--paper); }
.section.ink   { background: var(--ink); color: var(--paper); }
.section.ink h1, .section.ink h2, .section.ink h3 { color: var(--paper); }
.section.ink p { color: #BFBBB3; }

.row { display: grid; gap: var(--s-7); }
.row-2 { grid-template-columns: repeat(2, 1fr); }
.row-3 { grid-template-columns: repeat(3, 1fr); }
.row-4 { grid-template-columns: repeat(4, 1fr); }
.row-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
.row-aside { grid-template-columns: 280px minmax(0, 1fr); gap: var(--s-7); }

@media (max-width: 1024px) {
  .row-4 { grid-template-columns: repeat(2, 1fr); }
  .row-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .section { padding: var(--s-8) 0; }
  .row-2, .row-3, .row-4, .row-split, .row-aside { grid-template-columns: 1fr; gap: var(--s-6); }
}

/* ---------- Navbar ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: inline-flex; align-items: center; gap: var(--s-2); font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; font-size: 1.0625rem; }
.brand-mark {
  width: 22px; height: 22px;
  border: 1.5px solid var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
}
.brand-mark::after {
  content: ""; width: 8px; height: 8px; background: var(--signal); display: block;
}
.nav-links { display: flex; align-items: center; gap: var(--s-6); }
.nav-links a { font-size: 0.9375rem; color: var(--ink-2); }
.nav-links a:hover { color: var(--ink); }
.nav-cta { display: inline-flex; align-items: center; gap: var(--s-3); }

.nav-burger {
  display: none;
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  align-items: center; justify-content: center;
  border-radius: var(--r-sm);
}
.nav-burger span {
  display: block; width: 16px; height: 1.5px; background: var(--ink); position: relative;
}
.nav-burger span::before, .nav-burger span::after {
  content: ""; position: absolute; left: 0; width: 16px; height: 1.5px; background: var(--ink);
}
.nav-burger span::before { top: -5px; }
.nav-burger span::after  { top:  5px; }

@media (max-width: 920px) {
  .nav-links, .nav-cta .btn:not(.btn-primary) { display: none; }
  .nav-burger { display: inline-flex; }
}
.nav-drawer {
  display: none;
  border-top: 1px solid var(--line);
  padding: var(--s-5) 0;
  background: var(--surface);
}
.nav-drawer.open { display: block; }
.nav-drawer a { display: block; padding: var(--s-3) 0; color: var(--ink-2); border-bottom: 1px solid var(--line); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-primary:hover { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); }
.btn-secondary:hover { background: var(--paper); }
.btn-ghost { border-color: transparent; padding-left: 0; padding-right: 0; }
.btn-ghost:hover { color: var(--signal); }
.btn-lg { padding: 14px 22px; font-size: 1rem; }
.btn .arrow { display: inline-block; transition: transform .15s ease; }
.btn:hover .arrow { transform: translateX(2px); }

/* ---------- Hero ---------- */
.hero { padding: var(--s-10) 0 var(--s-9); position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse at top, #000 35%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at top, #000 35%, transparent 75%);
  opacity: 0.55;
  z-index: 0;
}
.hero > .container { position: relative; z-index: 1; }
.hero h1 { max-width: 22ch; }
.hero p.lede { font-size: 1.1875rem; color: var(--ink-2); max-width: 56ch; }
.hero-actions { display: inline-flex; gap: var(--s-3); margin-top: var(--s-5); flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-6);
}
.card.tight { padding: var(--s-5); }
.card h3 { margin-bottom: var(--s-2); }
.card p  { margin-bottom: 0; color: var(--ink-2); }
.card-link { display: block; transition: border-color .15s ease; }
.card-link:hover { border-color: var(--line-strong); }

.feature-icon {
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: var(--s-4);
}
.feature-icon svg { width: 18px; height: 18px; stroke: var(--ink); }

/* ---------- Stat bar ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden;
}
.stats > div {
  padding: var(--s-6);
  border-right: 1px solid var(--line);
}
.stats > div:last-child { border-right: 0; }
.stat-num { font-family: var(--font-display); font-size: 2.25rem; letter-spacing: -0.03em; font-weight: 600; }
.stat-num .unit { color: var(--signal); }
.stat-label { color: var(--ink-3); font-size: 0.875rem; margin-top: var(--s-1); }
@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats > div { border-bottom: 1px solid var(--line); }
  .stats > div:nth-child(2n) { border-right: 0; }
  .stats > div:nth-last-child(-n+2) { border-bottom: 0; }
}

/* ---------- Bento ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--s-4);
}
.bento .b {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-6);
  background: var(--surface);
  min-height: 240px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.bento .b-3 { grid-column: span 3; }
.bento .b-2 { grid-column: span 2; }
.bento .b-4 { grid-column: span 4; }
.bento .b-6 { grid-column: span 6; }
@media (max-width: 960px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
  .bento .b-3, .bento .b-2, .bento .b-4, .bento .b-6 { grid-column: span 2; }
}

/* ---------- Code / log viewer ---------- */
.code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  background: var(--ink);
  color: #E6E3DC;
  border-radius: var(--r-md);
  padding: var(--s-5);
  overflow-x: auto;
  border: 1px solid var(--ink);
}
.code .k { color: #F7B86A; }
.code .s { color: #9CDCA6; }
.code .c { color: #7A7770; }
.code .n { color: #E0431F; }

.log {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}
.log-head {
  display: flex; gap: var(--s-2); padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  align-items: center;
}
.log-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.log-dot.r { background: var(--signal); }
.log-body { padding: var(--s-4) var(--s-5); }
.log-line { display: flex; gap: var(--s-4); padding: 4px 0; color: var(--ink-2); }
.log-line .t { color: var(--ink-3); width: 80px; flex: none; }
.log-line .a { color: var(--signal); width: 92px; flex: none; }
.log-line .m { color: var(--ink); }

/* ---------- Agent trace ---------- */
.trace { display: grid; gap: var(--s-3); }
.trace-step {
  display: grid; grid-template-columns: 32px 1fr auto;
  gap: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5);
  background: var(--surface);
  align-items: center;
}
.trace-step .idx {
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  height: 28px; display: inline-flex; align-items: center; justify-content: center;
}
.trace-step h4 { margin: 0 0 2px; font-size: 0.9375rem; }
.trace-step p  { margin: 0; font-size: 0.875rem; color: var(--ink-3); }
.trace-step .tag { font-family: var(--font-mono); font-size: 0.75rem; color: var(--signal); }

/* ---------- Logos strip ---------- */
.logos {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: var(--s-5);
  align-items: center;
}
.logos .logo {
  font-family: var(--font-display); font-weight: 600;
  color: var(--ink-3); font-size: 1.0625rem; letter-spacing: -0.01em;
  text-align: center; padding: var(--s-3) 0;
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
@media (max-width: 720px) { .logos { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Comparison table ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.table th, .table td {
  padding: var(--s-4) var(--s-5);
  text-align: left;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  font-size: 0.9375rem;
  vertical-align: top;
}
.table th { background: var(--paper); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.table td:last-child, .table th:last-child { border-right: 0; }
.table .yes { color: var(--ok); font-weight: 600; }
.table .no  { color: var(--ink-3); }
.table .mid { color: var(--warn); }

/* ---------- Pricing ---------- */
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-5); }
.price-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-7);
  display: flex; flex-direction: column;
  background: var(--surface);
}
.price-card.feature { border-color: var(--line-strong); }
.price-card .name {
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-3);
}
.price-card .amount {
  font-family: var(--font-display); font-size: 2.75rem; letter-spacing: -0.03em;
  margin: var(--s-3) 0 var(--s-1); font-weight: 600;
}
.price-card .amount small { font-size: 0.9375rem; color: var(--ink-3); font-weight: 400; }
.price-card ul { list-style: none; padding: 0; margin: var(--s-5) 0; }
.price-card li { padding: var(--s-2) 0; border-bottom: 1px dashed var(--line); color: var(--ink-2); font-size: 0.9375rem; }
.price-card li::before { content: "—"; color: var(--signal); margin-right: var(--s-2); }
.price-card .btn { margin-top: auto; }
@media (max-width: 960px) { .price-grid { grid-template-columns: 1fr; } }

/* ---------- FAQ ---------- */
.faq { border-top: 1px solid var(--line); }
.faq details {
  border-bottom: 1px solid var(--line);
  padding: var(--s-5) 0;
}
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-display); font-weight: 600; font-size: 1.0625rem;
  color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .plus {
  width: 22px; height: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.875rem;
}
.faq details[open] summary .plus::before { content: "−"; }
.faq details:not([open]) summary .plus::before { content: "+"; }
.faq details p { margin-top: var(--s-3); color: var(--ink-2); max-width: 70ch; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-4); }
.field label {
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-3);
}
.field input, .field textarea, .field select {
  font: inherit; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--ink);
}
.field .hint { color: var(--ink-3); font-size: 0.8125rem; }
.field .err { color: var(--signal); font-size: 0.8125rem; display: none; }
.field.invalid .err { display: block; }
.field.invalid input { border-color: var(--signal); }

/* ---------- Badge / tag ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
}
.tag.signal { color: var(--signal); border-color: var(--signal); }
.tag.ok { color: var(--ok); border-color: var(--ok); }
.tag.warn { color: var(--warn); border-color: var(--warn); }

/* ---------- Tabs ---------- */
.tabs { border-bottom: 1px solid var(--line); display: flex; gap: var(--s-5); margin-bottom: var(--s-6); flex-wrap: wrap; }
.tabs button {
  padding: var(--s-3) 0;
  font-size: 0.9375rem;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button.active { color: var(--ink); border-bottom-color: var(--ink); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Footer ---------- */
.footer { background: var(--ink); color: #BFBBB3; padding: var(--s-9) 0 var(--s-6); }
.footer h5 { color: #fff; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: var(--s-4); }
.footer a { color: #BFBBB3; }
.footer a:hover { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: var(--s-6); }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { padding: 6px 0; font-size: 0.9375rem; }
.footer-bottom {
  margin-top: var(--s-8); padding-top: var(--s-5);
  border-top: 1px solid #2A2A2A;
  display: flex; justify-content: space-between; gap: var(--s-4);
  color: #7A7770; font-size: 0.8125rem;
}
.footer .brand-mark { border-color: #BFBBB3; }
.footer .brand { color: #fff; }
@media (max-width: 920px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-bottom { flex-direction: column; }
}

/* ---------- Docs sidebar ---------- */
.docs-side {
  border-right: 1px solid var(--line);
  padding-right: var(--s-5);
}
.docs-side h6 { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); margin: var(--s-5) 0 var(--s-2); }
.docs-side a { display: block; padding: 6px 0; color: var(--ink-2); font-size: 0.9375rem; border-left: 2px solid transparent; padding-left: 12px; margin-left: -12px; }
.docs-side a:hover { color: var(--ink); }
.docs-side a.active { color: var(--ink); border-left-color: var(--signal); font-weight: 500; }
.docs-content h2 { margin-top: var(--s-7); }

/* ---------- Dashboard preview ---------- */
.dash {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}
.dash-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-3);
}
.dash-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
}
.dash-side {
  border-right: 1px solid var(--line);
  padding: var(--s-4);
  font-size: 0.875rem;
}
.dash-side h6 { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin: var(--s-3) 0 var(--s-2); }
.dash-side a { display: block; padding: 6px 8px; color: var(--ink-2); border-radius: var(--r-sm); }
.dash-side a.active { background: var(--paper); color: var(--ink); }
.dash-main { padding: var(--s-5); }
.dash-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-4); margin-bottom: var(--s-5); }
.dash-kpi { border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--s-4); }
.dash-kpi .n { font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; }
.dash-kpi .l { color: var(--ink-3); font-size: 0.75rem; font-family: var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; }
.dash-rows { border: 1px solid var(--line); border-radius: var(--r-sm); }
.dash-row {
  display: grid; grid-template-columns: 90px 1fr 110px 120px 80px;
  align-items: center; gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
}
.dash-row:last-child { border-bottom: 0; }
.dash-row .id { font-family: var(--font-mono); color: var(--ink-3); }
.dash-row .ttl { color: var(--ink); }
@media (max-width: 720px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .dash-kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-row { grid-template-columns: 1fr 80px; }
  .dash-row .id, .dash-row .src, .dash-row .when { display: none; }
}

/* ---------- Utility ---------- */
.center { text-align: center; }
.muted  { color: var(--ink-3); }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-5); } .mt-6 { margin-top: var(--s-7); }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: var(--s-3); } .mb-4 { margin-bottom: var(--s-5); } .mb-6 { margin-bottom: var(--s-7); }
.max-60 { max-width: 60ch; }
.max-70 { max-width: 70ch; }
.divider-strong { border-top-color: var(--line-strong); }
.inline-list { display: flex; gap: var(--s-4); flex-wrap: wrap; }
.inline-list li { list-style: none; }

/* ---------- Focus ---------- */
:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ---------- Reduce motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
