/* ==========================================================
   CNSPK design tokens · v3
   ----------------------------------------------------------
   Single source of truth for colour, type, space, layout,
   radius, and motion. Linked first on every page.

   v3 changes (redesign/cnspk-platform):
   - Fonts are no longer @imported here. Generated pages link
     them in <head>; legacy pages get them from js/Navbar.js.
   - Adds an AA-safe secondary text colour (--muted), a type
     scale, layout widths, and line-height tokens.
   - Keeps every v2 variable and utility class so legacy pages
     (join, members, certificate, consultants, code of conduct)
     render unchanged.
   ========================================================== */

:root {
  /* ---- Brand accents ------------------------------------- */
  --lime: #C7FF3E;           /* accent on dark surfaces only */
  --lime-600: #9BD11A;       /* accent text on light surfaces */
  --lime-glow: #E8FF8A;
  --pak-green: #01411C;      /* heritage, used sparingly */
  --pak-green-2: #0B5A2E;
  --gold: #C9A227;           /* heritage hairlines, Urdu */

  /* ---- Surfaces ----------------------------------------- */
  --carbon: #0F1115;         /* page */
  --carbon-2: #13161B;       /* alternating band */
  --charcoal: #1A1D24;       /* raised surface */
  --slate: #2A2E37;          /* rules and borders */
  --slate-2: #3A3F4A;        /* stronger borders, hover */
  --steel: #6B7280;          /* decorative only: fails AA for small text on carbon */
  --muted: #A3A8B3;          /* secondary text, 7.4:1 on carbon */
  --bone: #F4F1EA;           /* primary text on dark */
  --bone-2: #E8E3D6;

  /* ---- Semantic ----------------------------------------- */
  --watch: #F59E0B;
  --breach: #F43F5E;
  --signal: #06B6D4;
  --ok: #4ADE80;

  /* ---- Legacy gradients (v2 pages only) ------------------ */
  --grad-stamp-glow: linear-gradient(135deg, #C7FF3E 0%, #9BD11A 100%);
  --grad-terminal-dawn: linear-gradient(180deg, #0F1115 0%, #01411C 50%, #C7FF3E 100%);

  /* ---- Type families ------------------------------------ */
  --font-display: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --font-urdu: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', serif;

  /* ---- Type scale (fluid, 360px → 1280px) ---------------- */
  --text-xs: 0.75rem;                                  /* 12 */
  --text-sm: 0.875rem;                                 /* 14 */
  --text-base: 1rem;                                   /* 16 */
  --text-md: 1.125rem;                                 /* 18 */
  --text-lg: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);   /* 20 → 24 */
  --text-xl: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem);  /* 24 → 34 */
  --text-2xl: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);    /* 32 → 52 */
  --text-3xl: clamp(2.5rem, 1.5rem + 4.2vw, 5rem);     /* 40 → 80 */

  --leading-tight: 1.04;
  --leading-snug: 1.25;
  --leading-body: 1.6;
  --tracking-display: -0.035em;
  --tracking-label: 0.08em;

  /* ---- Spacing (4px base) ------------------------------- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;
  --section-y: clamp(64px, 5vw + 40px, 112px);

  /* ---- Layout ------------------------------------------- */
  --container: 1200px;
  --container-narrow: 760px;
  --gutter: clamp(20px, 4vw, 40px);
  --header-h: 68px;

  /* ---- Radius ------------------------------------------- */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-2xl: 24px;
  --r-pill: 9999px;

  /* ---- Borders ------------------------------------------ */
  --rule: 1px solid var(--slate);
  --rule-strong: 1px solid var(--slate-2);

  /* ---- Motion ------------------------------------------- */
  --dur-hover: 150ms;
  --dur-elevate: 200ms;
  --dur-reveal: 400ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);

  /* ---- Shadow (legacy v2 pages) -------------------------- */
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 8px 24px rgba(0, 0, 0, 0.32);
  --shadow-cta: 6px 6px 0 0 var(--charcoal), 6px 6px 0 1px var(--lime-600);
  --shadow-cta-hover: 8px 8px 0 0 var(--charcoal), 8px 8px 0 1px var(--lime-600);
  --shadow-soft: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-elevated: 0 20px 60px rgba(0, 0, 0, 0.55);

  /* ---- Layers ------------------------------------------- */
  --z-header: 50;
  --z-menu: 60;
  --z-skip: 100;

  color-scheme: dark;
}

/* ==========================================================
   Base
   ========================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  background-color: var(--carbon);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  display: block;
}

a {
  color: var(--lime);
  text-decoration: none;
  transition: color var(--dur-hover) var(--ease);
}

a:hover {
  color: var(--lime-glow);
}

button {
  font-family: inherit;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: inherit;
}

ul,
ol {
  list-style: none;
}

code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

::selection {
  background: var(--lime);
  color: var(--carbon);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* ==========================================================
   Shared utilities (used by generated and legacy pages)
   ========================================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden,
[hidden] {
  display: none !important;
}

/* ==========================================================
   Legacy v2 primitives — kept so legacy pages render as before.
   New pages use the components in css/site.css instead.
   ========================================================== */
.brand-shield {
  width: 38px;
  height: 38px;
  background-image: url('/brand/assets/cnspk-shield.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  display: inline-block;
  text-indent: -9999px;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand-shield--sm { width: 24px; height: 24px; }
.brand-shield--lg { width: 48px; height: 48px; }

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--lime);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: var(--space-5);
}
.section-eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--lime);
  flex-shrink: 0;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 18px 32px;
  background: var(--lime);
  color: var(--carbon);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-decoration: none;
  border: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
  box-shadow: var(--shadow-cta);
  transition: transform var(--dur-hover) var(--ease), box-shadow var(--dur-hover) var(--ease), background var(--dur-hover) var(--ease);
}
.btn-primary:hover,
.btn-primary:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-cta-hover);
  background: var(--lime-glow);
  color: var(--carbon);
}
.btn-primary--sm {
  padding: 10px 18px;
  font-size: 13px;
  box-shadow: 4px 4px 0 0 var(--charcoal), 4px 4px 0 1px var(--lime-600);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 18px 32px;
  background: transparent;
  color: var(--bone);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--slate);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color var(--dur-hover) var(--ease), color var(--dur-hover) var(--ease);
}
.btn-secondary:hover,
.btn-secondary:focus-visible {
  border-color: var(--lime);
  color: var(--lime);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: rgba(199, 255, 62, 0.10);
  border: 1px solid rgba(199, 255, 62, 0.25);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--lime);
  letter-spacing: 0.04em;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  flex-shrink: 0;
}

.glass-panel {
  background: rgba(15, 17, 21, 0.92);
  border: 1px solid var(--slate);
}

/* ==========================================================
   Reduced motion
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto; }
  .btn-primary:hover,
  .btn-primary:focus-visible { transform: none; }
}
