/*
 * header.css — TechAgro Header
 * Loaded on every page via functions.php.
 *
 * Layout: [Socials] ←→ [Site Name] ←→ [Search + Toggle]
 */

/* ─── FIX BROWSER DEFAULT BODY MARGIN ────────────────────────────────────── */

body, html {
    margin: 0;
    padding: 0;
}


/* ─── HEADER BASE ─────────────────────────────────────────────────────────── */

.ta-header {
    width: 100%;
    height: 64px;
    z-index: 100;
}

.ta-header__inner {
    max-width: var(--container-max);
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: grid;
    grid-template-columns: 1fr auto 1fr;   /* left | center | right — keeps name truly centered */
    align-items: center;
}


/* ─── TRANSPARENT (homepage) ──────────────────────────────────────────────── */

.ta-header--transparent {
    background: var(--color-green-mid);
    position: relative;
    margin-bottom: 0;
}

/* ─── SOLID (all other pages) ─────────────────────────────────────────────── */

.ta-header--solid {
    background-color: var(--color-green-mid);
    margin-bottom: 0;
}


/* ─── LEFT: SOCIAL ICONS ──────────────────────────────────────────────────── */

.ta-header__socials {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    justify-content: flex-start;
}

.ta-header__social-link {
    color: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: color 0.18s ease;
}

.ta-header__social-link:hover {
    color: #ffffff;
}


/* ─── CENTER: SITE NAME ───────────────────────────────────────────────────── */

.ta-header__logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.ta-header__logo .ta-logo {
    display: block;
    height: 34px;
    width: 170px;
    object-fit: contain;
}

.ta-header__logo .ta-logo--dark {
    display: none;
}

body.dark-mode .ta-header__logo .ta-logo--dark {
    display: block;
}

body.dark-mode .ta-header__logo .ta-logo--light {
    display: none;
}


/* ─── RIGHT: SEARCH + TOGGLE ──────────────────────────────────────────────── */

.ta-header__actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    justify-content: flex-end;
}

/* ── Search form ── */
.ta-header__search {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    overflow: hidden;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.ta-header__search:focus-within {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.5);
}

.ta-header__search input[type="search"] {
    background: transparent;
    border: none;
    outline: none;
    padding: 7px 10px;
    font-family: var(--font-main);
    font-size: 0.82rem;
    color: #ffffff;
    width: 150px;
}

.ta-header__search input[type="search"]::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.ta-header__search button[type="submit"] {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0 10px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    height: 100%;
    transition: color 0.15s ease;
}

.ta-header__search button[type="submit"]:hover {
    color: #ffffff;
}


/* ─── HAMBURGER — tablet and mobile ─────────────────────────────────────── */

.ta-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

.ta-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

/* Animate to X when open */
.ta-hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.ta-hamburger.is-open span:nth-child(2) { opacity: 0; }
.ta-hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }


/* ─── MOBILE DRAWER ───────────────────────────────────────────────────────── */

.ta-drawer {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--color-green-mid);
    z-index: 99;
    padding: var(--spacing-lg);
    flex-direction: column;
    gap: var(--spacing-lg);
    transform: translateY(-10px);
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: none;
}

.ta-drawer.is-open {
    display: flex !important;
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

body.dark-mode .ta-drawer {
    background: #1A1A1A;
    border-bottom: 1px solid var(--color-border);
}

/* Search + socials row */
.ta-drawer__search-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.ta-drawer__search {
    flex: 1;
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    overflow: hidden;
}

.ta-drawer__search input[type="search"] {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 8px 12px;
    font-family: var(--font-main);
    font-size: 0.85rem;
    color: #ffffff;
}

.ta-drawer__search input[type="search"]::placeholder {
    color: rgba(255,255,255,0.6);
}

.ta-drawer__search button {
    background: transparent;
    border: none;
    padding: 0 10px;
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    display: flex;
    align-items: center;
    height: 100%;
}

.ta-drawer__socials {
    display: flex;
    gap: var(--spacing-md);
    flex-shrink: 0;
}

/* Categories list */
.ta-drawer__categories {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ta-drawer__cat-link {
    display: block;
    padding: 9px 4px;
    font-size: 0.92rem;
    font-weight: 500;
    color: rgba(255,255,255,0.88);
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    transition: color 0.15s ease;
}

.ta-drawer__cat-link:last-child {
    border-bottom: none;
}

.ta-drawer__cat-home {
    font-weight: 700;
    color: #ffffff;
}

.ta-drawer__cat-link:hover {
    color: #ffffff;
}

/* Subscribe button */
.ta-drawer__footer {
    padding-top: var(--spacing-sm);
}

.ta-drawer__footer .ta-subscribe-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    color: #ffffff;
    display: inline-block;
    text-align: center;
}

.ta-drawer__footer .ta-subscribe-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Overlay */
.ta-drawer__overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: 64px;
    background: rgba(0,0,0,0.3);
    z-index: 98;
}

.ta-drawer__overlay.is-open {
    display: block;
}


/* ─── RESPONSIVE ──────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {

    /* Hide desktop-only elements */
    .ta-header__socials,
    .ta-header__search {
        display: none !important;
    }

    /* Show hamburger — force override any Astra styles */
    .ta-hamburger {
        display: flex !important;
    }

    /* Logo moves left — override grid centering */
    .ta-header__inner {
        grid-template-columns: auto 1fr auto;
    }

    .ta-header__logo {
        justify-content: flex-start;
        padding-left: var(--spacing-sm);
    }
}

.ta-theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.ta-toggle__track {
    display: block;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.3);
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    position: relative;
    transition: background 0.28s ease, border-color 0.28s ease;
}

/* Active (dark mode on): track turns bright green */
body.dark-mode .ta-toggle__track {
    background: var(--color-green-light, #52B788);
    border-color: var(--color-green-light, #52B788);
}

.ta-toggle__thumb {
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #ffffff;
    background-image: url('https://techagro.az/wp-content/uploads/2026/05/brightness-and-contrast.png');
    background-size: 11px 11px;
    background-position: center;
    background-repeat: no-repeat;
    position: absolute;
    top: 50%;
    left: 2px;
    transform: translateY(-50%);
    transition: left 0.28s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

/* Move thumb to the right when dark mode is on */
body.dark-mode .ta-toggle__thumb {
    left: calc(100% - 20px);
}