/* =========================================================
   FTL — HEADER COMPONENT (v3 — glass + gradient polish)
   Fontes Letras
   Same class names, same HTML, same JS hooks.
   Only this CSS file changes.
   ========================================================= */


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

.ftl-masthead {
    --ftl-hd-a: #5B4BDB;
    --ftl-hd-b: #8B7CF6;
    --ftl-hd-c: #f59e0b;
    --ftl-hd-fill: linear-gradient(135deg, #4F3FD1 0%, #6A5BEA 100%);
    --ftl-hd-on-fill: #ffffff;
    --ftl-hd-tint: rgba(91, 75, 219, 0.08);
    --ftl-hd-tint-strong: rgba(91, 75, 219, 0.16);
    --ftl-hd-track: rgba(91, 75, 219, 0.06);
    --ftl-hd-fill-shadow: 0 8px 16px -8px rgba(91, 75, 219, 0.65);
    --ftl-hd-glow: rgba(91, 75, 219, 0.40);
    --ftl-hd-wash-a: rgba(91, 75, 219, 0.07);
    --ftl-hd-wash-b: rgba(139, 124, 246, 0.08);

    position: relative; /* sticky chahile: position: sticky; top: 0; */
    z-index: 1000;
    width: 100%;

    background:
        radial-gradient(60% 160% at 0% 0%, var(--ftl-hd-wash-a) 0%, transparent 62%),
        radial-gradient(50% 160% at 100% 0%, var(--ftl-hd-wash-b) 0%, transparent 62%),
        var(--ftl-color-surface, #ffffff);
    border-bottom: 1px solid var(--ftl-color-border, #e5e7eb);
    box-shadow: 0 14px 34px -22px var(--ftl-hd-glow);
}


/* Brand colour strip */
.ftl-masthead::before {
    content: "";
    display: block;
    width: 100%;
    height: 4px;
    background: linear-gradient(
        90deg,
        var(--ftl-hd-a) 0%,
        var(--ftl-hd-b) 55%,
        var(--ftl-hd-c) 100%
    );
}


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

.ftl-masthead__inner {
    width: 100%;
    max-width: var(--ftl-container-max-width, 1200px);
    min-height: 76px;
    margin: 0 auto;
    padding: 0 var(--ftl-space-page, 20px);

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


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

.ftl-masthead__brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;

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

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


.ftl-masthead__brand:focus-visible {
    outline: 2px solid var(--ftl-hd-a);
    outline-offset: 4px;
    border-radius: 16px;
}


/* =========================================================
   LOGO — gradient-ringed tile with soft halo
   ========================================================= */

.ftl-masthead__logo {
    display: block;
    box-sizing: border-box;

    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    padding: 6px;

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

    background:
        linear-gradient(var(--ftl-color-surface, #ffffff), var(--ftl-color-surface, #ffffff)) padding-box,
        linear-gradient(135deg, var(--ftl-hd-a), var(--ftl-hd-b)) border-box;
    border: 2px solid transparent;
    border-radius: 15px;

    box-shadow:
        0 0 0 4px var(--ftl-hd-tint),
        0 8px 16px -8px var(--ftl-hd-glow);

    transition:
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.25s ease;
}


.ftl-masthead__brand:hover .ftl-masthead__logo {
    transform: rotate(-6deg) scale(1.08);
    box-shadow:
        0 0 0 6px var(--ftl-hd-tint-strong),
        0 12px 20px -8px var(--ftl-hd-glow);
}


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

.ftl-masthead__brand-text {
    display: block;

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

    font-family: var(--ftl-font-family-heading, inherit);
    font-size: 20px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.025em;

    white-space: nowrap;
}


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

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

}


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

.ftl-menu-toggle {
    display: none;

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

    width: 46px;
    height: 46px;

    margin-left: auto;
    padding: 0;

    border: 1.5px solid var(--ftl-hd-tint-strong);
    border-radius: 15px;

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

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

    cursor: pointer;

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


.ftl-menu-toggle:hover {
    background: var(--ftl-hd-tint-strong);
    border-color: var(--ftl-hd-a);
}


.ftl-menu-toggle:active {
    transform: scale(0.94);
}


.ftl-menu-toggle[aria-expanded="true"] {
    background: var(--ftl-hd-fill);
    border-color: transparent;
    color: var(--ftl-hd-on-fill);
    box-shadow: var(--ftl-hd-fill-shadow);
}


.ftl-menu-toggle:focus-visible {
    outline: 2px solid var(--ftl-hd-a);
    outline-offset: 2px;
}


/* =========================================================
   PRIMARY NAVIGATION — soft glass pill track
   ========================================================= */

.ftl-menu {
    display: flex;
    align-items: center;

    gap: 2px;
    padding: 4px;

    margin-left: auto;

    background: var(--ftl-hd-track);
    border: 1px solid var(--ftl-hd-tint);
    border-radius: 999px;
}


/* =========================================================
   NAVIGATION LINK
   ========================================================= */

.ftl-menu__link {
    position: relative;

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

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

    border-radius: 999px;

    color: var(--ftl-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,
        box-shadow 0.2s ease,
        transform 0.15s ease;
}


/* Accent marker — hidden on desktop, left bar on mobile */
.ftl-menu__link::after {
    content: "";

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

    width: 16px;
    height: 3px;

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

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

    transition: transform 0.2s ease, opacity 0.2s ease;
}


.ftl-menu__link:hover {
    color: var(--ftl-hd-a);
    background: var(--ftl-hd-tint-strong);
    transform: translateY(-1px);
}


/* Active page — filled gradient pill */
.ftl-menu__link[aria-current="page"] {
    color: var(--ftl-hd-on-fill);
    background: var(--ftl-hd-fill);
    box-shadow: var(--ftl-hd-fill-shadow);
    transform: none;
}


.ftl-menu__link[aria-current="page"]:hover {
    color: var(--ftl-hd-on-fill);
    filter: brightness(1.07);
}


.ftl-menu__link:focus-visible {
    outline: 2px solid var(--ftl-hd-a);
    outline-offset: 2px;
}


/* =========================================================
   THEME TOGGLE
   ========================================================= */

.ftl-mode-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    min-height: 44px;
    padding: 0 16px 0 12px;
    margin-left: 6px;

    border: 1.5px solid var(--ftl-hd-tint-strong);
    border-radius: 999px;

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

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

    cursor: pointer;
    white-space: nowrap;

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


.ftl-mode-switch:hover {
    background: var(--ftl-hd-fill);
    border-color: transparent;
    color: var(--ftl-hd-on-fill);
    box-shadow: var(--ftl-hd-fill-shadow);
}


.ftl-mode-switch:active {
    transform: scale(0.96);
}


.ftl-mode-switch:focus-visible {
    outline: 2px solid var(--ftl-hd-a);
    outline-offset: 3px;
}


.ftl-mode-switch__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 22px;
    height: 22px;

    line-height: 1;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}


.ftl-mode-switch:hover .ftl-mode-switch__icon {
    transform: rotate(25deg) scale(1.15);
}


.ftl-mode-switch__text {
    display: inline-block;
}


/* =========================================================
   MATERIAL SYMBOLS ICONS (CSS only — HTML unchanged)
   Needs the Material Symbols Rounded stylesheet in <head>
   with these icon_names: close, dark_mode, emoji_symbols,
   home, info, light_mode, menu, mood (plus apps, auto_awesome)
   ========================================================= */

.ftl-menu__link::before,
.ftl-mode-switch__icon::before,
.ftl-menu-toggle > span::before {
    font-family: "Material Symbols Rounded";
    font-weight: 500;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    direction: ltr;

    -webkit-font-smoothing: antialiased;
    -webkit-font-feature-settings: "liga";
    font-feature-settings: "liga";
}


/* Nav link icons — desktop shows them only when there is room */

.ftl-menu__link::before {
    display: none;
    margin-right: 7px;
    font-size: 18px;
}

#ftl-nav-home::before        { content: "home"; content: "home" / ""; }
#ftl-nav-tools::before       { content: "apps"; content: "apps" / ""; }
#ftl-nav-fancy-text::before  { content: "auto_awesome"; content: "auto_awesome" / ""; }
#ftl-nav-emoji::before       { content: "mood"; content: "mood" / ""; }
#ftl-nav-symbols::before     { content: "emoji_symbols"; content: "emoji_symbols" / ""; }
#ftl-nav-about::before       { content: "info"; content: "info" / ""; }

@media (min-width: 1400px) {

    .ftl-menu__link::before {
        display: inline-block;
    }

}


/* Theme toggle icon — moon in light mode, sun in dark mode */

.ftl-mode-switch__icon {
    font-size: 0; /* hides the emoji text set by theme.js */
}

.ftl-mode-switch__icon::before {
    content: "dark_mode"; content: "dark_mode" / "";
    font-size: 22px;
}

[data-theme="dark"] .ftl-mode-switch__icon::before,
.dark .ftl-mode-switch__icon::before {
    content: "light_mode"; content: "light_mode" / "";
}


/* Mobile menu button — menu / close */

.ftl-menu-toggle > span {
    display: inline-flex;
    font-size: 0; /* hides the ☰ character */
}

.ftl-menu-toggle > span::before {
    content: "menu"; content: "menu" / "";
    font-size: 26px;
}

.ftl-menu-toggle[aria-expanded="true"] > span::before {
    content: "close"; content: "close" / "";
}


/* =========================================================
   LARGE TABLET — tighter nav so 6 links still fit
   ========================================================= */

@media (max-width: 1100px) {

    .ftl-menu__link {
        padding: 0 11px;
        font-size: 13px;
    }

    .ftl-mode-switch {
        padding: 0 12px 0 10px;
    }

}


/* =========================================================
   MOBILE (mobile menu starts here)
   ========================================================= */

@media (max-width: 980px) {

    .ftl-masthead__inner {
        position: relative;

        min-height: 68px;

        flex-wrap: wrap;
    }


    .ftl-menu-toggle {
        display: inline-flex;
    }


    /* Navigation panel — floating card */

    .ftl-menu {
        display: none;

        width: 100%;

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

        order: 10;

        gap: 4px;
        margin: 2px 0 14px;
        padding: 10px;

        background: var(--ftl-color-surface, #ffffff);
        border: 1px solid var(--ftl-hd-tint-strong);
        border-radius: 20px;
        box-shadow: 0 18px 40px -18px var(--ftl-hd-glow);
    }


    .ftl-menu.on-open {
        display: flex;
        animation: ftl-hd-drop 0.2s ease-out;
    }


    .ftl-menu__link {
        width: 100%;
        min-height: 50px;

        justify-content: flex-start;

        padding: 0 16px 0 14px;

        border-radius: 14px;

        font-size: 15px;
    }


    .ftl-menu__link:hover {
        transform: none;
    }


    /* Material icon tile (decorative) */

    .ftl-menu__link::before {
        display: inline-flex;
        align-items: center;
        justify-content: center;

        width: 36px;
        height: 36px;
        margin-right: 12px;

        border-radius: 12px;
        background: var(--ftl-hd-tint);
        color: var(--ftl-hd-a);

        font-size: 21px;
    }


    .ftl-menu__link[aria-current="page"]::before {
        background: var(--ftl-hd-fill);
        color: var(--ftl-hd-on-fill);
    }


    /* Accent marker becomes a left bar */

    .ftl-menu__link::after {
        left: 7px;
        bottom: auto;
        top: 50%;

        width: 4px;
        height: 24px;

        transform: translateY(-50%) scaleY(0);
        transform-origin: center;
    }


    .ftl-menu__link:hover::after,
    .ftl-menu__link[aria-current="page"]::after {
        opacity: 1;
        transform: translateY(-50%) scaleY(1);
    }


    /* Active link: soft tint on mobile (the bar marks it) */

    .ftl-menu__link[aria-current="page"] {
        color: var(--ftl-hd-a);
        background: var(--ftl-hd-tint-strong);
        box-shadow: none;
    }


    .ftl-menu__link[aria-current="page"]:hover {
        color: var(--ftl-hd-a);
        filter: none;
    }


    /* Theme button becomes a round icon button */

    .ftl-mode-switch {
        margin-left: 0;

        width: 46px;
        height: 46px;
        min-height: 46px;

        padding: 0;
    }


    .ftl-mode-switch__text {
        position: absolute;

        width: 1px;
        height: 1px;

        padding: 0;
        margin: -1px;

        overflow: hidden;

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

        white-space: nowrap;

        border: 0;
    }

}


@keyframes ftl-hd-drop {

    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}


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

@media (max-width: 420px) {

    .ftl-masthead__inner {
        padding: 0 var(--ftl-space-sm, 12px);
        gap: 8px;
    }


    .ftl-masthead__logo {
        width: 40px;
        height: 40px;

        flex-basis: 40px;
    }


    .ftl-masthead__brand {
        gap: 8px;
    }


    .ftl-masthead__brand-text {
        font-size: 16px;
    }


    .ftl-menu-toggle,
    .ftl-mode-switch {
        width: 42px;
        height: 42px;
        min-height: 42px;
    }

}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .ftl-masthead *,
    .ftl-masthead *::before,
    .ftl-masthead *::after {
        transition: none !important;
        animation: none !important;
    }

}


/* =========================================================
   DARK THEME
   ========================================================= */

[data-theme="dark"] .ftl-masthead,
.dark .ftl-masthead {
    --ftl-hd-a: #A99FFF;
    --ftl-hd-b: #C2BBFF;
    --ftl-hd-c: #fbbf24;
    --ftl-hd-fill: linear-gradient(135deg, #A99FFF 0%, #C2BBFF 100%);
    --ftl-hd-on-fill: #17152E;
    --ftl-hd-tint: rgba(194, 187, 255, 0.12);
    --ftl-hd-tint-strong: rgba(194, 187, 255, 0.22);
    --ftl-hd-track: rgba(194, 187, 255, 0.08);
    --ftl-hd-fill-shadow: 0 8px 18px -8px rgba(169, 159, 255, 0.55);
    --ftl-hd-glow: rgba(0, 0, 0, 0.7);
    --ftl-hd-wash-a: rgba(169, 159, 255, 0.10);
    --ftl-hd-wash-b: rgba(194, 187, 255, 0.07);

    border-bottom-color: var(--ftl-color-border, #374151);
}


[data-theme="dark"] .ftl-masthead__logo,
.dark .ftl-masthead__logo {
    background:
        linear-gradient(var(--ftl-color-surface, #111827), var(--ftl-color-surface, #111827)) padding-box,
        linear-gradient(135deg, var(--ftl-hd-a), var(--ftl-hd-b)) border-box;
}


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


[data-theme="dark"] .ftl-menu__link:hover,
.dark .ftl-menu__link:hover {
    color: var(--ftl-hd-a);
}


[data-theme="dark"] .ftl-menu__link[aria-current="page"],
.dark .ftl-menu__link[aria-current="page"] {
    color: var(--ftl-hd-on-fill);
}


[data-theme="dark"] .ftl-menu__link[aria-current="page"]:hover,
.dark .ftl-menu__link[aria-current="page"]:hover {
    color: var(--ftl-hd-on-fill);
}


@media (max-width: 980px) {

    [data-theme="dark"] .ftl-menu,
    .dark .ftl-menu {
        background: var(--ftl-color-surface, #211E3B);
    }

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

}


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