/* ==========================================================================
   base.css — Design Token System & CSS Foundation
   hxp.co.za — Phase 1 Foundation
   ==========================================================================
   Structure:
   1. @font-face declarations (Inter variable font, self-hosted)
   2. Layer 1: Primitive tokens (exact color, spacing, type values)
   3. Layer 2: Semantic tokens (role-based mappings)
   4. CSS reset & base styles
   5. Layout utility classes
   ========================================================================== */


/* ==========================================================================
   1. FONT FACE DECLARATIONS
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/InterVariable.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/InterVariable-Italic.woff2') format('woff2');
}


/* ==========================================================================
   2. LAYER 1: PRIMITIVE TOKENS
   ========================================================================== */

:root {

  /* -----------------------------------------------------------------------
     Color Primitives — Charcoal Grey + Logo Green (HXP brand)
     ----------------------------------------------------------------------- */
  --primitive-navy-950: #1a1a1a;   /* deepest charcoal */
  --primitive-navy-900: #262626;
  --primitive-navy-800: #3a3a3a;
  --primitive-navy-700: #4d4d4d;
  --primitive-navy-600: #4a8216;   /* dark green — hover, links */
  --primitive-navy-500: #5b9a1e;   /* mid green — buttons, interactive */
  --primitive-blue-400: #a2c73d;   /* logo green — accent on dark */
  --primitive-blue-100: #f2f8e6;   /* lightest green tint */

  /* -----------------------------------------------------------------------
     Neutral Primitives — Apple-Inspired Grays
     ----------------------------------------------------------------------- */
  --primitive-white:    #FFFFFF;
  --primitive-gray-50:  #F5F5F7;   /* Apple page background */
  --primitive-gray-100: #E8E8ED;
  --primitive-gray-200: #D2D2D7;
  --primitive-gray-400: #86868B;   /* Apple secondary text */
  --primitive-gray-600: #6E6E73;
  --primitive-gray-900: #1D1D1F;   /* Apple dark text */
  --primitive-black:    #000000;

  /* -----------------------------------------------------------------------
     Spacing Scale — 4px Base
     ----------------------------------------------------------------------- */
  --space-1:  0.25rem;  /* 4px  */
  --space-2:  0.5rem;   /* 8px  */
  --space-3:  0.75rem;  /* 12px */
  --space-4:  1rem;     /* 16px */
  --space-6:  1.5rem;   /* 24px */
  --space-8:  2rem;     /* 32px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-24: 6rem;     /* 96px */
  --space-32: 8rem;     /* 128px */

  /* -----------------------------------------------------------------------
     Type Scale
     ----------------------------------------------------------------------- */
  --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 */
  --text-5xl:  3rem;      /* 48px */
  --text-6xl:  3.75rem;   /* 60px */

  /* -----------------------------------------------------------------------
     Font Weights (Variable Font Axis)
     ----------------------------------------------------------------------- */
  --weight-regular:   400;
  --weight-medium:    500;
  --weight-semibold:  600;
  --weight-bold:      700;
  --weight-extrabold: 800;

  /* -----------------------------------------------------------------------
     Line Heights
     ----------------------------------------------------------------------- */
  --leading-tight:   1.25;
  --leading-snug:    1.375;
  --leading-normal:  1.5;
  --leading-relaxed: 1.625;

  /* -----------------------------------------------------------------------
     Border Radius
     ----------------------------------------------------------------------- */
  --radius-sm:   0.25rem;  /* 4px  */
  --radius-md:   0.5rem;   /* 8px  */
  --radius-lg:   0.75rem;  /* 12px */
  --radius-xl:   1rem;     /* 16px */
  --radius-2xl:  1.5rem;   /* 24px */
  --radius-full: 9999px;

  /* -----------------------------------------------------------------------
     Animation Timings (Apple-Style)
     ----------------------------------------------------------------------- */
  --duration-fast:   150ms;
  --duration-normal: 250ms;
  --duration-slow:   400ms;
  --ease-out:        cubic-bezier(0.0, 0.0, 0.2, 1.0);
  --ease-in-out:     cubic-bezier(0.4, 0.0, 0.2, 1.0);
  --ease-spring:     cubic-bezier(0.28, 0.11, 0.32, 1.0);  /* Apple spring */

  /* -----------------------------------------------------------------------
     Shadows
     ----------------------------------------------------------------------- */
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md:  0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg:  0 20px 40px rgba(0, 0, 0, 0.12);
  --shadow-xl:  0 32px 64px rgba(0, 0, 0, 0.14);


  /* =========================================================================
     3. LAYER 2: SEMANTIC TOKENS
     ========================================================================= */

  /* -----------------------------------------------------------------------
     Brand Colors
     ----------------------------------------------------------------------- */
  --color-brand:       var(--primitive-navy-800);
  --color-brand-dark:  var(--primitive-navy-950);
  --color-brand-light: var(--primitive-navy-600);
  --color-accent:      var(--primitive-navy-600);

  /* -----------------------------------------------------------------------
     Text Colors
     ----------------------------------------------------------------------- */
  --color-text-primary:   var(--primitive-gray-900);
  --color-text-secondary: var(--primitive-gray-400);
  --color-text-inverse:   var(--primitive-white);
  --color-text-link:      var(--primitive-navy-600);

  /* -----------------------------------------------------------------------
     Background Colors
     ----------------------------------------------------------------------- */
  --color-bg-page:       var(--primitive-white);
  --color-bg-subtle:     var(--primitive-gray-50);
  --color-bg-muted:      var(--primitive-gray-100);
  --color-bg-brand:      var(--primitive-navy-800);
  --color-bg-brand-dark: var(--primitive-navy-950);

  /* -----------------------------------------------------------------------
     Border Colors
     ----------------------------------------------------------------------- */
  --color-border:        var(--primitive-gray-200);
  --color-border-subtle: var(--primitive-gray-100);

  /* -----------------------------------------------------------------------
     Hero Overlay Colors — Dark gradient over hero background images
     Used in: index.php, about.php, services.php hero linear-gradient
     ----------------------------------------------------------------------- */
  --color-hero-overlay-dark:   rgba(20, 20, 20, 0.82);
  --color-hero-overlay-mid:    rgba(30, 30, 30, 0.75);
  --color-hero-overlay-light:  rgba(50, 50, 50, 0.7);

  /* -----------------------------------------------------------------------
     Typography Semantic
     ----------------------------------------------------------------------- */
  --font-sans:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-body: var(--text-base);
  --font-size-nav:  var(--text-sm);
  --font-size-h1:   clamp(var(--text-4xl), 6vw, var(--text-6xl));
  --font-size-h2:   clamp(var(--text-3xl), 4vw, var(--text-5xl));
  --font-size-h3:   clamp(var(--text-xl), 2.5vw, var(--text-3xl));

  /* -----------------------------------------------------------------------
     Layout
     ----------------------------------------------------------------------- */
  --max-width-content: 980px;
  --max-width-wide:    1200px;
  --nav-height:        64px;

}


/* ==========================================================================
   4. CSS RESET & BASE STYLES
   ========================================================================== */

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

* {
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: var(--font-size-body);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
}

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

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

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

a {
  color: var(--color-text-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}


/* ==========================================================================
   5. LAYOUT UTILITY CLASSES
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--max-width-content);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.container--wide {
  max-width: var(--max-width-wide);
}


/* --- Scroll Reveal Utilities --- */

.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal--delay-1 { transition-delay: 100ms; }
.reveal--delay-2 { transition-delay: 200ms; }
.reveal--delay-3 { transition-delay: 300ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}


/* --- Button Utilities --- */
/* Note: btn-ghost is designed for dark backgrounds (white border at 40% opacity). */
/* On light backgrounds, use btn-primary or create a dedicated light-bg variant. */

.btn-primary {
  display: inline-block;
  background: var(--primitive-navy-500);
  color: var(--color-text-inverse);
  padding: 14px 32px;
  border-radius: var(--radius-full);
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  text-decoration: none;
  transition: background var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

.btn-primary:hover {
  background: var(--primitive-navy-600);
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(162, 199, 61, 0.4); /* green glow */
  text-decoration: none;
  color: var(--color-text-inverse);
}

.btn-ghost {
  display: inline-block;
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: var(--color-text-inverse);
  padding: 12px 32px;
  border-radius: var(--radius-full);
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  text-decoration: none;
  transition: border-color var(--duration-normal) var(--ease-out),
              background var(--duration-normal) var(--ease-out);
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
  color: var(--color-text-inverse);
}

@media (prefers-reduced-motion: reduce) {
  .btn-primary {
    transition: none;
  }
  .btn-primary:hover {
    transform: none;
  }
}
