:root {
    --color-blanco: #FFFFFF;
    --pad-lateral: clamp(20px, 6vw, 60px);
    --fuente-titulo: "Baskervville", serif;
    --fuente-texto: "Roboto", sans-serif;

    --radius-xl: 24px;
    --radius-md: 14px;
    --radius-sm: 10px;

    --alto-header: 120px;
}

@media (max-width: 768px) {
    :root {
        --radius-xl: 20px;
        --radius-md: 12px;
        --radius-sm: 8px;
    }
}

/* =========================================================
   RESET BASE
========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
    text-rendering: optimizeLegibility;
    -moz-osx-font-smoothing: grayscale;
    -webkit-font-smoothing: antialiased;
}

html,
body {
    margin: 0;
    padding: 0;
    overflow-y: auto;
}

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

a {
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

/* =========================================================
   ESTRUCTURA GENERAL
========================================================= */

main {
    padding-left: var(--pad-lateral);
    padding-right: var(--pad-lateral);
    padding-top: calc(var(--alto-header) + 12px);
}

h1,
h2,
h3,
h4,
h5,
h6,
.titulo,
.destacado {
    font-family: var(--fuente-titulo);
}

/* =========================================================
   CABECERA
========================================================= */

#cabecera {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    width: 100%;
    height: var(--alto-header);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-left: var(--pad-lateral);
    padding-right: var(--pad-lateral);
    background-color: var(--color-blanco);
    transition: transform 0.4s ease;
}

.cabecera-logo {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.cabecera-logo img {
    width: 70px;
    height: auto;
}

.cabecera-busqueda {
    flex: 0 1 600px;
    display: flex;
    justify-content: center;
    position: relative;
}

.toggle-busqueda {
    display: none;
}

.boton-lupa {
    display: none;
}

.form-busqueda {
    position: relative;
    width: 100%;
}

.campo-busqueda {
    width: 100%;
    height: 52px;
    padding: 0 18px 0 50px;
    border: none;
    border-radius: 14px;
    background-color: #e7e7e7;
    font-family: var(--fuente-texto);
    font-size: 16px;
    color: #1f1f1f;
    outline: none;
}

.campo-busqueda::placeholder {
    color: #6b6b6b;
    font-family: var(--fuente-texto);
}

.form-busqueda::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 18px;
    width: 18px;
    height: 18px;
    border: 2px solid #333333;
    border-radius: 50%;
    transform: translateY(-60%);
}

.form-busqueda::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 33px;
    width: 9px;
    height: 2px;
    background-color: #333333;
    transform: translateY(4px) rotate(45deg);
    transform-origin: left center;
}

.cabecera-contacto {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.boton-contacto {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 22px;
    border-radius: 12px;
    background-color: #1e3a5f;
    color: var(--color-blanco);
    font-family: var(--fuente-texto);
    font-size: 16px;
    font-weight: 600;
    transition: opacity 0.2s ease;
}

.boton-contacto:hover {
    opacity: 0.92;
}

/* =========================================================
   HEADER RESPONSIVE
========================================================= */

@media (max-width: 1024px) {
    #cabecera {
        gap: 24px;
    }

    .cabecera-logo img {
        width: 60px;
    }

    .cabecera-busqueda {
        flex: 1 1 420px;
    }

    .campo-busqueda {
        height: 48px;
        font-size: 15px;
    }

    .boton-contacto {
        min-height: 42px;
        padding: 0 18px;
        font-size: 15px;
    }
}

@media (max-width: 768px) {
    main {
        padding-top: 110px;
    }

    #cabecera {
        height: auto;
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 14px;
        padding-top: 14px;
        padding-bottom: 14px;
    }

    .cabecera-logo {
        flex: initial;
    }

    .cabecera-logo img {
        width: 56px;
    }

    .cabecera-contacto {
        flex: initial;
        justify-content: flex-end;
    }

    .boton-contacto {
        min-height: 42px;
        padding: 0 16px;
        font-size: 14px;
    }

    .cabecera-busqueda {
        flex: initial;
        justify-content: flex-end;
        width: auto;
        position: relative;
    }

    .boton-lupa {
        display: block;
        position: relative;
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background-color: #e7e7e7;
        cursor: pointer;
        flex: 0 0 auto;
    }

    .boton-lupa::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 15px;
        height: 15px;
        border: 2px solid #333333;
        border-radius: 50%;
        transform: translate(-60%, -60%);
    }

    .boton-lupa::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 8px;
        height: 2px;
        background-color: #333333;
        transform: translate(4px, 6px) rotate(45deg);
        transform-origin: left center;
    }

    .form-busqueda {
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        width: min(78vw, 320px);
        opacity: 0;
        pointer-events: none;
        transform: translateY(-8px) scale(0.98);
        transition: opacity 0.22s ease, transform 0.22s ease;
        z-index: 20;
    }

    .toggle-busqueda:checked+.boton-lupa+.form-busqueda {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }

    .campo-busqueda {
        width: 100%;
        height: 46px;
        padding: 0 16px 0 46px;
        font-size: 15px;
        box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
    }

    .form-busqueda::before {
        left: 16px;
        width: 16px;
        height: 16px;
    }

    .form-busqueda::after {
        left: 30px;
        width: 8px;
    }
}

@media (max-width: 480px) {
    main {
        padding-top: 100px;
    }

    #cabecera {
        gap: 12px;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .cabecera-logo img {
        width: 48px;
    }

    .boton-contacto {
        min-height: 40px;
        padding: 0 14px;
        border-radius: 10px;
        font-size: 13px;
    }

    .boton-lupa {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .form-busqueda {
        width: min(84vw, 280px);
    }

    .campo-busqueda {
        height: 44px;
        padding: 0 14px 0 42px;
        border-radius: 12px;
        font-size: 14px;
    }

    .form-busqueda::before {
        left: 14px;
        width: 15px;
        height: 15px;
    }

    .form-busqueda::after {
        left: 27px;
        width: 8px;
    }
}

/* =========================================================
   FOOTER
========================================================= */

#pie-web {
    margin-top: 40px;
    padding-left: var(--pad-lateral);
    padding-right: var(--pad-lateral);
    padding-top: 24px;
    padding-bottom: 24px;
    border-top: 1px solid #e4dccb;
}

.pie-web-superior {
    display: grid;
    grid-template-columns: 1.3fr 1fr auto;
    gap: 24px;
    align-items: start;
}

.pie-web-marca {
    min-width: 0;
}

.pie-web-titulo {
    margin: 0 0 8px;
    font-family: var(--fuente-titulo);
    font-size: clamp(1.05rem, 1vw, 1.25rem);
    line-height: 1.15;
    font-weight: 700;
    color: #2f3023;
}

.pie-web-texto {
    margin: 0;
    font-family: var(--fuente-texto);
    font-size: clamp(0.85rem, 0.8vw, 0.95rem);
    line-height: 1.45;
    color: #7a766c;
}

.pie-web-nav,
.pie-web-redes {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pie-web-nav a,
.pie-web-redes a {
    font-family: var(--fuente-texto);
    font-size: clamp(0.88rem, 0.82vw, 0.96rem);
    line-height: 1.3;
    color: #5f5a56;
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.pie-web-nav a:hover,
.pie-web-redes a:hover {
    color: #2f3023;
    opacity: 0.9;
}

.pie-web-inferior {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee6d8;
}

.pie-web-inferior p {
    margin: 0;
    font-family: var(--fuente-texto);
    font-size: 0.84rem;
    line-height: 1.4;
    color: #8a8578;
}

/* =========================================================
   FOOTER RESPONSIVE
========================================================= */

@media (max-width: 980px) {
    .pie-web-superior {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .pie-web-marca {
        grid-column: 1 / -1;
    }

    .pie-web-nav,
    .pie-web-redes {
        gap: 8px;
    }
}

@media (max-width: 640px) {
    #pie-web {
        margin-top: 32px;
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .pie-web-superior {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .pie-web-marca,
    .pie-web-nav,
    .pie-web-redes {
        grid-column: auto;
    }

    .pie-web-titulo {
        font-size: clamp(1rem, 4vw, 1.2rem);
        line-height: 1.18;
    }

    .pie-web-texto {
        font-size: clamp(0.84rem, 3.4vw, 0.94rem);
        line-height: 1.5;
    }

    .pie-web-nav,
    .pie-web-redes {
        gap: 6px;
        align-items: flex-start;
    }

    .pie-web-nav a,
    .pie-web-redes a {
        font-size: clamp(0.86rem, 3.2vw, 0.95rem);
        line-height: 1.35;
    }

    .pie-web-inferior {
        margin-top: 18px;
        padding-top: 14px;
    }

    .pie-web-inferior p {
        font-size: 0.82rem;
        line-height: 1.45;
        text-align: center;
    }
}