/* ==========================================================================
   NAMAN SINGH // FUTURISTIC 3D TECHNICAL PORTFOLIO
   RESPONSIVE DESIGN & ACCESSIBILITY (CSS/RESPONSIVE.CSS)
   ========================================================================== */

/* --------------------------------------------------------------------------
   00. GLOBAL MOBILE-SAFE BASE GUARDS (Zero Desktop Impact)
   -------------------------------------------------------------------------- */
html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    min-width: 320px;
}

/* iOS & Mobile Safe Area Inset Support */
:root {
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
}

/* Responsive Image and SVG Constraints */
img, svg, video {
    max-width: 100%;
    height: auto;
}

/* --------------------------------------------------------------------------
   01. LARGE DESKTOPS & ULTRAWIDE (1400px+) - DESKTOP FROZEN BASELINE
   -------------------------------------------------------------------------- */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    .hero-name {
        font-size: 4rem;
    }
}

/* --------------------------------------------------------------------------
   02. STANDARD LAPTOPS & DESKTOPS (1200px - 1399px) - DESKTOP FROZEN BASELINE
   -------------------------------------------------------------------------- */
@media (max-width: 1399px) {
    .hero-name {
        font-size: 3.5rem;
    }
    .interactive-reactor-overlay {
        width: 340px;
        height: 340px;
    }
}

/* --------------------------------------------------------------------------
   03. MEDIUM TABLETS & SMALL LAPTOPS (992px - 1199px) - COLLAPSE ACTIVE
   -------------------------------------------------------------------------- */
@media (max-width: 1199px) {
    .section-title {
        font-size: 1.9rem;
    }
    .hero-name {
        font-size: 3rem;
    }

    /* Mobile Navbar Dropdown Panel */
    .cyber-navbar .navbar-collapse {
        background: rgba(8, 8, 17, 0.96);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(0, 229, 255, 0.3);
        border-radius: 8px;
        padding: 1rem;
        margin-top: 0.75rem;
        box-shadow: 0 16px 45px rgba(0, 0, 0, 0.9), 0 0 25px rgba(0, 229, 255, 0.15);
        max-height: calc(100dvh - 80px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .cyber-navbar .navbar-collapse::-webkit-scrollbar {
        width: 4px;
    }
    .cyber-navbar .navbar-collapse::-webkit-scrollbar-thumb {
        background: rgba(0, 229, 255, 0.3);
        border-radius: 2px;
    }

    .cyber-nav-link {
        padding: 0.65rem 1rem !important;
        width: 100%;
        justify-content: flex-start;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .cyber-nav-link:last-child {
        border-bottom: none;
    }

    .cyber-nav-link.active::after {
        left: 0;
        width: 4px;
        height: 100%;
        top: 0;
        bottom: 0;
        border-radius: 2px 0 0 2px;
    }
}

/* --------------------------------------------------------------------------
   04. TABLETS (768px - 991px)
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
    .section-padding {
        padding: 4.5rem 0;
    }
    
    .hero-section {
        padding-top: 100px;
        min-height: auto;
        padding-bottom: 70px;
    }

    .hero-centerpiece-col {
        height: auto;
        min-height: 280px;
        margin-top: 2rem;
    }

    .crypto-hash-widget {
        max-width: 100%;
        width: 100%;
    }

    .hero-threejs-container {
        opacity: 0.75;
    }

    /* Systems Architecture Grid Reflow */
    .arch-nodes-row {
        gap: 1.25rem;
    }

    .arch-inspector-panel {
        padding: 1.25rem;
    }

    .arch-metrics-box {
        margin-top: 1rem;
        width: 100%;
    }

    /* NEXUS AI Stacking */
    .nexus-avatar-wrapper {
        min-height: 320px;
    }
    .nexus-avatar-viewport {
        height: 280px;
    }
    .nexus-chat-messages {
        height: 280px;
    }

    /* Contact Form Stacking */
    .terminal-contact-card {
        margin-bottom: 1.5rem;
    }

    /* Engineering Workflow Grid */
    .workflow-timeline-wrapper .timeline-center-spine {
        opacity: 0.5;
    }
}

/* --------------------------------------------------------------------------
   05. MOBILE PHONES & PHABLETS (Under 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    /* Fluid Section Typography */
    .section-title {
        font-size: clamp(1.45rem, 5.5vw, 1.75rem);
        letter-spacing: 1px;
        line-height: 1.3;
    }

    .section-header-block {
        margin-bottom: 2rem;
    }

    .section-desc {
        font-size: 0.92rem;
        line-height: 1.55;
    }

    /* Hero Section Mobile Formatting */
    .hero-section {
        padding-top: 90px;
        padding-bottom: 60px;
    }

    .hero-eyebrow {
        font-size: clamp(0.72rem, 2.8vw, 0.88rem);
        white-space: normal;
        line-height: 1.45;
        text-align: left;
        display: block;
        margin-bottom: 0.75rem;
    }

    .hero-name {
        font-size: clamp(2.1rem, 7.5vw, 2.75rem);
        letter-spacing: 1px;
        line-height: 1.15;
        word-break: normal;
    }

    .hero-subtitle {
        font-size: 0.84rem;
        gap: 6px;
        flex-wrap: wrap;
        margin-bottom: 1.25rem;
    }

    .hero-role-pill {
        white-space: normal;
        text-align: center;
        padding: 0.25rem 0.6rem;
    }

    /* Hide pill separators on multi-line wrap */
    .pill-dot-sep {
        display: none;
    }

    .hero-description {
        font-size: 0.95rem;
        line-height: 1.6;
        margin-bottom: 1.5rem;
    }

    /* Hero Action Buttons */
    .hero-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }

    .hero-actions .btn {
        width: 100%;
        min-height: 46px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.88rem;
    }

    .hero-tech-highlights {
        font-size: 0.75rem;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.5rem;
        margin-top: 1.5rem;
    }

    .tech-badge-item {
        font-size: 0.72rem;
        padding: 0.25rem 0.55rem;
    }

    /* Crypto Hash Terminal Widget - Prevent Horizontal Scrollbar */
    .crypto-hash-widget {
        max-width: 100%;
        width: 100%;
        padding: 0.85rem;
        border-radius: 6px;
        margin-top: 1.5rem;
    }

    .hash-output-text,
    .hash-code-block,
    .processing-matrix {
        word-break: break-all;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: normal;
        font-size: 0.72rem;
        line-height: 1.4;
    }

    .hash-widget-header {
        font-size: 0.72rem;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    /* Profile Section Mobile */
    .profile-spec-box {
        padding: 1.15rem;
    }

    .spec-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
        padding: 0.5rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .spec-label {
        font-size: 0.75rem;
        color: var(--text-muted);
    }

    .spec-val {
        font-size: 0.88rem;
        word-break: break-word;
        overflow-wrap: anywhere;
        width: 100%;
    }

    .profile-cta-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
        text-align: center;
        margin-top: 1.25rem;
    }

    .profile-cta-footer .btn {
        width: 100%;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Skills Section Mobile */
    .skills-filter-wrapper {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.45rem;
        margin-bottom: 1.75rem;
    }

    .btn-cyber-filter {
        font-size: 0.75rem;
        padding: 0.45rem 0.8rem;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .skill-card {
        padding: 1rem;
    }

    .skill-icon-wrap {
        width: 44px;
        height: 44px;
        font-size: 1.4rem;
    }

    /* Project Cards Mobile */
    .project-card {
        padding: 1rem;
    }

    .project-thumb-holo {
        max-height: 140px;
        width: 100%;
        overflow: hidden;
    }

    .holo-project-svg {
        max-height: 120px;
        width: 100%;
    }

    .project-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.6rem;
        margin-top: 1.25rem;
    }

    .project-actions .btn {
        width: 100%;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .project-tags-wrap {
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    /* Systems Architecture Section Mobile */
    .arch-node-card {
        padding: 0.9rem;
        min-height: auto;
    }

    .arch-node-title {
        font-size: 0.95rem;
    }

    .arch-node-sub {
        font-size: 0.72rem;
    }

    .arch-inspector-panel {
        padding: 1rem;
    }

    .arch-metrics-box {
        margin-top: 1rem;
        width: 100%;
        padding: 0.85rem;
    }

    .metric-line {
        font-size: 0.75rem;
    }

    .arch-components-tags {
        gap: 0.35rem;
    }

    .tag-tech-sub {
        font-size: 0.68rem;
        padding: 0.2rem 0.5rem;
    }

    /* Engineering Workflow Timeline Mobile */
    .workflow-timeline-wrapper .timeline-center-spine {
        display: none;
    }

    .workflow-holo-card {
        margin-bottom: 0.75rem;
    }

    .workflow-card-inner {
        padding: 1.15rem;
    }

    .workflow-title {
        font-size: 1rem;
    }

    .workflow-sub {
        font-size: 0.72rem;
    }

    .workflow-desc {
        font-size: 0.84rem;
    }

    /* Code Blocks & Article Containers */
    pre, code {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        word-break: normal;
    }

    /* NEXUS AI Mobile Sizing */
    .nexus-avatar-wrapper {
        min-height: 280px;
    }
    .nexus-avatar-viewport {
        height: 240px;
    }
    .nexus-chat-messages {
        height: 260px;
        max-height: 40vh;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    .nexus-msg {
        max-width: 95%;
        font-size: 0.85rem;
    }
    .nexus-chip {
        font-size: 0.68rem;
        padding: 0.35rem 0.65rem;
        min-height: 34px;
        display: inline-flex;
        align-items: center;
    }
    .nexus-chips-wrapper {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scrollbar-width: none;
    }
    .nexus-chips-wrapper::-webkit-scrollbar {
        display: none;
    }
    .nexus-input-form .form-control {
        font-size: 16px; /* Prevents auto-zoom on iOS */
    }
    .nexus-input-form .btn-nexus-send {
        min-height: 44px;
        min-width: 65px;
    }
    .nexus-disclaimer {
        font-size: 0.68rem;
        line-height: 1.4;
    }

    /* Modals Responsive Sizing */
    .cyber-modal .modal-dialog {
        margin: 0.5rem auto;
        max-width: calc(100% - 1rem);
        width: calc(100% - 1rem);
    }
    .cyber-modal .modal-dialog-scrollable {
        height: calc(100dvh - 1rem);
        max-height: calc(100dvh - 1rem);
    }
    .cyber-modal-header {
        padding: 0.85rem 1rem;
    }
    .cyber-modal .modal-body {
        padding: 1rem;
        -webkit-overflow-scrolling: touch;
    }
    .cyber-modal-footer {
        padding: 0.75rem 1rem;
    }
    .cyber-modal .btn-close {
        min-width: 44px;
        min-height: 44px;
        padding: 0.75rem;
    }
    .project-modal-banner {
        height: 110px;
    }

    /* Contact Section Mobile */
    .terminal-contact-card {
        padding: 1.15rem;
    }
    .cyber-form-group .form-control {
        font-size: 16px; /* Prevents auto-zoom on iOS */
        padding: 0.65rem 0.85rem;
    }
    .cyber-form-group label {
        font-size: 0.75rem;
    }
    #btn-submit-contact {
        width: 100%;
        min-height: 46px;
    }
    .contact-channel-card {
        padding: 0.9rem;
    }
    .contact-val {
        font-size: 0.82rem;
        word-break: break-all;
    }

    /* Footer Mobile */
    .cyber-footer {
        text-align: center;
        padding: 2.5rem 0 1.5rem;
    }
    .footer-quick-links {
        justify-content: center !important;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .footer-bottom-line {
        justify-content: center !important;
        text-align: center;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    /* NEXUS 3D Digital World Mobile Optimizations */
    .nexus-world-hud-top {
        padding: 0.75rem !important;
    }
    .hud-zone-selector {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.35rem;
    }
    .btn-world-zone {
        font-size: 0.68rem !important;
        padding: 0.35rem 0.65rem !important;
        min-height: 34px;
    }
    .nexus-world-inspector {
        top: auto !important;
        bottom: 60px !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        width: 94% !important;
        max-width: 94% !important;
        max-height: 52vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        margin: 0 !important;
    }
    .inspector-card {
        padding: 0.85rem !important;
    }
    .inspector-visual-wrap {
        min-height: 110px !important;
        padding: 0.35rem !important;
    }
    .holo-skill-svg,
    .holo-project-svg {
        max-height: 105px !important;
    }
    .hud-controls-pill {
        font-size: 0.62rem !important;
        padding: 0.25rem 0.75rem !important;
    }
}

/* --------------------------------------------------------------------------
   06. SMALL MOBILE PHONES (376px - 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
    .section-title {
        font-size: clamp(1.35rem, 6vw, 1.55rem);
    }
    .hero-name {
        font-size: clamp(1.95rem, 7.8vw, 2.3rem);
    }
    .cyber-brand {
        font-size: 1.05rem;
        letter-spacing: 0.5px;
    }
    .sound-toggle-btn {
        padding: 0.38rem 0.55rem;
        min-height: 38px;
    }
    .nexus-avatar-viewport {
        height: 210px;
    }
    .nexus-chat-messages {
        height: 240px;
    }
    .crypto-hash-widget {
        font-size: 0.72rem;
        padding: 0.75rem;
    }
    .cyber-modal .modal-dialog {
        margin: 0.35rem auto;
        max-width: calc(100% - 0.7rem);
        width: calc(100% - 0.7rem);
    }
}

/* --------------------------------------------------------------------------
   07. EXTRA SMALL MOBILE PHONES (320px - 375px)
   -------------------------------------------------------------------------- */
@media (max-width: 375px) {
    .container, .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .hero-name {
        font-size: 1.85rem;
        letter-spacing: 0.5px;
    }

    .cyber-brand {
        font-size: 0.98rem;
        letter-spacing: 0.5px;
    }

    .brand-sub {
        font-size: 0.75rem;
    }

    .sound-toggle-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
    }

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

    .hero-eyebrow {
        font-size: 0.72rem;
    }

    .nexus-avatar-viewport {
        height: 190px;
    }

    .nexus-chat-messages {
        height: 220px;
    }

    .cyber-modal .modal-dialog {
        margin: 0.25rem auto;
        max-width: calc(100% - 0.5rem);
        width: calc(100% - 0.5rem);
    }

    .cyber-modal-header {
        padding: 0.75rem 0.85rem;
    }

    .cyber-modal .modal-body {
        padding: 0.85rem;
    }

    .cyber-modal-footer {
        padding: 0.65rem 0.85rem;
    }
}

/* --------------------------------------------------------------------------
   08. ULTRA-COMPACT MOBILE PHONES (Under 340px - Galaxy Fold Cover & Similar)
   -------------------------------------------------------------------------- */
@media (max-width: 340px) {
    .brand-divider, .brand-sub {
        display: none;
    }

    .cyber-brand {
        font-size: 0.92rem;
    }

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

    .btn {
        font-size: 0.78rem;
        padding: 0.4rem 0.65rem;
    }
}

/* --------------------------------------------------------------------------
   09. SHORT LANDSCAPE MOBILE SCREENS (@media max-height: 500px)
   -------------------------------------------------------------------------- */
@media (max-height: 500px) and (orientation: landscape) {
    .cyber-navbar .navbar-collapse {
        max-height: calc(100dvh - 65px);
        overflow-y: auto;
    }

    .cyber-modal .modal-dialog {
        margin: 0.25rem auto;
        height: calc(100dvh - 0.5rem);
        max-height: calc(100dvh - 0.5rem);
    }

    .cyber-modal .modal-dialog-scrollable {
        height: calc(100dvh - 0.5rem);
        max-height: calc(100dvh - 0.5rem);
    }

    .cyber-modal-header {
        padding: 0.5rem 1rem;
    }

    .cyber-modal .modal-body {
        padding: 0.75rem 1rem;
    }

    .cyber-modal-footer {
        padding: 0.5rem 1rem;
    }

    .project-modal-banner {
        height: 75px;
    }

    .nexus-avatar-viewport {
        height: 160px;
    }

    .nexus-chat-messages {
        height: 180px;
    }

    .nexus-world-inspector {
        max-height: 72vh !important;
        bottom: 45px !important;
    }
}

/* --------------------------------------------------------------------------
   10. TOUCH DEVICES INTERACTION ADAPTATION (No Mouse Pointer / Hover)
   -------------------------------------------------------------------------- */
@media (hover: none) and (pointer: coarse) {
    /* Disable 3D tilt translations that cause jitter on touch scroll */
    .holo-card,
    .holo-card:hover,
    .holo-card.is-hovered,
    .skill-card,
    .skill-card:hover,
    .project-card,
    .project-card:hover {
        transform: none !important;
    }

    .holo-card .skill-icon-wrap,
    .holo-card .project-thumb-holo,
    .holo-card .project-body,
    .holo-card .holo-layer-top,
    .holo-card .holo-layer-mid,
    .holo-card .holo-layer-bottom,
    .holo-card .project-actions,
    .holo-card .holo-content-wrap {
        transform: none !important;
    }

    /* Touch Targets >= 44px */
    .btn,
    .cyber-nav-link,
    .btn-cyber-filter,
    .btn-inspect-proj,
    .btn-close,
    .sound-toggle-btn {
        min-height: 44px;
    }

    /* Prevent stuck hover outline */
    .cyber-nav-link:hover:not(:active) {
        background: transparent;
    }
}

/* --------------------------------------------------------------------------
   11. ACCESSIBILITY: REDUCED MOTION PREFERENCE
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .holo-card,
    .holo-card.is-hovered,
    .skill-card,
    .project-card {
        transform: none !important;
        transition: none !important;
    }

    .spin-slow,
    .flow-indicator,
    .blinking-dot,
    .pulse-indicator,
    .scroll-ball {
        animation: none !important;
    }

    .reveal-fade-up,
    .reveal-fade-left,
    .reveal-fade-right {
        opacity: 1 !important;
        transform: none !important;
    }
}
