/* ==========================================================================
   Checkpoint GTM — Global Styles
   Tokens, Typography, Grid, Reset
   ========================================================================== */

/* --- CSS Custom Properties (Light Mode Default) --- */
:root {
  /* Backgrounds */
  --bg-primary: #FAFAF8;
  --bg-secondary: #F2F0EC;
  --bg-dark: #1A1A1A;
  --bg-card: #FFFFFF;

  /* Text */
  --text-primary: #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-inverse: #FAFAF8;
  --text-muted: #999999;

  /* Accent */
  --accent: #2D6A4F;
  --accent-light: #40916C;
  --accent-subtle: #D8F3DC;
  --accent-warm: #E8985E;
  --accent-warm-light: #F0B88A;

  /* Borders */
  --border: #E5E3DE;
  --border-dark: #333333;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.10);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 1px rgba(0, 0, 0, 0.08);
  --shadow-hero-card: 0 8px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);

  /* Typography */
  --font-display: 'Roboto Slab', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */
  --space-4xl: 6rem;     /* 96px */
  --space-5xl: 8rem;     /* 128px */

  /* Layout */
  --container-max: 1200px;
  --container-padding: 1.5rem;
  --grid-gap: 2rem;
  --nav-height: 72px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --bg-primary: #0F0F0F;
  --bg-secondary: #1A1A1A;
  --bg-dark: #0A0A0A;
  --bg-card: #1E1E1E;

  --text-primary: #F0EDE8;
  --text-secondary: #9A9A9A;
  --text-inverse: #1A1A1A;
  --text-muted: #666666;

  --accent: #52B788;
  --accent-light: #74C69D;
  --accent-subtle: #1B3A2A;
  --accent-warm: #E8985E;
  --accent-warm-light: #F0B88A;

  --border: #2A2A2A;
  --border-dark: #444444;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.3);
  --shadow-hero-card: 0 8px 40px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* --- Navigation Logo (shared across all pages) --- */
.nav__logo-img {
  height: 28px;
  width: auto;
}

.nav__logo-img--dark {
  display: none;
}

[data-theme="dark"] .nav__logo-img:not(.nav__logo-img--dark) {
  display: none;
}

[data-theme="dark"] .nav__logo-img--dark {
  display: block;
}

/* --- Dark Mode Nav Link Contrast --- */
[data-theme="dark"] .nav__link {
  color: rgba(250, 250, 248, 0.65);
}

[data-theme="dark"] .nav__link:hover {
  color: rgba(250, 250, 248, 0.95);
}

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-base), color var(--transition-base);
}

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

input, button, textarea, select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.25rem, 5vw, 4rem);
}

h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  line-height: 1.2;
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 500;
  line-height: 1.3;
}

h4 {
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.4;
}

p {
  color: var(--text-secondary);
  max-width: 65ch;
}

.overline {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.text-large {
  font-size: 1.25rem;
  line-height: 1.5;
}

.text-small {
  font-size: 0.875rem;
  line-height: 1.5;
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.section {
  padding-block: var(--space-4xl);
}

.section--alt {
  background-color: var(--bg-secondary);
}

.section--dark {
  background-color: var(--bg-dark);
  color: var(--text-inverse);
}

.section--dark p {
  color: rgba(250, 250, 248, 0.7);
}

.section--dark h2,
.section--dark h3 {
  color: var(--text-inverse);
}

/* Grid */
.grid {
  display: grid;
  gap: var(--grid-gap);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* Flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* Spacing utilities */
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

/* Text alignment */
.text-center { text-align: center; }

/* --- Section Header Pattern --- */
.section-header {
  max-width: 640px;
  margin-bottom: var(--space-2xl);
}

.section-header.text-center {
  margin-inline: auto;
}

.section-header .overline {
  margin-bottom: var(--space-sm);
  display: block;
}

.section-header h2 {
  margin-bottom: var(--space-md);
}

.section-header p {
  margin-inline: auto;
}

/* --- Responsive Grid --- */
@media (max-width: 1024px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  :root {
    --container-padding: 1.25rem;
    --grid-gap: 1.5rem;
  }

  body {
    font-size: 1rem;
  }

  .section {
    padding-block: var(--space-3xl);
  }

  .grid--2, .grid--3, .grid--4 {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Theme Switch — 3-state Segmented Control (Day / Night / AI)
   ========================================================================== */
/* Override per-page inlined .theme-toggle { width/height/border-radius } that
   would otherwise crush the wrapper. The new control is a container, not a button. */
.theme-switch.theme-toggle {
  width: auto !important;
  height: 36px !important;
  border-radius: var(--radius-full) !important;
  background: var(--bg-secondary) !important;
  color: inherit !important;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  height: 36px;
}

.theme-switch__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.theme-switch__btn:hover {
  color: var(--text-primary);
}

.theme-switch__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-switch__btn.is-active {
  background: var(--accent);
  color: #FFFFFF;
}

.theme-switch__btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.theme-switch__btn .theme-switch__label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

@media (max-width: 640px) {
  .theme-switch {
    display: none;
  }
}

/* Language switcher — mirrors theme switch pattern */
.lang-switch { position: relative; }
.lang-switch__trigger {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.04em;
  padding: 6px 10px; border-radius: 999px;
  cursor: pointer; transition: all var(--transition-fast);
}
.lang-switch__trigger:hover {
  color: var(--text-primary); border-color: var(--border);
}
.lang-switch__menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  list-style: none; padding: 6px 0; margin: 0;
  background: var(--bg-card, var(--bg, #fff));
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.08));
  min-width: 160px;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(-4px);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility 0s linear var(--transition-fast);
  z-index: 200;
}
.lang-switch:hover .lang-switch__menu,
.lang-switch:focus-within .lang-switch__menu {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translateY(0);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.lang-switch__menu a {
  display: block; padding: 6px 14px;
  font-size: 0.875rem; color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.lang-switch__menu a:hover { background: var(--bg-secondary, var(--bg-alt)); color: var(--accent); }
[data-theme="dark"] .lang-switch__menu { background: rgba(26,26,26,0.98); border-color: rgba(255,255,255,0.1); }

/* ==========================================================================
   AI Mode Banner
   ========================================================================== */
.ai-mode-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  padding: 8px 16px;
  background: #0a0a0a;
  color: #FAFAF8;
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  text-align: center;
  border-bottom: 1px solid #2D6A4F;
}

.ai-mode-banner__exit {
  color: #52B788;
  text-decoration: underline;
  margin-left: 4px;
}

.ai-mode-banner__exit:hover {
  color: #74C69D;
}

/* ==========================================================================
   AI Summary Blocks — hidden in Day/Night, visible in AI mode
   ========================================================================== */
.ai-summary {
  display: none;
}

/* ==========================================================================
   AI Theme — Machine-readable, LLM-optimized rendering
   ========================================================================== */
[data-theme="ai"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-dark: #0a0a0a;
  --bg-card: #fafafa;

  --text-primary: #0a0a0a;
  --text-secondary: #404040;
  --text-inverse: #ffffff;
  --text-muted: #666666;

  --accent: #2D6A4F;
  --accent-light: #40916C;
  --accent-subtle: #D8F3DC;

  --border: #d4d4d4;
  --border-dark: #a3a3a3;

  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-card: none;
  --shadow-hero-card: none;

  --font-display: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-body: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="ai"] body {
  font-family: var(--font-body);
  line-height: 1.7;
  background: var(--bg-primary);
  color: var(--text-primary);
  padding-top: 40px; /* room for AI banner */
}

[data-theme="ai"] .ai-mode-banner {
  display: block;
}

/* Kill motion, transitions, decorative chrome */
[data-theme="ai"] *,
[data-theme="ai"] *::before,
[data-theme="ai"] *::after {
  animation: none !important;
  transition: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

/* Hide heavy animation canvas + decorative imagery */
[data-theme="ai"] canvas,
[data-theme="ai"] .hero__canvas-wrap,
[data-theme="ai"] .hero__particles,
[data-theme="ai"] .hero-particles,
[data-theme="ai"] .hero__scroll-cta,
[data-theme="ai"] .hero__scroll,
[data-theme="ai"] .hero__bg,
[data-theme="ai"] .marquee,
[data-theme="ai"] .partner-grid img,
[data-theme="ai"] .cert-badge,
[data-theme="ai"] .certification-badges,
[data-theme="ai"] img:not([data-keep-in-ai]) {
  display: none !important;
}

/* Flatten the hero so it doesn't hijack the viewport */
[data-theme="ai"] .hero,
[data-theme="ai"] .hero__inner,
[data-theme="ai"] .hero__fixed {
  position: relative !important;
  height: auto !important;
  min-height: 0 !important;
  padding-block: 4rem 2rem !important;
  background: var(--bg-primary) !important;
}

[data-theme="ai"] .hero__content,
[data-theme="ai"] .hero__card,
[data-theme="ai"] .hero__cards {
  position: static !important;
  transform: none !important;
}

/* Single-column, reading-max width */
[data-theme="ai"] main,
[data-theme="ai"] .container,
[data-theme="ai"] .section__inner,
[data-theme="ai"] .hero__inner {
  max-width: 760px !important;
  margin-inline: auto !important;
  padding-inline: 1.5rem !important;
}

[data-theme="ai"] section {
  padding-block: 2rem !important;
  background: var(--bg-primary) !important;
}

[data-theme="ai"] .grid,
[data-theme="ai"] .grid--2,
[data-theme="ai"] .grid--3,
[data-theme="ai"] .grid--4 {
  grid-template-columns: 1fr !important;
  gap: 1rem !important;
}

/* Clean heading hierarchy */
[data-theme="ai"] h1,
[data-theme="ai"] h2,
[data-theme="ai"] h3,
[data-theme="ai"] h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1.3;
}

[data-theme="ai"] h1 { font-size: 2rem; margin-block: 2rem 1rem; }
[data-theme="ai"] h2 { font-size: 1.5rem; margin-block: 2rem 0.75rem; }
[data-theme="ai"] h3 { font-size: 1.125rem; margin-block: 1.5rem 0.5rem; }

[data-theme="ai"] a {
  color: var(--accent);
  text-decoration: underline;
}

[data-theme="ai"] .btn,
[data-theme="ai"] .btn--primary,
[data-theme="ai"] .btn--secondary {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--bg-primary) !important;
  color: var(--accent) !important;
  border: 1px solid var(--accent) !important;
  border-radius: 2px !important;
  font-family: var(--font-body);
  font-weight: 600;
}

/* Show AI summary blocks */
[data-theme="ai"] .ai-summary {
  display: block;
  border-left: 3px solid var(--accent);
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  margin: 1.5rem 0 2rem;
  font-size: 0.9375rem;
  border-radius: 0 4px 4px 0;
}

[data-theme="ai"] .ai-summary h2,
[data-theme="ai"] .ai-summary h3 {
  margin-top: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

[data-theme="ai"] .ai-summary p,
[data-theme="ai"] .ai-summary li {
  margin: 0.5rem 0;
}

/* Nav simplification in AI mode */
[data-theme="ai"] .nav,
[data-theme="ai"] .nav--scrolled {
  position: static !important;
  background: var(--bg-primary) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: 1px solid var(--border);
}

[data-theme="ai"] .nav__dropdown-menu {
  position: static !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  pointer-events: auto !important;
  box-shadow: none !important;
  border: 0 !important;
  padding: 0 !important;
  min-width: 0 !important;
}

/* Force all scroll-revealed elements visible regardless of IntersectionObserver state */
[data-theme="ai"] .reveal,
[data-theme="ai"] .partner-grid__card,
[data-theme="ai"] .click-in,
[data-theme="ai"] .image-bank__card,
[data-theme="ai"] .stat-block {
  opacity: 1 !important;
  transform: none !important;
  visibility: visible !important;
}

/* Hide marquee + partner grid + cert scatter entirely — they don't read well as text */
[data-theme="ai"] .client-marquee,
[data-theme="ai"] .partner-grid,
[data-theme="ai"] .certification-badges,
[data-theme="ai"] .hero-bot,
[data-theme="ai"] .hero__bot,
[data-theme="ai"] .image-bank,
[data-theme="ai"] .testimonials__avatar,
[data-theme="ai"] .nav__mobile-toggle {
  display: none !important;
}

/* Promote .ai-summary to lead position — it should appear immediately under the nav */
[data-theme="ai"] main > .ai-summary:first-child,
[data-theme="ai"] .ai-summary {
  margin-top: 1rem;
}

/* Add a "machine-readable view" header at the top of main so LLMs/users see context */
[data-theme="ai"] main::before {
  content: "Checkpoint GTM — Machine-readable view. Optimized for LLM parsing and quick scanning.";
  display: block;
  max-width: 760px;
  margin: 1rem auto 2rem;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 4px;
}

