/* ──────────────────────────────────────────────────────────────
   SelfOpt - modern minimal redesign
   Single violet accent, neutral surfaces, tight rhythm.
   Dark default, fully designed light mode (toggle via data-theme).
   The accent purple is identical in both themes (uniform brand colour).
   ────────────────────────────────────────────────────────────── */

:root {
  /* Accent - uniform across themes */
  --accent:        #7C5CFC;
  --accent-hover:  #6A47F5;
  --accent-soft:   rgba(124, 92, 252, 0.13);
  --accent-text:   #7C5CFC;

  /* Surfaces (dark) */
  --bg:            #0A0A0F;
  --bg-soft:       #0D0D13;
  --surface:       #111119;
  --surface-2:     #15151F;
  --border:        rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  /* Text */
  --text:          #ECECF2;
  --text-muted:    #9A9AAB;
  --text-dim:      #6B6B7B;

  /* Chrome */
  --nav-bg:        rgba(10, 10, 15, 0.72);
  --hero-glow:     rgba(124, 92, 252, 0.16);
  --shadow:        0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.28);
  --shadow-sm:     0 1px 2px rgba(0, 0, 0, 0.3);

  --radius:        16px;
  --radius-sm:     11px;
  --maxw:          1200px;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
}

:root[data-theme="light"] {
  /* accent / accent-soft / accent-text intentionally NOT overridden -
     the brand purple stays identical in light mode. */
  --bg:            #FCFCFD;
  --bg-soft:       #F7F7FA;
  --surface:       #FFFFFF;
  --surface-2:     #F6F6F9;
  --border:        rgba(17, 17, 34, 0.09);
  --border-strong: rgba(17, 17, 34, 0.16);

  --text:          #14141C;
  --text-muted:    #585866;
  --text-dim:      #8A8A98;

  --nav-bg:        rgba(255, 255, 255, 0.74);
  --hero-glow:     rgba(124, 92, 252, 0.12);
  --shadow:        0 1px 2px rgba(17, 17, 34, 0.05), 0 12px 28px rgba(17, 17, 34, 0.06);
  --shadow-sm:     0 1px 2px rgba(17, 17, 34, 0.05);
}

/* ── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.25s ease, color 0.25s ease;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-soft); }

/* ── LAYOUT ────────────────────────────────────────────────── */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 32px);
}
section { padding: clamp(44px, 5.5vw, 76px) 0; }
section + section { border-top: 1px solid var(--border); }
.section-head { max-width: 760px; margin-bottom: clamp(22px, 3vw, 34px); }

/* ── TYPOGRAPHY ────────────────────────────────────────────── */
h1 {
  font-size: clamp(2rem, 4.6vw, 3.3rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
}
h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
}
h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.accent-text { color: var(--accent-text); }
.eyebrow {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 20px;
}
.section-sub {
  color: var(--text-muted);
  font-size: 1.0625rem;
  line-height: 1.6;
  margin-top: 14px;
}

/* ── NAV ───────────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
}
.nav-inner {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.logo-text {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.logo-text span { color: var(--accent); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-links > a:not(.btn-ghost) {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.nav-links > a:not(.btn-ghost):hover { color: var(--text); background: var(--surface-2); }
.btn-ghost {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 7px 14px;
  margin-left: 4px;
  transition: border-color 0.15s, background 0.15s;
}
.btn-ghost:hover { border-color: var(--accent); background: var(--accent-soft); }

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.theme-toggle svg { width: 17px; height: 17px; display: block; }
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun  { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun  { display: none; }

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn-primary, .btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 11px;
  transition: transform 0.12s ease, background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 20px rgba(124, 92, 252, 0.28);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-outline {
  color: var(--text);
  border: 1px solid var(--border-strong);
  background: var(--surface);
}
.btn-outline:hover { border-color: var(--accent); transform: translateY(-1px); }

/* ── HERO ──────────────────────────────────────────────────── */
#hero {
  position: relative;
  overflow: hidden;
  padding-top: clamp(72px, 10vw, 132px);
  padding-bottom: clamp(56px, 8vw, 104px);
}
#hero::before {
  content: "";
  position: absolute;
  top: -200px;
  left: 50%;
  width: 900px;
  height: 600px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, var(--hero-glow) 0%, transparent 68%);
  pointer-events: none;
  z-index: -1;
}
.hero-inner { max-width: 940px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  margin-bottom: 26px;
}
.badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.badge a { color: var(--accent-text); font-weight: 600; }
.badge a:hover { text-decoration: underline; }
.hero-sub {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 640px;
  margin: 22px 0 32px;
}
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 44px; }

/* Pipeline */
.hero-flow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.flow-item {
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--mono);
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 15px;
}
.flow-accent {
  color: var(--accent-text);
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.flow-arrow { color: var(--text-dim); font-size: 0.9rem; }

/* ── CARD GRID (features, reliability, steps) ──────────────── */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  transition: transform 0.16s ease, border-color 0.16s, box-shadow 0.16s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--accent-soft);
  margin-bottom: 14px;
}
.card-icon svg { width: 21px; height: 21px; color: var(--accent); }
.card h3 { margin-bottom: 7px; }
.card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: justify;
  hyphens: auto;
}
.card code {
  font-family: var(--mono);
  font-size: 0.82em;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 1px 5px;
  border-radius: 5px;
}

/* ── STEPS (how it works) ──────────────────────────────────── */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s;
}
.step:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.step-num {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
}
.step-body h3 { margin-bottom: 6px; }
.step-body p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; }

/* ── DEMO WINDOW ───────────────────────────────────────────── */
.demo-wrapper { margin-top: clamp(28px, 4vw, 44px); }
.bp-label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.demo-window {
  background: #0C0C12;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.85rem;
  box-shadow: var(--shadow);
}
.demo-titlebar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  background: #14141C;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.demo-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.demo-window-title {
  margin-left: 8px;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: #8C8C9C;
}
.demo-body {
  padding: 16px 18px;
  height: 300px;            /* fixed so the panel never resizes as lines stream in */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scroll-behavior: smooth;
}
.dl {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.6;
  animation: dl-in 0.2s ease both;
}
@keyframes dl-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.dl-tag {
  flex-shrink: 0;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.8;
}
.dl-tag--so    { background: rgba(124, 92, 252, 0.20); color: #c3b2ff; }
.dl-tag--model { background: rgba(56, 189, 248, 0.16);  color: #7dd3fc; }
.dl-tag--file  { background: rgba(52, 211, 153, 0.16);  color: #6ee7b7; }
.dl-tag--done  { background: rgba(52, 211, 153, 0.16);  color: #6ee7b7; }
.dl-tag--user  { background: rgba(255, 255, 255, 0.09); color: #9a9aab; }
.dl-body { flex: 1; min-width: 0; color: #E6E6EE; word-break: break-word; }
.dl--user .dl-body  { color: #9a9aab; font-style: italic; }
.dl--think .dl-body { color: #9a9aab; }
.demo-dots span { display: inline-block; animation: dot-bounce 1s infinite; }
.demo-dots span:nth-child(2) { animation-delay: 0.15s; }
.demo-dots span:nth-child(3) { animation-delay: 0.30s; }
@keyframes dot-bounce { 0%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-4px); } }
.demo-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 3px;
}
.demo-badge--add { background: rgba(52, 211, 153, 0.16); color: #6ee7b7; }
.demo-badge--del { background: rgba(248, 113, 113, 0.16); color: #fca5a5; }
.demo-check { color: #6ee7b7; }
.demo-score { display: block; margin-top: 3px; color: #8c8c9c; font-size: 0.82em; }
.demo-input-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: #0A0A0F;
}
.demo-chevron { color: var(--accent); font-size: 1.05rem; line-height: 1; flex-shrink: 0; }
.demo-input-text { flex: 1; color: #E6E6EE; min-height: 1em; }
.demo-cursor {
  width: 2px; height: 1.05em;
  background: #E6E6EE;
  display: inline-block;
  vertical-align: middle;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ── INTEGRATIONS ──────────────────────────────────────────── */
.integrations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 14px;
}
.integration-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.16s ease, border-color 0.16s, box-shadow 0.16s;
}
.integration-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.int-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.int-name { font-weight: 600; font-size: 1.0625rem; }
.int-desc { font-size: 0.9375rem; color: var(--text-muted); line-height: 1.6; }
.int-desc code, .int-desc strong { color: var(--text); }
.int-desc code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 6px;
}

/* ── QUICK START ───────────────────────────────────────────── */
.qs-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.qs-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.qs-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.qs-label::before {
  content: counter(qs);
  counter-increment: qs;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 7px;
}
.qs-list { counter-reset: qs; }
pre {
  padding: 16px 18px;
  overflow-x: auto;
  background: transparent;
}
pre code {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.7;
}
code { font-family: var(--mono); }

/* ── PROVIDERS ─────────────────────────────────────────────── */
.providers-grouped { display: flex; flex-direction: column; gap: 24px; }
.providers-group-label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.providers { display: flex; flex-wrap: wrap; gap: 10px; }
.provider {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 16px;
  font-size: 0.9375rem;
  font-weight: 500;
  background: var(--surface);
  transition: border-color 0.15s;
}
.provider:hover { border-color: var(--border-strong); }
.tag {
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--mono);
  padding: 2px 8px;
  border-radius: 6px;
}
.tag-local { background: var(--accent-soft); color: var(--accent-text); }
.tag-cloud { background: rgba(56, 189, 248, 0.14); color: #38bdf8; }
:root[data-theme="light"] .tag-cloud { color: #0284c7; }

/* ── FOOTER ────────────────────────────────────────────────── */
footer { border-top: 1px solid var(--border); padding: 40px 0; }
.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-brand { display: flex; flex-direction: column; gap: 6px; max-width: 540px; }
.footer-brand .logo-text { font-size: 1.2rem; margin-bottom: 4px; }
.footer-copy, .footer-legal { font-size: 0.875rem; color: var(--text-muted); line-height: 1.65; }
.footer-email { font-size: 0.875rem; margin-top: 2px; }
.footer-email a { color: var(--accent-text); font-weight: 600; }
.footer-copy a, .footer-legal a { color: var(--accent-text); font-weight: 500; }
.footer-copy a:hover, .footer-legal a:hover, .footer-email a:hover { text-decoration: underline; }
.footer-links { display: flex; gap: 10px; }

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 940px) {
  .grid-cards, .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .nav-links > a:not(.btn-ghost) { display: none; }
}
@media (max-width: 600px) {
  .grid-cards, .steps { grid-template-columns: 1fr; }
  .hero-flow { flex-direction: column; align-items: flex-start; gap: 6px; }
  .flow-arrow { transform: rotate(90deg); padding-left: 16px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .btn-primary, .btn-outline { flex: 1; }
  .card, .step, .integration-card { padding: 22px; }
}
