/* ==========================================================================
   Tools & Numbers — Core Design Tokens & Aesthetic System
   Inspired by Tools & Numbers Distribution Desk Craft:
   Warm Paper, Sharp Ink, Signal Red, Monospace Telemetry & Rich Typography
   ========================================================================== */

:root {
  --paper: #FAF8F5;
  --paper-dark: #F2ECE4;
  --paper-subtle: #F6F1EA;
  --ink: #14110F;
  --ink-pure: #0A0807;
  --signal-red: #C81E3A;
  --stamp-red-dark: #8C1428;
  --muted: #5C5651;
  --muted-light: #8A827B;
  --hairline: #DFD8D0;
  --hairline-dark: #C5BCB2;
  --cardbg: #FFFFFF;
  --emerald: #059669;
  --emerald-dark: #065F46;
  --emerald-light: #ECFDF5;
  
  --font-serif: "Source Serif 4", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subdued Paper Grid Texture (Square Box Grid) */
body.bg-grid-paper,
.bg-grid-paper {
  background-color: var(--paper);
  background-image: 
    linear-gradient(to right, rgba(20, 17, 15, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(20, 17, 15, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Animations */
@keyframes stampDrop {
  0% {
    opacity: 0;
    transform: scale(1.8) rotate(-8deg);
  }
  70% {
    opacity: 1;
    transform: scale(0.96) rotate(-2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(-3deg);
  }
}

.animate-stamp {
  animation: stampDrop 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.1); }
}

.pulse-red {
  animation: pulseGlow 2s infinite ease-in-out;
}

/* Stamp Badges */
.ink-stamp-badge {
  border: 1.5px dashed var(--signal-red);
  color: var(--signal-red);
  background: rgba(200, 30, 58, 0.04);
  display: inline-block;
  padding: 4px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.stamp-badge-emerald {
  border: 1.5px dashed var(--emerald);
  color: var(--emerald-dark);
  background: rgba(5, 150, 105, 0.06);
  display: inline-block;
  padding: 4px 12px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.stamp-badge-dark {
  border: 1.5px dashed var(--ink);
  color: var(--ink);
  background: rgba(20, 17, 15, 0.05);
  display: inline-block;
  padding: 4px 12px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.verified-stamp {
  border: 2px solid var(--emerald);
  color: var(--emerald-dark);
  background: rgba(209, 250, 229, 0.95);
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-block;
}

/* Card Case Tabs */
.case-tab-red {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background-color: var(--signal-red);
}

.case-tab-emerald {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background-color: var(--emerald);
}

.case-tab-dark {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background-color: var(--ink);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--paper);
}
::-webkit-scrollbar-thumb {
  background: #D8D3CC;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #948C84;
}

/* Category Pills */
.cat-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  border-radius: 2px;
  letter-spacing: 0.02em;
}

.pill-construction { background: rgba(180, 83, 9, 0.1); color: #B45309; border: 1px solid rgba(180, 83, 9, 0.2); }
.pill-nutrition { background: rgba(5, 150, 105, 0.1); color: #047857; border: 1px solid rgba(5, 150, 105, 0.2); }
.pill-finance { background: rgba(2, 132, 199, 0.1); color: #0284C7; border: 1px solid rgba(2, 132, 199, 0.2); }
.pill-payroll { background: rgba(79, 70, 229, 0.1); color: #4F46E5; border: 1px solid rgba(79, 70, 229, 0.2); }
.pill-developer { background: rgba(20, 17, 15, 0.08); color: #14110F; border: 1px solid rgba(20, 17, 15, 0.2); }
.pill-fitness { background: rgba(200, 30, 58, 0.1); color: #C81E3A; border: 1px solid rgba(200, 30, 58, 0.2); }
.pill-homestead { background: rgba(101, 163, 13, 0.1); color: #4D7C0F; border: 1px solid rgba(101, 163, 13, 0.2); }
.pill-education { background: rgba(147, 51, 234, 0.1); color: #7E22CE; border: 1px solid rgba(147, 51, 234, 0.2); }
.pill-gaming { background: rgba(219, 39, 119, 0.1); color: #BE185D; border: 1px solid rgba(219, 39, 119, 0.2); }

/* Quick Math Widget Inputs */
.desk-input {
  width: 100%;
  padding: 8px 12px;
  background-color: var(--paper);
  border: 1px solid var(--hairline);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color 0.15s ease;
}
.desk-input:focus {
  outline: none;
  border-color: var(--signal-red);
}

/* Brand Logo - Ensure crisp rendering and prevent collapse across viewports */
header a[href="/"] img,
.brand-logo img,
footer a[href="/"] img {
  height: 30px;
  max-height: 32px;
  width: auto;
  max-width: 175px;
  object-fit: contain;
  display: block;
}
@media (min-width: 640px) {
  header a[href="/"] img,
  .brand-logo img,
  footer a[href="/"] img {
    height: 32px;
    max-width: none;
  }
}

/* Fallback text brand if image ever fails to load */
.brand-fallback {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Mobile Nav Drawer & Backdrop */
#tnMobileNavOverlay {
  background-color: rgba(20, 17, 15, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

#tnMobileNav {
  box-shadow: 0 20px 30px -5px rgba(20, 17, 15, 0.2), 0 10px 15px -5px rgba(20, 17, 15, 0.1);
}

/* Desktop Mega Menu Dropdown */
#tnMegaMenuOverlay {
  background-color: rgba(20, 17, 15, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

#tnMegaMenuPanel {
  box-shadow: 0 25px 50px -12px rgba(20, 17, 15, 0.25), 0 0 0 1px rgba(20, 17, 15, 0.08);
}

.mega-card {
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.mega-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -3px rgba(20, 17, 15, 0.09);
}

