/* AloneFinder - Culinary Editorial Blog */
/* Editorial Magazine Aesthetic with Warm, Inviting Palette */

:root {
  /* Color Palette - Warm & Earthy */
  --primary: #D84A1B;
  --primary-dark: #B23E16;
  --secondary: #F4A460;
  --accent: #8B4513;
  --background: #FFFDF7;
  --surface: #FFF9F0;
  --text-primary: #2C1810;
  --text-secondary: #6B4423;
  --text-muted: #9C7456;
  --border: #E8D5C4;
  --shadow: rgba(216, 74, 27, 0.1);
  
  /* Typography */
  --font-display: 'Playfair Display', serif;
  --font-body: 'Lora', serif;
  --font-accent: 'Cormorant Garamond', serif;
  --font-ui: 'Inter', sans-serif;
  
  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 6rem;
  
  /* Transitions */
  --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.2s ease;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--background);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Performance optimizations */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
}

h2 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: -0.01em;
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
}

h4 {
  font-size: 1.5rem;
}

p {
  font-size: 1.125rem;
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-fast);
}

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

/* Header */
.header {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.header.scroll-down {
  transform: translateY(-100%);
}

.header.scroll-up {
  box-shadow: 0 8px 30px var(--shadow);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-accent);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  position: relative;
}

.logo::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 60%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), transparent);
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: var(--space-md);
  align-items: center;
}

.nav-menu a {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: var(--transition-fast);
}

.nav-menu a:hover {
  background: var(--primary);
  color: white;
}

.nav-menu a.active {
  background: var(--primary);
  color: white;
}

/* Hero Section */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--surface) 0%, var(--background) 100%);
  overflow: hidden;
  padding: var(--space-xl) var(--space-md);
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(216, 74, 27, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(244, 164, 96, 0.05) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content {
  max-width: 900px;
  text-align: center;
  position: relative;
  z-index: 1;
  animation: fadeInUp 1s ease-out;
}

.hero h1 {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-md);
}

.hero p {
  font-size: 1.5rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: var(--space-md);
}

.hero-cta {
  display: inline-block;
  padding: 1rem 2.5rem;
  background: var(--primary);
  color: white;
  font-family: var(--font-ui);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 50px;
  box-shadow: 0 10px 30px var(--shadow);
  transition: var(--transition);
}

.hero-cta:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
  box-shadow: 0 15px 40px var(--shadow);
  color: white;
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}

.section-title {
  text-align: center;
  margin-bottom: var(--space-lg);
  position: relative;
}

.section-title::after {
  content: '';
  display: block;
  width: 100px;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  margin: var(--space-sm) auto 0;
}

/* Recipe Grid */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.recipe-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.recipe-card:hover {
  transform: translateY(-10px) translateZ(0);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.recipe-image {
  width: 100%;
  height: 300px;
  object-fit: cover;
  transition: var(--transition);
  will-change: transform;
}

.recipe-card:hover .recipe-image {
  transform: scale(1.05);
}

.recipe-content {
  padding: var(--space-md);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.recipe-category {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--primary);
  margin-bottom: var(--space-xs);
}

.recipe-title {
  font-size: 1.75rem;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.recipe-excerpt {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  flex: 1;
}

.recipe-meta {
  display: flex;
  gap: var(--space-md);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text-muted);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
}

.recipe-meta span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Featured Recipe */
.featured-recipe {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  margin: var(--space-xl) 0;
  padding: var(--space-lg);
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

.featured-image {
  width: 100%;
  height: 500px;
  object-fit: cover;
  border-radius: 12px;
}

.featured-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.featured-tag {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: white;
  background: var(--primary);
  padding: 0.5rem 1rem;
  display: inline-block;
  width: fit-content;
  margin-bottom: var(--space-sm);
  border-radius: 20px;
}

/* Category Tags */
.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
  margin: var(--space-lg) 0;
}

.category-tag {
  font-family: var(--font-ui);
  padding: 0.75rem 1.5rem;
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 50px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: 0.1em;
  transition: var(--transition-fast);
}

.category-tag:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
}

/* Footer */
.footer {
  background: var(--text-primary);
  color: var(--background);
  padding: var(--space-lg) var(--space-md);
  margin-top: var(--space-xl);
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
}

.footer-section h3 {
  color: var(--secondary);
  margin-bottom: var(--space-sm);
  font-size: 1.25rem;
}

.footer-section p,
.footer-section a {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
  display: block;
  margin-bottom: 0.5rem;
}

.footer-section a:hover {
  color: var(--secondary);
}

.footer-bottom {
  max-width: 1400px;
  margin: var(--space-md) auto 0;
  padding-top: var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
}

.social-links {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.social-link {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transition: var(--transition-fast);
}

.social-link:hover {
  background: var(--primary);
  transform: translateY(-3px);
}

/* Recipe Page Specific */
.recipe-header {
  max-width: 900px;
  margin: var(--space-lg) auto;
  text-align: center;
}

.recipe-hero-image {
  width: 100%;
  max-width: 1200px;
  height: 600px;
  object-fit: cover;
  border-radius: 20px;
  margin: var(--space-lg) auto;
  display: block;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.recipe-body {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-lg);
}

.recipe-sidebar {
  background: white;
  padding: var(--space-md);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  height: fit-content;
  position: sticky;
  top: 100px;
}

.recipe-sidebar h3 {
  font-size: 1.25rem;
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--border);
}

.ingredient-list,
.equipment-list {
  list-style: none;
  margin-bottom: var(--space-md);
}

.ingredient-list li,
.equipment-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 1rem;
}

.ingredient-list li:last-child,
.equipment-list li:last-child {
  border-bottom: none;
}

.recipe-instructions {
  background: white;
  padding: var(--space-md);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.recipe-instructions h3 {
  font-size: 1.5rem;
  margin-bottom: var(--space-md);
}

.instruction-step {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.instruction-step:last-child {
  border-bottom: none;
}

.step-number {
  display: inline-block;
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 40px;
  font-weight: bold;
  margin-right: var(--space-sm);
  font-family: var(--font-ui);
}

/* Breadcrumbs */
.breadcrumbs {
  max-width: 1400px;
  margin: var(--space-sm) auto;
  padding: 0 var(--space-md);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.breadcrumbs a {
  color: var(--primary);
}

.breadcrumbs span {
  margin: 0 0.5rem;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Responsive */
@media (max-width: 968px) {
  .nav-menu {
    gap: var(--space-sm);
  }
  
  .featured-recipe {
    grid-template-columns: 1fr;
  }
  
  .recipe-body {
    grid-template-columns: 1fr;
  }
  
  .recipe-sidebar {
    position: static;
  }
}

@media (max-width: 640px) {
  .recipe-grid {
    grid-template-columns: 1fr;
  }
  
  .nav-menu {
    flex-direction: column;
    gap: var(--space-xs);
  }
}

/* SEO & 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;
}

/* Print Styles */
@media print {
  .header, .footer, .nav-menu, .hero-cta, .category-tags {
    display: none;
  }
  
  body {
    background: white;
  }
  
  .recipe-card, .recipe-instructions, .recipe-sidebar {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* Additional Performance & Visual Enhancements */

/* Smooth reveal on scroll */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Enhanced focus states for accessibility */
a:focus,
button:focus,
input:focus,
textarea:focus {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* Skip to main content link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 10000;
}

.skip-link:focus {
  top: 0;
}

/* Print optimizations */
@media print {
  .header, 
  .footer, 
  .nav-menu, 
  .hero-cta, 
  .category-tags,
  .social-links {
    display: none;
  }
  
  body {
    background: white;
    color: black;
    font-size: 12pt;
  }
  
  .recipe-card, 
  .recipe-instructions, 
  .recipe-sidebar {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
  
  h1, h2, h3 {
    page-break-after: avoid;
  }
  
  img {
    max-width: 100%;
    page-break-inside: avoid;
  }
}

/* Dark mode support (respects user preference) */
@media (prefers-color-scheme: dark) {
  :root {
    --background: #1a1410;
    --surface: #2C1810;
    --text-primary: #FFF9F0;
    --text-secondary: #E8D5C4;
    --text-muted: #9C7456;
    --border: #6B4423;
  }
  
  .recipe-card,
  .recipe-sidebar,
  .recipe-instructions,
  .footer-section {
    background: var(--surface);
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --primary: #FF5722;
    --border: #000;
  }
  
  .recipe-card,
  .header {
    border: 2px solid var(--border);
  }
}

/* Loading states */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 3px solid var(--primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Image lazy load fade */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Utility classes */
.text-center {
  text-align: center;
}

.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }

.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }

/* Improved mobile menu (future enhancement) */
@media (max-width: 768px) {
  .nav-menu {
    flex-direction: column;
    gap: var(--space-xs);
    align-items: flex-start;
  }
  
  .nav-container {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .recipe-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .hero {
    min-height: 50vh;
    padding: var(--space-lg) var(--space-sm);
  }
  
  .featured-recipe {
    grid-template-columns: 1fr;
    padding: var(--space-md);
  }
  
  .recipe-body {
    grid-template-columns: 1fr;
  }
}

/* Tablet optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
  .recipe-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .container {
    padding: var(--space-md) var(--space-md);
  }
}

/* Extra large screens */
@media (min-width: 1920px) {
  .container {
    max-width: 1600px;
  }
  
  .recipe-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Fonts loaded optimization */
.fonts-loaded body {
  font-family: var(--font-body);
}

.fonts-loaded h1,
.fonts-loaded h2,
.fonts-loaded h3 {
  font-family: var(--font-display);
}

/* Connection speed adaptations */
@media (prefers-reduced-data: reduce) {
  .hero::before {
    display: none;
  }
  
  .recipe-card:hover .recipe-image {
    transform: none;
  }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: 100vh;
  }
}
