/* ==========================================================================
   header.css — SuaraBaca Header Styles
   Three-level header: utility bar, branding, navigation
   ========================================================================== */

/* ── UTILITY BAR ─────────────────────────────────────────────────── */
.header-utility {
    background-color: #f7f7f7;
    border-bottom: 1px solid var(--sb-border);
    font-size: 12px;
    color: var(--sb-muted);
    font-family: 'Inter', system-ui, sans-serif;
}

.utility-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 6px;
    padding-bottom: 6px;
    gap: 1rem;
}

.utility-date {
    font-weight: 500;
    color: var(--sb-muted);
}

.utility-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.utility-link {
    color: var(--sb-muted);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.2s;
}

.utility-link:hover {
    color: var(--sb-secondary);
    text-decoration: none;
}

.utility-link + .utility-link::before {
    content: '·';
    margin-right: 1rem;
    color: var(--sb-border);
}

/* ── BRANDING HEADER ─────────────────────────────────────────────── */
.header-branding {
    background-color: #ffffff;
    border-bottom: 1px solid var(--sb-border);
    padding: 14px 0;
}

.branding-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-branding {
    flex: 1;
}

.custom-logo-wrap a {
    display: inline-block;
    text-decoration: none;
}

.custom-logo-wrap img,
.custom-logo {
    max-width: 240px;
    max-height: 70px;
    width: auto;
    height: auto;
    display: block;
}

.site-name-link {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.site-name {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--sb-secondary);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.site-description {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 12px;
    color: var(--sb-muted);
    font-weight: 400;
}

/* ── HEADER ACTIONS ──────────────────────────────────────────────── */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-toggle,
.nav-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sb-secondary);
    transition: background-color 0.2s, color 0.2s;
}

.search-toggle:hover,
.search-toggle:focus-visible {
    background-color: var(--sb-surface);
    color: var(--sb-primary);
    outline: 2px solid var(--sb-primary);
    outline-offset: 2px;
}

.nav-toggle {
    display: none; /* shown at mobile breakpoint */
    flex-direction: column;
    gap: 5px;
    padding: 10px 8px;
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
    background-color: var(--sb-surface);
    outline: 2px solid var(--sb-primary);
    outline-offset: 2px;
}

.hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--sb-secondary);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

/* Animated hamburger when open */
.nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
}
.nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── SEARCH OVERLAY ──────────────────────────────────────────────── */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    padding-top: 80px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

.search-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.search-overlay-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-form-overlay {
    display: flex;
    flex: 1;
    align-items: center;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid var(--sb-primary);
}

.search-form-overlay input[type="search"] {
    flex: 1;
    padding: 14px 16px;
    font-size: 18px;
    font-family: 'Inter', system-ui, sans-serif;
    border: none;
    outline: none;
    background: transparent;
    color: var(--sb-heading);
}

.search-submit-btn {
    background: var(--sb-primary);
    border: none;
    padding: 12px 16px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.search-submit-btn:hover {
    background-color: var(--sb-secondary);
}

.search-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.search-close:hover {
    background-color: rgba(255,255,255,0.3);
}

/* ── PRIMARY NAVIGATION ──────────────────────────────────────────── */
.primary-navigation {
    background-color: var(--sb-nav-background);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.nav-inner {
    display: flex;
    align-items: stretch;
}

/* Nav menu reset */
.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    width: 100%;
}

.nav-menu li {
    position: relative;
}

.nav-menu a {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    color: var(--sb-nav-text);
    text-decoration: none;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s;
    border-bottom: 3px solid transparent;
}

.nav-menu a:hover,
.nav-menu .current-menu-item > a,
.nav-menu .current-menu-ancestor > a {
    background-color: rgba(255,255,255,0.1);
    border-bottom-color: var(--sb-primary);
    color: #fff;
    text-decoration: none;
}

/* Dropdown menus */
.nav-menu .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    min-width: 220px;
    list-style: none;
    margin: 0;
    padding: 6px 0;
    border-top: 3px solid var(--sb-primary);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 200;
}

.nav-menu li:hover > .sub-menu,
.nav-menu li:focus-within > .sub-menu {
    display: block;
}

.nav-menu .sub-menu a {
    color: var(--sb-text);
    padding: 10px 20px;
    font-size: 14px;
    border-bottom: none;
    white-space: normal;
    display: block;
}

.nav-menu .sub-menu a:hover {
    background-color: var(--sb-surface);
    color: var(--sb-secondary);
    border-bottom: none;
}

/* ── STICKY HEADER SHADOW ────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 200;
}

.header-utility,
.header-branding {
    position: relative;
}

/* ── SCREEN-READER TEXT ──────────────────────────────────────────── */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    white-space: nowrap;
}

.screen-reader-text:focus {
    background-color: #fff;
    clip: auto;
    clip-path: none;
    color: var(--sb-heading);
    display: block;
    font-size: 14px;
    font-weight: 600;
    height: auto;
    left: 0;
    padding: 1rem;
    top: 0;
    width: auto;
    z-index: 10000;
}
