@media (max-width: 991px) {

    html,
    body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }

    html {
        font-size: 14px;
    }

    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 2rem;
    }

    .animated-background {
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        transform: none;
    }

    .section-title {
        font-size: 2.2rem;
        margin-bottom: 2rem;
    }

    /* ============================================
       MOBILE MENU PANEL — Modern glassmorphism drawer
       Narrow (~190px), centered nav items with icon
       + label, no header label, clean and minimal.
       ============================================ */
    .navbar-collapse {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        max-width: 190px;
        height: 100vh;
        background: linear-gradient(160deg,
            rgba(10, 14, 35, 0.95) 0%,
            rgba(5, 7, 15, 0.98) 100%);
        backdrop-filter: blur(28px) saturate(180%);
        -webkit-backdrop-filter: blur(28px) saturate(180%);
        padding: 0;
        margin: 0;
        border: none;
        border-left: 1px solid rgba(34, 211, 238, 0.18);
        box-shadow: -24px 0 80px rgba(0, 0, 0, 0.6),
                    -1px 0 0 rgba(34, 211, 238, 0.15);
        z-index: 9999;
        transition: right 0.45s cubic-bezier(0.22, 1, 0.36, 1);
        overflow-y: auto;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    [data-theme="light"] .navbar-collapse {
        background: linear-gradient(160deg,
            rgba(255, 255, 255, 0.96) 0%,
            rgba(245, 247, 250, 0.98) 100%);
        border-left: 1px solid rgba(14, 165, 233, 0.18);
    }

    /* Top-left decorative glow accent */
    .navbar-collapse::before {
        content: '';
        position: absolute;
        top: -60px;
        right: -60px;
        width: 180px;
        height: 180px;
        border-radius: 50%;
        background: radial-gradient(circle,
            rgba(34, 211, 238, 0.18) 0%,
            transparent 70%);
        pointer-events: none;
        z-index: 0;
    }

    .navbar-collapse::-webkit-scrollbar {
        display: none;
    }

    .navbar-collapse.show {
        right: 0;
    }

    .navbar-collapse.collapsing {
        right: -100%;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Menu list — clean vertical stack, no header.
       Bootstrap's `align-items-center` class on the <ul> is overridden
       so every nav item stretches to the full panel width. */
    .navbar-nav,
    .navbar-nav.align-items-center {
        padding: 4.5rem 0.8rem 1.25rem;
        flex-direction: column;
        gap: 0.4rem;
        min-height: 100vh;
        align-items: stretch !important;
        position: relative;
        z-index: 1;
    }

    /* Each nav <li> is also a flex item — force full width so the link inside fills */
    .navbar-nav .nav-item {
        width: 100%;
    }

    /* "MENÚ" label removed — cleaner minimal look */
    .navbar-nav::before {
        content: none;
    }

    /* Hamburger toggle — clean icon button */
    .navbar-toggler {
        border: none;
        padding: 0.5rem;
        box-shadow: none !important;
        outline: none !important;
        position: relative;
        z-index: 10000;
        background: transparent;
        transition: transform 0.3s ease;
    }

    .navbar-toggler:active {
        transform: scale(0.9);
    }

    .navbar-toggler .fa-bars,
    .navbar-toggler .fa-times {
        transition: all 0.3s ease;
        font-size: 1.3rem;
    }

    /* Each nav item: full-width row with icon + label centered as a group */
    .navbar-nav .nav-link {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.65rem;
        width: 100%;
        padding: 0.65rem 0.5rem;
        text-align: center;
        font-size: 0.88rem;
        font-weight: 600;
        color: var(--text-primary) !important;
        position: relative;
        transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                    background 0.3s,
                    border-color 0.3s,
                    box-shadow 0.4s;
        opacity: 0;
        transform: translateX(28px);
        animation: slideInMenuItem 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
        letter-spacing: 0.01em;
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, 0.05);
        background: rgba(255, 255, 255, 0.02);
        overflow: hidden;
    }

    /* Hide the trailing chevron in centered mode — would unbalance the group */
    .navbar-nav .nav-link::after {
        display: none;
    }

    [data-theme="light"] .navbar-nav .nav-link {
        border: 1px solid rgba(15, 23, 42, 0.06);
        background: rgba(15, 23, 42, 0.02);
    }

    /* Left accent bar — hidden until hover/focus, slides in from left */
    .navbar-nav .nav-link::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 0;
        width: 3px;
        height: 0;
        background: linear-gradient(180deg, #22d3ee, #a855f7);
        transform: translateY(-50%);
        transition: height 0.35s cubic-bezier(0.22, 1, 0.36, 1);
        border-radius: 0 3px 3px 0;
        box-shadow: 0 0 12px rgba(34, 211, 238, 0.7);
    }

    /* Icon styling — small cube on the left */
    .nav-link-icon {
        width: 28px;
        height: 28px;
        flex-shrink: 0;
        border-radius: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.78rem;
        color: #22d3ee;
        background: rgba(34, 211, 238, 0.12);
        border: 1px solid rgba(34, 211, 238, 0.25);
        transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
                    background 0.3s,
                    color 0.3s;
    }

    [data-theme="light"] .nav-link-icon {
        background: rgba(14, 165, 233, 0.1);
        border-color: rgba(14, 165, 233, 0.2);
        color: #0ea5e9;
    }

    .navbar-nav .nav-link span {
        flex: 1;
        min-width: 0;
    }

    /* Trailing chevron — invisible until hover */
    .navbar-nav .nav-link::after {
        content: '\f054';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        font-size: 0.7rem;
        color: var(--text-secondary);
        opacity: 0;
        transform: translateX(-6px);
        transition: opacity 0.3s, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    }

    /* Hover / focus / active state */
    .navbar-nav .nav-link:hover,
    .navbar-nav .nav-link:focus,
    .navbar-nav .nav-link.active {
        background: linear-gradient(90deg,
            rgba(34, 211, 238, 0.12),
            rgba(34, 211, 238, 0.02));
        border-color: rgba(34, 211, 238, 0.35);
        box-shadow: 0 6px 18px rgba(34, 211, 238, 0.2);
        color: var(--text-primary) !important;
        transform: translateX(0);
    }

    .navbar-nav .nav-link:hover::before,
    .navbar-nav .nav-link:focus::before,
    .navbar-nav .nav-link.active::before {
        height: 60%;
    }

    .navbar-nav .nav-link:hover .nav-link-icon,
    .navbar-nav .nav-link:focus .nav-link-icon {
        transform: rotate(-6deg) scale(1.08);
        background: rgba(34, 211, 238, 0.22);
        color: #ffffff;
    }

    .navbar-nav .nav-link:hover::after,
    .navbar-nav .nav-link:focus::after {
        opacity: 1;
        transform: translateX(0);
        color: #22d3ee;
    }

    /* Stagger entry — each item delayed slightly more */
    @keyframes slideInMenuItem {
        from {
            opacity: 0;
            transform: translateX(28px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    .navbar-collapse.show .navbar-nav .nav-link:nth-child(1) { animation-delay: 0.08s; }
    .navbar-collapse.show .navbar-nav .nav-link:nth-child(2) { animation-delay: 0.14s; }
    .navbar-collapse.show .navbar-nav .nav-link:nth-child(3) { animation-delay: 0.20s; }
    .navbar-collapse.show .navbar-nav .nav-link:nth-child(4) { animation-delay: 0.26s; }
    .navbar-collapse.show .navbar-nav .nav-link:nth-child(5) { animation-delay: 0.32s; }
    .navbar-collapse.show .navbar-nav .nav-link:nth-child(6) { animation-delay: 0.38s; }

    /* Theme toggle footer — pushed to bottom of drawer */
    .navbar-nav .nav-item:last-child {
        margin-top: auto;
        padding: 1.25rem 0.5rem 0.5rem;
        border-top: 1px solid rgba(34, 211, 238, 0.15);
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.85rem;
        opacity: 0;
        animation: slideInMenuItem 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.44s forwards;
    }

    [data-theme="light"] .navbar-nav .nav-item:last-child {
        border-top-color: rgba(14, 165, 233, 0.18);
    }

    .navbar-nav .nav-item:last-child::before {
        content: 'Tema';
        font-size: 0.78rem;
        color: var(--text-secondary);
        font-weight: 600;
        letter-spacing: 0.05em;
    }

    .theme-toggle {
        margin: 0;
        width: 38px;
        height: 38px;
        border-radius: 50%;
        border: 1px solid rgba(34, 211, 238, 0.3);
        background: linear-gradient(135deg,
            rgba(34, 211, 238, 0.12),
            rgba(168, 85, 247, 0.08));
        color: #22d3ee;
        font-size: 0.9rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                    background 0.3s,
                    box-shadow 0.4s;
        opacity: 1 !important;
        animation: none !important;
    }

    .theme-toggle:hover,
    .theme-toggle:focus {
        transform: rotate(-12deg) scale(1.08);
        background: linear-gradient(135deg,
            rgba(34, 211, 238, 0.25),
            rgba(168, 85, 247, 0.15));
        box-shadow: 0 6px 18px rgba(34, 211, 238, 0.35);
        color: #fff;
    }

    .hero {
        padding-top: 120px;
        padding-bottom: 60px;
        text-align: center;
        height: auto;
        min-height: 100vh;
    }

    #hero-title {
        font-size: 3rem;
        line-height: 1.1;
    }

    #hero-role {
        font-size: 1.4rem;
        margin-bottom: 1.5rem;
        min-height: auto;
        display: inline-block;
    }

    #hero-text {
        font-size: 1.1rem;
        margin-left: auto;
        margin-right: auto;
        max-width: 100%;
    }

    .hero-content .d-flex {
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem !important;
    }

    .social-stack {
        justify-content: center;
        margin-top: 2.5rem;
    }

    .about-section {
        text-align: center;
    }

    .about-image-container {
        margin-bottom: 3rem;
        transform: scale(0.95);
    }

    .about-name {
        font-size: 2.5rem;
    }

    .about-quote-box {
        text-align: left;
        margin-top: 2rem;
        border-left-width: 3px;
    }

    .about-section .d-flex {
        justify-content: center;
        flex-wrap: wrap;
    }

    .timeline {
        padding: 20px 0;
    }

    .timeline::before {
        left: 20px;
        transform: none;
    }

    .timeline-row {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 40px;
        position: relative;
    }

    .timeline-col {
        width: 100%;
        padding: 0;
    }

    .col-center {
        position: absolute;
        left: 0;
        top: 0;
        width: 40px;
        height: 100%;
        justify-content: flex-start;
        align-items: flex-start;
        padding-top: 5px;
        z-index: 2;
    }

    .timeline-dot-wrapper {
        margin-left: 9px;
    }

    .col-left,
    .col-right {
        padding-left: 60px;
        padding-right: 0;
        text-align: left !important;
        justify-content: flex-start !important;
    }

    .timeline-row.left .col-left {
        order: 2;
    }

    .timeline-row.left .col-right {
        order: 1;
        margin-bottom: 0.5rem;
    }

    .timeline-row.right .col-left {
        order: 1;
        margin-bottom: 0.5rem;
    }

    .timeline-row.right .col-right {
        order: 2;
    }

    .timeline-date-label {
        justify-content: flex-start;
        height: auto;
    }

    .date-text {
        font-size: 1.1rem;
        color: var(--primary);
        -webkit-text-stroke: 0;
        opacity: 1;
        text-shadow: none;
        font-weight: 700;
        letter-spacing: 1px;
    }

    .timeline-content-card {
        width: 100%;
        max-width: 100%;
        text-align: left;
        padding: 1.5rem;
    }

    .timeline-content-card:hover {
        transform: none;
    }

    .timeline-content-card::after {
        display: none;
    }

    .timeline-company {
        justify-content: flex-start !important;
    }

    .marquee-content span {
        font-size: 2.5rem;
    }

    .modal-dialog {
        margin: 1rem;
    }
}

/* =========================================
   MOBILE PHONES (Max 576px)
   ========================================= */
@media (max-width: 576px) {

    .section-title {
        font-size: 1.8rem;
        letter-spacing: 1px;
    }

    .hero-content .d-flex {
        flex-direction: column;
        width: 100%;
    }

    .btn-primary-custom,
    .btn-outline-custom {
        width: 100%;
        display: block;
        padding: 1rem;
    }

    .social-stack {
        flex-wrap: nowrap;
        gap: 0.5rem;
        justify-content: center;
    }

    .social-icon {
        font-size: 1.2rem;
        width: 35px;
        height: 35px;
        background: rgba(255, 255, 255, 0.08);
        border-radius: 50%;
        padding: 0;
    }

    .section {
        padding: 5rem 0;
    }

    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .project-card,
    .cert-card-pro,
    .education-card-modern {
        margin-bottom: 2rem;
    }

    .project-img {
        height: 200px;
    }

    .contact-card {
        padding: 2rem;
        border-radius: 20px;
    }

    .social-card {
        padding: 1.5rem;
        gap: 1rem;
    }

    .tech-grid-pro {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.6rem;
    }

    .tech-card-pro {
        padding: 0.8rem 0.4rem;
        aspect-ratio: 1/1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .tech-icon-box {
        font-size: 1.8rem;
        margin-bottom: 0.3rem;
    }

    .tech-name {
        font-size: 0.75rem;
    }

    footer {
        padding: 3rem 1.5rem;
    }

    footer p {
        font-size: 0.9rem;
    }

    .navbar>.container {
        flex-wrap: nowrap !important;
        gap: 0.5rem;
    }

    .navbar-brand {
        flex-shrink: 1;
        min-width: 0;
        max-width: 85%;
        font-size: 1.1rem;
    }

    .brand-logo {
        flex-shrink: 0;
    }

    .brand-separator {
        flex-shrink: 0;
        margin: 0 0.25rem;
    }

    .brand-tagline {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
        min-width: 0;
        font-size: 0.75rem;
        opacity: 0.8;
    }

    .navbar-toggler {
        flex-shrink: 0;
        margin-left: auto;
        border: none;
        padding: 0.25rem;
    }
}