/* =========================================================
   Variables
   ========================================================= */
:root {
  /* Colors */
  --color-bg: #f9fafb;
  --color-text: #23272f;
  --color-primary: #0264dc;
  --color-primary-hover: #024ea7;
  --color-success: #22c55e;
  --color-warning: #eab308;
  --color-danger: #ef4444;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;

  /* Typography */
  --font-sans: 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Fira Mono', 'Consolas', 'Courier New', monospace;
  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-loose: 1.8;

  /* Spacing scale */
  --space-0: 0px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-14: 56px;
  --space-16: 64px;
  --space-24: 96px;

  /* Misc */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px 0 rgba(40, 54, 86, 0.06);
  --shadow: 0 2px 8px 0 rgba(40, 54, 86, 0.09);
  --shadow-lg: 0 4px 16px 0 rgba(40, 54, 86, 0.15);
  --transition-xs: 80ms cubic-bezier(.4,0,.2,1);
  --transition: 180ms cubic-bezier(.4,0,.2,1);
  --transition-lg: 350ms cubic-bezier(.4,0,.2,1);
}

/* =========================================================
   Reset & Normalize
   ========================================================= */
*, *::before, *::after {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}
body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol, pre {
  margin: 0;
  padding: 0;
}
ul, ol {
  list-style: none;
}
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}
input, button, textarea, select {
  font: inherit;
  background: none;
  border: none;
  outline: none;
}
button {
  background: none;
  color: inherit;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
[tabindex="-1"]:focus {
  outline: none !important;
}

/* =========================================================
   Base
   ========================================================= */
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: var(--line-height-normal);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  color: var(--color-text);
  font-weight: 700;
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-2);
}
h1 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-4);
}
h2 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-3);
}
h3 {
  font-size: var(--text-xl);
}
h4 {
  font-size: var(--text-lg);
}
h5, h6 {
  font-size: var(--text-base);
}
p {
  margin-bottom: var(--space-4);
  line-height: var(--line-height-loose);
}
a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition);
}
a:hover, a:focus-visible {
  color: var(--color-primary-hover);
  outline: none;
}
a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* =========================================================
   Utilities
   ========================================================= */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.flex-row {
  flex-direction: row;
}
.justify-center {
  justify-content: center;
}
.items-center {
  align-items: center;
}
.gap-4 {
  gap: var(--space-4);
}
.grid {
  display: grid;
}
.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}
.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}
.gap-8 {
  gap: var(--space-8);
}
.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;
}

/* =========================================================
   Components
   ========================================================= */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-5);
  font-weight: 600;
  font-size: var(--text-base);
  line-height: 1.2;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
  border: none;
  outline: none;
  text-decoration: none;
}
.button:hover, .button:focus-visible {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow);
}
.button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.button:disabled, .button[aria-disabled="true"] {
  opacity: 0.6;
  pointer-events: none;
}

.input, select, textarea {
  width: 100%;
  padding: var(--space-2) var(--space-4);
  background: #fff;
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
}
.input:focus, select:focus, textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(2, 100, 220, 0.15);
  outline: none;
}
.input:disabled, select:disabled, textarea:disabled {
  background: var(--color-gray-100);
  color: var(--color-gray-400);
  cursor: not-allowed;
}

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-6);
  transition: box-shadow var(--transition);
}
.card:hover, .card:focus-within {
  box-shadow: var(--shadow-lg);
}

/* =========================================================
   Header & Footer styles
   ========================================================= */

/* Header & Navigation */
.main-header {
  background: #fff;
  border-bottom: 1px solid var(--color-gray-200);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  height: 72px;
  justify-content: space-between;
  align-items: center;
}
.site-logo {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  margin-right: var(--space-2);
}
.main-nav ul {
  align-items: center;
}
.main-nav a {
  font-weight: 600;
  color: var(--color-gray-800);
  text-decoration: none;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.main-nav a:hover, .main-nav a:focus-visible {
  background: var(--color-primary);
  color: #fff;
  text-decoration: none;
}

.desktop-nav { display: block; }
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: var(--space-4);
}
.menu-bar {
  width: 24px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 2px;
  display: block;
}
/* Mobile nav off-canvas */
.mobile-nav {
  display: none;
  position: absolute;
  top: 72px;
  left: 0;
  width: 100vw;
  background: #fff;
  border-bottom: 1px solid var(--color-gray-200);
  box-shadow: var(--shadow-sm);
  z-index: 100;
  padding-bottom: var(--space-8);
}
.mobile-nav[hidden] { display:none; }
.mobile-nav ul { flex-direction: column; gap: var(--space-4); margin-top: var(--space-4); }

/* Footer */
.main-footer {
  background: var(--color-gray-800);
  color: #fff;
  padding: var(--space-8) 0 0 0;
  position: relative;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-8);
  padding-bottom: var(--space-6);
}
.footer-brand .site-logo {
  color: #fff;
  font-size: var(--text-lg);
  margin: 0;
  text-decoration: none;
}
.footer-nav ul,
.footer-legal ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.footer-links a,
.footer-legal-links a {
  color: #fff;
  opacity: 0.8;
  font-size: var(--text-sm);
  transition: opacity var(--transition), text-decoration var(--transition);
}
.footer-links a:hover,
.footer-legal-links a:hover {
  opacity: 1;
  text-decoration: underline;
}
.footer-bottom {
  background: var(--color-gray-900, #171b22);
  color: var(--color-gray-400);
  text-align: center;
  font-size: var(--text-xs);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--color-gray-700);
}

/* Cookie consent banner */
.cookie-consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--color-gray-200);
  box-shadow: var(--shadow);
  z-index: 200;
  padding: var(--space-4) 0;
  transition: transform var(--transition);
}
.cookie-consent[hidden] { display:none!important; }
.cookie-consent-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 var(--space-4);
}
.cookie-consent-inner span {
  font-size: var(--text-sm);
  color: var(--color-gray-800);
}
.cookie-consent-actions {
  display: flex;
  gap: var(--space-3);
}
.button-secondary {
  background: var(--color-gray-200);
  color: var(--color-text);
}
.button-secondary:hover,
.button-secondary:focus-visible {
  background: var(--color-gray-300);
  color: var(--color-text);
}

/* Responsive styles for header and footer */
@media (max-width: 768px) {
  .main-header {
    position: relative;
  }
  .desktop-nav { display: none; }
  .mobile-menu-toggle {
    display: flex;
  }
  .mobile-nav {
    display: block;
  }
}
@media (max-width: 520px) {
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-6);
  }
  .cookie-consent-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
}

/* =========================================================
   Accessibility & Motion
   ========================================================= */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    transition: none !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 768px) {
  .container {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }
  .card {
    padding: var(--space-4);
  }
  h1 {
    font-size: var(--text-2xl);
  }
  h2 {
    font-size: var(--text-xl);
  }
  h3 {
    font-size: var(--text-lg);
  }
}
