/* 
 * Modern CSS for Shahremanbarkhat
 * Uses modern design tokens, responsive design, and accessibility features
 */

/* ================================
   CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ================================ */

/* Spacing System */
:root {
  --space-1: 0.25rem; /* 4px */
  --space-2: 0.5rem; /* 8px */
  --space-3: 0.75rem; /* 12px */
  --space-4: 1rem; /* 16px */
  --space-5: 1.5rem; /* 24px */
  --space-6: 2rem; /* 32px */
  --space-8: 3rem; /* 48px */
  --space-10: 4rem; /* 64px */
  --space-12: 6rem; /* 96px */
}

/* Color Palette - Modern Design Tokens */
:root {
  /* Primary Colors */
  --primary: #8e1616; /* Medium Red - Main brand color */
  --accent: #d84040; /* Bright Red - Accent color */

  /* Light Theme */
  --bg-light: #eeeeee; /* Light gray background */
  --surface-light: #ffffff; /* White surface */
  --text-light: #1d1616; /* Dark brown text for readability */
  --text-muted-light: #8e1616; /* Medium red for muted text */

  /* Dark Theme */
  --bg-dark: #1d1616; /* Dark brown background */
  --surface-dark: #2a1816; /* Slightly lighter dark surface */
  --text-dark: #eeeeee; /* Light gray text */
  --text-muted-dark: #d84040; /* Bright red for muted text in dark mode */

  /* Current theme (will be overridden by specific theme) */
  --bg: var(--bg-light);
  --surface: var(--surface-light);
  --text: var(--text-light);
  --text-muted: var(--text-muted-light);

  /* Semantic Colors */
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);

  /* Typography Scale */
  --font-heading: 'Poppins', system-ui, -apple-system, sans-serif;
  --font-body: 'Roboto', system-ui, -apple-system, sans-serif;

  --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 */

  /* 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;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 300ms ease;
  --transition-slow: 500ms ease;

  /* Z-index layers */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal: 1040;
  --z-popover: 1050;
  --z-tooltip: 1060;
}

/* Dark Theme */
[data-theme='dark'] {
  --bg: var(--bg-dark);
  --surface: var(--surface-dark);
  --text: var(--text-dark);
  --text-muted: var(--text-muted-dark);
  --border: #3a2620;
}

/* Auto theme based on system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: var(--bg-dark);
    --surface: var(--surface-dark);
    --text: var(--text-dark);
    --text-muted: var(--text-muted-dark);
    --border: #3a2620;
  }
}

/* ================================
   RESET & BASE STYLES
   ================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Improved text rendering */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ================================
   ACCESSIBILITY IMPROVEMENTS
   ================================ */

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--surface);
  color: var(--text);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  z-index: var(--z-modal);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 6px;
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles for better accessibility */
*:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ================================
   LAYOUT COMPONENTS
   ================================ */

/* Container for consistent content width */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 640px) {
  .container {
    padding: 0 var(--space-6);
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 var(--space-8);
  }
}

/* ================================
   HEADER STYLES
   ================================ */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  transition: all var(--transition-normal);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  position: relative;
  min-height: 64px;
}

/* Logo styles */
.logo {
  font-family: var(--font-heading);
  font-size: var(--font-size-xl);
  font-weight: 600;
  text-align: center;
  flex: 1;
}

.logo a {
  color: var(--text);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.logo a:hover {
  color: var(--primary);
}

/* Theme toggle button */
.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.theme-toggle-btn:hover {
  background: var(--bg);
  border-color: var(--primary);
  transform: scale(1.05);
}

.theme-toggle-btn:active {
  transform: scale(0.95);
}

.theme-toggle-btn svg {
  width: 20px;
  height: 20px;
  fill: var(--text);
  transition: fill var(--transition-fast);
}

/* ================================
   MAIN CONTENT STYLES
   ================================ */

.main-content {
  flex: 1;
  padding: var(--space-8) 0;
}

@media (min-width: 640px) {
  .main-content {
    padding: var(--space-10) 0;
  }
}

@media (min-width: 1024px) {
  .main-content {
    padding: var(--space-12) 0;
  }
}

/* Hero section */
.hero-section {
  text-align: center;
  margin-bottom: var(--space-10);
}

@media (min-width: 640px) {
  .hero-section {
    margin-bottom: var(--space-12);
  }
}

.hero-title {
  font-family: var(--font-heading);
  font-size: var(--font-size-3xl);
  font-weight: 600;
  margin-bottom: var(--space-4);
  color: var(--text);
}

@media (min-width: 640px) {
  .hero-title {
    font-size: var(--font-size-4xl);
  }
}

/* City selection grid */
.city-selection {
  display: grid;
  gap: var(--space-6);
  max-width: 800px;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .city-selection {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }
}

@media (min-width: 1024px) {
  .city-selection {
    gap: var(--space-10);
  }
}

/* City card */
.city-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all var(--transition-normal);
  cursor: pointer;
  border: 1px solid var(--border);
}

.city-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.city-card:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* City card background image */
.city-card-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

.city-background-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.city-card:hover .city-background-image {
  transform: scale(1.05);
}

/* Gradient overlay for better text readability */
.city-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(29, 22, 22, 0.9) 0%,
    rgba(29, 22, 22, 0.6) 50%,
    rgba(29, 22, 22, 0.8) 100%
  );
  z-index: 2;
}

/* City card content */
.city-card-content {
  position: relative;
  z-index: 3;
  padding: var(--space-8);
  text-align: center;
  color: white;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.city-name {
  font-family: var(--font-heading);
  font-size: var(--font-size-2xl);
  font-weight: 600;
  margin-bottom: var(--space-4);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  text-align: center;
  align-self: center;
}

.city-description {
  font-size: var(--font-size-base);
  margin-bottom: var(--space-6);
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  text-align: center;
  align-self: center;
}

/* ================================
   FOOTER STYLES
   ================================ */

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--space-6) 0;
  margin-top: auto;
}

.footer-inner {
  text-align: center;
}

.footer-inner p {
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.footer-note {
  font-size: var(--font-size-sm) !important;
  opacity: 0.8;
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */

/* Mobile styles (default) - max-width: 639px */
@media (max-width: 639px) {
  .theme-toggle-btn {
    position: static;
    order: 1;
  }

  .logo {
    order: 2;
    font-size: var(--font-size-lg);
  }

  .city-selection {
    gap: var(--space-4);
  }

  .city-card-content {
    padding: var(--space-6);
    min-height: 250px;
  }

  .hero-title {
    font-size: var(--font-size-2xl);
  }
}

/* Tablet styles - min-width: 640px */
@media (min-width: 640px) and (max-width: 1023px) {
  .city-card-content {
    padding: var(--space-10);
  }
}

/* Desktop styles - min-width: 1024px */
@media (min-width: 1024px) {
  .city-selection {
    max-width: 1000px;
  }

  .city-card {
    min-height: 400px;
  }

  .city-card-content {
    padding: var(--space-12);
  }
}

/* Large desktop styles - min-width: 1440px */
@media (min-width: 1440px) {
  .container {
    max-width: 1400px;
  }

  .city-selection {
    max-width: 1200px;
  }
}

/* ================================
   ANIMATIONS & INTERACTIONS
   ================================ */

/* Staggered animation for city cards */
.city-card {
  animation: fadeInUp 0.6s ease-out;
}

.city-card:nth-child(1) {
  animation-delay: 0.1s;
}

.city-card:nth-child(2) {
  animation-delay: 0.2s;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hover effects with smooth transitions */
.city-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================================
   UTILITY CLASSES
   ================================ */

/* Text utilities */
.text-center {
  text-align: center;
}
.text-left {
  text-align: left;
}
.text-right {
  text-align: right;
}

.text-muted {
  color: var(--text-muted);
}
.text-primary {
  color: var(--primary);
}
.text-accent {
  color: var(--accent);
}

/* Spacing utilities */
.mb-0 {
  margin-bottom: 0;
}
.mb-2 {
  margin-bottom: var(--space-2);
}
.mb-4 {
  margin-bottom: var(--space-4);
}
.mb-6 {
  margin-bottom: var(--space-6);
}
.mb-8 {
  margin-bottom: var(--space-8);
}

/* Display utilities */
.hidden {
  display: none;
}
.block {
  display: block;
}
.inline {
  display: inline;
}
.inline-block {
  display: inline-block;
}

/* ================================
   PRINT STYLES
   ================================ */

@media print {
  .theme-toggle-btn {
    display: none !important;
  }

  .site-header {
    box-shadow: none;
    border-bottom: 1px solid #000;
  }

  .city-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #000;
  }

  .city-card-background {
    display: none;
  }

  .city-card-content {
    background: white;
    color: black;
    min-height: auto;
  }
}
