/* ==========================================================================
   NIKHIL INGALE - ULTRA-RESPONSIVE CROSS-DEVICE STYLES
   Optimized for: 
   - Extra Small Mobile (320px - 360px)
   - Standard Mobile (361px - 480px)
   - Large Mobile / Phablets (481px - 768px)
   - Tablets & iPads (769px - 1024px)
   - Laptops & Compact Desktops (1025px - 1280px)
   - Large Displays & 4K (1281px+)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. LAPTOPS & COMPACT DESKTOPS (<= 1200px)
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  :root {
    --max-width: 1040px;
  }

  .container {
    padding: 0 20px;
  }

  .nav-links {
    gap: 20px;
  }

  .nav-link {
    font-size: 0.88rem;
  }

  .hero-grid {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 36px;
  }

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

  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .arch-layer-node {
    grid-template-columns: 180px 1fr auto;
    gap: 20px;
  }
}

/* --------------------------------------------------------------------------
   2. TABLETS & IPADS (<= 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  :root {
    --header-height: 72px;
  }

  /* Switch Desktop Nav into Slide-out Drawer to prevent header overcrowding */
  .nav-menu-wrapper {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: 320px;
    max-width: 85vw;
    height: calc(100vh - var(--header-height));
    background: rgba(6, 9, 19, 0.98);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-left: 1px solid var(--border-glow);
    flex-direction: column;
    align-items: stretch;
    padding: 28px 24px;
    gap: 24px;
    transform: translateX(110%);
    opacity: 0;
    visibility: hidden;
    transition: transform var(--transition-normal), opacity var(--transition-normal), visibility var(--transition-normal);
    z-index: 999;
    box-shadow: -20px 0 50px rgba(0, 0, 0, 0.9);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-menu-wrapper.active {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    width: 100%;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
  }

  .nav-link {
    font-size: 1.05rem;
    font-weight: 600;
    padding: 8px 12px;
    width: 100%;
    border-radius: var(--radius-sm);
    display: block;
  }

  .nav-link:hover,
  .nav-link.active {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
  }

  .nav-drawer-extras {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
  }

  .drawer-theme-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .drawer-theme-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .drawer-cta-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .drawer-cta-group .btn,
  .drawer-cta-group .terminal-trigger-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 18px;
    font-size: 0.92rem;
  }

  /* Top Bar Actions on Tablet */
  .mobile-toggle {
    display: inline-flex;
  }

  .nav-desktop-terminal,
  .nav-desktop-hire {
    display: none;
  }

  /* Section Spacing */
  .section {
    padding: 80px 0;
  }

  /* Hero Section */
  .hero-section {
    padding-top: calc(var(--header-height) + 30px);
    padding-bottom: 50px;
    min-height: auto;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }

  .hero-content {
    align-items: center;
    max-width: 750px;
    margin: 0 auto;
  }

  .hero-top-badges,
  .hero-cta-group {
    justify-content: center;
  }

  .typewriter-wrapper {
    justify-content: center;
    text-align: center;
  }

  .hero-description {
    margin: 0 auto;
    text-align: center;
  }

  .hero-metrics-strip {
    grid-template-columns: repeat(4, 1fr);
    width: 100%;
    max-width: 680px;
    margin: 10px auto 0 auto;
    padding: 16px 20px;
  }

  .hero-visual {
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
  }

  /* Grids */
  .projects-grid {
    grid-template-columns: 1fr;
    max-width: 700px;
    margin: 0 auto;
  }

  .edu-cert-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    max-width: 700px;
    margin: 0 auto;
  }

  .freelance-contact-grid {
    grid-template-columns: 1fr;
    max-width: 700px;
    margin: 0 auto;
  }

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

/* --------------------------------------------------------------------------
   3. SMALL TABLETS & SYSTEM DESIGN (<= 900px)
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .section {
    padding: 70px 0;
  }

  .arch-selector-tabs {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto 30px auto;
  }

  .arch-tab-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 18px;
    font-size: 0.95rem;
  }

  .arch-layer-node {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 20px;
    text-align: left;
  }

  .arch-layer-node .layer-action-icon {
    display: none;
  }

  .architecture-diagram-card {
    padding: 24px 18px;
  }

  .skills-grid {
    grid-template-columns: 1fr;
    max-width: 600px;
    margin: 0 auto;
  }
}

/* --------------------------------------------------------------------------
   4. PHABLETS & MOBILE DEVICES (<= 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --header-height: 68px;
  }

  /* Full Screen Mobile Drawer */
  .nav-menu-wrapper {
    width: 100%;
    max-width: 100%;
    top: var(--header-height);
    border-left: none;
    border-bottom: 1px solid var(--border-glow);
    padding: 24px 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.95);
  }

  .nav-links {
    align-items: center;
    text-align: center;
    gap: 12px;
  }

  .nav-link {
    text-align: center;
    padding: 10px 0;
    font-size: 1.1rem;
  }

  .drawer-theme-box {
    align-items: center;
    text-align: center;
  }

  .nav-desktop-theme {
    display: none;
  }

  .nav-brand span {
    font-size: 1.15rem;
  }

  .nav-avatar-img {
    width: 32px;
    height: 32px;
  }

  /* Section Spacing & Headers */
  .section {
    padding: 55px 0;
    overflow-x: hidden;
  }

  .section-header {
    margin-bottom: 30px;
    padding: 0 4px;
  }

  .section-tag {
    font-size: 0.75rem;
    padding: 4px 12px;
  }

  .section-title {
    font-size: clamp(1.6rem, 5vw, 2rem);
    line-height: 1.2;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .section-subtitle {
    font-size: 0.92rem;
    line-height: 1.55;
    word-break: break-word;
  }

  /* Hero Section Mobile */
  .hero-section {
    padding-top: calc(var(--header-height) + 16px);
    padding-bottom: 35px;
    overflow-x: hidden;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    width: 100%;
    max-width: 100%;
  }

  .hero-content {
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 100%;
    gap: 16px;
  }

  .hero-top-badges {
    justify-content: center;
    width: 100%;
    gap: 8px;
    flex-wrap: wrap;
  }

  .live-status,
  .role-badge {
    font-size: 0.74rem;
    padding: 5px 10px;
    max-width: 100%;
    text-align: center;
    white-space: normal;
  }

  .hero-title {
    font-size: clamp(1.75rem, 6.5vw, 2.3rem);
    line-height: 1.15;
    text-align: center;
    width: 100%;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .typewriter-wrapper {
    font-size: clamp(0.95rem, 3.8vw, 1.15rem);
    min-height: auto;
    gap: 6px;
    line-height: 1.4;
    justify-content: center;
    text-align: center;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-wrap: wrap;
  }

  .typewriter-prefix {
    white-space: normal;
    display: inline;
  }

  .typewriter-dynamic {
    display: inline;
  }

  .hero-description {
    font-size: clamp(0.88rem, 3.4vw, 1rem);
    line-height: 1.6;
    text-align: center;
    width: 100%;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .hero-cta-group {
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    gap: 10px;
  }

  .hero-cta-group .btn {
    width: 100%;
    max-width: 100%;
    justify-content: center;
    text-align: center;
    padding: 12px 16px;
    font-size: 0.92rem;
    white-space: normal;
  }

  .hero-metrics-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 14px 12px;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 100%;
    margin-top: 10px;
    box-sizing: border-box;
  }

  .metric-item {
    text-align: center;
    align-items: center;
    min-width: 0;
  }

  .metric-number {
    font-size: 1.45rem;
  }

  .metric-label {
    font-size: 0.7rem;
    text-align: center;
    line-height: 1.25;
  }

  /* Hero Profile Card Mobile */
  .hero-visual {
    width: 100%;
    max-width: 100%;
    gap: 18px;
  }

  .hero-profile-container {
    flex-direction: column;
    text-align: center;
    padding: 18px 14px;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .avatar-ring-wrapper {
    width: 84px;
    height: 84px;
  }

  .profile-info {
    align-items: center;
    text-align: center;
  }

  .profile-info .tech-chip {
    font-size: 0.7rem;
  }

  /* Code Showcase Window Mobile */
  .tech-showcase-box {
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .window-header {
    padding: 8px 12px;
  }

  .window-title {
    font-size: 0.7rem;
  }

  .code-editor-body {
    padding: 12px;
    font-size: 0.74rem;
    line-height: 1.45;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .live-badge-floating {
    position: static;
    margin-top: 8px;
    width: 100%;
    justify-content: center;
    padding: 8px 12px;
    box-sizing: border-box;
  }

  /* Skills Tabs Mobile */
  .skills-nav-tabs {
    gap: 8px;
    margin-bottom: 20px;
    justify-content: center;
  }

  .skill-tab-btn {
    padding: 8px 12px;
    font-size: 0.82rem;
  }

  .skills-grid {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
  }

  .skill-category-card {
    padding: 20px 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

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

  .skill-pill {
    font-size: 0.8rem;
    padding: 6px 10px;
  }

  /* Project Cards Mobile */
  .projects-grid {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
  }

  .project-card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .project-card-header {
    padding: 16px 16px 12px 16px;
  }

  .project-body {
    padding: 18px 16px;
    gap: 12px;
  }

  .project-title {
    font-size: 1.25rem;
  }

  .project-desc {
    font-size: 0.9rem;
  }

  .project-features li {
    font-size: 0.85rem;
  }

  .project-actions {
    flex-direction: column;
    gap: 10px;
  }

  .project-actions .btn {
    width: 100%;
    padding: 11px 16px;
    justify-content: center;
  }

  /* Architecture Flow Connectors Mobile */
  .arch-canvas-flow {
    width: 100%;
    max-width: 100%;
  }

  .arch-layer-node {
    grid-template-columns: 1fr;
    padding: 16px 14px;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .arch-flow-connector {
    height: 24px;
  }

  .flow-pulse {
    font-size: 0.65rem;
    padding: 2px 6px;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .arch-detail-panel {
    padding: 16px 14px;
    width: 100%;
    box-sizing: border-box;
  }

  .arch-detail-title {
    font-size: 1rem;
  }

  .arch-detail-text {
    font-size: 0.85rem;
  }

  /* Timeline Mobile */
  .timeline-container {
    padding-left: 18px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .timeline-container::before {
    left: 4px;
  }

  .timeline-dot {
    left: -18px;
    width: 10px;
    height: 10px;
  }

  .timeline-card {
    padding: 18px 14px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .timeline-header {
    flex-direction: column;
    gap: 6px;
  }

  .company-title {
    font-size: 1.15rem;
  }

  .role-subtitle {
    font-size: 0.88rem;
    margin-bottom: 10px;
  }

  .timeline-period {
    align-self: flex-start;
  }

  .timeline-bullets li {
    font-size: 0.85rem;
  }

  /* Education & Certs Mobile */
  .edu-cert-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    width: 100%;
    max-width: 100%;
  }

  .edu-card,
  .cert-card {
    padding: 18px 14px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .edu-card-top {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .edu-degree-title {
    font-size: 1.15rem;
  }

  .edu-score-badge {
    align-self: flex-start;
    font-size: 0.82rem;
    padding: 4px 10px;
  }

  .cert-item {
    padding: 10px 12px;
    font-size: 0.82rem;
  }

  /* Freelance & Contact Hub Mobile */
  .freelance-services-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .freelance-guarantees-banner {
    grid-template-columns: 1fr;
    padding: 18px 16px;
    gap: 14px;
  }

  .freelance-contact-grid,
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    width: 100%;
    max-width: 100%;
  }

  .freelance-info-card,
  .freelance-form-card,
  .contact-info-card,
  .contact-form-card {
    padding: 18px 14px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .contact-channel {
    padding: 10px 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .channel-icon {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
    flex-shrink: 0;
  }

  .channel-value {
    font-size: 0.82rem;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Terminal Window Mobile */
  .terminal-modal-overlay {
    padding: 10px;
  }

  .terminal-window {
    width: 100%;
    height: 85vh;
    max-height: 520px;
    border-radius: var(--radius-md);
  }

  .terminal-screen {
    font-size: 0.76rem;
    padding: 10px;
  }

  .terminal-quick-chips {
    padding: 6px 10px;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

  .terminal-chip {
    padding: 4px 8px;
    font-size: 0.7rem;
    flex-shrink: 0;
  }

  .terminal-input-row {
    font-size: 0.8rem;
  }

  .terminal-prompt {
    font-size: 0.78rem;
  }

  /* Toast Mobile */
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast {
    width: 100%;
    font-size: 0.82rem;
    padding: 10px 14px;
  }

  /* Footer Mobile */
  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 14px;
  }

  .footer-socials {
    justify-content: center;
  }
}

/* --------------------------------------------------------------------------
   5. COMPACT MOBILE PHONES (<= 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .container {
    padding: 0 14px;
  }

  .section {
    padding: 45px 0;
  }

  .hero-title {
    font-size: clamp(1.6rem, 7vw, 1.95rem);
    line-height: 1.18;
  }

  .typewriter-wrapper {
    font-size: 0.92rem;
  }

  .hero-description {
    font-size: 0.88rem;
    line-height: 1.55;
  }

  .hero-cta-group {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .hero-cta-group .btn {
    width: 100%;
    padding: 11px 14px;
    font-size: 0.88rem;
  }

  .hero-metrics-strip {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px 8px;
  }

  .metric-number {
    font-size: 1.3rem;
  }

  .metric-label {
    font-size: 0.65rem;
  }

  .project-card-header {
    padding: 12px 14px;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .project-body {
    padding: 16px 14px;
  }

  .project-title {
    font-size: 1.15rem;
  }

  .skill-category-card {
    padding: 16px 12px;
  }

  .skill-tags-list {
    gap: 6px;
  }

  .skill-pill {
    font-size: 0.75rem;
    padding: 5px 8px;
  }

  .contact-info-card,
  .contact-form-card {
    padding: 16px 12px;
  }

  .form-input,
  .form-textarea {
    font-size: 16px;
    /* Prevents auto-zoom in iOS Safari */
    padding: 10px 12px;
  }
}

/* --------------------------------------------------------------------------
   6. EXTRA SMALL SCREENS (<= 360px & 320px)
   -------------------------------------------------------------------------- */
@media (max-width: 360px) {
  .container {
    padding: 0 10px;
  }

  .nav-brand span {
    font-size: 1rem;
  }

  .nav-avatar-img {
    width: 26px;
    height: 26px;
  }

  .hero-title {
    font-size: 1.45rem;
    line-height: 1.2;
  }

  .typewriter-wrapper {
    font-size: 0.85rem;
    gap: 4px;
  }

  .hero-description {
    font-size: 0.82rem;
    line-height: 1.5;
  }

  .live-status,
  .role-badge {
    font-size: 0.7rem;
    padding: 4px 8px;
  }

  .hero-metrics-strip {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 8px 6px;
  }

  .metric-number {
    font-size: 1.15rem;
  }

  .metric-label {
    font-size: 0.6rem;
  }

  .skills-nav-tabs {
    gap: 4px;
  }

  .skill-tab-btn {
    padding: 5px 8px;
    font-size: 0.75rem;
  }

  .arch-tab-btn {
    font-size: 0.8rem;
    padding: 8px 10px;
  }

  .btn {
    font-size: 0.82rem;
    padding: 10px 12px;
  }
}