/* =========================================================
   LPI — HEADER COMPONENT
   LetrasParaImprimir
   Shared site header — brand design (violet / pink)
   Same class names, same HTML, same JS hooks.
   ========================================================= */


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

.site-header {
    --lpi-hd-a: #6d5dfc;
    --lpi-hd-b: #ec4899;
    --lpi-hd-c: #f59e0b;
    --lpi-hd-tint: rgba(109, 93, 252, 0.10);
    --lpi-hd-tint-strong: rgba(109, 93, 252, 0.16);

    position: relative;
    z-index: 1000;
    width: 100%;

    background: var(--lpi-color-surface, #ffffff);
    border-bottom: 1px solid var(--lpi-color-border, #e5e7eb);
    box-shadow: 0 8px 24px -16px rgba(109, 93, 252, 0.45);
}


/* Brand colour strip on top of the header */
.site-header::before {
    content: "";
    display: block;
    width: 100%;
    height: 4px;
    background: linear-gradient(
        90deg,
        var(--lpi-hd-a) 0%,
        var(--lpi-hd-b) 60%,
        var(--lpi-hd-c) 100%
    );
}


/* =========================================================
   HEADER INNER
   ========================================================= */

.site-header__inner {
    width: 100%;
    max-width: var(--lpi-container-max-width, 1200px);
    min-height: 68px;
    margin: 0 auto;
    padding: 0 var(--lpi-space-page, 20px);

    display: flex;
    align-items: center;
    gap: var(--lpi-space-md, 16px);
}


/* =========================================================
   BRAND
   ========================================================= */

.site-header__brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;

    min-width: 0;
    flex: 0 0 auto;

    color: var(--lpi-color-text, #111827);
    text-decoration: none;
}


.site-header__brand:focus-visible {
    outline: 2px solid var(--lpi-hd-a);
    outline-offset: 4px;
    border-radius: 12px;
}


/* =========================================================
   LOGO — rounded tile
   ========================================================= */

.site-header__logo {
    display: block;
    box-sizing: border-box;

    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    padding: 5px;

    object-fit: contain;
    object-position: center;

    background: var(--lpi-hd-tint);
    border: 1px solid var(--lpi-hd-tint-strong);
    border-radius: 12px;

    transition:
        transform 0.2s ease,
        background-color 0.2s ease;
}


.site-header__brand:hover .site-header__logo {
    transform: rotate(-6deg) scale(1.05);
    background: var(--lpi-hd-tint-strong);
}


/* =========================================================
   BRAND TEXT — gradient wordmark
   ========================================================= */

.site-header__brand-text {
    display: block;

    color: var(--lpi-hd-a);

    font-size: 18px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.01em;

    white-space: nowrap;
}


@supports (-webkit-background-clip: text) or (background-clip: text) {

    .site-header__brand-text {
        background: linear-gradient(
            90deg,
            var(--lpi-hd-a) 0%,
            var(--lpi-hd-b) 100%
        );
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        color: transparent;
    }

}


/* =========================================================
   MOBILE NAVIGATION BUTTON
   ========================================================= */

.site-nav-toggle {
    display: none;

    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    margin-left: auto;
    padding: 0;

    border: 1.5px solid var(--lpi-hd-tint-strong);
    border-radius: 12px;

    background: var(--lpi-hd-tint);
    color: var(--lpi-hd-a);

    font: inherit;
    font-size: 20px;
    line-height: 1;

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}


.site-nav-toggle:hover {
    background: var(--lpi-hd-tint-strong);
    border-color: var(--lpi-hd-a);
}


.site-nav-toggle:focus-visible {
    outline: 2px solid var(--lpi-hd-a);
    outline-offset: 2px;
}


/* =========================================================
   PRIMARY NAVIGATION
   ========================================================= */

.site-nav {
    display: flex;
    align-items: center;

    gap: 4px;

    margin-left: auto;
}


/* =========================================================
   NAVIGATION LINK — pill with animated underline bar
   ========================================================= */

.site-nav__link {
    position: relative;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 40px;
    padding: 0 14px;

    border-radius: 999px;

    color: var(--lpi-color-text-muted, #4b5563);
    text-decoration: none;

    font-size: 14px;
    line-height: 1.2;
    font-weight: 600;

    white-space: nowrap;

    transition:
        color 0.15s ease,
        background-color 0.15s ease;
}


.site-nav__link::after {
    content: "";

    position: absolute;
    left: 50%;
    bottom: 5px;

    width: 18px;
    height: 3px;

    border-radius: 3px;
    background: linear-gradient(
        90deg,
        var(--lpi-hd-a),
        var(--lpi-hd-b)
    );

    transform: translateX(-50%) scaleX(0);
    transform-origin: center;

    transition: transform 0.2s ease;
}


.site-nav__link:hover {
    color: var(--lpi-hd-a);
    background: var(--lpi-hd-tint);
}


.site-nav__link:hover::after,
.site-nav__link[aria-current="page"]::after {
    transform: translateX(-50%) scaleX(1);
}


.site-nav__link[aria-current="page"] {
    color: var(--lpi-hd-a);
    background: var(--lpi-hd-tint);
}


.site-nav__link:focus-visible {
    outline: 2px solid var(--lpi-hd-a);
    outline-offset: 2px;
}


/* =========================================================
   THEME TOGGLE — gradient pill
   ========================================================= */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 6px;

    min-height: 40px;
    padding: 0 14px;
    margin-left: 10px;

    border: 1.5px solid var(--lpi-hd-a);
    border-radius: 999px;

    background: transparent;
    color: var(--lpi-hd-a);

    font: inherit;
    font-size: 14px;
    font-weight: 700;

    cursor: pointer;
    white-space: nowrap;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease;
}


.theme-toggle:hover {
    background: linear-gradient(
        90deg,
        var(--lpi-hd-a),
        var(--lpi-hd-b)
    );
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 6px 16px -6px rgba(109, 93, 252, 0.6);
}


.theme-toggle:focus-visible {
    outline: 2px solid var(--lpi-hd-a);
    outline-offset: 3px;
}


/* =========================================================
   THEME ICON
   ========================================================= */

.theme-toggle__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 20px;
    height: 20px;

    line-height: 1;
}


/* =========================================================
   THEME TEXT
   ========================================================= */

.theme-toggle__text {
    display: inline-block;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {

    .site-header__inner {
        min-height: 62px;
    }


    .site-nav {
        gap: 2px;
    }


    .site-nav__link {
        padding: 0 10px;
        font-size: 13px;
    }


    .theme-toggle {
        margin-left: 6px;
        padding: 0 10px;
    }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 880px) {

    .site-header__inner {
        position: relative;

        min-height: 62px;

        flex-wrap: wrap;
    }


    /* Mobile menu button */

    .site-nav-toggle {
        display: inline-flex;
    }


    /* Navigation panel */

    .site-nav {
        display: none;

        width: 100%;

        flex-direction: column;
        align-items: stretch;

        order: 10;

        gap: 4px;
        margin-left: 0;

        padding: 10px 0 14px;

        border-top: 1px dashed var(--lpi-hd-tint-strong);
    }


    .site-nav.is-open {
        display: flex;
    }


    /* Mobile links */

    .site-nav__link {
        width: 100%;
        min-height: 46px;

        justify-content: flex-start;

        padding: 0 14px;

        border-radius: 12px;

        font-size: 15px;
    }


    .site-nav__link::after {
        left: 14px;
        bottom: 8px;

        transform: scaleX(0);
        transform-origin: left center;
    }


    .site-nav__link:hover::after,
    .site-nav__link[aria-current="page"]::after {
        transform: scaleX(1);
    }


    /* Theme button becomes a round icon button */

    .theme-toggle {
        margin-left: 0;

        width: 42px;
        height: 42px;
        min-height: 42px;

        padding: 0;
    }


    .theme-toggle__text {
        position: absolute;

        width: 1px;
        height: 1px;

        padding: 0;
        margin: -1px;

        overflow: hidden;

        clip: rect(0, 0, 0, 0);

        white-space: nowrap;

        border: 0;
    }

}


/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 420px) {

    .site-header__inner {
        padding: 0 var(--lpi-space-sm, 10px);
    }


    .site-header__logo {
        width: 38px;
        height: 38px;

        flex-basis: 38px;
    }


    .site-header__brand {
        gap: 8px;
    }


    .site-header__brand-text {
        font-size: 15px;
    }


    .site-nav-toggle {
        width: 40px;
        height: 40px;
    }


    .theme-toggle {
        width: 40px;
        height: 40px;
        min-height: 40px;
    }

}


/* =========================================================
   DARK THEME
   Lighter brand colours for contrast.
   ========================================================= */

[data-theme="dark"] .site-header,
.dark .site-header {
    --lpi-hd-a: #9b8cff;
    --lpi-hd-b: #f472b6;
    --lpi-hd-c: #fbbf24;
    --lpi-hd-tint: rgba(155, 140, 255, 0.14);
    --lpi-hd-tint-strong: rgba(155, 140, 255, 0.24);

    background: var(--lpi-color-surface, #111827);
    border-bottom-color: var(--lpi-color-border, #374151);
    box-shadow: 0 8px 24px -16px rgba(0, 0, 0, 0.8);
}


[data-theme="dark"] .site-nav__link,
.dark .site-nav__link {
    color: var(--lpi-color-text-muted, #d1d5db);
}


[data-theme="dark"] .site-nav__link:hover,
.dark .site-nav__link:hover,
[data-theme="dark"] .site-nav__link[aria-current="page"],
.dark .site-nav__link[aria-current="page"] {
    color: var(--lpi-hd-a);
}


[data-theme="dark"] .theme-toggle:hover,
.dark .theme-toggle:hover {
    color: #111827;
}


[data-theme="dark"] .site-header__brand,
.dark .site-header__brand {
    color: var(--lpi-color-text, #f9fafb);
}