/* Global Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --nav-height: 82px;
    --content-max: 1100px;
    --touch-min: 44px;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Source Code Pro', monospace;
    background-color: #030712;
    background-image: 
        radial-gradient(ellipse at top right, rgba(0, 255, 157, 0.08) 0%, transparent 45%),
        radial-gradient(ellipse at bottom left, rgba(0, 255, 255, 0.05) 0%, transparent 45%);
    background-attachment: fixed;
    color: #e0e0e0;
    line-height: 1.6;
    font-size: 16px;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a,
button,
summary {
    -webkit-tap-highlight-color: rgba(0, 255, 157, 0.18);
    touch-action: manipulation;
}

/* Premium Micro-Dot Hardware Mesh */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 20px 20px;
    z-index: -2;
    pointer-events: none;
}

/* Navigation */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: rgba(1, 3, 10, 0.78);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 255, 157, 0.28);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding-left: max(40px, env(safe-area-inset-left));
    padding-right: max(40px, env(safe-area-inset-right));
    gap: 12px;
}

.logo {
    font-family: 'Orbitron', sans-serif;
    color: #00ff9d;
    text-shadow: none;
    font-size: clamp(1.15rem, 3.5vw, 2.2rem);
    letter-spacing: 2px;
    cursor: pointer;
    transition: transform 0.3s ease, text-shadow 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.menu-toggle {
    display: none;
    width: 46px;
    height: 46px;
    border: 1px solid rgba(0, 255, 157, 0.55);
    border-radius: 10px;
    background: linear-gradient(180deg, #061427 0%, #030a16 100%);
    cursor: pointer;
    padding: 9px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: #8feaff;
    margin: 5px 0;
    transition: all 0.3s ease;
    transform-origin: center;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(90deg) translateX(-9px);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
    transform: rotate(90deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(90deg) translateX(9px);
}

.logo span {
    color: #0ff;
    text-shadow: none;
}

.logo:hover,
.logo:focus-visible,
.logo:active {
    transform: scale(1.05) rotate(-1deg);
    text-shadow: 0 0 20px #00ff9d, 0 0 40px #00ff9d, 0 0 60px #0ff;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 10px;
    padding: 0;
    align-items: center;
}

.nav-links a {
    display: inline-block;
    text-decoration: none;
    color: #e0e0e0;
    padding: 11px 20px;
    min-height: var(--touch-min);
    transition: 0.3s ease-in-out;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.95rem;
    border-radius: 30px;
    border: 1px solid rgba(0, 255, 157, 0.5);
    background: linear-gradient(180deg, #061427 0%, #030a16 100%);
    box-shadow: inset 0 0 0 1px rgba(143, 234, 255, 0.12);
}

.nav-links a:hover {
    color: #01030a;
    background: #00ff9d;
    box-shadow: 0 0 15px #00ff9d;
    font-weight: bold;
}

/* Hero Section */

.hero {
    min-height: calc(100vh - var(--nav-height));
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: radial-gradient(circle at center, #02050d, #000000);
    padding: 32px 20px;
}

.hero-content {
    width: min(100%, 560px);
    margin: 0 auto;
}

.main-name {
    font-size: clamp(2rem, 7vw, 3rem);
    color: #00ff9d;
    text-shadow: 0 0 15px #00ff9d;
    margin: 10px 0;
}

.glow-text {
    color: #0ff;
    text-shadow: 0 0 10px #0ff;
}

.tagline {
    margin-top: 10px;
    color: #aaa;
    min-height: 1.6em;
    display: flex;
    align-items: center;
    justify-content: center;
}

#typing {
    display: inline-block;
    width: min(24ch, 100%);
    white-space: nowrap;
    text-align: left;
}

/* Profile Image */

.profile-container {
    position: relative;
    width: clamp(130px, 35vw, 180px);
    margin: 0 auto 20px;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.profile-pic {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #00ff9d;
    box-shadow: 0 0 25px #00ff9d66;
    image-rendering: auto;
}

/* Scanning line animation */
.scan-line {
    position: absolute;
    width: 100%;
    height: 3px;
    background: #00ff9d;
    top: 0;
    left: 0;
    box-shadow: 0 0 10px #00ff9d;
    animation: scan 3s linear infinite;
}

@keyframes scan {
    0% { top: 0; }
    100% { top: 100%; }
}

/* Sections */

.section {
    padding: clamp(48px, 7vw, 72px) 20px;
    text-align: center;
    scroll-margin-top: calc(var(--nav-height) + 14px);
    content-visibility: auto;
    contain-intrinsic-size: 700px;
}

.dark {
    background: transparent;
}

.section-title {
    font-size: clamp(1.45rem, 5.2vw, 2rem);
    margin-bottom: 32px;
    color: #00ff9d;
    text-shadow: 0 0 10px #00ff9d;
    font-family: 'Orbitron', sans-serif;
}

/* About */

.about-content {
    max-width: 700px;
    margin: auto;
    font-size: 1.1rem;
}

/* Skills */

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 20px;
    max-width: var(--content-max);
    margin: auto;
}

.skill-card {
    padding: 20px;
    background: linear-gradient(180deg, #061427 0%, #030a16 100%);
    border: 1px solid rgba(0, 255, 157, 0.5);
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(143, 234, 255, 0.12);
    transition: 0.3s;
    position: relative;
    overflow: hidden;
}

.skill-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 20px #00ff9d;
    border: 1px solid #00ff9d;
}

.skill-card i {
    display: block;
    font-size: 2.2rem;
    margin-bottom: 12px;
    color: #e0e0e0;
    transition: 0.3s;
}

.skill-card:hover i {
    color: #00ff9d;
    transform: scale(1.1);
}

.highlight {
    border: 1px solid #00ff9d;
    color: #00ff9d;
}

/* Projects */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 20px;
    max-width: var(--content-max);
    margin: auto;
}

.project-card {
    padding: 20px;
    background: linear-gradient(180deg, #061427 0%, #030a16 100%);
    border: 1px solid rgba(0, 255, 157, 0.5);
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(143, 234, 255, 0.12);
    transition: 0.3s;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 20px #00ff9d;
    border: 1px solid #00ff9d;
}

/* Certifications */

.certifications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 20px;
    max-width: var(--content-max);
    margin: auto;
}

.cert-card {
    padding: 20px;
    background: linear-gradient(180deg, #061427 0%, #030a16 100%);
    border: 1px solid rgba(0, 255, 157, 0.5);
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(143, 234, 255, 0.12);
    text-align: center;
    transition: 0.3s;
}

.cert-card:hover {
    transform: translateY(-5px);
    border: 1px solid #00ff9d;
    box-shadow: 0 0 20px #00ff9d;
}

.cert-card i {
    font-size: 2rem;
    color: #e0e0e0;
    margin-bottom: 10px;
    transition: 0.3s;
}

.cert-card:hover i {
    color: #00ff9d;
    transform: scale(1.1);
}

.cert-card h3 {
    color: #e0e0e0;
    margin-bottom: 8px;
}

.cert-card p {
    color: #9fb2bf;
    font-size: 0.95rem;
}

.cert-meta {
    margin-bottom: 4px;
}

.cert-id {
    font-size: 0.9rem;
    color: #8aa0ad;
}

.cert-link {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 16px;
    min-height: var(--touch-min);
    border-radius: 20px;
    border: 1px solid rgba(224, 224, 224, 0.7);
    color: #e0e0e0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: 0.3s;
}

.cert-link:hover {
    border-color: #00ff9d;
    color: #00ff9d;
    box-shadow: 0 0 12px rgba(0, 255, 157, 0.45);
}

.cert-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cert-details {
    margin-top: 14px;
    text-align: center;
}

.cert-details summary {
    cursor: pointer;
    margin-bottom: 0;
    min-height: var(--touch-min);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px 12px;
    width: 100%;
    max-width: 100%;
}

.cert-credential {
    margin-top: 0;
    text-align: center;
}

.cert-skills-old {
    margin-top: 12px;
    text-align: left;
}

.cert-skills-old summary {
    color: #8feaff;
    font-weight: 600;
}

.cert-toggle {
    list-style: none;
}

.cert-toggle::-webkit-details-marker {
    display: none;
}

.cert-credential .cert-id {
    margin-top: 10px;
}

.cert-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
    margin-bottom: 12px;
}

.cert-skills span {
    border: 1px solid rgba(143, 234, 255, 0.6);
    border-radius: 8px;
    padding: 6px 10px;
    color: #bfefff;
    font-size: 0.9rem;
    background: rgba(143, 234, 255, 0.08);
}

/* Contact */

.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: #020712;
    color: #e0e0e0;
    font-size: 1.8rem;
    border: 1px solid #00ff9d44;
    border-radius: 50%;
    min-width: 52px;
    min-height: 52px;
    transition: 0.3s;
    text-decoration: none;
}

.menu-toggle:focus-visible,
.nav-links a:focus-visible,
.cert-link:focus-visible,
.social-btn:focus-visible,
.cert-details summary:focus-visible {
    outline: 2px solid #8feaff;
    outline-offset: 2px;
}

.social-btn:hover {
    color: #01030a;
    background: #00ff9d;
    box-shadow: 0 0 20px #00ff9d;
    border: 1px solid #00ff9d;
    transform: translateY(-5px);
}

/* Footer */

footer {
    text-align: center;
    padding: 20px max(20px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    background: #000000;
    border-top: 1px solid #00ff9d55;
    font-size: 0.9rem;
}

/* Animated project cards */
.glow-card {
    position: relative;
    overflow: hidden;
}

.glow-card::before {
    content: "";
    position: absolute;
    width: 120%;
    height: 120%;
    background: linear-gradient(
        120deg,
        transparent,
        #00ff9d44,
        transparent
    );
    top: -10%;
    left: -10%;
    transform: rotate(25deg);
    opacity: 0;
    transition: 0.5s;
}

.glow-card:hover::before {
    opacity: 1;
    animation: shine 1s linear;
}

@keyframes shine {
    from {
        transform: translateX(-100%) rotate(25deg);
    }
    to {
        transform: translateX(100%) rotate(25deg);
    }
}

/* Dashboard */
#dashboard {
    background: transparent;
    border: none;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 20px;
    max-width: var(--content-max);
    margin: auto;
}

.dashboard-card {
    background: linear-gradient(180deg, #03111f 0%, #020712 100%);
    border: 1px solid rgba(0, 255, 157, 0.35);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: inset 0 0 0 1px rgba(0, 255, 255, 0.08);
    transition: none;
}

.dashboard-card:hover {
    transform: none;
    box-shadow: inset 0 0 0 1px rgba(0, 255, 255, 0.08);
    border: 1px solid rgba(0, 255, 157, 0.35);
}

.dashboard-card i {
    display: block;
    font-size: 2rem;
    margin-bottom: 15px;
    color: #8feaff;
    transition: none;
}

.dashboard-card:hover i {
    color: #8feaff;
    transform: none;
}

.dashboard-card h3 {
    font-size: 0.9rem;
    letter-spacing: 1px;
    color: #bcd3df;
}

.status {
    font-size: 1rem;
    margin-top: 10px;
    font-weight: bold;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.dashboard-card h3,
.cert-card h3,
.project-card h3 {
    overflow-wrap: anywhere;
}

.metric-green { color: #00ff9d; }
.metric-cyan { color: #0ff; }

/* Hacker Terminal & Effects */

.terminal-window {
    max-width: min(var(--content-max), 100%);
    margin: 0 auto;
    background: #01030a;
    border: 1px solid #00ff9d55;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 255, 157, 0.1);
    overflow: hidden;
    text-align: left;
}

.terminal-header {
    background: #020712;
    padding: 12px 15px;
    border-bottom: 1px solid #00ff9d55;
    display: flex;
    align-items: center;
    position: relative;
}

.terminal-header .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.terminal-header .close { background: #ff5f56; }
.terminal-header .min { background: #ffbd2e; }
.terminal-header .max { background: #27c93f; }

.term-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: #00ff9d;
    font-size: 0.95rem;
    font-family: 'Source Code Pro', monospace;
    font-weight: bold;
    letter-spacing: 1.5px;
    text-shadow: 0 0 10px #00ff9d;
}

.terminal-body {
    padding: 30px;
    color: #e0e0e0;
    font-family: 'Source Code Pro', monospace;
    font-size: clamp(0.92rem, 2.8vw, 1.05rem);
    line-height: 1.7;
    text-align: left;
    background: rgba(0, 255, 157, 0.02);
    box-shadow: inset 0 0 30px rgba(0, 255, 157, 0.02);
    overflow-wrap: anywhere;
}

.terminal-body .prompt {
    color: #00ff9d;
    font-weight: bold;
    margin-right: 10px;
}

.blink-cursor, .cursor {
    display: inline-block;
    color: #00ff9d;
    font-weight: bold;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* Glitch Effect */
.glitch {
    position: relative;
    display: inline-block;
}

.glitch::before, .glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    color: #00ff9d;
    background: transparent;
    z-index: -1;
}

.glitch::before {
    left: 3px;
    text-shadow: -2px 0 red;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

.glitch::after {
    left: -3px;
    text-shadow: -2px 0 blue;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(10px, 9999px, 44px, 0); }
    20% { clip: rect(66px, 9999px, 18px, 0); }
    40% { clip: rect(27px, 9999px, 63px, 0); }
    60% { clip: rect(81px, 9999px, 34px, 0); }
    80% { clip: rect(48px, 9999px, 5px, 0); }
    100% { clip: rect(23px, 9999px, 98px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(65px, 9999px, 100px, 0); }
    20% { clip: rect(12px, 9999px, 43px, 0); }
    40% { clip: rect(89px, 9999px, 20px, 0); }
    60% { clip: rect(34px, 9999px, 66px, 0); }
    80% { clip: rect(56px, 9999px, 12px, 0); }
    100% { clip: rect(98px, 9999px, 45px, 0); }
}


/* Responsive Breakpoints */

/* Tablet: 769px - 1024px */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .navbar {
        padding: 16px max(24px, env(safe-area-inset-right)) 16px max(24px, env(safe-area-inset-left));
        background: rgba(1, 3, 10, 0.86);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(0, 255, 157, 0.35);
    }

    .logo {
        font-size: clamp(1rem, 3vw, 1.8rem);
        letter-spacing: 1.6px;
    }

    .nav-links {
        gap: 8px;
    }

    .nav-links a {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .skills-grid,
    .projects-grid,
    .certifications-grid,
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .section {
        padding: 56px max(20px, env(safe-area-inset-right)) 56px max(20px, env(safe-area-inset-left));
    }

    .hero-content {
        width: min(100%, 480px);
    }

    .profile-container {
        width: clamp(120px, 24vw, 170px);
        margin-bottom: 18px;
    }

    .tagline {
        min-height: 1.8em;
    }
}

/* Tablet and mobile: up to 1024px */
@media screen and (max-width: 1024px) {
    body {
        background-attachment: scroll;
    }

    .navbar {
        padding: 14px max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left));
        gap: 10px;
        flex-wrap: nowrap;
        position: sticky;
    }

    .menu-toggle {
        display: block;
        margin-left: auto;
    }
    
    .nav-links {
        display: none;
        width: fit-content;
        min-width: 176px;
        max-width: min(56vw, 220px);
        flex-direction: column;
        align-items: flex-end;
        gap: 10px;
        padding: 8px;
        position: absolute;
        top: calc(100% + 10px);
        right: max(16px, env(safe-area-inset-right));
        left: auto;
        background: linear-gradient(180deg, rgba(2, 9, 20, 0.88) 0%, rgba(1, 6, 15, 0.82) 100%);
        border: 1px solid rgba(0, 255, 157, 0.22);
        border-radius: 18px;
        backdrop-filter: blur(6px);
        box-shadow: 0 10px 26px rgba(0, 0, 0, 0.42);
        z-index: 999;
        animation: slideDown 0.3s ease;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links li {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }

    .nav-links a {
        width: 100%;
        text-align: right;
        padding: 10px 14px;
        letter-spacing: 1px;
        font-size: 0.89rem;
        font-weight: 600;
        background: transparent;
        border: 1px solid rgba(0, 255, 157, 0.58);
        border-radius: 14px;
        box-shadow: none;
        line-height: 1.2;
    }

    .nav-links a:hover {
        color: #00ff9d;
        background: transparent;
        border-color: #00ff9d;
        box-shadow: 0 0 12px rgba(0, 255, 157, 0.3);
    }

    .hero {
        min-height: auto;
        padding: 48px 18px 56px;
    }

    .hero-content {
        width: min(100%, 520px);
    }

    .main-name {
        font-size: 2.2rem;
    }
    
    .section {
        padding: 50px max(14px, env(safe-area-inset-right)) 50px max(14px, env(safe-area-inset-left));
    }

    .tagline {
        min-height: 2.2em;
    }

    #typing {
        width: 100%;
        max-width: 26ch;
        white-space: normal;
        text-align: center;
    }
    
    .section-title {
        font-size: 1.6rem;
    }

    .certifications-grid,
    .projects-grid,
    .skills-grid,
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .skill-card,
    .project-card,
    .cert-card,
    .dashboard-card {
        padding: 16px;
    }
    
    .terminal-body {
        padding: 20px 15px;
        font-size: 0.98rem;
        line-height: 1.75;
    }

    .social-btn {
        width: 54px;
        height: 54px;
        font-size: 1.5rem;
    }

    .profile-container {
        width: clamp(110px, 30vw, 160px);
    }
}

/* Medium mobile: 412px - 480px */
@media screen and (max-width: 480px) {
    .hero {
        min-height: auto;
        padding: 40px max(10px, env(safe-area-inset-left)) 40px max(10px, env(safe-area-inset-right));
    }

    .main-name {
        font-size: 1.8rem;
    }

    .glow-text {
        font-size: 1rem;
    }
    
    .glitch::before, .glitch::after {
        display: none;
    }

    .nav-links a {
        padding: 9px 12px;
        min-height: 44px;
        font-size: 0.84rem;
    }

    .skills-grid,
    .projects-grid,
    .certifications-grid,
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .social-btn {
        width: 52px;
        height: 52px;
        font-size: 1.4rem;
    }
    
    .social-links {
        gap: 14px;
        flex-wrap: wrap;
    }

    .cert-link {
        display: block;
        width: 100%;
        max-width: 100%;
        padding: 11px 14px;
    }

    .term-title {
        display: none;
    }

    .terminal-header {
        justify-content: center;
    }

    .terminal-body {
        padding: 16px 12px;
        font-size: 0.94rem;
        line-height: 1.6;
    }

    .section-title {
        font-size: 1.35rem;
        margin-bottom: 24px;
    }

    .profile-container {
        width: clamp(100px, 28vw, 140px);
        margin-bottom: 18px;
    }

    .section {
        padding: 40px max(12px, env(safe-area-inset-left)) 40px max(12px, env(safe-area-inset-right));
    }
}

/* Small mobile: 360px - 412px */
@media screen and (max-width: 412px) {
    .logo {
        font-size: clamp(0.95rem, 3.5vw, 1.2rem);
        letter-spacing: 1px;
    }

    .menu-toggle {
        width: 46px;
        height: 46px;
    }

    .nav-links {
        min-width: 164px;
        max-width: min(52vw, 200px);
        right: max(12px, env(safe-area-inset-right));
    }

    .section-title {
        font-size: 1.25rem;
        margin-bottom: 20px;
    }

    .main-name {
        font-size: 1.65rem;
    }

    .skill-card,
    .project-card,
    .cert-card,
    .dashboard-card {
        padding: 14px;
        font-size: 0.9rem;
    }

    .social-btn {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
}

/* Extra small mobile: 320px - 360px */
@media screen and (max-width: 360px) {
    .navbar {
        padding: 12px max(12px, env(safe-area-inset-left)) 12px max(12px, env(safe-area-inset-right));
        gap: 8px;
    }

    .logo {
        font-size: clamp(0.9rem, 3vw, 1rem);
        letter-spacing: 1px;
    }

    .menu-toggle {
        width: 44px;
        height: 44px;
        padding: 8px;
    }

    .nav-links {
        min-width: 154px;
        max-width: min(50vw, 186px);
        right: max(10px, env(safe-area-inset-right));
        gap: 8px;
        padding: 6px;
    }

    .menu-toggle span {
        margin: 4px 0;
    }

    .hero {
        padding: 36px max(8px, env(safe-area-inset-left)) 36px max(8px, env(safe-area-inset-right));
        min-height: calc(100vh - var(--nav-height));
    }

    .main-name {
        font-size: 1.5rem;
    }

    .glow-text {
        font-size: 0.95rem;
    }

    .tagline {
        font-size: 0.88rem;
    }

    .profile-container {
        width: clamp(90px, 25vw, 120px);
        margin-bottom: 16px;
    }

    .section {
        padding: 36px max(10px, env(safe-area-inset-left)) 36px max(10px, env(safe-area-inset-right));
    }

    .section-title {
        font-size: 1.15rem;
        margin-bottom: 18px;
    }

    .skill-card,
    .project-card,
    .cert-card,
    .dashboard-card {
        padding: 12px;
        font-size: 0.88rem;
    }

    .skill-card i,
    .cert-card i,
    .dashboard-card i {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }

    .social-btn {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
        min-width: 48px;
        min-height: 48px;
    }

    .social-links {
        gap: 10px;
    }

    .terminal-header {
        padding: 10px 12px;
    }

    .terminal-body {
        padding: 12px 10px;
        font-size: 0.88rem;
        line-height: 1.6;
    }

    .terminal-body .prompt {
        display: block;
        margin-right: 0;
        margin-bottom: 3px;
    }

    .cert-link {
        padding: 9px 12px;
        font-size: 0.85rem;
    }
}

/* Minimum size: < 320px */
@media screen and (max-width: 319px) {
    .logo {
        font-size: 0.9rem;
    }

    .main-name {
        font-size: 1.4rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .skills-grid,
    .projects-grid,
    .certifications-grid,
    .dashboard-grid {
        gap: 8px;
    }
}

@media screen and (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 26px 16px 22px;
    }

    .profile-container {
        width: clamp(96px, 22vh, 120px);
        margin-bottom: 12px;
    }

    .main-name {
        font-size: clamp(1.45rem, 5.3vh, 2.1rem);
        margin: 6px 0;
    }

    .glow-text,
    .tagline {
        font-size: clamp(0.9rem, 3.2vh, 1rem);
    }

    .section {
        padding: 36px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .scan-line,
    .blink-cursor,
    .cursor,
    .glitch::before,
    .glitch::after,
    .glow-card::before {
        animation: none !important;
    }
}

@media screen and (max-height: 430px) and (orientation: landscape) {
    .navbar {
        position: static;
    }

    .hero {
        padding-top: 20px;
    }

    .scan-line,
    .glitch::before,
    .glitch::after {
        display: none;
    }
}

@media (pointer: coarse) {
    .nav-links a,
    .cert-link,
    .social-btn,
    .menu-toggle,
    .cert-details summary {
        min-height: 46px;
    }
}
