/* Carta interactiva (isla Preact): la hoja blanca con bandas de color por categoría. */
/* En la capa `components`, como el resto del sistema: así mandan las utilidades de Tailwind
   (por ejemplo `lg:hidden`). El orden se declara aquí también por si esta hoja carga antes. */
@layer theme, base, components, utilities;

@layer components {
  .carta-barra {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    margin-bottom: 1.75rem;
    padding-block: 0.9rem;
    border-block: 2px solid #000;
  }
  .carta-barra.fija {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #efe9ce;
  }
  .pestanas {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .pestana {
    min-height: 2.6rem;
    padding: 0.4rem 1.05rem;
    border: 2px solid #000;
    border-radius: 999px;
    background: #fff;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    transition: translate 0.2s ease;
  }
  .pestana:hover {
    translate: 0 -2px;
  }
  .pestana[aria-selected='true'] {
    background: #000;
    color: #fff;
  }
  .pestana[aria-selected='true'][data-color='carmesi'] {
    background: #ff346f;
    color: #000;
  }
  .pestana[aria-selected='true'][data-color='amarillo'] {
    background: #f2de77;
    color: #000;
  }
  .buscador {
    position: relative;
    flex: 1 1 16rem;
    max-width: 22rem;
  }
  .buscador input {
    width: 100%;
    min-height: 2.6rem;
    padding: 0.45rem 1rem 0.45rem 2.4rem;
    border: 2px solid #000;
    border-radius: 999px;
    background: #fff;
    font: inherit;
  }
  .buscador svg {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    width: 1.05rem;
    translate: 0 -50%;
    pointer-events: none;
  }

  .hoja {
    display: grid;
    overflow: hidden;
    border: 2px solid #000;
    border-radius: 1.1rem;
    background: #fff;
    box-shadow: 0.6rem 0.6rem 0 #000;
  }
  .hoja.una {
    max-width: 46rem;
    margin-inline: auto;
  }
  @media (min-width: 1024px) {
    .hoja.tres {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .hoja.tres .columna + .columna {
      border-left: 2px solid #000;
    }
  }
  @media (max-width: 1023px) {
    .columna + .columna {
      border-top: 2px solid #000;
    }
  }
  .banda {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.2rem;
    border-bottom: 2px solid #000;
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 600;
  }
  .banda small {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
  }
  .banda-carmesi {
    background: linear-gradient(100deg, #ff346f, #ff346f 55%, #f8ebae);
  }
  .banda-amarillo {
    background: linear-gradient(100deg, #f2de77, #f8ebae);
  }
  .banda-negro {
    background: #000;
    color: #fff;
  }
  .banda-negro .nombre-banda {
    background: linear-gradient(95deg, #ff346f, #f2de77);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  .carta-subgrupo {
    padding: 0.65rem 1.2rem;
    border-block: 1px solid #000;
    background: var(--color-crema);
    font-weight: 800;
  }

  .filas {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .fila {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.2rem 0.75rem;
    align-items: start;
    padding: 0.85rem 1.2rem;
    border-bottom: 1px solid rgb(0 0 0 / 0.12);
  }
  .fila:last-child {
    border-bottom: 0;
  }
  .fila b {
    display: block;
    font-weight: 700;
    line-height: 1.25;
  }
  .fila small {
    display: block;
    margin-top: 0.15rem;
    color: rgb(0 0 0 / 0.7);
    font-size: 0.82rem;
  }
  .fila-precio {
    font-weight: 800;
    white-space: nowrap;
  }
  .fila-acciones {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.45rem;
  }
  .fila-en-cita::before {
    content: '';
    position: absolute;
    left: 0;
    top: 18%;
    bottom: 18%;
    width: 0.3rem;
    border-radius: 0 3px 3px 0;
    background: #ff346f;
  }
  .accion {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 2.5rem;
    padding: 0.35rem 0.9rem;
    border: 2px solid #000;
    border-radius: 999px;
    background: #fff;
    color: #000;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: translate 0.2s ease;
  }
  .accion:hover {
    translate: 0 -2px;
  }
  .accion svg {
    width: 1.05rem;
    height: 1.05rem;
    flex: none;
  }
  .accion-wa {
    background: linear-gradient(135deg, #ff346f, #f2de77);
  }
  .accion-anadir[aria-pressed='true'] {
    background: #000;
    color: #f2de77;
  }
  .accion:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    translate: none;
  }
  /* En escritorio con columnas, las acciones son dos botones redondos junto al precio. */
  @media (min-width: 1024px) {
    .hoja.tres .fila {
      grid-template-columns: minmax(0, 1fr) auto auto;
    }
    .hoja.tres .fila-acciones {
      grid-column: auto;
      flex-wrap: nowrap;
      margin-top: 0;
    }
    .hoja.tres .accion {
      width: 2.5rem;
      padding: 0;
    }
    .hoja.tres .accion-texto {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }
  }
  .fila-motivo {
    grid-column: 1 / -1;
    margin-top: 0.4rem;
    padding: 0.3rem 0.6rem;
    border-radius: 0.45rem;
    background: #f8ebae;
    font-size: 0.78rem;
  }
  .carta-vacia {
    padding: 2rem 1.2rem;
    text-align: center;
  }
  .carta-notas {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.75rem;
    margin-top: 1.5rem;
    font-size: 0.88rem;
  }
  .carta-notas span::before {
    content: '✦ ';
    color: #ff346f;
  }

  @media (prefers-reduced-motion: no-preference) {
    .filas.recien > li {
      animation: fila-entra 0.4s ease both;
      animation-delay: calc(var(--i, 0) * 35ms);
    }
  }
  @keyframes fila-entra {
    from {
      opacity: 0;
      translate: 0 0.6rem;
    }
  }
}
