/* ============================================
 * Design2 Theme — CSS Variables & Animations
 * Портировано из design-2/adapted-bff-variant1
 * ============================================ */

/* Light theme (default) */
:root {
  --background: 40 20% 97%;
  --foreground: 240 10% 16%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 16%;
  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 16%;
  --primary: 142 52% 40%;
  --primary-foreground: 0 0% 100%;
  --secondary: 40 10% 93%;
  --secondary-foreground: 240 6% 35%;
  --muted: 40 10% 93%;
  --muted-foreground: 240 5% 46%;
  --accent: 40 10% 90%;
  --accent-foreground: 240 10% 16%;
  --destructive: 0 84% 50%;
  --destructive-foreground: 0 0% 100%;
  --border: 40 8% 88%;
  --input: 40 8% 88%;
  --ring: 142 52% 40%;
  --radius: 0.625rem;
  --chart-1: 142 52% 40%;
  --chart-2: 220 70% 55%;
  --chart-3: 280 65% 60%;
  --chart-4: 38 92% 55%;
  --chart-5: 0 72% 55%;
}

/* Dark theme */
.dark {
  --background: 240 6% 10%;
  --foreground: 220 13% 91%;
  --card: 240 5% 13%;
  --card-foreground: 220 13% 91%;
  --popover: 240 5% 13%;
  --popover-foreground: 220 13% 91%;
  --primary: 142 52% 58%;
  --primary-foreground: 240 6% 10%;
  --secondary: 240 4% 16%;
  --secondary-foreground: 220 10% 72%;
  --muted: 240 4% 16%;
  --muted-foreground: 220 8% 55%;
  --accent: 240 4% 19%;
  --accent-foreground: 220 13% 91%;
  --destructive: 0 84% 60%;
  --destructive-foreground: 0 0% 100%;
  --border: 240 4% 18%;
  --input: 240 4% 18%;
  --ring: 142 52% 58%;
  --radius: 0.625rem;
  --chart-1: 142 52% 58%;
  --chart-2: 220 70% 55%;
  --chart-3: 280 65% 60%;
  --chart-4: 38 92% 60%;
  --chart-5: 0 72% 60%;
}

/* Base styles */
body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
}

*, *::before, *::after {
  border-color: hsl(var(--border));
}

/* ============================================
 * Scroll-triggered reveal animations
 * ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* ============================================
 * Hero interactive glow (follows mouse)
 * ============================================ */
.hero-glow {
  background: radial-gradient(
    600px circle at var(--glow-x, 50%) var(--glow-y, 50%),
    hsl(var(--primary) / 0.07) 0%,
    transparent 70%
  );
}

.dark .hero-glow {
  background: radial-gradient(
    600px circle at var(--glow-x, 50%) var(--glow-y, 50%),
    hsl(var(--primary) / 0.12) 0%,
    transparent 70%
  );
}

/* ============================================
 * Grain texture overlay
 * ============================================ */
.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  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.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
}

.dark .grain::after {
  opacity: 0.4;
}

/* ============================================
 * Text balance utility
 * ============================================ */
.text-balance {
  text-wrap: balance;
}

/* ============================================
 * Side panel (model detail)
 * ============================================ */
.sidepanel-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sidepanel-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.sidepanel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: 100%;
  max-width: 480px;
  background: hsl(var(--card));
  border-left: 1px solid hsl(var(--border));
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.sidepanel.active {
  transform: translateX(0);
}

/* ============================================
 * RACI table sticky column
 * ============================================ */
.raci-table-wrapper {
  position: relative;
}

.raci-sticky-col {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 160px;
  white-space: nowrap;
}
