/* ==========================================================================
   Dewbix Technologies — Main Stylesheet
   Architecture: Tokens → Base → Layout → Components → Utilities
   ========================================================================== */

/* ---------- 1. DESIGN TOKENS ---------- */
:root {
  /* Brand */
  --brand-primary: #C6F432;        /* electric lime */
  --brand-primary-dim: #A8D628;
  --brand-secondary: #4F46E5;      /* deep indigo accent */
  --brand-tertiary: #FF6B47;       /* warm coral for emphasis */

  /* Dark theme (default) */
  --bg-base: #0A0A0B;
  --bg-elevated: #111113;
  --bg-surface: #17171A;
  --bg-surface-2: #1F1F23;
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-border: rgba(255, 255, 255, 0.08);

  --text-primary: #F5F5F7;
  --text-secondary: #A1A1A6;
  --text-tertiary: #6E6E73;
  --text-inverse: #0A0A0B;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-emphasis: rgba(255, 255, 255, 0.18);

  /* Typography */
  --font-display: "Instrument Serif", "Cormorant Garamond", Georgia, serif;
  --font-body: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, monospace;

  /* Type scale (fluid) */
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: clamp(1.75rem, 3vw, 2.5rem);
  --fs-3xl: clamp(2.25rem, 4vw, 3.5rem);
  --fs-4xl: clamp(3rem, 7vw, 6rem);
  --fs-display: clamp(3.5rem, 10vw, 9rem);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;
  --space-11: 12rem;

  /* Layout */
  --container-max: 1320px;
  --container-padding: clamp(1rem, 4vw, 2.5rem);
  --section-padding: clamp(4rem, 10vw, 8rem);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 999px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 180ms;
  --dur-base: 320ms;
  --dur-slow: 600ms;
  --dur-slower: 1000ms;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.35);
  --shadow-lg: 0 24px 60px rgba(0,0,0,0.45);
  --shadow-glow: 0 0 80px rgba(198, 244, 50, 0.15);

  /* Z-index */
  --z-base: 1;
  --z-sticky: 100;
  --z-nav: 200;
  --z-overlay: 500;
  --z-modal: 1000;
  --z-toast: 2000;
}

/* Light theme */
[data-theme="light"] {
  --bg-base: #FAFAF7;
  --bg-elevated: #FFFFFF;
  --bg-surface: #F4F4F0;
  --bg-surface-2: #EAEAE3;
  --bg-glass: rgba(0, 0, 0, 0.02);
  --bg-glass-border: rgba(0, 0, 0, 0.06);

  --text-primary: #0A0A0B;
  --text-secondary: #44444A;
  --text-tertiary: #76767D;
  --text-inverse: #FAFAF7;

  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-default: rgba(0, 0, 0, 0.1);
  --border-emphasis: rgba(0, 0, 0, 0.18);

  --shadow-md: 0 8px 24px rgba(0,0,0,0.06);
  --shadow-lg: 0 24px 60px rgba(0,0,0,0.1);
}

/* ---------- 2. BASE / RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-feature-settings: "ss01", "cv11";
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}

img, svg, video { display: block; max-width: 100%; height: auto; }
img { font-style: italic; background-repeat: no-repeat; background-size: cover; }

input, button, textarea, select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button { cursor: pointer; }

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}

ul, ol { list-style: none; }

::selection {
  background: var(--brand-primary);
  color: var(--text-inverse);
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb {
  background: var(--bg-surface-2);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-base);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- 3. TYPOGRAPHY ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--brand-primary);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--brand-primary);
}

.display {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.02em;
  font-size: var(--fs-display);
}

.display em {
  font-style: italic;
  color: var(--brand-primary);
}

.heading-xl {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-4xl);
  line-height: 0.98;
  letter-spacing: -0.025em;
}

.heading-lg {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-3xl);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.heading-md {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-2xl);
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.heading-sm {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-xl);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.lead {
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 60ch;
}

.text-mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-secondary); }
.text-subtle { color: var(--text-tertiary); }

/* ---------- 4. LAYOUT ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.container-wide {
  width: 100%;
  max-width: 1600px;
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.section {
  padding-block: var(--section-padding);
  position: relative;
}

.section-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

@media (min-width: 900px) {
  .section-header {
    grid-template-columns: 1fr 1fr;
    align-items: end;
    gap: var(--space-7);
  }
}

.section-header__title {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  line-height: 1;
  letter-spacing: -0.02em;
}

.section-header__title em {
  font-style: italic;
  color: var(--brand-primary);
}

.section-header__lead {
  color: var(--text-secondary);
  font-size: var(--fs-md);
  max-width: 50ch;
}

/* ---------- 5. BUTTONS ---------- */
.btn {
  --btn-bg: var(--text-primary);
  --btn-fg: var(--text-inverse);
  --btn-border: transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1.5rem;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--dur-base) var(--ease-out),
              background var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out);
  white-space: nowrap;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--brand-primary);
  border-radius: inherit;
  transform: translateY(101%);
  transition: transform var(--dur-base) var(--ease-out-expo);
  z-index: -1;
}

.btn:hover::before { transform: translateY(0); }
.btn:hover { color: var(--text-inverse); }

.btn--primary {
  --btn-bg: var(--brand-primary);
  --btn-fg: var(--text-inverse);
}

.btn--primary::before { background: var(--text-primary); }
.btn--primary:hover { color: var(--bg-base); }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text-primary);
  --btn-border: var(--border-emphasis);
}

.btn--ghost::before { background: var(--brand-primary); }
.btn--ghost:hover { border-color: var(--brand-primary); }

.btn .btn__icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  transition: transform var(--dur-base) var(--ease-out);
}

.btn:hover .btn__icon { transform: translateX(3px); }

.btn--lg {
  padding: 1.125rem 2rem;
  font-size: var(--fs-base);
}

/* ---------- 6. CHIPS / BADGES ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background: var(--bg-glass);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.chip__dot {
  width: 6px;
  height: 6px;
  background: var(--brand-primary);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--brand-primary);
  animation: pulse 2s var(--ease-in-out) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ---------- 7. SCROLL REVEAL ---------- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 800ms var(--ease-out-expo),
              transform 800ms var(--ease-out-expo);
}

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

.reveal[data-delay="1"] { transition-delay: 100ms; }
.reveal[data-delay="2"] { transition-delay: 200ms; }
.reveal[data-delay="3"] { transition-delay: 300ms; }
.reveal[data-delay="4"] { transition-delay: 400ms; }
.reveal[data-delay="5"] { transition-delay: 500ms; }
.reveal[data-delay="6"] { transition-delay: 600ms; }

.reveal-x {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 800ms var(--ease-out-expo),
              transform 800ms var(--ease-out-expo);
}

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

/* ---------- 8. UTILITIES ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.text-balance { text-wrap: balance; }
.text-pretty { text-wrap: pretty; }

.divider {
  height: 1px;
  background: var(--border-subtle);
  border: 0;
  margin-block: var(--space-6);
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

[data-theme="light"] .grain { opacity: 0.06; mix-blend-mode: multiply; }
