$cssPath = "site\assets\style.css"
$css = Get-Content $cssPath -Raw

# 1. Restore exact original .nav-link CSS
$oldNavLink = '(?s)\.nav-link\s*\{\s*display: flex;.*?\.nav-link\.is-active\s*\{\s*color: var\(--violet-700\);\s*\}'
$newNavLink = ".nav-link{text-decoration:none;color:var(--muted);font-weight:600;font-size:15px;background:none;border:none;cursor:pointer;font-family:inherit;padding:0;}`n.nav-link:hover{color:var(--ink);}`n.nav-link.is-active{color:var(--violet-700);}"
$css = $css -replace $oldNavLink, $newNavLink

# 2. Extract the global icons block and remove it
$iconsRegex = '(?s)/\* Global Icons for nav links \(Desktop\) \*/.*?/\* Contact Icon \*/.*?\}'
$iconsBlock = [regex]::Match($css, $iconsRegex).Value
$css = $css -replace $iconsRegex, ''

# 3. Clean up the mobile media query
$mobileIconsRegex = '(?s)/\* Make icons larger on mobile \*/.*?/\* Grid layout fixes \*/'

$mobileReplacement = @"
  /* Icons for Tab Bar */
  .nav-links a::before {
    content: "";
    display: block;
    width: 26px;
    height: 26px;
    background-color: currentColor;
    -webkit-mask-size: contain;
    -webkit-mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-size: contain;
    mask-position: center;
    mask-repeat: no-repeat;
  }
  
  /* Home Icon */
  .nav-links a[href*="index.html"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpolyline points='9 22 9 12 15 12 15 22'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpolyline points='9 22 9 12 15 12 15 22'/%3E%3C/svg%3E");
  }
  
  /* Tools Icon */
  .nav-links a[href*="tools.html"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3C/svg%3E");
  }
  
  /* Blog Icon */
  .nav-links a[href*="blog"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z'/%3E%3Cpath d='M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z'/%3E%3Cpath d='M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z'/%3E%3C/svg%3E");
  }

  /* Grid layout fixes */
"@

$css = $css -replace $mobileIconsRegex, $mobileReplacement

Set-Content -Path $cssPath -Value $css -Encoding UTF8
Write-Host "Completely restored exact desktop styling!"
