/* =========================================================
   1C AI Assistant — stylesheet
   Plain CSS, no build step, no framework dependency.
   ========================================================= */

:root {
  --bg: #0a0a0a;
  --bg-raised: #141414;
  --border: #262626;
  --border-soft: rgba(64, 64, 64, .5);
  --text: #fafafa;
  --text-dim: #a3a3a3;
  --text-dimmer: #737373;
  --accent: #ffffff;
  --accent-text: #0a0a0a;
  --link: #a78bfa;
  --radius-lg: 1rem;
  --radius-md: .75rem;
  --radius-sm: .5rem;
  --max-width: 72rem;
  --font: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}

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

body { overflow-x: hidden; }

a { color: inherit; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(163, 163, 163, .4); border-radius: 3px; }

/* Layout helpers */
.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.section {
  padding-block: 6rem;
}

.divider {
  border: none;
  border-top: 1px solid rgba(115, 115, 115, .3);
  width: 50%;
  margin: 0 auto;
}

/* Loading splash */
#splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity .3s ease;
}

.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--border);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Navbar */
.navbar {
  position: sticky;
  top: 1rem;
  z-index: 50;
  width: fit-content;
  max-width: calc(100% - 2rem);
  margin: 1rem auto 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(10, 10, 10, .8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, .3);
  opacity: 0;
  transition: opacity .4s ease;
}

.navbar-inner {
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding-inline: 1.25rem;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .nav-links { display: flex; }
}

.nav-links a {
  font-size: .875rem;
  color: var(--text-dim);
  text-decoration: none;
  transition: color .15s ease;
}

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

.nav-tag {
  font-size: .625rem;
  font-family: ui-monospace, monospace;
  color: var(--text-dimmer);
  margin-left: .25rem;
}

.btn-ghost {
  font-size: .8125rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: .4rem .75rem;
  background: transparent;
  color: var(--text-dim);
  text-decoration: none;
  transition: background-color .15s ease;
}

.btn-ghost:hover { background: rgba(38, 38, 38, .6); color: var(--text); }

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: 6rem 5rem;
  opacity: 0;
  transition: opacity .4s ease;
}

#heroCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 42rem;
  margin-inline: auto;
  text-align: center;
}

.hero-title {
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0 0 1.5rem;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-dim);
  margin: 0 0 2rem;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 20rem;
  margin-inline: auto;
}

.btn-primary {
  padding: .75rem 1.5rem;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  text-align: center;
  transition: background-color .15s ease;
}

.btn-primary:hover { background: #d4d4d4; }

.btn-outline {
  padding: .75rem 1.5rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: #d4d4d4;
  text-decoration: none;
  text-align: center;
  transition: background-color .15s ease;
}

.btn-outline:hover { background: rgba(38, 38, 38, .6); }

/* Section headings */
.section-title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  text-align: center;
  margin: 0 0 3rem;
}

/* Feature cards */
.grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  opacity: 0;
  animation: fade-in .45s ease-out forwards;
  transition: transform .3s ease, background .3s ease;
}

.card:hover { transform: translateY(-8px); background: #181818; }

.card-icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.card-icon svg { width: 1.75rem; height: 1.75rem; display: block; }

.card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 .5rem;
}

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

/* Install steps */
.steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 48rem;
  margin-inline: auto;
}

.step {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1rem;
  opacity: 0;
  animation: fade-in .45s ease-out forwards;
  transition: transform .3s cubic-bezier(.25, .46, .45, .94), box-shadow .3s ease;
}

.step:hover { transform: translateY(-3px); box-shadow: 0 4px 20px rgba(0,0,0,.3); }

.step-num {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .875rem;
  font-weight: 600;
}

.step-text {
  flex: 1;
  font-size: .875rem;
}

/* Chat widget */
.chat-panel {
  max-width: 48rem;
  margin-inline: auto;
  border: 1px solid var(--border);
  border-radius: 1rem;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  display: flex;
  flex-direction: column;
  height: calc(32rem + 5rem);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(23, 23, 23, .3);
}

.chat-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-header h3 {
  font-size: .875rem;
  font-weight: 600;
  margin: 0;
}

.chat-header p {
  font-size: .75rem;
  color: var(--text-dimmer);
  margin: 0;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (max-width: 768px) {
  .chat-messages {
    height: 50vh;
    min-height: 20rem;
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .chat-messages {
    height: 45vh;
    min-height: 16rem;
    padding: .75rem;
    gap: .75rem;
  }

  .msg-bubble {
    max-width: 85%;
    padding: .625rem .75rem;
    font-size: .8125rem;
  }

  .chat-input-area {
    padding: .75rem;
  }

  .chat-textarea {
    font-size: .8125rem;
    padding: .625rem .75rem;
  }
}

.msg-row {
  display: flex;
}

.msg-row.user { justify-content: flex-end; }
.msg-row.assistant { justify-content: flex-start; }

.msg-bubble {
  max-width: 75%;
  padding: .75rem 1rem;
  border-radius: 1rem;
  font-size: .875rem;
  line-height: 1.6;
  word-break: break-word;
  background: rgba(23, 23, 23, .6);
  border: 1px solid var(--border);
  color: rgba(255, 255, 255, .7);
}

.msg-row.user .msg-bubble { border-bottom-right-radius: .375rem; }
.msg-row.assistant .msg-bubble { border-bottom-left-radius: .375rem; }

.msg-new {
  animation: msg-in .3s ease-out;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Markdown content inside messages */
.msg-bubble pre {
  background: rgba(38, 38, 38, .3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: .75rem;
  overflow-x: auto;
  font-size: .75rem;
  font-family: ui-monospace, monospace;
  margin: .5rem 0;
}

.msg-bubble code {
  background: rgba(38, 38, 38, .5);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .75rem;
  font-family: ui-monospace, monospace;
  border: 1px solid var(--border-soft);
}

.msg-bubble pre code { background: none; padding: 0; border: none; }
.msg-bubble ul { margin: .5rem 0; padding-left: 1.25rem; }
.msg-bubble li { margin-bottom: .25rem; list-style-type: disc; }
.msg-bubble h1 { font-size: 1.25rem; font-weight: 700; margin: .75rem 0 .5rem; }
.msg-bubble h2 { font-size: 1.1rem; font-weight: 600; margin: .75rem 0 .5rem; }
.msg-bubble h3 { font-size: 1rem; font-weight: 600; margin: .5rem 0 .25rem; }
.msg-bubble strong { font-weight: 600; }
.msg-bubble a { color: var(--link); text-decoration: underline; }

.code-block { position: relative; margin: .5rem 0; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); overflow: hidden; }
.code-block pre { margin: 0; border: none; border-radius: 0; }
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .375rem .75rem;
  background: rgba(38, 38, 38, .3);
  border-bottom: 1px solid var(--border-soft);
}

.code-lang {
  font-size: .625rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .4);
}

.copy-btn {
  background: rgba(64, 64, 64, .3);
  border: none;
  color: rgba(163, 163, 163, .6);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: .7rem;
}

.copy-btn:hover { color: var(--text); background: rgba(64, 64, 64, .5); }

/* Typing indicator */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: .375rem;
  padding: .75rem 1rem;
  background: rgba(23, 23, 23, .6);
  border: 1px solid var(--border);
  border-radius: 1rem;
  border-bottom-left-radius: .375rem;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .4);
  animation: bounce-dot 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }

@keyframes bounce-dot {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Chat input */
.chat-input-area {
  padding: 1rem;
  border-top: 1px solid var(--border);
  background: rgba(23, 23, 23, .2);
}

.chat-input-row {
  display: flex;
  gap: .75rem;
  align-items: flex-end;
}

.chat-textarea {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: .75rem 1rem;
  font: inherit;
  font-size: .875rem;
  color: rgba(255, 255, 255, .8);
  resize: none;
  min-height: 2.75rem;
  max-height: 50vh;
  outline: none;
  overflow: hidden;
  transition: height .7s cubic-bezier(.16, 1, .3, 1), background .7s ease, border-color .5s ease;
}

.chat-textarea::placeholder { color: rgba(255, 255, 255, .4); }
.chat-textarea:focus { background: rgba(255, 255, 255, .03); }

.send-btn {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .15s ease;
}

.send-btn:hover:not(:disabled) { background: rgba(23, 23, 23, .8); }
.send-btn:disabled { opacity: .5; cursor: not-allowed; }

.chat-disclaimer {
  font-size: .625rem;
  color: var(--text-dimmer);
  text-align: center;
  margin: .5rem 0 0;
}

/* Content-visibility for below-fold sections */
#installation { content-visibility: auto; contain-intrinsic-size: 400px; }
#chat { content-visibility: auto; contain-intrinsic-size: 600px; }

/* Footer */
.footer {
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: 80rem;
  margin-inline: auto;
  padding: 2rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-brand {
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
}

.footer-brand:hover { text-decoration: underline; }

.footer-copy {
  font-size: .875rem;
  color: var(--text-dimmer);
  margin: 0;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .section { padding-block: 4rem; }
  .hero { padding-block: 4rem 3rem; }
  .container { padding-inline: 1rem; }
  .footer-inner { padding: 1.5rem 1rem; flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .step { flex-direction: column; text-align: center; }
  .card { padding: 1.25rem; }
}


