/* ============================================================
   responsive.css — tablet + mobile refinements
   ============================================================ */

/* ========== TABLET (≤ 1024px) ========== */
@media (max-width: 1024px) {
    .about-grid { grid-template-columns: 1fr; }
    .contact-wrap { grid-template-columns: 1fr; gap: 3rem; }
    .contact-orb { margin: 0 auto; max-width: 280px; }
    .hero-meta { grid-template-columns: repeat(2, 1fr); }
    .nav-menu { gap: 1.2rem; }
    .featured-card { grid-template-columns: 1fr; gap: 2rem; padding: 2rem; }
    .gh-card { transform: none; }
    .field-card { grid-template-columns: 1fr; gap: 2rem; }
    .video-frame { transform: none; }

    /* hero stacks: portrait first, content below */
    .hero {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .hero-portrait {
        grid-column: 1;
        grid-row: 1;
        justify-self: center;
        max-width: 320px;
    }
    .hero-content { grid-row: 2; }
}

/* ========== MOBILE (≤ 768px) ========== */
@media (max-width: 768px) {

    /* native cursor on touch devices */
    body { cursor: auto; -webkit-tap-highlight-color: rgba(0, 255, 157, 0.18); }
    .cursor-dot, .cursor-ring { display: none !important; }
    button, a { cursor: pointer; }

    /* tighter side padding */
    :root { --pad-x: 1.1rem; }

    /* prevent horizontal scroll from any element */
    html, body { overflow-x: hidden; }
    .section { overflow-x: hidden; }

    /* dim heavy overlays for readability + perf */
    .scanlines { opacity: 0.4; }
    .vignette  { background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.65) 100%); }
    .portrait-noise { display: none; }

    /* ===== NAVIGATION ===== */
    .navbar {
        padding: 0.9rem 1.1rem;
    }

    .nav-brand { font-size: 0.9rem; }

    .nav-menu {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(82vw, 320px);
        background: rgba(5, 6, 8, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-left: 1px solid var(--border-strong);
        flex-direction: column;
        justify-content: center;
        gap: 1.2rem;
        padding: 2rem 1.6rem;
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
        font-size: 1rem;
        z-index: 105;
    }

    .nav-menu.open { transform: translateX(0); }

    .nav-link {
        display: block;
        padding: 0.9rem 0;
        font-size: 1.05rem;
        min-height: 48px;
        line-height: 1.4;
    }

    .nav-toggle {
        display: flex;
        z-index: 110;
        padding: 0.6rem;
        min-width: 44px;
        min-height: 44px;
    }

    /* lock body when nav open */
    body.nav-open { overflow: hidden; }

    /* backdrop behind open nav */
    body.nav-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(2px);
        z-index: 104;
        animation: fadeBg 0.3s ease;
    }

    @keyframes fadeBg { from { opacity: 0; } to { opacity: 1; } }

    /* ===== SECTIONS ===== */
    .section { padding: 4.5rem 1.1rem 3rem; min-height: auto; }
    .hero { padding-top: 6.5rem; padding-bottom: 4rem; min-height: 100vh; }

    .section-header {
        flex-wrap: wrap;
        gap: 0.6rem;
        margin-bottom: 2rem;
    }
    .section-line { display: none; }
    .section-num { font-size: 0.85rem; }
    .section-title { font-size: clamp(1.5rem, 7vw, 2rem); letter-spacing: 1px; }
    .section-lead { font-size: 0.95rem; margin-bottom: 2rem; }

    /* ===== HERO ===== */
    .hero-title { font-size: clamp(2.4rem, 13vw, 4.2rem); letter-spacing: -1px; }
    .hero-greeting { font-size: 0.8rem; }
    .hero-roles { font-size: 1rem; min-height: 1.6em; }
    .hero-tagline { font-size: 0.95rem; line-height: 1.65; margin-bottom: 2rem; }

    .hero-portrait {
        max-width: 240px;
        margin-bottom: 0.5rem;
    }

    .portrait-badge { font-size: 0.55rem; padding: 4px 8px; top: 14px; right: 14px; }
    .portrait-hud { top: 14px; left: 14px; font-size: 0.55rem; }
    .portrait-hud .hud-line { padding: 2px 6px; }
    .portrait-meta { font-size: 0.6rem; left: 14px; right: 14px; bottom: 14px; }
    .portrait-corners .corner { width: 18px; height: 18px; }
    .portrait-dots { right: 14px; bottom: 14px; }

    .hero-meta {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.2rem;
        padding-top: 1.5rem;
    }

    .meta-num { font-size: 1.7rem; }
    .meta-label { font-size: 0.6rem; }

    .scroll-indicator { display: none; }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.7rem;
    }

    /* ===== BUTTONS (touch targets) ===== */
    .btn {
        justify-content: center;
        min-height: 48px;
        padding: 0.95rem 1.5rem;
        font-size: 0.85rem;
        letter-spacing: 1.5px;
    }

    /* ===== ABOUT ===== */
    .bio-card { padding: 1.5rem; }
    .bio-head { gap: 1rem; }
    .avatar-wrap { width: 64px; height: 64px; }

    .terminal-body { font-size: 0.75rem; padding: 1rem; }
    .terminal-body .code { font-size: 0.7rem; }

    .lang-list li {
        grid-template-columns: 80px 1fr 50px;
        gap: 0.6rem;
        font-size: 0.7rem;
    }

    /* ===== FEATURED + FIELD ===== */
    .featured-card { padding: 1.4rem; gap: 1.5rem; }
    .featured-title { font-size: 1.8rem; }
    .featured-eyebrow { font-size: 0.7rem; }
    .featured-tag { font-size: 0.85rem; }
    .featured-desc { font-size: 0.9rem; }
    .featured-stack li { font-size: 0.65rem; padding: 3px 7px; }
    .gh-mock { font-size: 0.65rem; }
    .featured-actions { flex-direction: column; align-items: stretch; }

    .field-card { gap: 2rem; }
    .field-video { max-width: 100%; }
    .video-frame { aspect-ratio: 16 / 9; }
    .field-meta { grid-template-columns: 1fr; max-width: 320px; gap: 0.9rem; }
    .vid-mute { width: 36px; height: 36px; bottom: 12px; left: 12px; }

    /* ===== ARSENAL ===== */
    .arsenal-grid { grid-template-columns: 1fr; gap: 0.9rem; }
    .arsenal-card { padding: 1.3rem; }
    .arsenal-card h3 { font-size: 1.1rem; }

    /* ===== SKILLS ===== */
    .skills-tabs {
        gap: 0.4rem;
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
        padding-bottom: 0.8rem;
        margin-bottom: 1.8rem;
        -webkit-overflow-scrolling: touch;
    }
    .skills-tabs::-webkit-scrollbar { display: none; }

    .skill-tab {
        flex-shrink: 0;
        padding: 0.6rem 1rem;
        font-size: 0.7rem;
        min-height: 40px;
        white-space: nowrap;
    }

    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.7rem;
    }

    .skill-cube { padding: 1rem 0.6rem; }
    .skill-cube .skill-icon { font-size: 1.6rem; }
    .skill-cube h4 { font-size: 0.85rem; }
    .skill-cube .level { font-size: 0.55rem; }

    /* ===== TIMELINE — collapse to single column with left spine ===== */
    .timeline { padding: 0; }
    .timeline::before { left: 14px; transform: none; }

    .tl-item {
        width: 100%;
        margin-left: 0 !important;
        padding: 0 0 2rem 2.5rem;
        text-align: left !important;
    }

    .tl-item::before {
        left: 6px !important;
        right: auto !important;
        top: 0.4rem;
        width: 14px;
        height: 14px;
    }

    .tl-item::after {
        left: 22px !important;
        right: auto !important;
        top: 1rem;
        width: 1.2rem;
        background: linear-gradient(to right, var(--accent), transparent) !important;
    }

    .tl-card { display: block; padding: 1.1rem 1.2rem; }
    .tl-card h3 { font-size: 1rem; }
    .tl-card .tl-org { font-size: 0.78rem; }
    .tl-card li { font-size: 0.8rem; text-align: left; }
    .tl-tags { justify-content: flex-start; }

    /* ===== CONTACT ===== */
    .contact-title { font-size: 1.5rem; }

    .contact-method {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
        padding: 1rem 1.2rem;
        min-height: 64px;
    }

    .method-label { font-size: 0.65rem; }
    .method-value { font-size: 0.85rem; }

    /* ===== FIXED ELEMENTS AT BOTTOM (status + socials) ===== */
    .status-bar {
        bottom: 0.6rem;
        left: 0.9rem;
        gap: 0.6rem;
        font-size: 0.55rem;
        padding: 0;
    }

    .status-bar .status-item:nth-child(3) { display: none; }

    .side-socials {
        right: 0.9rem;
        bottom: 0.6rem;
        flex-direction: row;
        gap: 0.9rem;
        padding: 0.4rem 0.6rem;
        background: rgba(5, 6, 8, 0.6);
        backdrop-filter: blur(6px);
        border-radius: 4px;
    }

    .side-socials a {
        width: 20px;
        height: 20px;
        min-width: 20px;
    }

    .socials-line { display: none; }

    /* ===== FOOTER — extra bottom space so status bar / socials don't overlap ===== */
    .footer {
        padding-bottom: 4rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
        font-size: 0.7rem;
    }

    /* ===== BOOT TERMINAL ===== */
    .boot-terminal {
        padding: 1rem;
        font-size: 0.7rem;
        max-height: 65vh;
        width: 92vw;
    }
    #bootLog { font-size: 0.7rem; line-height: 1.55; }
}

/* ========== EXTRA SMALL (≤ 480px) ========== */
@media (max-width: 480px) {
    .hero-portrait { max-width: 210px; }
    .hero-meta { gap: 1rem; }
    .meta-num { font-size: 1.5rem; }
    .meta-label { font-size: 0.55rem; }

    .nav-menu { width: 88vw; }

    .featured-title { font-size: 1.55rem; }
    .featured-stack li { font-size: 0.6rem; }

    .video-frame { aspect-ratio: 16 / 10; }

    .skills-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }

    .arsenal-card { padding: 1.1rem; }
    .arsenal-card h3 { font-size: 1rem; }
    .arsenal-card p { font-size: 0.78rem; }

    .gh-card-head { padding: 0.6rem 0.8rem; }
    .gh-mock { font-size: 0.6rem; }

    .terminal-header .terminal-title { font-size: 0.7rem; }

    .nav-brand { font-size: 0.78rem; }
}

/* ========== TINY (≤ 360px) ========== */
@media (max-width: 360px) {
    :root { --pad-x: 0.8rem; }
    .hero-title { font-size: 2.1rem; }
    .hero-portrait { max-width: 180px; }
    .section { padding: 4rem 0.8rem 2.5rem; }
}

/* ========== TOUCH-PRIMARY (no fine pointer) ========== */
@media (pointer: coarse) {
    body { cursor: auto; }
    .cursor-dot, .cursor-ring { display: none !important; }

    /* Larger touch area on small icons */
    .side-socials a { padding: 6px; box-sizing: content-box; }

    /* Always show hover-revealed elements */
    .arsenal-card::before { display: none; }
}

/* ========== REDUCED-DATA / SAVE-DATA ========== */
@media (prefers-reduced-data: reduce) {
    #matrixCanvas, .field-matrix, #bgCanvas { display: none; }
    .field-vid { display: none; }
}
