/* ============================================
   LA HUERTA VERDE — STYLESHEET (Mobile-first)
   ============================================ */

:root {
  --green-dark:   #1b4332;
  --green-mid:    #2d6a4f;
  --green-light:  #52b788;
  --green-pale:   #d8f3dc;
  --orange:       #f77f00;
  --orange-light: #fcbf49;
  --yellow:       #ffd166;
  --red-offer:    #e63946;
  --white:        #ffffff;
  --off-white:    #f9f7f3;
  --gray-100:     #f1f5f0;
  --gray-200:     #e2e8df;
  --gray-400:     #94a390;
  --gray-700:     #3d5144;
  --text:         #1e2d24;
  --shadow-sm:    0 2px 8px rgba(0,0,0,.07);
  --shadow-md:    0 6px 24px rgba(0,0,0,.11);
  --shadow-lg:    0 16px 48px rgba(0,0,0,.14);
  --radius:       16px;
  --radius-sm:    10px;
  --transition:   .25s cubic-bezier(.4,0,.2,1);

  /* Safe areas para iPhone (notch / Dynamic Island / home bar) */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);
}

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

html {
  scroll-behavior: smooth;
  /* Evita el zoom al hacer tap en iOS */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--off-white);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  /* Scroll suave en iOS */
  -webkit-overflow-scrolling: touch;
}

img { display: block; max-width: 100%; }
a  { text-decoration: none; color: inherit; }

/* Elimina el flash azul al tocar en Android/iOS */
a, button, [role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Scrollbar (solo desktop) */
@media (hover: hover) {
  ::-webkit-scrollbar { width: 6px; }
  ::-webkit-scrollbar-track { background: var(--gray-100); }
  ::-webkit-scrollbar-thumb { background: var(--green-light); border-radius: 3px; }
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
  position: sticky;
  top: 0;
  /* Respeta el notch de iPhone en landscape */
  top: var(--safe-top);
  z-index: 100;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--gray-200);
  transition: box-shadow var(--transition);
}
.navbar.scrolled { box-shadow: var(--shadow-md); }

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  /* Padding lateral + safe area para iPhone en landscape */
  padding: 0 calc(1rem + var(--safe-left)) 0 calc(1rem + var(--safe-right));
  height: 60px;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--green-dark);
  white-space: nowrap;
}
.logo-icon { font-size: 1.35rem; }

.nav-links { display: none; }

/* Botón hamburguesa — siempre visible en móvil */
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .6rem;
  margin-left: auto;
  /* Target táctil mínimo 44px */
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--green-dark);
  border-radius: 2px;
  transition: var(--transition);
}
/* Animación X al abrir */
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-mobile {
  display: none;
  flex-direction: column;
  gap: .2rem;
  padding: .75rem 1rem calc(.75rem + var(--safe-bottom));
  border-top: 1px solid var(--gray-200);
  background: white;
}
.nav-mobile.open { display: flex; }
.nav-mobile .nav-link {
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1rem;
  color: var(--gray-700);
  min-height: 48px;
  display: flex;
  align-items: center;
}
.nav-mobile .nav-link:active { background: var(--green-pale); }
.nav-mobile .nav-admin-btn {
  text-align: center;
  margin-top: .4rem;
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--green-mid);
  color: white !important;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}

/* ============================================
   HERO — mobile first
   ============================================ */
.hero {
  position: relative;
  /* svh = small viewport height (no cuenta las barras del browser en móvil) */
  min-height: 85svh;
  min-height: 85vh; /* fallback */
  background: linear-gradient(150deg, var(--green-dark) 0%, var(--green-mid) 55%, #40916c 100%);
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 4rem 1.25rem 3rem;
  padding-bottom: calc(3rem + var(--safe-bottom));
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  color: var(--yellow);
  font-weight: 700;
  font-size: .8rem;
  padding: .4rem .9rem;
  border-radius: 50px;
  margin-bottom: 1.25rem;
  letter-spacing: .02em;
}

.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.9rem, 8vw, 3.8rem);
  color: var(--white);
  line-height: 1.15;
  margin-bottom: 1rem;
}
.hero-highlight {
  color: var(--orange-light);
  font-style: italic;
}

.hero-subtitle {
  color: rgba(255,255,255,.82);
  font-size: clamp(.9rem, 3.5vw, 1.05rem);
  max-width: 520px;
  margin: 0 auto 2rem;
}

.hero-buttons {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .85rem 1.75rem;
  border-radius: 50px;
  font-weight: 700;
  font-size: .95rem;
  font-family: 'Nunito', sans-serif;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  cursor: pointer;
  border: none;
  min-height: 48px; /* target táctil */
  width: 100%;
  max-width: 280px;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--orange);
  color: var(--white);
  box-shadow: 0 4px 20px rgba(247,127,0,.4);
}
.btn-primary:active { background: #e06e00; }

.btn-secondary {
  background: rgba(255,255,255,.15);
  color: var(--white);
  border: 2px solid rgba(255,255,255,.35);
}
.btn-secondary:active { background: rgba(255,255,255,.25); }

/* Emojis flotantes — reducidos en móvil */
.hero-emojis { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.float-emoji {
  position: absolute;
  font-size: 1.4rem;
  animation: floatBob 6s ease-in-out infinite;
  opacity: .45;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.2));
}
.e1 { top:8%;  left:4%;   animation-delay:0s; }
.e2 { top:15%; right:5%;  animation-delay:.8s; }
.e3 { top:50%; left:2%;   animation-delay:1.6s; }
.e4 { top:60%; right:4%;  animation-delay:2.4s; }
.e5 { top:28%; left:1%;   animation-delay:3.2s; }
.e6 { top:78%; left:8%;   animation-delay:.4s; }
.e7 { top:38%; right:2%;  animation-delay:1.2s; }
.e8 { top:82%; right:10%; animation-delay:2s; }

@keyframes floatBob {
  0%,100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-14px) rotate(3deg); }
}

/* ============================================
   WEEK BANNER
   ============================================ */
.week-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  background: var(--green-dark);
  color: var(--white);
  padding: .85rem 1rem;
  font-weight: 700;
  font-size: .82rem;
  text-align: center;
  flex-wrap: wrap;
  line-height: 1.4;
}
.week-icon { font-size: 1rem; flex-shrink: 0; }
.week-tag {
  background: var(--orange);
  color: var(--white);
  font-size: .7rem;
  font-weight: 800;
  padding: .18rem .6rem;
  border-radius: 50px;
  letter-spacing: .04em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ============================================
   SECTIONS
   ============================================ */
.section { padding: 3rem 1rem; }
.section-alt { background: var(--gray-100); }

.section-header {
  text-align: center;
  margin-bottom: 2rem;
}

.section-badge {
  display: inline-block;
  padding: .3rem .8rem;
  border-radius: 50px;
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .04em;
  margin-bottom: .85rem;
}
.fruits-badge { background: #fff0d6; color: #a85e00; }
.vegs-badge   { background: var(--green-pale); color: var(--green-dark); }
.offer-badge  { background: #fde2e4; color: #a00010; }

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.5rem, 5vw, 2.4rem);
  color: var(--green-dark);
  margin-bottom: .6rem;
  text-align: center;
}

.section-subtitle {
  color: var(--gray-400);
  font-size: .9rem;
  max-width: 500px;
  margin: 0 auto;
}

/* ============================================
   PRODUCTS GRID
   ============================================ */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .85rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* ---- PRODUCT CARD ---- */
.product-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
  /* Feedback táctil */
  transition: transform var(--transition), box-shadow var(--transition);
  -webkit-user-select: none;
  user-select: none;
}
.product-card:active {
  transform: scale(.97);
  box-shadow: none;
}

.card-img-wrap {
  position: relative;
  height: 140px;
  overflow: hidden;
  background: var(--gray-100);
}
.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}

.card-emoji-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  background: linear-gradient(135deg, var(--green-pale), #c7f0d3);
}

.card-tag {
  position: absolute;
  top: .6rem;
  left: .6rem;
  background: var(--white);
  color: var(--green-dark);
  font-size: .65rem;
  font-weight: 800;
  padding: .2rem .55rem;
  border-radius: 50px;
  box-shadow: var(--shadow-sm);
  letter-spacing: .03em;
  text-transform: uppercase;
}
.card-tag.offer { background: var(--red-offer); color: white; }

.card-body {
  padding: .85rem .9rem 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-name {
  font-size: .95rem;
  font-weight: 800;
  color: var(--green-dark);
  margin-bottom: .25rem;
  line-height: 1.3;
}

.card-desc {
  font-size: .78rem;
  color: var(--gray-400);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--gray-200);
}

.card-price {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--green-mid);
  line-height: 1;
}
.card-price .price-old {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  color: var(--gray-400);
  text-decoration: line-through;
  margin-bottom: 2px;
}
.card-unit {
  font-size: .7rem;
  color: var(--gray-400);
  font-weight: 600;
  align-self: flex-end;
  margin-bottom: .15rem;
}

/* ---- SKELETON ---- */
.skeleton-card {
  height: 280px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-msg {
  text-align: center;
  color: var(--gray-400);
  padding: 2rem;
  font-size: .95rem;
  grid-column: 1 / -1;
}

/* ============================================
   ABOUT SECTION
   ============================================ */
.about-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.about-text .section-badge { margin-bottom: .85rem; display: inline-block; }
.about-text p {
  color: var(--gray-700);
  margin-bottom: .9rem;
  font-size: .95rem;
}
.about-text .section-title { text-align: left; }

.about-features {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}
.feature {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
}
.feature-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  background: var(--green-pale);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.feature strong { display: block; font-weight: 800; color: var(--green-dark); margin-bottom: .15rem; }
.feature p { color: var(--gray-400); font-size: .83rem; margin: 0; }

.about-image { display: none; } /* Oculto en móvil */

/* ============================================
   FOOTER
   ============================================ */
.footer {
  background: var(--green-dark);
  color: rgba(255,255,255,.7);
  padding: 2rem 1rem;
  /* Safe area home bar iPhone */
  padding-bottom: calc(2rem + var(--safe-bottom));
  text-align: center;
}
.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .65rem;
}
.footer .nav-logo, .footer .logo-text { color: white; }
.footer-copy { font-size: .82rem; }
.footer-admin-link {
  font-size: .78rem;
  color: rgba(255,255,255,.35);
  padding: .5rem; /* target táctil */
}
.footer-admin-link:active { color: var(--yellow); }

/* ============================================
   MODAL — bottom sheet en móvil
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex;
  align-items: flex-end; /* ← bottom sheet */
  justify-content: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-card {
  background: white;
  border-radius: var(--radius) var(--radius) 0 0; /* solo arriba */
  width: 100%;
  max-width: 100%;
  max-height: 90svh;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-lg);
  position: relative;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  /* Safe area home bar */
  padding-bottom: var(--safe-bottom);
}
.modal-overlay.open .modal-card { transform: translateY(0); }

/* Handle visual (barra arriba del modal) */
.modal-card::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  margin: .75rem auto 0;
}

.modal-close {
  position: absolute;
  top: .75rem;
  right: .85rem;
  z-index: 10;
  background: var(--gray-100);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: .9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-700);
}
.modal-close:active { background: var(--gray-200); }

.modal-img-wrap {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: var(--gray-100);
  margin-top: .25rem;
}
.modal-img-wrap img { width: 100%; height: 100%; object-fit: cover; }

.modal-badge {
  position: absolute;
  top: .85rem;
  left: .85rem;
  background: white;
  color: var(--green-dark);
  font-size: .7rem;
  font-weight: 800;
  padding: .22rem .6rem;
  border-radius: 50px;
  box-shadow: var(--shadow-sm);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.modal-body { padding: 1.25rem 1.25rem 1.5rem; }
.modal-title { font-size: 1.35rem; font-weight: 900; color: var(--green-dark); margin-bottom: .4rem; }
.modal-desc  { color: var(--gray-700); font-size: .92rem; line-height: 1.65; margin-bottom: 1.1rem; }

.modal-price-row { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .85rem; }
.modal-price { font-size: 1.8rem; font-weight: 900; color: var(--green-mid); }
.modal-unit  { font-size: .83rem; color: var(--gray-400); font-weight: 600; }

.modal-tags { display: flex; flex-wrap: wrap; gap: .45rem; }
.modal-tag {
  background: var(--green-pale);
  color: var(--green-dark);
  font-size: .76rem;
  font-weight: 700;
  padding: .22rem .65rem;
  border-radius: 50px;
}

/* ============================================
   REDUCE ANIMATIONS (accesibilidad)
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================
   TABLET — 600px+
   ============================================ */
@media (min-width: 600px) {
  .nav-container { padding: 0 1.5rem; height: 64px; }
  .nav-logo { font-size: 1.2rem; }

  .hero { padding: 5rem 2rem 3.5rem; }
  .hero-buttons { flex-direction: row; justify-content: center; }
  .btn { width: auto; min-width: 160px; }

  .section { padding: 4rem 1.5rem; }
  .section-header { margin-bottom: 2.5rem; }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
  }
  .card-img-wrap { height: 175px; }
  .card-emoji-fallback { font-size: 4.5rem; }
  .card-name { font-size: 1.05rem; }
  .card-price { font-size: 1.45rem; }

  .modal-overlay { align-items: center; padding: 1.5rem; }
  .modal-card {
    max-width: 480px;
    border-radius: var(--radius);
    transform: scale(.94) translateY(10px);
    max-height: 92vh;
    padding-bottom: 0;
  }
  .modal-card::before { display: none; }
  .modal-overlay.open .modal-card { transform: scale(1) translateY(0); }
  .modal-img-wrap { height: 220px; margin-top: 0; }
}

/* ============================================
   TABLET GRANDE — 768px+
   ============================================ */
@media (min-width: 768px) {
  .nav-links {
    display: flex;
    align-items: center;
    gap: .25rem;
    margin-left: auto;
  }
  .nav-link {
    padding: .45rem .85rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: .9rem;
    color: var(--gray-700);
    transition: background var(--transition), color var(--transition);
  }
  .nav-link:hover { background: var(--green-pale); color: var(--green-dark); }

  .nav-admin-btn {
    margin-left: .5rem;
    padding: .45rem 1rem;
    border-radius: 50px;
    background: var(--green-mid);
    color: var(--white) !important;
    font-weight: 700;
    font-size: .85rem;
    min-height: auto;
    width: auto;
    max-width: none;
  }
  .nav-admin-btn:hover { background: var(--green-dark); }

  .hamburger { display: none; }
  .nav-mobile { display: none !important; }

  .float-emoji { font-size: clamp(1.8rem, 2.5vw, 2.5rem); opacity: .65; }

  .about-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
  }
  .about-image {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .about-emoji-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    font-size: 3.5rem;
    text-align: center;
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
  }
  .about-emoji-grid span {
    display: block;
    animation: floatBob 5s ease-in-out infinite;
    line-height: 1.2;
  }
  .about-emoji-grid span:nth-child(2)  { animation-delay: .5s; }
  .about-emoji-grid span:nth-child(3)  { animation-delay: 1s; }
  .about-emoji-grid span:nth-child(4)  { animation-delay: 1.5s; }
  .about-emoji-grid span:nth-child(5)  { animation-delay: 2s; }
  .about-emoji-grid span:nth-child(6)  { animation-delay: 2.5s; }
  .about-emoji-grid span:nth-child(7)  { animation-delay: 3s; }
  .about-emoji-grid span:nth-child(8)  { animation-delay: 3.5s; }
  .about-emoji-grid span:nth-child(9)  { animation-delay: 4s; }
}

/* ============================================
   DESKTOP — 1024px+
   ============================================ */
@media (min-width: 1024px) {
  .nav-container { height: 68px; }
  .hero {
    min-height: 90vh;
    padding: 6rem 2rem 4rem;
  }
  .float-emoji { font-size: clamp(1.8rem, 3vw, 2.5rem); opacity: .7; }

  .section { padding: 5rem 2rem; }
  .section-header { margin-bottom: 3rem; }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
  }
  .card-img-wrap { height: 200px; }
  .card-emoji-fallback { font-size: 5rem; }
  .card-body { padding: 1.1rem 1.25rem 1.25rem; }
  .card-name { font-size: 1.1rem; }
  .card-price { font-size: 1.55rem; }

  .product-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
  .product-card:hover .card-img-wrap img { transform: scale(1.06); }
  .product-card:active { transform: translateY(-6px); }

  .btn { width: auto; }
  .btn:hover { transform: translateY(-2px); }
  .btn-primary:hover { background: #e06e00; box-shadow: 0 6px 28px rgba(247,127,0,.5); }
  .btn-secondary:hover { background: rgba(255,255,255,.25); }

  .week-banner { font-size: .95rem; }
}
