/* ============================================================
   demos.css — shared demo-page template + quote-generator UI.
   Builds on style.css tokens + glass system; reused by every
   /demos/* page so they stay consistent with the homepage.
   ============================================================ */

/* ─── Page shell ─────────────────────────────────── */
.demo-main {
  padding-top: clamp(6.5rem, 11vw, 9rem);
  padding-bottom: var(--section-py);
}

.demo-back {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
  transition: color var(--dur) var(--ease);
}
.demo-back:hover { color: var(--amber); }

/* ─── Hero ───────────────────────────────────────── */
.demo-hero {
  max-width: 46rem;
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.demo-hero-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.demo-tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}

.demo-badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.22rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid var(--border-hover);
  background: rgba(255, 255, 255, 0.04);
}

.demo-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: 1rem;
}

.demo-lead {
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  color: var(--text-muted);
  line-height: 1.7;
}

/* ─── Demo block (the interactive widget) ────────── */
.qg-app {
  position: relative;
  background: rgba(13, 14, 20, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: clamp(1.25rem, 3vw, 2rem);
  margin-bottom: clamp(3rem, 6vw, 4.5rem);
}

.qg-demo-note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--text-dim);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-hover);
  margin-bottom: 1.5rem;
}

.qg-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 880px) {
  .qg-layout { grid-template-columns: 1.1fr 0.9fr; gap: 2rem; align-items: start; }
}

/* Configurator form */
.qg-form { display: flex; flex-direction: column; gap: 1.5rem; }

.qg-field { border: 0; padding: 0; margin: 0; }
.qg-field--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.qg-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.7rem;
  padding: 0;
}
.qg-field--row .qg-label { margin-bottom: 0; }

.qg-select,
.qg-number {
  font-family: var(--font-primary);
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(5, 6, 10, 0.6);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  transition: border-color var(--dur) var(--ease);
}
.qg-select { width: 100%; appearance: none; cursor: pointer; }
.qg-number { width: 5.5rem; text-align: center; }
.qg-select:focus,
.qg-number:focus { outline: none; border-color: var(--amber); }

.qg-options { display: flex; flex-direction: column; gap: 0.5rem; }

.qg-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.qg-option:hover { border-color: var(--border-hover); }
.qg-option:has(:checked) {
  border-color: rgba(212, 169, 78, 0.4);
  background: rgba(212, 169, 78, 0.06);
}

.qg-check,
.qg-radio { accent-color: var(--amber); width: 1rem; height: 1rem; flex: none; cursor: pointer; }
.qg-option-label { flex: 1; font-size: 0.87rem; color: var(--text); }
.qg-option-price {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Live quote summary */
.qg-summary {
  background: rgba(5, 6, 10, 0.5);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
}
@media (min-width: 880px) { .qg-summary { position: sticky; top: 6.5rem; } }

.qg-summary-title {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.qg-lines { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.qg-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
}
.qg-line-label { color: var(--text-muted); }
.qg-line-amount { font-family: var(--font-mono); color: var(--text); white-space: nowrap; }

.qg-totals {
  border-top: 1px solid var(--border);
  padding-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.qg-total-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.qg-total-row span:last-child { font-family: var(--font-mono); color: var(--text); }
.qg-total-row--grand {
  margin-top: 0.25rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.qg-total-row--grand span:last-child { color: var(--amber); }

.qg-pdf { width: 100%; margin-top: 1.25rem; justify-content: center; }
.qg-pdf:disabled { opacity: 0.45; cursor: not-allowed; }

/* ─── Content sections ───────────────────────────── */
.demo-section {
  max-width: 46rem;
  margin-bottom: clamp(2.25rem, 4.5vw, 3.25rem);
}

.demo-section-title {
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
  font-weight: 700;
  margin-bottom: 1rem;
}

.demo-section-body {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 1rem;
}
.demo-section-body:last-child { margin-bottom: 0; }

.demo-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.demo-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}
.demo-flow-step {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}
.demo-flow-arrow { color: var(--amber); font-size: 0.9rem; }
.demo-flow-note { margin-top: 1rem; }

/* ─── CTA block ──────────────────────────────────── */
.demo-cta {
  text-align: center;
  max-width: 40rem;
  margin: clamp(3rem, 6vw, 5rem) auto 0;
  padding: clamp(2rem, 4vw, 3rem);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: rgba(13, 14, 20, 0.7);
}

.demo-cta-title {
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}
.demo-cta-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}
.demo-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

/* ─── Automation flow (visual demo — page 3) ─────── */
.auto-app {
  position: relative;
  background: rgba(13, 14, 20, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: clamp(1.25rem, 3vw, 2rem);
  margin-bottom: clamp(3rem, 6vw, 4.5rem);
  /* Rail geometry — keeps the connectors aligned under each icon centre. */
  --auto-icon: 2.5rem;
  --auto-pad: 0.9rem;
}

.auto-note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--text-dim);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-hover);
  margin-bottom: 1.75rem;
}

.auto-flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.auto-node {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: var(--auto-pad);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(5, 6, 10, 0.5);
  opacity: 0.5;
  transition: opacity var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.auto-node.is-active {
  opacity: 1;
  border-color: rgba(212, 169, 78, 0.55);
  background: rgba(212, 169, 78, 0.07);
}
/* Pulsing ring — pseudo-element so only transform + opacity animate (composited). */
.auto-node.is-active::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid var(--amber);
  border-radius: inherit;
  pointer-events: none;
  transform-origin: center;
  animation: auto-pulse 950ms var(--ease);
}
.auto-node.is-done {
  opacity: 1;
  border-color: rgba(212, 169, 78, 0.32);
  background: rgba(212, 169, 78, 0.04);
}

.auto-node-icon {
  flex: none;
  width: var(--auto-icon);
  height: var(--auto-icon);
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hover);
  color: var(--text-dim);
  background: rgba(5, 6, 10, 0.6);
  transition: color var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.auto-node.is-active .auto-node-icon,
.auto-node.is-done .auto-node-icon {
  color: var(--amber);
  border-color: rgba(212, 169, 78, 0.5);
  background: rgba(212, 169, 78, 0.1);
}

.auto-node-text { display: flex; flex-direction: column; gap: 0.2rem; }
.auto-node-label { font-size: 0.92rem; font-weight: 600; color: var(--text); }
.auto-node-sub { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }

/* Vertical connector between nodes, aligned under the icon centre. */
.auto-link {
  height: 1.65rem;
  width: 2px;
  margin-left: calc(var(--auto-pad) + var(--auto-icon) / 2 - 1px);
  background: var(--border-hover);
  border-radius: 2px;
  overflow: hidden;
}
.auto-link-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--amber);
  transform: scaleY(0);
  transform-origin: top center;
  transition: transform 320ms var(--ease);
}
.auto-link.is-filled .auto-link-fill { transform: scaleY(1); }

@keyframes auto-pulse {
  0%   { opacity: 0.75; transform: scale(1); }
  70%  { opacity: 0;    transform: scale(1.035); }
  100% { opacity: 0;    transform: scale(1.035); }
}

.auto-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.75rem;
}
.auto-status {
  flex: 1 1 14rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.auto-replay { flex: none; }

/* ─── AI assistant chat (in-browser model — page 1) ─ */
.ai-app {
  position: relative;
  background: rgba(13, 14, 20, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: clamp(1.25rem, 3vw, 2rem);
  margin-bottom: clamp(3rem, 6vw, 4.5rem);
}

.ai-note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--text-dim);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-hover);
  margin-bottom: 1.75rem;
}

/* Idle state — the pre-load pitch */
.ai-idle { text-align: center; padding: clamp(1rem, 4vw, 2.5rem) 1rem; }
.ai-idle-icon {
  display: inline-grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(0, 209, 255, 0.4);
  background: rgba(0, 209, 255, 0.08);
  color: var(--cyan);
  margin-bottom: 1.1rem;
}
.ai-idle-title { font-size: clamp(1.15rem, 2.4vw, 1.5rem); font-weight: 700; margin-bottom: 0.5rem; }
.ai-idle-text {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 28rem;
  margin: 0 auto 1.5rem;
}
.ai-start { margin: 0 auto; }
.ai-fineprint {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.6;
  color: var(--text-dim);
  max-width: 30rem;
  margin: 1.25rem auto 0;
}

/* Loading state — download progress */
.ai-loading { padding: clamp(1.5rem, 5vw, 3rem) 1rem; text-align: center; }
.ai-loading-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
}
.ai-progress {
  position: relative;
  height: 6px;
  max-width: 26rem;
  margin: 0 auto;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.ai-progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), #e6c377);
  transition: width 220ms var(--ease);
}
.ai-progress-pct {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--amber);
  margin-top: 0.85rem;
}

/* Chat interface */
.ai-chat { display: flex; flex-direction: column; }

.ai-chat-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.ai-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 9999px;
  border: 1px solid rgba(212, 169, 78, 0.4);
  background: rgba(212, 169, 78, 0.1);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
}
.ai-chat-meta { display: flex; flex-direction: column; gap: 0.1rem; }
.ai-chat-name { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.ai-chat-sub { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-muted); }
.ai-mode-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.22rem 0.55rem;
  border-radius: 9999px;
  border: 1px solid var(--border-hover);
}

.ai-messages {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 16rem;
  max-height: 26rem;
  overflow-y: auto;
  padding: 0.25rem 0.25rem 0.5rem;
  scroll-behavior: smooth;
}

.ai-msg {
  max-width: 80%;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-lg);
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.ai-msg--bot {
  align-self: flex-start;
  background: rgba(5, 6, 10, 0.6);
  border: 1px solid var(--border-hover);
  color: var(--text);
  border-bottom-left-radius: var(--radius-sm);
}
.ai-msg--user {
  align-self: flex-end;
  background: rgba(212, 169, 78, 0.12);
  border: 1px solid rgba(212, 169, 78, 0.35);
  color: var(--text);
  border-bottom-right-radius: var(--radius-sm);
}

/* Typing indicator — three bouncing dots inside a bot bubble */
.ai-typing { align-self: flex-start; display: inline-flex; gap: 0.28rem; padding: 0.8rem 0.95rem; }
.ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: ai-bounce 1.2s infinite ease-in-out;
}
.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ai-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.ai-fallback-note {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.5;
  color: var(--text-dim);
  padding: 0.5rem 0.7rem;
  margin-top: 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-hover);
}

.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.1rem;
}
.ai-chip {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.45rem 0.8rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease),
              color var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.ai-chip:hover {
  border-color: rgba(212, 169, 78, 0.45);
  color: var(--text);
  background: rgba(212, 169, 78, 0.06);
}
.ai-chip:disabled { opacity: 0.4; cursor: not-allowed; }

.ai-input-row {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
}
.ai-input {
  flex: 1;
  resize: none;
  font-family: var(--font-primary);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  background: rgba(5, 6, 10, 0.6);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  padding: 0.7rem 0.9rem;
  max-height: 8rem;
  transition: border-color var(--dur) var(--ease);
}
.ai-input:focus { outline: none; border-color: var(--amber); }
.ai-input::placeholder { color: var(--text-dim); }

.ai-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.7rem;
  height: 2.7rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(212, 169, 78, 0.4);
  background: rgba(212, 169, 78, 0.12);
  color: var(--amber);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ai-send:hover:not(:disabled) { background: rgba(212, 169, 78, 0.2); }
.ai-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Reduced motion ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .demo-back, .qg-option, .qg-select, .qg-number { transition: none; }
  .auto-node, .auto-node-icon, .auto-link-fill { transition: none; }
  .auto-node.is-active::after { animation: none; }
  .ai-progress-fill, .ai-chip, .ai-input, .ai-send { transition: none; }
  .ai-messages { scroll-behavior: auto; }
  .ai-typing span { animation: none; }
}
