/*
 * ============================================================
 *  SupplyChainStack — Canonical Design System v3
 *  Applied to ALL pages as an override layer (Phase 3)
 *  Do NOT edit manually — regenerated by phase3-apply-design-system.js
 * ============================================================
 */

/* ─── CANONICAL CSS VARIABLES ─── */
/* Overrides both legacy tool-page variables AND Phase-2 homepage vars */
:root {
  /* ── Primary palette ── */
  --cobalt:    #2563EB;
  --cobalt-dk: #1D4ED8;
  --cobalt-lt: #EFF6FF;
  --cobalt-md: #BFDBFE;
  --cyan:      #06B6D4;
  --cyan-lt:   #ECFEFF;
  --ink:       #080E1E;
  --ink-soft:  #0F172A;

  /* ── Grays ── */
  --g900: #111827;
  --g700: #374151;
  --g600: #4B5563;
  --g500: #6B7280;
  --g400: #9CA3AF;
  --g300: #D1D5DB;
  --g200: #E5E7EB;
  --g100: #F3F4F6;
  --g50:  #F9FAFB;
  --white: #FFFFFF;

  /* ── Semantic ── */
  --ok:    #10B981;
  --ok-lt: #D1FAE5;
  --red:   #EF4444;
  --red-lt:#FEE2E2;
  --warn:  #F59E0B;
  --warn-lt: #FEF3C7;

  /* ── Legacy aliases (tool pages used these names) ── */
  --blue:          #2563EB;
  --blue-dark:     #1D4ED8;
  --blue-light:    #EFF6FF;
  --navy:          #080E1E;
  --orange:        #E65100;
  --orange-light:  #FFF3E0;
  --gray-900:      #111827;
  --gray-700:      #374151;
  --gray-600:      #4B5563;
  --gray-500:      #6B7280;
  --gray-400:      #9CA3AF;
  --gray-300:      #D1D5DB;
  --gray-200:      #E5E7EB;
  --gray-100:      #F3F4F6;
  --green:         #10B981;
  --green-light:   #D1FAE5;

  /* ── Typography scale ── */
  --font-head: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
}

/* ─── TYPOGRAPHY NORMALIZATION ─── */
/* Tool pages used Space Grotesk / DM Sans — unify to canonical fonts */
body,
p, li, td, th, label, input, button, textarea, select {
  font-family: var(--font-body) !important;
}

h1, h2, h3, h4, h5, h6,
.logo, .logo-text,
[class*="heading"], [class*="title"],
[class*="head-"], [class*="-head"],
.hero-title, .section-title, .card-title,
nav .logo {
  font-family: var(--font-head) !important;
}

/* ─── CANONICAL NAV (Phase 2) ─── */
/* Canonical nav height */
nav .nav-inner { height: 64px !important; }

/* Canonical nav bar styles for pages using .nav-v2 */
nav.nav-v2 {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--g100);
}
nav.nav-v2 .nav-inner {
  max-width: 1280px !important; margin: 0 auto; padding: 0 24px;
  display: flex !important; align-items: center; justify-content: space-between; height: 64px !important;
}
nav.nav-v2 .nav-logo,
nav.nav-v2 .logo {
  font-family: var(--font-head) !important; font-weight: 800; font-size: 17px;
  color: var(--ink); text-decoration: none;
  display: flex; align-items: center; gap: 10px;
  letter-spacing: -0.03em; flex-shrink: 0;
}
nav.nav-v2 .nav-logo span { color: var(--cobalt); }

nav.nav-v2 .nav-links {
  display: flex; align-items: center; gap: 2px; flex: 1; justify-content: flex-end;
}
nav.nav-v2 .nav-links > a {
  font-size: 14px; font-weight: 500; color: var(--g600);
  text-decoration: none; padding: 8px 12px; border-radius: 8px;
  transition: all 0.15s;
}
nav.nav-v2 .nav-links > a:hover { color: var(--g900); background: var(--g50); }

/* Dropdown within nav-v2 */
nav.nav-v2 .nav-dropdown { position: relative; }
nav.nav-v2 .nav-dd-btn {
  font-size: 14px; font-weight: 500; color: var(--g600);
  background: none; border: none; cursor: pointer;
  padding: 8px 12px; border-radius: 8px;
  display: flex; align-items: center; gap: 4px;
  transition: all 0.15s; font-family: var(--font-body);
}
nav.nav-v2 .nav-dd-btn:hover { color: var(--g900); background: var(--g50); }
nav.nav-v2 .nav-dd-btn svg { transition: transform 0.2s; }
nav.nav-v2 .nav-dropdown.open .nav-dd-btn { color: var(--cobalt); background: var(--cobalt-lt); }
nav.nav-v2 .nav-dropdown.open .nav-dd-btn svg { transform: rotate(180deg); }
nav.nav-v2 .nav-dd-panel {
  display: none; position: absolute; top: calc(100% + 8px); left: 0;
  background: var(--white); border: 1px solid var(--g200);
  border-radius: 12px; padding: 8px;
  min-width: 220px; z-index: 300;
  box-shadow: 0 4px 6px rgba(0,0,0,.04), 0 12px 32px rgba(0,0,0,.10);
}
nav.nav-v2 .nav-dropdown.open .nav-dd-panel { display: block; }
nav.nav-v2 .nav-dd-panel a {
  display: block; padding: 9px 14px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; color: var(--g700);
  text-decoration: none; transition: all 0.12s;
}
nav.nav-v2 .nav-dd-panel a:hover { background: var(--g50); color: var(--cobalt); }
nav.nav-v2 .nav-dd-panel .dd-divider { height: 1px; background: var(--g100); margin: 6px 0; }
nav.nav-v2 .nav-dd-panel .dd-all { font-size: 12.5px; font-weight: 600; color: var(--cobalt); }
nav.nav-v2 .nav-dd-panel .dd-all:hover { background: var(--cobalt-lt); }

/* Nav CTA button */
nav.nav-v2 .nav-cta {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 9px; font-weight: 700; font-size: 13.5px;
  text-decoration: none; transition: all 0.18s; cursor: pointer; border: none;
  font-family: var(--font-head); letter-spacing: -0.01em;
  background: var(--cobalt); color: var(--white); white-space: nowrap; margin-left: 8px;
  box-shadow: 0 1px 2px rgba(37,99,235,.2), 0 4px 12px rgba(37,99,235,.2);
}
nav.nav-v2 .nav-cta:hover {
  background: var(--cobalt-dk); transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(37,99,235,.2), 0 8px 20px rgba(37,99,235,.25);
}
nav.nav-v2 .nav-login {
  font-size: 14px; font-weight: 500; color: var(--g600);
  text-decoration: none; padding: 8px 10px; margin-right: 4px;
  transition: color 0.15s;
}
nav.nav-v2 .nav-login:hover { color: var(--g900); }

/* Hamburger (mobile only) */
nav.nav-v2 .nav-hamburger {
  display: none; flex-direction: column; gap: 5px; cursor: pointer;
  padding: 8px; border: none; background: none; border-radius: 8px;
}
nav.nav-v2 .nav-hamburger span {
  width: 22px; height: 2px; background: var(--g700); border-radius: 2px;
  transition: all 0.25s ease; transform-origin: center; display: block;
}
nav.nav-v2 .nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
nav.nav-v2 .nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
nav.nav-v2 .nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu for nav-v2 */
.mobile-menu-v2 {
  display: none; position: fixed; top: 64px; left: 0; right: 0; z-index: 190;
  background: var(--white); border-bottom: 1px solid var(--g100);
  padding: 16px 24px 24px; flex-direction: column; gap: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.mobile-menu-v2.open { display: flex; }
.mobile-menu-v2 .mm-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--g400); padding: 12px 16px 4px; }
.mobile-menu-v2 a {
  font-size: 15px; font-weight: 500; color: var(--g700);
  text-decoration: none; padding: 11px 16px; border-radius: 10px;
  transition: all 0.15s;
}
.mobile-menu-v2 a:hover { background: var(--g50); color: var(--g900); }
.mobile-menu-v2 .mm-cta {
  display: block; margin-top: 12px; padding: 13px 20px; text-align: center;
  background: var(--cobalt); color: var(--white); border-radius: 10px;
  font-weight: 700; font-family: var(--font-head); text-decoration: none;
  font-size: 14px;
}

@media (max-width: 768px) {
  nav.nav-v2 .nav-links { display: none !important; }
  nav.nav-v2 .nav-hamburger { display: flex !important; }
}

/* Push content below canonical nav height */
.tool-header, .tool-hero,
[class*="page-header"]:first-of-type,
[class*="hero"]:first-of-type {
  padding-top: max(90px, 7.5vw);
}

/* ─── SKIP NAVIGATION (WCAG 2.1 — SC 2.4.1) ─── */
.skip-nav {
  position: absolute;
  top: -120px;
  left: 16px;
  z-index: 9999;
  padding: 8px 20px;
  background: var(--cobalt);
  color: #fff;
  border-radius: 0 0 8px 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: top 0.2s ease;
  box-shadow: 0 4px 16px rgba(37,99,235,.4);
}
.skip-nav:focus { top: 0; }

/* ─── FOCUS VISIBLE (WCAG 2.4.7) ─── */
:focus-visible {
  outline: 2.5px solid var(--cobalt);
  outline-offset: 3px;
  border-radius: 4px;
}
/* Remove ugly :focus for mouse users */
:focus:not(:focus-visible) { outline: none; }

/* ─── STACK NETWORK BADGE ─── */
.sn-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--g500);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid var(--g200);
  border-radius: 20px;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1.4;
}
.sn-badge:hover {
  color: var(--cobalt);
  border-color: var(--cobalt-md);
}
.sn-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cobalt) 0%, var(--cyan) 100%);
  flex-shrink: 0;
}
.sn-badge-wrap {
  margin-top: 12px;
  display: block;
}

/* ─── DATA LABELS ─── */
/* Applied to output values: [VERIFIED] [ESTIMATE] [SEEK EXPERT ADVICE] [LAST UPDATED] */
.dl {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 5px;
  line-height: 1.3;
  font-family: var(--font-body);
}
.dl-verified  { background: var(--ok-lt);   color: #065F46; }
.dl-estimate  { background: var(--warn-lt); color: #92400E; }
.dl-expert    { background: #EDE9FE;        color: #5B21B6; }
.dl-updated   { background: var(--cobalt-lt); color: #1E40AF; }

/* ─── TOOL OUTPUT DISCLAIMER BAR ─── */
.output-disclaimer {
  font-size: 12px;
  color: var(--g500);
  padding: 10px 14px;
  background: var(--g50);
  border-radius: 8px;
  border: 1px solid var(--g200);
  margin-top: 12px;
  line-height: 1.5;
}
.output-disclaimer strong { color: var(--g700); }

/* ─── PERFORMANCE: PREVENT CLS ─── */
img { height: auto; max-width: 100%; }
canvas { display: block; }

/* Prevent FOUT on font load */
html { font-display: optional; }

/* ─── ACCESSIBILITY: COLOR CONTRAST FIXES ─── */
/* Some tool pages used gray-on-gray that fails WCAG AA */
.tpf-legal a,
.tpf-legal a:visited {
  color: var(--cobalt);
}

/* Ensure sufficient contrast for placeholder text */
input::placeholder,
textarea::placeholder {
  color: var(--g400);
  opacity: 1;
}

/* ─── BUTTON ACCESSIBILITY ─── */
button:not([disabled]) { cursor: pointer; }

/* ─── MOBILE RESPONSIVE UTILITIES ─── */
@media (max-width: 768px) {
  .container { padding: 0 16px; }

  /* Tool pages: ensure calculator doesn't overflow on small screens */
  .tool-container,
  .calc-wrap,
  [class*="calculator"],
  [class*="tool-body"] {
    overflow-x: auto;
  }

  /* Ensure nav doesn't overflow */
  nav { overflow: hidden; }
}

/* ─── STACK NAV v3 — New taxonomy styles (Forecast/Landed Cost/Dead & Safety/Supply) ─── */

/* Tagline inside dropdown panels */
nav .nav-dd-panel .dd-tagline,
.nav-dd-panel .dd-tagline {
  font-size: 11px;
  font-weight: 700;
  color: var(--cobalt);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 14px 4px;
  opacity: 0.65;
  display: block;
  pointer-events: none;
}

/* Wide dropdown panel (Supply Stack) */
nav .nav-dd-panel.nav-dd-panel--wide,
.nav-dd-panel.nav-dd-panel--wide {
  min-width: 270px;
}

/* AI generator CTA at top of Supply Stack dropdown */
nav .nav-dd-panel .dd-ai-cta,
.nav-dd-panel .dd-ai-cta {
  display: block;
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 700;
  background: var(--cobalt-lt);
  color: var(--cobalt);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border: 1px solid var(--cobalt-md);
  margin-bottom: 2px;
}
nav .nav-dd-panel .dd-ai-cta:hover,
.nav-dd-panel .dd-ai-cta:hover {
  background: #DBEAFE;
  color: var(--cobalt-dk);
}

/* ── All nav CTAs should read "My Supply Stack →" — accent button ── */
nav .nav-cta,
nav.nav-v2 .nav-cta {
  background: var(--cobalt) !important;
  color: var(--white) !important;
  border-radius: 9px;
  font-weight: 700;
  font-family: var(--font-head);
  white-space: nowrap;
}

/* ─── MOBILE STICKY CTA (My Supply Stack) ─── */
.mobile-sticky-cta {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 500;
  padding: 12px 16px 16px;
  background: var(--white);
  border-top: 1px solid var(--g200);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.10);
}
.mobile-sticky-cta a {
  display: block;
  text-align: center;
  width: 100%;
  padding: 14px 24px;
  background: var(--cobalt);
  color: var(--white);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-head);
  text-decoration: none;
  letter-spacing: -0.01em;
  box-shadow: 0 2px 8px rgba(37,99,235,.25);
}
@media (max-width: 768px) {
  .mobile-sticky-cta { display: block; }
  /* Give content space above sticky CTA */
  body { padding-bottom: 72px; }
}

/* ─── PRINT STYLES ─── */
@media print {
  nav, .mobile-menu, .sn-badge,
  .nl-popup, #cookieBanner,
  [id*="Popup"], [id*="Banner"],
  .nav-hamburger,
  .mobile-sticky-cta { display: none !important; }

  body { font-size: 12pt; color: #000; padding-bottom: 0; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 10pt; }
}
