/* =========================================================
   J.C. Electrical Services — Global Stylesheet
   One stylesheet to keep formatting consistent site-wide
   ========================================================= */

/* ---------- Design Tokens ---------- */
/* ---------- Theme Tokens ---------- */
:root{
  /* shared */
  --brand: #6d28d9;
  --brand-2: #a78bfa;
  --accent: #22c55e;

  --shadow: 0 10px 30px rgba(0,0,0,.18);
  --radius: 18px;
  --radius-sm: 12px;

  --max: 1100px;
  --pad: 20px;

  --h1: clamp(34px, 4.6vw, 52px);
  --h2: clamp(24px, 3.2vw, 34px);
  --h3: 20px;
  --p: 16px;

  --line: 1.6;
  --speed: 160ms;

  /* dark defaults */
  --bg: #0b0f14;
  --surface: #101826;
  --surface-2: #0f1722;
  --text: #e8eef7;
  --muted: #b8c4d8;
  --border: rgba(255,255,255,.10);
  --headerBg: rgba(11,15,20,.65);
}

/* Light theme overrides */
:root[data-theme="light"]{
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f1f5fb;
  --text: #0b1220;
  --muted: #3b475b;
  --border: rgba(15, 23, 42, .12);
  --headerBg: rgba(246,248,252,.75);
  --shadow: 0 10px 30px rgba(2,6,23,.10);
}


/* ---------- Base Reset ---------- */
*{ box-sizing: border-box; }
html,body{ height: 100%; }
body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--text);
  line-height: var(--line);
}

img{ max-width: 100%; display: block; }
a{ color: inherit; text-decoration: none; }
p{ margin: 0 0 14px; font-size: var(--p); color: var(--muted); }
h1,h2,h3{ margin: 0 0 12px; line-height: 1.15; color: var(--text); }
h1{ font-size: var(--h1); letter-spacing: -.02em; }
h2{ font-size: var(--h2); letter-spacing: -.01em; }
h3{ font-size: var(--h3); }

/* ---------- Layout Helpers ---------- */
.container{
  width: min(var(--max), 100% - 2*var(--pad));
  margin-inline: auto;
}
.section{ padding: 70px 0; }
.card{
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
:root[data-theme="light"] .card{
  background: linear-gradient(180deg, rgba(255,255,255,1), rgba(241,245,251,1));
}
.card-pad{ padding: 22px; }

/* ---------- Grid Helpers ---------- */
.grid{
  display: grid;
  gap: 18px;
}
.grid-2{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 880px){
  .grid-2,.grid-3{ grid-template-columns: 1fr; }
  .section{ padding: 56px 0; }
}

/* Grid helper: span full width */
.span-2{
  grid-column: 1 / -1;
}
/* ---------- Header / Nav ---------- */
.site-header{
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: transparent;         /* important */
  backdrop-filter: none;           /* important */
  -webkit-backdrop-filter: none;   /* important */
  isolation: isolate;              /* keeps layers stable */
  background-color: #3C1048;
}

/* Disable header overlay layer (we're using a solid brand header) */
.site-header::before{
  content: none !important;
}

.navbar{
  display: flex;
  align-items: center;
  justify-content: flex-start; /* NOT space-between */
  gap: 86px;
  padding: 10px 0;
}
.brand{
  display: flex;
  align-items: center;
  gap: 1px;
  min-width: 220px;
  flex: 0 0 auto;
}
/* Brand logo sizing */
.brand img{
  height: 150px;          /* was likely ~40–44px */
  width: auto;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
}
@media (min-width: 880){
  .brand img{ height: 120px; }
  .navbar{ padding: 8px 0; }
}

.brand .title{
  min-width: none;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand .title strong{ font-size: 24px; }
.brand .title span{ font-size: 12px; color: var(--muted); white-space: nowrap; }

.nav-links{
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav-links a{
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  transition: background var(--speed), color var(--speed), transform var(--speed);
}
.nav-links a:hover{
  background: rgba(255,255,255,.06);
  color: var(--text);
}
.nav-links a.active{
  background: rgba(109,40,217,.18);
  color: var(--text);
  border: 1px solid rgba(167,139,250,.25);
}

@media (max-width: 880px){
  .navbar{ align-items: flex-start; }
  .nav-links{ justify-content: flex-start; }
}

/* ---------- Buttons ---------- */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform var(--speed), background var(--speed), border-color var(--speed), opacity var(--speed);
  font-weight: 650;
  letter-spacing: .01em;
  user-select: none;
}
.btn:active{ transform: translateY(1px); }
.btn-primary{
  background: linear-gradient(180deg, rgba(109,40,217,.95), rgba(109,40,217,.65));
  border-color: rgba(167,139,250,.35);
  color: white;
}
.btn-primary:hover{ opacity: .95; }
.btn-ghost{
  background: rgba(255,255,255,.04);
  color: var(--text);
}
.btn-ghost:hover{ background: rgba(255,255,255,.07); }
.btn-accent{
  background: linear-gradient(180deg, rgba(34,197,94,.95), rgba(34,197,94,.55));
  border-color: rgba(34,197,94,.35);
  color: #06210f;
}

/* ---------------------------------
   Trust Strip (below header, site-wide)
---------------------------------- */
.trust-strip-wrap{
  background: transparent;
}

.trust-strip{
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 14px;

  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  border-left: 4px solid #3C1048;

  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;

  font-size: 13.5px;
  line-height: 1.35;
}

.trust-strip strong{
  font-weight: 750;
  color: #ffffff;
}

.trust-strip span{
  color: rgba(255,255,255,0.88);
}

/* Light mode */
:root[data-theme="light"] .trust-strip{
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(15,23,42,0.12);
  border-left: 4px solid #3C1048;
}

:root[data-theme="light"] .trust-strip strong{
  color: #0b1220;
}

:root[data-theme="light"] .trust-strip span{
  color: rgba(15,23,42,0.75);
}

/* Mobile tightening */
@media (max-width: 520px){
  .trust-strip{
    font-size: 13px;
    padding: 9px 10px;
  }
}

/* ---------- Hero ---------- */
.hero{
  padding: 72px 0 46px;
}
.hero-inner{
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 18px;
  align-items: center;
}
.hero .lead{
  font-size: 18px;
  color: var(--muted);
  max-width: 60ch;
}
.hero-actions{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.hero-badges{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.badge{
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
.hero-side{
  padding: 18px;
}
.kpi{
  display: grid;
  gap: 10px;
}
.kpi .row{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(0,0,0,.18);
  border: 1px solid var(--border);
}
.kpi .row strong{ color: var(--text); }
.kpi .row span{ color: var(--muted); font-size: 14px; }

@media (max-width: 880px){
  .hero-inner{ grid-template-columns: 1fr; }
}

/* ----------Signature --------*/
.signature{
  margin-top: 14px;
  margin-bottom: 2px;
  font-family: "Ms Madi", cursive;
  font-size: 26px;          /* slightly larger looks more natural */
  color: var(--text);
  letter-spacing: 0.02em;
}

.signature + .small{
  margin-top: 0;
  opacity: 0.85;
}

/* ---------- Forms ---------- */
.form{
  display: grid;
  gap: 12px;
}
.label{
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.input, .textarea, .select{
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.22);
  color: var(--text);
  outline: none;
}
.textarea{ min-height: 120px; resize: vertical; }
.help{
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.form-actions{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ---------- Footer ---------- */
.site-footer{
  border-top: 1px solid var(--border);
  background: rgba(109,40,217,.10);
  padding: 34px 0;
}
.footer-grid{
  display: grid;
  gap: 14px;
  grid-template-columns: 1.25fr .75fr;
  align-items: start;
}
.footer-grid a{ color: var(--muted); }
.footer-grid a:hover{ color: var(--text); }
.small{ font-size: 12px; color: var(--muted); }
@media (max-width: 880px){
  .footer-grid{ grid-template-columns: 1fr; }
}

/* ---------- Utility ---------- */
.hr{ height: 1px; background: var(--border); margin: 16px 0; }
.note{
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(167,139,250,.25);
  background: rgba(109,40,217,.10);
  color: var(--muted);
}
.success{
  border-color: rgba(34,197,94,.30);
  background: rgba(34,197,94,.10);
}
.warn{
  border-color: rgba(245,158,11,.30);
  background: rgba(245,158,11,.10);
}
.error{
  border-color: rgba(239,68,68,.30);
  background: rgba(239,68,68,.10);
}
@media (max-width: 480px){
  .note{ padding: 10px 12px; }
  .btn{ width: 100%; }
}

/* ---------------------------------
   Theme transition (smooth)
---------------------------------- */
/* Theme transition only when user toggles */
html.theme-animate,
html.theme-animate body,
html.theme-animate .site-header,
html.theme-animate .card,
html.theme-animate .nav-links a,
html.theme-animate .badge,
html.theme-animate .input,
html.theme-animate .textarea,
html.theme-animate .select,
html.theme-animate .note,
html.theme-animate .btn {
  transition:
    background-color 220ms ease,
    color 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease,
    filter 220ms ease,
    fill 220ms ease;
}


/* ---------------------------------
   Bulb toggle styling
---------------------------------- */
:root{
  --bulbColor: #facc15; /* yellow for dark theme */
  --bulbGlow: drop-shadow(0 0 10px rgba(250, 204, 21, .25));
}

:root[data-theme="light"]{
  --bulbColor: #94a3b8; /* gray for light theme */
  --bulbGlow: none;
}

#themeToggle{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 650;
}

#themeToggle .bulb{
  width: 18px;
  height: 18px;
  display: inline-block;
  filter: var(--bulbGlow);
}

#themeToggle .bulb path{
  fill: var(--bulbColor);
  transition: fill 220ms ease, filter 220ms ease;
}
html { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root:not([data-theme="light"]) { color-scheme: dark; }

/* -----------------------------------------------------------------------
Services card formatting
/* ----------------------------------------------------------------------- */
/* Two-column services list inside a card */
.services-two-col{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
  margin-top: 12px;
}

.services-two-col ul{
  margin: 0;
  padding-left: 18px;
}

.services-two-col li{
  margin: 6px 0;
  color: var(--muted);
  font-size: var(--p);
}

/* Mobile: collapse to one column */
@media (max-width: 640px){
  .services-two-col{
    grid-template-columns: 1fr;
  }
}

/* -------------- Card with image padding ----------- */
/* Full-card circuit background with left-side fade (text stays readable) */
.card.services-bg-full{
  position: relative;
  overflow: hidden;
}

/* Background art layer */
.card.services-bg-full::after{
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../assets/circuit-traces-angled.svg");
  background-repeat: no-repeat;
  background-position: 80% center;
  background-size: 45%, auto;
  opacity: 0.10;                 /* base strength (we control visibility with mask below) */
  pointer-events: none;
  z-index: 0;
}

/* Fade mask: stronger cover on LEFT, less cover toward MIDDLE/RIGHT */
.card.services-bg-full::before{
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;

  /* This overlay hides the background more on the left,
     then gradually reveals it toward the middle/right. */
  background: linear-gradient(
    90deg,
    rgba(0,0,0,0.65) 0%,
    rgba(255,255,255,0.12) 24%,
    rgba(255,255,255,0.38) 46%,
    rgba(255,255,255,0.65) 72%,
    rgba(255,255,255,0.9) 100%
  );
}

/* Keep card content above the layers */
.card.services-bg-full > *{
  position: relative;
  z-index: 2;
}

/* DARK mode: use a dark veil so traces stay subtle behind light text */
:root:not([data-theme="light"]) .card.services-bg-full::before{
  background: linear-gradient(
    90deg,
    rgba(0,0,0,0.55) 0%,
    rgba(0,0,0,0.40) 22%,
    rgba(0,0,0,0.18) 45%,
    rgba(0,0,0,0.05) 70%,
    rgba(0,0,0,0.00) 100%
  );
}

/* NOTE: SVG background renders black by default — filter used for dark mode */
:root:not([data-theme="light"]) .card.services-bg-full::after{
  filter: invert(1) brightness(1.1) contrast(0.95);
  color: rgba(255,255,255,0.9);
  opacity: 0.10;
}

/* LIGHT mode: use a light veil so traces don’t muddy the background */
:root[data-theme="light"] .card.services-bg-full::before{
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.85) 0%,
    rgba(255,255,255,0.65) 24%,
    rgba(255,255,255,0.38) 46%,
    rgba(255,255,255,0.12) 54%,
    rgba(0, 0, 0, 0) 70%
  );
}

/* Remove the filter for light mode (SVG shows correctly on light bg) */
:root[data-theme="light"] .card.services-bg-full::after{
  filter: none;
  color: rgba(0,0,0,0.9);
  opacity: 0.08;
}

/* -----------------------------------------------------------------------
    Fixes for Bugs
/* -----------------------------------------------------------------------
/* ---------------------------------
   Header text stability
   Prevent text re-rasterization flash
---------------------------------- */  
/* Prevent brief text flash during theme switch (header brand text) */
.brand .title,
.brand .title strong,
.brand .title span{
  transition: none !important;          /* don’t animate these */
  -webkit-font-smoothing: antialiased;  /* stabilize */
  text-rendering: geometricPrecision;   /* stabilize */
}

/* Reduce flicker from GPU composition in sticky + blur headers */
.site-header,
.brand{
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.brand, .brand .title{
  position: relative;
  z-index: 1;
  transform: translateZ(0);
  will-change: transform;
}
.brand .title strong, .brand .title span{
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}
/* ---------------------------------
   Header text stability (Edge fix)
   Prevent text re-rasterization flash
---------------------------------- */
.site-header *{
  transition-property: background-color, border-color, box-shadow, filter, fill;
}
.first-line{
  text-indent: 2em;
  font-size: smaller;
}
.clean-list{ margin: 12px 0 0; padding-left: 18px; }
.clean-list li{ margin: 8px 0; color: var(--muted); }
/* ---------------------------------
   Theme toggle label fix
   Prevent flicker when toggling themes
---------------------------------- */
/* Theme toggle label: no JS flicker */
#themeToggle .toggleText { display: inline-flex; }
#themeToggle .label-dark,
#themeToggle .label-light { display: none; }

/* If current theme is DARK, show "Light Mode" */
html:not([data-theme="light"]) #themeToggle .label-dark { display: inline; }

/* If current theme is LIGHT, show "Dark Mode" */
html[data-theme="light"] #themeToggle .label-light { display: inline; }
.site-header{
  background-color: #3C1048 !important;
}

/* =========================================
   Light mode: make header readable on purple
   ========================================= */
html[data-theme="light"] .site-header,
html[data-theme="light"] .site-header a,
html[data-theme="light"] .site-header .brand,
html[data-theme="light"] .site-header .title{
  color: #fff !important;
}

/* Nav links need a visible “hit box” in light mode */
html[data-theme="light"] .site-header .nav-links a{
  color: #fff !important;
  opacity: 0.95;
}

html[data-theme="light"] .site-header .nav-links a:hover{
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 6px;
}

/* If you use aria-current for active page, make it pop */
html[data-theme="light"] .site-header .nav-links a[aria-current="page"]{
  opacity: 1;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 6px;
}

/* Buttons inside the header (including the theme toggle) */
html[data-theme="light"] .site-header .btn{
  color: #fff !important;
  border-color: rgba(255,255,255,0.55) !important;
  background: rgba(255,255,255,0.12) !important;
}

html[data-theme="light"] .site-header .btn:hover{
  background: rgba(255,255,255,0.18) !important;
  border-color: rgba(255,255,255,0.70) !important;
}

/* Header tagline contrast fix */
.site-header .tagline{
  display: block;
  margin-top: 2px;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.85);
}

/* Keep it readable in light mode on purple header */
html[data-theme="light"] .site-header .tagline{
  color: rgba(255,255,255,0.85) !important;
}

/* Header should span full width (don’t constrain to --max) */
.site-header .container{
  width: 100%;
  max-width: none;
  padding-left: var(--pad);
  padding-right: var(--pad);
}
/* Align nav with body content while header stays full-width */
.site-header .nav-wrap{
  max-width: var(--max);
  width: 100%;
  display: grid;
  justify-content: flex-end;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 24px;
/* Right side of header: nav on top, theme button below */
  max-width: var(--max);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;     /* pushes everything to the far right */
  gap: 8px;                  /* space between links and button */
  row-gap: 16px;
}

/* Keep links right-aligned */
.site-header .nav-links{
  grid-column: 1;
  grid-row: 1;
  justify-content: flex-start;
}
/* Nav links sit closer to logo */

/* Ensure the toggle sits at the far right under the links */
.site-header #themeToggle{
  align-self: flex-end;
/* Theme toggle pinned far right, below links */
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
}

/* ===== Header nav positioning override ===== */
/* nav links move LEFT toward logo, theme toggle stays RIGHT below */

.site-header .nav-wrap{
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;   /* do NOT right-align the whole block */
  width: auto !important;            /* prevent full-width “right block” behavior */
}

/* Links row sits left (closer to logo) */
.site-header .nav-links{
  justify-content: flex-start !important;
  align-self: flex-start !important;
}

/* Theme toggle sits below and far right */
.site-header #themeToggle{
  align-self: flex-end !important;
  margin-top: 8px;
}

/* Quick Info Border */
.quick-info{
  border-left: 4px solid #3C1048;
}

/* Optional: subtle accent for About page trust cards */
.card h2 + p{
  margin-bottom: 16px;
}

/* End of stylesheet */

