:root {
    --texto-oscuro: #29271f;
    --texto-claro: #f4f0e6;
    --crema: #d8d1bd;
    --borde: rgba(255, 255, 255, 0.18);
    --fondo-oscuro: #11110f;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
}

body.portada {
    color: var(--texto-oscuro);
    background:
        linear-gradient(
            to bottom,
            rgba(255, 255, 255, 0) 0%,
            rgba(72, 65, 52, 0.08) 43%,
            rgba(22, 21, 18, 0.58) 72%,
            rgba(8, 8, 8, 0.96) 100%
        ),
        repeating-linear-gradient(
            0deg,
            rgba(255, 255, 255, 0.06) 0,
            rgba(255, 255, 255, 0.06) 1px,
            rgba(83, 74, 57, 0.045) 1px,
            rgba(83, 74, 57, 0.045) 4px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.035) 0,
            rgba(255, 255, 255, 0.035) 1px,
            rgba(77, 68, 52, 0.045) 1px,
            rgba(77, 68, 52, 0.045) 5px
        ),
        var(--crema);
    background-attachment: fixed;
}

body.interior {
    color: var(--texto-claro);
    background:
        repeating-linear-gradient(
            45deg,
            rgba(255, 255, 255, 0.018) 0,
            rgba(255, 255, 255, 0.018) 2px,
            rgba(0, 0, 0, 0.035) 2px,
            rgba(0, 0, 0, 0.035) 7px
        ),
        linear-gradient(180deg, #3d3a31 0%, #1a1916 42%, #090909 100%);
    background-attachment: fixed;
}

/* CABECERA COMÚN */

.site-header {
    padding: 24px 30px 0;
}

.cabecera {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.marca {
    position: relative;
    z-index: 2;
    display: block;
    flex: 0 0 125px;
    width: 125px;
    height: 125px;
    overflow: hidden;
    border-radius: 50%;
    text-decoration: none;
}

.marca::after {
    content: "INICIO";
    position: absolute;
    left: 50%;
    bottom: 10px;
    padding: 6px 12px;
    color: #fff;
    background: rgba(25, 24, 20, 0.84);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    opacity: 0;
    transform: translate(-50%, 8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.marca:hover::after,
.marca:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.marca:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.85);
    outline-offset: 4px;
}

.logotipo {
    display: block;
    width: 125px;
    height: 125px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.72);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.28),
        0 0 0 1px rgba(42, 38, 29, 0.25);
}

.boton-menu {
    display: none;
}

.navegacion {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    flex: 1 1 auto;
    gap: clamp(14px, 2vw, 38px);
    min-width: 0;
    min-height: 64px;
    margin-left: -62px;
    padding: 10px 82px;
    border-top: 1px solid var(--borde);
    border-bottom: 1px solid rgba(0, 0, 0, 0.45);
    background:
        repeating-linear-gradient(
            45deg,
            rgba(255, 255, 255, 0.035) 0,
            rgba(255, 255, 255, 0.035) 2px,
            rgba(0, 0, 0, 0.045) 2px,
            rgba(0, 0, 0, 0.045) 6px
        ),
        linear-gradient(
            90deg,
            rgba(74, 67, 54, 0.97),
            rgba(32, 30, 26, 0.98)
        );
    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.22),
        inset 0 1px rgba(255, 255, 255, 0.08);
}

.navegacion a {
    display: inline-block;
    flex: 0 0 auto;
    padding: 13px 18px;
    color: var(--texto-claro);
    text-decoration: none;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    border-radius: 3px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.navegacion a:hover,
.navegacion a:focus-visible,
.navegacion a.activo {
    background-color: rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
    outline: none;
}

/* PORTADA */

.inicio-principal {
    min-height: calc(100vh - 149px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 45px 24px 130px;
    text-align: center;
}

.presentacion {
    max-width: 900px;
}

.presentacion h1 {
    margin: 0;
    font-size: clamp(4rem, 13vw, 9rem);
    line-height: 0.9;
    letter-spacing: 0.08em;
    color: rgba(36, 33, 26, 0.92);
}

.especialidad {
    margin: 28px 0 0;
    font-size: clamp(1rem, 2.2vw, 1.45rem);
    letter-spacing: 0.08em;
    color: rgba(43, 39, 31, 0.8);
}

/* PÁGINAS INTERIORES */

.pagina {
    width: min(1380px, calc(100% - 48px));
    margin: 74px auto 100px;
}

.encabezado-pagina {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 44px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.encabezado-pagina h1 {
    margin: 0;
    font-size: clamp(3rem, 8vw, 7rem);
    line-height: 0.88;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.encabezado-pagina p {
    max-width: 560px;
    margin: 0 0 4px;
    color: rgba(244, 240, 230, 0.68);
    line-height: 1.65;
    text-align: right;
}

.contenido-provisional {
    min-height: 48vh;
    display: grid;
    place-items: center;
    padding: 45px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.13);
    background: rgba(255, 255, 255, 0.035);
}

.contenido-provisional h2 {
    margin: 0 0 12px;
    font-size: clamp(1.8rem, 4vw, 3.4rem);
}

.contenido-provisional p {
    max-width: 650px;
    margin: 0;
    color: rgba(244, 240, 230, 0.65);
    line-height: 1.65;
}

/* PORTFOLIO */

.galeria {
    columns: 3;
    column-gap: 22px;
}

.obra {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 22px;
    padding: 0;
    overflow: hidden;
    break-inside: avoid;
    color: #fff;
    font: inherit;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #111;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

.obra img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.35s ease, filter 0.35s ease;
}

.obra-info {
    position: absolute;
    inset: auto 0 0;
    display: block;
    padding: 44px 20px 18px;
    color: #fff;
    text-align: left;
    background: linear-gradient(
        to top,
        rgba(5, 5, 5, 0.95) 0%,
        rgba(5, 5, 5, 0.7) 55%,
        rgba(5, 5, 5, 0) 100%
    );
    transform: translateY(18px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.obra-info strong {
    display: block;
    margin-bottom: 6px;
    font-size: 1.15rem;
}

.obra-info span {
    display: block;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.obra:hover img,
.obra:focus-visible img {
    transform: scale(1.025);
    filter: brightness(0.72);
}

.obra:hover .obra-info,
.obra:focus-visible .obra-info {
    transform: translateY(0);
    opacity: 1;
}

.obra:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

dialog {
    width: min(94vw, 1550px);
    max-height: 94vh;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: #0b0b0a;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.78);
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(4px);
}

.visor-contenido {
    position: relative;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    max-height: 94vh;
}

.visor-contenido img {
    display: block;
    width: 100%;
    max-height: calc(94vh - 72px);
    object-fit: contain;
    background: #0b0b0a;
}

.visor-pie {
    min-height: 72px;
    padding: 18px 75px 18px 22px;
    color: rgba(255, 255, 255, 0.84);
    background: #171714;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.cerrar {
    position: absolute;
    right: 16px;
    bottom: 14px;
    width: 42px;
    height: 42px;
    color: #fff;
    font-size: 1.45rem;
    line-height: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
}

/* TABLET */

@media (max-width: 1080px) {
    .navegacion {
        gap: 6px;
        padding-right: 24px;
    }

    .navegacion a {
        padding: 12px 9px;
        font-size: 0.72rem;
    }

    .galeria {
        columns: 2;
    }
}

/* MÓVIL */

@media (max-width: 700px) {
    .site-header {
        position: relative;
        z-index: 20;
        padding: 12px 14px 0;
    }

    .cabecera {
        justify-content: space-between;
        min-height: 76px;
    }

    .marca,
    .logotipo {
        width: 76px;
        height: 76px;
    }

    .marca {
        flex-basis: 76px;
    }

    .marca::after {
        display: none;
    }

    .boton-menu {
        position: relative;
        z-index: 5;
        display: flex;
        width: 50px;
        height: 50px;
        margin-left: auto;
        padding: 0;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        color: #fff;
        background:
            repeating-linear-gradient(
                45deg,
                rgba(255, 255, 255, 0.04) 0,
                rgba(255, 255, 255, 0.04) 2px,
                rgba(0, 0, 0, 0.04) 2px,
                rgba(0, 0, 0, 0.04) 6px
            ),
            rgba(35, 33, 28, 0.96);
        border: 1px solid rgba(255, 255, 255, 0.28);
        border-radius: 4px;
        cursor: pointer;
    }

    .boton-menu span {
        display: block;
        width: 25px;
        height: 2px;
        background: currentColor;
        transition: transform 0.22s ease, opacity 0.22s ease;
    }

    .boton-menu.activo span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .boton-menu.activo span:nth-child(2) {
        opacity: 0;
    }

    .boton-menu.activo span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .navegacion {
        position: absolute;
        top: calc(100% + 9px);
        left: 0;
        right: 0;
        z-index: 4;
        display: grid;
        justify-content: stretch;
        align-items: stretch;
        gap: 4px;
        min-height: 0;
        margin: 0;
        padding: 8px;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-10px);
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    }

    .navegacion.abierta {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .navegacion a {
        display: block;
        width: 100%;
        padding: 14px 16px;
        font-size: 0.8rem;
        text-align: left;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .navegacion a:last-child {
        border-bottom: 0;
    }

    .inicio-principal {
        min-height: calc(100svh - 88px);
        padding: 50px 18px 105px;
    }

    .presentacion h1 {
        font-size: clamp(3.2rem, 19vw, 5rem);
        letter-spacing: 0.05em;
    }

    .especialidad {
        margin-top: 20px;
        font-size: 0.9rem;
        line-height: 1.6;
        letter-spacing: 0.04em;
    }

    .pagina {
        width: calc(100% - 28px);
        margin: 42px auto 72px;
    }

    .encabezado-pagina {
        display: block;
        margin-bottom: 28px;
        padding-bottom: 22px;
    }

    .encabezado-pagina h1 {
        font-size: clamp(2.3rem, 11vw, 3.4rem);
        line-height: 0.95;
        letter-spacing: 0.035em;
        overflow-wrap: anywhere;
    }

    .encabezado-pagina p {
        max-width: none;
        margin: 18px 0 0;
        font-size: 0.98rem;
        line-height: 1.55;
        text-align: left;
    }

    .contenido-provisional {
        min-height: 42vh;
        padding: 28px 20px;
    }

    .galeria {
        columns: 1;
        column-gap: 0;
    }

    .obra {
        margin-bottom: 20px;
        border-radius: 3px;
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    }

    .obra-info {
        position: static;
        display: block;
        width: 100%;
        padding: 15px 16px 17px;
        opacity: 1;
        transform: none;
        background: #171714;
    }

    .obra-info strong {
        font-size: 1.05rem;
        line-height: 1.3;
    }

    .obra-info span {
        margin-top: 4px;
        font-size: 0.7rem;
        line-height: 1.45;
    }

    .obra:hover img,
    .obra:focus-visible img {
        transform: none;
        filter: none;
    }

    dialog {
        width: 96vw;
        max-height: 92vh;
    }

    .visor-contenido img {
        max-height: calc(92vh - 84px);
    }

    .visor-pie {
        min-height: 84px;
        padding: 16px 64px 16px 16px;
        font-size: 0.84rem;
        line-height: 1.45;
    }
}
