/* ==========================================================================
   Trufitas Artesanas — estilos generales
   Hoja de estilo única para toda la web. Mobile-first: primero se pensó
   para móvil y luego se adapta a pantallas más grandes con @media.
   ========================================================================== */

/* --- Tipografías propias, guardadas dentro de la web --- */
@font-face {
    font-family: "Playfair Display";
    src: url("fuentes/playfair-display.woff2") format("woff2");
    font-weight: 400 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "DM Sans";
    src: url("fuentes/dm-sans.woff2") format("woff2");
    font-weight: 300 800;
    font-style: normal;
    font-display: swap;
}

/* --- Variables de color y estilo --- */
:root {
    --color-fondo: #F7F0E6;
    --color-fondo-alterno: #EFE4D3;
    --color-texto: #5C4A32;
    --color-acento: #D4956A;
    --color-boton-fondo: #5C4A32;
    --color-boton-texto: #F7F0E6;
    --color-blanco: #FFFDF9;

    --fuente-titulos: "Playfair Display", Georgia, serif;
    --fuente-texto: "DM Sans", Arial, sans-serif;

    --radio-tarjeta: 18px;
    --radio-boton: 999px;
    --sombra-suave: 0 6px 20px rgba(92, 74, 50, 0.10);
    --ancho-maximo: 1120px;
}

/* --- Reinicio básico --- */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--color-fondo);
    color: var(--color-texto);
    font-family: var(--fuente-texto);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
}

h1, h2, h3, h4 {
    font-family: var(--fuente-titulos);
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 0.6em 0;
}

h1 { font-size: clamp(2rem, 6vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); }
h3 { font-size: clamp(1.25rem, 3.5vw, 1.6rem); }

p { margin: 0 0 1em 0; }

.contenedor {
    max-width: var(--ancho-maximo);
    margin: 0 auto;
    padding: 0 1.25rem;
}

.seccion {
    padding: 3.5rem 0;
}

.seccion--alterna {
    background: var(--color-fondo-alterno);
}

.centro { text-align: center; }

.linea-acento {
    width: 64px;
    height: 3px;
    background: var(--color-acento);
    border: none;
    margin: 0.6em auto 1.4em auto;
}

.linea-acento--izq {
    margin-left: 0;
}

/* --- Botones --- */
.boton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6em;
    padding: 1rem 2rem;
    border-radius: var(--radio-boton);
    background: var(--color-boton-fondo);
    color: var(--color-boton-texto);
    font-family: var(--fuente-texto);
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    border: 2px solid var(--color-boton-fondo);
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
    min-height: 52px;
}

.boton:hover, .boton:focus-visible {
    transform: translateY(-2px);
    opacity: 0.92;
}

.boton--secundario {
    background: transparent;
    color: var(--color-boton-fondo);
}

.boton--ancho {
    width: 100%;
}

.boton img {
    width: 22px;
    height: 22px;
}

/* --- Cabecera --- */
.cabecera {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--color-fondo);
    border-bottom: 1px solid rgba(92, 74, 50, 0.12);
}

.cabecera__interior {
    max-width: var(--ancho-maximo);
    margin: 0 auto;
    padding: 0.8rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cabecera__logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--color-texto);
}

.cabecera__logo img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.cabecera__logo span {
    font-family: var(--fuente-titulos);
    font-weight: 700;
    font-size: 1.15rem;
}

.boton-menu {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.boton-menu span {
    display: block;
    width: 26px;
    height: 2px;
    background: var(--color-texto);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-principal {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-fondo);
    border-bottom: 1px solid rgba(92, 74, 50, 0.12);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.menu-principal.abierto {
    max-height: 480px;
}

.menu-principal ul {
    list-style: none;
    margin: 0;
    padding: 0.5rem 1.25rem 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
}

.menu-principal a {
    display: block;
    padding: 0.75rem 0;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid rgba(92, 74, 50, 0.08);
}

@media (min-width: 860px) {
    .boton-menu { display: none; }

    .menu-principal {
        position: static;
        max-height: none;
        overflow: visible;
        border-bottom: none;
        background: none;
    }

    .menu-principal ul {
        flex-direction: row;
        padding: 0;
        gap: 1.6rem;
    }

    .menu-principal a {
        padding: 0.4rem 0;
        border-bottom: none;
    }
}

/* --- Héroe de inicio --- */
.heroe {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: 78vh;
    background-size: cover;
    background-position: center;
    color: var(--color-blanco);
}

.heroe::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(92,74,50,0.05) 0%, rgba(45,34,20,0.55) 100%);
}

.heroe__contenido {
    position: relative;
    z-index: 1;
    padding: 2.5rem 1.25rem 3rem 1.25rem;
    max-width: var(--ancho-maximo);
    margin: 0 auto;
    width: 100%;
}

.heroe h1, .heroe p {
    color: var(--color-blanco);
}

/* --- Rejilla de tarjetas (inicio, "para regalar") --- */
.rejilla {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .rejilla--3 { grid-template-columns: repeat(3, 1fr); }
}

/* --- Galería de productos --- */
.filtros {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.filtro {
    padding: 0.5rem 0.85rem;
    border-radius: var(--radio-boton);
    border: 1.5px solid var(--color-acento);
    background: transparent;
    color: var(--color-texto);
    font-family: var(--fuente-texto);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

@media (min-width: 640px) {
    .filtro {
        padding: 0.55rem 1.1rem;
        font-size: 0.92rem;
    }
}

.filtro.activo {
    background: var(--color-boton-fondo);
    border-color: var(--color-boton-fondo);
    color: var(--color-boton-texto);
}

.rejilla-productos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 720px) {
    .rejilla-productos { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
}

@media (min-width: 1020px) {
    .rejilla-productos { grid-template-columns: repeat(4, 1fr); }
}

.tarjeta-producto {
    background: var(--color-blanco);
    border-radius: var(--radio-tarjeta);
    overflow: hidden;
    box-shadow: var(--sombra-suave);
    text-decoration: none;
    color: var(--color-texto);
    display: flex;
    flex-direction: column;
}

.tarjeta-producto__imagen {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    position: relative;
}

.tarjeta-producto__imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.etiqueta-pack {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    background: var(--color-fondo);
    border: 1px solid var(--color-acento);
    color: var(--color-texto);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radio-boton);
}

.tarjeta-producto__info {
    padding: 0.9rem 1rem 1.1rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.tarjeta-producto__nombre {
    font-family: var(--fuente-titulos);
    font-weight: 700;
    font-size: 1.02rem;
}

.tarjeta-producto__precio {
    font-weight: 700;
    display: flex;
    flex-wrap: wrap;
}

.precio-antes,
.precio-actual {
    /* El número y el símbolo "€" no deben partirse nunca entre dos líneas.
       Si no cabe todo junto, es el bloque completo (tachado + nuevo) el que
       pasa a su propia línea, no el número suelto del símbolo. */
    white-space: nowrap;
}

.precio-antes {
    text-decoration: line-through;
    opacity: 0.55;
    margin-right: 0.4em;
    font-weight: 400;
}

/* --- Ficha de producto --- */
.ficha-producto {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 860px) {
    .ficha-producto { grid-template-columns: 1.1fr 1fr; align-items: start; }
}

.carrusel {
    display: flex;
    align-items: center;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    border-radius: var(--radio-tarjeta);
    box-shadow: var(--sombra-suave);
    -webkit-overflow-scrolling: touch;
    background: var(--color-fondo);
}

.carrusel::-webkit-scrollbar { display: none; }

.carrusel img {
    flex: 0 0 100%;
    scroll-snap-align: start;
    width: 100%;
    height: auto;
    display: block;
}

.carrusel-puntos {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.9rem;
}

.carrusel-puntos span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(92, 74, 50, 0.25);
}

.carrusel-puntos span.activo {
    background: var(--color-boton-fondo);
}

.precio-producto {
    font-family: var(--fuente-titulos);
    font-size: 1.8rem;
    font-weight: 700;
}

.lista-simple {
    list-style: none;
    padding: 0;
    margin: 0 0 1.2rem 0;
}

.lista-simple li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(92, 74, 50, 0.12);
}

.lista-simple li strong {
    display: inline-block;
    min-width: 110px;
}

.aviso-caja {
    background: var(--color-fondo-alterno);
    border-left: 3px solid var(--color-acento);
    padding: 1rem 1.2rem;
    border-radius: 10px;
    margin: 1.2rem 0;
}

.botones-fila {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1.3rem;
}

/* --- Formularios --- */
.formulario {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 460px;
}

.formulario label {
    font-weight: 600;
    margin-bottom: 0.35rem;
    display: block;
}

.formulario input[type="text"],
.formulario input[type="email"] {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1.5px solid rgba(92, 74, 50, 0.3);
    background: var(--color-blanco);
    font-family: var(--fuente-texto);
    font-size: 1rem;
    color: var(--color-texto);
}

.formulario input:focus {
    outline: 2px solid var(--color-acento);
    outline-offset: 1px;
}

.campo-casilla {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.92rem;
}

.campo-casilla input { margin-top: 0.3rem; }

/* --- Pie de página --- */
.pie {
    border-top: 1px solid rgba(92, 74, 50, 0.15);
    padding: 2.5rem 0 2rem 0;
    margin-top: 3rem;
    font-size: 0.92rem;
}

.pie__enlaces {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.6rem;
    margin-bottom: 1.4rem;
}

.pie__enlaces a { text-decoration: none; }
.pie__enlaces a:hover { text-decoration: underline; }

.pie__iconos {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.pie__iconos img { width: 28px; height: 28px; }

.pie small { opacity: 0.75; }

/* --- Utilidades --- */
.oculto-visualmente {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

.texto-envolvente { max-width: 65ch; }
