/* ==========================================================================
   MAIN.CSS — Design System, Reset, Themes, Base Styles
   GreyMatter Ingenieria — 2026
   ========================================================================== */

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

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

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

body {
  font-family: 'Nunito', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.4s ease, color 0.4s ease;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
ul, ol { list-style: none; }

/* ---------- CSS CUSTOM PROPERTIES — LIGHT THEME ---------- */
:root {
  /* Colors — LIGHT: stronger, more contrast */
  --bg-primary: #F0EFE9;
  --bg-secondary: #E4E2DA;
  --text-primary: #111111;
  --text-secondary: #3D3D3D;
  --text-tertiary: #6B6B6B;
  --accent: #00A87E;
  --accent-hover: #00C992;
  --accent-glow: rgba(0, 168, 126, 0.30);
  --card-glow: rgba(99, 102, 241, 0.18);
  --prism-blue: #2563EB;
  --prism-purple: #7C3AED;
  --prism-blue-glow: rgba(37, 99, 235, 0.20);
  --prism-purple-glow: rgba(124, 58, 237, 0.16);
  --surface: rgba(255, 255, 255, 0.80);
  --surface-hover: rgba(255, 255, 255, 0.95);
  --border: rgba(0, 0, 0, 0.12);
  --border-strong: rgba(0, 0, 0, 0.25);
  --nav-bg: rgba(240, 239, 233, 0.88);
  --card-bg: rgba(255, 255, 255, 0.75);
  --card-bg-hover: rgba(255, 255, 255, 0.95);

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 80px;
  --space-5xl: 100px;

  /* Typography */
  --font-display: 'Playfair Display', serif;
  --font-body: 'Nunito', sans-serif;

  --text-xs: clamp(0.75rem, 1.5vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 1.5vw, 0.9375rem);
  --text-base: clamp(0.9375rem, 2vw, 1.0625rem);
  --text-lg: clamp(1.0625rem, 2vw, 1.25rem);
  --text-xl: clamp(1.25rem, 2.5vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 3vw, 2rem);
  --text-3xl: clamp(2rem, 4vw, 3rem);
  --text-4xl: clamp(2.5rem, 5vw, 4rem);
  --text-hero: clamp(3rem, 8vw, 7rem);

  /* Layout */
  --max-width: 1320px;
  --nav-height: 72px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Shadows — stronger in light */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.10);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.15);
}

/* ---------- DARK THEME ---------- */
[data-theme="dark"] {
  --bg-primary: #0A0A0C;
  --bg-secondary: #111114;
  --text-primary: #EDEDEF;
  --text-secondary: #B8B8C0;
  --text-tertiary: #8A8A94;
  --accent: #00F0A0;
  --accent-hover: #33FFB8;
  --accent-glow: rgba(0, 240, 160, 0.25);
  --card-glow: rgba(99, 102, 241, 0.15);
  --prism-blue: #60A5FA;
  --prism-purple: #A78BFA;
  --prism-blue-glow: rgba(96, 165, 250, 0.18);
  --prism-purple-glow: rgba(167, 139, 250, 0.14);
  --surface: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --nav-bg: rgba(10, 10, 12, 0.88);
  --card-bg: rgba(255, 255, 255, 0.04);
  --card-bg-hover: rgba(255, 255, 255, 0.08);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
}

/* ---------- BASE ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section {
  position: relative;
  padding: var(--space-4xl) 0;
}

.section-alt {
  background-color: var(--bg-secondary);
  transition: background-color 0.4s ease;
}

/* ---------- AMBIENT BG (CSS-only) + GRAIN ---------- */
.ambient-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
  background: var(--bg-primary);
  transition: background 0.6s ease;
}

/* Three prism blobs: green, blue, purple */
.ambient-bg::before,
.ambient-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.6;
  animation: ambient-drift 20s ease-in-out infinite alternate;
  transition: background 0.8s ease;
}

.ambient-bg::before {
  width: 55vw;
  height: 55vw;
  top: -20%;
  right: -10%;
  background: var(--ambient-blob-1);
}

.ambient-bg::after {
  width: 45vw;
  height: 45vw;
  bottom: -15%;
  left: -5%;
  background: var(--ambient-blob-2);
  animation-delay: -10s;
  animation-direction: alternate-reverse;
}

:root {
  --ambient-blob-1: rgba(37, 99, 235, 0.12);
  --ambient-blob-2: rgba(124, 58, 237, 0.10);
  --ambient-blob-3: rgba(0, 168, 126, 0.06);
}

[data-theme="dark"] {
  --ambient-blob-1: rgba(96, 165, 250, 0.10);
  --ambient-blob-2: rgba(167, 139, 250, 0.08);
  --ambient-blob-3: rgba(0, 240, 160, 0.05);
}

@keyframes ambient-drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(3%, 5%) scale(1.08); }
}

.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.30;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.5'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

[data-theme="dark"] .grain-overlay {
  opacity: 0.18;
}

/* ---------- SECTION HEADERS ---------- */
.section-tag {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: var(--space-md);
  padding: var(--space-xs) var(--space-md);
  border: 1.5px solid var(--accent);
  border-radius: 100px;
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
}

.section-desc {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 680px;
  line-height: 1.75;
  font-weight: 400;
}

.section-header {
  margin-bottom: var(--space-2xl);
}

/* ---------- PRISM ACCENT HIGHLIGHTS ---------- */
.prism-text {
  background: linear-gradient(135deg, var(--prism-blue), var(--prism-purple), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- SELECTION ---------- */
::selection {
  background: var(--accent);
  color: var(--bg-primary);
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
