/* =============================================================
   Header — Topbar + Navbar
   Tema Piedrangular
   ============================================================= */

/* ---- CSS Custom Properties ---- */
:root {
    /* Colours */
    --color-primary:        #1a4ddb;
    --color-button-brochre: #1E3FAF;
    --color-button-constanciasbs: #3F6FCB;
    --color-primary-hover:  #1540c0;
    --color-primary-hover-brochure:  #224d9e;
    --color-primary-hover-constanciasbs:  #264dcc;
    --color-primary-dark:   #0b2c5f;
    --color-section-blue:   #1A3A99;   /* blue section backgrounds */
    --color-navy:           #061539;   /* footer background */
    --color-topbar-bg:      #091e3e00;
    --color-topbar-border:  rgba(255, 255, 255, 0.08);
    --color-white:          #ffffff;
    --color-white-dim:      rgba(255, 255, 255, 0.85);

    /* Typography */
    --font-body:            'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-body:       16px;
    --font-size-sm:         0.8125rem;  /* 13px */
    --font-size-base:       0.9375rem;  /* 15px */
    --line-height-body:     1.6;

    /* Layout */
    --transition-base:      0.3s ease;
    --container-max:        1280px;
    --container-px:         1.5rem;
}

/* ---- Global typography reset ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    font-size: var(--font-size-body);
    line-height: var(--line-height-body);
    color: #222;
    -webkit-font-smoothing: antialiased;
}

body.admin-bar header {
    margin-top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar header {
        margin-top: 46px;
    }
}

/* ---- Global box-sizing (scoped to header) ---- */
.site-header *,
.site-header *::before,
.site-header *::after {
    box-sizing: border-box;
}

/* ---- Container ---- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin-right: auto;
    margin-left: auto;
    padding-right: var(--container-px);
    padding-left: var(--container-px);
}

/* =============================================================
   Site Header — wrapper
   ============================================================= */
.site-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    transition:
        background-color var(--transition-base),
        box-shadow       var(--transition-base);
}

/* Scrolled state — toggled by header.js */
.site-header.is-scrolled {
    position: fixed;
    background-color: var(--color-primary-dark);
    box-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

/* =============================================================
   Topbar
   ============================================================= */
.topbar {
    background-color: var(--color-topbar-bg);
    border-bottom: 1px solid var(--color-topbar-border);
    font-size: var(--font-size-sm);
    color: var(--color-white-dim);
    padding: 0.5rem 0;
}

.topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* ---- Contact items ---- */
.topbar__contact {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.topbar__item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--color-white-dim);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

a.topbar__item--link {
    transition: color var(--transition-base);
}

a.topbar__item--link:hover {
    color: var(--color-white);
}

.topbar__item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* ---- Social icons ---- */
.topbar__social {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.topbar__social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: var(--color-white-dim);
    text-decoration: none;
    transition:
        background-color 0.2s,
        border-color     0.2s,
        color            0.2s;
}

.topbar__social-link:hover {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.45);
    color: var(--color-white);
}

/* =============================================================
   Navbar
   ============================================================= */
.navbar {
    padding: 1rem 0;
    transition: padding var(--transition-base);
}

.site-header.is-scrolled .navbar {
    padding: 0.625rem 0;
}

.navbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

/* ---- Logo ---- */
.navbar__logo {
    flex-shrink: 0;
    line-height: 0;
}

.navbar__logo a {
    display: block;
}

.navbar__logo img {
    display: block;
    max-height: 64px;
    width: auto;
    transition: max-height var(--transition-base);
}

.site-header.is-scrolled .navbar__logo img {
    max-height: 52px;
}

.navbar__site-name {
    color: var(--color-white);
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -0.01em;
}

/* ---- Primary navigation ---- */
.navbar__nav {
    flex: 1;
}

.nav-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    position: relative;
}

.nav-menu li a {
    display: block;
    color: var(--color-white);
    text-decoration: none;
    font-size: var(--font-size-base);
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 0.25rem 0;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.nav-menu li a:hover,
.nav-menu li.current-menu-item > a,
.nav-menu li.current-page-ancestor > a {
    opacity: 0.7;
    color: #e0f1ff;}

/* Active underline indicator */
.nav-menu li.current-menu-item > a::after {
    content: '';
    display: block;
    height: 2px;
    background-color: var(--color-white);
    border-radius: 2px;
    margin-top: 2px;
    opacity: 0.6;
}

/* ---- Action buttons ---- */
.navbar__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Base button */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1.25rem;
    border-radius: 3px;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    transition:
        background-color 0.2s,
        opacity          0.2s;
}

/* Brochure button */
.btn--brochure {
    background-color: var(--color-button-brochre);
    height: 100%;
    padding-top: 20px;
    padding-bottom: 20px;
    color: var(--color-white);
}

.btn--brochure:hover {
    background-color: var(--color-primary-hover-brochure);
}

/* Constancia SBS button */
.btn--sbs {
    background-color: var(--color-button-constanciasbs);
    height: 100%;
    padding-top: 20px;
    padding-bottom: 20px;
    color: var(--color-white);
}

.btn--sbs:hover {
    background-color: var(--color-primary-hover-constanciasbs);
}

/* =============================================================
   Mobile toggle button (hamburger)
   ============================================================= */
.navbar__toggle {
    display: none; /* hidden on desktop */
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    padding: 0;
    transition:
        background-color 0.2s,
        border-color     0.2s;
}

.navbar__toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color:     rgba(255, 255, 255, 0.65);
}

.navbar__toggle:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* =============================================================
   Responsive
   ============================================================= */

/* ---- Tablet: ≤1024px ----
   Nav links don't fit; swap actions for the hamburger toggle.
   ------------------------------------------------------------ */
@media (max-width: 1024px) {
    .navbar__nav {
        display: none;
    }

    .navbar__actions {
        display: none;
    }

    .navbar__toggle {
        display: flex;
    }
}

/* ---- Mobile: ≤768px ----
   Hide topbar entirely; keep only the slim navbar.
   Give the header a subtle dark tint so logo + toggle are
   readable over the banner even before the user scrolls.
   ------------------------------------------------------------ */
@media (max-width: 768px) {
    /* Remove topbar — logo + hamburger is the full header */
    .topbar {
        display: none;
    }

    /* Subtle dark backdrop so the header is legible at page-top
       (before JS applies .is-scrolled). The banner image shows
       through but text/icons remain clearly visible. */
    .site-header:not(.is-scrolled) {
        background-color: rgba(6, 21, 57, 0.55);
    }

    /* Tighten navbar vertical padding on mobile */
    .navbar {
        padding: 0.625rem 0;
    }

    /* Slightly smaller logo on mobile */
    .navbar__logo img {
        max-height: 52px;
    }
}

/* =============================================================
   Mobile off-canvas drawer
   ============================================================= */

/* ---- Overlay backdrop ---- */
.mobile-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 998;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-drawer-overlay.is-open {
    display: block;
    opacity: 1;
}

/* ---- Drawer panel ---- */
.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 80%;
    max-width: 320px;
    z-index: 999;
    background-color: var(--color-navy, #061539);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(-100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-overflow-scrolling: touch;
}

.mobile-drawer.is-open {
    transform: translateX(0);
}

/* ---- Drawer header (logo + close) ---- */
.mobile-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.mobile-drawer__logo {
    line-height: 0;
}

.mobile-drawer__logo img {
    max-height: 44px;
    width: auto;
    display: block;
}

.mobile-drawer__site-name {
    color: var(--color-white);
    font-size: 1.125rem;
    font-weight: 700;
    text-decoration: none;
}

.mobile-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    color: var(--color-white);
    cursor: pointer;
    padding: 0;
    transition:
        background-color 0.2s,
        border-color     0.2s;
}

.mobile-drawer__close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.mobile-drawer__close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* ---- Nav menu ---- */
.mobile-drawer__nav-wrap {
    flex: 1;
    padding: 0.5rem 0;
}

.mobile-drawer__nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-drawer__nav li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mobile-drawer__nav li a {
    display: block;
    padding: 0.8rem 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: background-color 0.18s, color 0.18s;
}

.mobile-drawer__nav li a:hover,
.mobile-drawer__nav li.current-menu-item > a,
.mobile-drawer__nav li.current-page-ancestor > a {
    background-color: rgba(255, 255, 255, 0.07);
    color: var(--color-white);
}

/* Sub-menus — indented one level */
.mobile-drawer__nav .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    background-color: rgba(0, 0, 0, 0.18);
}

.mobile-drawer__nav .sub-menu li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.mobile-drawer__nav .sub-menu li:last-child {
    border-bottom: none;
}

.mobile-drawer__nav .sub-menu li a {
    padding-left: 2.25rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.75);
}

.mobile-drawer__nav .sub-menu li a:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--color-white);
}

/* ---- Contact block ---- */
.mobile-drawer__contact {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.mobile-drawer__contact-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: color 0.18s;
}

.mobile-drawer__contact-item:hover {
    color: var(--color-white);
}

.mobile-drawer__contact-item svg {
    flex-shrink: 0;
    opacity: 0.65;
}

/* ---- Social icons ---- */
.mobile-drawer__social {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.mobile-drawer__social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition:
        background-color 0.2s,
        border-color     0.2s,
        color            0.2s;
}

.mobile-drawer__social-link:hover {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.45);
    color: var(--color-white);
}

/* ---- CTA buttons ---- */
.mobile-drawer__cta {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 1rem 1.25rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.mobile-drawer__btn {
    display: block;
    text-align: center;
    padding: 0.65rem 1rem;
    border-radius: 3px;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
    transition: background-color 0.2s;
}

.mobile-drawer__btn--brochure {
    background-color: var(--color-button-brochre, #1E3FAF);
    color: var(--color-white);
}

.mobile-drawer__btn--brochure:hover {
    background-color: var(--color-primary-hover-brochure, #224d9e);
}

.mobile-drawer__btn--sbs {
    background-color: var(--color-button-constanciasbs, #3F6FCB);
    color: var(--color-white);
}

.mobile-drawer__btn--sbs:hover {
    background-color: var(--color-primary-hover-constanciasbs, #264dcc);
}

/* ---- Desktop: ensure drawer is fully hidden (no transition flash) ---- */
@media (min-width: 1025px) {
    .mobile-drawer,
    .mobile-drawer-overlay {
        display: none !important;
    }
}
