/* =========================================
   NMBII — New Mexico Building Industry Institute
   Design System: Authoritative / Southwest / Policy
   Palette: Deep adobe/terracotta + slate blue + warm sand
   Fonts: Playfair Display (display) + DM Sans (body)
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700;900&family=DM+Sans:wght@300;400;500;600;700&display=swap');

/* ---- Type Scale ---- */
:root {
  --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.5rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    5rem);
  --text-hero: clamp(3rem,     0.5rem  + 7vw,    8rem);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

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

  /* ---- Shadows ---- */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.14);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.18);

  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 14px;
  --radius-xl: 24px;

  --transition: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Light Mode (default) — Southwest Slate / Adobe ---- */
:root, [data-theme="light"] {
  /* Surfaces */
  --color-bg:              #f5f2ec;
  --color-surface:         #faf8f3;
  --color-surface-2:       #ffffff;
  --color-surface-offset:  #ede8df;
  --color-surface-dark:    #1d2535;
  --color-divider:         #dcd5c8;
  --color-border:          #d0c9bc;

  /* Text */
  --color-text:            #1a1714;
  --color-text-muted:      #6b6459;
  --color-text-faint:      #b0a898;
  --color-text-inverse:    #f5f2ec;

  /* Primary — Slate Blue (policy/government authority) */
  --color-primary:         #2d4a7a;
  --color-primary-hover:   #1e3560;
  --color-primary-light:   #e8eef6;
  --color-primary-mid:     #3d5f94;

  /* Accent — Terracotta/Adobe (NM Southwest) */
  --color-accent:          #b5472a;
  --color-accent-hover:    #963a21;
  --color-accent-light:    #f7ebe6;
  --color-accent-mid:      #c95c3a;

  /* Gold — warm highlight */
  --color-gold:            #c8972a;
  --color-gold-light:      #fdf4e0;

  /* Nav */
  --color-nav-bg:          rgba(245, 242, 236, 0.92);
}

/* ---- Dark Mode ---- */
[data-theme="dark"] {
  --color-bg:              #111620;
  --color-surface:         #181e2c;
  --color-surface-2:       #1f2738;
  --color-surface-offset:  #141926;
  --color-surface-dark:    #0d1018;
  --color-divider:         #283045;
  --color-border:          #2f3a50;

  --color-text:            #eae8e3;
  --color-text-muted:      #8a9ab5;
  --color-text-faint:      #4a5568;
  --color-text-inverse:    #111620;

  --color-primary:         #5b82c0;
  --color-primary-hover:   #7097d0;
  --color-primary-light:   #1a2540;
  --color-primary-mid:     #4a6fa8;

  --color-accent:          #d4694c;
  --color-accent-hover:    #e07a5c;
  --color-accent-light:    #2a1510;
  --color-accent-mid:      #c05a3f;

  --color-gold:            #d4a83a;
  --color-gold-light:      #2a2010;

  --color-nav-bg:          rgba(17, 22, 32, 0.95);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color 0.3s, color 0.3s;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ---- Typography helpers ---- */
.font-display { font-family: var(--font-display); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; font-weight: 700; }
h4, h5, h6 { font-family: var(--font-body); font-weight: 600; }

/* ---- Layout utilities ---- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}
.container--wide { max-width: 1400px; }
.container--narrow { max-width: 820px; }

.section {
  padding-block: clamp(var(--space-12), 8vw, var(--space-32));
}
.section--sm {
  padding-block: clamp(var(--space-8), 4vw, var(--space-16));
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.75rem 1.75rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--radius);
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-accent {
  background: var(--color-accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn-outline:hover {
  background: var(--color-primary);
  color: #fff;
}

.btn-outline-light {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.6);
}
.btn-outline-light:hover {
  background: rgba(255,255,255,0.15);
  border-color: #fff;
}

.btn-lg {
  padding: 1rem 2.25rem;
  font-size: var(--text-base);
}

/* ---- Cards ---- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ---- Section label ---- */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-4);
}
.section-label::before {
  content: '';
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-accent);
}

/* ---- Divider ---- */
.divider {
  height: 1px;
  background: var(--color-divider);
  border: none;
}

/* ---- Scroll animations ---- */
.fade-up {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}
.fade-up-delay-1 { transition-delay: 0.1s; }
.fade-up-delay-2 { transition-delay: 0.2s; }
.fade-up-delay-3 { transition-delay: 0.3s; }
.fade-up-delay-4 { transition-delay: 0.4s; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .container { padding: 0 var(--space-5); }
  .hide-mobile { display: none !important; }
}
