:root {
    --bf-ink: #1f2933;
    --bf-graphite: #2d3844;
    --bf-gold: #8c8578;
    --bf-sand: #f6f7f8;
    --bf-cream: #ffffff;
    --bf-white: #ffffff;
    --bf-line: rgba(31, 41, 51, 0.1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", sans-serif;
    font-weight: 400;
    color: var(--bf-ink);
    background: var(--bf-sand);
}

a {
    color: inherit;
    text-decoration: none;
}

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

.main-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid var(--bf-line);
}

.header-inner {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    min-height: 86px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.brand img {
    width: 78px;
    height: auto;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-copy strong {
    font-size: 1rem;
    letter-spacing: 0.14em;
    font-weight: 600;
    color: var(--bf-graphite);
}

.brand-copy span {
    font-size: 0.88rem;
    color: rgba(31, 41, 51, 0.72);
    font-weight: 400;
}

.main-nav {
    margin-left: auto;
    flex: 1 1 auto;
    min-width: 0;
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    margin: 0;
    padding: 0;
}

.nav-links > li {
    display: flex;
    align-items: center;
}

.nav-links a {
    font-size: 0.94rem;
    font-weight: 400;
    color: var(--bf-graphite);
}

.nav-parent > a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-links a:hover {
    color: var(--bf-ink);
}

.nav-caret {
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-1px);
    transition: transform 0.2s ease;
}

.has-submenu {
    position: relative;
}

.nav-parent {
    display: flex;
    align-items: center;
    gap: 6px;
}

.submenu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 280px;
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 14px;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.99);
    border: 1px solid var(--bf-line);
    box-shadow: none;
}

.submenu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -12px;
    height: 12px;
}

.submenu a {
    display: block;
    padding: 8px 10px;
    border-radius: 0;
    font-size: 0.92rem;
    line-height: 1.35;
    font-weight: 400;
}

.submenu a:hover {
    background: rgba(31, 41, 51, 0.04);
}

.has-submenu:hover .submenu,
.has-submenu:focus-within .submenu,
.has-submenu.open .submenu {
    display: block;
}

.has-submenu.open .nav-caret,
.has-submenu:hover .nav-caret,
.has-submenu:focus-within .nav-caret {
    transform: rotate(225deg) translateY(-1px);
}

.header-contact {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    font-size: 0.92rem;
    font-weight: 400;
    min-width: 150px;
    flex-shrink: 0;
    white-space: nowrap;
}

.header-contact a {
    white-space: nowrap;
}

.header-contact a:hover {
    color: var(--bf-ink);
}

.mobile-menu-toggle {
    display: none;
    margin-left: auto;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: var(--bf-graphite);
    cursor: pointer;
}

.mobile-menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 4px auto;
    background: var(--bf-white);
}

@media (max-width: 980px) {
    .brand-copy span,
    .header-contact {
        display: none;
    }

    .mobile-menu-toggle {
        display: inline-block;
    }

    .main-nav {
        flex: initial;
        position: absolute;
        top: calc(100% + 1px);
        left: 16px;
        right: 16px;
        display: none;
        background: rgba(255, 255, 255, 0.99);
        border: 1px solid var(--bf-line);
        border-radius: 0;
        box-shadow: none;
        padding: 20px;
    }

    .main-nav.active {
        display: block;
    }

    .nav-links {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 14px;
    }

    .nav-links > li {
        display: block;
        width: 100%;
    }

    .has-submenu {
        width: 100%;
    }

    .nav-parent {
        width: 100%;
    }

    .nav-parent > a {
        width: 100%;
        justify-content: space-between;
    }

    .nav-caret {
        display: inline-block;
    }

    .submenu {
        position: static;
        display: none;
        min-width: 0;
        width: 100%;
        max-width: 100%;
        margin-top: 8px;
        padding: 10px 10px 10px 18px;
        box-shadow: none;
        border-radius: 0;
        background: rgba(31, 41, 51, 0.03);
        border: 0;
    }

    .submenu a {
        padding-left: 14px;
    }

    .has-submenu:hover .submenu,
    .has-submenu:focus-within .submenu {
        display: none;
    }

    .has-submenu.open .submenu {
        display: block;
    }

    .has-submenu.open .nav-caret {
        transform: rotate(225deg) translateY(-1px);
    }
}

/* La marca conserva el bloc de text al costat de l'anagrama mentre el menú és d'escriptori. */
.brand {
    flex: 0 0 auto;
}

.brand-copy {
    flex: 0 0 auto;
}

.brand-copy span {
    white-space: nowrap;
}

@media (min-width: 981px) {
    .main-nav {
        transform: translateX(20px);
    }
}

.nav-links a,
.header-contact a {
    display: inline-block;
    transition: color 180ms ease, transform 180ms ease;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.header-contact a:hover,
.header-contact a:focus-visible {
    color: #7f1d3d;
    transform: translateX(4px);
}

.nav-caret {
    display: inline-block;
}
