/* ============================================================
   STYLE.CSS — Base styles, typography, layout, and utilities
   Klyo — The Enterprise AI Security Gateway
   ============================================================ */

/* ----- Custom Properties (Design Tokens) — LIGHT MODE ----- */
:root {
  /* Brand Colors */
  --color-primary: #78295f;
  --color-primary-dark: #5e1f4a;
  --color-primary-light: #9a3d7a;
  --color-brand-deep: #3a2743;
  --color-accent: #10b981;
  --color-accent-dark: #059669;

  /* Surfaces */
  --color-bg: #ffffff;
  --color-bg-alt: #f9fafb;
  --color-bg-card: #ffffff;
  --color-bg-code: #f3f0f5;

  /* Text */
  --color-text: #1f2937;
  --color-text-heading: #111827;
  --color-text-muted: #4b5563;
  --color-text-faint: #6b7280;

  /* Borders */
  --color-border: #e5e7eb;
  --color-border-strong: #d1d5db;

  /* Grays (contextual) */
  --color-gray-900: #111827;
  --color-gray-800: #1f2937;
  --color-gray-700: #374151;
  --color-gray-600: #4b5563;
  --color-gray-500: #6b7280;
  --color-gray-400: #9ca3af;
  --color-gray-300: #d1d5db;
  --color-gray-200: #e5e7eb;
  --color-gray-100: #f3f4f6;
  --color-gray-50: #f9fafb;

  /* Semantic */
  --color-check: #10b981;
  --color-cross: #ef4444;
  --color-partial: #f59e0b;

  /* Header */
  --header-bg: rgba(255, 255, 255, 0.85);
  --header-bg-scrolled: rgba(255, 255, 255, 0.95);
  --header-border: transparent;
  --header-border-scrolled: var(--color-border);

  /* Badge */
  --badge-bg: rgba(120, 41, 95, 0.08);
  --badge-color: var(--color-primary);

  /* CTA section */
  --cta-bg: linear-gradient(180deg, var(--color-primary), var(--color-brand-deep));

  /* Footer */
  --footer-bg: var(--color-brand-deep);
  --footer-text: #9ca3af;
  --footer-heading: #9ca3af;
  --footer-link: #9ca3af;
  --footer-link-hover: #ffffff;
  --footer-border: rgba(255, 255, 255, 0.1);

  /* Nerd mode */
  --nerd-bg: #f3f0f5;
  --nerd-border: rgba(120, 41, 95, 0.2);
  --nerd-title-color: var(--color-primary);

  /* Highlight col */
  --highlight-bg: rgba(120, 41, 95, 0.04);
  --highlight-bg-strong: rgba(120, 41, 95, 0.08);

  /* Typography */
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 3.75rem;

  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.6;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;
  --space-5xl: 8rem;

  /* Layout */
  --container-max: 1200px;
  --container-padding: 1.5rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07),
    0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08),
    0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.05);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Header */
  --header-height: 72px;
}


/* ----- DARK MODE ----- */
[data-theme="dark"] {
  --color-primary: #b85d9a;
  --color-primary-dark: #9a3d7a;
  --color-primary-light: #d078b8;
  --color-brand-deep: #2a1a33;

  --color-bg: #0f0a14;
  --color-bg-alt: #160f1d;
  --color-bg-card: #1c1326;
  --color-bg-code: #221830;

  --color-text: #d4cdd8;
  --color-text-heading: #f0ebf3;
  --color-text-muted: #9e93a8;
  --color-text-faint: #7a6f85;

  --color-border: #2e2339;
  --color-border-strong: #3d2f4d;

  --color-gray-900: #f0ebf3;
  --color-gray-800: #d4cdd8;
  --color-gray-700: #b0a5bb;
  --color-gray-600: #9e93a8;
  --color-gray-500: #7a6f85;
  --color-gray-400: #5d5268;
  --color-gray-300: #3d2f4d;
  --color-gray-200: #2e2339;
  --color-gray-100: #1c1326;
  --color-gray-50: #160f1d;

  --header-bg: rgba(15, 10, 20, 0.85);
  --header-bg-scrolled: rgba(15, 10, 20, 0.95);
  --header-border: transparent;
  --header-border-scrolled: var(--color-border);

  --badge-bg: rgba(184, 93, 154, 0.15);
  --badge-color: var(--color-primary-light);

  --cta-bg: linear-gradient(180deg, #3a2743, #0a0610);

  --footer-bg: #0a0610;
  --footer-text: #7a6f85;
  --footer-heading: #7a6f85;
  --footer-link: #7a6f85;
  --footer-link-hover: #f0ebf3;
  --footer-border: rgba(255, 255, 255, 0.05);

  --nerd-bg: #1c1326;
  --nerd-border: rgba(184, 93, 154, 0.25);
  --nerd-title-color: var(--color-primary-light);

  --highlight-bg: rgba(184, 93, 154, 0.06);
  --highlight-bg-strong: rgba(184, 93, 154, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4),
    0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5),
    0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6),
    0 8px 10px -6px rgba(0, 0, 0, 0.3);
}


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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: var(--header-height);
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

button {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

table {
  border-collapse: collapse;
  width: 100%;
}


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

.section {
  padding: var(--space-5xl) 0;
}

.section-alt {
  background-color: var(--color-bg-alt);
}


/* ----- Typography ----- */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--color-text-heading);
  line-height: var(--leading-tight);
  font-weight: 700;
}

.section-header {
  text-align: center;
  max-width: 720px;
  margin-inline: auto;
  margin-bottom: var(--space-3xl);
}

.section-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--badge-color);
  background: var(--badge-bg);
  padding: 0.35em 1em;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-md);
}

.section-title {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-md);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
}

.text-gradient {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}


/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: 1;
  padding: 0.75em 1.75em;
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    filter 180ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px) scale(0.98);
  transition-duration: 60ms;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

/* --- btn-primary --- */
.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(120, 41, 95, 0.2);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  box-shadow: 0 8px 24px rgba(120, 41, 95, 0.35);
  transform: translateY(-2px);
}

.btn-primary:active {
  box-shadow: 0 1px 4px rgba(120, 41, 95, 0.25);
  transform: translateY(1px) scale(0.98);
  transition-duration: 60ms;
}

/* --- btn-outline --- */
.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(120, 41, 95, 0.25);
  transform: translateY(-2px);
}

.btn-outline:active {
  box-shadow: 0 1px 4px rgba(120, 41, 95, 0.15);
  transform: translateY(1px) scale(0.98);
  transition-duration: 60ms;
}

/* --- btn-white --- */
.btn-white {
  background: #ffffff;
  color: #78295f;
  border-color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.btn-white:hover {
  background: #ffffff;
  box-shadow: 0 8px 30px rgba(255, 255, 255, 0.3), 0 0 20px rgba(120, 41, 95, 0.1);
  transform: translateY(-2px);
}

.btn-white:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
  transition-duration: 60ms;
}

[data-theme="dark"] .btn-white {
  color: #3a2743;
}

/* --- btn-outline-white --- */
.btn-outline-white {
  background: transparent;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
}

.btn-outline-white:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #ffffff;
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.btn-outline-white:active {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: none;
  transform: translateY(1px) scale(0.98);
  transition-duration: 60ms;
}

/* --- Hero "Request Demo" — subtle breathing glow --- */
.hero-actions .btn-primary {
  animation: hero-glow 3s ease-in-out infinite;
}

.hero-actions .btn-primary:hover {
  animation: none;
  box-shadow: 0 4px 24px rgba(120, 41, 95, 0.35);
}

@keyframes hero-glow {
  0%, 100% {
    box-shadow: 0 2px 8px rgba(120, 41, 95, 0.2);
  }
  50% {
    box-shadow: 0 2px 20px rgba(120, 41, 95, 0.3);
  }
}

/* --- Sizes --- */
.btn-sm {
  font-size: var(--text-xs);
  padding: 0.6em 1.4em;
}

.btn-lg {
  font-size: var(--text-base);
  padding: 0.9em 2.2em;
}


/* ----- Logo ----- */
.logo-emblem {
  display: inline-block;
  width: 34px;
  height: auto;
  flex-shrink: 0;
}

.logo-text {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text-heading);
}

/* Light/dark emblem switching */
.logo-emblem-light {
  display: none;
}

[data-theme="dark"] .logo-emblem-dark {
  display: none;
}

[data-theme="dark"] .logo-emblem-light {
  display: inline-block;
}

/* Footer logo — always white on dark background */
.site-footer .logo-text {
  color: #ffffff !important;
}


/* ----- Fade-in animation utility ----- */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  will-change: opacity, transform;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
  will-change: auto;
}

.fade-in-delay {
  transition-delay: 0.2s;
}

/* Staggered fade-in for grid children */
.stagger-children > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.stagger-children.visible > * {
  opacity: 1;
  transform: translateY(0);
}

.stagger-children > *:nth-child(1) { transition-delay: 0s; }
.stagger-children > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-children > *:nth-child(3) { transition-delay: 0.2s; }
.stagger-children > *:nth-child(4) { transition-delay: 0.3s; }
.stagger-children > *:nth-child(5) { transition-delay: 0.4s; }
.stagger-children > *:nth-child(6) { transition-delay: 0.5s; }


/* ----- Nerd Mode ----- */
.nerd-block {
  display: none;
  margin-top: var(--space-xl);
}

body.nerd-mode .nerd-block {
  display: block;
}

.nerd-block .nerd-content {
  background: var(--nerd-bg);
  border: 1px solid var(--nerd-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
}

.nerd-title {
  font-size: var(--text-lg);
  color: var(--nerd-title-color);
  margin-bottom: var(--space-lg);
  font-family: var(--font-mono);
}

.nerd-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
}

.nerd-col h5 {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-heading);
  margin-bottom: var(--space-sm);
  font-family: var(--font-mono);
}

.nerd-col ul {
  list-style: none;
  padding: 0;
}

.nerd-col li {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
  padding: 0.3em 0;
  padding-left: 1em;
  position: relative;
  font-family: var(--font-mono);
}

.nerd-col li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--color-primary);
  font-weight: 700;
}

/* Inline nerd blocks (inside cards) */
.nerd-inline {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px dashed var(--nerd-border);
}

.nerd-inline p {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  line-height: 1.6;
}
