/**
 * 6ft Projects Brand Guidelines - Design System
 * Production-ready brand-compliant stylesheet
 * 
 * This file implements brand-compliant design tokens and utilities
 * following industry best practices and accessibility standards.
 */

:root {
  /* Brand Colors - Official Palette from Brand Guidelines */
  --brand-yellow: #FFC800; /* Deep Yellow - Primary brand color */
  --brand-yellow-dark: #e6b400;
  --brand-yellow-light: #ffd633;
  --brand-yellow-lighter: #ffe066;
  --brand-yellow-lightest: #ffeb99;
  
  --brand-black: #000000; /* Black */
  --brand-white: #FFFFFF; /* White */
  --brand-gray-dark: #222222; /* Extra Dark Gray */
  
  /* Brand Colors - Primary Palette (using Deep Yellow) */
  --brand-primary: #FFC800; /* Deep Yellow - Primary brand color */
  --brand-primary-dark: #e6b400;
  --brand-primary-light: #ffd633;
  --brand-primary-lighter: #ffe066;
  --brand-primary-lightest: #ffeb99;
  
  /* Brand Colors - Secondary Palette */
  --brand-secondary: #222222; /* Extra Dark Gray */
  --brand-secondary-dark: #1a1a1a;
  --brand-secondary-light: #3a3a3a;
  
  /* Neutral Colors - Based on Brand Guidelines */
  --neutral-900: #000000; /* Brand Black */
  --neutral-800: #222222; /* Extra Dark Gray */
  --neutral-700: #444444;
  --neutral-600: #666666;
  --neutral-500: #888888;
  --neutral-400: #aaaaaa;
  --neutral-300: #cccccc;
  --neutral-200: #e0e0e0;
  --neutral-100: #f0f0f0;
  --neutral-50: #f8f8f8;
  --neutral-white: #ffffff; /* Brand White */
  
  /* Semantic Colors */
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --error: #ef4444;
  --error-light: #fee2e2;
  --info: #3b82f6;
  --info-light: #dbeafe;
  
  /* Typography - Font Families (Brand Guidelines) */
  /* Primary: Clean modern sans-serif (as shown in brand guidelines) */
  --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  /* Secondary: Cerebri Sans (as specified in brand guidelines) */
  --font-secondary: 'Cerebri Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  /* Display: Use primary for headings */
  --font-display: var(--font-primary);
  /* Body: Use secondary for body text */
  --font-body: var(--font-secondary);
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
  
  /* Typography - Font Sizes */
  --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 */
  --text-6xl: 3.75rem;    /* 60px */
  
  /* Typography - Font Weights */
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;
  
  /* Typography - Line Heights */
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;
  
  /* Spacing Scale */
  --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 */
  
  /* Border Radius */
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;     /* 16px */
  --radius-2xl: 1.5rem;  /* 24px */
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-brand: 0 10px 25px -5px rgba(255, 200, 0, 0.3);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Z-Index Scale */
  --z-base: 0;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  
  /* Container Max Widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1536px;
}

/* Dark Mode Support - Applied when .dark class is on html element */
html.dark {
  --neutral-900: #ffffff; /* White text on dark */
  --neutral-800: #f0f0f0;
  --neutral-700: #e0e0e0;
  --neutral-600: #cccccc;
  --neutral-500: #aaaaaa;
  --neutral-400: #888888;
  --neutral-300: #666666;
  --neutral-200: #444444;
  --neutral-100: #222222; /* Extra Dark Gray */
  --neutral-50: #1a1a1a;
  --neutral-white: #000000; /* Black background */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  --shadow-brand: 0 10px 25px -5px rgba(255, 200, 0, 0.4);
}

/* Respect system preference on initial load */
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --neutral-900: #ffffff;
    --neutral-800: #f1f5f9;
    --neutral-700: #e2e8f0;
    --neutral-600: #cbd5e1;
    --neutral-500: #94a3b8;
    --neutral-400: #64748b;
    --neutral-300: #475569;
    --neutral-200: #334155;
    --neutral-100: #1e293b;
    --neutral-50: #0f172a;
    --neutral-white: #0f172a;
  }
}

/* Base Typography */
body {
  font-family: var(--font-body); /* Cerebri Sans (secondary font for body text) */
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--neutral-800);
  background-color: var(--neutral-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  color: var(--neutral-900);
  margin: 0;
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
  margin: 0;
  line-height: var(--leading-relaxed);
}

/* Brand-Compliant Buttons */
.btn-primary {
  background-color: var(--brand-primary);
  color: var(--neutral-white);
  font-family: var(--font-body);
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  text-decoration: none;
}

.btn-primary:hover {
  background-color: var(--brand-primary-dark);
  box-shadow: var(--shadow-brand);
  transform: translateY(-1px);
}

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

.btn-primary:disabled {
  background-color: var(--neutral-300);
  color: var(--neutral-500);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background-color: transparent;
  color: var(--brand-primary);
  font-family: var(--font-body);
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-lg);
  border: 2px solid var(--brand-primary);
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  text-decoration: none;
}

.btn-secondary:hover {
  background-color: var(--brand-primary-lightest);
  border-color: var(--brand-primary-dark);
  color: var(--brand-primary-dark);
}

.btn-secondary:active {
  background-color: var(--brand-primary-lighter);
}

/* Brand-Compliant Cards */
.card {
  background-color: var(--neutral-white);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--neutral-200);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Brand-Compliant Inputs */
.input {
  font-family: var(--font-body);
  font-size: var(--text-base);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 2px solid var(--neutral-300);
  background-color: var(--neutral-white);
  color: var(--neutral-800);
  transition: all var(--transition-base);
  width: 100%;
}

.input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-lightest);
}

.input::placeholder {
  color: var(--neutral-400);
}

/* Brand-Compliant Links */
a {
  color: var(--brand-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--brand-primary-dark);
  text-decoration: underline;
}

/* Utility Classes */
.text-brand {
  color: var(--brand-primary);
}

.bg-brand {
  background-color: var(--brand-primary);
}

.border-brand {
  border-color: var(--brand-primary);
}

.shadow-brand {
  box-shadow: var(--shadow-brand);
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus Visible for Keyboard Navigation */
*:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

/* Navigation Bar - Brand Compliant */
/* Apply to any nav, header, or navbar element - More aggressive selectors */
nav,
header,
.navbar,
.header,
[role="navigation"],
[role="banner"] {
  background-color: rgba(255, 255, 255, 1) !important; /* White background in light mode */
  border-bottom: 1px solid var(--neutral-200) !important;
  padding: var(--space-4) var(--space-6) !important;
  position: sticky !important;
  top: 0 !important;
  z-index: var(--z-sticky) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1) !important;
  transition: all var(--transition-base) !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

html.dark nav,
html.dark header,
html.dark .navbar,
html.dark .header,
html.dark [role="navigation"],
html.dark [role="banner"] {
  background-color: rgba(34, 34, 34, 0.8) !important; /* brand-dark (#222222) with 80% opacity */
  border-bottom-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3) !important;
}

.navbar-container {
  max-width: var(--container-2xl);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  height: 5rem; /* h-20 equivalent (80px) */
  padding: 0 var(--space-4);
}

@media (min-width: 640px) {
  .navbar-container {
    padding: 0 var(--space-6);
  }
}

@media (min-width: 1024px) {
  .navbar-container {
    padding: 0 var(--space-8);
  }
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--neutral-900);
  font-family: var(--font-display);
  font-weight: var(--font-bold);
  font-size: var(--text-xl);
  transition: color var(--transition-fast);
}

.navbar-brand:hover {
  color: var(--brand-primary);
}

.navbar-brand img {
  height: 2.5rem;
  width: auto;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.navbar-link {
  color: var(--neutral-700);
  text-decoration: none;
  font-family: var(--font-body);
  font-weight: var(--font-medium);
  font-size: var(--text-base);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  position: relative;
}

.navbar-link:hover {
  color: var(--brand-primary);
}

.navbar-link.active {
  color: var(--brand-primary);
  background-color: var(--brand-primary-lightest);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Theme Toggle Button - Matching Reference Design */
#theme-toggle,
.theme-toggle {
  background: transparent;
  border: none;
  border-radius: var(--radius-lg);
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  color: var(--neutral-500);
  padding: 0;
  flex-shrink: 0;
}

html.dark #theme-toggle,
html.dark .theme-toggle {
  color: var(--neutral-400);
}

#theme-toggle:hover,
.theme-toggle:hover {
  background-color: var(--neutral-100);
  color: var(--neutral-700);
}

html.dark #theme-toggle:hover,
html.dark .theme-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--neutral-200);
}

#theme-toggle svg,
.theme-toggle svg {
  width: 1.5rem;
  height: 1.5rem;
}

#theme-toggle .icon-light,
#theme-toggle .icon-dark,
.theme-toggle .icon-light,
.theme-toggle .icon-dark {
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  display: block;
}

html.dark #theme-toggle .icon-light,
html.dark .theme-toggle .icon-light {
  display: block;
}

html.dark #theme-toggle .icon-dark,
html.dark .theme-toggle .icon-dark {
  display: none;
}

html:not(.dark) #theme-toggle .icon-light,
html:not(.dark) .theme-toggle .icon-light {
  display: none;
}

html:not(.dark) #theme-toggle .icon-dark,
html:not(.dark) .theme-toggle .icon-dark {
  display: block;
}

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

/* Fixed position theme toggle container (always visible at top-right) */
#theme-toggle-container,
.theme-toggle-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile Menu Toggle */
.navbar-menu-toggle {
  display: none;
  background: transparent;
  border: 2px solid var(--neutral-300);
  border-radius: var(--radius-md);
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  color: var(--neutral-700);
  padding: 0;
}

.navbar-menu-toggle:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background-color: var(--brand-primary-lightest);
}

/* Mobile Navigation */
@media (max-width: 768px) {
  .navbar-menu-toggle {
    display: flex;
  }
  
  .navbar-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--neutral-white);
    border-bottom: 1px solid var(--neutral-200);
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-4);
    gap: var(--space-1);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-lg);
  }
  
  html.dark .navbar-nav {
    background-color: var(--neutral-50);
    border-bottom-color: var(--neutral-200);
  }
  
  .navbar-nav.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  
  .navbar-link {
    width: 100%;
    padding: var(--space-3) var(--space-4);
  }
}

/* Logo Clear Space Requirements (Brand Guidelines) */
.logo-container {
  position: relative;
  display: inline-block;
}

.logo-container::before {
  content: '';
  position: absolute;
  top: -33%;
  left: -33%;
  right: -33%;
  bottom: -33%;
  pointer-events: none;
  /* Visual guide for clear space (remove in production) */
  /* border: 1px dashed rgba(255, 200, 0, 0.3); */
}

/* Logo variations support */
.logo-yellow-bg {
  background-color: var(--brand-yellow);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.logo-black-bg {
  background-color: var(--brand-black);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.logo-white-bg {
  background-color: var(--brand-white);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--neutral-200);
}

/* Print Styles */
@media print {
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  a,
  a:visited {
    text-decoration: underline;
  }
  
  .btn-primary,
  .btn-secondary {
    border: 1px solid black;
  }
  
  .navbar {
    position: static;
    border-bottom: 1px solid black;
  }
  
  .theme-toggle,
  .navbar-menu-toggle {
    display: none;
  }
}

