/*
Theme Name: PurePress
Description: Modern news theme with carousel and dark/light mode
Version: 1.0
Author: Your Name
*/

:root {
  --primary-bg: #ffffff;
  --secondary-bg: #f8f9fa;
  --text-primary: #1a1a1a;
  --text-secondary: #4a5568;
  --accent-color: #e53e3e;
  --border-color: #e2e8f0;
  --card-bg: #ffffff;
  --navbar-bg: #1a202c;
}

[data-theme="dark"] {
  --primary-bg: #1a1a1a;
  --secondary-bg: #2d3748;
  --text-primary: #f7fafc;
  --text-secondary: #cbd5e0;
  --accent-color: #fc8181;
  --border-color: #4a5568;
  --card-bg: #2d3748;
  --navbar-bg: #0d1117;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--primary-bg);
  color: var(--text-primary);
  line-height: 1.6;
  transition: all 0.3s ease;
}

/* Header */
.site-header {
  background: var(--navbar-bg);
  color: white;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
}

.search-container {
  flex: 1;
  max-width: 600px;
  margin: 0 2rem;
  position: relative;
}

.search-form {
  width: 100%;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #4a5568;
  border-radius: 25px;
  background: #2d3748;
  color: white;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.3s ease;
}

.search-input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.2);
}

.search-input::placeholder {
  color: #a0aec0;
}

.search-submit {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 36px;
  height: 36px;
  background: var(--accent-color);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.search-submit:hover {
  background: #c53030;
}

.search-submit:focus {
  outline: 2px solid white;
  outline-offset: 2px;
}

/* Theme Toggle */
.theme-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  display: flex;
  background: #404040;
  border-radius: 20px;
  padding: 4px;
  gap: 2px;
  border: none;
}

.theme-toggle legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.theme-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 14px;
  border: none;
  border-radius: 16px;
  background: transparent;
  color: #e0e0e0;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.theme-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.theme-btn:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.theme-btn.active {
  background: var(--accent-color);
  color: white;
}

/* Navigation */
.main-nav {
  background: var(--secondary-bg);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 80px;
  z-index: 999;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.category-nav {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.category-nav::-webkit-scrollbar {
  display: none;
}

.nav-item {
  min-width: 44px;
  min-height: 44px;
  padding: 12px 18px;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.3s ease;
  border-bottom: 3px solid transparent;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item:hover,
.nav-item.active,
.nav-item[aria-current="page"] {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
}

.nav-item:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Main Content */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Featured Carousel */
.featured-carousel {
  margin-bottom: 3rem;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
}

.carousel-container {
  position: relative;
  height: 400px;
  overflow: hidden;
}

.carousel-slide {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

.carousel-slide.active {
  opacity: 1;
}

.slide-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: white;
}

.slide-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.slide-meta {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Carousel Controls */
.carousel-indicators {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}

.indicator {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.indicator::after {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
}

.indicator.active::after,
.indicator[aria-current="true"]::after {
  background: white;
}

.indicator:hover {
  background: rgba(255,255,255,0.6);
}

.indicator:focus {
  outline: 2px solid white;
  outline-offset: 2px;
}

/* News Grid */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.news-card {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.news-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.card-content {
  padding: 1.5rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.4;
  color: var(--text-primary);
}

.card-title a {
  color: inherit;
  text-decoration: none;
}

.card-title a:hover {
  color: var(--accent-color);
}

.card-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.card-category {
  background: var(--accent-color);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .search-container {
    margin: 0;
    max-width: none;
  }
  
  .category-nav {
    padding: 0 1rem;
  }
  
  .nav-item {
    padding: 1rem;
  }
  
  .main-content {
    padding: 1rem;
  }
  
  .news-grid {
    grid-template-columns: 1fr;
  }
  
  .carousel-container {
    height: 250px;
  }
  
  .slide-title {
    font-size: 1.2rem;
  }
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #2d2d2d 25%, #3d3d3d 50%, #2d2d2d 75%);
  background-size: 200% 100%;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Utilities */
.visually-hidden,
.screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.visually-hidden:focus,
.screen-reader-text:focus {
  position: absolute !important;
  width: auto !important;
  height: auto !important;
  padding: 8px 16px !important;
  margin: 0 !important;
  background: var(--accent-color) !important;
  color: white !important;
  clip: auto !important;
  top: 5px !important;
  left: 5px !important;
  z-index: 999999 !important;
  border-radius: 4px !important;
}