/* ==========================================================================
   PW Solar — global stylesheet
   Mobile-first. All colour/spacing/type values are CSS variables below —
   swap them to reskin the whole site without touching component rules.
   ========================================================================== */

:root {
  /* Colour palette — charcoal + PW Solar's real brand green (from
     pwsolar.co.uk's CTA buttons, sampled as #31C36C) */
  --color-primary: #1C1F26;
  --color-primary-dark: #101318;
  --color-primary-tint: #2B2F38;
  --color-accent: #31C36C;
  --color-accent-dark: #279C56;
  --color-text: #2B2F36;
  --color-text-muted: #5B6470;
  --color-text-on-dark: #F3F4F6;
  --color-text-on-dark-muted: #B7BCC5;
  --color-bg: #F7F7F5;
  --color-surface: #FFFFFF;
  --color-border: #E3E1DC;
  --color-on-primary: #FFFFFF;
  --color-on-accent: #1C1F26;
  --color-success: #2E7D46;
  --color-error: #C23B3B;

  /* Spacing scale */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;

  /* Font sizes (fluid-ish via rem; scale up at wider breakpoints below) */
  --font-size-xs: 0.8125rem;
  --font-size-sm: 0.9375rem;
  --font-size-base: 1rem;
  --font-size-md: 1.125rem;
  --font-size-lg: 1.375rem;
  --font-size-xl: 1.875rem;
  --font-size-2xl: 2.25rem;
  --font-size-3xl: 2.75rem;

  /* Type + layout */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --line-height-tight: 1.2;
  --line-height-base: 1.6;
  --container-width: 1140px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(16, 19, 24, 0.08);
  --shadow-md: 0 8px 24px rgba(16, 19, 24, 0.12);
  --transition: 0.2s ease;
  --header-height: 76px;
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  /* Keeps anchor-jump targets (services.html#residential, contact.html#quote,
     etc.) from landing underneath the sticky header. A bit more than
     --header-height itself: the header's real rendered height can run a
     fraction taller than that (it's a min-height, not a fixed height), and
     landing with a little breathing room reads better than flush anyway. */
  scroll-padding-top: calc(var(--header-height) + 16px);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-bg);
}

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

h1, h2, h3, h4 {
  margin: 0 0 var(--space-sm);
  line-height: var(--line-height-tight);
  font-weight: 800;
  color: var(--color-primary);
}

h1 { font-size: var(--font-size-2xl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }
h4 { font-size: var(--font-size-md); }

p {
  margin: 0 0 var(--space-sm);
}

a {
  color: var(--color-primary);
  text-decoration-color: var(--color-accent);
  text-underline-offset: 0.15em;
}

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

ul, ol {
  padding-left: 1.25em;
}

label {
  font-weight: 600;
}

button {
  font-family: inherit;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-sm);
  z-index: 1000;
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: var(--space-2xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: top var(--transition);
}

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

/* ==========================================================================
   Layout helpers
   ========================================================================== */

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

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

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

.section-header {
  max-width: 640px;
  margin-bottom: var(--space-lg);
}

.section-header--center {
  margin-inline: auto;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-dark);
  margin-bottom: var(--space-2xs);
}

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

.grid {
  display: grid;
  gap: var(--space-md);
  /* min-width:0 stops grid items' default content-based minimum size
     from forcing tracks (and the page) wider than the viewport */
  min-width: 0;
}

.grid > * {
  min-width: 0;
}

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

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

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

@media (min-width: 960px) {
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  padding: 0.85em 2em;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: var(--font-size-base);
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
}

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

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

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

.btn-outline {
  background-color: transparent;
  border-color: currentColor;
  color: inherit;
}

.btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: inherit;
}

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

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

.btn-block {
  width: 100%;
}

/* ==========================================================================
   Header / Nav
   ========================================================================== */

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  gap: var(--space-sm);
}

.logo {
  font-size: var(--font-size-md);
  font-weight: 800;
  color: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;
}

.logo img {
  display: block;
  height: 48px;
  width: auto;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  width: 20px;
  height: 2px;
  margin-inline: auto;
  background-color: var(--color-primary);
  transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.site-nav {
  position: absolute;
  top: var(--header-height);
  left: 0;
  right: 0;
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-sm);
  display: none;
  flex-direction: column;
  gap: var(--space-sm);
}

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

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* :not(.btn) so the nav-cta button below isn't caught by this — its
   padding/display/colour must come from .btn/.btn-primary instead,
   which this selector would otherwise silently outrank (it has an
   extra element selector, so .site-nav a beats .btn on specificity
   even though .btn is more specific-looking). This was the actual
   cause of the nav-cta button having near-zero horizontal padding and
   its hover text matching the hover background exactly. */
.site-nav a:not(.btn) {
  display: block;
  padding: var(--space-2xs) 0;
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}

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

.nav-cta {
  align-self: flex-start;
}

@media (min-width: 960px) {
  .nav-toggle {
    display: none;
  }

  .site-nav {
    position: static;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-lg);
    border-bottom: none;
    padding: 0;
    width: auto;
  }

  .site-nav ul {
    flex-direction: row;
    gap: var(--space-md);
  }

  .nav-cta {
    align-self: center;
  }
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  background-color: var(--color-primary);
  color: var(--color-text-on-dark);
  padding-block: var(--space-xl);
  overflow: hidden;
}

.hero-inner {
  display: grid;
  gap: var(--space-lg);
  align-items: center;
  min-width: 0;
}

.hero-inner > * {
  min-width: 0;
}

.hero-copy h1 {
  color: var(--color-on-primary);
  font-size: var(--font-size-2xl);
}

.hero-copy p {
  color: var(--color-text-on-dark-muted);
  font-size: var(--font-size-md);
  max-width: 46ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-md);
}

.hero-media img {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

@media (min-width: 860px) {
  .hero-inner {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  }

  .hero-copy h1 {
    font-size: var(--font-size-3xl);
  }
}

/* Page header used on interior pages (About, Services, Projects, Contact, News) */
.page-header {
  background-color: var(--color-primary);
  color: var(--color-text-on-dark);
  padding-block: var(--space-lg);
}

.page-header h1 {
  color: var(--color-on-primary);
  margin-bottom: var(--space-2xs);
}

.page-header p {
  color: var(--color-text-on-dark-muted);
  max-width: 60ch;
  margin-bottom: 0;
}

/* Inline text links on dark sections default to the same dark
   (--color-primary) link colour as the rest of the site, which is
   invisible against a dark background — override for every dark
   section, not just the ones currently using inline links. */
.hero a:not(.btn),
.page-header a:not(.btn),
.cta-band a:not(.btn) {
  color: var(--color-on-primary);
}

.hero a:not(.btn):hover,
.page-header a:not(.btn):hover,
.cta-band a:not(.btn):hover {
  color: var(--color-accent);
}

/* ==========================================================================
   Trust bar / stats
   ========================================================================== */

.stats-bar {
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding-block: var(--space-md);
}

.stats-bar .grid {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: var(--font-size-xl);
  font-weight: 800;
  color: var(--color-primary);
}

.stat-label {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.card-media img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

/* Taller alternative for photos that don't suit a landscape crop (e.g. a
   phone shot taken in portrait) — opt in per-card via the project builder. */
.card-media img.is-portrait {
  aspect-ratio: 4 / 5;
}

.card-body {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  flex: 1;
}

.card-body h3 {
  margin-bottom: 0;
}

.card-link {
  display: inline-block;
  font-weight: 700;
  text-decoration: none;
}

.card-body .card-link {
  margin-top: auto;
}

.card-stat-row {
  display: flex;
  gap: var(--space-md);
  margin: var(--space-2xs) 0;
}

.card-stat-row .stat-value {
  font-size: var(--font-size-lg);
}

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

.tick-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2xs);
  margin-bottom: var(--space-xs);
}

.tick-list li:last-child {
  margin-bottom: 0;
}

.tick-icon {
  flex-shrink: 0;
  width: 1.35em;
  height: 1.35em;
  margin-top: 0.1em;
  color: var(--color-accent-dark);
}

/* Centered as a block (not full container width) so it doesn't read as
   pushed over to the left under the centered heading above it — text
   inside stays left-aligned, only the block itself is centered. */
.tick-list--2col {
  max-width: 640px;
  margin-inline: auto;
}

/* column-count rather than a grid: a 2-column grid sizes each ROW to
   its tallest item, so a wrapped line in one column leaves an orphaned
   gap next to a shorter one-line item in the other. Columns flow each
   list top-to-bottom independently instead, so uneven wrapping in one
   column never affects the other. */
@media (min-width: 640px) {
  .tick-list--2col {
    column-count: 2;
    column-gap: var(--space-md);
  }

  .tick-list--2col li {
    break-inside: avoid;
  }
}

/* A fixed stage so MCS/NAPIT (tall badges) and RECC (a wide lockup)
   read at the same visual weight despite very different aspect ratios —
   each logo scales to fit this box, rather than being forced to a
   shared height (which would make RECC huge and the others tiny) or a
   shared width (the reverse). */
.accreditation-card-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  margin-bottom: var(--space-sm);
}

.accreditation-card-logo img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

/* Icon-style service cards (no photo) */
.icon-card {
  padding: var(--space-md);
}

.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background-color: rgba(49, 195, 108, 0.15);
  color: var(--color-accent-dark);
  margin-bottom: var(--space-sm);
  font-size: 1.4rem;
}

/* ==========================================================================
   Process / steps
   ========================================================================== */

.steps {
  counter-reset: step;
}

.step {
  position: relative;
  padding-left: 3rem;
}

.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: 800;
}

/* ==========================================================================
   CTA band
   ========================================================================== */

.cta-band {
  background-color: var(--color-primary);
  color: var(--color-text-on-dark);
  padding-block: var(--space-xl);
  text-align: center;
}

.cta-band h2 {
  color: var(--color-on-primary);
}

.cta-band p {
  color: var(--color-text-on-dark-muted);
  max-width: 56ch;
  margin-inline: auto;
}

.cta-band .btn {
  margin-top: var(--space-sm);
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-field {
  margin-bottom: var(--space-md);
}

.form-field label {
  display: block;
  margin-bottom: var(--space-3xs);
  font-size: var(--font-size-sm);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 0.7em 0.85em;
  font-family: inherit;
  font-size: var(--font-size-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  color: var(--color-text);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--color-accent);
}

.form-field textarea {
  min-height: 8rem;
  resize: vertical;
}

.form-row {
  display: grid;
  gap: var(--space-md);
  min-width: 0;
}

.form-row > * {
  min-width: 0;
}

@media (min-width: 640px) {
  .form-row--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2xs);
}

.form-checkbox input {
  width: auto;
  margin-top: 0.3em;
}

.form-checkbox label {
  font-weight: 400;
  font-size: var(--font-size-sm);
}

.form-note {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.field-error {
  display: block;
  min-height: 1.2em;
  margin-top: var(--space-3xs);
  font-size: var(--font-size-xs);
  color: var(--color-error);
}

.form-field input[aria-invalid="true"],
.form-field select[aria-invalid="true"],
.form-field textarea[aria-invalid="true"] {
  border-color: var(--color-error);
}

.form-status {
  margin-bottom: var(--space-md);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  background-color: rgba(46, 125, 70, 0.1);
  border: 1px solid var(--color-success);
  color: var(--color-text);
}

.form-status--error {
  background-color: rgba(194, 59, 59, 0.08);
  border-color: var(--color-error);
}

.btn .spinner:not([hidden]) {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-left: var(--space-2xs);
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-top-color: var(--color-on-accent);
  border-radius: 50%;
  vertical-align: -0.15em;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.lead-form-success {
  background-color: rgba(46, 125, 70, 0.1);
  border: 1px solid var(--color-success);
  border-radius: var(--radius);
  padding: var(--space-lg);
}

.lead-form-success h3 {
  margin-top: 0;
}

.lead-form-success p {
  margin-bottom: 0;
  color: var(--color-text-muted);
}

.contact-layout {
  display: grid;
  gap: var(--space-xl);
  min-width: 0;
}

.contact-layout > * {
  min-width: 0;
}

.quote-page-layout {
  display: grid;
  gap: var(--space-xl);
  min-width: 0;
}

.quote-page-layout > * {
  min-width: 0;
}

@media (min-width: 860px) {
  .quote-page-layout {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
  }
}

.quote-page-aside {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  align-self: start;
}

.quote-page-aside h2 {
  font-size: var(--font-size-lg);
}

.quote-page-aside p:last-child {
  margin-bottom: 0;
}

@media (min-width: 860px) {
  .contact-layout {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }
}

.contact-details dt {
  font-weight: 700;
  color: var(--color-primary);
  margin-top: var(--space-sm);
}

.contact-details dd {
  margin: 0 0 var(--space-2xs);
  color: var(--color-text-muted);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  background-color: var(--color-primary);
  color: var(--color-text-on-dark-muted);
}

.footer-inner {
  display: grid;
  gap: var(--space-lg);
  padding-block: var(--space-xl);
  min-width: 0;
}

.footer-inner > * {
  min-width: 0;
}

.footer-brand .logo {
  color: var(--color-on-primary);
}

.footer-inner h2 {
  color: var(--color-on-primary);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-xs);
}

.footer-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.footer-nav a,
.footer-contact a {
  color: var(--color-text-on-dark-muted);
  text-decoration: none;
}

.footer-nav a:hover,
.footer-contact a:hover {
  color: var(--color-accent);
}

.accreditation-logos {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-2xs);
}

.accreditation-logos img {
  height: clamp(28px, 5vw, 40px);
  width: auto;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* Plain <a> here otherwise inherits the global dark `a { color }` rule,
   which is invisible against this dark footer — same bug class as the
   hero/page-header/cta-band dark-link fix above, just a section that
   fix didn't cover since this link was added later. */
.footer-bottom-inner a {
  color: var(--color-text-on-dark-muted);
}

.footer-bottom-inner a:hover {
  color: var(--color-accent);
}

.footer-bottom-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  padding-block: var(--space-sm);
  font-size: var(--font-size-xs);
}

@media (min-width: 720px) {
  .footer-inner {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .footer-bottom-inner {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* ==========================================================================
   Misc content blocks
   ========================================================================== */

.values-grid .card-body {
  text-align: left;
}

.testimonial-card .card-body {
  text-align: left;
  gap: var(--space-sm);
}

.testimonial-card blockquote {
  margin: 0;
  color: var(--color-text);
}

.testimonial-author {
  margin: 0;
  font-weight: 700;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.placeholder-note {
  background-color: rgba(49, 195, 108, 0.12);
  border: 1px dashed var(--color-accent-dark);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text);
}
