/* ══════════════════════════════
   FULL-PAGE LAYOUT
   Required by any page with .top-bar
══════════════════════════════ */
body {
    padding: 0;
    justify-content: flex-start;
    align-items: stretch;
}

.site-wrap {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    z-index: 10;
}

/* Centered content area — form and data pages */
.page-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
}

/* ══════════════════════════════
   TOP BAR
══════════════════════════════ */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.4rem 2.25rem;
    min-height: 84px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: linear-gradient(180deg, rgba(6,5,9,0.96) 0%, rgba(8,7,11,0.92) 100%);
    backdrop-filter: blur(14px) saturate(0.85);
    -webkit-backdrop-filter: blur(14px) saturate(0.85);
    box-shadow: 0 18px 40px rgba(0,0,0,0.55);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Blood seeping from the underside of the bar */
.top-bar::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(187,24,24,0.55) 25%,
        rgba(184,134,11,0.45) 50%,
        rgba(187,24,24,0.55) 75%,
        transparent 100%);
    pointer-events: none;
}

.top-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    line-height: 0;
}

.top-brand img {
    width: auto;
    height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(187,24,24,0.45));
    transition: filter 0.3s, transform 0.3s;
}

.top-brand:hover img {
    filter: drop-shadow(0 0 18px rgba(187,24,24,0.75)) drop-shadow(0 0 6px rgba(224,178,62,0.35));
    transform: scale(1.04);
}

/* The items spread evenly over the whole span between the logo and the
   account buttons, instead of huddling in the middle of it. */
.top-nav {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
    gap: 0.25rem;
    margin: 0 1.25rem 0 2rem;
}

/* ── Nav item base ── */
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0.7rem 0.95rem 0.8rem;
    text-decoration: none;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-size: 0.56rem;
    font-weight: 600;
    letter-spacing: 2.2px;
    white-space: nowrap;
    text-transform: uppercase;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: color 0.22s, background 0.22s;
    border-bottom: 2px solid transparent;
    user-select: none;
}

/* Ember glow rising from the nav item's base on hover/active */
.nav-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(224,178,62,0.18), rgba(224,178,62,0.04) 55%, transparent 90%);
    opacity: 0;
    transition: opacity 0.22s;
    pointer-events: none;
}

.nav-item i:first-child {
    font-size: 1.1rem;
    color: #bdb4a8;
    position: relative;
    transition: color 0.22s, text-shadow 0.22s;
}

.nav-item > span { position: relative; }

.nav-item:hover,
.nav-item:hover > i:first-child { color: var(--gold-bright); }

.nav-item:hover > i:first-child { text-shadow: 0 0 14px rgba(184,134,11,0.55); }

.nav-item:hover { border-bottom-color: rgba(184,134,11,0.4); }
.nav-item:hover::before { opacity: 1; }

/* Active nav item */
.nav-item.nav-active {
    color: var(--gold-bright);
    border-bottom-color: var(--gold);
}

.nav-item.nav-active::before { opacity: 1; }

.nav-item.nav-active > i:first-child {
    color: var(--gold-bright);
    text-shadow: 0 0 14px rgba(184,134,11,0.55);
}

/* Download button */
.nav-download i:first-child { color: var(--red-bright); }
.nav-download::before { background: linear-gradient(to top, rgba(212,32,32,0.22), transparent 70%); }
.nav-download:hover,
.nav-download:hover i:first-child { color: #ff4444; text-shadow: 0 0 14px rgba(212,32,32,0.6); }
.nav-download:hover { border-bottom-color: rgba(212,32,32,0.4); }

.nav-label { display: inline-flex; align-items: center; }

.nav-caret {
    font-size: 0.55rem !important;
    opacity: 0.6;
    margin-left: 3px;
    transition: transform 0.22s;
}

/* ── Dropdown ── */
.nav-dropdown { position: relative; }

.nav-dropdown .dropdown-panel {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 230px;
    background: linear-gradient(180deg, rgba(12,9,15,0.99) 0%, rgba(5,4,8,0.99) 100%);
    border: 1px solid rgba(184,134,11,0.2);
    border-top: 2px solid var(--gold);
    box-shadow:
        0 24px 70px rgba(0,0,0,0.9),
        0 0 30px rgba(184,134,11,0.07),
        inset 0 1px 0 rgba(184,134,11,0.08);
    z-index: 200;
    padding: 6px 0;
    /* .nav-item centres its label; the menu rows read left to right */
    text-align: left;
}

.nav-dropdown:hover .dropdown-panel,
.nav-dropdown:focus-within .dropdown-panel {
    display: block;
    animation: dropIn 0.18s cubic-bezier(0.22,1,0.36,1);
}

.nav-dropdown:hover .nav-caret { transform: rotate(180deg); }

@keyframes dropIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Dropdown items ── */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    color: var(--text-muted);
    transition: background 0.18s, color 0.18s;
    border-left: 2px solid transparent;
}

.dropdown-item:hover {
    background: rgba(184,134,11,0.06);
    color: var(--text-bright);
    border-left-color: var(--gold);
}

.dropdown-item > i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    color: var(--gold);
    opacity: 0.7;
    transition: opacity 0.18s;
    flex-shrink: 0;
}

.dropdown-item:hover > i { opacity: 1; }

.dropdown-item-text { display: flex; flex-direction: column; gap: 2px; }

.dropdown-item-text strong {
    font-family: var(--font-display);
    font-size: 0.6rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-bright);
    font-weight: 600;
}

.dropdown-item-text small {
    font-size: 0.58rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: none;
    font-family: var(--font-body);
}

.dropdown-sep { height: 1px; background: rgba(255,255,255,0.05); margin: 4px 0; }

.top-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* ── Account actions (login / sign up, or my account / logout) ── */
.btn-top {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: auto;
    height: 36px;
    margin: 0;
    padding: 0 18px;
    font-family: var(--font-display);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 3px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s, filter 0.2s;
}

.btn-top i { font-size: 0.85rem; }

/* <button> inherits the shared red sweep; these paint their own hover */
.btn-top::before { content: none; }

.btn-top-red {
    background: linear-gradient(180deg, #c42020 0%, #a01515 100%);
    border: 1px solid rgba(255,90,70,0.28);
    color: #fbeee6;
    box-shadow: 0 0 18px rgba(187,24,24,0.35), inset 0 1px 0 rgba(255,255,255,0.14);
}

.btn-top-red:hover {
    filter: brightness(1.12);
    color: #fff;
    border-color: rgba(255,110,90,0.5);
    box-shadow: 0 0 26px rgba(212,32,32,0.55), inset 0 1px 0 rgba(255,255,255,0.18);
}

.btn-top-gold {
    background: rgba(10,8,12,0.55);
    border: 1px solid rgba(224,178,62,0.6);
    color: var(--gold-bright);
}

.btn-top-gold:hover {
    background: rgba(224,178,62,0.1);
    border-color: var(--gold-bright);
    color: #f3d27a;
    box-shadow: 0 0 20px rgba(224,178,62,0.2);
}

/* Logout — quiet until hovered, so it never competes with My Account */
.btn-logout {
    background: transparent;
    border: 1px solid rgba(187,24,24,0.45);
    color: #d9786c;
}

.btn-logout:hover {
    background: rgba(187,24,24,0.14);
    border-color: var(--red-bright);
    color: #ff8c7c;
    box-shadow: 0 0 18px rgba(187,24,24,0.3);
}

/* ── Language dropdown ── */
.lang-switch { position: relative; }

.lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: auto;
    height: 36px;
    margin: 0;
    padding: 0 12px;
    background: rgba(22,18,26,0.85);
    border: 1px solid rgba(224,178,62,0.28);
    border-radius: 3px;
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 2px;
}

.lang-toggle::before { content: none; }

.lang-toggle:hover,
.lang-switch.open .lang-toggle {
    color: var(--gold-bright);
    border-color: rgba(224,178,62,0.6);
    box-shadow: 0 0 16px rgba(224,178,62,0.12);
}

.lang-toggle .fa-globe { font-size: 0.95rem; color: #a9a097; }
.lang-caret { font-size: 0.55rem; opacity: 0.8; transition: transform 0.2s; }
.lang-switch.open .lang-caret { transform: rotate(180deg); }

.lang-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 170px;
    padding: 6px 0;
    background: linear-gradient(180deg, rgba(12,9,15,0.99) 0%, rgba(5,4,8,0.99) 100%);
    border: 1px solid rgba(184,134,11,0.2);
    border-top: 2px solid var(--gold);
    box-shadow: 0 24px 60px rgba(0,0,0,0.85);
    z-index: 200;
}

.lang-switch.open .lang-menu {
    display: block;
    animation: langIn 0.16s cubic-bezier(0.22,1,0.36,1);
}

@keyframes langIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Pages overwrite className on #en-btn / #pt-btn with 'active' or '',
   so these are styled through the menu, never through their own class. */
.lang-menu button {
    justify-content: space-between;
    width: 100%;
    margin: 0;
    padding: 0.65rem 1rem;
    background: transparent;
    border: none;
    border-left: 2px solid transparent;
    border-radius: 0;
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 2px;
}

.lang-menu button::before { content: none; }

.lang-menu button small {
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.3px;
    text-transform: none;
    color: var(--text-muted);
}

.lang-menu button:hover {
    background: rgba(184,134,11,0.07);
    color: var(--text-bright);
    border-color: transparent;
    border-left-color: var(--gold);
    box-shadow: none;
}

.lang-menu button.active { color: var(--gold-bright); }

/* ══════════════════════════════
   SITE FOOTER
══════════════════════════════ */
.site-footer {
    margin-top: auto;
    padding: 1.6rem 3rem;
    border-top: 1px solid var(--border-dim);
    background: linear-gradient(to bottom, transparent, rgba(1,0,3,0.75));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

/* Matching blood line along the footer's top edge */
.site-footer::before {
    content: '';
    position: absolute;
    left: 0; right: 0; top: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(187,24,24,0.4) 50%, transparent);
    pointer-events: none;
}

.site-footer .footer-nav {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

/* ══════════════════════════════
   MOBILE MENU
   The toggle is injected by layout.js and stays hidden on desktop,
   where the horizontal nav is already visible.
══════════════════════════════ */
.nav-toggle {
    display: none;
    width: auto;
    margin: 0;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid rgba(184,134,11,0.3);
    color: var(--gold-bright);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 1px;
    transition: border-color 0.2s, color 0.2s;
}

.nav-toggle:hover { border-color: var(--gold); color: var(--text-bright); }

/* The button reuses the shared <button> element styles, which paint a
   red sweep on hover — cancel it here so the toggle stays quiet. */
.nav-toggle::before { content: none; }

/* The full bar needs ~1380px; below that it tightens in steps, then
   folds into the drawer before anything can collide. */
/* The logo is wide: tighten the row well before the drawer breakpoint. */
@media (max-width: 1500px) {
    .top-bar  { padding: 0.7rem 1.5rem; }
    .top-brand img { height: 56px; }
    .top-nav  { gap: 0; margin: 0 0.75rem 0 1.25rem; }
    .nav-item { padding: 0.7rem 0.7rem 0.8rem; letter-spacing: 1.6px; }
    .btn-top  { padding: 0 14px; letter-spacing: 2px; }
}

/* Icon-only account actions where the row runs out of room: just above
   the drawer breakpoint, and on phones. The links keep their title. */
@media (min-width: 1101px) and (max-width: 1320px), (max-width: 560px) {
    .btn-top        { width: 38px; padding: 0; }
    .btn-top > span { display: none; }
}

@media (max-width: 900px) {
    .site-footer { padding: 1.75rem 1.25rem; }
}

@media (max-width: 720px) {
    .page-main { padding: 2rem 1rem; }
}

@media (max-width: 1100px) {
    .nav-toggle { display: block; order: 3; height: 38px; }

    .top-bar   { flex-wrap: wrap; padding: 0.6rem 1.1rem; min-height: 0; }
    .top-brand img { height: 56px; }
    .top-right { order: 2; margin-left: auto; gap: 0.6rem; }

    /* Collapsed drawer: full-width, below the bar, revealed by .nav-open */
    .top-nav {
        order: 4;
        flex: none;
        flex-direction: column;
        align-items: stretch;
        /* centred overflow would push the first rows out of scroll reach */
        justify-content: flex-start;
        margin: 0;
        width: 100%;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.3s ease, opacity 0.25s ease, margin 0.3s ease;
    }

    .top-bar.nav-open .top-nav {
        max-height: 80vh;
        overflow-y: auto;
        opacity: 1;
        margin-top: 0.85rem;
    }

    /* Stacked rows instead of icon-over-label tiles */
    .top-nav .nav-item {
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        padding: 0.85rem 0.5rem;
        font-size: 0.62rem;
        letter-spacing: 2px;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    .top-nav .nav-item i:first-child { width: 22px; text-align: center; }

    /* Dropdowns become always-open inline sections — there is no hover on touch */
    .top-nav .nav-dropdown {
        flex-wrap: wrap;
        padding-bottom: 0;
        cursor: default;
    }
    .nav-dropdown::before   { content: none; }
    .nav-dropdown .nav-caret { display: none; }

    .nav-dropdown .dropdown-panel {
        display: block;
        position: static;
        transform: none;
        flex-basis: 100%;
        min-width: 0;
        margin: 0.6rem 0 0;
        background: rgba(0,0,0,0.35);
        border: none;
        border-left: 2px solid rgba(184,134,11,0.3);
        box-shadow: none;
        animation: none;
        padding: 0;
    }

    .dropdown-item { padding: 0.7rem 1rem; }
}

@media (max-width: 400px) {
    .top-bar   { padding: 0.6rem 0.75rem; }
    .top-brand img { height: 48px; }
    .top-right { gap: 0.4rem; }
    .lang-toggle { padding: 0 9px; gap: 7px; }
    .lang-toggle .fa-globe { display: none; }
}
