/* Open RAG Engine landing page. System fonts only: nothing is fetched from
   a third party, so the page renders the same on a server with no internet. */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --text: #1d1d1f;
  /* #6e6e73 is 4.5:1 on white but not on #f5f5f7; this passes on both. */
  --text-2: #636366;
  --hairline: rgba(0, 0, 0, 0.08);
  --hairline-strong: rgba(0, 0, 0, 0.12);
  --accent: #2563eb;
  --accent-hover: #1d4fd8;
  --accent-text: #1d4fd8;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --on-accent: #ffffff;
  --mark: rgba(37, 99, 235, 0.14);
  --code-bg: #1d1d1f;
  --code-text: #f5f5f7;
  --nav-bg: rgba(255, 255, 255, 0.72);
  --ok: #1f8a3b;
  --warn: #b25e00;
  --bad: #d70015;
  --idle: #8e8e93;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.03), 0 12px 24px rgba(0, 0, 0, 0.06),
    0 32px 64px rgba(0, 0, 0, 0.08);
  --radius-lg: 28px;
  --radius: 20px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --gutter: clamp(20px, 5vw, 48px);
  color-scheme: light dark;
}

/* Dark applies when the visitor chose it, or when the system asks for it and
   the visitor did not choose light. CSS cannot put a selector and a media
   query in one rule, so the block appears twice; test_landing.py fails
   if the copies differ. */
:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #000000;
  --bg-alt: #111113;
  --surface: #1c1c1e;
  --surface-2: #161618;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --hairline: rgba(255, 255, 255, 0.1);
  --hairline-strong: rgba(255, 255, 255, 0.16);
  --accent-hover: #3b76f6;
  --accent-text: #6ea0ff;
  --accent-soft: rgba(110, 160, 255, 0.16);
  --mark: rgba(110, 160, 255, 0.22);
  --code-bg: #2c2c2e;
  --code-text: #f5f5f7;
  --nav-bg: rgba(22, 22, 24, 0.72);
  --ok: #32d74b;
  --warn: #ffb340;
  --bad: #ff6961;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 16px 32px rgba(0, 0, 0, 0.4),
    0 40px 80px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-alt: #111113;
    --surface: #1c1c1e;
    --surface-2: #161618;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --hairline: rgba(255, 255, 255, 0.1);
    --hairline-strong: rgba(255, 255, 255, 0.16);
    --accent-hover: #3b76f6;
    --accent-text: #6ea0ff;
    --accent-soft: rgba(110, 160, 255, 0.16);
    --mark: rgba(110, 160, 255, 0.22);
    --code-bg: #2c2c2e;
    --code-text: #f5f5f7;
    --nav-bg: rgba(22, 22, 24, 0.72);
    --ok: #32d74b;
    --warn: #ffb340;
    --bad: #ff6961;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 16px 32px rgba(0, 0, 0, 0.4),
      0 40px 80px rgba(0, 0, 0, 0.5);
  }
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1,
h2,
h3,
p,
ol,
figure,
pre {
  margin: 0;
}

a {
  color: var(--accent-text);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

img,
svg {
  display: block;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  letter-spacing: 0;
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--text);
  overflow-wrap: anywhere;
}

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 20;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
}

.skip:focus {
  top: 12px;
}

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

/* --- navigation ------------------------------------------------------------ */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--hairline);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .nav {
    background: var(--nav-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
  }
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1080px;
  height: 56px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-link {
  font-size: 15px;
  white-space: nowrap;
}

/* --- theme switcher ---------------------------------------------------------- */

.theme {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--bg-alt);
}

.theme button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.theme button:hover {
  color: var(--text);
}

.theme button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm), 0 0 0 0.5px var(--hairline-strong);
}

.theme svg {
  width: 15px;
  height: 15px;
}

/* --- live status ------------------------------------------------------------ */

.status,
.status-words {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
}

.status {
  height: 28px;
  padding: 0 11px 0 10px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--idle);
  flex: none;
}

[data-state="ready"] .status-dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent);
}

[data-state="starting"] .status-dot {
  background: var(--warn);
}

[data-state="unavailable"] .status-dot {
  background: var(--bad);
}

/* --- hero ------------------------------------------------------------------- */

.hero {
  padding: clamp(56px, 7vw, 96px) 0 clamp(64px, 9vw, 112px);
  text-align: center;
}

.hero-copy {
  max-width: 880px;
}

.eyebrow {
  margin-bottom: 14px;
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(44px, 7.4vw, 80px);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.lede {
  max-width: 34ch;
  margin: 22px auto 0;
  color: var(--text-2);
  font-size: clamp(19px, 2.2vw, 24px);
  line-height: 1.38;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.actions {
  margin-top: 36px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 26px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 17px;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25), 0 6px 16px rgba(37, 99, 235, 0.2);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.button:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.button:active {
  transform: scale(0.98);
}

/* --- product shot ----------------------------------------------------------- */

.shot {
  max-width: 1080px;
  margin: clamp(48px, 5vw, 64px) auto 0;
  padding: 0 var(--gutter);
}

.stage {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px) clamp(14px, 4vw, 56px) clamp(28px, 5vw, 56px);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 80% at 50% 0%, var(--accent-soft), transparent 70%),
    var(--bg-alt);
  border: 1px solid var(--hairline);
  text-align: left;
}

.chat {
  position: relative;
  z-index: 1;
  max-width: 560px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.chat-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--hairline);
  font-size: 14px;
}

.chat-title {
  font-weight: 600;
}

.chat-meta {
  color: var(--text-2);
}

.chat-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 20px 22px;
  font-size: 15px;
  line-height: 1.45;
}

.bubble {
  max-width: 88%;
  padding: 11px 15px;
  border-radius: 18px;
}

.bubble-user {
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
}

.bubble-bot {
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  background: var(--bg-alt);
}

.cite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-left: 5px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 600;
  vertical-align: 1px;
}

.verdict {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  color: var(--text-2);
  font-size: 13px;
}

.verdict-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}

.source {
  position: relative;
  z-index: 2;
  max-width: 400px;
  margin: -28px 0 0 auto;
  padding: 16px 18px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
}

.source-head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.source-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.source-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.source-page {
  margin-left: auto;
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
}

.source-path {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 13px;
}

.source-text {
  margin-top: 10px;
  padding-left: 12px;
  border-left: 2px solid var(--accent);
  line-height: 1.5;
}

mark {
  padding: 0 2px;
  border-radius: 4px;
  background: var(--mark);
  color: inherit;
}

figcaption {
  margin-top: 18px;
  color: var(--text-2);
  font-size: 13px;
  text-align: center;
}

/* --- sections --------------------------------------------------------------- */

.band,
.section {
  padding: clamp(72px, 10vw, 120px) 0;
}

.band {
  background: var(--bg-alt);
}

h2 {
  max-width: 22ch;
  font-size: clamp(30px, 4.4vw, 48px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

h3 {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.012em;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 48px;
  padding: 0;
  list-style: none;
}

.step {
  padding: 26px 24px 28px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-sm);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 600;
}

.step p,
.card p {
  margin-top: 8px;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1.5;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 48px;
}

.card {
  padding: 32px 30px 34px;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
}

.card-icon {
  width: 30px;
  height: 30px;
  margin-bottom: 22px;
  color: var(--accent-text);
}

/* --- signing in ------------------------------------------------------------- */

.guide {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 32px 64px;
  align-items: start;
}

.guide-intro {
  position: sticky;
  top: 96px;
}

.guide-lede {
  margin-top: 18px;
  color: var(--text-2);
  max-width: 36ch;
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0;
  list-style: none;
  counter-reset: guide;
}

.guide-steps li {
  position: relative;
  padding: 24px 26px 26px 72px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-sm);
  counter-increment: guide;
}

.guide-steps li::before {
  content: counter(guide);
  position: absolute;
  left: 24px;
  top: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 600;
}

.guide-steps p {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 16px;
}

.guide-steps .note {
  font-size: 14px;
}

pre {
  margin-top: 12px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  color: var(--code-text);
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.55;
}

pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  overflow-wrap: normal;
  white-space: pre;
}

.guide-help {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.help {
  padding: 22px 24px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline-strong);
}

.help h3 {
  font-size: 16px;
}

.help p {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 15px;
}

/* --- closing ---------------------------------------------------------------- */

.cta {
  padding: clamp(88px, 12vw, 144px) 0;
  text-align: center;
}

.cta-inner h2 {
  margin: 0 auto;
  font-size: clamp(36px, 5.6vw, 60px);
}

.cta-inner p {
  margin: 16px auto 32px;
  color: var(--text-2);
  font-size: 19px;
}

.footer {
  border-top: 1px solid var(--hairline);
  background: var(--bg-alt);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 22px;
  padding-bottom: 22px;
  color: var(--text-2);
  font-size: 13px;
}

/* --- responsive ------------------------------------------------------------- */

@media (max-width: 900px) {
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cards {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .guide {
    grid-template-columns: minmax(0, 1fr);
  }

  .guide-intro {
    position: static;
  }

  .guide-help {
    grid-column: 1;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 16px;
  }

  .steps,
  .guide-help {
    grid-template-columns: minmax(0, 1fr);
  }

  .steps {
    gap: 12px;
  }

  .nav-actions {
    gap: 12px;
  }

  .brand {
    font-size: 15px;
  }

  .chat-body {
    padding: 16px 14px 18px;
  }

  .bubble {
    max-width: 94%;
  }

  .source {
    margin: -16px 6px 0 18px;
  }

  .guide-steps li {
    padding: 64px 20px 22px;
  }

  .guide-steps li::before {
    left: 20px;
    top: 20px;
  }

  .card {
    padding: 26px 24px 28px;
  }
}

/* The live status is the first thing to go when the bar is narrow: the
   footer repeats it in words. */
@media (max-width: 520px) {
  .nav .status {
    display: none;
  }
}

@media (max-width: 400px) {
  .nav-actions {
    gap: 8px;
  }

  .brand {
    gap: 8px;
  }

  .theme button {
    width: 26px;
  }
}

/* --- motion ----------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .rise {
    animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .rise-2 {
    animation-delay: 0.06s;
  }

  .rise-3 {
    animation-delay: 0.12s;
  }

  .rise-4 {
    animation-delay: 0.18s;
  }

  .rise-5 {
    animation-delay: 0.3s;
    animation-duration: 1.1s;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(14px);
    }

    to {
      opacity: 1;
      transform: none;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
