/**
 * =============================================================================
 * TRIM-LINE OF BURLOAK – GLOBAL STYLES
 * =============================================================================
 *
 * Naming convention: BEM  (Block__Element--Modifier)
 *   .card            → block
 *   .card__title     → element inside the block
 *   .btn--primary    → modifier (variation) of a block
 *
 * State classes (added/removed by JavaScript) start with "is-":
 *   .is-active, .is-visible, .is-ok, .is-err
 *
 * TABLE OF CONTENTS
 *   1.  Design tokens (CSS custom properties)
 *   2.  Reset & base elements
 *   3.  Typography
 *   4.  Layout helpers (container, section, grid, split)
 *   5.  Utilities
 *   6.  Buttons
 *   7.  Top bar
 *   8.  Site header & logo
 *   9.  Navigation (desktop + mobile)
 *   10. Hero
 *   11. Cards
 *   12. Prose & chips
 *   13. Gallery
 *   14. Lightbox
 *   15. Forms
 *   16. Contact card
 *   17. Footer
 *   18. Animations (reveal on scroll, keyframes)
 *   19. Reduced motion
 *
 * @file src/styles/global.css
 */


/* =============================================================================
   1. DESIGN TOKENS
   Change colours, fonts and spacing here – they update everywhere.
   ========================================================================== */

:root {
  /* ---- Backgrounds (darkest → lightest) ---- */
  --bg: #0e0f12;          /* page background */
  --bg-2: #16181d;        /* alternate section background */
  --bg-3: #1f2229;        /* cards, panels, dropdowns */
  --bg-footer: #08090b;   /* footer background */

  /* ---- Lines & text ---- */
  --line: #2b2f38;        /* borders and dividers */
  --text: #e9ebef;        /* main text */
  --text-soft: #cfd3da;   /* long-form paragraph text */
  --muted: #a3a9b5;       /* secondary text, labels */

  /* ---- Brand colours (sampled from the logo, public/images/logo.webp) ---- */
  --accent: #f0050f;          /* logo red – buttons, top bar, highlights */
  --accent-hover: #ff2a33;    /* slightly lighter red for hover states */
  --accent-2: #f8c200;        /* logo yellow – links, statistics */
  --accent-ink: #ffffff;      /* text placed on top of --accent */
  --accent-soft: rgba(240, 5, 15, 0.14);   /* tinted backgrounds */
  --accent-ring: rgba(240, 5, 15, 0.25);   /* focus ring */

  /* ---- Feedback colours ---- */
  --success-bg: rgba(46, 204, 113, 0.12);
  --success-text: #6ee7a1;
  --error-bg: rgba(240, 5, 15, 0.14);
  --error-text: #ff8a8f;

  /* ---- Shape & depth ---- */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.6);

  /* ---- Layout ---- */
  --max-width: 1180px;
  --gutter: 20px;
  --header-height: 76px;

  /* ---- Fonts ---- */
  --font-head: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* ---- Motion ---- */
  --ease: ease;
  --speed-fast: 0.2s;
  --speed: 0.3s;
}


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

/* Include padding and border in every element's width/height. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Make sure the HTML `hidden` attribute always wins over display rules. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  /* Stop in-page links from hiding headings under the sticky header. */
  scroll-padding-top: calc(var(--header-height) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* Images never overflow their container. */
img {
  display: block;
  max-width: 100%;
}

figure {
  margin: 0;
}

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

a:hover {
  text-decoration: underline;
}

/* Visible keyboard focus everywhere. */
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}


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

h1,
h2,
h3,
h4 {
  margin: 0 0 0.5em;
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

/* clamp(min, preferred, max) scales headings smoothly with screen width. */
h1 { font-size: clamp(2.6rem, 6vw, 4.8rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: 1.5rem; }

p {
  margin: 0 0 1.1em;
}

/* Small uppercase label above section headings. */
.eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--accent);
  font-family: var(--font-head);
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* Larger introductory paragraph. */
.lead {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.2rem;
}


/* =============================================================================
   4. LAYOUT HELPERS
   ========================================================================== */

/* ---- Container: centres content and limits line length ---- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---- Section: vertical spacing between page blocks ---- */
.section {
  padding: clamp(56px, 9vw, 110px) 0;
}

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

/* Space between a section's heading and its content. */
.section__body {
  margin-top: 36px;
}

/* ---- Grid: responsive columns that wrap automatically ---- */
.grid {
  display: grid;
  gap: 22px;
}

.grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}

/*
 * Centered card row: up to 3 equal-width cards per row, and any cards on an
 * unfinished last row are centered instead of sitting on the left.
 * Uses flexbox because CSS grid cannot center a partial last row.
 */
.card-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px;
}

/* (100% − two gaps) ÷ 3 = exactly three cards per row on wide screens. */
.card-row > * {
  flex: 0 1 calc((100% - 2 * 22px) / 3);
  min-width: 290px;
}

/* Below ~950px three cards no longer fit: switch to two per row… */
@media (max-width: 950px) {
  .card-row > * {
    flex-basis: calc((100% - 22px) / 2);
  }
}

/* …and one full-width card per row on phones. */
@media (max-width: 640px) {
  .card-row > * {
    flex-basis: 100%;
    min-width: 0;
  }
}

/* ---- Split: two columns (text + media) that stack on mobile ---- */
.split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(30px, 6vw, 70px);
  align-items: center;
}

/* Align both columns to the top instead of the middle. */
.split--top {
  align-items: start;
}

.split__cta {
  margin-top: 10px;
}

.split__media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  .split {
    grid-template-columns: 1fr;
  }
}


/* =============================================================================
   5. UTILITIES
   ========================================================================== */

/* Accent-coloured inline text. */
.text-accent {
  color: var(--accent);
}

/* Hide visually but keep available to screen readers. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Prevent the page scrolling behind an open overlay (lightbox). */
.no-scroll {
  overflow: hidden;
}

/* "Skip to content" link – off-screen until focused with the keyboard. */
.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  top: 12px;
  left: 12px;
  z-index: 999;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
}


/* =============================================================================
   6. BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform var(--speed-fast) var(--ease),
    background var(--speed-fast) var(--ease),
    border-color var(--speed-fast) var(--ease),
    color var(--speed-fast) var(--ease);
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

/* Solid brand-coloured button – main call to action. */
.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn--primary:hover {
  background: var(--accent-hover);
}

/* Outline button – secondary action. */
.btn--ghost {
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--text);
}

.btn--ghost:hover {
  border-color: var(--text);
}


/* =============================================================================
   7. TOP BAR
   Thin brand-coloured strip above the header.
   ========================================================================== */

.topbar {
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.9rem;
}

.topbar__inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.topbar__phone {
  color: var(--accent-ink);
  font-weight: 600;
}

/* Hide the tagline on very small screens so the phone number fits. */
@media (max-width: 480px) {
  .topbar__tagline {
    display: none;
  }
}


/* =============================================================================
   8. SITE HEADER & LOGO
   ========================================================================== */

/* Sticks to the top while scrolling, with a frosted-glass background. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(14, 15, 18, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: var(--header-height);
}

/* ---- Logo ---- */
.logo {
  display: inline-flex;
  flex-shrink: 0; /* never squash the logo when the menu is wide */
  align-items: center;
}

/*
 * The image is 480 × 186 px; only the height is set here so the width
 * follows automatically and the logo never looks stretched.
 */
.logo__img {
  width: auto;
  height: 56px;
}

/* Slightly smaller on phones so it fits beside the menu button. */
@media (max-width: 480px) {
  .logo__img {
    height: 46px;
  }
}

/* Larger version in the footer. */
.site-footer .logo__img {
  height: 72px;
}


/* =============================================================================
   9. NAVIGATION
   Desktop: horizontal menu with hover dropdowns.
   Mobile (≤ 1100px): off-canvas panel opened by the hamburger button.
   ========================================================================== */

.nav__list,
.nav__sub {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav__link {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Hover and "you are here" states. */
.nav__link:hover,
.nav__link[aria-current='page'] {
  color: var(--accent);
  text-decoration: none;
}

/* ---- Dropdown ---- */
.nav__item--has-sub {
  position: relative;
}

.nav__sub {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-3);
  box-shadow: var(--shadow);

  /* Hidden until the parent is hovered or focused. */
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition:
    opacity var(--speed-fast) var(--ease),
    transform var(--speed-fast) var(--ease),
    visibility var(--speed-fast);
}

/* :focus-within keeps the dropdown open for keyboard users. */
.nav__item--has-sub:hover .nav__sub,
.nav__item--has-sub:focus-within .nav__sub {
  opacity: 1;
  visibility: visible;
  transform: none;
}

/* ---- Hamburger button (three lines → "X" when open) ---- */
.nav-toggle {
  display: none; /* shown only on small screens, see media query below */
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  cursor: pointer;
}

/* The middle bar is the span; the top and bottom bars are ::before/::after. */
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  position: relative;
  display: block;
  width: 20px;
  height: 2px;
  margin: 0 auto;
  background: currentColor;
  transition: var(--speed) var(--ease);
}

.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: '';
  position: absolute;
  left: 0;
}

.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after  { top: 6px; }

/* Open state: hide the middle bar, rotate the others into an "X". */
.nav-open .nav-toggle__bars {
  background: transparent;
}

.nav-open .nav-toggle__bars::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-open .nav-toggle__bars::after {
  top: 0;
  transform: rotate(-45deg);
}

/* ---- Mobile layout ---- */
@media (max-width: 1100px) {
  .nav-toggle {
    display: block;
  }

  /* Full-screen panel that slides in from the right. */
  .nav {
    position: fixed;
    inset: var(--header-height) 0 0 0;
    padding: var(--gutter);
    overflow-y: auto;
    background: var(--bg);
    transform: translateX(100%);
    transition: transform var(--speed) var(--ease);
  }

  .nav-open .nav {
    transform: none;
  }

  /* Stop the page behind the open menu from scrolling. */
  .nav-open {
    overflow: hidden;
  }

  .nav__list {
    flex-direction: column;
    align-items: stretch;
  }

  .nav__link {
    padding: 12px 8px;
    border-bottom: 1px solid var(--line);
    font-size: 1.4rem;
  }

  /* Sub-menus are always visible and indented on mobile. */
  .nav__sub {
    position: static;
    padding: 0 0 0 16px;
    border: 0;
    background: none;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .nav__link--sub {
    color: var(--muted);
    font-size: 1.15rem;
  }
}


/* =============================================================================
   10. HERO
   ========================================================================== */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: min(88vh, 760px);
  overflow: hidden;
}

/* ---- Background slideshow ---- */
.hero__bg {
  position: absolute;
  inset: 0;
}

/* All slides are stacked; only the .is-active one is visible. */
.hero__slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 1.2s var(--ease);
}

.hero__slide.is-active {
  opacity: 1;
  animation: kenburns 7s ease-out forwards;
}

/* Dark gradient over the photos so the white text stays readable. */
.hero__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(14, 15, 18, 0.95) 0%,
    rgba(14, 15, 18, 0.75) 45%,
    rgba(14, 15, 18, 0.3) 100%
  );
}

/* ---- Foreground text ---- */
.hero__content {
  position: relative;
  z-index: 1;
  padding-top: 60px;
  padding-bottom: 60px;
}

.hero__title-accent {
  color: var(--accent);
}

.hero__lead {
  color: var(--text-soft);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}

/* ---- Statistics row ---- */
.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 36px;
  margin: 48px 0 0;
}

.hero__stat-value {
  color: var(--accent-2);
  font-family: var(--font-head);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
}

.hero__stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}


/* =============================================================================
   11. CARDS
   ========================================================================== */

.card {
  display: flex;
  flex-direction: column;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-3);
  transition:
    transform 0.25s var(--ease),
    border-color 0.25s var(--ease);
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}

.card__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* flex: 1 pushes the "Learn more" link to the bottom of every card. */
.card__text {
  flex: 1;
  color: var(--muted);
}

.card__link {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}


/* =============================================================================
   12. PROSE & CHIPS
   ========================================================================== */

/* Comfortable reading width for long text. */
.prose {
  max-width: 75ch;
}

.prose p {
  color: var(--text-soft);
}

/* Pill-shaped tags (used for service areas). */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.chips__item {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 0.9rem;
}

/* Service-area map shown under the chips in "Areas We Serve". */
.areas-map {
  margin-top: 36px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* width/height attributes set the shape; this makes it fluid. */
.areas-map__img {
  width: 100%;
  height: auto;
}


/* =============================================================================
   13. GALLERY
   ========================================================================== */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.gallery__item {
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  cursor: zoom-in;
}

.gallery__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}

.gallery__item:hover .gallery__img,
.gallery__item:focus-visible .gallery__img {
  transform: scale(1.06);
}


/* =============================================================================
   14. LIGHTBOX
   Full-screen image viewer. Shown/hidden with the `hidden` attribute.
   ========================================================================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 16px;
  background: rgba(0, 0, 0, 0.92);
}

.lightbox__img {
  max-width: min(1100px, 100%);
  max-height: 85vh;
  border-radius: var(--radius-sm);
}

/* Shared style for the close / previous / next buttons. */
.lightbox__btn {
  position: absolute;
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
}

.lightbox__btn:hover {
  background: var(--accent);
}

.lightbox__close {
  top: 16px;
  right: 16px;
}

.lightbox__prev,
.lightbox__next {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__prev { left: 16px; }
.lightbox__next { right: 16px; }


/* =============================================================================
   15. FORMS
   ========================================================================== */

.form {
  display: grid;
  gap: 18px;
}

/* Two fields side by side (stacks on small screens). */
.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 640px) {
  .form__row {
    grid-template-columns: 1fr;
  }
}

.form label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.form input,
.form textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

.form input:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

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

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

/* ---- Status message (hidden until it has a state class) ---- */
.form__status {
  display: none;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
}

.form__status.is-ok {
  display: block;
  background: var(--success-bg);
  color: var(--success-text);
}

.form__status.is-err {
  display: block;
  background: var(--error-bg);
  color: var(--error-text);
}

/* ---- Honeypot anti-spam field: moved off-screen, never seen by people ---- */
.form__honeypot {
  position: absolute;
  left: -9999px;
}


/* =============================================================================
   16. CONTACT CARD
   ========================================================================== */

.contact-card {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-3);
}

.contact-card__phone {
  color: var(--text);
  font-family: var(--font-head);
  font-size: 2.2rem;
}

.contact-card__text {
  color: var(--muted);
}


/* =============================================================================
   17. FOOTER
   ========================================================================== */

.site-footer {
  padding: 60px 0 30px;
  border-top: 1px solid var(--line);
  background: var(--bg-footer);
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
}

@media (max-width: 760px) {
  .site-footer__grid {
    grid-template-columns: 1fr;
  }
}

.site-footer__about {
  margin-top: 16px;
}

.site-footer__heading {
  color: var(--text);
  font-size: 1.2rem;
}

.site-footer__links {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer__links li {
  margin-bottom: 6px;
}

.site-footer a:not(.btn):not(.logo) {
  color: var(--muted);
}

.site-footer a:not(.btn):not(.logo):hover {
  color: var(--accent);
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}


/* =============================================================================
   18. ANIMATIONS
   ========================================================================== */

/* ---- Reveal on scroll (class added by modules/scrollReveal.js) ---- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---- Slow zoom-out on the active hero photo ---- */
@keyframes kenburns {
  from { transform: scale(1.06); }
  to   { transform: scale(1); }
}


/* =============================================================================
   19. REDUCED MOTION
   Respect visitors who turned off animations in their system settings.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .hero__slide.is-active {
    animation: none;
  }
}
