/* ============================================
   CrowdSourced Cooking - Unified Styles
   One site, all devices - responsive by default
   ============================================ */

/* === VARIABLES === */
:root {
  --primary: #E76F51;
  --primary-dark: #C54B30;
  --secondary: #2A9D8F;
  --dark: #264653;
  --cream: #FEF7F4;
  --text: #333;
  --text-light: #666;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --radius: 12px;
}

/* === RESET & BASE === */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { 
  overflow-x: hidden; 
  max-width: 100vw; 
  margin: 0; 
  padding: 0; 
}

*, *::before, *::after { box-sizing: border-box; max-width: 100%; }
img { max-width: 100%; height: auto; }

body { 
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
  background: var(--cream); 
  color: var(--text); 
  line-height: 1.6; 
}

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

/* === HEADER === */
header {
  background: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
}

header a img { height: 50px; width: auto; flex-shrink: 0; }

/* === NAVIGATION === */
.nav { display: flex; gap: 0.25rem; align-items: center; }

.nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.nav a:hover { color: var(--primary); background: #fafafa; text-decoration: none; }
.nav a.active { color: var(--primary); font-weight: 600; }

/* === DROPDOWN MENU === */
.dropdown { position: relative; }

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  min-width: 160px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0.5rem 0;
  z-index: 101;
}

.dropdown:hover .dropdown-content { display: block; }

.dropdown-submenu { position: relative; }
.submenu-trigger::after { content: ' ▸'; }
.submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  background: white;
  min-width: 160px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0.5rem 0;
}
.dropdown-submenu:hover .submenu { display: block; }

.dropdown-content a {
  display: block;
  padding: 0.6rem 1rem;
  border-radius: 0;
}

.dropdown-content a:hover { background: #fafafa; text-decoration: none; }

/* === NAV === */
.nav {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
}

.nav li {
  margin: 0;
}

.nav a {
  display: block;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  white-space: nowrap;
}

.nav a:hover { color: var(--primary); }
.nav a.active { color: var(--primary); border-bottom: 2px solid var(--primary); }

/* Mobile toggle hidden by default */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text);
}

/* === HERO === */
.hero {
  background: var(--cream);
  padding: 0;
  text-align: center;
}

.hero-banner {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  display: block;
  margin: 0 auto;
}

.hero-content {
  padding: 2rem;
  text-align: center;
}

.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; color: var(--dark); }
.hero p { font-size: 1.1rem; color: var(--text-light); max-width: 600px; margin: 0 auto 2rem; }

/* === BUTTONS === */
.btn {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 0.85rem 2rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.2s, background 0.2s;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
}

.btn:hover { transform: translateY(-2px); background: var(--primary-dark); color: white; text-decoration: none; }

.btn-secondary {
  background: var(--secondary);
}
.btn-secondary:hover { background: #238B7D; }

/* === MAIN CONTENT === */
main { max-width: 1200px; margin: 0 auto; padding: 2rem 1rem; }

.section { margin-bottom: 3rem; }
.section-title { color: var(--dark); font-size: 1.4rem; margin-bottom: 1.5rem; }

/* === RECIPE GRID === */
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.5rem; }

.recipe-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.recipe-card:hover { transform: translateY(-4px); text-decoration: none; }
.recipe-card-image { width: 100%; height: 140px; object-fit: cover; }
.recipe-emoji { font-size: 3rem; text-align: center; padding: 1.5rem 1rem 0.5rem; }
.recipe-content { padding: 1rem; }
.recipe-title { font-weight: 600; color: var(--dark); margin-bottom: 0.5rem; font-size: 1.1rem; }
.recipe-desc { color: var(--text-light); font-size: 0.9rem; margin-bottom: 0.75rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recipe-meta { display: flex; gap: 1rem; color: #888; font-size: 0.85rem; }

.recipe-detail-image { width: 100%; max-height: 400px; object-fit: cover; border-radius: var(--radius); margin-bottom: 1.5rem; }
.recipe-header { margin-bottom: 2rem; }
.recipe-header h1 { color: var(--dark); margin-bottom: 0.5rem; }
.recipe-description { color: var(--text-light); font-size: 1.1rem; margin-bottom: 1rem; }

.recipe-section { background: white; border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.recipe-section h2 { color: var(--dark); font-size: 1.2rem; margin-bottom: 1rem; border-bottom: 2px solid var(--primary); padding-bottom: 0.5rem; }
.recipe-section ul, .recipe-section ol { margin-left: 1.5rem; }
.recipe-section li { margin-bottom: 0.5rem; }

/* === FEATURES === */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }

.feature-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s;
}

.feature-card:hover { transform: translateY(-4px); text-decoration: none; }
.feature-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.feature-card h3 { color: var(--dark); margin-bottom: 0.5rem; font-size: 1rem; }
.feature-card p { color: var(--text-light); font-size: 0.9rem; }

/* === FORMS === */
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: var(--dark); }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(231, 111, 81, 0.1);
}
.form-group textarea { min-height: 100px; resize: vertical; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.checkbox-group { display: flex; flex-direction: column; gap: 0.75rem; }
.checkbox-item { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-item input { width: auto; }

/* === LOADING === */
.loading { text-align: center; padding: 3rem; color: var(--text-light); }
.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* === FOOTER === */
footer { background: var(--dark); color: white; padding: 3rem 1rem; text-align: center; margin-top: 4rem; }
footer a { color: white; opacity: 0.8; }
footer a:hover { opacity: 1; text-decoration: none; }
.footer-links { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.footer-copyright { opacity: 0.7; font-size: 0.9rem; }

/* === UTILITIES === */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* === RESPONSIVE: iPad & TABLET === */
@media (max-width: 1024px) {
  /* Hide desktop nav, show hamburger */
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--cream);
    flex-direction: column;
    padding: 1rem;
    border-top: 1px solid #eee;
    z-index: 100;
    gap: 0;
  }
  
  .nav.open { display: flex; }
  
  .nav li { width: 100%; }
  
  .nav a {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
    width: 100%;
    box-sizing: border-box;
  }
  
  .nav a.active { border-bottom: 2px solid var(--primary); }
  
  .mobile-toggle { display: block; }
  
  main { padding: 1.5rem; }
  .recipe-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* === RESPONSIVE: MOBILE (iPhone) === */
@media (max-width: 768px) {
  /* Hero */
  .hero-banner { max-height: 250px; }
  .hero h1 { font-size: 1.6rem; }
  .hero p { font-size: 1rem; }
  .hero-content { padding: 1.5rem 1rem; }
  
  /* Grids */
  .recipe-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
  .features-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
  
  /* Main */
  main { padding: 1rem; }
  
  /* Recipe detail */
  .recipe-detail-image { max-height: 250px; }
  .recipe-header h1 { font-size: 1.5rem; }
  .recipe-section { padding: 1rem; }
  
  /* Forms */
  .form-row { grid-template-columns: 1fr; }
}

/* === RESPONSIVE: SMALL MOBILE === */
@media (max-width: 480px) {
  .header-inner { padding: 0.5rem 1rem; }
  header a img { height: 40px; }
  
  .recipe-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  
  .hero h1 { font-size: 1.4rem; }
  .btn { padding: 0.75rem 1.5rem; font-size: 0.95rem; }
  
  footer { padding: 2rem 1rem; }
  .footer-links { flex-direction: column; gap: 0.75rem; }
}