/**
 * Compay / PrimoSoftware Design System — Core
 * Original theme. Tokens, reset, typography, layout.
 */

:root {
  --color-primary: #0B3D91;
  --color-primary-dark: #082E6E;
  --color-primary-light: #1A56B0;
  --color-accent: #0EA5E9;
  --color-secondary: #475569;
  --color-bg: #F4F7FB;
  --color-surface: #FFFFFF;
  --color-surface-2: #EEF2F7;
  --color-text: #0F172A;
  --color-muted: #64748B;
  --color-border: #E2E8F0;
  --color-success: #059669;
  --color-warning: #D97706;
  --color-danger: #DC2626;
  --color-info: #0284C7;

  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-h1: clamp(2rem, 4vw, 3rem);
  --fs-h2: clamp(1.5rem, 3vw, 2.25rem);
  --fs-h3: clamp(1.25rem, 2.2vw, 1.5rem);
  --fs-h4: 1.125rem;
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-caption: 0.75rem;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);

  --header-h: 4.25rem;
  --sidebar-w: 16.5rem;
  --container: 72rem;
  --transition: 180ms ease;
  --focus-ring: 0 0 0 3px rgba(14, 165, 233, 0.35);
}

[data-theme="dark"] {
  --color-bg: #0B1220;
  --color-surface: #111827;
  --color-surface-2: #1F2937;
  --color-text: #F1F5F9;
  --color-muted: #94A3B8;
  --color-border: #243044;
  --color-primary: #3B82F6;
  --color-primary-dark: #2563EB;
  --color-primary-light: #60A5FA;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@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 {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-accent);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-md);
  line-height: 1.25;
  font-weight: 700;
  color: var(--color-text);
}

h1 { font-size: var(--fs-h1); letter-spacing: -0.02em; }
h2 { font-size: var(--fs-h2); letter-spacing: -0.015em; }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

p { margin: 0 0 var(--space-md); color: var(--color-muted); }

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.container-wide {
  width: min(100% - 2rem, 80rem);
  margin-inline: auto;
}

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

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

.section-title {
  margin-bottom: var(--space-sm);
}

.section-lead {
  max-width: 40rem;
  margin-bottom: var(--space-xl);
  font-size: 1.05rem;
}

.text-center { text-align: center; }
.text-muted { color: var(--color-muted); }
.text-small { font-size: var(--fs-small); }
.text-caption { font-size: var(--fs-caption); color: var(--color-muted); }
.fw-semibold { font-weight: 600; }
.fw-bold { font-weight: 700; }

.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;
}

.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.stack > * + * { margin-top: var(--space-md); }

.surface {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-main {
  flex: 1;
}

.site-bg {
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(11, 61, 145, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(14, 165, 233, 0.1), transparent 50%),
    var(--color-bg);
}

[data-theme="dark"] .site-bg {
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(59, 130, 246, 0.15), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(14, 165, 233, 0.08), transparent 50%),
    var(--color-bg);
}

.visually-hidden-focusable:not(:focus):not(:focus-within) {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-md);
  top: var(--space-md);
  z-index: 10000;
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
  color: #fff;
}
