/* ============================================================
   Krilx.  Public Site Stylesheet
   Dark navy/violet marketing, docs, blog & legal theme
   ============================================================ */

:root {
  --bg-primary: #0b0c10;
  --bg-secondary: #0f172a;
  --bg-card: #10131c;
  --bg-card-hover: #151927;
  --border: #1e293b;
  --border-soft: #16203277;
  --accent-violet: #8b5cf6;
  --accent-indigo: #6366f1;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --success: #34d399;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 20px 50px -20px rgba(99, 102, 241, 0.35);
  --max-width: 1160px;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.65;
  font-size: 16.5px;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--accent-violet); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #c4b5fd;
  outline-offset: 3px;
}

h1, h2, h3, h4 { line-height: 1.2; font-weight: 750; letter-spacing: -0.02em; }

h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.25rem); }
h3 { font-size: 1.25rem; }

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

.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent-violet); color: #fff;
  padding: 10px 18px; border-radius: 0 0 10px 0; z-index: 200;
}
.skip-link:focus { left: 0; }

/* ---------- Navbar ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11, 12, 16, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px; max-width: var(--max-width); margin: 0 auto; padding: 0 24px;
}
.logo {
  font-size: 1.45rem; font-weight: 800; color: var(--text-main);
  letter-spacing: -0.03em;
}
.logo:hover { text-decoration: none; }
.logo .dot { color: var(--accent-violet); }
.logo .sparkle { font-size: 1rem; vertical-align: 2px; color: var(--accent-indigo); }

.nav-links {
  display: flex; align-items: center; gap: 26px; list-style: none;
}
.nav-links a {
  color: var(--text-muted); font-size: 0.95rem; font-weight: 550;
}
.nav-links a:hover, .nav-links a.active { color: var(--text-main); text-decoration: none; }
.nav-links a.active { color: var(--accent-violet); }

.nav-cta {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-gradient);
  color: #fff !important;
  padding: 9px 20px; border-radius: 999px;
  font-weight: 650; font-size: 0.93rem;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.nav-cta:hover { transform: translateY(-1px); text-decoration: none; }

.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-main); width: 42px; height: 42px;
  cursor: pointer; font-size: 1.15rem; line-height: 1;
}

@media (max-width: 880px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; align-items: flex-start;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 18px 24px 22px; gap: 4px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; padding: 10px 4px; font-size: 1.05rem; }
  .nav-cta { margin-top: 10px; width: 100%; justify-content: center; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 28px; border-radius: 999px;
  font-weight: 650; font-size: 1rem; cursor: pointer; border: none;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn-primary {
  background: var(--accent-gradient); color: #fff;
  box-shadow: var(--shadow);
}
.btn-primary:hover { transform: translateY(-2px); text-decoration: none; }
.btn-outline {
  background: transparent; color: var(--text-main);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent-violet); color: var(--accent-violet); text-decoration: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 92px 0 76px;
  overflow: hidden;
  background:
    radial-gradient(900px 480px at 75% -10%, rgba(139, 92, 246, 0.18), transparent 60%),
    radial-gradient(700px 420px at 10% 110%, rgba(99, 102, 241, 0.14), transparent 60%);
}
.hero-grid {
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 56px; align-items: center;
}
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }

.workflow-card {
  position: relative;
  padding: clamp(24px, 4vw, 38px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(440px 240px at 100% 0%, rgba(139, 92, 246, 0.18), transparent 68%),
    linear-gradient(150deg, #141825, #0d1017);
  box-shadow: 0 36px 80px -38px rgba(0, 0, 0, 0.8);
}
.workflow-label {
  color: #c4b5fd;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.workflow-card h2 {
  max-width: 440px;
  margin: 14px 0 28px;
  font-size: clamp(1.65rem, 3vw, 2.25rem);
}
.workflow-list {
  display: grid;
  gap: 12px;
  list-style: none;
}
.workflow-list li {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 14px;
  border: 1px solid #ffffff12;
  border-radius: 12px;
  background: #080b12a8;
}
.workflow-list li > span {
  color: #a78bfa;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  padding-top: 2px;
}
.workflow-list strong { display: block; font-size: 0.98rem; }
.workflow-list p { color: var(--text-muted); font-size: 0.87rem; margin-top: 3px; }
.workflow-note { color: var(--text-dim); font-size: 0.8rem; line-height: 1.5; margin-top: 18px; }

.hero-eyebrow {
  display: inline-block;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent-violet);
  border: 1px solid #8b5cf644; border-radius: 999px;
  padding: 6px 14px; margin-bottom: 22px;
  background: #8b5cf611;
}
.hero p.lead { font-size: 1.18rem; color: var(--text-muted); margin: 20px 0 34px; max-width: 540px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.hero-visual { position: relative; }
/* ---------- Sections ---------- */
.section { padding: 84px 0; }
.section.alt { background: var(--bg-secondary); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 54px; }
.section-head p { color: var(--text-muted); margin-top: 14px; font-size: 1.08rem; }

/* ---------- Feature grid ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
@media (max-width: 960px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.card:hover { transform: translateY(-4px); border-color: #8b5cf655; background: var(--bg-card-hover); }
.card .icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: #8b5cf61c; color: var(--accent-violet);
  font-size: 1.3rem; margin-bottom: 18px;
}
.card h3 { margin-bottom: 10px; }
.card p { color: var(--text-muted); font-size: 0.96rem; }

/* ---------- How it works ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; counter-reset: step; }
@media (max-width: 960px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }
.step {
  position: relative; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px;
}
.step::before {
  counter-increment: step; content: counter(step);
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-gradient); color: #fff;
  font-weight: 800; margin-bottom: 16px;
}
.step h3 { font-size: 1.08rem; margin-bottom: 8px; }
.step p { color: var(--text-muted); font-size: 0.92rem; }

/* ---------- Pricing ---------- */
.billing-toggle {
  display: flex;
  justify-content: center;
  gap: 4px;
  width: fit-content;
  margin: -24px auto 28px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-secondary);
}
.billing-toggle button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  padding: 9px 18px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
}
.billing-toggle button[aria-pressed="true"] {
  background: var(--accent-gradient);
  color: #fff;
}
.billing-toggle button:disabled {
  cursor: wait;
  opacity: 0.65;
}
.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 22px;
}
.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(400px 180px at 50% 0%, #8b5cf611, transparent 75%),
    var(--bg-card);
}
.plan-card.is-popular {
  border-color: #8b5cf688;
  box-shadow: var(--shadow);
}
.plan-badge {
  align-self: flex-start;
  margin: -5px 0 14px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #8b5cf622;
  color: #c4b5fd;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.plan-name { margin-bottom: 5px; }
.plan-tagline {
  min-height: 48px;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.plan-price {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 23px;
}
.plan-amount {
  font-size: clamp(2rem, 3vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1.1;
}
.plan-period { color: var(--text-muted); }
.plan-billing-note {
  min-height: 28px;
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.plan-savings {
  display: inline-block;
  margin-left: 7px;
  color: var(--success);
  font-weight: 700;
}
.plan-credits {
  margin: 20px 0 18px;
  padding: 11px 12px;
  border-radius: 9px;
  background: #8b5cf611;
  color: #c4b5fd;
  font-size: 0.92rem;
  font-weight: 700;
}
.plan-features {
  display: grid;
  gap: 11px;
  margin-bottom: 26px;
  list-style: none;
}
.plan-features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.plan-features li.is-excluded { color: var(--text-dim); }
.plan-feature-icon {
  flex: 0 0 18px;
  color: var(--success);
  font-weight: 800;
  text-align: center;
}
.is-excluded .plan-feature-icon { color: var(--text-dim); }
.plan-action {
  justify-content: center;
  width: 100%;
  margin-top: auto;
  text-align: center;
}
.plans-status,
.plans-error {
  margin: 0 auto 28px;
  color: var(--text-muted);
  text-align: center;
}
.plans-status[hidden],
.plans-error[hidden] { display: none; }
.plans-error p { margin-bottom: 14px; }
.plans-disclaimer {
  max-width: 760px;
  margin: 28px auto 0;
  text-align: center;
  font-size: 0.9rem;
}
@media (max-width: 960px) {
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .plan-grid { grid-template-columns: 1fr; }
  .plan-card { padding: 25px; }
}
/* ---------- CTA band ---------- */
.cta-band {
  background: var(--accent-gradient); border-radius: var(--radius);
  padding: 54px 40px; text-align: center; color: #fff;
}
.cta-band h2 { margin-bottom: 12px; }
.cta-band p { opacity: .92; max-width: 560px; margin: 0 auto 28px; }
.cta-band .btn { background: #fff; color: var(--accent-indigo); }
.cta-band .btn:hover { transform: translateY(-2px); text-decoration: none; }

/* ---------- Page hero (inner pages) ---------- */
.page-hero {
  padding: 72px 0 48px;
  background:
    radial-gradient(700px 300px at 80% 0%, rgba(139,92,246,.12), transparent 60%);
  border-bottom: 1px solid var(--border);
}
.page-hero p { color: var(--text-muted); max-width: 660px; margin-top: 14px; font-size: 1.08rem; }
.breadcrumb { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 18px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent-violet); }

/* ---------- Docs layout ---------- */
.docs-layout {
  display: grid; grid-template-columns: 250px 1fr; gap: 48px;
  padding: 56px 0 90px;
}
@media (max-width: 900px) { .docs-layout { grid-template-columns: 1fr; } }
.docs-sidebar {
  position: sticky; top: 92px; align-self: start;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.docs-sidebar h4 {
  font-size: 0.75rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 12px;
}
.docs-sidebar ul { list-style: none; }
.docs-sidebar li a {
  display: block; padding: 8px 12px; border-radius: 8px;
  color: var(--text-muted); font-size: 0.93rem;
}
.docs-sidebar li a:hover { background: #8b5cf614; color: var(--text-main); text-decoration: none; }
.docs-sidebar li a.active { background: #8b5cf622; color: var(--accent-violet); font-weight: 650; }

.doc-content { min-width: 0; }
.doc-content h1 { font-size: 2.1rem; margin-bottom: 8px; }
.doc-content .doc-updated { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 30px; }
.doc-content h2 { margin: 42px 0 14px; font-size: 1.45rem; }
.doc-content h3 { margin: 30px 0 10px; font-size: 1.15rem; }
.doc-content p { color: var(--text-muted); margin-bottom: 16px; }
.doc-content ul, .doc-content ol { color: var(--text-muted); margin: 0 0 18px 22px; }
.doc-content li { margin-bottom: 8px; }
.doc-content strong { color: var(--text-main); }
.doc-content .callout {
  border-left: 3px solid var(--accent-violet);
  background: #8b5cf612; border-radius: 0 10px 10px 0;
  padding: 16px 20px; margin: 22px 0;
  color: var(--text-muted); font-size: 0.96rem;
}
.doc-content .callout strong { color: var(--text-main); }
.doc-content code {
  font-family: var(--font-mono); font-size: 0.86em;
  background: #1a1f2e; border: 1px solid var(--border);
  border-radius: 6px; padding: 2px 7px; color: #c4b5fd;
}
.doc-content pre {
  background: #0a0d14; border: 1px solid var(--border); border-radius: 10px;
  padding: 18px; overflow-x: auto; margin: 18px 0 26px;
}
.doc-content pre code { background: none; border: none; padding: 0; color: #a5b4fc; font-size: 0.85rem; line-height: 1.6; }
.doc-content table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; margin: 20px 0 28px; font-size: 0.93rem; }
.doc-content th, .doc-content td {
  text-align: left; padding: 11px 14px; border: 1px solid var(--border);
  color: var(--text-muted);
}
.doc-content th { background: #141824; color: var(--text-main); font-weight: 650; }
.doc-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 52px; flex-wrap: wrap; }
.doc-nav a {
  flex: 1; min-width: 200px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 18px; color: var(--text-muted); font-size: 0.92rem;
}
.doc-nav a:hover { border-color: var(--accent-violet); text-decoration: none; color: var(--text-main); }
.doc-nav a span { display: block; font-size: 0.75rem; color: var(--text-dim); margin-bottom: 3px; }

/* ---------- Blog ---------- */
.post-card { display: flex; flex-direction: column; }
.post-card .post-tag {
  font-size: 0.72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-violet); margin-bottom: 12px;
}
.post-card h3 a { color: var(--text-main); }
.post-card h3 a:hover { color: var(--accent-violet); text-decoration: none; }
.post-card .post-meta { font-size: 0.83rem; color: var(--text-dim); margin-top: auto; padding-top: 16px; }

.article { max-width: 760px; margin: 0 auto; padding: 64px 0 90px; }
.article .post-meta { color: var(--text-dim); font-size: 0.9rem; margin: 14px 0 40px; }
.article-body h2 { margin: 46px 0 14px; }
.article-body h3 { margin: 30px 0 10px; }
.article-body p { color: #cbd5e1; margin-bottom: 18px; }
.article-body ul, .article-body ol { color: #cbd5e1; margin: 0 0 18px 22px; }
.article-body li { margin-bottom: 9px; }
.article-body blockquote {
  border-left: 3px solid var(--accent-violet);
  background: #8b5cf610; border-radius: 0 10px 10px 0;
  padding: 16px 22px; margin: 24px 0; color: var(--text-muted);
}
.article-body blockquote p { margin: 0; }
.article-body .prompt-example {
  background: #0a0d14; border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 20px; margin: 22px 0; font-family: var(--font-mono);
  font-size: 0.86rem; color: #a5b4fc; line-height: 1.7; white-space: pre-wrap;
}

/* ---------- FAQ ---------- */
.faq-item {
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-card); margin-bottom: 14px; overflow: hidden;
}
.faq-item button {
  width: 100%; text-align: left; background: none; border: none;
  color: var(--text-main); font-size: 1.02rem; font-weight: 600;
  padding: 19px 22px; cursor: pointer; display: flex; justify-content: space-between;
  gap: 16px; align-items: center; font-family: inherit;
}
.faq-item button .chev { color: var(--accent-violet); transition: transform .2s ease; flex-shrink: 0; }
.faq-item.open button .chev { transform: rotate(180deg); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height .28s ease; }
.faq-answer-inner { padding: 0 22px 20px; color: var(--text-muted); font-size: 0.96rem; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 0.88rem; font-weight: 600; color: var(--text-main); }
.field input, .field select, .field textarea {
  background: #0a0d14; border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-main); padding: 12px 15px; font-size: 0.97rem;
  font-family: inherit; transition: border-color .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent-violet);
  box-shadow: 0 0 0 3px #8b5cf626;
}
.field textarea { resize: vertical; min-height: 130px; }
.form-status { margin-top: 16px; font-size: 0.93rem; color: var(--text-muted); display: none; }
.form-status.visible { display: block; }

/* ---------- Legal ---------- */
.legal { max-width: 800px; margin: 0 auto; padding: 64px 0 90px; }
.legal h1 { font-size: 2.2rem; margin-bottom: 6px; }
.legal .legal-updated { color: var(--text-dim); font-size: 0.88rem; margin-bottom: 40px; }
.legal h2 { margin: 40px 0 12px; font-size: 1.35rem; }
.legal h3 { margin: 26px 0 10px; font-size: 1.1rem; }
.legal p, .legal li { color: var(--text-muted); font-size: 0.97rem; }
.legal p { margin-bottom: 15px; }
.legal ul, .legal ol { margin: 0 0 16px 22px; }
.legal li { margin-bottom: 7px; }
.legal a { word-break: break-word; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  padding: 62px 0 30px; margin-top: 0;
}
.footer-grid {
  display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 36px;
}
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-brand p { color: var(--text-muted); font-size: 0.92rem; margin-top: 14px; max-width: 300px; }
.footer-col h4 {
  font-size: 0.78rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 16px;
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 9px; }
.footer-col a { color: var(--text-muted); font-size: 0.93rem; }
.footer-col a:hover { color: var(--accent-violet); }
.footer-bottom {
  border-top: 1px solid var(--border); margin-top: 46px; padding-top: 24px;
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  color: var(--text-dim); font-size: 0.85rem;
}

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 1; transform: none; }
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal, .js .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
