/* Electrical Solutions Bristol: live wire. One dark theme, one accent. */
:root {
  --bg: #16181b;
  --on-bg: #eceef0;
  --on-bg-muted: #a9aeb5;
  --surface: #1f2226;
  --on-surface: #eceef0;
  --on-surface-muted: #a9aeb5;
  --field: #121417;
  --on-field: #eceef0;
  --accent: #dcff3a;
  --on-accent: #16181b;
  --ribbon: #2b2f35;
  --on-ribbon: #e1e4e8;
  --error: #ff9a8a;
  --line: #34383e;
  --wire: #4a4f57;
  --radius: 2px;
  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --body: "Barlow", system-ui, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --snap: cubic-bezier(.2, 0, 0, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--on-bg);
  font: 400 1.0625rem/1.6 var(--body);
  overflow-wrap: break-word;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--on-bg); text-decoration-color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { color: var(--accent); background: var(--bg); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 900; text-transform: uppercase; letter-spacing: .005em; line-height: .95; }
p { margin: 0; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 1rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip { position: absolute; left: -999px; top: 0; padding: .5rem 1rem; background: var(--accent); color: var(--on-accent); z-index: 30; }
.skip:focus { left: 1rem; }

.ribbon {
  background: var(--ribbon);
  color: var(--on-ribbon);
  font-size: .8125rem;
  line-height: 1.4;
  text-align: center;
  padding: .45rem 1rem;
}

/* Buttons: sharp corners everywhere, one rule */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: .7rem 1.35rem;
  border-radius: var(--radius); border: 2px solid transparent;
  font: 600 1rem/1.1 var(--body); text-decoration: none; white-space: nowrap;
  cursor: pointer;
  transition: scale .15s ease-out;
}
.btn:active { scale: .96; }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--on-bg); color: var(--on-accent); }
.btn-ghost { background: var(--bg); color: var(--on-bg); border-color: var(--on-bg-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--accent); border-color: var(--accent); }
.btn-sm { min-height: 40px; padding: .5rem 1rem; font-size: .9375rem; }
.btn-block { width: 100%; }

/* Header */
.top { border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 68px; }
.lockup { display: flex; flex-direction: column; text-decoration: none; line-height: 1; }
.lockup-name { font: 900 1.35rem/1 var(--display); text-transform: uppercase; }
.lockup-name b { color: var(--accent); background: var(--bg); }
.lockup-aka { font-size: .8125rem; color: var(--on-bg-muted); background: var(--bg); margin-top: .25rem; }
.nav { display: none; align-items: center; gap: 1.75rem; }
.nav a:not(.btn), .socials a { position: relative; text-decoration: none; font-weight: 500; }
.nav a:not(.btn)::after, .socials a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform .25s var(--snap); }
.nav a:not(.btn):is(:hover, :focus-visible)::after, .socials a:is(:hover, :focus-visible)::after { transform: scaleX(1); transform-origin: left; }

/* Hero */
.hero { padding: 2.5rem 0 1rem; overflow: hidden; }
.hero-grid { display: grid; gap: 1.5rem; }
.brandstrip { color: var(--on-bg-muted); background: var(--bg); font-size: .9375rem; margin-bottom: 1rem; }
.handle { color: var(--on-bg); background: var(--bg); font-weight: 600; }
.hero h1 { font-size: clamp(2.9rem, 13vw, 6.4rem); line-height: .92; }
.hot { position: relative; display: block; color: var(--accent); background: var(--bg); }
.lede { margin-top: 1.25rem; max-width: 34ch; font-size: 1.1875rem; color: var(--on-bg-muted); background: var(--bg); }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }

.sig { margin: 0 -1rem; max-height: 300px; }
.sig svg { width: 100%; height: 100%; max-height: 300px; }
.w { stroke-width: 7; stroke: var(--wire); }
.w-l, .w-b { stroke: var(--accent); }
.n-g { fill: var(--wire); }
.n-l { fill: var(--accent); }
.t-g { fill: var(--on-bg-muted); }
.t-l { fill: var(--accent); }


/* Proof */
.proof { padding: 3rem 0; border-top: 1px solid var(--line); }
.proof-grid { display: grid; gap: 2.5rem; }
.num { font: 900 clamp(5rem, 26vw, 11rem)/.85 var(--display); color: var(--on-bg); background: var(--bg); letter-spacing: -.01em; }
.num-cap { margin-top: 1rem; max-width: 36ch; color: var(--on-bg-muted); background: var(--bg); }
.proof-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; align-content: end; }
.proof-list li { position: relative; padding-left: 1rem; }
.proof-list li::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); transform-origin: top; }
.proof-list strong { display: block; font: 900 1.6rem/1.05 var(--display); text-transform: uppercase; }
.proof-list span { display: block; margin-top: .3rem; color: var(--on-bg-muted); background: var(--bg); }

/* Services */
.services { padding: 3.5rem 0; background: var(--surface); color: var(--on-surface); }
.sec-h { font-size: clamp(2.2rem, 9vw, 4rem); }
.svc { list-style: none; margin: 2rem 0 0; padding: 0; }
.svc-row { display: grid; gap: .4rem; padding: 1.1rem 0; }
.svc-row { position: relative; }
.svc-row + .svc-row::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--line); transform-origin: left; }
.svc-word { font: 900 clamp(2.6rem, 14vw, 6.5rem)/.9 var(--display); text-transform: uppercase; color: var(--on-surface); background: var(--surface); }
.svc-word { display: block; transition: transform .3s var(--snap); }
.svc-row:hover .svc-word { color: var(--accent); background: var(--surface); transform: translateX(.12em); }
.svc-row p { color: var(--on-surface-muted); background: var(--surface); max-width: 40ch; }
.split { display: grid; gap: 1px; margin-top: 2.5rem; background: var(--line); border: 1px solid var(--line); }
.split-cell { padding: 1.5rem; background: var(--bg); color: var(--on-bg); }
.split-cell h3 { font-size: 2rem; color: var(--accent); background: var(--bg); }
.split-cell p { margin-top: .4rem; color: var(--on-bg-muted); background: var(--bg); }
.aside { margin-top: 1.5rem; color: var(--on-surface-muted); background: var(--surface); }
.aside a { color: var(--on-surface); background: var(--surface); }

/* Watch */
.watch { padding: 3.5rem 0; }
.watch-grid { display: grid; gap: 2.5rem; }
.phone-plate {
  width: min(100%, 280px); aspect-ratio: 9 / 16; margin: 0 auto;
  border: 2px solid var(--wire); border-radius: 22px; padding: 10px;
  background: var(--surface);
}
.phone-screen {
  height: 100%; border-radius: 14px; padding: 1.25rem;
  display: flex; flex-direction: column; justify-content: flex-end; gap: .75rem; position: relative;
  background: repeating-linear-gradient(135deg, var(--field) 0 14px, var(--bg) 14px 28px);
  color: var(--on-field);
}
.plate-title { font: 900 1.9rem/1 var(--display); text-transform: uppercase; color: var(--accent); background: var(--field); }
.plate-note { font-size: .9375rem; color: var(--on-field); background: var(--field); }
.eyebrow { font-size: .8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); background: var(--bg); margin-bottom: .75rem; }
.watch-copy > p:not(.eyebrow) { margin-top: 1rem; max-width: 44ch; color: var(--on-bg-muted); background: var(--bg); }
.socials { list-style: none; margin: 2rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.socials a { font-weight: 600; }
.socials a:hover { color: var(--on-bg); background: var(--bg); }

/* Quote */
.quote { padding: 3.5rem 0 4rem; background: var(--surface); color: var(--on-surface); }
.quote-grid { display: grid; gap: 2rem; }
.quote-intro > p { margin-top: 1rem; max-width: 38ch; color: var(--on-surface-muted); background: var(--surface); }
.quote-intro .direct { color: var(--on-surface); background: var(--surface); line-height: 1.9; }
.quote-intro a { color: var(--on-surface); background: var(--surface); font-weight: 600; }
.form { display: grid; gap: 1.25rem; }
.field { display: grid; gap: .45rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.field label, .field legend { font-weight: 600; color: var(--on-surface); background: var(--surface); padding: 0; }
.opt, .help { font-weight: 400; color: var(--on-surface-muted); background: var(--surface); font-size: .9375rem; }
input[type=text], input[type=tel], input[type=email], textarea {
  width: 100%; min-height: 48px; padding: .7rem .85rem;
  font: inherit; color: var(--on-field); background: var(--field);
  border: 2px solid var(--wire); border-radius: var(--radius);
}
textarea { resize: vertical; }
.field { position: relative; }
div.field::after { content: ""; grid-row: 2; grid-column: 1; align-self: end; height: 3px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--snap); pointer-events: none; }
div.field:focus-within::after { transform: scaleX(1); }
div.field > input, div.field > textarea { grid-row: 2; grid-column: 1; }
input:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); }
[aria-invalid=true] { border-color: var(--error); }
.err { color: var(--error); background: var(--surface); font-size: .9375rem; }
.choice { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; }
.choice label { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; }
input[type=radio] { width: 20px; height: 20px; accent-color: var(--accent); }
.success { position: relative; padding: 1.25rem 1.25rem 1.25rem 1.5rem; background: var(--bg); color: var(--on-bg); }
.success::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); transform-origin: top; }
.ok-head { display: flex; align-items: center; gap: .5rem; }
.tick { width: 1.4rem; height: 1.4rem; fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: square; }
.success p + p { margin-top: .25rem; }
.form :is(input, textarea, .success) { scroll-margin-bottom: 6rem; }

/* Footer */
.foot { padding: 3rem 0 6.5rem; border-top: 1px solid var(--line); color: var(--on-bg-muted); background: var(--bg); font-size: .9375rem; }
.foot-grid { display: grid; gap: 1.75rem; }
.foot p + p { margin-top: .35rem; }
.foot-name { font: 900 1.5rem/1 var(--display); text-transform: uppercase; color: var(--on-bg); background: var(--bg); margin-bottom: .5rem; }
.privacy-link { max-width: 1240px; margin: 1.5rem auto 0; padding: 0 1rem; }
.privacy h2 { font-size: 1.25rem; color: var(--on-bg); background: var(--bg); margin-bottom: .4rem; }

/* Mobile dock: bottom, so the top ribbon and the dock never overlap */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr 1fr; gap: .5rem;
  padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom));
  background: var(--bg); color: var(--on-bg); border-top: 1px solid var(--line);
}
.dock .btn { width: 100%; }

/* ============================================================
   Motion layer. Everything below is enhancement: with no JS or
   reduced motion, every element sits in its final state.
   ============================================================ */

/* Signature: the live wire. Wires draw from the supply, a spark of
   current runs the live conductor, and the hot line of the headline
   energises as it lands. All done by ~1.2s; text readable from frame 1. */
.spark { stroke: var(--on-bg); stroke-width: 7; stroke-dasharray: 0 1; opacity: 0; }
.hot::after {
  content: attr(data-text);
  content: attr(data-text) / "";
  position: absolute; inset: 0;
  color: var(--accent); background: var(--bg);
  pointer-events: none;
}
.n { transform-box: fill-box; transform-origin: center; }

@media (prefers-reduced-motion: no-preference) {
  .hot { color: var(--on-bg-muted); background: var(--bg); }
  .hot::after { animation: energise .45s var(--snap) .55s both; }
  .w { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .65s cubic-bezier(.3, 0, .2, 1) forwards; }
  .w-n { animation-delay: .05s; }
  .w-l { animation-delay: .1s; }
  .w-b { animation-delay: .7s; animation-duration: .4s; }
  .spark {
    stroke-dasharray: .1 1.2;
    filter: drop-shadow(0 0 6px var(--accent));
    animation: spark .55s cubic-bezier(.5, 0, .3, 1) .45s;
  }
  .n { animation: node .3s var(--snap) both; }
  .n:nth-child(1) { animation-delay: .85s; }
  .n:nth-child(2) { animation-delay: .89s; }
  .n:nth-child(3) { animation-delay: .93s; }
  .n:nth-child(4) { animation-delay: .8s; }
  .n:nth-child(5) { animation-delay: 1.05s; }
  .term { animation: fade .3s ease-out .9s both; }

  /* Hover or focus the call button and current runs again. */
  .hero:has(.cta-row .btn-accent:is(:hover, :focus-visible)) .spark {
    animation: spark .8s cubic-bezier(.5, 0, .3, 1) infinite;
  }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes spark {
  0% { stroke-dashoffset: .1; opacity: 1; }
  92% { opacity: 1; }
  100% { stroke-dashoffset: -1.02; opacity: 0; }
}
@keyframes energise {
  from { clip-path: inset(-10% 100% -10% 0); }
  to { clip-path: inset(-10% 0 -10% 0); }
}
@keyframes node { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.thread { display: none; }

/* Play glyph on the video plate */
.play { width: 56px; height: 56px; position: absolute; top: 1.25rem; left: 1.25rem; fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; }

/* ---------- Scroll choreography ----------
   Two paths, same end state:
   1. Browsers with scroll-driven animations scrub reveals to scroll position.
   2. Others: app.js adds .in via IntersectionObserver; time-based with an 80ms stagger.
   Hidden states only exist under html.js. */
@keyframes rise { from { opacity: 0; transform: translateY(18px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes meter { from { clip-path: inset(100% 0 -5% 0); transform: translateY(.18em); } to { clip-path: inset(-5% 0 -5% 0); transform: none; } }
@keyframes head { from { clip-path: inset(0 0 100% 0); transform: translateY(-.25em); opacity: 0; } to { clip-path: inset(-.2em 0 -.2em 0); transform: none; opacity: 1; } }
@keyframes wipe { from { clip-path: inset(-10% 100% -10% 0); } to { clip-path: inset(-10% -2% -10% 0); } }
@keyframes wire-y { from { transform: scaleY(0); } to { transform: none; } }
@keyframes wire-x { from { transform: scaleX(0); } to { transform: none; } }
@keyframes phone { from { opacity: 0; transform: translateY(28px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes trace { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

.play circle, .play path { stroke-dasharray: 1; }

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    html.js .rv, html.js .rv-head, html.js .rv-meter, html.js .rv-phone,
    html.js .rv-wire, html.js .rv-wire::before, html.js .svc-word,
    html.js .svc-row::before, html.js .play circle, html.js .play path {
      animation-timeline: view();
      animation-fill-mode: both;
      animation-timing-function: var(--snap);
      animation-duration: 1ms; /* required by Firefox; the timeline sets the pace */
    }
    html.js .rv { animation-name: rise; animation-range: entry calc(var(--i, 0) * 7%) entry calc(55% + var(--i, 0) * 7%); }
    html.js .rv-head { animation-name: head; animation-range: entry 10% entry 70%; }
    html.js .rv-meter { animation-name: meter; animation-range: entry 0% entry 90%; }
    html.js .rv-phone { animation-name: phone; animation-range: entry 0% entry 60%; }
    html.js .rv-wire { animation-name: rise; animation-range: entry calc(var(--i) * 8%) entry calc(50% + var(--i) * 8%); }
    html.js .rv-wire::before { animation-name: wire-y; }
    html.js .svc-row { view-timeline-name: --row; }
    html.js .svc-word { animation-name: wipe; animation-timeline: --row; animation-range: entry 20% cover 35%; }
    html.js .svc-row::before { animation-name: wire-x; animation-timeline: --row; animation-range: entry 0% entry 80%; }
    html.js .play circle { animation-name: trace; animation-timeline: --plate; animation-range: entry 30% cover 45%; }
    html.js .play path { animation-name: trace; animation-timeline: --plate; animation-range: entry 45% cover 50%; }
    html.js .rv-phone { view-timeline-name: --plate; }
    html.js .rv-wire::before { animation-range: entry 0% entry 100%; }

    /* Progress thread: a wire down the left edge that fills as you read. */
    .thread {
      display: block; position: fixed; z-index: 15; left: 0; top: 0; bottom: 0; width: 3px;
      background: var(--accent); transform-origin: top; pointer-events: none;
      animation: wire-y linear both; animation-duration: 1ms; animation-timeline: scroll(root);
    }
  }

  @supports not (animation-timeline: view()) {
    html.js .rv, html.js .rv-wire { opacity: 0; transform: translateY(18px); transition: opacity .5s var(--snap), transform .6s var(--snap); transition-delay: calc(var(--i, 0) * 80ms); }
    html.js .rv-phone { opacity: 0; transform: translateY(28px) scale(.96); transition: opacity .5s var(--snap), transform .7s var(--snap); }
    html.js .rv-head { clip-path: inset(0 0 100% 0); transform: translateY(-.25em); transition: clip-path .6s var(--snap), transform .6s var(--snap); }
    html.js .rv-meter { clip-path: inset(100% 0 -5% 0); transform: translateY(.18em); transition: clip-path .8s var(--snap), transform .8s var(--snap); }
    html.js .rv-wire::before { transform: scaleY(0); transition: transform .5s var(--snap); transition-delay: calc(var(--i, 0) * 80ms); }
    html.js .svc-row .svc-word { clip-path: inset(-10% 100% -10% 0); transition: clip-path .7s var(--snap), transform .3s var(--snap); transition-delay: calc(var(--i, 0) * 90ms), 0s; }
    html.js .svc-row::before { transform: scaleX(0); transition: transform .6s var(--snap); }
    html.js .play circle, html.js .play path { stroke-dashoffset: 1; transition: stroke-dashoffset .7s var(--snap) .3s; }
    html.js .play path { transition-delay: .6s; }
    html.js .in.rv, html.js .in.rv-wire, html.js .in.rv-phone { opacity: 1; transform: none; }
    html.js .in.rv-head, html.js .in.rv-meter { clip-path: inset(-.2em 0 -.2em 0); transform: none; }
    html.js .in.rv-wire::before, html.js .svc-row.in::before { transform: none; }
    html.js .svc-row.in .svc-word { clip-path: inset(-10% -2% -10% 0); }
    html.js .svc-row.in:hover .svc-word { transform: translateX(.12em); }
    html.js .in .play circle, html.js .in .play path { stroke-dashoffset: 0; }
  }

  /* Form feedback */
  .err:not([hidden]) { animation: rise .25s var(--snap); }
  input[aria-invalid=true], textarea[aria-invalid=true] { animation: nudge .3s var(--snap); }
  .success:not([hidden]) { animation: rise .35s var(--snap); }
  .success:not([hidden])::before { animation: wire-y .4s var(--snap) .1s both; }
  .success:not([hidden]) .tick path { stroke-dasharray: 1; animation: trace .35s var(--snap) .3s both; }

  /* Mobile dock arrives once the hero call button scrolls away. */
  html.js .dock { transform: translateY(110%); transition: transform .35s var(--snap); }
  html.js .dock.on { transform: none; }
}
@keyframes nudge { 25% { transform: translateX(-4px); } 75% { transform: translateX(3px); } }

@media (min-width: 768px) {
  .wrap { padding: 0 2rem; }
  .nav { display: flex; }
  .hero { padding: 4rem 0 2rem; }
  .hero-grid { grid-template-columns: 1.25fr 1fr; align-items: center; gap: 2rem; }
  .sig { margin: 0; max-height: 520px; }
  .sig svg { max-height: 520px; }
  .proof { padding: 5rem 0; }
  .proof-grid { grid-template-columns: 1.4fr 1fr; align-items: end; gap: 4rem; }
  .services, .watch { padding: 5.5rem 0; }
  .svc-row { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: end; gap: 2rem; }
  .split { grid-template-columns: 1fr 1fr; }
  .watch-grid { grid-template-columns: 300px 1fr; align-items: center; gap: 5rem; }
  .phone-plate { margin: 0; }
  .quote { padding: 5.5rem 0; }
  .quote-grid { grid-template-columns: 1fr 1.2fr; gap: 4rem; }
  .form { padding: 2rem; background: var(--bg); color: var(--on-bg); border: 1px solid var(--line); }
  .form .field label, .form .field legend { background: var(--bg); color: var(--on-bg); }
  .form .opt, .form .help { background: var(--bg); color: var(--on-bg-muted); }
  .form .err { background: var(--bg); color: var(--error); }
  .foot { padding-bottom: 3rem; }
  .privacy-link { padding: 0 2rem; }
  .foot-grid { grid-template-columns: 1.3fr 1fr 1.3fr; }
  .dock { display: none; }
}

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