/*
 * Pastelería Nava — capa responsive progresiva
 * v1.6 | Ajuste del carrusel y ocultación de sus controles en móvil; solo modifica pantallas de hasta 959px.
 * Por encima de 959px se conservan las reglas originales.
 */

/* La nueva capa no altera el layout de escritorio amplio. */
.mobile-menu-toggle { display: none; }

@media (max-width: 959px) {
  html, body { width: 100%; max-width: 100%; }
  img, video, iframe, object, embed { max-width: 100%; }
  img { height: auto; }
  *, *::before, *::after { box-sizing: border-box; }
  body { min-width: 0 !important; overflow-x: hidden; }
  .main { width: 100%; max-width: 100%; overflow: hidden; }

  /* El antiguo 960 Grid System pasa a ser fluido. */
  .container_12 {
    width: 100% !important;
    max-width: 1200px;
    padding-left: 12px;
    padding-right: 12px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
  }
  .container_12 [class*="grid_"] {
    box-sizing: border-box;
    min-width: 0;
  }
  .container_12 .grid_1 { width: 6.3333%; margin-left: 1%; margin-right: 1%; }
  .container_12 .grid_2 { width: 14.6667%; margin-left: 1%; margin-right: 1%; }
  .container_12 .grid_3 { width: 23%; margin-left: 1%; margin-right: 1%; }
  .container_12 .grid_4 { width: 31.3333%; margin-left: 1%; margin-right: 1%; }
  .container_12 .grid_5 { width: 39.6667%; margin-left: 1%; margin-right: 1%; }
  .container_12 .grid_6 { width: 48%; margin-left: 1%; margin-right: 1%; }
  .container_12 .grid_7 { width: 56.3333%; margin-left: 1%; margin-right: 1%; }
  .container_12 .grid_8 { width: 64.6667%; margin-left: 1%; margin-right: 1%; }
  .container_12 .grid_9 { width: 73%; margin-left: 1%; margin-right: 1%; }
  .container_12 .grid_10 { width: 81.3333%; margin-left: 1%; margin-right: 1%; }
  .container_12 .grid_11 { width: 89.6667%; margin-left: 1%; margin-right: 1%; }
  .container_12 .grid_12 { width: 98%; margin-left: 1%; margin-right: 1%; }

  /* Desactiva offsets de la rejilla fija que pueden sacar contenido de pantalla. */
  .container_12 [class*="prefix_"] { padding-left: 0 !important; }
  .container_12 [class*="suffix_"] { padding-right: 0 !important; }
  .container_12 [class*="push_"] { left: auto !important; }
  .container_12 [class*="pull_"] { left: auto !important; }

  header { padding: 12px 0 16px; }
  header .container_12, header .container_12 .grid_12 { width: 100% !important; }
  header h1 { margin: 0; }
  header h1 a { max-width: 100%; }
  header h1 a img { max-width: 100%; height: auto; }
  .menu_block { max-width: 100%; }

  /* Carrusel de portada: la imagen completa queda dentro del área visible. */
  .slider-relative { width: 100%; overflow: hidden; }
  .slider-block {
    width: 100%;
    height: auto;
    aspect-ratio: 1600 / 615;
    min-height: 0;
    overflow: hidden;
  }
  .slider {
    width: 100% !important;
    max-width: 100%;
    height: 100% !important;
    left: 0 !important;
    margin-left: 0 !important;
    position: relative;
  }
  .slider .items, .slider .items li { max-width: 100%; }
  /* TMS crea .pic con la fotografía como fondo y fija en línea sus
     dimensiones de escritorio. En móvil se fuerza el propio lienzo del
     plugin al tamaño del carrusel y se escala el fondo completo.
     Se oculta la máscara de transición porque sus fragmentos conservan
     coordenadas de 1600x615 y provocaban que solo apareciera una esquina. */
  .slider .pic {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    transform: none !important;
    transform-origin: 0 0 !important;
    background-size: 100% 100% !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
  }
  .slider .pic .mask {
    display: none !important;
  }
  .slider .items li img {
    display: block;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    object-fit: contain;
    object-position: center;
  }
  /* En móvil se ocultan y desactivan los controles de navegación del carrusel.
     El pase automático de imágenes se mantiene. */
  .slider-relative .prev,
  .slider-relative .next,
  .slider-relative .pagination {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .page1_block img { max-width: 42%; height: auto; }
  .car_wrap { margin-left: 0; margin-right: 0; }
  .carousel1 { max-width: 100%; }
  .carousel1 li { max-width: 100%; }
  .carousel1 img { max-width: 100%; height: auto; }
  .map figure iframe { width: 100%; }
  iframe, table { max-width: 100%; }
  table { display: block; overflow-x: auto; }

  /* Controles y formularios más cómodos al tacto. */
  input, select, textarea, button { max-width: 100%; }
  input, select, textarea { font-size: 16px; }
  #form label { max-width: 100%; }
}

/* Tablet: la rejilla conserva columnas donde hay espacio. */
@media (min-width: 641px) and (max-width: 959px) {
  .menu_block { float: none; clear: both; padding-top: 18px; }
  header h1 a { float: none; margin: 0 auto; }
  .sf-menu { display: flex; flex-wrap: wrap; justify-content: center; }
  .sf-menu > li { float: none; }
}

/* Móvil: una columna, navegación desplegable y espacios reducidos. */
@media (max-width: 640px) {
  body { padding-top: 0; font-size: 15px; line-height: 1.5; }
  .container_12 { padding-left: 12px; padding-right: 12px; }
  .container_12 .grid_1,
  .container_12 .grid_2,
  .container_12 .grid_3,
  .container_12 .grid_4,
  .container_12 .grid_5,
  .container_12 .grid_6,
  .container_12 .grid_7,
  .container_12 .grid_8,
  .container_12 .grid_9,
  .container_12 .grid_10,
  .container_12 .grid_11,
  .container_12 .grid_12 {
    float: none !important;
    display: block !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  header { padding: 10px 0 12px; }
  header .container_12 { display: flex; flex-direction: column; gap: 10px; }
  header h1 { width: 100%; }
  header h1 a { float: none; width: min(240px, 82vw); height: auto; min-height: 1px; margin: 0 auto; text-indent: 0; }
  header h1 a img { display: block; width: 100%; height: auto; }
  .menu_block { float: none !important; clear: both; width: 100%; padding-top: 0; }
  .mobile-menu-toggle {
    display: block;
    width: 100%;
    min-height: 44px;
    border: 1px solid #dddbdb;
    border-radius: 5px;
    background: #e9afac;
    color: #5d0400;
    font: 700 16px/1.2 Arial, Helvetica, sans-serif;
    text-align: left;
    padding: 10px 14px;
    cursor: pointer;
  }
  .mobile-menu-toggle::after { content: "☰"; float: right; font-size: 20px; line-height: 20px; }
  .mobile-menu-toggle[aria-expanded="true"]::after { content: "×"; font-size: 25px; }
  header .menu_block nav { display: none; width: 100%; padding-top: 8px; }
  header .menu_block nav.is-mobile-open { display: block; }
  header .sf-menu { display: block; width: 100%; text-align: left; }
  header .sf-menu > li,
  header .sf-menu li { float: none !important; display: block; width: 100%; margin: 0 !important; }
  header .sf-menu > li > a { display: block; padding: 11px 12px; font-size: 16px; line-height: 1.3; border-radius: 3px; }
  header .sf-menu li ul,
  header .sf-menu li.sfHover > ul,
  header .sf-menu ul { display: block !important; position: static !important; top: auto !important; left: auto !important; width: 100% !important; padding: 0 0 0 12px; }
  header .sf-menu li ul li a { display: block; padding: 9px 12px; font-size: 14px; line-height: 1.3; text-align: left; }

  /* En móvil se mantiene la proporción original (1600 × 615), sin recortar la foto. */
  .slider-block { height: auto; aspect-ratio: 1600 / 615; }
  .slider .items li img { object-fit: contain; object-position: center; }
  .content.page1 { padding-top: 20px; background-position: center 20px; }
  .content h2, .content.page1 h2 { padding-top: 20px; font-size: 23px; line-height: 1.25; margin-bottom: 12px; }
  .page1_block img { float: none; display: block; max-width: 100%; width: auto; margin: 0 auto 16px; }
  .extra_wrapper { overflow: visible; }
  .car_wrap { padding-bottom: 12px; }
  .carousel1 { height: auto; }
  .carousel1 li { width: 50% !important; }
  .carousel1 li > div { padding: 0 6px; }
  .carousel1 li .price { max-width: 100%; }
  .bottom_block { padding-top: 20px; padding-bottom: 20px; }
  .bottom_block h3 { padding-top: 18px; margin-bottom: 12px; }
  .bottom_block nav { padding-top: 12px; }
  .bottom_block nav li { float: none; display: inline-block; margin: 0 8px 8px 0 !important; }
  .socials { display: flex; justify-content: center; }
  .map address { float: none; margin-right: 0; margin-bottom: 16px; }
  .map figure { margin-bottom: 20px; }
  .map figure iframe { height: 240px; }
  #newsletter label { float: none; width: 100%; }
  #newsletter input { float: none; width: 100%; height: 42px; }
  #newsletter a.btn { float: none; display: inline-block; margin-top: 10px; }
  #form label { float: none; width: 100%; min-height: 0; margin-bottom: 12px; }
  #form input, #form textarea { float: none; width: 100%; }
  #form textarea { height: 180px; }
  .btns { padding-top: 16px; }
  .content .btns a.btn { margin: 0 8px 8px 0 !important; }
  footer { padding: 25px 12px; }
  .alright, .derecha { text-align: left; }
}

/* Reduce animación para usuarios que así lo soliciten. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}


/* v1.1: foco visible para navegación por teclado; no altera el escritorio. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #5d0400;
  outline-offset: 2px;
}

@media (max-width: 959px) {
  .container_12,
  .container_12 > [class*="grid_"] {
    min-width: 0;
  }

  pre, code, .long-url {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

@media (max-width: 640px) {
  .mobile-menu-toggle:focus-visible {
    outline-color: #5d0400;
  }
}


/* v1.7: formulario de contacto responsive; escritorio sin cambios. */
@media (max-width: 767px) {
  #formulario {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
  #formulario label {
    display: block;
    float: none !important;
    width: 100% !important;
    box-sizing: border-box;
    margin: 0 0 6px;
  }
  #formulario input[type="text"],
  #formulario input[type="email"],
  #formulario input[type="tel"],
  #formulario input[type="file"],
  #formulario textarea {
    display: block;
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
    margin: 0 0 14px;
    font-size: 16px;
  }
  #formulario textarea {
    min-height: 150px;
    resize: vertical;
  }
  #formulario input[type="file"] {
    padding: 8px 0;
    overflow: hidden;
  }
  #formulario #buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  #formulario #buttons input[type="submit"],
  #formulario #buttons input[type="reset"] {
    min-height: 44px;
    margin: 0;
  }
  #formulario #buttons br { display: none; }
}
