/* ========================================================================
 * Variables
 * ======================================================================== */

:root {
  /* Color Palette - tech-focused blue & graphite */
  --color-background: #050811;
  --color-surface: #0b1020;
  --color-surface-alt: #141a2b;
  --color-surface-soft: #1b2236;

  --color-text: #f5f7ff;
  --color-text-muted: #a3acc6;
  --color-border-subtle: #252b3e;

  --color-primary: #2d8cff;
  --color-primary-soft: rgba(45, 140, 255, 0.12);
  --color-primary-soft-strong: rgba(45, 140, 255, 0.24);

  --color-success: #2ecc71;
  --color-success-soft: rgba(46, 204, 113, 0.14);
  --color-warning: #f1c40f;
  --color-warning-soft: rgba(241, 196, 15, 0.16);
  --color-danger: #e74c3c;
  --color-danger-soft: rgba(231, 76, 60, 0.18);

  /* Neutral grays (cool, for enterprise dashboards) */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2933;
  --gray-900: #111827;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-base: 1rem;    /* 16px */
  --font-size-lg: 1.125rem;  /* 18px */
  --font-size-xl: 1.25rem;   /* 20px */
  --font-size-2xl: 1.5rem;   /* 24px */
  --font-size-3xl: 1.875rem; /* 30px */
  --font-size-4xl: 2.25rem;  /* 36px */

  --line-height-tight: 1.2;
  --line-height-snug: 1.35;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.7;

  /* Spacing scale (0–96px) */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

  /* Radius */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 18px;
  --radius-pill: 999px;

  /* Shadows (subtle but modern) */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.5);
  --shadow-sm: 0 8px 18px rgba(15, 23, 42, 0.45);
  --shadow-md: 0 18px 40px rgba(15, 23, 42, 0.6);

  /* Transitions */
  --transition-fast: 120ms ease-out;
  --transition-base: 180ms ease-out;
  --transition-slow: 260ms ease;

  /* Layout */
  --container-width: 1120px;
  --container-gutter: 1.5rem;
}

/* Reduced motion: disable transitions/animations for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: 0ms;
    --transition-base: 0ms;
    --transition-slow: 0ms;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ========================================================================
 * Reset / Normalize
 * ======================================================================== */

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

html,
body {
  margin: 0;
  padding: 0;
}

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

body {
  min-height: 100vh;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: none;
  background: none;
  padding: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
figure {
  margin: 0;
}

/* Make sure form elements don't overflow containers */
input,
textarea,
select,
button {
  max-width: 100%;
}

/* ========================================================================
 * Base Styles
 * ======================================================================== */

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  background-color: var(--color-background);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  min-height: 60vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: var(--line-height-tight);
  color: var(--color-text);
}

h1 {
  font-size: clamp(2.25rem, 3vw, 2.75rem);
  margin-bottom: var(--space-4);
}

h2 {
  font-size: clamp(1.75rem, 2.4vw, 2.125rem);
  margin-bottom: var(--space-3);
}

h3 {
  font-size: clamp(1.5rem, 2vw, 1.75rem);
  margin-bottom: var(--space-2);
}

h4 {
  font-size: 1.25rem;
  margin-bottom: var(--space-2);
}

h5 {
  font-size: 1.125rem;
  margin-bottom: var(--space-2);
}

h6 {
  font-size: 1rem;
  margin-bottom: var(--space-1);
}

p {
  margin-bottom: var(--space-3);
  line-height: var(--line-height-relaxed);
  }

a {
  color: var(--color-primary);
  text-decoration: none;
  text-underline-offset: 2px;
  transition: color var(--transition-base), text-decoration-color var(--transition-base);
}

a:hover {
  color: #6ca9ff;
  text-decoration: underline;
}

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

small {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

code,
pre {
  font-family: var(--font-mono);
}

hr {
  border: 0;
  border-top: 1px solid var(--color-border-subtle);
  margin: var(--space-6) 0;
}

/* ========================================================================
 * Accessibility Helpers
 * ======================================================================== */

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

[tabindex="-1"]:focus {
  outline: none !important;
}

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

/* ========================================================================
 * Utilities
 * ======================================================================== */

.container {
  width: 100%;
  max-width: var(--container-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-gutter);
  padding-right: var(--container-gutter);
}

.section {
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
}

.section--tight {
  padding-top: var(--space-10);
  padding-bottom: var(--space-10);
}

/* Flex helpers */

.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm {
  gap: var(--space-3);
}

.gap-md {
  gap: var(--space-4);
}

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

/* Grid helpers */

.grid {
  display: grid;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-6);
}

@media (max-width: 900px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-muted {
  color: var(--color-text-muted);
}

.w-full {
  width: 100%;
}

.max-w-readable {
  max-width: 72ch;
}

/* Spacing utility (vertical rhythm) */

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

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

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

/* ========================================================================
 * Components
 * ======================================================================== */

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: var(--font-size-sm);
  line-height: 1.1;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color var(--transition-base),
    border-color var(--transition-base),
    color var(--transition-base),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.btn--primary {
  background: linear-gradient(135deg, #2d8cff, #00b4ff);
  color: #ffffff;
  box-shadow: var(--shadow-xs);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn--primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

.btn--ghost {
  background-color: transparent;
  border-color: var(--color-border-subtle);
  color: var(--color-text);
}

.btn--ghost:hover {
  background-color: rgba(148, 163, 184, 0.08);
}

.btn--danger {
  background-color: var(--color-danger);
  color: #ffffff;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

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

/* Inputs */

.input,
textarea,
select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  background-color: rgba(15, 23, 42, 0.8);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  line-height: 1.4;
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    background-color var(--transition-base);
}

.input::placeholder,
textarea::placeholder {
  color: var(--color-text-muted);
}

.input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary-soft-strong);
  background-color: #050816;
}

.input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
  display: inline-block;
  margin-bottom: var(--space-1);
}

.field-help {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.field-error {
  font-size: var(--font-size-xs);
  color: var(--color-danger);
  margin-top: var(--space-1);
}

/* Card */

.card {
  background: radial-gradient(circle at top left, rgba(45, 140, 255, 0.16), transparent 55%),
    var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(45, 140, 255, 0.22), transparent 60%);
  opacity: 0.4;
  pointer-events: none;
}

.card__content {
  position: relative;
  z-index: 1;
}

.card--muted {
  background: var(--color-surface-alt);
  box-shadow: var(--shadow-xs);
}

.card--outlined {
  background: var(--color-surface);
  border-style: dashed;
  box-shadow: none;
}

.card-header {
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-1);
}

.card-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* Badge (useful for labels like "Enterprise", "API", etc.) */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.16rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background-color: var(--color-primary-soft);
  color: #dbeafe;
}

.badge--success {
  background-color: var(--color-success-soft);
  color: #e3f9e5;
}

.badge--warning {
  background-color: var(--color-warning-soft);
  color: #fef3c7;
}

.badge--danger {
  background-color: var(--color-danger-soft);
  color: #fee2e2;
}

/* Panels / subtle surface blocks (e.g., for stats, feature lists) */

.surface {
  background-color: var(--color-surface-alt);
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.16);
  padding: var(--space-4);
}

.surface--soft {
  background-color: var(--color-surface-soft);
}

/* Tables (for enterprise data / resources) */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

th,
td {
  padding: 0.75rem 0.75rem;
  text-align: left;
}

th {
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border-subtle);
}

tbody tr:nth-child(even) {
  background-color: rgba(15, 23, 42, 0.4);
}

tbody tr:hover {
  background-color: rgba(15, 23, 42, 0.7);
}

/* Alerts (e.g., compliance messages, system status) */

.alert {
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  border: 1px solid transparent;
}

.alert--info {
  background-color: var(--color-primary-soft);
  border-color: rgba(37, 99, 235, 0.5);
  color: #dbeafe;
}

.alert--success {
  background-color: var(--color-success-soft);
  border-color: rgba(34, 197, 94, 0.5);
}

.alert--warning {
  background-color: var(--color-warning-soft);
  border-color: rgba(245, 158, 11, 0.5);
}

.alert--danger {
  background-color: var(--color-danger-soft);
  border-color: rgba(239, 68, 68, 0.5);
}

/* Navigation helpers (basic baseline, can be extended per layout) */

.navbar {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(18px);
  background: linear-gradient(to right, rgba(5, 8, 17, 0.96), rgba(8, 16, 32, 0.9));
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  font-size: 0.9rem;
}

.nav-link {
  color: var(--color-text-muted);
  position: relative;
  padding: 0.1rem 0;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.2rem;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2d8cff, #00b4ff);
  transition: width var(--transition-base);
}

.nav-link:hover {
  color: var(--color-text);
}

.nav-link:hover::after {
  width: 100%;
}

.nav-link--active {
  color: var(--color-text);
}

.nav-link--active::after {
  width: 100%;
}

/* Footer baseline */

.footer {
  border-top: 1px solid rgba(15, 23, 42, 0.8);
  background: radial-gradient(circle at top, rgba(37, 99, 235, 0.1), transparent 55%), #050811;
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}
