/* System font stack for performance */
:root {
  --bg-1: #ffffff;
  --bg-2: #f7f9fc;
  --text: #0b1226;
  --muted: #5a6378;
  --brand-1: #6d5efc;
  --brand-2: #00d4ff;
  --brand-3: #00ffa3;
  --shadow: 0 10px 30px rgba(0,0,0,.12);
  --header-h: 64px;
  --footer-h: 60px;
}

* { box-sizing: border-box }
html { scroll-behavior: smooth }
html, body { height: 100% }

body {
  margin: 0;
  background: var(--bg-1);
  color: var(--text);
  font: 18px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px }
.container--wide { max-width: none; padding: 0; margin: 0 }
.section { padding: 72px 0 }
.section.alt { background: var(--bg-2); border-top: 1px solid rgba(0,0,0,0.05); border-bottom: 1px solid rgba(0,0,0,0.05) }
 .section h2 { margin: 0 0 16px; font-size: clamp(22px, 3vw, 32px); letter-spacing: -0.02em }
 .section p.lead { color: var(--muted); font-size: 1.05rem; margin-top: 8px }

/* Header */
.site-header { position: sticky; top: 0; backdrop-filter: saturate(1.2) blur(8px); background: rgba(255,255,255,0.8); border-bottom: 1px solid rgba(0,0,0,0.06); z-index: 50 }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700 }
.logo { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); color: white; font-weight: 800 }
.brand-text { letter-spacing: 0.2px }
.nav { display: flex; gap: 14px }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 8px }
.nav a:hover { color: var(--text); background: rgba(0,0,0,0.06) }

/* Menu toggle button */
.menu-toggle { display: none; background: transparent; border: 1px solid rgba(0,0,0,0.12); border-radius: 10px; width: 42px; height: 38px; align-items: center; justify-content: center; gap: 4px; cursor: pointer; color: var(--text) }
.menu-toggle .bar { display: block; width: 20px; height: 2px; background: var(--text) }

/* Buttons */
.btn { display: inline-block; padding: 10px 16px; border-radius: 10px; border: 1px solid rgba(0,0,0,0.12); color: var(--text); text-decoration: none; transition: transform .12s ease, background .2s ease }
.btn:hover { transform: translateY(-1px) }
.btn.primary { background: linear-gradient(135deg, var(--brand-1), var(--brand-2), var(--brand-3)); color: #041016; border: none; font-weight: 700 }
.btn.ghost { background: transparent }
 .btn.block { display: inline-flex; align-items: center; gap: 8px }

/* Hero */
.hero { position: relative; padding: 96px 0 72px; overflow: hidden }
.gradient-bg { position: absolute; inset: -20%; background: conic-gradient(from 180deg at 50% 50%, rgba(109,94,252,.18), rgba(0,212,255,.18), rgba(0,255,163,.15), rgba(109,94,252,.18)); filter: blur(60px); opacity: .6; transform: translateZ(0) }
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 36px; align-items: center }
.hero-copy h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.15; margin: 0 0 12px; letter-spacing: -0.02em }
.hero-copy p { margin: 0 0 18px; color: var(--muted) }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap }

/* Center Start section */
#start .container { text-align: center }
#start .hero-cta { justify-content: center }

/* 3D Scene */
.scene { perspective: 900px; display: grid; place-items: center; height: 360px }
.cube { position: relative; width: 180px; height: 180px; transform-style: preserve-3d; animation: spin 6s linear infinite; will-change: transform }
.face { position: absolute; width: 100%; height: 100%; display: grid; place-items: center; font-weight: 800; letter-spacing: 0.5px; color: #041016; background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); border-radius: 18px; box-shadow: var(--shadow) }
.face--front { transform: translateZ(90px) }
.face--back { transform: rotateY(180deg) translateZ(90px) }
.face--right { transform: rotateY(90deg) translateZ(90px); background: linear-gradient(135deg, var(--brand-2), var(--brand-3)) }
.face--left { transform: rotateY(-90deg) translateZ(90px); background: linear-gradient(135deg, var(--brand-3), var(--brand-1)) }
.face--top { transform: rotateX(90deg) translateZ(90px) }
.face--bottom { transform: rotateX(-90deg) translateZ(90px) }

@keyframes spin {
  0% { transform: rotateX(0deg) rotateY(0deg) }
  100% { transform: rotateX(360deg) rotateY(360deg) }
}

/* Features */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px }
.feature { background: rgba(0,0,0,0.02); border: 1px solid rgba(0,0,0,0.06); padding: 18px; border-radius: 14px }
.feature h3 { margin: 0 0 6px }
.feature p { margin: 0; color: var(--muted) }

/* Utilities for new content */
.grid { display: grid; gap: 20px }
.grid-2 { grid-template-columns: repeat(2, 1fr) }
.grid-3 { grid-template-columns: repeat(3, 1fr) }
.card { background: rgba(0,0,0,0.02); border: 1px solid rgba(0,0,0,0.06); border-radius: 14px; padding: 18px }
.card h3 { margin: 0 0 8px }
.muted { color: var(--muted) }
.list { padding-left: 18px; margin: 8px 0 0 }
.list li { margin: 6px 0 }
.badge { display: inline-block; padding: 4px 8px; border-radius: 999px; background: rgba(0,0,0,0.06); color: var(--muted); font-size: 12px }

/* FAQ */
details.faq { background: rgba(0,0,0,0.02); border: 1px solid rgba(0,0,0,0.06); border-radius: 12px; padding: 12px 14px }
details.faq + details.faq { margin-top: 10px }
details.faq summary { cursor: pointer; font-weight: 600 }
details.faq[open] { background: rgba(0,0,0,0.04) }

/* Footer */
.site-footer { border-top: 1px solid rgba(0,0,0,0.06); padding: 18px 0; background: rgba(255,255,255,0.8); min-height: var(--footer-h); display: flex; align-items: center }
.footer-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; text-align: center }
.footer-inner a { color: var(--muted); text-decoration: none }
.footer-inner a:hover { color: var(--text) }
/* Footer links group */
.footer-inner > div { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center }

/* Chat dashboard layout */
.page-chat { min-height: 100vh; display: flex; flex-direction: column }
.page-chat .site-header { position: fixed; top: 0; left: 0; right: 0; height: var(--header-h) }
.page-chat .site-footer { position: fixed; bottom: 0; left: 0; right: 0; height: var(--footer-h) }
.page-chat main.chat-main { flex: 1; display: flex; flex-direction: column; height: calc(100dvh - var(--header-h) - var(--footer-h)); min-height: calc(100dvh - var(--header-h) - var(--footer-h)); padding-top: var(--header-h); padding-bottom: var(--footer-h) }
.chat-embed { flex: 1; display: flex; height: 100% }
.chat-embed > * { flex: 1; height: 100% }

/* Responsive */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .scene { height: 280px }
  .cube { width: 150px; height: 150px }
  .features { grid-template-columns: 1fr }
  .grid-2, .grid-3 { grid-template-columns: 1fr }
  .menu-toggle { display: inline-flex }
  .nav { position: absolute; top: 64px; right: 20px; left: 20px; flex-direction: column; background: rgba(255,255,255,0.98); border: 1px solid rgba(0,0,0,0.08); border-radius: 12px; padding: 10px; display: none; box-shadow: var(--shadow) }
  .nav.open { display: flex }
  .nav a, .nav .btn { width: 100% }
  /* Center hero CTA on mobile */
  .hero-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; text-align: center }
  /* Chat dashboards: keep header/footer; make them non-overlapping and align toggle left */
  .page-chat .site-header, .page-chat .site-footer { display: flex; position: static }
  .page-chat .header-inner { justify-content: flex-start; gap: 10px }
  .page-chat main.chat-main { height: calc(100dvh - var(--header-h) - var(--footer-h)); min-height: calc(100dvh - var(--header-h) - var(--footer-h)); padding-top: var(--header-h); padding-bottom: var(--footer-h) }
  .page-chat .chat-embed { height: 100% }
  /* Footer mobile layout */
  .footer-inner { flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px }
  .footer-inner > div { justify-content: center }
  .footer-inner a { padding: 8px 10px; border-radius: 8px; background: rgba(0,0,0,0.03) }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important }
}

/* Clickability: ensure decorative layers don't block hero CTAs */
.gradient-bg { pointer-events: none }
.hero-visual, .hero-visual * { pointer-events: none }
.hero-copy, .hero-cta { position: relative; z-index: 2 }
