/* Ultragent site
   Color only carries state: deep green = done / primary action, amber = waiting for a person. */

/* IBM Plex, self-hosted (latin subset, SIL Open Font License) */
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/plex-sans-latin-var.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/plex-mono-latin-400.woff2") format("woff2");
}

:root {
  --paper: #F1F3F0;
  --paper-2: #E6EBE6;
  --panel: #FCFDFB;
  --ink: #17201D;
  --ink-2: #4B5752;
  --ink-3: #75817B;
  --line: #D2D9D3;
  --green: #0F6E5A;
  --green-deep: #0A5545;
  --green-soft: #DCEAE3;
  --amber: #E3A63A;
  --amber-soft: #F8ECD2;
  --amber-ink: #6E4B0C;
  --danger: #A33A2B;
  --danger-soft: #F6E1DC;

  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* 1.25 modular scale on a 16px base */
  --t-sm: 0.875rem;
  --t-base: 1rem;
  --t-md: 1.125rem;
  --t-lg: 1.5625rem;
  --t-xl: clamp(1.75rem, 1.2rem + 1.6vw, 2.4rem);
  --t-hero: clamp(2.4rem, 1.3rem + 3.4vw, 3.9rem);

  --wrap: 1160px;
  --gutter: clamp(20px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

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

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 6px;
  z-index: 10;
  text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---- Buttons and links ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-size: var(--t-base);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-deep); }
.btn-primary:disabled { background: var(--ink-3); cursor: progress; }
.btn-quiet { min-height: 38px; padding: 0 16px; border-color: var(--line); background: var(--panel); }
.btn-quiet:hover { border-color: var(--ink-3); }

.text-link {
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
}
.text-link:hover { color: var(--ink); text-decoration-color: currentColor; }

/* ---- Header ---- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--t-md);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.site-nav { display: flex; gap: 28px; margin-left: auto; }
.site-nav a {
  color: var(--ink-2);
  font-size: var(--t-sm);
  text-decoration: none;
}
.site-nav a:hover { color: var(--ink); }

.nav-toggle { display: none; }

@media (max-width: 760px) {
  .header-inner { gap: 12px; }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    margin-left: auto;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: var(--t-sm);
    cursor: pointer;
  }
  .nav-toggle[aria-expanded="true"] { background: var(--paper-2); }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 8px var(--gutter) 16px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 12px 0; font-size: var(--t-base); color: var(--ink); }
  .site-nav a + a { border-top: 1px solid var(--line); }
  .header-login { flex: none; }
}
/* Pages without the menu button (privacy, 404): push the login button right */
.header-inner > .brand + .header-login { margin-left: auto; }

/* ---- Hero ---- */

.hero { padding: clamp(56px, 9vw, 112px) 0 clamp(64px, 9vw, 120px); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(40px, 6vw, 88px);
  align-items: center;
}
.hero h1 {
  font-size: var(--t-hero);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
/* Each sentence starts its own line */
.hero h1 span { display: block; text-wrap: balance; }
.lede {
  max-width: 34em;
  margin-top: 24px;
  color: var(--ink-2);
  font-size: var(--t-md);
  line-height: 1.65;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  margin-top: 36px;
}

@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; }
}

/* ---- Run log (the hero's centerpiece) ---- */

.trace {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 0 rgba(23, 32, 29, 0.04), 0 18px 40px -24px rgba(15, 60, 48, 0.35);
  overflow: hidden;
}
.trace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--line);
}
.trace-title { font-weight: 600; line-height: 1.5; }
.trace-sub { color: var(--ink-3); font-size: var(--t-sm); }

.trace-status {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 9px;
  border-radius: 999px;
  font-size: var(--t-sm);
  font-weight: 600;
  white-space: nowrap;
}
.trace-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.trace-status[data-status="running"] { background: var(--paper-2); color: var(--ink-2); }
.trace-status[data-status="waiting"] { background: var(--amber-soft); color: var(--amber-ink); }
.trace-status[data-status="done"] { background: var(--green-soft); color: var(--green-deep); }

.trace-steps { padding: 10px 22px 6px; }

.step {
  position: relative;
  display: grid;
  grid-template-columns: 4.6em 1fr;
  gap: 4px 18px;
  padding: 10px 0 10px 26px;
  transition: opacity 0.35s ease;
}
/* Line connecting the steps */
.step::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.step:first-child::before { top: 21px; }
.step:last-child::before { bottom: calc(100% - 21px); }
/* State dot */
.step::after {
  content: "";
  position: absolute;
  left: 0;
  top: 15px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--panel);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
.step time {
  padding-top: 1px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.step-name { font-weight: 600; line-height: 1.6; }
.step-detail { color: var(--ink-2); font-size: var(--t-sm); line-height: 1.6; }
.nowrap { white-space: nowrap; }

.step[data-state="pending"] { opacity: 0.32; }
.step[data-state="pending"] time { visibility: hidden; }
.step[data-state="done"]::after { border-color: var(--green); background: var(--green); }
.step[data-state="waiting"]::after { border-color: var(--amber); background: var(--amber); animation: pulse 1.3s ease-in-out infinite; }
.step[data-state="waiting"] .step-name { color: var(--amber-ink); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(227, 166, 58, 0.55); }
  50% { box-shadow: 0 0 0 7px rgba(227, 166, 58, 0); }
}

.trace figcaption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 22px 14px;
  color: var(--ink-3);
  font-size: 0.8125rem;
}
.replay {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.replay:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .step, .step::after { transition: none; }
  .step[data-state="waiting"]::after { animation: none; }
}

@media (max-width: 480px) {
  .trace-head, .trace-steps, .trace figcaption { padding-left: 16px; padding-right: 16px; }
  .step { grid-template-columns: 1fr; gap: 0; }
}

/* ---- Sections ---- */

.section { padding: clamp(64px, 9vw, 112px) 0; border-top: 1px solid var(--line); }
.section-alt { background: var(--paper-2); }
.section h2 {
  max-width: 18em;
  font-size: var(--t-xl);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
}
.split-head { position: sticky; top: 104px; }
.split-head p { max-width: 26em; margin-top: 16px; color: var(--ink-2); }

@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .split-head { position: static; }
}

/* Onboarding steps are a real sequence, so they're numbered */
.steps { counter-reset: step; }
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 3rem 1fr;
  column-gap: 8px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}
.steps li:first-child { padding-top: 0; }
.steps li::before {
  content: counter(step);
  grid-row: span 2;
  color: var(--green);
  font-size: var(--t-lg);
  font-weight: 600;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.steps h3 { font-size: var(--t-md); font-weight: 600; line-height: 1.6; }
.steps p { max-width: 36em; margin-top: 6px; color: var(--ink-2); }

/* Use cases */
.cases {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 48px;
  border-top: 2px solid var(--ink);
}
.case { padding: 28px 28px 8px 0; }
.case + .case { padding-left: 28px; border-left: 1px solid var(--line); }
.case h3 { font-size: var(--t-lg); font-weight: 600; line-height: 1.4; }
.case-cols { display: grid; gap: 22px; margin-top: 22px; }
.by {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: var(--t-sm);
  font-weight: 600;
}
.by::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.by-agent { color: var(--green-deep); }
.by-agent::before { background: var(--green); }
.by-human { color: var(--amber-ink); }
.by-human::before { background: var(--amber); }
.case li {
  position: relative;
  padding-left: 16px;
  color: var(--ink-2);
  line-height: 1.7;
}
.case li + li { margin-top: 4px; }
.case li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.82em;
  width: 6px;
  height: 1px;
  background: var(--ink-3);
}

@media (max-width: 900px) {
  .cases { grid-template-columns: 1fr; }
  .case, .case + .case { padding: 28px 0; border-left: 0; }
  .case + .case { border-top: 1px solid var(--line); }
  .case-cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .case-cols { grid-template-columns: 1fr; }
}

/* Security */
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; }
.controls > div { padding: 24px 0; border-top: 1px solid var(--line); }
.controls > div:nth-child(-n + 2) { border-top: 0; padding-top: 0; }
.controls dt { font-size: var(--t-md); font-weight: 600; }
.controls dd { margin-top: 6px; color: var(--ink-2); }

@media (max-width: 600px) {
  .controls { grid-template-columns: 1fr; }
  .controls > div:nth-child(2) { border-top: 1px solid var(--line); padding-top: 24px; }
}

/* Contact */
.contact { background: var(--ink); color: var(--paper); border-top: 0; }
.contact h2 { max-width: 16em; }
.contact-inner > p { max-width: 34em; margin-top: 18px; color: #B9C4BE; font-size: var(--t-md); }
.contact-actions { margin-top: 32px; }
.contact .btn-primary { background: var(--paper); color: var(--ink); }
.contact .btn-primary:hover { background: #fff; }
.contact :focus-visible { outline-color: var(--paper); }
.contact .contact-note { margin-top: 28px; color: #93A09A; font-size: var(--t-sm); }
.contact-note a { color: var(--paper); text-underline-offset: 3px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 28px;
  padding-bottom: 28px;
  color: var(--ink-3);
  font-size: var(--t-sm);
}
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-inner a { text-decoration: none; }
.footer-inner a:hover { color: var(--ink); }

/* ---- Login ---- */

.auth-body { min-height: 100vh; display: flex; flex-direction: column; }
.auth-top { padding: 24px var(--gutter); }
.auth-main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px var(--gutter) 80px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
}
.auth-card h1 { font-size: var(--t-xl); font-weight: 600; line-height: 1.3; letter-spacing: -0.015em; }
.auth-card .auth-sub { margin-top: 8px; color: var(--ink-2); }
.auth-form { display: grid; gap: 18px; margin-top: 32px; }
.field { display: grid; gap: 6px; }
.field label { font-size: var(--t-sm); font-weight: 600; }
.field input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:hover { border-color: var(--ink-3); }
.field input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.auth-form .btn { width: 100%; margin-top: 6px; }

.form-error {
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--t-sm);
}
.form-error:empty { display: none; }

.auth-note {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: var(--t-sm);
}
.auth-note a { color: var(--ink); text-underline-offset: 3px; }

/* ---- Console ---- */

.console-main { padding: clamp(40px, 7vw, 80px) 0 96px; }
.console-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; }
.console-head h1 { font-size: var(--t-xl); font-weight: 600; line-height: 1.3; }
.console-head p { color: var(--ink-2); }
.account { display: flex; align-items: center; gap: 16px; margin-left: auto; font-size: var(--t-sm); color: var(--ink-2); }
.empty {
  margin-top: 40px;
  padding: clamp(28px, 5vw, 48px);
  border: 1px dashed var(--ink-3);
  border-radius: 10px;
  background: var(--panel);
}
.empty h2 { font-size: var(--t-lg); font-weight: 600; line-height: 1.4; }
.empty p { max-width: 36em; margin-top: 10px; color: var(--ink-2); }
.empty .btn { margin-top: 24px; }

/* ---- Long-form text (privacy) ---- */

.prose { max-width: calc(40em + 2 * var(--gutter)); padding-top: clamp(48px, 8vw, 88px); padding-bottom: 96px; }
.prose h1 { font-size: var(--t-xl); font-weight: 600; line-height: 1.3; letter-spacing: -0.015em; }
.prose-meta { margin-top: 8px; color: var(--ink-3); font-size: var(--t-sm); }
.prose h2 { margin-top: 44px; font-size: var(--t-md); font-weight: 600; }
.prose p { margin-top: 12px; color: var(--ink-2); line-height: 1.7; }
.prose-meta + p { margin-top: 32px; }
.prose a { color: var(--green-deep); text-underline-offset: 3px; }
.prose code { font-family: var(--mono); font-size: 0.875em; padding: 1px 5px; border-radius: 4px; background: var(--paper-2); color: var(--ink); }

/* ---- 404 ---- */

.notfound { padding: 120px 0; }
.notfound h1 { font-size: var(--t-xl); font-weight: 600; }
.notfound p { margin-top: 12px; color: var(--ink-2); }
.notfound .btn { margin-top: 28px; }
