/* ============================================================
   MSG — McElveen Solutions Group
   Design system: disciplined federal-contractor palette.
   Deep navy-teal accent, cool slate neutrals. General Sans (display)
   + Satoshi (body) via Fontshare.
   ============================================================ */

:root {
  /* ---- Type scale (fluid clamp) ---- */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.25rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 4.5rem);
  --text-hero: clamp(2.75rem, 0.5rem + 6vw, 5.5rem);

  /* ---- Spacing (4px base) ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* ---- Radius ---- */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-full: 9999px;

  /* ---- Transitions ---- */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  /* ---- Content widths ---- */
  --content-narrow: 640px;
  --content-default: 1000px;
  --content-wide: 1280px;
  --content-full: 100%;

  /* ---- Fonts ---- */
  --font-display: 'General Sans', 'Segoe UI', Arial, sans-serif;
  --font-body: 'Satoshi', 'Segoe UI', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

/* ================= LIGHT MODE (default) ================= */
:root,
[data-theme='light'] {
  /* Surfaces — cool slate, not warm beige. Disciplined, technical. */
  --color-bg: #f4f6f7;
  --color-surface: #ffffff;
  --color-surface-2: #fbfcfc;
  --color-surface-offset: #eaeef0;
  --color-surface-offset-2: #dfe5e8;
  --color-surface-dynamic: #d3dbdf;
  --color-divider: #d7dee1;
  --color-border: #c7d0d4;

  /* Text — near-black navy-slate */
  --color-text: #131c22;
  --color-text-muted: #56666d;
  --color-text-faint: #98a5aa;
  --color-text-inverse: #f4f8f9;

  /* Primary accent — deep navy-teal (defense-sector) */
  --color-primary: #073c44;
  --color-primary-2: #0b5a63;
  --color-primary-hover: #0a4d56;
  --color-primary-active: #052a30;
  --color-primary-highlight: #d3e2e2;

  /* Secondary accent — brighter teal for small highlights */
  --color-accent: #0e7c85;
  --color-accent-hover: #0b656c;

  /* Status colors */
  --color-warning: #8a4b17;
  --color-warning-highlight: #ecd9c4;
  --color-error: #8f2c3b;
  --color-error-highlight: #ecd3d6;
  --color-success: #2f6b3a;
  --color-success-highlight: #d4e3d1;
  --color-gold: #96742a;
  --color-gold-highlight: #ece1c4;

  /* Brand seal accent — used only in the logo mark, decoupled from status colors */
  --color-brand-accent: #9c2b3b;

  --shadow-sm: 0 1px 2px oklch(0.15 0.02 220 / 0.08);
  --shadow-md: 0 4px 14px oklch(0.15 0.02 220 / 0.10);
  --shadow-lg: 0 16px 40px oklch(0.15 0.02 220 / 0.16);
}

/* ================= DARK MODE ================= */
[data-theme='dark'] {
  --color-bg: #0a1216;
  --color-surface: #10181d;
  --color-surface-2: #131c22;
  --color-surface-offset: #17222a;
  --color-surface-offset-2: #1c2933;
  --color-surface-dynamic: #22303b;
  --color-divider: #223038;
  --color-border: #2b3b44;

  --color-text: #dde6e8;
  --color-text-muted: #8ca0a8;
  --color-text-faint: #5c7178;
  --color-text-inverse: #0a1216;

  --color-primary: #4fb3ba;
  --color-primary-2: #6cc6cc;
  --color-primary-hover: #6cc6cc;
  --color-primary-active: #3a8f96;
  --color-primary-highlight: #17383c;

  --color-accent: #4fd0d8;
  --color-accent-hover: #7bdde3;

  --color-warning: #d99a5c;
  --color-warning-highlight: #3a2f22;
  --color-error: #e08a95;
  --color-error-highlight: #3a2429;
  --color-success: #8fca8f;
  --color-success-highlight: #223328;
  --color-gold: #d4b866;

  /* Brand seal accent — used only in the logo mark, decoupled from status colors */
  --color-brand-accent: #d9707d;
  --color-gold-highlight: #362f1e;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.35);
  --shadow-md: 0 4px 14px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 20px 44px oklch(0 0 0 / 0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #0a1216;
    --color-surface: #10181d;
    --color-surface-2: #131c22;
    --color-surface-offset: #17222a;
    --color-surface-offset-2: #1c2933;
    --color-surface-dynamic: #22303b;
    --color-divider: #223038;
    --color-border: #2b3b44;
    --color-text: #dde6e8;
    --color-text-muted: #8ca0a8;
    --color-text-faint: #5c7178;
    --color-text-inverse: #0a1216;
    --color-primary: #4fb3ba;
    --color-primary-2: #6cc6cc;
    --color-primary-hover: #6cc6cc;
    --color-primary-active: #3a8f96;
    --color-primary-highlight: #17383c;
    --color-accent: #4fd0d8;
    --color-accent-hover: #7bdde3;
    --color-warning: #d99a5c;
    --color-warning-highlight: #3a2f22;
    --color-error: #e08a95;
    --color-error-highlight: #3a2429;
    --color-success: #8fca8f;
    --color-success-highlight: #223328;
    --color-gold: #d4b866;
    --color-gold-highlight: #362f1e;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.35);
    --shadow-md: 0 4px 14px oklch(0 0 0 / 0.4);
    --shadow-lg: 0 20px 44px oklch(0 0 0 / 0.55);
  }
}

/* ============================================================
   LAYOUT PRIMITIVES
   ============================================================ */

.container {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-6);
}
.container--default {
  max-width: var(--content-default);
}
.container--narrow {
  max-width: var(--content-narrow);
}

.section {
  padding-block: clamp(var(--space-12), 8vw, var(--space-24));
}
.section--tight {
  padding-block: clamp(var(--space-8), 5vw, var(--space-16));
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-accent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.eyebrow::before {
  content: '';
  width: 18px;
  height: 1px;
  background: var(--color-accent);
  display: inline-block;
}

.h-hero {
  font-size: var(--text-hero);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.02em;
}
.h-page {
  font-size: var(--text-2xl);
  font-weight: 600;
  line-height: 1.08;
}
.h-section {
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.15;
}
.h-sub {
  font-size: var(--text-lg);
  font-weight: 600;
  font-family: var(--font-body);
}

.lede {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 60ch;
  font-weight: 400;
}

.prose p {
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
}
.prose p.lead {
  font-size: var(--text-lg);
  color: var(--color-text);
}

/* ============================================================
   HEADER / NAV
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-divider);
  transition:
    transform 0.3s var(--ease-out),
    box-shadow 0.3s var(--ease-out);
}
.site-header--hidden {
  transform: translateY(-100%);
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
  gap: var(--space-6);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text);
  text-decoration: none;
  flex-shrink: 0;
}
.brand svg {
  width: 34px;
  height: 34px;
  color: var(--color-primary-2);
}
[data-theme='light'] .brand svg,
:root:not([data-theme='dark']) .brand svg {
  color: var(--color-primary);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-sm);
  letter-spacing: 0.01em;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}
.nav-links a {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  position: relative;
  padding-block: var(--space-1);
}
.nav-links a:hover,
.nav-links a[aria-current='page'] {
  color: var(--color-text);
}
.nav-links a[aria-current='page']::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  background: var(--color-accent);
  border-radius: var(--radius-full);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.theme-toggle {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.theme-toggle:hover {
  color: var(--color-text);
  border-color: var(--color-text-faint);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}
.nav-toggle svg {
  width: 20px;
  height: 20px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  min-height: 44px;
  transition:
    background var(--transition-interactive),
    color var(--transition-interactive),
    border-color var(--transition-interactive),
    box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
}
.btn--primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
[data-theme='dark'] .btn--primary {
  color: #071013;
}
.btn--primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.btn--primary:active {
  transform: translateY(0);
}
.btn--secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn--secondary:hover {
  border-color: var(--color-text-faint);
  background: var(--color-surface-offset);
}
.btn--ghost {
  color: var(--color-primary-2);
  padding-inline: var(--space-2);
}
[data-theme='light'] .btn--ghost,
:root:not([data-theme='dark']) .btn--ghost {
  color: var(--color-primary);
}
.btn--ghost:hover {
  color: var(--color-accent-hover);
}
.btn--block {
  width: 100%;
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.badge--progress {
  color: var(--color-warning);
  border-color: color-mix(in oklab, var(--color-warning) 40%, var(--color-border));
  background: var(--color-warning-highlight);
}
.badge--accent {
  color: var(--color-accent);
  border-color: color-mix(in oklab, var(--color-accent) 40%, var(--color-border));
  background: var(--color-primary-highlight);
}

/* ============================================================
   CERTIFICATION / DESIGNATION STRIP
   ============================================================ */

.cert-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.cert-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  border: 1px solid color-mix(in oklab, var(--color-accent) 35%, var(--color-border));
  background: var(--color-primary-highlight);
  color: var(--color-text);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.cert-chip svg {
  width: 14px;
  height: 14px;
  color: var(--color-accent);
  flex-shrink: 0;
}
.cert-strip--on-dark .cert-chip {
  border-color: color-mix(in oklab, var(--color-text-inverse) 35%, transparent);
  background: color-mix(in oklab, var(--color-text-inverse) 10%, transparent);
  color: var(--color-text-inverse);
}
.cert-strip--on-dark .cert-chip svg {
  color: var(--color-text-inverse);
}

/* ============================================================
   DATA VISUALIZATION CARDS
   ============================================================ */

.viz-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
}
.viz-card h3 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}
.viz-bar-row {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  align-items: center;
  gap: var(--space-4);
  padding-block: var(--space-3);
}
.viz-bar-row:not(:last-child) {
  border-bottom: 1px solid var(--color-divider);
}
.viz-bar-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}
.viz-bar-track {
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  overflow: hidden;
}
.viz-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-accent);
}
.viz-bar-value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary-2);
  white-space: nowrap;
}
[data-theme='light'] .viz-bar-value,
:root:not([data-theme='dark']) .viz-bar-value {
  color: var(--color-primary);
}
.viz-footnote {
  margin-top: var(--space-5);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.stat-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
}
.stat-kpi {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.stat-kpi .value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-primary-2);
  display: block;
  margin-bottom: var(--space-1);
}
[data-theme='light'] .stat-kpi .value,
:root:not([data-theme='dark']) .stat-kpi .value {
  color: var(--color-primary);
}
.stat-kpi .label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
}

@media (max-width: 768px) {
  .stat-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .viz-bar-row {
    grid-template-columns: 120px 1fr auto;
  }
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--color-divider);
  background: var(--color-surface-offset);
  padding-block: var(--space-16) var(--space-8);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: var(--space-10);
}
.footer-brand p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  max-width: 32ch;
  margin-top: var(--space-4);
}
.footer-col h4 {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
  margin-bottom: var(--space-4);
  font-weight: 600;
}
.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.footer-col a {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  text-decoration: none;
}
.footer-col a:hover {
  color: var(--color-text);
}
.footer-bottom {
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  flex-wrap: wrap;
}

/* ============================================================
   SCROLL REVEAL (opacity-only, no CLS)
   ============================================================ */

.reveal {
  opacity: 1;
}
@supports (animation-timeline: view()) {
  .reveal {
    opacity: 0;
    animation: reveal-fade linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 40%;
  }
}
@keyframes reveal-fade {
  to {
    opacity: 1;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }
}

@media (max-width: 768px) {
  .nav-row {
    gap: var(--space-2);
  }
  .brand {
    flex-shrink: 1;
    min-width: 0;
    gap: var(--space-2);
  }
  .brand svg {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
  }
  .brand-text {
    min-width: 0;
    overflow: hidden;
  }
  .brand-name {
    font-size: 0.8125rem;
    letter-spacing: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-sub {
    display: none;
  }
  .nav-actions {
    flex-shrink: 0;
    gap: var(--space-1, 6px);
  }
}

@media (max-width: 360px) {
  .brand-name {
    font-size: 0.75rem;
  }
  .brand svg {
    width: 26px;
    height: 26px;
  }
}

@media (max-width: 340px) {
  .nav-row {
    gap: 4px;
  }
  .brand-name {
    letter-spacing: -0.015em;
  }
  .brand svg {
    width: 20px;
    height: 20px;
  }
  .brand {
    gap: 4px;
  }
  .nav-actions {
    gap: 4px;
  }
  .theme-toggle,
  .nav-toggle {
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 76px;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(100dvh - 76px);
    align-self: auto;
    background: var(--color-bg);
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-6);
    gap: var(--space-1);
    transform: translateX(100%);
    transition: transform 0.3s var(--ease-out);
    overflow-y: auto;
    z-index: 60;
  }
  .nav-links.is-open {
    transform: translateX(0);
  }
  .nav-links a {
    padding: var(--space-4) var(--space-2);
    border-bottom: 1px solid var(--color-divider);
    font-size: var(--text-base);
  }
  .nav-toggle {
    display: flex;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}
