*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #faf8f5;
  --color-surface: #ffffff;
  --color-text: #111827;
  --color-text-secondary: #4b5563;
  --color-border: #e5e7eb;
  --color-primary: #e07b39;
  --color-primary-hover: #c96528;
  --color-accent: #fcd34d;
  --color-success: #10b981;
  --gradient-warm: linear-gradient(160deg, #fff7ed 0%, #fee2d0 50%, #fce4ec 100%);
  --gradient-hero: linear-gradient(180deg, #ffffff 0%, #fff7ed 100%);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-base: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --space-xl: 3.5rem;
  --space-2xl: 5rem;
  --container-max: 1200px;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-base);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* Typography */
h1, h2, h3, h4 {
  line-height: 1.2;
  text-wrap: balance;
  color: var(--color-text);
}
h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 600; margin-bottom: var(--space-md); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); font-weight: 600; margin-bottom: var(--space-sm); }
p { margin-bottom: 1rem; color: var(--color-text-secondary); }
strong { font-weight: 600; color: var(--color-text); }
code, .mono { font-family: var(--font-mono); font-size: 0.9em; background: #f3f4f6; padding: 2px 6px; border-radius: 4px; }

/* Layout */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

section {
  padding: var(--space-2xl) 0;
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--space-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: var(--space-lg); }

/* Header & Nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 248, 245, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.brand { display: flex; align-items: center; gap: var(--space-sm); }
.brand img { height: 32px; width: auto; }
.brand-text { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }
.nav-links { display: flex; gap: var(--space-lg); font-size: 0.95rem; font-weight: 500; }
.nav-link { padding: 6px 0; border-bottom: 2px solid transparent; transition: border-color .2s; }
.nav-link:hover, .nav-link[aria-current="page"] { border-bottom-color: var(--color-primary); color: var(--color-primary); }
.mobile-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.toggle-icon { width: 24px; height: 24px; stroke: currentColor; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  transition: transform .2s ease, box-shadow .2s ease, background .2s;
  cursor: pointer;
  border: none;
  user-select: none;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary { background: var(--color-primary); color: #fff; box-shadow: 0 4px 12px rgba(224, 123, 57, 0.25); }
.btn-primary:hover { background: var(--color-primary-hover); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(224, 123, 57, 0.35); }
.btn-outline { background: transparent; border: 1.5px solid var(--color-border); color: var(--color-text); }
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-sm { padding: 8px 16px; font-size: 0.9rem; border-radius: var(--radius-sm); }

/* Hero */
.hero {
  padding: var(--space-2xl) 0 var(--space-xl);
  background: var(--gradient-hero);
  position: relative;
  overflow: hidden;
}
.hero-content { max-width: 720px; position: relative; z-index: 2; }
.hero-subtitle { font-size: clamp(1.1rem, 2vw, 1.35rem); color: var(--color-text-secondary); margin-bottom: var(--space-lg); max-width: 600px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-md); margin-top: var(--space-lg); }
.hero-svg-container { position: absolute; top: 10%; right: 0; width: 50%; max-width: 560px; height: auto; opacity: 0.9; }

/* Features */
.feature-card {
  background: var(--color-surface);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.feature-icon { width: 40px; height: 40px; margin-bottom: var(--space-md); color: var(--color-primary); }
.feature-title { margin-bottom: var(--space-xs); }
.feature-desc { font-size: 0.95rem; line-height: 1.6; margin: 0; }

/* UI Demo */
.ui-demo-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.ui-mockup {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  aspect-ratio: 16/9;
  background: #f8fafc;
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: 240px 1fr;
  overflow: hidden;
}
.ui-sidebar { background: #fff; border-right: 1px solid var(--color-border); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ui-chat { background: #fff; padding: 20px; display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; }
.ui-bubble { padding: 10px 14px; border-radius: 12px; font-size: 0.9rem; max-width: 80%; }
.bubble-in { background: #f3f4f6; align-self: flex-start; }
.bubble-out { background: #eff6ff; color: #0f172a; align-self: flex-end; }

/* Scenarios & Steps */
.scenario-card, .step-card {
  background: var(--color-surface);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.scenario-step { counter-reset: step; margin-top: var(--space-sm); }
.scenario-step li { position: relative; padding-left: 28px; margin-bottom: 8px; font-size: 0.95rem; }
.scenario-step li::before { content: counter(step); counter-increment: step; position: absolute; left: 0; top: 0; width: 20px; height: 20px; background: var(--color-primary); color: #fff; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; font-weight: 600; }
.step-number { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: var(--color-primary); color: #fff; border-radius: 50%; font-weight: 700; margin-right: 12px; vertical-align: middle; }

/* Table */
.table-wrapper { overflow-x: auto; margin-top: var(--space-md); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 14px; text-align: left; border-bottom: 1px solid var(--color-border); }
th { font-weight: 600; background: #f9fafb; }
tr:last-child td { border-bottom: none; }

/* Security */
.security-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-lg); margin-top: var(--space-md); }
.security-item { display: flex; gap: 12px; align-items: flex-start; }
.security-icon { flex-shrink: 0; width: 28px; height: 28px; color: var(--color-success); }

/* Download */
#download { background: var(--gradient-warm); border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
.download-box { max-width: 700px; margin: 0 auto; text-align: center; }
.download-box p { margin-bottom: var(--space-md); }
.requirements-list { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-md); margin: var(--space-md) 0; }
.req-tag { padding: 6px 12px; background: #fff; border: 1px solid var(--color-border); border-radius: 99px; font-size: 0.85rem; font-weight: 500; }
.install-steps { text-align: left; max-width: 500px; margin: var(--space-lg) auto; counter-reset: install; }
.install-steps li { position: relative; padding-left: 32px; margin-bottom: 14px; }
.install-steps li::before { counter-increment: install; content: counter(install); position: absolute; left: 0; top: 2px; width: 22px; height: 22px; background: var(--color-primary); color: #fff; border-radius: 6px; display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 12px; }
details { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
summary { padding: 18px 20px; cursor: pointer; font-weight: 600; list-style: none; position: relative; transition: background .2s; }
summary:hover { background: #f9fafb; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 1.2rem; color: var(--color-text-secondary); transition: transform .25s; }
details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.details-content { padding: 0 20px 20px; font-size: 0.95rem; line-height: 1.65; color: var(--color-text-secondary); }

/* Updates & Related */
.update-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-lg); display: flex; flex-direction: column; height: 100%; }
.update-date { font-family: var(--font-mono); font-size: 0.8rem; color: var(--color-text-secondary); margin-bottom: 8px; }
.update-title { margin-bottom: 8px; }
.update-excerpt { flex-grow: 1; font-size: 0.9rem; margin-bottom: var(--space-md); }
.link-list li { margin-bottom: 12px; border-bottom: 1px dashed var(--color-border); padding-bottom: 12px; }
.link-list li a { font-weight: 500; display: flex; justify-content: space-between; align-items: baseline; }
.link-list li a span { font-size: 0.85rem; color: var(--color-text-secondary); margin-top: 4px; }
.link-list li a:hover { color: var(--color-primary); }

/* Footer */
.site-footer { background: #111827; color: #9ca3af; padding: var(--space-xl) 0 var(--space-lg); font-size: 0.9rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-lg); margin-bottom: var(--space-lg); }
.footer-col h4 { color: #fff; margin-bottom: var(--space-md); font-size: 1rem; }
.footer-links li { margin-bottom: 8px; }
.footer-links a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #374151; padding-top: var(--space-md); text-align: center; font-size: 0.85rem; }

/* SVG Animations */
@keyframes contour-flow {
  0% { stroke-dashoffset: 1; opacity: 0.5; }
  50% { opacity: 0.9; }
  100% { stroke-dashoffset: 1; opacity: 0.5; }
}
@keyframes wave-drift {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}
.svg-contour-path {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 1.5;
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: contour-flow 10s linear infinite alternate;
}
.svg-wave-path {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 1.2;
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: contour-flow 14s linear infinite alternate-reverse;
}
.svg-group-animated { animation: wave-drift 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .svg-contour-path, .svg-wave-path { animation: none; }
  .svg-group-animated { animation: none; }
}

/* Responsive */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-toggle { display: block; }
  .hero-svg-container { width: 90%; top: 15%; right: 5%; opacity: 0.4; }
  .ui-mockup { grid-template-columns: 1fr; }
  .ui-sidebar { display: none; }
}
