/**
 * HoloModular Foundation CSS
 * 
 * Master import file that loads all foundation styles in the correct order.
 * Import this single file to get the complete design system.
 * 
 * Order matters:
 * 1. Tokens (CSS custom properties) - must come first
 * 2. Elements (components that use tokens)
 * 3. Forms (specialized component styles)
 * 4. Utilities (overrides and helpers) - must come last
 * 
 * Usage in HTML:
 * <link rel="stylesheet" href="/css/foundation.css">
 * 
 * Or import in SCSS/CSS:
 * @import 'foundation.css';
 * 
 * Prefix convention:
 * - hm-* : HoloModular foundation (cross-site)
 * - sq-* : ServiceQuery specific
 * - sb-* : ServiceBricks specific
 */

@import 'tokens.css';
@import 'elements.css';
@import 'forms.css';
@import 'utilities.css';

/* ========================================
   BASE RESET & DEFAULTS
   ======================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--hm-font-family-base);
  font-size: var(--hm-text-base);
  font-weight: var(--hm-font-normal);
  line-height: var(--hm-leading-loose);
  color: var(--hm-color-text-primary);
  background-color: var(--hm-color-bg-base);
}

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

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: var(--hm-space-4);
  font-weight: var(--hm-font-bold);
  line-height: var(--hm-leading-snug);
  color: var(--hm-color-text-primary);
}

h1 { font-size: var(--hm-text-4xl); }
h2 { font-size: var(--hm-text-3xl); }
h3 { font-size: var(--hm-text-2xl); font-weight: var(--hm-font-semibold); }
h4 { font-size: var(--hm-text-xl); font-weight: var(--hm-font-semibold); }
h5 { font-size: var(--hm-text-lg); font-weight: var(--hm-font-semibold); }
h6 { font-size: var(--hm-text-base); font-weight: var(--hm-font-semibold); }

p {
  margin-top: 0;
  margin-bottom: var(--hm-space-4);
}

a {
  color: var(--hm-color-accent-light);
  text-decoration: none;
  transition: color var(--hm-transition-fast);
}

a:hover {
  color: var(--hm-color-accent);
}

/* Muted links (secondary/muted text as links) get accent on hover */
a.hm-text-secondary:hover,
a.hm-text-muted:hover,
.nav-link.hm-text-secondary:hover {
  color: var(--hm-color-accent) !important;
}

a:focus-visible {
  outline: 2px solid var(--hm-color-accent);
  outline-offset: 2px;
}

strong, b {
  font-weight: var(--hm-font-semibold);
}

small {
  font-size: var(--hm-text-sm);
}

/* ========================================
   CODE DEFAULTS
   ======================================== */

code, kbd, samp, pre {
  font-family: var(--hm-font-family-mono);
}

code {
  font-size: 0.875em;
  background: var(--hm-color-bg-elevated);
  padding: 0.125em 0.375em;
  border-radius: var(--hm-radius-sm);
}

pre {
  margin: 0 0 var(--hm-space-4);
  padding: var(--hm-space-4);
  background: var(--hm-color-bg-elevated);
  border-radius: var(--hm-radius-md);
  overflow-x: auto;
  max-width: 100%;
}

pre code {
  padding: 0;
  background: transparent;
}

/* Prevent horizontal overflow */
html, body {
  overflow-x: hidden;
}

/* ========================================
   IMAGE DEFAULTS
   ======================================== */

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ========================================
   LIST DEFAULTS
   ======================================== */

ul, ol {
  margin-top: 0;
  margin-bottom: var(--hm-space-4);
  padding-left: var(--hm-space-6);
}

li {
  margin-bottom: var(--hm-space-2);
}

/* ========================================
   TABLE DEFAULTS
   ======================================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--hm-space-4);
}

th, td {
  padding: var(--hm-space-3) var(--hm-space-4);
  text-align: left;
  border-bottom: 1px solid var(--hm-color-border);
}

th {
  font-weight: var(--hm-font-semibold);
  color: var(--hm-color-text-primary);
}

td {
  color: var(--hm-color-text-secondary);
}

/* ========================================
   HR DEFAULTS
   ======================================== */

hr {
  border: none;
  border-top: 1px solid var(--hm-color-border);
  margin: var(--hm-space-8) 0;
}

/* ========================================
   FOCUS VISIBLE (ACCESSIBILITY)
   ======================================== */

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--hm-color-accent);
  outline-offset: 2px;
}

/* ========================================
   SELECTION
   ======================================== */

::selection {
  background: var(--hm-color-accent);
  color: var(--hm-color-text-on-accent);
}

/* ========================================
   REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
