/*
Theme Name: MTM Drains Lightweight
Theme URI: https://mtmdrains.co.uk/
Author: MTM Drains
Author URI: https://mtmdrains.co.uk/
Description: Ultra-lean, high-performance, accessible WordPress theme for MTM Haydon Drainage Specialists. Zero builder bloat, zero heavy framework dependencies.
Version: 1.2.0
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.0
License: GNU General Public License v2 or later
Text Domain: mtmdrains
*/

:root {
  --mtm-primary: #12385b;
  --mtm-primary-dark: #0c253d;
  --mtm-primary-light: #1b4b7a;
  --mtm-accent-hover: #f59e0b;
  --mtm-text-dark: #1e293b;
  --mtm-text-muted: #475569;
  --mtm-bg-light: #f8fafc;
  --mtm-bg-white: #ffffff;
  --mtm-border: #e2e8f0;
  --mtm-footer-divider: rgba(255, 255, 255, 0.1);
  --mtm-radius: 5px;
  --mtm-shadow-sm: 0 2px 8px rgba(12, 37, 61, 0.08);
  --mtm-shadow-md: 0 12px 28px -12px rgba(12, 37, 61, 0.2);
  --mtm-shadow-lg: 0 18px 40px -16px rgba(12, 37, 61, 0.24);
  --mtm-container-width: 1240px;
  --mtm-reading-width: 47rem;
}

/* Modern CSS Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--mtm-text-dark);
  background-color: var(--mtm-bg-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Accessibility Focus Ring */
:focus-visible {
  outline: 3px solid var(--mtm-primary-dark);
  outline-offset: 2px;
}
.mtm-footer :focus-visible {
  outline-color: #ffffff;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--mtm-primary);
  color: #fff;
  padding: 0.75rem 1.25rem;
  z-index: 99999;
  font-weight: 700;
  border-radius: var(--mtm-radius);
  transition: top 0.2s ease;
  text-decoration: none;
}
.skip-link:focus {
  top: 1rem;
}

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

a {
  color: var(--mtm-primary-light);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--mtm-primary-dark);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--mtm-primary-dark);
  font-family: inherit;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0;
  margin-bottom: 0.75rem;
}

h1 {
  font-size: 3rem;
}
h2 {
  font-size: 2rem;
  margin-top: 2.5rem;
}
h3 {
  font-size: 1.4rem;
  margin-top: 2rem;
}
p,
ul,
ol,
blockquote {
  margin-bottom: 1.25rem;
}
ul,
ol {
  padding-left: 1.5rem;
}

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

/* Top Call Banner */
.mtm-topbar {
  background-color: var(--mtm-primary-dark);
  color: #fff;
  padding: 0.4rem 0;
  font-size: 0.9rem;
}
.mtm-topbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.mtm-topbar-call {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}
.mtm-topbar-call a {
  color: var(--mtm-accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
}
.mtm-topbar-call a:hover {
  text-decoration: underline;
}

/* Header */
.mtm-header {
  background-color: #fff;
  box-shadow: 0 4px 14px rgba(12, 37, 61, 0.06);
  border-bottom: 1px solid var(--mtm-border);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.mtm-header .container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
.mtm-logo img {
  max-height: 65px;
  width: auto;
}

/* Navigation */
.mtm-nav-menu {
  display: flex;
  list-style: none;
  align-items: center;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
}
.mtm-nav-menu > li {
  position: relative;
}
.mtm-nav-menu a {
  color: var(--mtm-primary-dark);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 0;
  display: inline-block;
}
.mtm-nav-menu a:hover,
.mtm-nav-menu .current-menu-item > a {
  color: var(--mtm-primary-light);
}

/* Dropdown */
.mtm-nav-menu .sub-menu {
  position: absolute;
  top: 100%;
  left: auto;
  right: 0;
  background: #fff;
  box-shadow: var(--mtm-shadow-lg);
  border-radius: var(--mtm-radius);
  border: 1px solid var(--mtm-border);
  list-style: none;
  padding: 0.5rem 0;
  min-width: 220px;
  max-height: min(70vh, calc(100vh - 120px));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s ease;
  z-index: 1000;
}
.mtm-nav-menu .sub-menu::-webkit-scrollbar {
  width: 6px;
}
.mtm-nav-menu .sub-menu::-webkit-scrollbar-track {
  background: transparent;
}
.mtm-nav-menu .sub-menu::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 4px;
}
.mtm-nav-menu .sub-menu::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}
.mtm-nav-menu li:hover > .sub-menu,
.mtm-nav-menu li:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.mtm-nav-menu .sub-menu a {
  padding: 0.5rem 1.25rem;
  display: block;
  font-size: 0.95rem;
  white-space: nowrap;
}
.mtm-nav-menu .sub-menu a:hover {
  background-color: var(--mtm-bg-light);
  color: var(--mtm-primary-light);
}

/* Mobile Toggle */
.mtm-mobile-toggle {
  display: none;
  background: none;
  border: 1px solid var(--mtm-border);
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 0.75rem;
  border-radius: var(--mtm-radius);
  cursor: pointer;
  color: var(--mtm-primary-dark);
  font-weight: 600;
  font-size: 0.95rem;
}

/* Main Content Area */
.mtm-main {
  flex: 1;
  padding: 0 0 5rem;
}

.mtm-page-header {
  max-width: var(--mtm-reading-width);
  margin: 0 auto 2rem;
  border-bottom: 2px solid var(--mtm-border);
  padding-bottom: 1rem;
}

.entry-content {
  font-size: 1.0625rem;
  line-height: 1.75;
}
.entry-content p {
  max-width: var(--mtm-reading-width);
}
.entry-content > h1 {
  max-width: var(--mtm-reading-width);
  margin: 0 auto 1.25rem;
  font-size: 3.25rem;
  line-height: 1.08;
}
.entry-content > h2 {
  max-width: var(--mtm-reading-width);
  margin: 3.5rem auto 1rem;
}
.entry-content > p,
.entry-content > h4,
.entry-content > h5,
.entry-content > h6,
.entry-content > h3,
.entry-content > ul,
.entry-content > ol,
.entry-content > blockquote {
  max-width: var(--mtm-reading-width);
  margin-left: auto;
  margin-right: auto;
}
.entry-content > p:empty,
.entry-content > p:has(> br:only-child) {
  display: none;
}
.mtm-home-content .entry-content > .wp-block-image:first-of-type {
  max-width: 100%;
  margin: 0 auto 3rem;
  overflow: hidden;
  border-radius: 0 0 8px 8px;
}
.wp-block-image img {
  border-radius: var(--mtm-radius);
}
.mtm-home-content .entry-content > .wp-block-image:first-of-type img {
  width: 100%;
  max-height: 500px;
  object-fit: cover;
  object-position: center;
  border-radius: 0 0 8px 8px;
}
.mtm-home-content .entry-content > .wp-block-image:first-of-type > a {
  display: block;
  cursor: pointer;
}
.mtm-home-content .entry-content > .wp-block-image:first-of-type > a img {
  transition: filter 0.2s ease;
}
.mtm-home-content .entry-content > .wp-block-image:first-of-type > a:hover img {
  filter: brightness(0.96);
}
.mtm-coverage-section {
  margin: 5rem 0;
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--mtm-bg-white);
  border: 1px solid var(--mtm-border);
  border-radius: 8px;
}
.mtm-coverage-section h2 {
  margin-top: 0;
}
.mtm-coverage-map {
  max-width: 900px;
  margin: 1.5rem auto 0;
}
.mtm-coverage-map img {
  margin: 0 auto;
  border-radius: 6px;
  box-shadow: var(--mtm-shadow-sm);
}

/* Buttons */
.mtm-btn,
.wp-block-button__link {
  display: inline-block;
  background-color: var(--mtm-accent);
  color: var(--mtm-primary-dark) !important;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--mtm-radius);
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: var(--mtm-shadow-sm);
  transition:
    background-color 0.15s ease,
    transform 0.1s ease;
}
.mtm-btn:hover,
.wp-block-button__link:hover {
  background-color: var(--mtm-accent-hover);
  color: var(--mtm-primary-dark) !important;
  transform: translateY(-1px);
}
.mtm-btn-secondary {
  background-color: var(--mtm-primary);
  color: #fff !important;
}
.mtm-btn-secondary:hover {
  background-color: var(--mtm-primary-dark);
  color: #fff !important;
}
.mtm-btn-large {
  font-size: 1.2rem;
  padding: 0.85rem 2rem;
}

.wp-block-button {
  margin: 1.25rem 0;
  text-align: center;
}

.wp-block-image {
  text-align: center;
  margin: 2rem auto;
}
.wp-block-image img {
  margin-left: auto;
  margin-right: auto;
}
.mtm-image-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: start;
  margin: 2.5rem auto;
}
.mtm-image-grid--resources {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 900px;
}
.mtm-image-grid .wp-block-image {
  min-width: 0;
  width: 100%;
  margin: 0;
}
.mtm-image-grid .wp-block-image img {
  width: 100%;
}

/* Contact Form Styling */
.mtm-contact-form-section {
  background-color: var(--mtm-bg-light);
  border: 1px solid var(--mtm-border);
  border-radius: var(--mtm-radius);
  padding: 2rem;
  margin: 2.5rem 0;
  box-shadow: var(--mtm-shadow-sm);
}
.mtm-contact-form {
  max-width: 960px;
  margin: 1.25rem auto 2rem;
  padding: 1.5rem;
  background-color: var(--mtm-primary-dark);
  border: 1px solid var(--mtm-footer-divider);
  border-radius: var(--mtm-radius);
  box-shadow: var(--mtm-shadow-md);
}
.mtm-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.mtm-form-field.full-width {
  grid-column: 1 / -1;
}
.mtm-form-field label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  color: #fff;
}
.mtm-form-field label .required {
  color: #f7a49b;
}
.mtm-form-field input,
.mtm-form-field textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--mtm-border);
  border-radius: var(--mtm-radius);
  font-size: 1rem;
  background-color: #fff;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.mtm-form-field textarea {
  resize: vertical;
}
.mtm-form-field input::placeholder,
.mtm-form-field textarea::placeholder {
  color: #64748b;
}
.mtm-form-field input:focus,
.mtm-form-field textarea:focus {
  border-color: var(--mtm-accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.35);
}
.mtm-form-privacy {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #cbd5e1;
}
.mtm-contact-form a,
.mtm-form-alert a {
  color: var(--mtm-accent);
  font-weight: 600;
}
.mtm-contact-form a:hover,
.mtm-form-alert a:hover {
  color: #e7f6a4;
}
.mtm-contact-form a:focus-visible,
.mtm-form-alert a:focus-visible {
  outline: 3px solid var(--mtm-accent);
  outline-offset: 3px;
}
.mtm-form-submit {
  margin-top: 1.25rem;
  text-align: center;
}
.mtm-form-submit .mtm-btn:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.mtm-form-alert {
  padding: 1rem 1.25rem;
  border-radius: var(--mtm-radius);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}
.mtm-alert-success {
  background-color: #ecfdf5;
  border: 1px solid #10b981;
  color: #065f46;
}
.mtm-alert-error {
  background-color: #fef2f2;
  border: 1px solid #ef4444;
  color: #991b1b;
}

/* Callouts / CTAs */
.mtm-cta-banner {
  background-color: var(--mtm-primary-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3.5rem 1.5rem;
  border-radius: 8px;
  margin: 2.5rem 0;
}
.mtm-cta-banner h2 {
  color: #fff;
  margin-bottom: 0.75rem;
}
.mtm-cta-banner p {
  color: #e2e8f0;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

/* Quotes / Testimonials */
.wp-block-quote {
  border-left: 4px solid var(--mtm-accent);
  background-color: var(--mtm-bg-light);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--mtm-radius) var(--mtm-radius) 0;
}
.wp-block-quote p {
  font-style: italic;
  margin-bottom: 0.5rem;
}
.wp-block-quote cite {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--mtm-text-muted);
  display: block;
}

/* Footer */
.mtm-footer {
  background-color: var(--mtm-primary-dark);
  color: #e2e8f0;
  padding: 3rem 0 1.5rem;
  margin-top: auto;
  border-top: 4px solid var(--mtm-accent);
}
.mtm-footer-branding {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--mtm-footer-divider);
  margin-bottom: 2rem;
}
.mtm-footer-logo img {
  max-height: 55px;
  width: auto;
  background: #fff;
  padding: 4px 8px;
  border-radius: var(--mtm-radius);
}
@font-face {
  font-family: "MTM Social";
  src: url("assets/fonts/mtm-social.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
.mtm-home-content .entry-content > .wp-block-image:first-of-type > a {
  display: block;
  cursor: pointer;
}
.mtm-home-content .entry-content > .wp-block-image:first-of-type > a img {
  transition: filter 0.2s ease;
}
.mtm-home-content .entry-content > .wp-block-image:first-of-type > a:hover img {
  filter: brightness(0.96);
}
.mtm-footer-social {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.mtm-footer-social a {
  display: inline-flex;
  width: 2.75rem;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.mtm-social-icon {
  font-family: "MTM Social";
  font-size: 1.5rem;
  font-style: normal;
  font-weight: 400;
  line-height: 1;
}
.mtm-footer-counties {
  margin-bottom: 2rem;
  font-size: 0.9rem;
  line-height: 1.8;
}
.mtm-footer-counties strong {
  color: #fff;
  display: block;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.85rem;
}
.mtm-footer a {
  color: #cbd5e1;
  text-decoration: none;
}
.mtm-footer a:hover {
  color: var(--mtm-accent);
  text-decoration: underline;
}
.mtm-footer-social a:hover {
  transform: scale(1.1);
  text-decoration: none;
}
.mtm-footer-meta {
  border-top: 1px solid var(--mtm-footer-divider);
  padding-top: 1.5rem;
  font-size: 0.85rem;
  color: #94a3b8;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Responsive */
@media (max-width: 860px) {
  .mtm-header .container {
    min-height: 76px;
  }
  .mtm-mobile-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.65rem 0.9rem;
    font-size: 1rem;
  }
  .mtm-toggle-icon {
    display: block;
    position: relative;
    width: 18px;
    height: 14px;
    border-top: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
  }
  .mtm-toggle-icon::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 0;
    width: 100%;
    border-top: 2px solid currentColor;
  }
  .mtm-mobile-toggle[aria-expanded="true"] .mtm-toggle-icon {
    height: 2px;
    border: 0;
    transform: rotate(45deg);
  }
  .mtm-mobile-toggle[aria-expanded="true"] .mtm-toggle-icon::after {
    top: 0;
    transform: rotate(90deg);
  }
  .mtm-nav-menu {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    max-height: calc(100dvh - 6rem);
    background: #fff;
    padding: 0.75rem 1.5rem 1.25rem;
    box-shadow: var(--mtm-shadow-lg);
    border-top: 1px solid var(--mtm-border);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    align-items: stretch;
    z-index: 1000;
  }
  .mtm-nav-menu.is-active {
    display: flex;
  }
  .mtm-nav-menu > li {
    border-bottom: 1px solid var(--mtm-border);
    padding: 0.25rem 0;
    width: 100%;
  }
  .mtm-nav-menu a {
    font-size: 1.1rem;
    min-height: 44px;
    padding: 0.7rem 0;
    display: block;
    width: 100%;
  }
  .mtm-nav-menu .sub-menu {
    position: static;
    max-height: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    border-left: 2px solid var(--mtm-accent);
    margin: 0.25rem 0 0.5rem 0.5rem;
    padding: 0.25rem 0 0.5rem 1rem;
    background: transparent;
    overflow-y: visible;
    min-width: 0;
  }
  .mtm-nav-menu .sub-menu a {
    font-size: 0.95rem;
    padding: 0.4rem 0;
    color: var(--mtm-text-muted);
    white-space: normal;
  }
  .mtm-nav-menu .sub-menu a:hover {
    color: var(--mtm-primary-light);
    background: transparent;
  }
  .mtm-form-grid {
    grid-template-columns: 1fr;
  }
  .mtm-image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
  .entry-content > h1 {
    font-size: 2.5rem;
  }
  .entry-content > h2 {
    margin-top: 2.75rem;
    font-size: 1.75rem;
  }
  .mtm-coverage-section {
    margin: 3.5rem 0;
    padding: 2.5rem 1rem;
  }
}

@media (max-width: 560px) {
  .mtm-topbar .container {
    justify-content: center;
    text-align: center;
  }
  .mtm-topbar .mtm-topbar-call:first-child {
    display: none;
  }
  .mtm-header .container {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }
  .mtm-logo img {
    max-width: min(54vw, 240px);
    max-height: 52px;
    object-fit: contain;
    object-position: left center;
  }
  .mtm-main {
    padding-bottom: 3.5rem;
  }
  .mtm-home-content .entry-content > .wp-block-image:first-of-type {
    margin-bottom: 2rem;
  }
  .mtm-home-content .entry-content > .wp-block-image:first-of-type img {
    min-height: 0;
    max-height: 200px;
  }
  .mtm-image-grid {
    gap: 0.75rem;
  }
  .mtm-image-grid--resources {
    grid-template-columns: 1fr;
  }
  .mtm-contact-form-section,
  .mtm-contact-form {
    padding: 1.25rem;
  }
  .mtm-footer {
    padding-top: 2.25rem;
  }
  .mtm-footer-meta {
    display: block;
  }
}

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