/* ========================================
   DESIGN SYSTEM — Northern Advisory Group
   Custom properties, reset, typography, grid, a11y, print
   ======================================== */

/* ========================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ======================================== */
:root {
  /* Colors - WCAG AA compliant combinations */
  --navy-deep: #1C3163;
  --navy-black: #00071B;
  --white: #FEFFFF;
  --gold: #B8956C; /* Darkened for better contrast */
  --gold-decorative: #D6B585; /* Original gold for decorative elements */
  --gold-light: rgba(184, 149, 108, 0.15);

  /* Focus indicator */
  --focus-ring: #2563eb;
  --focus-ring-offset: 2px;

  /* Typography Scale (Mobile-First) */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 1.875rem;  /* 30px */
  --text-4xl: 2.25rem;   /* 36px */

  /* Spacing Scale */
  --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;

  /* Touch Target Minimum (WCAG 2.5.5) */
  --touch-target: 44px;

  /* Transition */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;
}

/* ========================================
   RESET & BASE STYLES
   ======================================== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 100%; /* Respect user's browser settings */
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* Respect reduced motion preference (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 300;
  background: var(--white);
  color: var(--navy-black);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ========================================
   FOCUS STYLES (WCAG 2.4.7)
   ======================================== */
:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
  border-radius: 2px;
}

/* High contrast focus for dark backgrounds */
.services :focus-visible,
.cta :focus-visible,
footer :focus-visible,
.page-hero :focus-visible {
  outline-color: var(--white);
}

/* ========================================
   SKIP LINK (WCAG 2.4.1)
   ======================================== */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 9999;
  padding: var(--space-3) var(--space-4);
  background: var(--navy-deep);
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  border-radius: 0 0 4px 4px;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ========================================
   VISUALLY HIDDEN (Screen Reader Only)
   ======================================== */
.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;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-weight: 400;
  line-height: 1.2;
}

p {
  max-width: 65ch; /* Optimal reading width */
}

/* ========================================
   LINKS
   ======================================== */
a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration: none;
}

/* ========================================
   IMAGES
   ======================================== */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ========================================
   GRID SYSTEM (Mobile-First)
   ======================================== */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

/* ========================================
   CHAT WIDGET MOBILE ADJUSTMENT
   Account for iOS Safari safe areas
   ======================================== */
#artemis-chat-widget,
[id^="artemis-"],
.artemis-widget-container,
iframe[src*="artemis"] {
  right: 16px !important;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
}

/* ========================================
   TABLET BREAKPOINT (768px+)
   ======================================== */
@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(12, 1fr);
    gap: var(--space-8);
    padding: 0 var(--space-8);
  }
}

/* ========================================
   DESKTOP BREAKPOINT (1024px+)
   ======================================== */
@media (min-width: 1024px) {
  .grid {
    padding: 0 var(--space-16);
  }
}

/* ========================================
   HIGH CONTRAST MODE
   ======================================== */
@media (prefers-contrast: high) {
  :root {
    --gold: #8B6914;
    --gold-decorative: #8B6914;
  }

  a:not(.hero-cta):not(.cta-button):not(.nav-cta) {
    text-decoration: underline;
  }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
  #nav,
  .scroll-prompt,
  .nav-overlay,
  .menu-toggle {
    display: none !important;
  }

  .hero {
    min-height: auto;
    padding: 2rem;
  }

  .hero-image-column {
    display: none;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}
