/**
 * Roof EGR — Design Tokens
 * Source of truth for all visual decisions.
 * Reference: BRAND-DIRECTION-v2.md
 *
 * Usage: Import this file first in your stylesheet chain.
 * Every color, size, shadow, and motion value derives from here.
 * Never hardcode hex values — always use a token.
 */

:root {

  /* ─── COLOR: NAVY FAMILY ──────────────────────────────────────────────────── */
  --navy-950: #000D1A;   /* deepest background, behind-hero layer              */
  --navy-900: #001433;   /* hero, footer, callout bands                        */
  --navy-800: #001E4A;   /* dark section variant, interactive hover on 900     */
  --navy-700: #002569;   /* primary navy — buttons, badges (EGR official)      */
  --navy-600: #003080;   /* hover state for navy-700 interactive elements      */
  --navy-500: #1A4D99;   /* softer navy for decorative / illustrative use      */
  --navy-100: #D9E3F5;   /* light navy tint — borders, subtle dividers         */
  --navy-50:  #EEF2FA;   /* barely-there navy surface, card borders on white   */


  /* ─── COLOR: GOLD FAMILY ─────────────────────────────────────────────────── */
  /* CRITICAL RULE:                                                              */
  /*   gold-400 (#FFCD00) → dark navy surfaces ONLY (fails contrast on white)  */
  /*   gold-700 (#8A6A00) → light surfaces ONLY (links, text, icons on white)  */
  --gold-400: #FFCD00;   /* EGR official gold — DARK SURFACES ONLY             */
  --gold-500: #E6B800;   /* slightly warmer variant, icons on dark             */
  --gold-600: #C49A00;   /* hover state for gold interactive on light surface  */
  --gold-700: #8A6A00;   /* links and text emphasis on light (WCAG AA pass)    */
  --gold-800: #5C4500;   /* very dark gold for rich emphasis                   */
  --gold-100: #FFF3C4;   /* subtle warm card background                        */
  --gold-50:  #FFFBEB;   /* warm section tint — use sparingly                  */


  /* ─── COLOR: NEUTRALS ────────────────────────────────────────────────────── */
  --ink:   #0F1B2D;   /* primary headings, high-contrast text                  */
  --slate: #51607A;   /* body text, secondary copy                             */
  --stone: #8A96A8;   /* captions, metadata, timestamps                        */
  --mist:  #EEF2F9;   /* alternating section background                        */
  --cloud: #F5F7FB;   /* default page background                               */
  --white: #FFFFFF;   /* cards, nav, pure white surfaces                       */


  /* ─── COLOR: SEMANTIC ALIASES ────────────────────────────────────────────── */
  /* Use these in component CSS. Never reach for raw tokens in components.      */

  /* Backgrounds */
  --bg-default:  var(--cloud);
  --bg-surface:  var(--white);
  --bg-subtle:   var(--mist);
  --bg-hero:     var(--navy-900);
  --bg-callout:  var(--navy-700);
  --bg-warm:     var(--gold-50);
  --bg-data:     var(--navy-900);   /* estimator / price display background    */

  /* Text */
  --text-primary:    var(--ink);
  --text-secondary:  var(--slate);
  --text-tertiary:   var(--stone);
  --text-inverse:    var(--white);
  --text-gold-dark:  var(--gold-400);   /* gold text on dark/navy surfaces     */
  --text-gold-light: var(--gold-700);   /* gold text on white/mist surfaces    */
  --text-link:       var(--gold-700);
  --text-link-hover: var(--gold-600);

  /* Interactive */
  --interactive-primary:        var(--navy-700);
  --interactive-primary-hover:  var(--navy-600);
  --interactive-gold:           var(--gold-400);
  --interactive-gold-hover:     var(--gold-500);
  --interactive-focus-ring:     var(--gold-400);

  /* Borders */
  --border-default: #DDE3EF;
  --border-strong:  #B8C4DA;
  --border-gold:    var(--gold-400);   /* gold rule — dark surfaces only       */
  --border-inverse: rgba(255, 255, 255, 0.15);


  /* ─── TYPOGRAPHY: FAMILIES ───────────────────────────────────────────────── */
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;


  /* ─── TYPOGRAPHY: SCALE ──────────────────────────────────────────────────── */
  --text-xs:   0.75rem;    /* 12px — captions, legal, timestamps              */
  --text-sm:   0.875rem;   /* 14px — labels, nav items, metadata              */
  --text-base: 1rem;       /* 16px — body copy default                        */
  --text-lg:   1.125rem;   /* 18px — lead paragraphs, featured body           */
  --text-xl:   1.25rem;    /* 20px — large labels, card subheads              */
  --text-2xl:  1.5rem;     /* 24px — H4, section subheads                     */
  --text-3xl:  1.875rem;   /* 30px — H3                                       */
  --text-4xl:  2.25rem;    /* 36px — H2                                       */
  --text-5xl:  3rem;       /* 48px — H1, section heroes (mobile hero)         */
  --text-6xl:  3.75rem;    /* 60px — large feature heads                      */
  --text-7xl:  4.5rem;     /* 72px — homepage hero headline (desktop only)    */


  /* ─── TYPOGRAPHY: WEIGHTS ────────────────────────────────────────────────── */
  --weight-light:    300;
  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;
  --weight-extrabold: 800;
  --weight-black:    900;


  /* ─── TYPOGRAPHY: LINE HEIGHT ────────────────────────────────────────────── */
  --leading-none:    1.0;
  --leading-tight:   1.1;
  --leading-snug:    1.25;
  --leading-normal:  1.6;
  --leading-relaxed: 1.75;


  /* ─── TYPOGRAPHY: LETTER SPACING ─────────────────────────────────────────── */
  --tracking-tighter: -0.03em;   /* hero headline display type                */
  --tracking-tight:   -0.02em;   /* section headings                          */
  --tracking-snug:    -0.01em;   /* large body lead                           */
  --tracking-normal:   0em;
  --tracking-wide:     0.06em;   /* small labels, Inter body                  */
  --tracking-wider:    0.10em;   /* eyebrow/overline labels (uppercase)       */
  --tracking-widest:   0.14em;   /* very small uppercase utility text         */


  /* ─── SPACING: 8-POINT GRID ──────────────────────────────────────────────── */
  --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 */
  --space-32: 8rem;       /* 128px */


  /* ─── LAYOUT ─────────────────────────────────────────────────────────────── */
  --content-max-width: 1200px;
  --text-max-width:     680px;   /* reading column — never wider for body text */
  --section-pad-y:     var(--space-24);   /* default section vertical padding  */
  --section-pad-x:     var(--space-6);    /* mobile gutter                     */
  --card-gap:          var(--space-6);


  /* ─── SHADOWS ────────────────────────────────────────────────────────────── */
  /* All shadow hue derived from navy for brand coherence                       */
  --shadow-xs: 0 1px 2px rgba(0, 20, 51, 0.06);
  --shadow-sm: 0 2px 6px rgba(0, 20, 51, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 20, 51, 0.10);
  --shadow-lg: 0 8px 32px rgba(0, 20, 51, 0.13);
  --shadow-xl: 0 16px 56px rgba(0, 20, 51, 0.18);

  /* Gold focus ring — used on all interactive elements for keyboard nav        */
  --shadow-gold-focus: 0 0 0 3px rgba(255, 205, 0, 0.45);
  /* Gold glow — CTA button hover on dark backgrounds                           */
  --shadow-gold-glow:  0 4px 24px rgba(255, 205, 0, 0.22);


  /* ─── BORDER RADIUS ──────────────────────────────────────────────────────── */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-2xl:  24px;
  --radius-full: 9999px;   /* pill buttons, tags                               */


  /* ─── GRADIENTS ──────────────────────────────────────────────────────────── */
  /* Hero: rich directional navy depth                                           */
  --gradient-hero: linear-gradient(
    155deg,
    var(--navy-950) 0%,
    var(--navy-900) 50%,
    var(--navy-800) 100%
  );

  /* Gold shimmer: animated sweep across hero on load — dark surfaces only      */
  --gradient-gold-shimmer: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 205, 0, 0.07) 45%,
    rgba(255, 205, 0, 0.12) 50%,
    rgba(255, 205, 0, 0.07) 55%,
    transparent 100%
  );

  /* Subtle card surface on light backgrounds                                   */
  --gradient-surface: linear-gradient(
    135deg,
    var(--white) 0%,
    var(--mist) 100%
  );

  /* Section fade: hero into first light section                                */
  --gradient-hero-fade: linear-gradient(
    180deg,
    var(--navy-900) 0%,
    var(--cloud) 100%
  );


  /* ─── MOTION ─────────────────────────────────────────────────────────────── */
  --ease-out:    cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-in-out: cubic-bezier(0.45, 0.00, 0.55, 1.00);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1.00);   /* slight overshoot  */

  --duration-instant: 80ms;
  --duration-fast:    150ms;
  --duration-base:    250ms;
  --duration-slow:    400ms;
  --duration-slower:  600ms;


  /* ─── Z-INDEX ─────────────────────────────────────────────────────────────── */
  --z-below:    -1;
  --z-base:      0;
  --z-raised:    10;
  --z-dropdown:  100;
  --z-sticky:    200;
  --z-overlay:   300;
  --z-modal:     400;
  --z-toast:     500;

} /* end :root */


/* ─── REDUCED MOTION ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--text-secondary);
  background-color: var(--bg-default);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--text-link);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--duration-fast) var(--ease-out);
}
a:hover {
  color: var(--text-link-hover);
}

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


/* ─── TYPOGRAPHY CLASSES ─────────────────────────────────────────────────── */

/* Eyebrow / overline label */
.eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--text-gold-light);   /* override to --text-gold-dark on dark bg  */
}

/* Display headline (hero) */
.display {
  font-family: var(--font-display);
  font-size: clamp(var(--text-5xl), 7vw, var(--text-7xl));
  font-weight: var(--weight-extrabold);
  font-variation-settings: 'opsz' 144;
  letter-spacing: var(--tracking-tighter);
  line-height: var(--leading-tight);
  color: var(--text-inverse);
}

/* Section headline */
.headline {
  font-family: var(--font-display);
  font-size: clamp(var(--text-4xl), 4vw, var(--text-5xl));
  font-weight: var(--weight-bold);
  font-variation-settings: 'opsz' 72;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-snug);
  color: var(--text-primary);
}

/* Sub-headline */
.subheadline {
  font-family: var(--font-display);
  font-size: clamp(var(--text-2xl), 3vw, var(--text-3xl));
  font-weight: var(--weight-bold);
  font-variation-settings: 'opsz' 48;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-snug);
  color: var(--text-primary);
}

/* Lead paragraph */
.lead {
  font-family: var(--font-body);
  font-size: clamp(var(--text-lg), 1.5vw, var(--text-xl));
  font-weight: var(--weight-regular);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  max-width: var(--text-max-width);
}

/* Pull quote */
.pullquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(var(--text-xl), 2vw, var(--text-2xl));
  font-weight: var(--weight-light);
  font-variation-settings: 'opsz' 9;
  line-height: var(--leading-normal);
  color: var(--navy-700);
  border-left: 2px solid var(--border-gold);
  padding-left: var(--space-6);
  margin: var(--space-8) 0;
}

/* Price / data display */
.price-display {
  font-family: var(--font-mono);
  font-size: clamp(var(--text-2xl), 3vw, var(--text-4xl));
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-snug);
  color: var(--text-inverse);
}


/* ─── LAYOUT UTILITIES ───────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--content-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--section-pad-x);
  padding-right: var(--section-pad-x);
}

.section {
  padding-top: var(--section-pad-y);
  padding-bottom: var(--section-pad-y);
}

.section--dark {
  background: var(--bg-hero);
  color: var(--text-inverse);
}

.section--light {
  background: var(--bg-surface);
}

.section--subtle {
  background: var(--bg-subtle);
}

.section--warm {
  background: var(--bg-warm);
}

.text-column {
  max-width: var(--text-max-width);
}


/* ─── BUTTON COMPONENTS ──────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  box-shadow: var(--shadow-gold-focus);
}

/* Primary — navy fill */
.btn-primary {
  background: var(--interactive-primary);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--interactive-primary-hover);
  box-shadow: var(--shadow-md);
  color: var(--white);
}

/* CTA Gold — only for hero-level CTAs on dark backgrounds */
.btn-gold {
  background: var(--interactive-gold);
  color: var(--navy-900);
  padding: 16px 32px;
  font-weight: var(--weight-semibold);
}
.btn-gold:hover {
  background: var(--interactive-gold-hover);
  box-shadow: var(--shadow-gold-glow);
  color: var(--navy-900);
}

/* Ghost — on dark surfaces */
.btn-ghost-inverse {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  color: var(--white);
}
.btn-ghost-inverse:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.70);
  color: var(--white);
}

/* Ghost — on light surfaces */
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border-strong);
  color: var(--interactive-primary);
}
.btn-ghost:hover {
  background: var(--navy-50);
  border-color: var(--navy-500);
  color: var(--interactive-primary);
}


/* ─── CARD COMPONENT ──────────────────────────────────────────────────────── */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Card with gradient surface */
.card--gradient {
  background: var(--gradient-surface);
}

/* Featured / sponsor card */
.card--featured {
  border-color: var(--navy-100);
  border-top: 3px solid var(--navy-700);
  box-shadow: var(--shadow-lg);
}


/* ─── DATA / ESTIMATOR PANEL ─────────────────────────────────────────────── */

.data-panel {
  background: var(--bg-data);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-10);
  border-left: 3px solid var(--gold-400);   /* THE signature gold rule element */
}

.data-panel .eyebrow {
  color: var(--text-gold-dark);
}


/* ─── NAVIGATION ─────────────────────────────────────────────────────────── */

.site-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-default);
  transition: box-shadow var(--duration-fast) var(--ease-out);
}

.site-nav.scrolled {
  box-shadow: var(--shadow-sm);
}

/* Nav on hero (before scroll) — transparent, white text */
.site-nav--transparent {
  background: transparent;
  border-bottom: 1px solid var(--border-gold); /* gold rule on dark nav */
  backdrop-filter: none;
}


/* ─── GOLD RULE DECORATION ───────────────────────────────────────────────── */
/* The signature structural element. Used on dark surfaces only.               */

.gold-rule {
  display: block;
  width: 48px;
  height: 2px;
  background: var(--gold-400);
  margin-bottom: var(--space-4);
}

.gold-rule--full {
  width: 100%;
  height: 1px;
}


/* ─── SCROLL REVEAL ANIMATION ────────────────────────────────────────────── */

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

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

/* Stagger utility classes */
.reveal-delay-1 { transition-delay: 80ms; }
.reveal-delay-2 { transition-delay: 160ms; }
.reveal-delay-3 { transition-delay: 240ms; }
.reveal-delay-4 { transition-delay: 320ms; }


/* ─── RESPONSIVE OVERRIDES ───────────────────────────────────────────────── */

@media (max-width: 768px) {
  :root {
    --section-pad-y: var(--space-16);
    --section-pad-x: var(--space-4);
    --card-gap: var(--space-4);
  }

  .data-panel {
    padding: var(--space-6) var(--space-6);
  }

  .btn-gold {
    padding: 14px 24px;
  }
}
