/* =========================================
   Responsive: mobile-first overrides
   ========================================= */

/* Tablet and below */
@media (max-width: 968px) {
    .nav__links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        padding: 1rem var(--gutter);
        background: rgba(10, 10, 15, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border);
    }

    .nav__links.is-open {
        display: flex;
    }

    .nav__links li {
        padding: 0.85rem 0;
        border-bottom: 1px solid var(--border);
    }

    .nav__links li:last-child {
        border-bottom: none;
    }

    .nav__toggle {
        display: flex;
        margin-left: auto;
    }

    .nav__toggle[aria-expanded="true"] span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav__toggle[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
    }

    .nav__toggle[aria-expanded="true"] span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .nav__cta {
        display: none;
    }

    .about__grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about__stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Phones */
@media (max-width: 640px) {
    html {
        scroll-padding-top: 70px;
    }

    .hero {
        padding-top: 5rem;
        padding-bottom: 2rem;
    }

    .hero__terminal {
        border-radius: var(--radius);
    }

    .terminal__body {
        padding: 1.1rem 1rem 1.3rem;
        font-size: 0.82rem;
    }

    .terminal__title {
        display: none;
    }

    .hero__meta {
        padding: 0.7rem 1rem;
        gap: 0.65rem;
        border-radius: var(--radius);
    }

    .hero__meta-divider {
        display: none;
    }

    .hero__meta-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.15rem;
    }

    .hero__scroll {
        display: none;
    }

    .hero__cta {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .section__header {
        flex-wrap: wrap;
        gap: 0.6rem;
        margin-bottom: 2rem;
    }

    .section__line {
        margin-left: 0;
        width: 100%;
    }

    .about__stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .bento {
        grid-template-columns: 1fr;
    }

    .bento__card,
    .bento__card--featured {
        grid-column: span 1;
    }

    .bento__card {
        padding: 1.25rem;
    }

    .bento__title {
        font-size: 1.35rem;
    }

    .bento__architecture {
        font-size: 0.7rem;
    }

    .bento__stat {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .bento__stat > div {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
        gap: 1rem;
    }

    .bento__links {
        flex-direction: column;
    }

    .bento__link {
        width: 100%;
        justify-content: center;
    }

    .skill-card__list li {
        grid-template-columns: 1fr 70px;
    }

    .timeline {
        padding-left: 1.5rem;
    }

    .timeline__dot {
        left: -1.5rem;
        width: 14px;
        height: 14px;
    }

    .timeline__content {
        padding: 1rem 1.1rem;
    }

    .timeline::before {
        left: 7px;
    }

    .publication {
        padding: 1.75rem 1.25rem;
    }

    .publication__meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .certs {
        padding: 1.25rem 1rem;
    }

    .contact__card {
        padding: 1.25rem 1rem;
    }

    .footer__inner {
        flex-direction: column;
        gap: 0.3rem;
    }

    .footer__sep {
        display: none;
    }
}

/* Very small phones */
@media (max-width: 380px) {
    :root {
        --gutter: 0.85rem;
    }

    .nav__logo-text {
        display: none;
    }

    .terminal__body {
        font-size: 0.75rem;
        padding: 0.85rem 0.85rem 1rem;
    }

    .terminal__output h1 {
        font-size: 2rem;
    }
}

/* High-DPI tweak — slightly thicker borders look better on retina */
@media (min-resolution: 2dppx) {
    .nav,
    .bento__card,
    .skill-card,
    .timeline__content,
    .contact__card {
        border-width: 0.5px;
    }
}

/* Print: hide background, simplify layout */
@media print {
    #neural-bg,
    .nav,
    .footer,
    .hero__scroll,
    .hero__meta,
    .more-projects {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .section {
        padding: 1.5rem 0;
        break-inside: avoid;
    }

    a {
        color: black;
    }
}
