/* =========================================================
   Variables
   ========================================================= */
:root {
  /* Palette */
  --color-background: #f8fafc; /* soft white */
  --color-surface: #ffffff;
  --color-text: #0f172a; /* charcoal/slate-900 */
  --color-muted: #475569; /* slate-600 */

  --color-primary: #2e6bff; /* electric blue */
  --color-success: #00e676; /* neon green */
  --color-warning: #ff6a00; /* bright orange */
  --color-danger:  #ff3366; /* vibrant danger */
  --color-accent:  #39ff14; /* neon accent */

  --on-primary: #ffffff;
  --on-success: #0a0a0a;
  --on-warning: #0a0a0a;
  --on-danger:  #ffffff;

  /* Neutral grays */
  --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: #1f2937;
  --gray-900: #111827;

  /* Typography */
  --font-sans: "Inter", "Poppins", "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, -apple-system, "Apple Color Emoji", "Segoe UI Emoji";
  --font-display: "Poppins", "Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif;

  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-base: 16px;
  --fs-md: 18px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-2xl: 30px;
  --fs-3xl: 36px;
  --fs-4xl: 48px;
  --fs-5xl: 60px;

  --lh-tight: 1.2;
  --lh-snug: 1.35;
  --lh-normal: 1.6;
  --lh-loose: 1.75;

  /* Spacing scale (0–96px in 4px steps) */
  --space-0: 0px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-9: 36px;
  --space-10: 40px;
  --space-11: 44px;
  --space-12: 48px;
  --space-13: 52px;
  --space-14: 56px;
  --space-15: 60px;
  --space-16: 64px;
  --space-17: 68px;
  --space-18: 72px;
  --space-19: 76px;
  --space-20: 80px;
  --space-21: 84px;
  --space-22: 88px;
  --space-23: 92px;
  --space-24: 96px;

  /* 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.06);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.18);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.22);
  --shadow-glow-primary: 0 0 0 3px rgba(46, 107, 255, 0.35), 0 10px 20px rgba(46, 107, 255, 0.2);

  /* Transitions */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-slow: 320ms;

  /* Focus ring */
  --focus-ring: rgba(46, 107, 255, 0.45);
}

/* Optional dark theme hook */
.theme-dark, [data-theme="dark"] {
  --color-background: #0b0f14; /* near-black charcoal */
  --color-surface: #0f172a; /* deep slate */
  --color-text: #e5e7eb;
  --color-muted: #94a3b8;

  --color-primary: #4f9cff; /* brighter blue in dark */
  --color-success: #0ef08c;
  --color-warning: #ff8a33;
  --color-danger:  #ff4d7a;

  --on-primary: #0b1020;
  --on-success: #071a0f;
  --on-warning: #0a0a0a;
  --on-danger:  #0b0b0b;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.7);
  --shadow-glow-primary: 0 0 0 3px rgba(79, 156, 255, 0.5), 0 10px 30px rgba(79, 156, 255, 0.25);
  --focus-ring: rgba(79, 156, 255, 0.6);
}


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

html:focus-within { scroll-behavior: smooth; }

html, body { height: 100%; }

body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }

ul[role="list"], ol[role="list"] { list-style: none; padding-left: 0; }

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

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

button, [type="button"], [type="reset"], [type="submit"] { -webkit-appearance: button; appearance: button; }

/* Remove animations for users preferring reduced motion */
@media (prefers-reduced-motion: reduce) {
  html:focus-within { 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 Styles
   ========================================================= */
html { color-scheme: light dark; }

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

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

h1 { font-size: clamp(2rem, 2vw + 1.5rem, var(--fs-5xl)); margin-block: var(--space-6) var(--space-4); }
h2 { font-size: clamp(1.75rem, 1.5vw + 1.25rem, var(--fs-4xl)); margin-block: var(--space-5) var(--space-3); }
h3 { font-size: clamp(1.5rem, 1vw + 1rem, var(--fs-3xl)); margin-block: var(--space-4) var(--space-2); }
h4 { font-size: var(--fs-xl); margin-block: var(--space-3) var(--space-2); }
h5 { font-size: var(--fs-lg); margin-block: var(--space-3) var(--space-2); }
h6 { font-size: var(--fs-md); margin-block: var(--space-2) var(--space-1); }

p { margin-block: 0 var(--space-3); }

/* Links */
a { color: var(--color-primary); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: 4px; }

/* Media figure spacing */
figure { margin: 0; }

/* Selection color with accessible contrast */
::selection { background: rgba(46, 107, 255, 0.2); color: inherit; }


/* =========================================================
   Utilities
   ========================================================= */
.container {
  width: min(100% - var(--space-8), 1200px);
  margin-inline: auto;
}

.section {
  padding-block: var(--space-12);
}

/* Layout helpers */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

.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; }
.justify-end { justify-content: flex-end; }

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.auto-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* Flow utility: apply vertical rhythm to children */
.flow > * + * { margin-top: var(--space-4); }

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


/* =========================================================
   Components
   ========================================================= */
/* Buttons */
.btn {
  --_bg: var(--gray-900);
  --_text: #ffffff;
  --_shadow: var(--shadow-sm);
  --_shadow-hover: var(--shadow-md);
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  padding: 0.7em 1.1em;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--_bg);
  color: var(--_text);
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: var(--_shadow);
  transition: transform var(--duration-fast) var(--ease-spring), box-shadow var(--duration-fast) var(--ease-spring), background-color var(--duration-normal) linear, color var(--duration-normal) linear;
}
.btn:hover { transform: translateY(-1px) scale(1.01); box-shadow: var(--_shadow-hover); }
.btn:active { transform: translateY(0) scale(0.99); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

.btn-primary { --_bg: var(--color-primary); --_text: var(--on-primary); box-shadow: var(--shadow-sm), 0 0 0 0 rgba(0,0,0,0); }
.btn-primary:hover { box-shadow: var(--shadow-glow-primary); }

.btn-success { --_bg: var(--color-success); --_text: var(--on-success); }
.btn-warning { --_bg: var(--color-warning); --_text: var(--on-warning); }
.btn-danger  { --_bg: var(--color-danger);  --_text: var(--on-danger); }

.btn-ghost {
  --_bg: transparent;
  --_text: var(--color-text);
  border: 1px solid var(--gray-300);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--gray-100); }

/* Inputs */
:where(input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="tel"], input[type="url"], input[type="number"], select, textarea) {
  display: block;
  width: 100%;
  padding: 0.65em 0.8em;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  caret-color: var(--color-primary);
  transition: border-color var(--duration-fast) linear, box-shadow var(--duration-fast) var(--ease-spring), background-color var(--duration-fast) linear;
}

:where(input, select, textarea)::placeholder { color: var(--gray-500); opacity: 1; }

:where(input, select, textarea):hover { border-color: var(--gray-400); }

:where(input, select, textarea):focus-visible {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--focus-ring), var(--shadow-sm);
}

:where(input, select, textarea):disabled { background: var(--gray-100); color: var(--gray-600); cursor: not-allowed; }

/* Cards */
.card {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid color-mix(in oklab, var(--gray-300) 60%, transparent);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
}
.card:hover { box-shadow: var(--shadow-lg); transition: box-shadow var(--duration-normal) var(--ease-spring); }

.card-header { margin-bottom: var(--space-4); }
.card-actions { display: flex; gap: var(--space-3); margin-top: var(--space-4); }


/* =========================================================
   Accessibility
   ========================================================= */
:where(button, [href], input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 6px;
}

/* High-contrast link focus for keyboard users */
a:focus-visible { text-decoration: underline; text-decoration-thickness: 2px; }

/* Respect reduced motion already handled in reset section */

/* Media responsiveness helpers for immersive imagery */
.media-cover { width: 100%; height: 100%; object-fit: cover; }

/* Playful accent underline utility for headings */
.accent-underline {
  position: relative;
  display: inline-block;
}
.accent-underline::after {
  content: "";
  position: absolute; left: 0; bottom: -6px;
  width: 100%; height: 6px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent), var(--color-warning));
  opacity: 0.9;
}

/* Subtle animated hover lift utility (respects reduced motion) */
.lift {
  transition: transform var(--duration-normal) var(--ease-spring), box-shadow var(--duration-normal) var(--ease-spring);
}
.lift:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
@media (prefers-reduced-motion: reduce) { .lift, .lift:hover { transform: none !important; } }

/* End of base.css */
