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

.header {
    position: relative;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-bg);
}

.header__container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    padding-block: 12px;
}

.header__brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* HAMBURGER */

.header__hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    z-index: 15;
}

.header__hamburger-line {
    width: 24px;
    height: 2px;
    background: var(--color-primary);
    transition: transform 0.3s ease, opacity 0.2s ease;
}

.header__hamburger[aria-expanded="true"] .header__hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.header__hamburger[aria-expanded="true"] .header__hamburger-line:nth-child(2) {
    opacity: 0;
}

.header__hamburger[aria-expanded="true"] .header__hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* LOGO */

.header__logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
    color: var(--color-primary);
    transition: color 0.2s;
}

.header__logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;                /* Aumentado */
    height: 32px;               /* Aumentado */
    border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
    border-radius: 4px;
    position: relative;
    font-family: var(--font-ui);
    font-size: 0.75rem;         /* Aumentado */
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #fff;
    background: linear-gradient(135deg, var(--color-accent), var(--color-primary));
}

.header__logo-mark::before {
    content: "N24";
    z-index: 1;
}

.header__logo-mark::after {
    content: "";
    position: absolute;
    inset: 1px;
    border: 1px solid color-mix(in srgb, #fff 26%, transparent);
    border-radius: 3px;
}

.header__logo:hover {
    color: var(--color-accent);
}

/* NAVIGATION */

.header__nav {
    display: flex;
    justify-content: center;
}

.header__menu--desktop {
    display: flex;
    gap: 24px;
}

.header__menu-link {
    position: relative;
    padding-block: 6px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    white-space: nowrap;
    color: var(--color-text);
}

.header__menu-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-primary);
    transition: width 0.2s ease;
}

.header__menu-link:hover::after,
.header__menu-link[aria-current="page"]::after {
    width: 100%;
}

.header__menu-link[aria-current="page"] {
    font-weight: 700;
}

/* ACTIONS */

.header__actions {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-self: end;
}

.header__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    transition: background-color 0.2s;
}

.header__btn--search,
.header__btn--login {
    width: 40px;
    height: 40px;
}

.header__btn--search:hover,
.header__btn--login:hover,
.header__theme-toggle:hover {
    background-color: var(--color-bg-alt);
}

.header__btn--subscribe {
    padding: 8px 18px;
    background-color: var(--color-primary);
    color: var(--color-bg);
}

.header__btn--subscribe:hover {
    background-color: var(--color-accent);
}

/* Ajuste para mobile: botão menor e texto "Assinar" */
@media (max-width: 600px) {
    .header__btn--subscribe {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
}

.header__user-icon {
    width: 24px;
    height: 24px;
}

/* SEARCH */

.header__search-form {
    position: absolute;
    top: 100%;
    right: 0;
    display: flex;
    margin-top: 8px;
    padding: 4px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px) scaleY(0.95);
    transform-origin: top right;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
    z-index: 20;
}

.header__search-form.search--open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scaleY(1);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0s;
}

.header__search-input {
    width: clamp(220px, 30vw, 340px);
    padding: 8px;
    border: none;
    outline: none;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-ui);
    font-size: 0.9rem;
}

.header__search-submit {
    padding-inline: 8px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.1rem;
}

/* THEME */

.header__theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--color-text);
    flex-shrink: 0;
}

/* UPDATE BAR */

.header__update-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 16px;
    background-color: var(--update-bg);
    border-top: 1px solid var(--color-border);
    text-align: center;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--update-text);
}

.header__update-icon svg {
    opacity: 0.88;
}
