/* ═══════════════════════════════════════════════════
   NAVBAR MOBILE OPTIMIZATIONS
   Responsive navigation bar for all screen sizes
   ═══════════════════════════════════════════════════ */

/* ─────────────────────────────────────
   MOBILE (≤640px)
───────────────────────────────────── */
@media (max-width: 640px) {
  /* Main nav container */
  #main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 0.5rem 0.875rem;
    height: 56px;
    z-index: 100;
    background: rgba(5, 31, 32, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: none;
    border-bottom: 1px solid rgba(141, 183, 155, 0.15);
    transform: none;
    left: 0;
    transition: all 0.3s ease;
  }

  /* Navbar scroll effect - Make more compact when scrolled */
  #main-nav.scrolled {
    padding: 0.35rem 0.875rem;
    height: 52px;
    background: rgba(5, 31, 32, 0.99);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }

  #main-nav.scrolled .brand-wordmark {
    font-size: 0.95rem;
  }

  #main-nav.scrolled .btn-ghost,
  #main-nav.scrolled .btn-primary-sm {
    font-size: 0.65rem;
    height: 28px;
    padding: 0.3rem 0.6rem;
  }

  /* Floating pill effect when scrolled on landing page */
  #main-nav.nav-floating {
    top: 8px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: min(340px, calc(100% - 1.5rem)) !important;
    margin: 0 !important;
    border-radius: 24px !important;
    padding: 0.4rem 1.2rem !important;
    background: rgba(5, 31, 32, 0.65) !important;
    border: 1.5px solid rgba(141, 183, 155, 0.3) !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25),
                0 0 1px rgba(141, 183, 155, 0.1) !important;
  }

  #main-nav.nav-floating.nav-on-dark {
    background: rgba(5, 31, 32, 0.55) !important;
    border-color: rgba(141, 183, 155, 0.35) !important;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35),
                0 0 1px rgba(141, 183, 155, 0.15) !important;
  }

  /* Nav inner - Better distribution */
  .nav-inner {
    height: 100%;
    gap: 0.75rem;
    padding: 0;
    max-width: 100%;
    margin: 0;
    flex-wrap: nowrap;
    display: flex;
    align-items: center;
  }

  /* Logo - Professional sizing */
  .nav-brand {
    flex-shrink: 0;
    min-width: fit-content;
    display: flex;
    align-items: center;
    height: 100%;
  }

  .brand-wordmark {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #fff;
    white-space: nowrap;
    transition: font-size 0.3s ease;
  }

  .brand-dot {
    font-size: 1.05rem;
    color: inherit;
  }

  /* Nav actions - Better organization */
  .nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    height: 100%;
  }

  /* Language toggle - Clean style */
  .premium-lang-toggle {
    display: flex !important;
    background: rgba(141, 183, 155, 0.12);
    border: 1px solid rgba(141, 183, 155, 0.25);
    border-radius: 16px;
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
    align-items: center;
  }

  .pl-btn {
    font-family: var(--font);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
    background: transparent;
    border: none;
    border-radius: 12px;
    padding: 0.2rem 0.4rem;
    transition: all 0.18s;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    text-transform: uppercase;
  }

  .pl-btn.active {
    background: rgba(141, 183, 155, 0.25);
    color: #fff;
  }

  /* Divider - Show and style */
  .nav-actions > div[style*="width:1px"] {
    display: block !important;
    width: 1px !important;
    height: 1rem !important;
    background: rgba(141, 183, 155, 0.2) !important;
    margin: 0 0.3rem !important;
  }

  /* Login button */
  .btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.35rem 0.6rem;
    min-width: auto;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: all 0.18s;
    cursor: pointer;
    height: 30px;
    flex-shrink: 0;
  }

  .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
  }

  .btn-ghost:active {
    transform: scale(0.98);
  }

  /* Signup button - Premium style */
  .btn-primary-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.35rem 0.8rem;
    min-width: auto;
    white-space: nowrap;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #8CB79B 0%, #7aa48a 100%);
    color: #fff;
    text-decoration: none;
    transition: all 0.18s;
    cursor: pointer;
    flex-shrink: 0;
    height: 30px;
    box-shadow: 0 2px 6px rgba(140, 183, 155, 0.2);
  }

  .btn-primary-sm:hover {
    box-shadow: 0 4px 12px rgba(140, 183, 155, 0.3);
  }

  .btn-primary-sm:active {
    transform: scale(0.98);
    box-shadow: 0 1px 3px rgba(140, 183, 155, 0.15);
  }

  /* On dark background */
  #main-nav.nav-on-dark {
    background: rgba(5, 31, 32, 0.98) !important;
    border-bottom-color: rgba(141, 183, 155, 0.15) !important;
  }

  #main-nav.nav-on-dark .brand-wordmark {
    color: #fff;
  }

  #main-nav.nav-on-dark .brand-dot {
    color: inherit;
  }
}

/* ─────────────────────────────────────
   TABLET (641px - 1024px)
───────────────────────────────────── */
@media (641px <= width <= 1024px) {
  #main-nav {
    padding: 0 1.25rem;
  }

  .nav-inner {
    height: 60px;
    gap: 1rem;
  }

  .brand-wordmark {
    font-size: 1.25rem;
  }

  .nav-actions {
    gap: 0.75rem;
  }

  .btn-ghost,
  .btn-primary-sm {
    font-size: 0.8125rem;
    padding: 0.5rem 0.875rem;
  }

  .pl-btn {
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
  }
}

/* ─────────────────────────────────────
   DESKTOP (≥1025px)
───────────────────────────────────── */
@media (min-width: 1025px) {
  #main-nav {
    padding: 0 2rem;
  }

  .nav-inner {
    height: 64px;
    gap: 1.5rem;
  }

  .brand-wordmark {
    font-size: 1.375rem;
  }

  .nav-actions {
    gap: 0.75rem;
  }

  .nav-actions > div[style*="width:1px"] {
    display: block !important;
  }

  .btn-ghost,
  .btn-primary-sm {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
  }

  .pl-btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
  }
}

/* ─────────────────────────────────────
   HERO SECTION MOBILE OPTIMIZATIONS
───────────────────────────────────── */
@media (max-width: 640px) {
  /* Add top padding for fixed navbar */
  .nx-main {
    padding-top: 0;
  }

  .nx-hero {
    padding: 56px 1rem 3rem;
    min-height: auto;
  }

  /* Hero title - Responsive & compact */
  .nx-title {
    font-size: 1.65rem;
    line-height: 1.2;
    font-weight: 900;
    letter-spacing: -0.03em;
    margin: 0.6rem 0 0.4rem;
    color: #fff;
  }

  /* Hero subtitle - Better readability, professional colors */
  .nx-subtitle {
    font-size: 0.8125rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.62);
    margin: 0.6rem 0 1rem;
    padding: 0 0.25rem;
    font-weight: 400;
  }

  /* Hero actions - Compact stack on mobile */
  .nx-hero-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    margin-bottom: 1.25rem;
  }

  .nx-hero-actions a {
    width: 100%;
    padding: 0.6rem 1rem;
    text-align: center;
    font-size: 0.8rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    letter-spacing: -0.01em;
  }

  .btn-primary-glow {
    background: linear-gradient(135deg, #8CB79B 0%, #7aa48a 100%);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    box-shadow: 0 2px 8px rgba(140, 183, 155, 0.25);
  }

  .btn-primary-glow svg {
    width: 14px;
    height: 14px;
  }

  .btn-primary-glow:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(140, 183, 155, 0.15);
  }

  .btn-ghost-dark {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
    border: 1.5px solid rgba(141, 183, 155, 0.35);
  }

  .btn-ghost-dark:active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(141, 183, 155, 0.5);
  }

  /* Hero trust indicator */
  .nx-hero-trust-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.85rem;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.48);
    flex-wrap: wrap;
    font-weight: 500;
  }

  .nx-hero-trust-indicator span:first-child {
    display: flex;
    gap: 2px;
  }

  .nx-hero-trust-indicator span:first-child svg {
    width: 13px;
    height: 13px;
  }

  /* Hero badge - Smaller, subtle */
  .nx-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(141, 183, 155, 0.1);
    border: 1px solid rgba(141, 183, 155, 0.2);
    border-radius: 16px;
    padding: 0.4rem 0.7rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: rgba(141, 183, 155, 0.9);
    margin-bottom: 0.75rem;
  }

  .nx-badge-dot {
    width: 5px;
    height: 5px;
  }

  /* Minimal skill tags on mobile - very subtle background decoration */
  .nx-art-dots {
    background-size: 48px 48px;
    opacity: 0.15;
  }

  .nx-skill-tags {
    opacity: 0.15;
  }

  .nx-stag {
    display: none !important;
  }

  /* Show only one small skill tag for visual interest */
  .nx-skill-tags .nx-stag:nth-child(1) {
    display: inline-block !important;
    position: absolute !important;
    opacity: 0.25;
    font-size: 0.6rem;
    padding: 0.2rem 0.6rem;
    top: 15% !important;
    right: 8% !important;
    left: auto !important;
  }

  /* Make background photo very subtle */
  .nx-hero-art::before {
    opacity: 0.08 !important;
  }

  /* Adjust gradient overlay to be more visible with reduced background */
  .nx-hero-art::after {
    background: linear-gradient(160deg, rgba(5, 31, 32, 0.95) 0%, rgba(5, 31, 32, 0.75) 50%, rgba(5, 31, 32, 0.92) 100%) !important;
  }
}

@media (641px <= width <= 1024px) {
  .nx-hero {
    padding-top: 60px;
  }

  .nx-title {
    font-size: 2.5rem;
  }

  .nx-subtitle {
    font-size: 1rem;
  }

  .nx-hero-actions {
    flex-direction: row;
    gap: 1rem;
  }

  .nx-hero-actions a {
    flex: 1;
  }
}

@media (min-width: 1025px) {
  .nx-hero {
    padding-top: 64px;
  }

  .nx-title {
    font-size: 3.5rem;
  }

  .nx-subtitle {
    font-size: 1.1875rem;
  }

  .nx-hero-actions {
    flex-direction: row;
    gap: 1.25rem;
  }

  .nx-hero-actions a {
    width: auto;
  }

  /* Show all skill tags on desktop */
  .nx-stag {
    display: inline-block !important;
  }

  .nx-skill-tags {
    opacity: 1;
  }
}

/* ─────────────────────────────────────
   UNIVERSAL BUTTON IMPROVEMENTS
───────────────────────────────────── */

/* Ensure buttons have proper touch targets */
.btn-primary-glow,
.btn-ghost-dark {
  min-height: 44px;
  min-width: 100px;
  transition: all 0.2s ease-out;
  cursor: pointer;
}

.btn-primary-glow:active,
.btn-ghost-dark:active {
  transform: scale(0.98);
}

/* Focus styles */
.btn-primary-glow:focus-visible,
.btn-ghost-dark:focus-visible,
.btn-ghost:focus-visible,
.btn-primary-sm:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─────────────────────────────────────
   MARQUEE SECTION MOBILE
───────────────────────────────────── */
@media (max-width: 640px) {
  .nx-trust {
    padding: 1.5rem 0;
    text-align: center;
  }

  .nx-trust-label {
    font-size: 0.875rem;
    margin-bottom: 1rem;
  }

  .nx-marquee {
    font-size: 0.8125rem;
  }
}

/* ─────────────────────────────────────
   HERO ART - BACKGROUND OPTIMIZATION
───────────────────────────────────── */
@media (max-width: 640px) {
  .nx-hero-art {
    background: linear-gradient(135deg, rgba(5, 31, 32, 0.02) 0%, rgba(35, 83, 71, 0.04) 100%);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
  }

  .nx-art-dots {
    opacity: 0.3;
  }
}

/* ─────────────────────────────────────
   SMALL PHONES (≤420px) — Nav pill fix
   Hide lang toggle+divider, tighten layout,
   consistent button shapes
───────────────────────────────────── */
@media (max-width: 420px) {
  /* Force hide lang toggle — overrides the ≤640px display:flex !important */
  .premium-lang-toggle { display: none !important; }
  .nav-actions > div[style*="width:1px"] { display: none !important; }

  /* Pill: use full width minus margin so content fits */
  #main-nav.nav-floating {
    width: calc(100% - 1.5rem) !important;
    padding: 0.4rem 1rem !important;
  }

  /* Tighter inner layout */
  .nav-inner { gap: 0.5rem; }
  .nav-actions { gap: 0.375rem; }

  /* Brand smaller */
  .brand-wordmark { font-size: 0.9rem; }

  /* Consistent pill shapes for both buttons */
  .btn-ghost {
    border-radius: 10px;
    padding: 0.3rem 0.55rem;
    font-size: 0.65rem;
    height: 28px;
  }

  .btn-primary-sm {
    border-radius: 10px;
    padding: 0.3rem 0.65rem;
    font-size: 0.65rem;
    height: 28px;
  }

  /* Non-floating nav (at top of page before scroll) */
  #main-nav:not(.nav-floating) {
    padding: 0 0.875rem;
  }

  /* ── Hero visual: fix absolute-panel overflow at small phones ── */
  /* Orbits are decorative — hide at mobile */
  .nx-hero-orbit { display: none !important; }

  /* Primary panel: take out of abs flow so it stacks naturally */
  .nx-hero-panel--primary {
    position: relative !important;
    width: 100% !important;
    transform: none !important;
    top: auto !important;
    left: auto !important;
  }

  /* Secondary panel: too cluttered at small width */
  .nx-hero-panel--secondary { display: none !important; }

  /* Visual container: shrink to fit natural content */
  .nx-hero-visual {
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
    display: block !important;
    padding-bottom: 1rem;
  }
}
