* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: linear-gradient(to bottom, #1C2526 0%, #2E3739 100%);
    position: relative;
}

.page-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-wrap {
    flex: 1 0 auto;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(169, 169, 169, 0.1) 0%,
        rgba(169, 169, 169, 0.1) 0.1vh,
        transparent 0.1vh,
        transparent 5vh
    ),
    repeating-linear-gradient(
        90deg,
        rgba(169, 169, 169, 0.1) 0%,
        rgba(169, 169, 169, 0.1) 0.1vw,
        transparent 0.1vw,
        transparent 5vw
    );
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255, 69, 0, 0.05) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    z-index: -1;
    pointer-events: none;
}

.header, .mobile-menu, footer[role="contentinfo"] {
    background: transparent;
}

.tech-nodes {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.tech-nodes span {
    position: absolute;
    width: 0.5vh;
    height: 0.5vh;
    background: #ff4500;
    border-radius: 50%;
    animation: glow 12s infinite ease-in-out;
    opacity: 0;
}

@keyframes glow {
    0%, 100% { opacity: 0; transform: scale(1); }
    20%, 30% { opacity: 0.8; transform: scale(1.5); }
}

.header {
    position: relative;
    width: 100%;
    z-index: 25; /* Above mobile-menu */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 10px;
    box-sizing: border-box;
    min-height: 70px; /* Allow growth for logo */
}

.header .logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    z-index: 26; /* Above header */
    padding-top: 5px; /* Extra padding */
}

.logo-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.header-logo {
    display: flex;
    gap: 0.5vh;
    align-items: flex-end;
    width: 7vh; /* Original size */
    position: relative;
}

.header-logo-bar {
    width: 1.2vh;
    border-radius: 0.18vh;
    box-shadow: 0 0 0.4vh rgba(0, 0, 0, 0.5);
    transition: transform 0.5s ease, background-color 0.5s ease;
}

.header-logo-bar:nth-child(1) { height: 2.4vh; background-color: #808080; }
.header-logo-bar:nth-child(2) { height: 3.6vh; background-color: #d3d3d3; }
.header-logo-bar:nth-child(3) { height: 4.8vh; background-color: #808080; }
.header-logo-bar:nth-child(4) { height: 6vh; background-color: #d3d3d3; }
.header-logo-bar:nth-child(5) { height: 7.2vh; background-color: #808080; }

.logo-wrapper:hover .header-logo-bar:nth-child(5) {
    animation: shrinkAndColor 1s ease forwards, growAndReset 1s ease 1s forwards;
}

@keyframes shrinkAndColor {
    0% { transform: scaleY(1); background-color: #808080; }
    50% { transform: scaleY(0.9); background-color: #ff4500; }
    100% { transform: scaleY(0.9); background-color: #ff4500; }
}

@keyframes growAndReset {
    0% { transform: scaleY(0.9); background-color: #ff4500; }
    100% { transform: scaleY(1); background-color: #808080; }
}

.logo-text {
    color: #ffffff;
    font-size: 1.4vh;
    font-weight: bold;
    margin-top: 0.4vh;
    text-shadow: 0 0 0.4vh rgba(0, 0, 0, 0.5);
    text-align: center;
    font-family: 'Orbitron', sans-serif;
}

.header .links-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 0 5px;
    max-width: 300px;
    flex-shrink: 1;
}

.header .links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header a {
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    line-height: 1;
    transition: color 0.3s ease;
    white-space: nowrap;
    padding: 4px 0;
    font-family: 'Orbitron', sans-serif;
}

.header a:hover {
    color: #ff4500;
}

.dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.dropdown-btn {
    color: #ffffff;
    font-size: 15px;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    margin: 0;
    transition: color 0.3s ease;
    font-family: 'Orbitron', sans-serif;
}

.dropdown-btn:hover {
    color: #ff4500;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: rgba(0, 0, 0, 0.8);
    min-width: 100px;
    box-shadow: 0 5px 10px 0 rgba(0,0,0,0.2);
    z-index: 20;
    border-radius: 3px;
    top: 100%;
    right: 0;
}

.dropdown-content.flip-above {
    top: auto;
    bottom: 100%;
}

.dropdown-content a {
    color: #ffffff;
    padding: 6px 8px;
    text-decoration: none;
    display: block;
    font-size: 13px;
    line-height: 1;
    margin: 0;
    font-family: 'Orbitron', sans-serif;
}

.dropdown-content a:hover {
    background-color: rgba(255, 69, 0, 0.2);
    color: #ff4500;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 30; /* Above mobile-menu */
}

.burger-menu span {
    width: 100%;
    height: 3px;
    background-color: #ffffff;
    transition: all 0.3s ease;
}

.burger-menu.active span:nth-child(1) {
    transform: translateY(-8px);
}

.burger-menu.active span:nth-child(2) {
    transform: translateY(0);
}

.burger-menu.active span:nth-child(3) {
    transform: translateY(8px);
}

/* Dynamic header height for mobile menu positioning */
:root {
    --header-height: 70px; /* Default mobile */
}

@media (min-width: 769px) {
    :root {
        --header-height: 80px; /* Desktop */
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 100px; /* Mobile, matches template-styles.css */
    }
}

@media (max-width: 480px) {
    :root {
        --header-height: 80px; /* Small screens */
    }
}

.mobile-menu {
    display: none;
    position: fixed;
    top: var(--header-height); /* Start below header */
    left: 0;
    width: 100%;
    height: calc(100vh - var(--header-height)); /* Fill remaining space */
    background: rgba(0, 0, 0, 0.9);
    flex-direction: column;
    padding: 40px 20px;
    z-index: 14; /* Below header, logo, burger-menu */
    box-shadow: 0 5px 10px rgba(0,0,0,0.2);
}

.mobile-menu.active {
    display: flex;
}

.mobile-menu a {
    color: #ffffff;
    text-decoration: none;
    font-size: 20px;
    padding: 12px 0;
    text-align: left;
    font-family: 'Orbitron', sans-serif;
}

.mobile-menu a:hover {
    color: #ff4500;
}

.mobile-dropdown {
    display: flex;
    flex-direction: column;
}

.mobile-dropdown-btn {
    color: #ffffff;
    font-size: 20px;
    background: none;
    border: none;
    text-align: left;
    padding: 12px 0;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
}

.mobile-dropdown-btn:hover {
    color: #ff4500;
}

.mobile-dropdown-content {
    display: none;
    padding-left: 20px;
}

.mobile-dropdown-content.active {
    display: flex;
    flex-direction: column;
}

.mobile-dropdown-content a {
    font-size: 18px;
    padding: 10px 0;
    font-family: 'Orbitron', sans-serif;
}

footer[role="contentinfo"] {
    z-index: 10;
    padding: 10px 0;
    flex-shrink: 0;
}

.container {
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 15px;
    max-width: 1000px;
    margin: 0 auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
    color: #ffffff;
    gap: 15px;
}

.footer-copyright {
    margin: 0;
    font-size: 16px;
    text-align: left;
    flex: 1;
    align-self: flex-end;
}

.footer-section.contact {
    text-align: center;
    flex: 1;
    max-width: 300px;
}

.footer-section.legal {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-section h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    color: #ffffff;
}

.footer-contact {
    margin: 0;
    font-size: 16px;
}

.footer-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-link {
    color: #ffffff;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #ff4500;
}

/* Media queries for responsive header */
@media (min-width: 769px and max-width: 1200px) {
    .header {
        min-height: 80px;
        padding: 15px 15px;
    }
    .header .links-container {
        max-width: 260px;
        gap: 8px;
    }
    .header .links {
        gap: 8px;
    }
    .header a, .dropdown-btn {
        font-size: 14px;
    }
    .dropdown-content a {
        font-size: 12px;
    }
    .footer-copyright, .footer-contact, .footer-link {
        font-size: 15px;
    }
    .footer-section h3 {
        font-size: 19px;
    }
    .footer-section.contact {
        max-width: 250px;
    }
}

@media (max-width: 768px) {
    html, body {
        height: auto;
    }

    body {
        background: linear-gradient(to bottom, #1C2526 0%, #2E3739 100%);
    }

    body::before, body::after {
        display: block;
    }

    .header {
        position: relative;
        padding: 10px 15px;
        min-height: 90px; /* Increased for larger logo */
    }

    .header .logo {
        padding-top: 10px;
    }

    .header .links-container {
        display: none;
    }

    .burger-menu {
        display: flex;
    }

    .container {
        padding: 0;
        max-width: 90%;
        justify-content: center;
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .footer-content {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .footer-copyright {
        font-size: 12px;
        text-align: center;
        align-self: center;
    }

    .footer-section.contact {
        max-width: 100%;
    }

    .footer-section h3 {
        font-size: 16px;
        margin-bottom: 4px;
    }

    .footer-contact, .footer-link {
        font-size: 12px;
    }

    .footer-nav {
        gap: 4px;
    }

    .header-logo {
        width: 9vh;
        gap: 0.7vh;
    }

    .header-logo-bar {
        width: 1.6vh;
        border-radius: 0.24vh;
    }

    .header-logo-bar:nth-child(1) { height: 3.2vh; }
    .header-logo-bar:nth-child(2) { height: 4.8vh; }
    .header-logo-bar:nth-child(3) { height: 6.4vh; }
    .header-logo-bar:nth-child(4) { height: 8vh; }
    .header-logo-bar:nth-child(5) { height: 9.6vh; }

    .logo-text {
        font-size: 1.8vh;
        margin-top: 0.6vh;
    }
}

@media (max-width: 480px) {
    .header-logo-bar {
        width: 1vh;
    }

    .header-logo-bar:nth-child(1) { height: 2vh; }
    .header-logo-bar:nth-child(2) { height: 3vh; }
    .header-logo-bar:nth-child(3) { height: 4vh; }
    .header-logo-bar:nth-child(4) { height: 5vh; }
    .header-logo-bar:nth-child(5) { height: 6vh; }

    .header-logo {
        gap: 0.5vh;
        width: 6vh;
    }

    .logo-text {
        font-size: 1.2vh;
        margin-top: 0.4vh;
    }

    .footer-copyright, .footer-contact, .footer-link {
        font-size: 10px;
    }

    .footer-section h3 {
        font-size: 14px;
    }
}