/* ==========================================================================
   Design System — Phantom Electrical
   phantomelectrical.com.au
   Mobile-first. No external dependencies. WCAG 2.1 AA compliant.
   ========================================================================== */

/* ==========================================================================
   1. CSS CUSTOM PROPERTIES
   ========================================================================== */

:root {
  /* ------------------------------------------------------------------
     Colours
     Brand identity: deep navy primary, orange accent (trades industry),
     clean white surfaces. All text/background pairings meet WCAG 2.1 AA
     (4.5:1 minimum for normal text, 3:1 for large text).
     ------------------------------------------------------------------ */

  --color-primary: #1a2744;        /* Deep navy — header, dark sections. On white: ~13.5:1 */
  --color-primary-light: #243459;  /* Lighter navy for hover states */
  --color-secondary: #2c3e6b;      /* Mid navy — secondary text on dark bg */
  --color-accent: #e86c1f;         /* Orange — CTAs, highlights. On white: ~3.5:1 large text / on #1a2744: ~4.7:1 */
  --color-accent-hover: #c85a0e;   /* Orange darkened ~15% for hover. On white: ~5.1:1 */
  --color-accent-dark: #b34d08;    /* Darker orange for active state */
  --color-surface: #ffffff;        /* Primary page background */
  --color-surface-alt: #f5f6f8;    /* Alternate section bg — light grey-blue tint */
  --color-surface-dark: #1a2744;   /* Dark section bg (same as primary) */
  --color-text: #1a1a1a;           /* Body text on white. On #fff: ~18.1:1 */
  --color-text-muted: #5a6070;     /* Secondary text on white. On #fff: ~5.4:1 */
  --color-text-on-dark: #ffffff;   /* Text on dark navy bg. On #1a2744: ~13.5:1 */
  --color-text-on-accent: #ffffff; /* Text on orange bg. On #e86c1f: ~3.5:1 (large/bold only — use for btn text ≥14px bold) */
  --color-border: #dde1e9;         /* Subtle borders */
  --color-border-dark: #3a4a6b;    /* Borders on dark bg */
  --color-focus: #e86c1f;          /* Focus ring — matches accent for brand consistency */
  --color-error: #c0392b;          /* Form error states. On white: ~5.9:1 */
  --color-success: #1e7e34;        /* Form success. On white: ~5.0:1 */

  /* ------------------------------------------------------------------
     Typography
     System font stacks — no external dependencies. Heading uses a
     geometric sans for a modern-trades feel.
     ------------------------------------------------------------------ */

  --font-heading: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --font-body: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;

  --font-size-base: 1rem;       /* 16px */
  --font-size-sm: 0.875rem;     /* 14px */
  --font-size-lg: 1.125rem;     /* 18px */
  --font-size-xl: 1.25rem;      /* 20px */
  --font-size-2xl: 1.5rem;      /* 24px */
  --font-size-3xl: 2rem;        /* 32px */
  --font-size-4xl: 2.5rem;      /* 40px */
  --font-size-5xl: 3rem;        /* 48px */

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --line-height-base: 1.6;
  --line-height-heading: 1.2;
  --line-height-tight: 1.1;

  --letter-spacing-heading: -0.02em;
  --letter-spacing-caps: 0.08em;

  /* ------------------------------------------------------------------
     Spacing — 4px base unit scale
     ------------------------------------------------------------------ */

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

  --container-max: 1200px;
  --container-padding: var(--space-4);
  --container-padding-md: var(--space-6);

  /* ------------------------------------------------------------------
     Borders & Radius
     ------------------------------------------------------------------ */

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* ------------------------------------------------------------------
     Shadows
     ------------------------------------------------------------------ */

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15), 0 4px 8px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 2px 8px rgba(26, 39, 68, 0.10);
  --shadow-card-hover: 0 6px 20px rgba(26, 39, 68, 0.18);

  /* ------------------------------------------------------------------
     Transitions
     ------------------------------------------------------------------ */

  --transition-base: 200ms ease;
  --transition-slow: 350ms ease;

  /* ------------------------------------------------------------------
     Z-index scale
     ------------------------------------------------------------------ */

  --z-below: -1;
  --z-base: 0;
  --z-raised: 10;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
}


/* ==========================================================================
   2. CSS RESET & BASE
   ========================================================================== */

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

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

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

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

a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--transition-base);
}

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

a:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

ul,
ol {
  list-style: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

table {
  border-collapse: collapse;
}

hr {
  border: none;
  border-top: 1px solid var(--color-border);
}


/* ==========================================================================
   3. LAYOUT UTILITIES
   ========================================================================== */

.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

/* Skip link for screen readers / keyboard users */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: var(--z-modal);
  padding: var(--space-3) var(--space-6);
  background-color: var(--color-primary);
  color: var(--color-text-on-dark);
  font-weight: var(--font-weight-bold);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: top var(--transition-base);
}

.skip-link:focus {
  top: var(--space-4);
}

/* Visually hidden (screen reader only) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Section padding */
.section-pad {
  padding-block: var(--space-16);
}

.section-pad-sm {
  padding-block: var(--space-8);
}

.section-pad-lg {
  padding-block: var(--space-24);
}

/* Flex utilities */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-start {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Grid utilities — mobile-first (1 col base) */
.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

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

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .container {
    padding-inline: var(--container-padding-md);
  }
}

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

  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Section colour variants */
.bg-primary {
  background-color: var(--color-primary);
  color: var(--color-text-on-dark);
}

.bg-surface-alt {
  background-color: var(--color-surface-alt);
}

.bg-accent {
  background-color: var(--color-accent);
  color: var(--color-text-on-dark);
}

/* Text alignment */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }


/* ==========================================================================
   4. TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-heading);
  letter-spacing: var(--letter-spacing-heading);
  color: var(--color-primary);
}

/* On dark backgrounds, headings should be white */
.bg-primary h1,
.bg-primary h2,
.bg-primary h3,
.bg-primary h4,
.bg-accent  h1,
.bg-accent  h2,
.bg-accent  h3 {
  color: var(--color-text-on-dark);
}

h1 {
  font-size: var(--font-size-3xl);
  line-height: var(--line-height-tight);
}

h2 {
  font-size: var(--font-size-2xl);
}

h3 {
  font-size: var(--font-size-xl);
}

h4 {
  font-size: var(--font-size-lg);
}

h5, h6 {
  font-size: var(--font-size-base);
}

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

  h2 {
    font-size: var(--font-size-3xl);
  }

  h3 {
    font-size: var(--font-size-2xl);
  }

  h4 {
    font-size: var(--font-size-xl);
  }
}

@media (min-width: 1200px) {
  h1 {
    font-size: var(--font-size-5xl);
  }
}

p {
  max-width: 70ch;
  margin-block-end: var(--space-4);
}

p:last-child {
  margin-block-end: 0;
}

/* Lead text — larger intro paragraph */
.lead {
  font-size: var(--font-size-lg);
  line-height: 1.7;
  color: var(--color-text);
  max-width: 65ch;
}

@media (min-width: 768px) {
  .lead {
    font-size: var(--font-size-xl);
  }
}

/* Small / caption text */
.text-sm {
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

.text-muted {
  color: var(--color-text-muted);
}

/* Section label — small caps above heading */
.section-label {
  display: inline-block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-block-end: var(--space-2);
}

/* Section heading with bottom rule */
.section-heading {
  margin-block-end: var(--space-8);
}

.section-heading h2 {
  margin-block-end: var(--space-3);
}

.section-heading p {
  color: var(--color-text-muted);
}

/* Strong / bold */
strong, b {
  font-weight: var(--font-weight-bold);
}

/* Inline tel links */
a[href^="tel"] {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

a[href^="tel"]:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

/* Block quote */
blockquote {
  border-left: 4px solid var(--color-accent);
  padding-left: var(--space-6);
  margin-block: var(--space-6);
  font-size: var(--font-size-lg);
  font-style: italic;
  color: var(--color-text-muted);
}


/* ==========================================================================
   5. BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding-block: var(--space-3);
  padding-inline: var(--space-6);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  text-decoration: none;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background-color var(--transition-base),
              border-color var(--transition-base),
              color var(--transition-base),
              box-shadow var(--transition-base),
              transform var(--transition-base);
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}

.btn:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

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

/* Primary — orange, white text */
.btn-primary {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-text-on-dark); /* white on orange — used at bold/large size */
}

.btn-primary:hover {
  background-color: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: var(--color-text-on-dark);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  background-color: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
}

/* Secondary — outlined navy */
.btn-secondary {
  background-color: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-secondary:hover {
  background-color: var(--color-primary);
  color: var(--color-text-on-dark);
}

/* Ghost — for use on dark backgrounds */
.btn-ghost {
  background-color: transparent;
  border-color: var(--color-text-on-dark);
  color: var(--color-text-on-dark);
}

.btn-ghost:hover {
  background-color: rgba(255, 255, 255, 0.15);
  color: var(--color-text-on-dark);
}

/* Light — white button (on orange CTA bands) */
.btn-light {
  background-color: var(--color-surface);
  border-color: var(--color-surface);
  color: var(--color-primary);
}

.btn-light:hover {
  background-color: var(--color-surface-alt);
  border-color: var(--color-surface-alt);
  color: var(--color-primary);
}

/* Large — for hero CTAs */
.btn-lg {
  min-height: 54px;
  padding-block: var(--space-4);
  padding-inline: var(--space-8);
  font-size: var(--font-size-lg);
  border-radius: var(--radius-md);
}

/* Small */
.btn-sm {
  min-height: 36px;
  padding-block: var(--space-2);
  padding-inline: var(--space-4);
  font-size: var(--font-size-sm);
}

/* Full-width block button */
.btn-block {
  width: 100%;
}

/* Group of buttons side by side */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}


/* ==========================================================================
   6. FORMS
   ========================================================================== */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-block-end: var(--space-5);
}

.form-group:last-of-type {
  margin-block-end: 0;
}

label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

label .required-marker {
  color: var(--color-error);
  margin-inline-start: var(--space-1);
  aria-hidden: true;
}

.form-input,
.form-textarea,
.form-select {
  display: block;
  width: 100%;
  min-height: 44px;
  padding-block: var(--space-3);
  padding-inline: var(--space-4);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-base),
              box-shadow var(--transition-base);
  appearance: none;
  -webkit-appearance: none;
}

.form-input:hover,
.form-textarea:hover,
.form-select:hover {
  border-color: var(--color-secondary);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(232, 108, 31, 0.20);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235a6070' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-inline-end: var(--space-10);
}

/* Error state */
.form-input.is-error,
.form-textarea.is-error {
  border-color: var(--color-error);
}

.form-error-msg {
  font-size: var(--font-size-sm);
  color: var(--color-error);
}

/* File upload */
.form-file-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-surface-alt);
  cursor: pointer;
  transition: border-color var(--transition-base), background-color var(--transition-base);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.form-file-label:hover {
  border-color: var(--color-accent);
  background-color: var(--color-surface);
}

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Form hint text */
.form-hint {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* reCAPTCHA note */
.recaptcha-note {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-block-start: var(--space-4);
}

.recaptcha-note a {
  color: var(--color-text-muted);
}


/* ==========================================================================
   7. CARDS
   ========================================================================== */

.card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

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

.card-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.card-body {
  padding: var(--space-6);
}

.card-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  margin-block-end: var(--space-3);
}

.card-text {
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
  margin-block-end: var(--space-4);
}


/* ==========================================================================
   8. BREAKPOINTS / RESPONSIVE OVERRIDES
   ========================================================================== */

/* Tablet — 768px and up */
@media (min-width: 768px) {
  :root {
    --container-padding: var(--space-6);
  }

  .section-pad {
    padding-block: var(--space-20);
  }

  .section-pad-sm {
    padding-block: var(--space-12);
  }

  /* Show/hide helpers */
  .hide-md {
    display: none;
  }
}

/* Desktop — 1200px and up */
@media (min-width: 1200px) {
  :root {
    --container-padding: var(--space-8);
  }

  .section-pad {
    padding-block: var(--space-24);
  }

  /* Show/hide helpers */
  .hide-lg {
    display: none;
  }

  .show-lg {
    display: block;
  }
}
