* { box-sizing: border-box; }

html {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    scroll-behavior: smooth;
    overflow-x: hidden;
    width: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: inherit;
    line-height: inherit;
    color: inherit;
    background-color: inherit;
    position: relative;
    width: 100%;
}

#header #about {
    /* keep existing header text styles; ensure monospace for caret nicer look doesn't matter */
    font-variant-ligatures: none;
    /* a11y: make updates announced */
    caret-color: transparent;
  }
  
  /* pseudo element for the caret */
  #header #about.typing::after {
    content: "";
    display: inline-block;
    width: 2px;
    height: 1.1em;
    margin-left: 6px;
    vertical-align: middle;
    background: rgba(255,255,255,0.95);
    animation: blink-caret 1s steps(1) infinite;
  }
  
  /* blink animation */
  @keyframes blink-caret {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
  }
  
  /* Respect users who prefer reduced motion */
  @media (prefers-reduced-motion: reduce) {
    #header #about.typing::after { animation: none; opacity: 1; }
  }

#header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 10px;
    box-sizing: border-box;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 0 1rem;
    position: relative;
}

#header h1 {
    flex: 1;
    text-align: center;
    color: white;
    font-weight: 700;
    font-size: clamp(1.25rem, 3.5vw, 2rem);
    margin: 0;
    letter-spacing: -0.02em;
}

.menu-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s ease;
}

.menu-toggle:hover { background: rgba(255,255,255,0.3); }
.menu-toggle:focus {
    outline: 2px solid rgba(255,255,255,0.4);
    outline-offset: 2px;
}

.menu-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    margin: 0.75rem 0 0 0;
    gap: 0.5rem;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.menu-bar a {
    color: white;
    text-align: center;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: 0.3s ease;
    position: relative;
    overflow: hidden;
}

.menu-bar a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.2);
    transition: 0.3s ease;
}
.menu-bar a:hover::before { left: 0; }
.menu-bar a:hover {
    background-color: rgba(255,255,255,0.15);
    color: #ffd700;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.menu-bar a.active {
    background-color: rgba(255,255,255,0.15);
    color: #ffd700;
}
@media (max-width: 768px) {
    .menu-toggle { display: block; }

    .menu-bar {
        display: grid;                          /* 2-column grid instead of flex column */
        grid-template-columns: repeat(2, 1fr);  /* 2 × 3 layout */
        gap: 0.75rem 1rem;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        padding: 0;
        visibility: hidden;
        justify-items: stretch;
        align-items: stretch;
    }

    .menu-bar.menu-open {
        max-height: 500px;
        opacity: 1;
        padding: 1rem;
        margin-top: 0.5rem;
        visibility: visible;
    }

    .menu-bar a {
        width: 100%;
        padding: 0.75rem 1rem;
        margin: 0;
    }

    html {
        padding-bottom: 30px;
    }
}

@media (max-width: 420px) {
    #header { padding: 0.75rem 0; }
    #header h1 { font-size: 1.25rem; }
}

@media (min-width: 769px) {
    .menu-bar { max-height: none !important; opacity: 1 !important; }
}

@media (min-width: 1054px) {
    .menu-bar a {
        padding: 0.9rem 2rem;
        font-size: 1rem;
    }
}

footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: fixed;
    bottom: 0;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    color: white;
    text-align: center;
    padding: 1rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
    z-index: 999;
}

footer a {
    color: #ffd700;
    text-decoration: none;
    font-weight: 600;
}
footer a:hover { color: #fff; text-decoration: underline; }

@media (prefers-color-scheme: dark) {
    html, body { background: #1a1a1a; color: #e0e0e0; }
}
