/*
Theme Name:   MG Electrical
Theme URI:    https://www.mgelectrics.net
Author:       Pixversion
Author URI:   https://www.pixversion.com
Description:  Custom responsive theme for MG Electrical Services (Bolton) Ltd. Mobile-first, no page builder, no jQuery.
Version:      1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License:      Proprietary
Text Domain:  mg-electrical
*/

/* ==========================================================================
   1. Colour tokens
   ========================================================================== */

:root {
  --color-bg:        #1e1e1e;
  --color-surface:   #2a2a2a;
  --color-raised:    #333333;
  --color-red:       #cc0000;
  --color-red-hover: #e60000;
  --color-white:     #ffffff;
  --color-muted:     #bbbbbb;
  --color-border:    #444444;

  --font-stack: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --container: 1140px;
  --radius: 6px;
}

/* ==========================================================================
   2. Reset / base
   ========================================================================== */

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

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

body {
  background: var(--color-bg) url("img/bg-pattern.jpg") repeat;
  color: var(--color-white);
  font-family: var(--font-stack);
  font-size: 1rem;
  line-height: 1.65;
}

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

a {
  color: var(--color-white);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: var(--color-red-hover);
}

h1, h2, h3, h4 {
  line-height: 1.25;
  font-weight: 700;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

p {
  margin-bottom: 1rem;
}

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

ul {
  list-style-position: inside;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-red);
  color: var(--color-white);
  padding: 0.5rem 1rem;
  z-index: 999;
}

.skip-link:focus {
  left: 0;
}

/* ==========================================================================
   3. Layout helpers
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.section {
  padding: 2.5rem 0;
}

.section-title {
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-red);
  display: inline-block;
}

/* ==========================================================================
   4. Buttons
   ========================================================================== */

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  text-align: center;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  background: var(--color-red);
  color: var(--color-white);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--color-red-hover);
  color: var(--color-white);
}

.btn-outline {
  background: transparent;
  border-color: var(--color-white);
  color: var(--color-white);
}

.btn-outline:hover,
.btn-outline:focus {
  border-color: var(--color-red-hover);
  color: var(--color-red-hover);
}

/* ==========================================================================
   5. Header — top bar, logo, navigation (mobile-first)
   ========================================================================== */

.top-bar {
  display: none; /* desktop only — see 1024px breakpoint */
  background: var(--color-raised);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}

.top-bar .container {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.top-bar a {
  color: var(--color-red);
  font-weight: 700;
}

.top-bar a:hover {
  color: var(--color-red-hover);
}

.site-header {
  background: var(--color-raised);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background 0.25s ease;
}

.site-header.is-scrolled {
  background: rgba(30, 30, 30, 0.92);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.site-logo img,
.site-logo .custom-logo {
  max-height: 60px;
  width: auto;
}

.nav-toggle {
  background: none;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-white);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
}

.nav-toggle:hover,
.nav-toggle:focus {
  border-color: var(--color-red);
}

.site-nav {
  flex-basis: 100%;
  display: none;
}

.site-nav.is-open {
  display: block;
}

.site-nav ul {
  list-style: none;
  margin-top: 0.75rem;
}

.site-nav li {
  border-top: 1px solid var(--color-border);
}

.site-nav a {
  display: block;
  padding: 0.75rem 0.25rem;
  font-weight: 600;
}

.site-nav .current-menu-item > a,
.site-nav .current_page_item > a {
  color: var(--color-red);
}

/* ==========================================================================
   6. Hero (front page)
   ========================================================================== */

.hero {
  position: relative;
  background:
    linear-gradient(rgba(20, 20, 20, 0.72), rgba(20, 20, 20, 0.72)),
    var(--color-surface) url("img/hero-banner.jpg") center / cover no-repeat;
  text-align: center;
  padding: 4rem 0;
}

.hero h1 {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.hero .hero-sub {
  color: var(--color-muted);
  font-size: 1.1rem;
  margin-bottom: 1.75rem;
}

.hero-cta {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

/* ==========================================================================
   7. Cards & grids
   ========================================================================== */

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.card h3 {
  margin-bottom: 0.75rem;
}

.card .card-icon {
  width: 42px;
  height: 42px;
  margin-bottom: 1rem;
  color: var(--color-red);
}

.card ul {
  list-style: none;
}

.card li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-border);
}

.card li:last-child {
  border-bottom: none;
}

.card li::before {
  content: "\203A";
  color: var(--color-red);
  font-weight: 700;
  margin-right: 0.5rem;
}

/* Plain two-column services list (Domestic) */
.services-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.25rem 2rem;
}

.services-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-border);
}

.services-list li::before {
  content: "\203A";
  color: var(--color-red);
  font-weight: 700;
  margin-right: 0.5rem;
}

/* Accreditation badges (About) */
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

.badge {
  background: var(--color-raised);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-red);
  border-radius: var(--radius);
  padding: 0.9rem 1.4rem;
  font-weight: 700;
}

/* Big stat cards (Testing certificate validity) */
.stat-card {
  text-align: center;
}

.stat-card .stat-value {
  display: block;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--color-red);
  margin-bottom: 0.25rem;
}

/* ==========================================================================
   8. CTA strip
   ========================================================================== */

.cta-strip {
  background: var(--color-red);
  text-align: center;
  padding: 2rem 0;
}

.cta-strip p {
  font-size: 1.15rem;
  font-weight: 600;
}

.cta-strip a {
  text-decoration: underline;
}

.cta-strip a:hover {
  color: var(--color-white);
  opacity: 0.85;
}

/* ==========================================================================
   9. Contact page
   ========================================================================== */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.contact-details p {
  margin-bottom: 0.75rem;
}

.contact-details a {
  color: var(--color-red);
  font-weight: 600;
}

.contact-details a:hover {
  color: var(--color-red-hover);
}

.map-placeholder {
  margin-top: 1.5rem;
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 3rem 1rem;
  text-align: center;
  color: var(--color-muted);
}

.map-embed iframe {
  width: 100%;
  min-height: 300px;
  border: 0;
  border-radius: var(--radius);
}

/* WPForms dark-theme adjustments */
.wpforms-container input[type="text"],
.wpforms-container input[type="tel"],
.wpforms-container input[type="email"],
.wpforms-container textarea {
  background: var(--color-surface) !important;
  border: 1px solid var(--color-border) !important;
  color: var(--color-white) !important;
  border-radius: var(--radius) !important;
}

.wpforms-container button[type="submit"] {
  background: var(--color-red) !important;
  border: none !important;
  color: var(--color-white) !important;
  border-radius: var(--radius) !important;
  padding: 0.75rem 1.5rem !important;
  font-weight: 600 !important;
}

.wpforms-container button[type="submit"]:hover {
  background: var(--color-red-hover) !important;
}

/* ==========================================================================
   10. Generic page content
   ========================================================================== */

.page-title {
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-red);
  display: inline-block;
}

.entry-content h2 {
  margin: 1.5rem 0 0.75rem;
}

.entry-content ul,
.entry-content ol {
  margin: 0 0 1rem 1.25rem;
  list-style-position: outside;
}

/* ==========================================================================
   11. Footer
   ========================================================================== */

.site-footer {
  background: var(--color-raised);
  border-top: 1px solid var(--color-border);
  margin-top: 2.5rem;
  color: var(--color-muted);
  font-size: 0.95rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  padding: 2.5rem 0 1.5rem;
}

.footer-col h4 {
  color: var(--color-white);
  margin-bottom: 0.75rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  padding: 0.25rem 0;
}

.footer-col a {
  color: var(--color-muted);
}

.footer-col a:hover {
  color: var(--color-red-hover);
}

.footer-badge {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-red);
  border-radius: var(--radius);
  padding: 0.9rem 1.2rem;
  font-weight: 700;
  color: var(--color-white);
  display: inline-block;
}

.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding: 1.25rem 0;
  text-align: center;
  font-size: 0.85rem;
}

/* ==========================================================================
   12. Breakpoints — 768px tablet, 1024px desktop
   ========================================================================== */

@media (min-width: 768px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 1.75rem; }

  .hero {
    padding: 6rem 0;
  }

  .hero h1 {
    font-size: 2.75rem;
  }

  .hero-cta {
    flex-direction: row;
    justify-content: center;
  }

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

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

  .contact-grid {
    grid-template-columns: 1.2fr 1fr;
  }

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

@media (min-width: 1024px) {
  .top-bar {
    display: block;
  }

  .nav-toggle {
    display: none;
  }

  .site-nav {
    display: block;
    flex-basis: auto;
  }

  .site-nav ul {
    display: flex;
    gap: 0.25rem;
    margin-top: 0;
  }

  .site-nav li {
    border-top: none;
  }

  .site-nav a {
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius);
  }

  .site-nav a:hover {
    background: var(--color-surface);
    color: var(--color-white);
  }

  .site-nav .current-menu-item > a,
  .site-nav .current_page_item > a {
    background: var(--color-red);
    color: var(--color-white);
  }

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

  .hero {
    padding: 7.5rem 0;
  }
}
