/* ==========================================================================
   EcoBuilders — stylesheet
   Colours are defined once as tokens below and reused everywhere. To change
   a colour site-wide, edit it here only. Dark mode swaps the same token
   names, so any new component inherits dark mode automatically.
   ========================================================================== */

:root {
  color-scheme: light;

  /* brand — identical in both themes */
  --green: #22C55E;
  --green-hover: #16A34A;
  --green-ink: #15803D;          /* green text on light backgrounds */
  --radius: 8px;
  --max-width: 1200px;

  /* semantic — light theme */
  --bg: #F4F6F4;
  --surface: #FFFFFF;
  --surface-alt: rgba(0, 0, 0, 0.02);
  --text: #1A241F;
  --muted: #5C665F;
  --border: #E2E8F0;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.18);
  --header-bg: rgba(244, 246, 244, 0.9);
  --hero-scrim-a: rgba(244, 246, 244, 0.78);
  --hero-scrim-b: rgba(244, 246, 244, 0.86);
  --btn-primary-ink: #06130B;
  --backdrop: rgba(12, 18, 15, 0.72);
  --thumb-ring: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #121A16;
  --surface: #1A241F;
  --surface-alt: rgba(255, 255, 255, 0.03);
  --text: #FFFFFF;
  --muted: #9BA8A0;
  --border: #2A3830;
  --shadow: none;
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
  --header-bg: rgba(18, 26, 22, 0.9);
  --hero-scrim-a: rgba(18, 26, 22, 0.85);
  --hero-scrim-b: rgba(18, 26, 22, 0.95);
  --green-ink: #4ADE80;
  --backdrop: rgba(0, 0, 0, 0.82);
  --thumb-ring: rgba(255, 255, 255, 0.12);
}

/* Base */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

img { max-width: 100%; }

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

/* Header & nav */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: currentColor;
}

.nav-logo-mark { height: 32px; width: auto; }

/* Two logo files, one per theme — swapped in CSS so there is no flash
   and no JavaScript needed. */
[data-theme="light"] .logo-on-dark,
:root:not([data-theme="dark"]) .logo-on-dark { display: none; }
[data-theme="dark"] .logo-on-light { display: none; }

.nav-logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a {
  color: currentColor;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--green); }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: currentColor;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: currentColor;
  margin: 5px 0;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: currentColor;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}

.theme-toggle:hover {
  border-color: var(--green);
  color: var(--green);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root:not([data-theme="dark"]) .theme-toggle .icon-sun { display: none; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background-color: var(--green);
  color: var(--btn-primary-ink);
}

.btn-primary:hover {
  background-color: var(--green-hover);
  color: #fff;
}

.btn-outline {
  border: 1px solid var(--border);
  color: currentColor;
}

.btn-outline:hover {
  border-color: var(--green);
  color: var(--green);
}

/* Hero */
.hero {
  padding: 6rem 0 4rem;
  border-bottom: 1px solid var(--border);
  background-image: linear-gradient(var(--hero-scrim-a), var(--hero-scrim-b)),
                    url('assets/hero-bg.jpg');
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.hero-content { max-width: 800px; }

.eyebrow {
  color: var(--green-ink);
  text-transform: uppercase;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: 3.5rem;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}

.hero h1 span { color: var(--green); }

.hero p {
  font-size: 1.25rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 4rem;
  flex-wrap: wrap;
}

.hero-trust {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.hero-trust strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.hero-trust span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.35;
}

.hero-trust .trust-license {
  color: var(--green-ink);
  font-weight: 600;
}

/* Sections */
.section { padding: 5rem 0; }
.section-dark { background-color: var(--surface-alt); }
.section-head { margin-bottom: 3rem; }
.section-head.centered { text-align: center; }

.section-head h2 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Grids */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* Four-up markets grid: 2x2 on desktop so four cards sit even. */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* Service cards */
.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-decoration: none;
  color: currentColor;
  transition: transform 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
  box-shadow: var(--shadow);
}

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

.service-icon {
  width: 48px;
  height: 48px;
  color: var(--green);
  margin: 0 auto;
}

.service-card h3 { font-size: 1.25rem; font-weight: 700; }

/* Content cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}

.card-icon {
  width: 28px;
  height: 28px;
  color: var(--green);
  flex-shrink: 0;
}

.card-icon svg { width: 100%; height: 100%; display: block; }

.card h3 { font-size: 1.15rem; font-weight: 700; line-height: 1.3; }

.card p { color: var(--muted); font-size: 0.95rem; line-height: 1.5; }

/* Process */
.process {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--green);
  padding: 1.25rem 1rem;
  border-radius: 0 0 var(--radius) var(--radius);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  box-shadow: var(--shadow);
}

.step-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-icon svg { width: 100%; height: 100%; display: block; }
.step-text { display: flex; flex-direction: column; }
.step strong { display: block; font-size: 1rem; line-height: 1.2; margin-bottom: 0.2rem; }
.step span { font-size: 0.85rem; color: var(--muted); line-height: 1.35; }

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

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.contact-card p { margin-bottom: 1.25rem; }
.contact-card a { color: var(--green-ink); }

.credential-line {
  color: var(--green-ink);
  font-weight: 600;
  font-size: 0.9rem;
}

.phone-reveal {
  background: none;
  border: none;
  color: var(--green-ink);
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.phone-reveal.revealed { color: currentColor; text-decoration: none; }

.icon-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  height: 100%;
  align-items: center;
  justify-items: center;
}

.icon-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 130px;
  height: 70px;
}

.icon-item img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.2s;
}

.icon-item img:hover { transform: scale(1.05); }

/* The USGBC mark is near-black; force it white so it reads on the dark surface. */
[data-theme="dark"] .icon-item:nth-child(3) img { filter: brightness(0) invert(1); }

/* --------------------------------------------------------------------------
   Service pages
   -------------------------------------------------------------------------- */

.page-hero {
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  background-color: var(--surface-alt);
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--green); }

.page-hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 60ch;
}

.service-content { padding: 4rem 0 5rem; }

.back-link {
  display: inline-block;
  margin-top: 3rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.back-link:hover { color: var(--green); }

/* Sub-service sections */
.subservice { margin-bottom: 3.5rem; }

.subservice-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.subservice-head h3 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.subservice-head .count {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Thumbnail rows */
.project-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.project-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s;
}

.project-item:hover { transform: translateY(-3px); border-color: var(--green); }

.project-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 0;
  padding: 0;
  background: var(--surface-alt);
  cursor: zoom-in;
  overflow: hidden;
}

.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.project-thumb:hover img { transform: scale(1.04); }

.project-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px var(--thumb-ring);
}

.project-body { padding: 1rem 1.1rem 1.25rem; }

.project-body h4 {
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.3rem;
}

.project-body .specs {
  font-size: 0.88rem;
  color: var(--green-ink);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.project-body p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Text-only additional experience */
.also {
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.also strong { color: var(--text); font-weight: 600; }

/* Page CTA */
.page-cta {
  margin-top: 3.5rem;
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.page-cta p { font-size: 1.1rem; font-weight: 600; }
.page-cta span { display: block; font-size: 0.92rem; font-weight: 400; color: var(--muted); margin-top: 0.2rem; }

/* --------------------------------------------------------------------------
   Gallery modal
   -------------------------------------------------------------------------- */

#galleryModal[hidden] { display: none; }

#galleryModal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.gallery-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
  backdrop-filter: blur(4px);
}

.gallery-panel {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  max-height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gallery-panel.animate-in { animation: galleryIn 0.25s ease-out; }
.gallery-panel.animate-in-mobile { animation: galleryInMobile 0.25s ease-out; }
.gallery-panel.animate-out { animation: galleryOut 0.2s ease-in forwards; }

@keyframes galleryIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes galleryInMobile {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes galleryOut {
  to { opacity: 0; transform: scale(0.98); }
}

.gallery-stage {
  position: relative;
  background: #0b100d;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

#galleryMainImg {
  display: block;
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
}

.gallery-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 3;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.gallery-close:hover { background: rgba(0, 0, 0, 0.8); }

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.gallery-nav:hover { background: rgba(0, 0, 0, 0.75); }
.gallery-nav.prev { left: 0.75rem; }
.gallery-nav.next { right: 0.75rem; }

.gallery-meta { padding: 1.25rem 1.5rem 0; }
.gallery-meta h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.25rem; }
.gallery-meta p { color: var(--muted); font-size: 0.95rem; }

.gallery-thumbs {
  display: flex;
  gap: 0.6rem;
  padding: 1rem 1.5rem 1.5rem;
  overflow-x: auto;
}

.gallery-thumb {
  width: 84px;
  height: 60px;
  object-fit: cover;
  border-radius: 5px;
  cursor: pointer;
  opacity: 0.55;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: opacity 0.2s, border-color 0.2s;
}

.gallery-thumb:hover { opacity: 0.85; }
.gallery-thumb.active { opacity: 1; border-color: var(--green); }

body.gallery-open { overflow: hidden; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

footer {
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  padding: 3rem 0 2.5rem;
  margin-top: 0;
}

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

footer p, footer a { color: var(--muted); font-size: 0.92rem; }
footer a { color: var(--green-ink); text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer strong { display: block; margin-bottom: 0.6rem; font-size: 0.95rem; color: var(--text); }
footer .logo-link { margin-bottom: 1rem; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

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

@media (max-width: 768px) {
  .hero h1 { font-size: 2.5rem; }
  .hero-trust { grid-template-columns: 1fr; }

  .nav-links {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 1rem 1.5rem 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }

  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.85rem 0; }
  .nav-links .btn { margin-top: 0.75rem; }

  .nav-toggle { display: block; }

  .contact-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
  .process { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .page-hero h1 { font-size: 2rem; }

  #galleryModal { padding: 0; }
  .gallery-panel { border-radius: 0; height: 100%; width: 100%; }
  #galleryMainImg { max-height: 50vh; }

  body.menu-open { overflow: hidden; }
}

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