/* ============================================
   HEADER.CSS  —  JFCM Muntinlupa
   ============================================ */

/*FONTS*/
@font-face {
    font-family: 'Aileron';
    src: url('../fonts/Aileron-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'Aileron';
    src: url('../fonts/Aileron-Bold.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
}

/* ── BASE ───────────────────────────────────── */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: white;
    font-family: 'Aileron', sans-serif;
    box-shadow: 0 2px 12px rgba(15,42,29,.08);
    border-collapse: collapse;
}

.header td {
    vertical-align: middle;
}

.nav-brand-cell {
    text-align: left;
    width: 25%;
    position: relative; /* Desktop safety anchor anchor */
}

.nav-links-container {
    width: 75%;
}

.nav-links-inner-table {
    width: 100%;
    border-collapse: collapse;
}

.nav-links-inner-table td {
    display: table-cell;
    vertical-align: middle;
    text-align: center;
    width: 25%;
}

.header h3 {
    color: rgb(15, 42, 29);
    margin: 0;
    font-weight: 600;
}

.header a {
    text-decoration: none;
    transition: color 0.3s ease;
    color: #0f2A1D;
}

.header a:hover {
    color: #f0c040;
}

/* ── HAMBURGER BUTTON (Hidden on Desktop) ───── */
.nav-toggle {
    display: none;
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 18px;
    z-index: 1010;
    padding: 0;
}

.hamburger-bar {
    width: 100%;
    height: 3px;
    background-color: #0f2A1D;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ── DROPDOWN PARENT CELL (Desktop View) ────── */
.nav-has-dropdown {
    position: relative;
}

.nav-link--dropdown {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.nav-chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    transition: transform .25s ease;
    stroke: currentColor;
}

/* Rotate chevron when dropdown is open */
.nav-has-dropdown.open .nav-chevron {
    transform: rotate(180deg);
}

/* ── DROPDOWN PANEL (Desktop View) ──────────── */
.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    min-width: 200px;
    background: #fff;
    border-radius: 5px;
    border: 1px solid rgba(15,42,29,.07);
    overflow: hidden;

    /* Hidden by default */
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-6px);
    transition: opacity .22s ease, transform .22s ease;
    z-index: 1050;
}

/* Visible state */
.nav-has-dropdown.open .nav-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

/* ── DROPDOWN ITEMS ─────────────────────────── */
.nav-dropdown__item {
    display: block;
    padding: 12px 22px;
    font-family: 'Aileron', sans-serif;
    font-size: .85rem;
    font-weight: 500;
    color: #0f2A1D;
    text-decoration: none;
    letter-spacing: .02em;
    border-bottom: 1px solid rgba(15,42,29,.06);
    transition: background .18s, color .18s, padding-left .18s;
    text-align: left;
}

.nav-dropdown__item:last-child {
    border-bottom: none;
}

.nav-dropdown__item:hover {
    background: rgb(15,42,29);
    color: #f0c040;
    padding-left: 28px;
}

/* ════════════════════════════════════════════
   RESPONSIVE — MOBILE / TABLET
   ============================================ */

/* ── TABLET (Surfaces ≤900px): shrink logo + nav text ── */
@media (max-width: 900px) {
    .header-logo {
        height: 70px !important;
        margin-left: 16px !important;
    }
    .header h3 {
        font-size: .85rem;
    }
}

/* ── MOBILE (≤700px): TRANSFORM TO HAMBURGER DROPDOWN ── */
@media (max-width: 700px) {
    
    /* Reveal burger button */
    .nav-toggle {
        display: flex;
    }

    /* Transform Hamburger Icon bars into an 'X' when active */
    .nav-toggle.active .hamburger-bar:nth-child(1) {
        transform: translateY(7.5px) rotate(45deg);
    }
    .nav-toggle.active .hamburger-bar:nth-child(2) {
        opacity: 0;
    }
    .nav-toggle.active .hamburger-bar:nth-child(3) {
        transform: translateY(-7.5px) rotate(-45deg);
    }

    /* Break the main structural layout table framework to allow vertical blocks */
    .header, 
    .header tbody, 
    .header tr {
        display: block;
        width: 100%;
        position: relative;
    }
    
    /* Logo bar cell area spacing */
    .nav-brand-cell {
        display: block;
        position: relative; 
        width: 100%;
        padding: 16px 20px;
        box-sizing: border-box;
    }

    .header-logo {
        margin-left: 0 !important;
        height: 60px !important;
    }

    /* FIXED: Convert navigation panel link containers safely below tracking container bar */
    .nav-links-container {
        display: block;
        position: absolute;
        top: 100%; /* Sits exactly under brand cell block bar */
        left: 0;
        width: 100%;
        background: #ffffff;
        box-shadow: 0 8px 16px rgba(15,42,29,.1);
        border-top: 1px solid rgba(15,42,29,.06);
        z-index: 1005;
        
        /* Drawer animation profiles */
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
    }

    /* Target open behavior class explicitly over elements */
    .nav-links-container.open {
        max-height: 500px; 
        opacity: 1;
        overflow-y: auto; /* Safety scroll if drop items overflow viewport */
    }

    /* Remove sub-table properties to allow dynamic layout flow cascading */
    .nav-links-inner-table,
    .nav-links-inner-table tbody,
    .nav-links-inner-table tr,
    .nav-links-inner-table td {
        display: block;
        width: 100% !important;
        text-align: left;
    }

    .nav-links-inner-table td {
        border-bottom: 1px solid rgba(15,42,29,.04);
    }

    .header h3 {
        font-size: 0.95rem;
    }

    .header a, 
    .nav-link--dropdown {
        display: block;
        width: 100%;
        padding: 16px 24px;
        box-sizing: border-box;
    }
    
    .nav-link--dropdown {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .nav-dropdown {
        position: relative;
        top: 0;
        left: 0;
        width: 100%;
        min-width: 100%;
        background: #f8f9fa;
        border-radius: 0;
        border: none;
        box-shadow: none;
        transform: none;
        transition: none;
        display: none; 
        box-sizing: border-box;
    }

    .nav-has-dropdown.open .nav-dropdown {
        display: block;
        transform: none !important; /* Destroys the desktop desktop shift bug */
    }

    .nav-dropdown__item {
        display: block;
        width: 100%;
        padding: 14px 32px !important; /* Clean inset alignment indentation */
        box-sizing: border-box;
        border-bottom: 1px solid rgba(15,42,29,.04);
        background: transparent;
    }
    
    .nav-dropdown__item:hover {
        background: rgb(15,42,29) !important; /* Restores signature dark green block filling fully */
        color: #f0c040 !important;
        padding-left: 36px !important;
    }
}