/* =====================================
   Variables
   ===================================== */
:root {
  /* Palette - Futuristic, vibrant OW2-inspired */
  --color-background: #0b0f14; /* deep space blue-black */
  --color-surface: #121923; /* elevated panel */
  --color-elevated: #192330; /* higher elevation */
  --color-text: #e8f0f7; /* crisp white-blue */
  --color-text-muted: #a5b4c3;

  --color-primary: #00e5ff; /* electric teal */
  --color-primary-600: #00b8cc;
  --color-primary-700: #0096ab;

  --color-accent: #ff9f1a; /* fiery orange */
  --color-accent-600: #e48900;

  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;

  /* Neutral grays */
  --gray-50: #f8fafc;
  --gray-100: #eef2f6;
  --gray-200: #e3e8ef;
  --gray-300: #cdd5df;
  --gray-400: #9aa4b2;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #0b1220;

  /* Typography */
  --font-sans: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, -apple-system, "Noto Sans", "Liberation Sans", sans-serif;
  --font-display: "Rajdhani", "Orbitron", "Exo 2", var(--font-sans);

  --text-xs: 0.75rem;   /* 12px */
  --text-sm: 0.875rem;  /* 14px */
  --text-base: 1rem;    /* 16px */
  --text-lg: 1.125rem;  /* 18px */
  --text-xl: 1.25rem;   /* 20px */
  --text-2xl: 1.5rem;   /* 24px */
  --text-3xl: 1.875rem; /* 30px */
  --text-4xl: 2.25rem;  /* 36px */
  --text-5xl: 3rem;     /* 48px */
  --lh-tight: 1.2;
  --lh-normal: 1.6;

  /* Spacing scale (0–96px) */
  --space-0: 0;
  --space-2: 2px;
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;
  --space-40: 40px;
  --space-48: 48px;
  --space-56: 56px;
  --space-64: 64px;
  --space-72: 72px;
  --space-80: 80px;
  --space-96: 96px;

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

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.40);
  --shadow-sm: 0 4px 10px rgba(0,0,0,0.50);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.03);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.60), 0 0 0 1px rgba(255,255,255,0.06);
  --shadow-glow-primary: 0 0 0 2px rgba(0,229,255,0.25), 0 0 24px rgba(0,229,255,0.25);

  /* Transitions */
  --duration-fast: 120ms;
  --duration-normal: 220ms;
  --duration-slow: 420ms;
  --easing: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Layout */
  --container-max: 1200px;
  --container-pad: 1rem;
}

/* =====================================
   Reset / Normalize
   ===================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Remove default margins */
* { margin: 0; }

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

body {
  min-height: 100vh;
  line-height: var(--lh-normal);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/* Remove list styles on ul, ol elements */
ul[role='list'], ol[role='list'] { list-style: none; }

/* Respect user motion preferences */
@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;
    scroll-behavior: auto !important;
  }
}

/* =====================================
   Base
   ===================================== */
body {
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-sans);
}

/* Containers for comfortable reading width */
main, article, section {
  container-type: inline-size;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: var(--lh-tight);
  letter-spacing: 0.01em;
  color: var(--color-text);
}

h1 { font-size: clamp(2rem, 4vw, var(--text-5xl)); }
h2 { font-size: clamp(1.5rem, 3vw, var(--text-4xl)); }
h3 { font-size: clamp(1.25rem, 2.25vw, var(--text-3xl)); }
h4 { font-size: clamp(1.125rem, 1.75vw, var(--text-2xl)); }
h5 { font-size: clamp(1rem, 1.5vw, var(--text-xl)); }
h6 { font-size: clamp(0.875rem, 1.25vw, var(--text-lg)); letter-spacing: 0.04em; text-transform: uppercase; }

h1, h2, h3 { margin-block: var(--space-24) var(--space-12); }
h4, h5, h6 { margin-block: var(--space-20) var(--space-8); }

/* Paragraphs with comfortable line length */
p {
  font-size: var(--text-base);
  color: var(--color-text);
  margin-block: var(--space-12);
}

/* Links - sleek, no default underline */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--duration-normal) var(--easing), text-shadow var(--duration-normal) var(--easing);
}

a:hover { color: #7bf3ff; }

a:active { color: var(--color-primary-600); }

/* Strong/emphasis */
strong { font-weight: 700; }
em { font-style: italic; }

/* Horizontal rule */
hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  margin-block: var(--space-24);
}

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

@media (min-width: 768px) {
  :root { --container-pad: 1.25rem; }
}
@media (min-width: 1024px) {
  :root { --container-pad: 1.5rem; }
}

/* Flex and grid helpers */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-8); }
.gap-md { gap: var(--space-16); }
.gap-lg { gap: var(--space-24); }

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

/* Screen reader only */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Focus-visible outlines (Accessibility) */
:where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  box-shadow: var(--shadow-glow-primary);
  border-radius: 6px;
}

/* =====================================
   Components
   ===================================== */
/* Buttons */
.btn {
  --btn-bg: var(--gray-800);
  --btn-fg: var(--color-text);
  --btn-border: rgba(255,255,255,0.08);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  padding: 10px 16px;
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: 1;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-fast) var(--easing), box-shadow var(--duration-normal) var(--easing), background-color var(--duration-normal) var(--easing), color var(--duration-normal) var(--easing), border-color var(--duration-normal) var(--easing);
  cursor: pointer;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-xs); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-primary {
  --btn-bg: linear-gradient(180deg, var(--color-primary), var(--color-primary-600));
  --btn-fg: #03161a;
  --btn-border: rgba(0, 229, 255, 0.5);
}

.btn-accent {
  --btn-bg: linear-gradient(180deg, var(--color-accent), var(--color-accent-600));
  --btn-fg: #1c0e00;
  --btn-border: rgba(255, 159, 26, 0.5);
}

.btn-outline {
  --btn-bg: transparent;
  --btn-fg: var(--color-text);
  --btn-border: rgba(255,255,255,0.25);
  background-color: transparent;
}

/* Inputs */
.input, input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="url"], input[type="number"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  transition: border-color var(--duration-normal) var(--easing), box-shadow var(--duration-normal) var(--easing), background-color var(--duration-normal) var(--easing);
}

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

.input:focus, input:focus, select:focus, textarea:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(0,229,255,0.15); outline: none; }

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

/* Cards */
.card {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-24);
}

.card--elevated { background: var(--color-elevated); box-shadow: var(--shadow-lg); }

/* Media framing utility - subtle futuristic border */
.media-frame {
  background: radial-gradient(120% 120% at 50% 0%, rgba(0,229,255,0.06), transparent 70%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: #03161a;
  background: var(--color-primary);
  border-radius: var(--radius-full);
}

.badge--accent { background: var(--color-accent); color: #1c0e00; }
.badge--soft { background: rgba(0,229,255,0.12); color: var(--color-primary); }

/* =====================================
   Additional Accessibility
   ===================================== */
/* Ensure focus visible on dark surfaces */
button:focus:not(:focus-visible),
[role="button"]:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* High-contrast states for status colors */
.status-success { color: var(--color-success); }
.status-warning { color: var(--color-warning); }
.status-danger { color: var(--color-danger); }

/* =====================================
   Fine-tuning
   ===================================== */
/* Selection color */
::selection {
  background: rgba(0,229,255,0.25);
  color: var(--color-text);
}

/* Code elements */
code, kbd, samp, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

pre {
  background: #0e141b;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  padding: var(--space-16);
  overflow: auto;
}

/* Navigation link accent underline on hover (sleek) */
.nav-link {
  position: relative;
  display: inline-block;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-normal) var(--easing);
}

.nav-link:hover::after, .nav-link:focus-visible::after { transform: scaleX(1); }
