/* ==========================================================================
   MC Electrical — design system
   Colours, type and components copied from the live Squarespace site.
   Edit the tokens in :root to re-skin the whole site.
   ========================================================================== */

:root {
  /* Brand */
  --blue:        #0000ff;
  --blue-dark:   #0000cc;
  --grey:        #605f5e;   /* warm grey — nav text + dark section bg */
  --grey-mid:    #8a8988;
  --grey-light:  #e2e2e2;   /* body text on dark sections */
  --off-white:   #f5f5f5;
  --white:       #ffffff;
  --ink:         #1a1a1a;

  /* Type */
  --font-head: "Roboto Slab", Georgia, serif;
  --font-body: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Layout */
  --maxw:        1500px;
  --gutter:      4vw;
  --gutter-mob:  6vw;
  --header-h:    110px;

  --radius-pill: 300px;
  --transition:  180ms ease;
}

/* --- reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.45;
  letter-spacing: .01em;
  color: var(--grey);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

h1, h2, h3, h4, h5 {
  font-family: var(--font-head);
  font-weight: 500;
  letter-spacing: -.03em;
  line-height: 1.3;
  margin: 0 0 .5em;
}
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); }
h2 { font-size: clamp(1.35rem, 2.1vw, 1.7rem); }
h3 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); }
h4 { font-size: clamp(1.2rem, 1.9vw, 1.55rem); line-height: 1.4; }
p  { margin: 0 0 1.1em; }

/* --- layout helpers -------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap--narrow { max-width: 1080px; }
.section { padding-block: clamp(3.5rem, 7vw, 6rem); }
.section--blue  { background: var(--blue);  color: var(--white); }
.section--grey  { background: var(--grey);  color: var(--grey-light); }
.section--light { background: var(--off-white); }
.section--blue h1, .section--blue h2, .section--blue h3, .section--blue h4,
.section--grey h1, .section--grey h2, .section--grey h3, .section--grey h4 { color: var(--white); }
.center { text-align: center; }

/* --- buttons --------------------------------------------------------------- */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1;
  padding: 18px 30px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.btn--blue  { background: var(--blue); color: var(--white); }
.btn--blue:hover  { background: var(--blue-dark); }
.btn--grey  { background: var(--grey); color: var(--white); }
.btn--grey:hover  { background: var(--ink); }
.btn--ghost { background: transparent; color: var(--white); border-color: var(--white); }
.btn--ghost:hover { background: var(--white); color: var(--blue); }

/* --- header ---------------------------------------------------------------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding-block: 1.6rem;
}
.header__logo img { height: 70px; width: auto; }

.nav { display: flex; align-items: center; gap: 1.6rem; }
.nav a { font-size: 1rem; color: var(--grey); transition: color var(--transition); }
.nav a:hover { color: var(--blue); }

/* services dropdown */
.nav__item { position: relative; }
.nav__toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  background: none; border: 0; padding: 0;
  font-size: 1rem; color: var(--grey); cursor: pointer;
}
.nav__toggle:hover { color: var(--blue); }
.nav__toggle svg { transition: transform var(--transition); }
.nav__item[data-open="true"] .nav__toggle svg { transform: rotate(180deg); }
.nav__menu {
  position: absolute; top: calc(100% + 14px); left: 50%; translate: -50% 0;
  min-width: 210px; padding: .6rem 0;
  background: var(--white);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 10px;
  box-shadow: 0 12px 34px rgba(0,0,0,.12);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
}
.nav__item[data-open="true"] .nav__menu { opacity: 1; visibility: visible; transform: none; }
.nav__menu a { display: block; padding: .6rem 1.2rem; white-space: nowrap; }
.nav__menu a:hover { background: var(--off-white); color: var(--blue); }

/* mobile nav */
.nav__burger {
  display: none;
  flex-direction: column; gap: 5px;
  background: none; border: 0; padding: 8px; cursor: pointer;
}
.nav__burger span { display: block; width: 26px; height: 2px; background: var(--grey); transition: var(--transition); }

/* --- hero ------------------------------------------------------------------ */
.hero { position: relative; background: var(--grey); overflow: hidden; }
.hero img { width: 100%; height: clamp(340px, 46vw, 620px); object-fit: cover; }
.hero--titled::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.15), rgba(0,0,0,.5));
}
.hero__title {
  position: absolute; inset: auto 0 0 0; z-index: 2;
  padding: 0 var(--gutter) clamp(2rem, 5vw, 4rem);
  color: var(--white);
}
.hero__title h1, .hero__title h3 { color: var(--white); margin: 0; max-width: 20ch; }

/* --- intro statement ------------------------------------------------------- */
.statement {
  font-family: var(--font-head);
  font-size: clamp(1.15rem, 1.9vw, 1.55rem);
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -.02em;
  color: var(--blue);
  max-width: 68ch;
  margin: 0 auto 2rem;
}

/* --- eyebrow label --------------------------------------------------------- */
.eyebrow {
  font-family: var(--font-head);
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  font-weight: 500;
  letter-spacing: -.03em;
  color: var(--blue);
  margin-bottom: 2.5rem;
}
.section--blue .eyebrow, .section--grey .eyebrow { color: var(--white); }

/* --- service cards --------------------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(1.5rem, 3vw, 2.75rem);
}
.card { display: flex; flex-direction: column; }
.card__icon { height: 72px; width: auto; margin-bottom: 1.4rem; }
.card h2 { margin-bottom: .7rem; }
.card p { font-size: .95rem; line-height: 1.6; flex: 1; }
.card__link {
  align-self: flex-start;
  margin-top: 1rem;
  font-size: .95rem;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  transition: opacity var(--transition);
}
.card__link:hover { opacity: .7; }

/* --- routine services grid -------------------------------------------------
   Hairline lattice: 1px gaps over a tinted background read as dividing rules,
   so the cells share borders instead of doubling them up.
   -------------------------------------------------------------------------- */
.svc-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: rgba(0, 0, 0, .11);
  border: 1px solid rgba(0, 0, 0, .11);
}
.svc-grid li {
  background: var(--white);
  padding: clamp(1.35rem, 2.4vw, 2.1rem) clamp(1.25rem, 2vw, 1.75rem);
  font-family: var(--font-head);
  font-size: clamp(1rem, 1.25vw, 1.15rem);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.35;
  color: var(--grey);
  transition: background var(--transition), color var(--transition);
}
.svc-grid li:hover { background: var(--off-white); color: var(--blue); }

@media (max-width: 900px) { .svc-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .svc-grid { grid-template-columns: 1fr; } }

/* --- prose / service page body --------------------------------------------- */
.prose { max-width: 72ch; }
.prose p { line-height: 1.7; }
.lead {
  font-family: var(--font-head);
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -.02em;
  color: var(--blue);
  margin-bottom: 1.5rem;
}
.section--grey .lead, .section--blue .lead { color: var(--white); }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.split img { border-radius: 4px; width: 100%; height: 100%; max-height: 520px; object-fit: cover; }

/* bulleted service list */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  position: relative;
  padding-left: 1.6rem;
  margin-bottom: .7rem;
  line-height: 1.55;
}
.list li::before {
  content: ""; position: absolute; left: 0; top: .55em;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--blue);
}
.section--grey .list li::before, .section--blue .list li::before { background: var(--white); }

/* --- value blocks ---------------------------------------------------------- */
.values { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: clamp(2rem, 4vw, 3.5rem); }

/* --- contact form ---------------------------------------------------------- */
.form { max-width: 640px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-size: .85rem;
  margin-bottom: .4rem;
  color: inherit;
}
.field input, .field textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: .8rem .9rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 4px;
}
.field input:focus, .field textarea:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}
.field textarea { min-height: 130px; resize: vertical; }
.form__status { margin-top: 1rem; font-size: .9rem; min-height: 1.2em; }

/* --- footer ---------------------------------------------------------------- */
.footer { background: var(--white); padding-block: clamp(3rem, 5vw, 4.5rem); border-top: 1px solid rgba(0,0,0,.06); }
.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}
.footer__logo img { height: 58px; width: auto; margin-bottom: 1rem; }
.footer h5 {
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--grey-mid);
  margin: 0 0 .9rem;
}
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: .5rem; }
.footer a:hover { color: var(--blue); }
.footer__meta {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(0,0,0,.08);
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between;
  font-size: .82rem; color: var(--grey-mid);
}

/* --- responsive ------------------------------------------------------------ */
@media (max-width: 900px) {
  :root { --gutter: var(--gutter-mob); }
  .split { grid-template-columns: 1fr; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 767px) {
  .header__logo img { height: 50px; }
  .nav__burger { display: flex; }
  .nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 1rem var(--gutter) 2rem;
    background: var(--white);
    border-bottom: 1px solid rgba(0,0,0,.08);
    box-shadow: 0 14px 30px rgba(0,0,0,.1);
    transform: translateY(-12px);
    opacity: 0; visibility: hidden;
    transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
  }
  .header[data-nav-open="true"] .nav { opacity: 1; visibility: visible; transform: none; }
  .nav > * { padding-block: .75rem; border-bottom: 1px solid rgba(0,0,0,.06); }
  .nav .btn { margin-top: 1rem; text-align: center; border-bottom: 0; }
  .nav__menu {
    position: static; translate: none; transform: none;
    opacity: 1; visibility: visible;
    border: 0; box-shadow: none; padding: .4rem 0 0 1rem;
    display: none; min-width: 0;
  }
  .nav__item[data-open="true"] .nav__menu { display: block; }
  .form__row { grid-template-columns: 1fr; }
  .footer__grid { grid-template-columns: 1fr; }
}

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

/* --- lamp hero ------------------------------------------------------------
   Scroll-triggered light rig: a bright bar throws a cone of light downward,
   both widening as the section scrolls into view, and the statement rises
   into the pool of light. Vanilla equivalent of the framer-motion "lamp"
   effect — same beats, no React.

   Driven by --p (scroll progress, 0 to 1) which js/main.js writes on scroll.
   The parts scale rather than resize: width stays fixed at the open size and
   scaleX does the work, so each frame is a compositor transform instead of a
   layout + re-blur of a 36px-blurred element.
   -------------------------------------------------------------------------- */

.lamp {
  /* White ground. On black the beam was additive light; on white it reads as a
     tint spilling down, so the blues stay saturated and the opacities drop. */
  --lamp-bg:    #ffffff;
  --lamp-beam:  #0000ff;   /* brand blue */
  --lamp-core:  #2b47ff;   /* slightly lifted, for the hot centre */

  --beam-w-lit: 34rem;     /* the open size; --p scales down from here */
  --core-w-lit: 16rem;

  --p: 0;                  /* scroll progress, written by js/main.js */
  --k:      calc(.44 + .56 * var(--p));   /* beam + bar scale, 15rem/34rem = .44 */
  --k-core: calc(.5  + .5  * var(--p));   /* core scale,        8rem/16rem = .5  */

  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--lamp-bg);
  min-height: clamp(23rem, 60vh, 34rem);
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Rig height = distance from the top of the section down to the lamp bar.
   Every light part hangs off `top: 100%` of this box, so they share an apex. */
.lamp__rig {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 7.5rem;
  z-index: 0;
  pointer-events: none;
}

/* The light itself: ONE radial gradient, no filter.

   The previous version stacked four blurred layers and scaled them. A blurred
   element has to be re-rasterised every time it transforms, so scaling them on
   a scroll handler meant re-blurring four large surfaces per frame — the cause
   of the stutter. A radial gradient is soft by nature, costs nothing to
   rasterise once, and stretches cheaply. */
.lamp__glow {
  position: absolute;
  top: 100%; left: 50%;
  width: 62rem;
  height: 24rem;
  margin-left: -31rem;
  background: radial-gradient(ellipse 50% 100% at 50% 0%,
              rgba(0, 0, 255, .30) 0%,
              rgba(0, 0, 255, .14) 36%,
              rgba(0, 0, 255, 0)  76%);
  transform: scaleX(var(--k));
  transform-origin: 50% 0;
  will-change: transform;
}

/* the fixture — crisp, unfiltered, so scaling it is nearly free */
.lamp__bar {
  position: absolute;
  top: 100%; left: 50%;
  width: var(--beam-w-lit);
  margin-left: calc(var(--beam-w-lit) / -2);
  height: 2px;
  background: linear-gradient(to right,
              rgba(0, 0, 255, 0), var(--lamp-beam) 18%,
              var(--lamp-beam) 82%, rgba(0, 0, 255, 0));
  transform: scaleX(var(--k));
  will-change: transform;
}

.lamp__content {
  position: relative;
  z-index: 5;
  margin-top: 11.5rem;
  padding: 0 var(--gutter) clamp(3rem, 6vw, 5rem);
  max-width: 62rem;
}

.lamp__text {
  margin: 0 0 2rem;
  font-family: var(--font-head);
  font-size: clamp(1.25rem, 2.4vw, 2rem);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -.025em;

  color: var(--blue);

  /* readable at rest — this is the hero statement, so it never starts hidden */
  opacity: calc(.62 + .38 * var(--p));
  translate: 0 calc(34px - 34px * var(--p));
}
  .lamp__content { margin-top: 10rem; }
}

/* Reduced motion: show the lamp fully lit, just don't animate into it.
   The global reduced-motion rule already strips the transitions. */
@media (prefers-reduced-motion: reduce) {
  .lamp { --p: 1; }
}
