/* ============================================================
   FORWARD — Design Tokens & Base Styles
   Dark Mode as default, Light Mode via .dark-removed
   ============================================================ */

:root {
  --background: #0a0a0a;
  --foreground: #fafafa;
  --surface: #111111;
  --elevated: #171717;
  --border: #262626;
  --border-subtle: #1f1f1f;
  --muted: #a3a3a3;
  --faint: #737373;

  --accent: #3d72b4;
  --accent-soft: #525252;
  --gradient-brand: linear-gradient(135deg, #525252 0%, #3d72b4 100%);

  color-scheme: dark;
}

:root.light {
  --background: #ffffff;
  --foreground: #0a0a0a;
  --surface: #fafafa;
  --elevated: #f5f5f5;
  --border: #e5e5e5;
  --border-subtle: #ebebeb;
  --muted: #404040;
  --faint: #737373;

  color-scheme: light;
}

/* ============================================================
   Base typography & body
   ============================================================ */

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: 'Geist', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

/* No transition on theme switch to avoid flashing */
.no-transition,
.no-transition * {
  transition: none !important;
}

/* Subtle global transitions */
a, button {
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

/* ============================================================
   Selection
   ============================================================ */

::selection {
  background: rgba(61, 114, 180, 0.25);
  color: var(--foreground);
}

/* ============================================================
   Scrollbar (subtle, Cursor-like)
   ============================================================ */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
  border: 2px solid var(--background);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--faint);
}

/* ============================================================
   Focus states (a11y, keyboard only)
   ============================================================ */

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================================
   Gradient text utility
   ============================================================ */

.gradient-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* Gradient border via background trick */
.gradient-border {
  position: relative;
  background: var(--surface);
  border-radius: 12px;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: var(--gradient-brand);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0.6;
}

/* ============================================================
   Header backdrop blur
   ============================================================ */

.header-blur {
  background: color-mix(in srgb, var(--background) 80%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
          backdrop-filter: blur(12px) saturate(140%);
}

/* ============================================================
   Reveal-on-scroll animation
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ============================================================
   Hero visual — node/pill styling
   ============================================================ */

.node-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  font-family: 'Geist Mono', ui-monospace, monospace;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.node-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  flex-shrink: 0;
}

.node-pill.is-output .dot {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(61, 114, 180, 0.6);
}

/* ============================================================
   Animated dash on connecting lines
   ============================================================ */

.connect-line {
  stroke: var(--border);
  stroke-width: 1;
  fill: none;
  stroke-dasharray: 3 4;
  animation: dash-move 20s linear infinite;
}

@keyframes dash-move {
  to {
    stroke-dashoffset: -200;
  }
}

@media (prefers-reduced-motion: reduce) {
  .connect-line {
    animation: none;
  }
}

/* ============================================================
   FAQ details/summary
   ============================================================ */

details summary {
  list-style: none;
  cursor: pointer;
}

details summary::-webkit-details-marker {
  display: none;
}

details[open] .faq-icon {
  transform: rotate(45deg);
}

.faq-icon {
  transition: transform 200ms ease;
}

/* ============================================================
   Form controls
   ============================================================ */

input,
textarea,
select {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  width: 100%;
  transition: border-color 150ms ease, background 150ms ease;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--faint);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--elevated);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 6px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a3a3a3' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ============================================================
   Mobile menu sheet
   ============================================================ */

.mobile-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--background);
  transform: translateY(-100%);
  transition: transform 300ms cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
}

.mobile-sheet.is-open {
  transform: translateY(0);
}

body.menu-open {
  overflow: hidden;
}

/* ============================================================
   Utility: subtle grid background
   ============================================================ */

.bg-grid {
  background-image:
    linear-gradient(to right, var(--border-subtle) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border-subtle) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 0%, black, transparent);
          mask-image: radial-gradient(ellipse 60% 70% at 50% 0%, black, transparent);
}

/* ============================================================
   Print
   ============================================================ */

@media print {
  header, footer, .mobile-sheet, button { display: none !important; }
  body { background: white; color: black; }
}
