/* Dark is the default look (bare :root). Light mode applies either from the OS preference
   (prefers-color-scheme) or from an explicit user choice via the toggle button, which always
   wins over the OS setting in both directions — see the two override blocks below. */
:root {
  --bg: #0a0b0f;
  --bg-raised: #101219;
  --bg-card: #14161f;
  --border: #23262f;
  --text: #f2f3f5;
  --text-dim: #9a9ea8;
  --text-dimmer: #6b6f78;
  --accent: #4a9eea;
  --accent-strong: #2e7fd0;
  --accent-soft: rgba(74, 158, 234, 0.12);
  --shadow: rgba(0, 0, 0, 0.6);
  --header-bg: rgba(10, 11, 15, 0.85);
  --terminal-out: #6fd08c;
  --radius: 12px;
  --wrap: 1120px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #ffffff;
    --bg-raised: #f2f4f7;
    --bg-card: #f9fafb;
    --border: #e3e6ec;
    --text: #14161f;
    --text-dim: #565a66;
    --text-dimmer: #888c96;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --accent-soft: rgba(37, 99, 235, 0.08);
    --shadow: rgba(20, 22, 31, 0.1);
    --header-bg: rgba(255, 255, 255, 0.85);
    --terminal-out: #15803d;
  }
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-raised: #f2f4f7;
  --bg-card: #f9fafb;
  --border: #e3e6ec;
  --text: #14161f;
  --text-dim: #565a66;
  --text-dimmer: #888c96;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --shadow: rgba(20, 22, 31, 0.1);
  --header-bg: rgba(255, 255, 255, 0.85);
  --terminal-out: #15803d;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

a {
  color: inherit;
}

code {
  font-family: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.4em;
  font-size: 0.9em;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s ease;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}

.brand-icon {
  height: 24px;
  width: auto;
  display: block;
}

/* The icon is a dark stroke on transparent — inverted to white for dark backgrounds. Dark is the
   default look (see the token comment at the top of this file), so invert is the base state;
   it's switched off wherever the light palette applies instead. */
.brand-icon,
.footer-icon {
  filter: invert(1);
  transition: filter 0.15s ease;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .brand-icon,
  :root:not([data-theme="dark"]) .footer-icon {
    filter: none;
  }
}

:root[data-theme="light"] .brand-icon,
:root[data-theme="light"] .footer-icon {
  filter: none;
}

.brand-word {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--text);
}

.main-nav {
  display: flex;
  gap: 24px;
  margin-right: auto;
}

.main-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92rem;
  transition: color 0.15s ease;
}

.main-nav a:hover {
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-dimmer);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

.theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .icon-sun {
    display: none;
  }

  :root:not([data-theme="dark"]) .theme-toggle .icon-moon {
    display: block;
  }
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--text-dimmer);
}

.btn-outline {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent-soft);
}

.btn-coffee {
  border-color: #d99a3d;
  color: #d99a3d;
}

.btn-coffee:hover {
  background: rgba(217, 154, 61, 0.12);
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.88rem;
}

/* Hero */

.hero {
  padding: 88px 0 96px;
  border-bottom: 1px solid var(--border);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 16px;
}

.hero h1 {
  font-size: clamp(2.4rem, 4.5vw, 3.4rem);
  line-height: 1.08;
  margin: 0 0 20px;
  letter-spacing: -0.02em;
}

.lede {
  font-size: 1.1rem;
  color: var(--text-dim);
  margin: 0 0 32px;
  max-width: 46ch;
}

.hero-actions {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
}

.hero-note {
  color: var(--text-dimmer);
  font-size: 0.85rem;
  margin: 0;
}

/* Terminal mock */

.terminal {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 60px -25px var(--shadow);
}

.terminal-bar {
  display: flex;
  gap: 7px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-red {
  background: #ff5f57;
}

.dot-yellow {
  background: #febc2e;
}

.dot-green {
  background: #28c840;
}

.terminal-body {
  margin: 0;
  padding: 20px 22px 24px;
  font-family: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
  line-height: 1.75;
  overflow-x: auto;
}

.terminal-body code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: var(--text);
}

.tok-prompt {
  color: var(--accent);
  margin-right: 0.6em;
}

.tok-muted {
  color: var(--text-dimmer);
}

.tok-out {
  color: var(--terminal-out);
}

.terminal-wide {
  max-width: 640px;
  margin: 36px auto 0;
  text-align: left;
}

/* Contrast section */

.contrast {
  padding: 72px 0;
  border-bottom: 1px solid var(--border);
}

.contrast-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.contrast-card {
  border-radius: var(--radius);
  padding: 32px;
  border: 1px solid var(--border);
}

.contrast-card h3 {
  margin: 0 0 18px;
  font-size: 1.1rem;
}

.contrast-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.contrast-card li {
  margin-bottom: 12px;
}

.contrast-card li:last-child {
  margin-bottom: 0;
}

.contrast-old {
  background: var(--bg-card);
  opacity: 0.75;
}

.contrast-old h3 {
  color: var(--text-dim);
}

.contrast-new {
  background: linear-gradient(180deg, var(--accent-soft), transparent 60%), var(--bg-card);
  border-color: var(--accent-strong);
}

.contrast-new h3 {
  color: var(--accent);
}

.contrast-new code {
  background: rgba(255, 255, 255, 0.06);
}

/* Section shared */

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  letter-spacing: -0.01em;
  margin: 0 0 40px;
  text-align: center;
}

/* Features */

.features {
  padding: 96px 0;
  border-bottom: 1px solid var(--border);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
}

.feature-card h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.feature-card-wide {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--bg-card);
  border-color: var(--accent-strong);
}

.feature-card-wide h3 {
  color: var(--accent);
}

.feature-card-wide a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.feature-card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
}

/* How it works */

.how {
  padding: 96px 0;
  border-bottom: 1px solid var(--border);
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.steps li {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.step-num {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.steps h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.steps p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.94rem;
}

/* Assistant */

.assistant {
  padding: 96px 0;
  border-bottom: 1px solid var(--border);
}

.assistant-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: center;
}

.assistant .section-title {
  text-align: left;
  margin-bottom: 18px;
}

.assistant-copy p {
  color: var(--text-dim);
  margin: 0 0 16px;
}

.provider-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.pill {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.chat-mock {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-mock-bubble {
  padding: 12px 15px;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.45;
  max-width: 90%;
}

.chat-mock-user {
  align-self: flex-end;
  background: var(--accent);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.chat-mock-assistant {
  align-self: flex-start;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-bottom-left-radius: 2px;
}

/* Quickstart */

.quickstart {
  padding: 96px 0;
  text-align: center;
}

.quickstart-lede {
  color: var(--text-dim);
  margin: 0 0 8px;
}

.quickstart-note {
  color: var(--text-dimmer);
  font-size: 0.85rem;
  margin: 24px 0 0;
}

.quickstart-actions {
  margin-top: 28px;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-icon {
  height: 18px;
  width: auto;
}

.footer-word {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-right: 8px;
}

/* Motion */

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes blink-cursor {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.hero-copy > * {
  opacity: 0;
  animation: fade-in-up 0.7s ease forwards;
}

.hero-copy .eyebrow { animation-delay: 0.05s; }
.hero-copy h1 { animation-delay: 0.15s; }
.hero-copy .lede { animation-delay: 0.25s; }
.hero-copy .hero-actions { animation-delay: 0.35s; }
.hero-copy .hero-note { animation-delay: 0.45s; }

.hero-visual {
  opacity: 0;
  animation: fade-in-up 0.8s ease 0.3s forwards;
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

.contrast-inner .reveal:nth-child(2) { transition-delay: 0.1s; }

.feature-grid .reveal:nth-child(2) { transition-delay: 0.08s; }
.feature-grid .reveal:nth-child(3) { transition-delay: 0.16s; }
.feature-grid .reveal:nth-child(4) { transition-delay: 0.24s; }
.feature-grid .reveal:nth-child(5) { transition-delay: 0.32s; }
.feature-grid .reveal:nth-child(6) { transition-delay: 0.4s; }
.feature-grid .reveal:nth-child(7) { transition-delay: 0.48s; }

.steps .reveal:nth-child(2) { transition-delay: 0.12s; }
.steps .reveal:nth-child(3) { transition-delay: 0.24s; }

.assistant-inner .reveal:nth-child(2) { transition-delay: 0.12s; }

.feature-card,
.contrast-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease,
    opacity 0.6s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -28px var(--shadow);
  border-color: var(--text-dimmer);
}

.pill {
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.pill:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  color: var(--text);
}

.step-num {
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.steps li:hover .step-num {
  transform: scale(1.1);
  background: var(--accent);
  color: #ffffff;
}

.chat-mock-typing {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease 0.5s, transform 0.4s ease 0.5s;
}

.assistant-visual.in-view .chat-mock-typing {
  opacity: 1;
  transform: translateY(0);
}

.cursor {
  display: inline-block;
  width: 0.5em;
  height: 1em;
  margin-left: 2px;
  background: var(--terminal-out);
  vertical-align: text-bottom;
  animation: blink-cursor 1s step-end infinite;
}

@media (prefers-reduced-motion: reduce) {
  .hero-copy > *,
  .hero-visual {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .reveal {
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .chat-mock-typing {
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .cursor {
    animation: none !important;
  }

  .feature-card:hover,
  .pill:hover,
  .steps li:hover .step-num,
  .btn:hover {
    transform: none !important;
  }
}

.footer-inner p {
  color: var(--text-dimmer);
  font-size: 0.85rem;
  margin: 0;
}

/* Responsive */

@media (max-width: 900px) {
  .hero-inner,
  .assistant-inner {
    grid-template-columns: 1fr;
  }

  .contrast-inner {
    grid-template-columns: 1fr;
  }

  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .main-nav {
    display: none;
  }
}

@media (max-width: 460px) {
  .header-actions .btn-coffee .btn-label {
    display: none;
  }

  .header-actions .btn-coffee {
    padding-left: 10px;
    padding-right: 10px;
  }
}

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

  .hero {
    padding: 56px 0 64px;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn,
  .quickstart-actions .btn {
    width: 100%;
  }

  .footer-inner {
    flex-wrap: wrap;
  }
}
