/* 
 * main.css
 * Core styles for unhomed.info
 * Following GoFind.help design system as canonical design authority
 */

:root {
  /* Colors - standardized with GoFind.Help */
  --color-primary: #6366f1; /* Indigo */
  --color-primary-dark: #4f46e5;
  --color-primary-light: #818cf8;
  
  --color-secondary: #10b981; /* Green */
  --color-secondary-dark: #059669;
  --color-secondary-light: #34d399;
  
  /* Text colors */
  --color-text: #1f2937;
  --color-text-light: #6b7280;
  --color-text-muted: #9ca3af;
  --color-text-white: #ffffff;
  
  /* Background colors */
  --color-background: #ffffff;
  --color-background-alt: #f9fafb;
  --color-background-hover: #f3f4f6;
  --color-background-dark: #0f172a;
  
  /* Border colors */
  --color-border: #e5e7eb;
  --color-border-dark: #d1d5db;
  
  /* Neutral colors - for backward compatibility */
  --color-neutral-50: #fafafa;
  --color-neutral-100: #f5f5f5;
  --color-neutral-200: #e5e5e5;
  --color-neutral-300: #d4d4d4;
  --color-neutral-400: #a3a3a3;
  --color-neutral-500: #737373;
  --color-neutral-600: #525252;
  --color-neutral-700: #404040;
  --color-neutral-800: #262626;
  --color-neutral-900: #171717;
  --color-neutral-950: #0a0a0a;
  
  /* Status colors */
  --color-error: #dc2626;
  --color-error-bg: #fef2f2;
  --color-success: #16a34a;
  --color-success-bg: #f0fdf4;
  --color-warning: #d97706;
  --color-warning-bg: #fffbeb;
  
  /* Typography - standardized with GoFind.Help */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  --font-family-base: var(--font-family);
  --font-family-heading: var(--font-family);
  
  --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 */
  --font-size-5xl: 3rem;     /* 48px */
  
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  --line-height-loose: 1.75;
  
  /* Spacing - standardized with GoFind.Help */
  --spacing-xs: 0.25rem;  /* 4px */
  --spacing-sm: 0.5rem;   /* 8px */
  --spacing-md: 1rem;     /* 16px */
  --spacing-lg: 1.5rem;   /* 24px */
  --spacing-xl: 2rem;     /* 32px */
  --spacing-2xl: 3rem;    /* 48px */
  --spacing-3xl: 4rem;    /* 64px */
  
  /* For backward compatibility */
  --spacing-0: 0;
  --spacing-1: var(--spacing-xs);
  --spacing-2: var(--spacing-sm);
  --spacing-3: 0.75rem;
  --spacing-4: var(--spacing-md);
  --spacing-5: 1.25rem;
  --spacing-6: var(--spacing-lg);
  --spacing-8: var(--spacing-xl);
  --spacing-12: var(--spacing-2xl);
  --spacing-16: var(--spacing-3xl);
  --spacing-20: 5rem;
  --spacing-24: 6rem;
  
  /* Layout */
  --max-width: 48rem;
  --max-width-lg: 64rem;
  --header-height: 4rem;
  
  /* For backward compatibility */
  --container-padding: var(--spacing-md);
  --container-width-sm: 640px;
  --container-width-md: 768px;
  --container-width-lg: var(--max-width-lg);
  --container-width-xl: 1280px;
  
  /* Borders */
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.375rem;  /* 6px */
  --radius-lg: 0.5rem;    /* 8px */
  --radius-xl: 0.75rem;   /* 12px */
  --radius-2xl: 1rem;     /* 16px */
  --radius-full: 9999px;
  
  /* For backward compatibility */
  --border-radius-sm: var(--radius-sm);
  --border-radius-md: var(--radius-md);
  --border-radius-lg: var(--radius-lg);
  --border-radius-xl: var(--radius-2xl);
  --border-radius-full: var(--radius-full);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;
  --transition-slower: 500ms ease;
  
  /* For backward compatibility */
  --transition-base: var(--transition-normal);
  
  /* Z-index layers */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 300;
  --z-toast: 400;
  
  /* For backward compatibility */
  --z-index-dropdown: var(--z-dropdown);
  --z-index-sticky: var(--z-sticky);
  --z-index-fixed: 1030;
  --z-index-modal-backdrop: var(--z-modal);
  --z-index-modal: var(--z-modal);
  --z-index-popover: 1060;
  --z-index-tooltip: var(--z-toast);
}

/* Base styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-neutral-800);
  background-color: var(--color-neutral-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Dark mode */
/* Support both data-theme attribute and prefers-color-scheme */
:root[data-theme="dark"] {
  /* Dark mode color overrides */
  --color-text: #f1f5f9;
  --color-text-light: #94a3b8;
  --color-text-muted: #64748b;

  --color-background: #1e293b;
  --color-background-alt: #0f172a;
  --color-background-hover: #334155;

  --color-border: #334155;
  --color-border-dark: #475569;

  --color-error-bg: #450a0a;
  --color-success-bg: #052e16;
  --color-warning-bg: #451a03;

  /* Adjusted shadows for dark mode */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.3);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.4);
  
  color-scheme: dark;
}

:root[data-theme="dark"] body {
  color: var(--color-text);
  background-color: var(--color-background-dark);
}

/* Light mode override (when user explicitly chooses light) */
:root[data-theme="light"] {
  --color-text: #1f2937;
  --color-text-light: #6b7280;
  --color-text-muted: #9ca3af;

  --color-background: #ffffff;
  --color-background-alt: #f9fafb;
  --color-background-hover: #f3f4f6;

  --color-border: #e5e7eb;
  --color-border-dark: #d1d5db;

  --color-error-bg: #fef2f2;
  --color-success-bg: #f0fdf4;
  --color-warning-bg: #fffbeb;
}

:root[data-theme="light"] body {
  color: var(--color-text);
  background-color: #e2e8f0;
}

/* Auto dark mode based on system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Dark mode color overrides */
    --color-text: #f1f5f9;
    --color-text-light: #94a3b8;
    --color-text-muted: #64748b;

    --color-background: #1e293b;
    --color-background-alt: #0f172a;
    --color-background-hover: #334155;

    --color-border: #334155;
    --color-border-dark: #475569;

    --color-error-bg: #450a0a;
    --color-success-bg: #052e16;
    --color-warning-bg: #451a03;

    /* Adjusted shadows for dark mode */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.3);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.4);
    
    color-scheme: dark;
  }
  
  :root:not([data-theme="light"]) body {
    color: var(--color-text);
    background-color: var(--color-background-dark);
  }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-heading);
  font-weight: 700;
  line-height: var(--line-height-tight);
  margin-bottom: var(--spacing-4);
  color: var(--color-neutral-900);
}

:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3,
:root[data-theme="dark"] h4,
:root[data-theme="dark"] h5,
:root[data-theme="dark"] h6,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6 {
  color: black;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) h1,
  :root:not([data-theme="light"]) h2,
  :root:not([data-theme="light"]) h3,
  :root:not([data-theme="light"]) h4,
  :root:not([data-theme="light"]) h5,
  :root:not([data-theme="light"]) h6 {
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
}

h1 {
  font-size: var(--font-size-4xl);
}

h2 {
  font-size: var(--font-size-3xl);
}

h3 {
  font-size: var(--font-size-2xl);
}

h4 {
  font-size: var(--font-size-xl);
}

h5 {
  font-size: var(--font-size-lg);
}

h6 {
  font-size: var(--font-size-base);
}

p {
  margin-bottom: var(--spacing-4);
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--color-primary-dark);
}

:root[data-theme="dark"] a,
html[data-theme="dark"] a {
  color: var(--color-primary-light);
}

:root[data-theme="dark"] a:hover,
html[data-theme="dark"] a:hover {
  color: var(--color-primary);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) a {
    color: var(--color-primary-light);
  }
  
  :root:not([data-theme="light"]) a:hover {
    color: var(--color-primary);
  }
}

/* Lists */
ul, ol {
  margin-bottom: var(--spacing-4);
  padding-left: var(--spacing-6);
}

li {
  margin-bottom: var(--spacing-2);
}

/* Layout */
.container {
  width: 100%;
  max-width: var(--container-width-lg);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.container-sm {
  max-width: var(--container-width-sm);
}

.container-md {
  max-width: var(--container-width-md);
}

.container-lg {
  max-width: var(--container-width-lg);
}

.container-xl {
  max-width: var(--container-width-xl);
}

/* Header */
.site-header {
  padding: var(--spacing-4) 0;
  background-color: var(--color-neutral-50);
  border-bottom: 1px solid var(--color-neutral-200);
}

:root[data-theme="dark"] .site-header,
html[data-theme="dark"] .site-header {
  background-color: var(--color-neutral-900);
  border-bottom-color: var(--color-neutral-800);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-header {
    background-color: var(--color-neutral-900);
    border-bottom-color: var(--color-neutral-800);
  }
}

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

.site-logo {
  display: flex;
  align-items: center;
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-neutral-900);
  text-decoration: none;
}

:root[data-theme="dark"] .site-logo,
html[data-theme="dark"] .site-logo {
  color: var(--color-neutral-50);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-logo {
    color: var(--color-neutral-50);
  }
}

.site-logo img {
  height: 2rem;
  margin-right: var(--spacing-2);
}

/* Navigation */
.site-nav {
  display: flex;
  align-items: center;
}

.nav-list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  margin: 0 var(--spacing-2);
}

.nav-link {
  display: block;
  padding: var(--spacing-2);
  color: var(--color-neutral-700);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-base);
}

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

:root[data-theme="dark"] .nav-link,
html[data-theme="dark"] .nav-link {
  color: var(--color-neutral-300);
}

:root[data-theme="dark"] .nav-link:hover,
html[data-theme="dark"] .nav-link:hover {
  color: var(--color-primary-light);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav-link {
    color: var(--color-neutral-300);
  }
  
  :root:not([data-theme="light"]) .nav-link:hover {
    color: var(--color-primary-light);
  }
}

/* Hero section */
.hero {
  padding: var(--spacing-24) 0; /* Increased padding from 4rem to 6rem */
  background-image: url('/images/hero_image.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  text-align: center;
  position: relative;
  min-height: 500px; /* Set a minimum height to ensure more of the image is visible */
  display: flex;
  align-items: center;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4); /* Dark overlay for better text readability */
  z-index: 1;
}

.hero .container {
  position: relative;
  z-index: 2; /* Place content above the overlay */
}

.hero-title {
  font-size: var(--font-size-5xl);
  margin-bottom: var(--spacing-6);
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); /* Add shadow for better readability */
}

.hero-subtitle {
  font-size: var(--font-size-xl);
  font-weight: 400;
  color: white;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); /* Add shadow for better readability */
}

:root[data-theme="dark"] .hero::before,
html[data-theme="dark"] .hero::before {
  background-color: rgba(0, 0, 0, 0.6); /* Darker overlay for dark mode */
}

:root[data-theme="dark"] .hero-subtitle,
html[data-theme="dark"] .hero-subtitle {
  color: white;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero::before {
    background-color: rgba(0, 0, 0, 0.6); /* Darker overlay for dark mode */
  }
  
  :root:not([data-theme="light"]) .hero-subtitle {
    color: white;
  }
}

/* Footer */
.site-footer {
  padding: var(--spacing-8) 0;
  background-color: var(--color-neutral-100);
  border-top: 1px solid var(--color-neutral-200);
}

:root[data-theme="dark"] .site-footer,
html[data-theme="dark"] .site-footer {
  background-color: var(--color-neutral-900);
  border-top-color: var(--color-neutral-800);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-footer {
    background-color: var(--color-neutral-900);
    border-top-color: var(--color-neutral-800);
  }
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}

.footer-section {
  flex: 1;
  min-width: 250px;
  margin-bottom: var(--spacing-6);
}

.footer-logo {
  margin-bottom: var(--spacing-4);
}

.footer-logo-img {
  height: 3rem;
  max-width: 100%;
}

.footer-heading {
  font-size: var(--font-size-lg);
  margin-bottom: var(--spacing-4);
}

.footer-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-item {
  margin-bottom: var(--spacing-2);
}

.footer-link {
  color: var(--color-neutral-700);
  text-decoration: none;
  transition: color var(--transition-base);
}

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

:root[data-theme="dark"] .footer-link,
html[data-theme="dark"] .footer-link {
  color: var(--color-neutral-400);
}

:root[data-theme="dark"] .footer-link:hover,
html[data-theme="dark"] .footer-link:hover {
  color: var(--color-primary-light);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .footer-link {
    color: var(--color-neutral-400);
  }
  
  :root:not([data-theme="light"]) .footer-link:hover {
    color: var(--color-primary-light);
  }
}

.footer-bottom {
  margin-top: var(--spacing-8);
  padding-top: var(--spacing-4);
  border-top: 1px solid var(--color-neutral-200);
  text-align: center;
  color: var(--color-neutral-600);
  font-size: var(--font-size-sm);
}

:root[data-theme="dark"] .footer-bottom,
html[data-theme="dark"] .footer-bottom {
  border-top-color: var(--color-neutral-800);
  color: var(--color-neutral-500);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .footer-bottom {
    border-top-color: var(--color-neutral-800);
    color: var(--color-neutral-500);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  h1 {
    font-size: var(--font-size-3xl);
  }
  
  h2 {
    font-size: var(--font-size-2xl);
  }
  
  h3 {
    font-size: var(--font-size-xl);
  }
  
  .hero-title {
    font-size: var(--font-size-4xl);
  }
  
  .hero-subtitle {
    font-size: var(--font-size-lg);
  }
  
  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .site-nav {
    margin-top: var(--spacing-4);
    width: 100%;
  }
  
  .nav-list {
    flex-wrap: wrap;
  }
  
  .nav-item {
    margin: var(--spacing-1) var(--spacing-2);
  }
}

/* Buttons */
.button {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-lg);
  background-color: var(--color-primary);
  color: white;
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-normal), transform var(--transition-fast);
  text-align: center;
}

.button:hover {
  background-color: var(--color-primary-dark);
  color: white;
  text-decoration: none;
}

.button:active {
  transform: translateY(1px);
}

.button-secondary {
  background-color: var(--color-secondary);
}

.button-secondary:hover {
  background-color: var(--color-secondary-dark);
}

.button-outline {
  background-color: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}

.button-outline:hover {
  background-color: var(--color-primary);
  color: white;
}

.button-sm {
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: var(--font-size-sm);
}

.button-lg {
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: var(--font-size-lg);
}

/* Cards */
.card {
  background-color: var(--color-background);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

.card-header {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
}

.card-body {
  padding: var(--spacing-md);
}

.card-footer {
  padding: var(--spacing-md);
  border-top: 1px solid var(--color-border);
}

/* Accessibility */
.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;
}

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

/* Remove focus outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

@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;
  }
}