:root {
    --cream: #f4efe6;
    --ink: #1a1a1a;
    --muted: #6b6358;
    --accent: #c8543d;
    --line: #d8cfc0;
    --card: #ffffff;

    --display: "Fraunces", Georgia, serif;
    --body: "Manrope", system-ui, sans-serif;
  }

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

  body {
    font-family: var(--body);
    background: var(--cream);
    color: var(--ink);
    line-height: 1.6;
    overflow-x: hidden;
  }

  /* Textura de grano desactivada: ambas vistas (Inicio y Catálogo) ahora usan video de fondo */
  body::before {
    display: none;
  }

  nav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 4rem;
    background: linear-gradient(180deg, rgba(0,0,0,0.35), transparent);
  }

  nav.visible {
    display: flex;
  }

  .logo {
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.25rem;
    font-style: italic;
    background: linear-gradient(90deg, #2e6b32, #75c15c, #2e6b32);
    background-size: 220% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    border: none;
    cursor: pointer;
    animation: logoShine 5s linear infinite;
  }

  @keyframes logoShine {
    0%   { background-position: 0% center; }
    100% { background-position: 220% center; }
  }

  .nav-right { display: flex; align-items: center; gap: 2rem; }

  .nav-links { display: flex; gap: 2.5rem; list-style: none; }

  .nav-links button {
    background: none;
    border: none;
    font-family: var(--body);
    color: var(--cream);
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    text-shadow: 0 1px 6px rgba(0,0,0,0.5);
    transition: color 0.3s;
  }

  .nav-links button:hover { color: var(--accent); }

  .cart-btn {
    position: relative;
    background: var(--cream);
    border: 1px solid var(--ink);
    border-radius: 4px;
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: border-color 0.3s;
  }
  .cart-btn:hover { border-color: var(--accent); }
  .cart-icon-gif { width: 34px; height: 34px; object-fit: contain; display: block; }

  /* ---------- Selector de idioma ---------- */
  .lang-switch {
    display: flex;
    gap: 3px;
    padding: 6px;
    border-radius: 10px;
  }

  /* Variante dentro del menú: fondo negro con borde verde, bien visible sobre el crema */
  .lang-switch-inline {
    background: #14201a;
    border: 1px solid #3f7a3d;
    box-shadow: 0 4px 14px rgba(20, 32, 26, 0.35);
  }
  .lang-switch-inline .lang-btn { color: #8fd47c; }
  .lang-switch-inline .lang-btn:hover { background: rgba(143, 212, 124, 0.15); color: #b6ecA4; }
  .lang-switch-inline .lang-btn.active { background: #3f7a3d; color: #f4efe6 !important; }

  /* Barra de arriba en Inicio: usuario + idioma, fija arriba a la derecha */
  .inicio-top {
    position: fixed;
    top: 26px;
    right: 26px;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }

  /* Variante flotante (solo Inicio): fija arriba a la derecha, como MARCO sobre el video */
  .lang-switch-floating {
    background: transparent;
    border: 2px solid #4f9a4d;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
    animation: langGlowVerde 4s ease-in-out infinite;
  }
  .lang-switch-floating .lang-btn {
    color: #eafbe4;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.75);
  }
  .lang-switch-floating .lang-btn:hover { background: rgba(79, 154, 77, 0.25); }
  .lang-switch-floating .lang-btn.active { background: #4f9a4d; color: #0c1a0c !important; text-shadow: none; }

  .lang-btn {
    min-width: 38px;
    padding: 7px 8px;
    border-radius: 6px;
    border: none;
    background: transparent;
    font-family: var(--body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.25s, transform 0.2s;
  }
  .lang-btn:hover { transform: translateY(-1px); }
  .lang-btn.active { background: var(--accent); color: var(--cream) !important; }

  @keyframes langGlowVerde {
    0%, 100% { box-shadow: 0 6px 18px rgba(0,0,0,0.4), 0 0 0 rgba(79,154,77,0); }
    50%      { box-shadow: 0 6px 18px rgba(0,0,0,0.4), 0 0 14px rgba(79,154,77,0.6); }
  }

  .cart-badge {
    position: absolute;
    top: -6px; right: -6px;
    background: var(--accent);
    color: var(--cream);
    font-size: 0.72rem;
    font-weight: 700;
    width: 20px; height: 20px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    display: none;
  }
  .cart-badge.visible { display: flex; }

  .cart-badge.bump { animation: badgeBump 0.4s ease; }

  @keyframes badgeBump {
    0%   { transform: scale(1) rotate(0deg); }
    35%  { transform: scale(1.5) rotate(-8deg); }
    65%  { transform: scale(1.2) rotate(6deg); }
    100% { transform: scale(1) rotate(0deg); }
  }

  /* ---------- VISTA 1: INICIO ---------- */
  .hero {
    position: relative;
    z-index: 2;
    padding: 6rem 4rem 4rem;
    min-height: 80vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
  }

  /* Video de fondo: cubre toda la pantalla mientras se ve la vista de Inicio */
  .site-bg-video {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
  }

  .site-bg-overlay {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: rgba(0, 0, 0, 0.22);
  }

  .hero-text { position: relative; z-index: 2; }

  .hero-text .label   { animation: fadeUp 0.7s ease-out 0.1s both; }
  .hero-text h1        { animation: fadeUp 0.8s ease-out 0.25s both; }
  .hero-text p          { animation: fadeUp 0.8s ease-out 0.45s both; }
  .hero-text .actions  { animation: fadeUp 0.8s ease-out 0.65s both; }

  .label {
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
  }

  .label::before { content: ""; width: 40px; height: 1px; background: var(--accent); }

  .hero h1 {
    font-family: var(--display);
    font-weight: 300;
    font-size: clamp(3rem, 7vw, 6rem);
    line-height: 1;
    letter-spacing: -0.02em;
    margin-bottom: 2rem;
  }

  .hero h1 em { font-style: italic; color: var(--accent); font-weight: 400; }

  .hero p { font-size: 1.125rem; color: var(--muted); max-width: 32rem; margin-bottom: 2.5rem; }

  .actions { display: flex; gap: 1rem; align-items: center; }

  .btn {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--ink);
    color: var(--cream);
    text-decoration: none;
    font-size: 0.875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: transform 0.3s, background 0.3s;
    border: 1px solid var(--ink);
    cursor: pointer;
    font-family: var(--body);
  }
  .btn:hover { background: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
  .btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--ink); }

  .hero-visual { position: relative; z-index: 2; height: 500px; overflow: visible; animation: fadeIn 1.2s ease-out 0.2s both; }

  /* Resplandor verde y cálido detrás del carrusel */
  .showcase-glow {
    position: absolute;
    inset: 2% -8% 8%;
    z-index: 0;
    background:
      radial-gradient(ellipse at 50% 44%, rgba(84, 214, 98, 0.42), transparent 62%),
      radial-gradient(ellipse at 50% 100%, rgba(217, 72, 43, 0.20), transparent 62%);
    filter: blur(34px);
    animation: glowPulse 5s ease-in-out infinite;
    pointer-events: none;
  }

  @keyframes glowPulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.08); }
  }

  /* Marco que contiene el carrusel */
  .showcase-frame {
    position: relative;
    z-index: 1;
    height: 100%;
    overflow: hidden;
  }

  .showcase-tag {
    position: absolute;
    top: 16px;
    z-index: 2;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--cream);
    text-shadow: 0 1px 6px rgba(0,0,0,0.5);
  }
  .showcase-tag-left { left: 18px; }
  .showcase-tag-right { right: 18px; }

  /* Zona 3D: deja abajo un espacio para el nombre de la verdura */
  .showcase-images {
    position: absolute;
    inset: 0 0 76px;
    perspective: 1100px;
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
  }
  .showcase-images:active { cursor: grabbing; }

  /* Escenario que se inclina un poco con el mouse (JS cambia las variables) */
  .showcase-stage {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateX(var(--inclina-x, 0deg)) rotateY(var(--inclina-y, 0deg));
    transition: transform 0.35s ease-out;
  }

  /* "Piso" brillante bajo la tarjeta del centro */
  .showcase-stage::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 1%;
    width: 44%;
    height: 26px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse, rgba(110, 235, 120, 0.6), transparent 70%);
    filter: blur(9px);
  }

  /* Cada verdura va en una tarjeta blanca; JS la coloca (posición, giro, escala) */
  .showcase-slide {
    position: absolute;
    top: 46%;
    left: 50%;
    width: 33%;
    aspect-ratio: 1 / 1.08;
    padding: 7%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    transform: translate(-50%, -50%);
    transition: transform 0.9s cubic-bezier(0.22, 0.9, 0.3, 1),
                opacity 0.9s ease,
                box-shadow 0.9s ease;
  }
  .showcase-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    -webkit-user-drag: none;
  }

  /* La tarjeta del centro brilla y la verdura flota suavemente */
  .showcase-slide.activo {
    cursor: default;
    box-shadow:
      0 0 0 2px rgba(130, 230, 130, 0.95),
      0 0 55px rgba(80, 210, 95, 0.6),
      0 34px 60px rgba(0, 0, 0, 0.55);
  }
  .showcase-slide.activo img { animation: flotar 3.6s ease-in-out infinite; }

  @keyframes flotar {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-7px); }
  }

  /* Nombre de la verdura actual y contador */
  .showcase-info {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 14px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    pointer-events: none;
  }
  .showcase-name {
    font-family: var(--display);
    font-size: 1.7rem;
    color: var(--cream);
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
  }
  .showcase-count {
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    color: var(--accent);
  }

  @media (prefers-reduced-motion: reduce) {
    .showcase-glow, .showcase-slide.activo img { animation: none; }
  }

  .quote {
    position: absolute; bottom: -55px; right: 0;
    font-family: var(--display); font-style: italic; font-size: 1.25rem;
    max-width: 240px; line-height: 1.4; color: var(--muted);
  }
  .quote::before { content: "\201C"; font-size: 4rem; line-height: 0; vertical-align: -0.4em; color: var(--accent); }

  .info-strip {
    position: relative; z-index: 2;
    display: grid; grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  }
  .info-strip div { padding: 2rem 4rem; border-right: 1px solid var(--line); }
  .info-strip div:last-child { border-right: none; }
  .info-strip .num { font-family: var(--display); font-size: 1.75rem; color: var(--accent); }
  .info-strip .desc { font-size: 0.85rem; color: var(--muted); margin-top: 0.35rem; }

  footer.site {
    position: relative; z-index: 2;
    padding: 3rem 4rem; border-top: 1px solid var(--line);
    display: flex; justify-content: space-between;
    font-size: 0.875rem; color: var(--muted);
  }
  footer.site a, footer.site button {
    color: var(--ink); text-decoration: none; background: none; border: none;
    font-family: var(--body); font-size: inherit; cursor: pointer;
  }
  footer.site a:hover, footer.site button:hover { color: var(--accent); }

  /* Como el fondo aquí es el video (oscuro), el texto pasa a claro para que se lea bien */
  #vista-inicio .label,
  #vista-inicio .hero p,
  #vista-inicio .hero h1,
  #vista-inicio .info-strip .desc,
  #vista-inicio footer.site,
  #vista-inicio footer.site a,
  #vista-inicio footer.site button {
    color: var(--cream);
  }

  #vista-inicio .btn-ghost {
    color: var(--cream);
    border-color: var(--cream);
  }

  #vista-inicio .info-strip,
  #vista-inicio footer.site {
    border-color: rgba(244, 239, 230, 0.25);
  }
  #vista-inicio .info-strip div {
    border-right-color: rgba(244, 239, 230, 0.4);
  }

  /* ---------- VISTA 2: CATÁLOGO ---------- */
  #vista-catalogo { display: none; }
  #vista-catalogo.active { display: block; animation: fadeUp 0.5s ease-out; }
  #vista-inicio.hidden { display: none; }

  .page-head {
    position: relative;
    z-index: 2;
    padding: 4rem 4rem 2rem;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 3rem;
    flex-wrap: wrap;
  }
  .page-head-text h1 { font-family: var(--display); font-weight: 300; font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -0.02em; color: var(--cream); }
  .page-head-text h1 em { font-style: italic; color: var(--accent); font-weight: 400; }
  .page-head-text p { color: var(--cream); opacity: 0.85; margin-top: 0.75rem; max-width: 34rem; }

  .page-head-note {
    font-family: var(--display);
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.5;
    color: var(--cream);
    max-width: 330px;
    text-align: right;
    border-right: 2px solid var(--accent);
    padding-right: 1.25rem;
  }
  .page-head-note p { opacity: 0.8; }

  /* Mensaje importante: llamativo, con triángulo de advertencia */
  .page-head-note .nota-atencion {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
    margin-bottom: 0.6rem;
    font-style: normal;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #ffc83d;
    opacity: 1;
  }
  .nota-atencion svg { flex: none; width: 1.7rem; height: 1.7rem; color: #ffc83d; }

  .wrap { position: relative; z-index: 2; max-width: 1120px; margin: 0 auto; padding: 3rem 4rem 100px; }

  .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }

  .card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  /* Imagen del producto: se ve completa (sin recortar) y hace zoom leve al pasar el mouse */
  .card-img-wrap {
    width: 100%;
    height: 140px;
    overflow: hidden;
    border-radius: 4px;
    background: #ffffff;
  }

  .card-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    cursor: pointer;
    transition: transform 0.35s ease;
  }

  .card:hover .card-img {
    transform: scale(1.08);
  }

  /* Mismo efecto de zoom, pero al tocar con el dedo en celular */
  .card-img-wrap.touch-zoom .card-img {
    transform: scale(1.08);
  }

  .card h3 { font-family: var(--display); font-weight: 500; font-size: 1.1rem; }

  /* Selector Kg / Unidad (para productos con 2-3 opciones, ej: Pimiento) */
  .unit-toggle {
    display: flex;
    border: 1px solid var(--line);
    border-radius: 4px;
    overflow: hidden;
  }
  .unit-toggle button {
    flex: 1;
    background: var(--cream);
    border: none;
    padding: 8px 0;
    font-family: var(--body);
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
  }
  .unit-toggle button + button { border-left: 1px solid var(--line); }
  .unit-toggle button.active { background: var(--ink); color: var(--cream); }
  .unit-toggle-fila + .unit-toggle-fila { margin-top: -2px; }

  /* Selector desplegable (para productos con muchas opciones, ej: Huevo por paquete) */
  .unit-select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 8px 10px;
    font-family: var(--body);
    font-size: 0.82rem;
    color: var(--ink);
    background: var(--cream);
  }
  .unit-select:focus { outline: 1px solid var(--accent); }

  .price { color: var(--ink); font-size: 0.95rem; font-weight: 600; }

  /* Producto sin stock: imagen apagada y etiqueta en vez de precio/selector */
  .card-agotado .card-img { filter: grayscale(1); opacity: 0.5; }
  .agotado-tag {
    margin-top: auto;
    text-align: center;
    padding: 8px 0;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--cream);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
  .price .unit { color: var(--muted); font-size: 0.78rem; font-weight: 400; }

  .stepper {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--cream);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 6px;
  }
  .stepper button {
    width: 32px; height: 32px;
    border-radius: 3px;
    border: none;
    background: transparent;
    color: var(--ink);
    font-size: 1.1rem;
    cursor: pointer;
    font-family: var(--body);
  }
  .stepper button:hover { background: var(--line); }
  .stepper .qty {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    min-width: 38px;
    text-align: center;
    display: inline-block;
  }

  .stepper .qty.bump {
    animation: bump 0.32s ease;
  }

  @keyframes bump {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.35); color: var(--accent); }
    100% { transform: scale(1); }
  }

  footer.note { position: relative; z-index: 2; text-align: center; padding: 0 4rem 60px; color: var(--cream); opacity: 0.75; font-size: 0.82rem; }

  /* ---------- PANEL DE CARRITO ---------- */
  .cart-overlay {
    position: fixed; inset: 0;
    background: rgba(26,26,26,0.4);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .cart-overlay.open { opacity: 1; pointer-events: auto; }

  .cart-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(420px, 100vw);
    background: var(--cream);
    border-left: 1px solid var(--line);
    z-index: 56;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s ease;
  }
  .cart-panel.open { transform: translateX(0); }

  .cart-head {
    padding: 1.75rem 2rem;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .cart-head h2 { font-family: var(--display); font-weight: 500; font-size: 1.3rem; }

  .cart-head-actions { display: flex; align-items: center; gap: 14px; }

  .cart-clear {
    background: none; border: none; cursor: pointer;
    color: var(--muted);
    display: flex; align-items: center;
    padding: 4px;
  }
  .cart-clear svg { width: 19px; height: 19px; }
  .cart-clear:hover { color: var(--accent); }

  .cart-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.4rem; line-height: 1; color: var(--muted);
  }
  .cart-close:hover { color: var(--accent); }

  .cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .cart-empty { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 2rem 0; }

  .cart-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
  }
  .cart-item .name { font-weight: 600; font-size: 0.92rem; }
  .cart-item .meta { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
  .cart-item .subtotal { color: var(--ink); font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
  .cart-item .remove { background: none; border: none; color: var(--muted); font-size: 0.78rem; cursor: pointer; text-decoration: underline; margin-top: 4px; }
  .cart-item .remove:hover { color: var(--accent); }

  .cart-foot {
    border-top: 1px solid var(--line);
    padding: 1.5rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .cart-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: var(--display);
    font-size: 1.3rem;
  }
  .cart-total span:last-child { color: var(--ink); }
  .cart-total[hidden] { display: none; }

  .cart-foot label {
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  .cart-foot textarea {
    width: 100%;
    resize: vertical;
    min-height: 64px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 10px 12px;
    font-family: var(--body);
    font-size: 0.9rem;
    background: var(--card);
    color: var(--ink);
  }
  .cart-foot textarea:focus { outline: 1px solid var(--accent); }

  .cart-foot .send {
    background: var(--accent);
    color: var(--cream);
    border: none;
    padding: 14px;
    border-radius: 4px;
    font-family: var(--body);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.3s;
  }
  .cart-foot .send:hover { transform: translateY(-2px); }

  @keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

  /* ---------- Productos apareciendo uno por uno en el catálogo ---------- */
  .card-enter {
    opacity: 0;
    animation: cardEnter 0.5s ease-out both;
  }
  @keyframes cardEnter {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }

  /* ---------- Transición al cambiar entre Inicio y Catálogo ---------- */
  :root { --transicion-vista: 450ms; }

  #vista-inicio, #vista-catalogo.active {
    animation: vistaEntrar var(--transicion-vista) ease-out both;
  }
  .vista-saliendo {
    animation: vistaSalir var(--transicion-vista) ease-in both !important;
  }
  .vista-entrando {
    animation: vistaEntrar var(--transicion-vista) ease-out both;
  }

  @keyframes vistaSalir {
    from { opacity: 1; }
    to   { opacity: 0; }
  }
  @keyframes vistaEntrar {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  @media (max-width: 768px) {
    nav, .page-head, .wrap { padding-left: 1.5rem; padding-right: 1.5rem; }
    .nav-right { gap: 1.25rem; }
    .nav-links { gap: 1rem; }
    .hero { grid-template-columns: 1fr; padding: 3rem 1.5rem; }
    .hero-visual { height: 350px; margin-bottom: 6rem; }
    .showcase-images { inset: 30px 0 72px; }
    .showcase-slide { width: 52%; top: 50%; }
    .showcase-name { font-size: 1.3rem; }
    .quote { left: 0; right: 0; bottom: -84px; max-width: none; text-align: center; }
    .info-strip { grid-template-columns: 1fr; }
    .info-strip div { padding: 1.5rem; border-right: none; border-bottom: 1px solid var(--line); }
    footer.site { padding: 2rem 1.5rem; flex-direction: column; gap: 1rem; }
    .cart-panel { width: 100vw; }
    .page-head-note .nota-atencion { justify-content: flex-start; }
    .page-head-note {
      text-align: left;
      border-right: none;
      border-left: 2px solid var(--accent);
      padding-right: 0;
      padding-left: 1.25rem;
      max-width: 100%;
    }
    .nav-right { flex-wrap: wrap; gap: 0.75rem; }

    /* ---- Menú en celular: 3 filas ordenadas ----
       Fila 1: logo (izquierda) + carrito (derecha)
       Fila 2: idioma (izquierda) + usuario y "Salir" (derecha)
       Fila 3: Inicio, Catálogo, Contacto, Mis pedidos, Panel (centrados) */
    nav { flex-wrap: wrap; align-items: center; padding-top: 1rem; padding-bottom: 0.75rem; row-gap: 0.6rem; }
    .nav-right { display: contents; }
    nav .logo { order: 1; flex: 0 0 calc(100% - 62px); text-align: left; }
    nav .cart-btn { order: 2; margin-left: auto; width: 46px; height: 46px; }
    nav .lang-switch-inline { order: 3; }
    nav .user-chip { order: 4; margin-left: auto; }
    nav .nav-links { order: 5; gap: 0.2rem 1rem; flex-wrap: wrap; justify-content: center; }
    nav .nav-links { flex-basis: 100%; }
    nav .nav-links button { font-size: 0.7rem; letter-spacing: 0.02em; padding: 0.35rem 0; }
  }

  /* ---------- Animación: vuelo hacia el carrito ---------- */
  .fly-to-cart {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    pointer-events: none;
    object-fit: contain;
    border-radius: 8px;
    filter: drop-shadow(0 10px 18px rgba(0,0,0,0.35));
    will-change: transform, opacity;
  }

  /* ---------- LIGHTBOX: imagen ampliada ---------- */
  .lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.9);
    z-index: 57;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .lightbox-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  .lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 6px;
    background: #ffffff;
  }

  .lightbox-close {
    position: absolute;
    top: 24px;
    right: 32px;
    background: none;
    border: none;
    color: var(--cream);
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
  }
  .lightbox-close:hover { color: var(--accent); }


  /* ---------- Ingreso: pantalla de usuario y contraseña ---------- */
  body.sin-sesion { overflow: hidden; }

  .login-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(6, 12, 8, 0.72);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }
  body.sin-sesion .login-overlay { display: flex; }

  .login-card {
    width: 100%;
    max-width: 380px;
    padding: 2rem 2rem 2.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: rgba(20, 32, 26, 0.65);
    border: 1px solid rgba(79, 154, 77, 0.5);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    color: var(--cream);
    animation: fadeUp 0.5s ease-out both;
  }

  .login-lang { align-self: flex-end; margin-bottom: 0.75rem; }

  .login-card h2 {
    font-family: var(--display);
    font-weight: 400;
    font-size: 1.6rem;
  }
  .login-card p {
    font-size: 0.85rem;
    color: rgba(244, 239, 230, 0.7);
    margin-bottom: 1rem;
  }
  .login-card label {
    margin-top: 0.5rem;
    font-size: 0.72rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #8fd47c;
  }
  .login-card input {
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    border: 1px solid rgba(79, 154, 77, 0.45);
    background: rgba(0, 0, 0, 0.35);
    color: var(--cream);
    font-family: var(--body);
    font-size: 1rem;
  }
  .login-card input:focus {
    outline: none;
    border-color: #4f9a4d;
    box-shadow: 0 0 0 3px rgba(79, 154, 77, 0.25);
  }

  .login-error {
    min-height: 1.3rem;
    margin-top: 0.4rem;
    font-size: 0.82rem;
    color: #ff9a86;
  }

  .login-btn {
    margin-top: 0.4rem;
    padding: 0.9rem;
    border: none;
    border-radius: 8px;
    background: #4f9a4d;
    color: #0c1a0c;
    font-family: var(--body);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.3s, background 0.3s;
  }
  .login-btn:hover { background: #5cb25a; transform: translateY(-2px); }
  .login-btn:disabled { opacity: 0.6; cursor: wait; transform: none; }


  /* ---------- Barra superior: usuario conectado + Salir ---------- */
  .user-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0.4rem 0.3rem 0.9rem;
    border: 1px solid rgba(143, 212, 124, 0.4);
    border-radius: 10px;
    background: rgba(8, 20, 12, 0.7);
  }
  .user-chip[hidden] { display: none; }
  .user-name { font-size: 0.85rem; font-weight: 600; color: #b6eca4; }
  .user-chip button {
    padding: 0.3rem 0.7rem;
    border: none;
    border-radius: 7px;
    background: rgba(143, 212, 124, 0.15);
    color: #8fd47c;
    font-family: var(--body);
    font-size: 0.78rem;
    cursor: pointer;
  }
  .user-chip button:hover { background: rgba(143, 212, 124, 0.3); }


  /* ---------- Ojito para ver la contraseña ---------- */
  .password-wrap { position: relative; display: flex; }
  .password-wrap input { width: 100%; padding-right: 2.9rem; }

  .eye-btn {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 2.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #8fd47c;
    cursor: pointer;
  }
  .eye-btn:hover { color: #b6eca4; }
  .eye-btn svg { width: 20px; height: 20px; }
  .eye-btn .eye-closed { display: none; }
  .eye-btn.activo .eye-open { display: none; }
  .eye-btn.activo .eye-closed { display: block; }


  /* ---------- Aviso de dirección faltante (en el carrito) ---------- */
  .cart-foot textarea.con-error { border-color: #c0392b; outline: 1px solid #c0392b; }
  .direccion-error {
    display: none;
    margin-top: 0.4rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #c0392b;
  }
  .direccion-error.visible { display: block; }


  /* ---------- Aviso emergente (pedido enviado / error) ---------- */
  .toast {
    position: fixed;
    left: 50%;
    bottom: 2rem;
    z-index: 60;
    max-width: calc(100% - 2rem);
    padding: 0.9rem 1.4rem;
    border-radius: 10px;
    background: rgba(12, 26, 14, 0.95);
    border: 1px solid rgba(79, 154, 77, 0.6);
    color: #b6eca4;
    font-size: 0.95rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
  }
  .toast.visible { opacity: 1; transform: translate(-50%, 0); }


  /* ---------- Mis pedidos ---------- */
  .pedidos-overlay {
    position: fixed;
    inset: 0;
    z-index: 58;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(6, 12, 8, 0.65);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .pedidos-overlay.open { opacity: 1; pointer-events: auto; }

  .pedidos-modal {
    width: 100%;
    max-width: 640px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--cream);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
  }

  .pedidos-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.4rem 1.75rem;
    border-bottom: 1px solid var(--line);
  }
  .pedidos-head h2 { font-family: var(--display); font-weight: 400; font-size: 1.5rem; }
  .pedidos-close {
    background: none;
    border: none;
    font-size: 1.9rem;
    line-height: 1;
    color: var(--ink);
    cursor: pointer;
  }
  .pedidos-close:hover { color: var(--accent); }

  .pedidos-lista {
    padding: 1.25rem 1.75rem 1.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
  }
  .pedidos-aviso { padding: 2.5rem 0; text-align: center; color: var(--muted); }

  /* Aviso fijo: solo se guarda el último pedido */
  .pedidos-reemplazo {
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    line-height: 1.45;
    border-left: 4px solid #d9a21b;
    background: rgba(217, 162, 27, 0.14);
    border-radius: 6px;
  }

  .pedido-card {
    padding: 1.1rem 1.2rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
  }
  /* Cabecera de cada pedido: "Pedido 1" / "Pedido 2" y la X para cancelar el 2 */
  .pedido-cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.45rem; }
  .pedido-numero {
    padding: 0.15rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    background: rgba(0, 0, 0, 0.06);
    border-radius: 999px;
  }
  .pedido-numero-2 { color: #fff; background: var(--accent); }
  .pedido-quitar {
    width: 1.9rem; height: 1.9rem;
    font-size: 1.4rem; line-height: 1;
    color: var(--muted);
    background: none;
    border: 1px solid var(--line);
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
  }
  .pedido-quitar:hover { color: #b3261e; border-color: #b3261e; }

  /* Botón "Hacer pedido 2", abajo y al centro de Mis pedidos */
  .pedido-nuevo { text-align: center; padding: 0.4rem 0 0.2rem; }
  .pedido-nuevo p { margin-bottom: 0.8rem; font-size: 0.85rem; color: var(--muted); }
  .pedido-nuevo-btn {
    padding: 0.8rem 1.8rem;
    font-family: var(--body);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--cream);
    background: var(--accent);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.3s;
  }
  .pedido-nuevo-btn:hover { transform: translateY(-2px); }

  /* Aviso en el catálogo mientras se arma el Pedido 2 */
  .banner-pedido2 {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: calc(100% - 8rem);
    max-width: 980px;
    margin: 1.6rem auto -1.4rem;
    padding: 0.9rem 1.2rem;
    font-weight: 600;
    color: #1a1a1a;
    background: #ffc83d;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(255, 200, 61, 0.35);
  }
  .banner-pedido2[hidden] { display: none; }
  .banner-pedido2 button {
    flex: none;
    padding: 0.4rem 1rem;
    font-family: var(--body);
    font-weight: 600;
    color: #1a1a1a;
    background: transparent;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    cursor: pointer;
  }

  .pedido-fecha { font-family: var(--display); font-size: 1.05rem; margin-bottom: 0.8rem; }

  .pedido-pasos { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
  .pedido-paso {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--muted);
  }
  .pedido-paso .punto {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--line);
  }
  .pedido-paso.hecho { color: #2f6b2d; font-weight: 700; }
  .pedido-paso.hecho .punto { background: #4f9a4d; }

  .pedido-nota {
    margin-bottom: 0.9rem;
    padding: 0.55rem 0.8rem;
    border-left: 3px solid #4f9a4d;
    background: rgba(79, 154, 77, 0.1);
    font-size: 0.88rem;
  }

  .pedido-lineas { display: flex; flex-direction: column; gap: 0.5rem; }
  .pedido-linea {
    display: grid;
    grid-template-columns: 1.4rem 48px 1fr auto;
    align-items: center;
    gap: 0.8rem;
  }
  .pedido-linea img {
    width: 48px; height: 48px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
  }
  .pedido-linea-num { font-weight: 700; color: var(--accent); text-align: center; }
  .pedido-linea-nombre { font-weight: 600; }
  .pedido-linea-cant { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }

  .pedido-total-items { margin-top: 0.8rem; font-size: 0.85rem; color: var(--muted); text-align: right; }
  .pedido-mensaje {
    margin-top: 0.7rem;
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    background: rgba(217, 162, 27, 0.14);
    border-left: 3px solid #d9a21b;
    border-radius: 4px;
    word-break: break-word;
    white-space: pre-wrap;
  }
  .pedido-direccion {
    margin-top: 0.9rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--line);
    font-size: 0.82rem;
    color: var(--muted);
    word-break: break-word;
  }



  /* ---------- Ajustes de celular: que la página no se mueva ni se descuadre ---------- */
  html { overflow-x: hidden; max-width: 100%; }
  body { max-width: 100%; overflow-x: clip; }
  .hero { overflow-x: clip; }

  /* La pantalla de ingreso se desplaza sola si el teclado ocupa espacio, sin descuadrarse */
  .login-overlay { overflow-y: auto; overscroll-behavior: contain; }
  .login-card { margin: auto; }

  @media (max-width: 768px) {
    .inicio-top { top: 10px; right: 10px; gap: 0.4rem; }
    .hero { padding-top: 4.25rem; }
    .showcase-glow { inset: 2% 0 8%; }
    .login-overlay { padding: 1rem; }
    .login-card { padding: 1.5rem 1.25rem 1.75rem; }
  }

  /* ---------- Celular (pantalla normal): carrusel 3D, ingreso, menú y catálogo ---------- */
  @media (max-width: 768px) {

    /* Carrusel 3D: textos cerca de las tarjetas, pero sin taparlas */
    .hero-visual { height: 370px; margin-bottom: 7rem; }
    .showcase-tag { top: 6px; font-size: 0.6rem; letter-spacing: 0.1em; }
    .showcase-tag-left { left: 4px; }
    .showcase-tag-right { right: 4px; }
    .showcase-images { inset: 26px 0 78px; }
    .showcase-info { bottom: 4px; }
    .showcase-name { font-size: 1.2rem; }
    .quote { bottom: -100px; font-size: 1.1rem; }

    /* Idioma y usuario más pequeños (Inicio y menú) */
    .lang-switch { padding: 3px; gap: 2px; border-radius: 8px; }
    .lang-btn { min-width: 0; padding: 4px 7px; font-size: 0.6rem; }
    .lang-switch-floating { border-width: 1.5px; }
    .inicio-top .user-chip { padding: 0.1rem 0.12rem 0.1rem 0.5rem; gap: 0.35rem; border-radius: 8px; }
    .inicio-top .user-name { font-size: 0.62rem; }
    .inicio-top .user-chip button { padding: 0.18rem 0.45rem; font-size: 0.58rem; border-radius: 6px; }

    /* Ventana de ingreso: más pequeña */
    .login-overlay { padding: 1rem; }
    .login-card { max-width: 310px; padding: 1.1rem 1.1rem 1.3rem; gap: 0.25rem; border-radius: 14px; }
    .login-card h2 { font-size: 1.3rem; }
    .login-card p { font-size: 0.8rem; line-height: 1.4; }
    .login-card label { font-size: 0.64rem; margin-top: 0.3rem; }
    .login-card input { padding: 0.5rem 0.7rem; font-size: 0.95rem; }
    .login-error { min-height: 0.9rem; margin-top: 0.2rem; font-size: 0.75rem; }
    .login-btn { padding: 0.65rem 0; font-size: 0.85rem; }
    .login-lang { margin-bottom: 0.3rem; }

    /* Menú de arriba: compacto, con fondo sólido para que no se mezcle con el contenido */
    nav {
      padding: 0.55rem 1rem 0.5rem;
      row-gap: 0.4rem;
      background: rgba(8, 16, 10, 0.96);
      -webkit-backdrop-filter: blur(8px);
      backdrop-filter: blur(8px);
      border-bottom: 1px solid rgba(143, 212, 124, 0.18);
    }
    nav .logo { font-size: 1.05rem; flex: 0 0 calc(100% - 48px); }
    nav .cart-btn { width: 38px; height: 38px; }
    nav .cart-icon-gif { width: 24px; height: 24px; }
    nav .lang-switch-inline { padding: 3px; gap: 2px; border-radius: 8px; }
    nav .lang-switch-inline .lang-btn { font-size: 0.6rem; padding: 4px 7px; min-width: 0; }
    nav .user-chip { padding: 0.12rem 0.15rem 0.12rem 0.55rem; gap: 0.4rem; border-radius: 8px; }
    nav .user-name { font-size: 0.62rem; }
    nav .user-chip button { padding: 0.18rem 0.45rem; font-size: 0.58rem; border-radius: 6px; }
    nav .nav-links { gap: 0; flex-wrap: nowrap; justify-content: space-between; padding-top: 0.15rem; }
    nav .nav-links button { font-size: 0.62rem; letter-spacing: 0; padding: 0.25rem 0; white-space: nowrap; }
    nav .nav-links .admin-badge { min-width: 1rem; font-size: 0.6rem; padding: 0 0.25rem; margin-left: 0.15rem; }

    /* Catálogo: 3 productos por fila, con imágenes más chicas */
    .wrap { padding: 1.25rem 0.5rem 90px; }
    .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .card { padding: 6px; gap: 5px; }
    .card-img-wrap { height: 64px; }
    .card h3 { font-size: 0.74rem; line-height: 1.15; overflow-wrap: anywhere; }
    .price { font-size: 0.68rem; }
    .price .unit { font-size: 0.6rem; }
    .unit-toggle button { font-size: 0.5rem; padding: 5px 0; letter-spacing: 0; }
    /* Productos con 3 o más opciones (ej: Apio): los botones van uno debajo del otro para que quepan */
    .unit-toggle:has(button:nth-child(3)) { flex-direction: column; }
    .unit-toggle:has(button:nth-child(3)) button + button { border-left: none; border-top: 1px solid var(--line); }
    .unit-toggle:has(button:nth-child(3)) button { font-size: 0.55rem; padding: 6px 0; }
    /* Uva: dos filas de botones (color arriba, peso abajo), cada una en una sola línea y más chicas */
    .unit-toggle.unit-toggle-fila:has(button:nth-child(3)) { flex-direction: row; }
    .unit-toggle.unit-toggle-fila:has(button:nth-child(3)) button + button { border-top: none; border-left: 1px solid var(--line); }
    .unit-toggle.unit-toggle-fila button { font-size: 0.47rem; padding: 5px 0; letter-spacing: 0; }
    .unit-select { font-size: 0.6rem; padding: 4px 2px; }
    .stepper { padding: 2px; }
    .stepper button { width: 22px; height: 24px; font-size: 0.9rem; }
    .stepper .qty { min-width: 16px; font-size: 0.78rem; }
    .agotado-tag { font-size: 0.55rem; padding: 5px 0; }
  }


  /* ---------- Ventana "Confirmar pedido" ---------- */
  .confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(6, 12, 8, 0.7);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }
  .confirm-overlay[hidden] { display: none; }
  .confirm-card {
    width: 100%;
    max-width: 340px;
    padding: 1.4rem 1.25rem 1.2rem;
    background: var(--cream);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    animation: fadeUp 0.3s ease-out both;
  }
  .confirm-card h3 { font-family: var(--display); font-weight: 500; font-size: 1.35rem; color: var(--ink); margin-bottom: 0.5rem; }
  .confirm-card p { white-space: pre-line; font-size: 0.92rem; line-height: 1.45; color: var(--muted); }
  .confirm-btns { display: flex; gap: 0.6rem; margin-top: 1.1rem; }
  .confirm-btns button {
    flex: 1;
    padding: 0.7rem 0.5rem;
    border-radius: 8px;
    font-family: var(--body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
  }
  .confirm-no { background: transparent; border: 1px solid var(--line); color: var(--ink); }
  .confirm-si { background: #3f7a3d; border: 1px solid #3f7a3d; color: #fff; }
  .confirm-si:hover { background: #4f9a4d; }