/*
 * main.css — Western Trade Global Styles
 * ----------------------------------------
 * Purpose : CSS custom properties (design tokens), reset, base typography,
 *           layout utilities, and section helpers used across all pages.
 * Domain  : ewesterntrade.com
 * Stack   : Pure CSS3, mobile-first, no frameworks
 * Updated : 2026-10-16
 *
 * TABLE OF CONTENTS
 *  1. CSS Custom Properties (Design Tokens)
 *  2. CSS Reset & Box Model
 *  3. Base Typography
 *  4. Layout Utilities (.container, .section)
 *  5. Section Background Alternation
 *  6. Utility Classes
 *  7. Accessibility — Skip Link & Focus Styles
 *  8. Scroll-reveal animation base (used by main.js IntersectionObserver)
 */

/* ============================================================
   1. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ============================================================ */
:root {
  /* — Brand Colors — */
  --color-primary:      #0B3D91;   /* Navy Blue   — main brand, nav, headings    */
  --color-accent:       #D4AF37;   /* Gold        — CTAs, highlights, hover      */
  --color-accent-dark:  #B8963E;   /* Darker Gold — hover state for gold buttons */
  --color-bg:           #EBEDF3;   /* Light Grey  — page/section background      */
  --color-text:         #1F2937;   /* Charcoal    — all body text                */
  --color-text-muted:   #6B7280;   /* Mid Grey    — secondary/caption text       */
  --color-white:        #FFFFFF;   /* Pure White  — cards, navbar                */
  --color-footer-bg:    #071E47;   /* Deep Navy   — footer, dark sections        */
  --color-border:       #E2E8F0;   /* Light border for cards                     */
  --color-success:      #10B981;   /* Form success state                         */
  --color-error:        #EF4444;   /* Form error state                           */
  --color-whatsapp:     #25D366;   /* WhatsApp brand green                       */

  /* — Gradients — */
  --gradient-hero:  linear-gradient(
                      to right,
                      rgba(7, 30, 71, 0.93) 0%,
                      rgba(7, 30, 71, 0.55) 55%,
                      rgba(7, 30, 71, 0.10) 100%
                    );
  --gradient-dark:  linear-gradient(135deg, #0B3D91 0%, #071E47 100%);
  --gradient-gold:  linear-gradient(135deg, #D4AF37 0%, #B8963E 100%);
  --gradient-card-overlay: linear-gradient(
                      to top,
                      rgba(7, 30, 71, 0.90) 0%,
                      rgba(7, 30, 71, 0.40) 60%,
                      transparent 100%
                    );

  /* — Typography — */
  --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;

  /* — 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 */

  /* — Spacing Scale (4px base unit) — */
  --space-1:  0.25rem;   /*  4px */
  --space-2:  0.5rem;    /*  8px */
  --space-3:  0.75rem;   /* 12px */
  --space-4:  1rem;      /* 16px */
  --space-5:  1.25rem;   /* 20px */
  --space-6:  1.5rem;    /* 24px */
  --space-8:  2rem;      /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */
  --space-16: 4rem;      /* 64px */
  --space-20: 5rem;      /* 80px */
  --space-24: 6rem;      /* 96px */

  /* — Layout — */
  --max-width:        1200px;
  --container-px:     1.5rem;   /* 24px horizontal padding */
  --border-radius:    0.5rem;   /*  8px */
  --border-radius-lg: 1rem;     /* 16px */
  --border-radius-xl: 1.5rem;   /* 24px */
  --border-radius-full: 9999px; /* pill / circle */

  /* — Shadows — */
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.10);
  --shadow-lg:  0 8px 32px rgba(11, 61, 145, 0.12);
  --shadow-xl:  0 16px 48px rgba(11, 61, 145, 0.16);

  /* — Transitions — */
  --transition-fast:   0.15s ease;
  --transition:        0.3s ease;
  --transition-slow:   0.5s ease;

  /* — Z-index scale — */
  --z-base:      1;
  --z-dropdown:  100;
  --z-sticky:    200;
  --z-navbar:    1000;
  --z-overlay:   2000;
  --z-whatsapp:  9999;
}


/* ============================================================
   2. CSS RESET & BOX MODEL
   ============================================================ */

/* Box-sizing: all elements include padding + border in width */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Prevent horizontal overflow on mobile */
html {
  overflow-x: hidden;
  scroll-behavior: smooth;  /* smooth anchor scrolling */
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-white);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Remove default list styles where needed */
ul, ol {
  list-style: none;
}

/* Remove default link decoration */
a {
  color: inherit;
  text-decoration: none;
}

/* Make images responsive by default */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* <picture> wraps <img> for WebP — make it layout-transparent so
   existing img sizing (height:100%, object-fit) behaves unchanged */
picture {
  display: contents;
}

/* Remove default button styles */
button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* ── Responsive text overflow fix ─────────────────────────────
   Prevents long words / inline elements from breaking out of
   their container on narrow mobile viewports.
   Affects: paragraphs, headings, list items, table cells.
   Does NOT change layout on desktop — only kicks in when a word
   is longer than the available container width.
   ──────────────────────────────────────────────────────────── */
p, h1, h2, h3, h4, h5, h6, li, td, th, address, span {
  overflow-wrap: break-word;
  word-break:    break-word;   /* fallback for older WebKit/Android */
}

/* Remove default input styles */
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

/* ============================================================
   3. BASE TYPOGRAPHY
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.2;
  color: var(--color-text);
  font-weight: 700;
}

h1 { font-size: var(--text-4xl); font-weight: 800; }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl);  font-family: var(--font-body); font-weight: 600; }

/* Card/footer titles are h3 for correct heading order (h2 → h3) but keep
   the compact h4 look; component CSS below still overrides size/colour. */
.footer__col h3, .value-item h3, .why-bd-item h3,
.process-step h3, .feature-card h3 {
  font-size: var(--text-xl);
  font-family: var(--font-body);
  font-weight: 600;
}
h5 { font-size: var(--text-lg);  font-family: var(--font-body); font-weight: 600; }
h6 { font-size: var(--text-base);font-family: var(--font-body); font-weight: 600; }

p {
  margin-bottom: var(--space-4);
  color: var(--color-text);
  line-height: 1.75;
}

p:last-child {
  margin-bottom: 0;
}

strong { font-weight: 600; }
em     { font-style: italic; }

/* Eyebrow / badge label above headings */
.label {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-3);
}

/* Section heading text-align helper */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

/* Desktop type scale upgrades */
@media (min-width: 1024px) {
  h1 { font-size: var(--text-6xl); }
  h2 { font-size: var(--text-4xl); }
  h3 { font-size: var(--text-3xl); }
}

@media (min-width: 768px) {
  h1 { font-size: var(--text-5xl); }
  h2 { font-size: var(--text-4xl); }
}


/* ============================================================
   4. LAYOUT UTILITIES — .container & .section
   ============================================================ */

/* Centered, max-width container */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-px);
  padding-right: var(--container-px);
}

/* Wider container variant for full-bleed sections with inner content */
.container--wide {
  max-width: 1400px;
}

/* Standard section vertical padding */
.section {
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
}

@media (min-width: 768px) {
  .section {
    padding-top: var(--space-20);
    padding-bottom: var(--space-20);
  }
}

/* Section heading block — eyebrow + h2 + subtext */
.section-header {
  margin-bottom: var(--space-12);
}

.section-header.text-center {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

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

.section-header p {
  color: var(--color-text-muted);
  font-size: var(--text-lg);
}


/* ============================================================
   5. SECTION BACKGROUND ALTERNATION
   ============================================================ */

.section--white  { background-color: var(--color-white); }
.section--grey   { background-color: var(--color-bg); }
.section--dark   {
  background-color: var(--color-footer-bg);
  color: var(--color-white);
}
.section--dark h2,
.section--dark h3,
.section--dark h4,
.section--dark p {
  color: var(--color-white);
}
.section--navy   {
  background: var(--gradient-dark);
  color: var(--color-white);
}
.section--navy h2,
.section--navy h3,
.section--navy p {
  color: var(--color-white);
}


/* ============================================================
   6. UTILITY CLASSES
   ============================================================ */

/* Flexbox helpers */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.flex-col    { display: flex; flex-direction: column; }
.flex-wrap   { flex-wrap: wrap; }
.gap-4       { gap: var(--space-4); }
.gap-6       { gap: var(--space-6); }
.gap-8       { gap: var(--space-8); }

/* Grid helpers */
.grid         { display: grid; }
.grid-2       { display: grid; gap: var(--space-6); grid-template-columns: 1fr; }
.grid-3       { display: grid; gap: var(--space-6); grid-template-columns: 1fr; }
.grid-4       { display: grid; gap: var(--space-6); grid-template-columns: 1fr 1fr; }

@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Display helpers */
.hidden         { display: none; }
.sr-only {
  /* Screen-reader only — visually hidden but accessible */
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Color text helpers */
.text-primary { color: var(--color-primary); }
.text-accent  { color: var(--color-accent);  }
.text-muted   { color: var(--color-text-muted); }
.text-white   { color: var(--color-white); }

/* Margin helpers */
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }


/* ============================================================
   7. ACCESSIBILITY — SKIP LINK & FOCUS STYLES
   ============================================================ */

/* Skip to main content — shown on keyboard Tab, hidden otherwise */
.skip-link {
  position: absolute;
  top: -9999px;
  left: var(--space-4);
  background: var(--color-primary);
  color: var(--color-white);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--border-radius);
  font-weight: 600;
  z-index: var(--z-overlay);
  text-decoration: none;
}
.skip-link:focus {
  top: var(--space-4);
}

/* Visible focus ring for keyboard navigation (WCAG AA) */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

/* Remove focus ring for mouse users only */
:focus:not(:focus-visible) {
  outline: none;
}


/* ============================================================
   8. SCROLL-REVEAL ANIMATION BASE
   ============================================================ */

/* Elements with [data-reveal] start invisible and slide up.
   main.js IntersectionObserver adds .is-visible when in viewport.
   GPU-accelerated: only transform + opacity — no layout reflow. */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered reveal delays for grid items */
[data-reveal-delay="1"] { transition-delay: 0.1s; }
[data-reveal-delay="2"] { transition-delay: 0.2s; }
[data-reveal-delay="3"] { transition-delay: 0.3s; }
[data-reveal-delay="4"] { transition-delay: 0.4s; }
[data-reveal-delay="5"] { transition-delay: 0.5s; }
[data-reveal-delay="6"] { transition-delay: 0.6s; }

/* Respect user preference to reduce motion */
@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
}
