/* ══════════════════════════════════════════════════════════════════════════════
   Cao's Electrical Inc.
   Palette is pulled off the equipment: enclosure graphite, conductor copper,
   hot-wire red (which is also the auspicious red the neighborhood reads),
   energized amber, ground green. Nothing here is decorative for its own sake.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
  --ink:      #14171C;   /* panel enclosure */
  --ink-2:    #1E232B;
  --ink-3:    #2A313B;
  --paper:    #EDEFF2;   /* deadfront grey */
  --paper-2:  #F8F9FB;
  --line:     #C9D0D8;
  --line-dk:  #333B46;
  --muted:    #5C6673;
  --muted-dk: #8E99A6;
  --hot:      #C8102E;   /* hot conductor */
  --hot-lo:   #A50D26;
  --copper:   #B4703A;   /* conductor — surfaces and rules only, never text */
  --copper-ink: #8F5424; /* the same copper, darkened to clear AA on light ground */
  --copper-lt:  #C98A4E; /* and lightened to clear AA on the enclosure dark */
  --live:     #F2C14E;   /* energized */
  --ground:   #2E7D51;

  --disp: "Saira Condensed", "Noto Sans SC", system-ui, sans-serif;
  --body: "Public Sans", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --wrap: 1140px;
  --pad: clamp(1.25rem, 5vw, 3rem);
  --gap: clamp(3.5rem, 8vw, 7rem);
}

/* Throwing a breaker in the hero inverts the page. Rather than restate every rule for
   a second scheme, the base tokens swap roles — so --ink is always "the far end of the
   contrast from the page ground", and every rule below follows automatically. */
[data-theme="dark"] {
  --ink:        #EDEFF2;
  --ink-2:      #E3E7EC;
  --ink-3:      #D6DCE3;
  --paper:      #14171C;
  --paper-2:    #1B2027;
  --line:       #3D4653;
  --line-dk:    #C9D0D8;
  --muted:      #98A2AE;
  --muted-dk:   #5C6673;
  --copper-ink: #C98A4E;
  --copper-lt:  #8F5424;
  --hot-text:   #FF6257;
  --live-text:  #8F5424;  /* the band is light now; amber would vanish on it */
}

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

/* Layout classes below set display on elements that also carry [hidden];
   without this the attribute loses and the row leaks onto the page. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 clamp(1rem, .96rem + .2vw, 1.0625rem)/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
}

/* Language switch. Both languages ship in the HTML so both are crawlable;
   only the inactive one is hidden. */
[data-lang="en"] .zh,
[data-lang="zh"] .en { display: none; }

:where(.zh), :where([lang="zh-Hans"]) { font-family: var(--body); letter-spacing: .01em; }

/* Chinese has no inter-word spaces, so a long heading will break mid-word. Phrases
   that must stay whole are wrapped in .nb — it is a grouping hook, not emphasis. */
.nb { white-space: nowrap; font-weight: inherit; }
[data-lang="zh"] .h1, [data-lang="zh"] .h2 { letter-spacing: .005em; line-height: 1.25; }
[data-lang="zh"] .h1 { font-size: clamp(1.95rem, 1.25rem + 3vw, 3.3rem); }
[data-lang="zh"] .h2 { font-size: clamp(1.6rem, 1.2rem + 1.7vw, 2.5rem); }

a { color: inherit; }
img, svg { max-width: 100%; }

.wrap { width: min(var(--wrap), 100%); margin-inline: auto; padding-inline: var(--pad); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--hot); color: #fff; padding: .75rem 1.25rem; font-weight: 600;
}
.skip:focus { left: 0; }

:focus-visible { outline: 3px solid var(--copper); outline-offset: 3px; border-radius: 2px; }

/* ── Type ─────────────────────────────────────────────────────────────────── */

.h1 {
  font: 700 clamp(2.5rem, 1.4rem + 5.2vw, 5rem)/.98 var(--disp);
  letter-spacing: -.015em;
  margin: 0 0 1.25rem;
  text-wrap: balance;
}
.h2 {
  font: 700 clamp(1.9rem, 1.3rem + 2.4vw, 3.1rem)/1.04 var(--disp);
  letter-spacing: -.01em;
  margin: 0 0 .75rem;
  text-wrap: balance;
}

.eyebrow, .label {
  font: 500 .75rem/1 var(--mono);
  letter-spacing: .22em;
  text-transform: uppercase;
  margin: 0 0 1.25rem;
  display: flex; align-items: center; gap: .7rem;
}
.eyebrow::before, .label::before {
  content: ""; width: 1.75rem; height: 2px; background: var(--copper); flex: none;
}
.label { color: var(--copper-ink); }
.eyebrow { color: var(--live-text); }
[data-lang="zh"] .eyebrow, [data-lang="zh"] .label { letter-spacing: .12em; }

.lede { font-size: clamp(1.06rem, 1rem + .4vw, 1.3rem); line-height: 1.6; margin: 0 0 2rem; max-width: 46ch; }
.sub  { color: var(--muted); margin: 0 0 2.5rem; max-width: 52ch; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  --bh: 2.75rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: var(--bh); padding: 0 1.15rem;
  font: 600 .95rem/1 var(--body);
  text-decoration: none; white-space: nowrap; border: 1.5px solid transparent;
  border-radius: 3px; cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
}
.btn--lg { --bh: 3.4rem; padding: 0 1.6rem; font-size: 1.03rem; }
.btn:active { transform: translateY(1px); }

.btn--hot { background: var(--hot); color: #fff; }
.btn--hot:hover { background: var(--hot-lo); }

.btn--ghost { border-color: currentColor; color: inherit; }
.hero .btn--ghost { color: var(--paper); }
.hero .btn--ghost:hover { background: var(--paper); color: var(--ink); }
.sec--contact .btn--ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.btn__i { width: 1.05em; height: 1.05em; fill: currentColor; flex: none; }
.cta { display: flex; flex-wrap: wrap; gap: .75rem; }

/* ── Top bar ──────────────────────────────────────────────────────────────── */

.bar { background: var(--ink); color: var(--paper); position: sticky; top: 0; z-index: 50;
       border-bottom: 1px solid var(--line-dk); }
.bar__in {
  width: min(var(--wrap), 100%); margin-inline: auto; padding: .7rem var(--pad);
  display: flex; align-items: center; gap: 1rem; justify-content: space-between;
}
.bar__right { display: flex; align-items: center; gap: .85rem; }

.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand__mark {
  width: 1.7rem; height: 1.7rem; flex: none; border-radius: 3px;
  background: #2A313B; border: 1px solid #39424E;
  display: grid; place-items: center;
}
.brand__mark i { width: 5px; height: 10px; border-radius: 1px; background: var(--live);
                 box-shadow: 0 0 8px rgba(242,193,78,.55); display: block; }
.brand__name { font: 700 1.02rem/1 var(--disp); letter-spacing: .01em; text-transform: uppercase; }
.brand__name em { font-style: normal; color: var(--muted-dk); font-weight: 600; }
[data-lang="zh"] .brand__name { font-family: var(--body); font-size: .95rem; text-transform: none; }
[data-lang="zh"] .brand__name em { font-size: .78rem; }

.status { display: flex; align-items: center; gap: .45rem; margin: 0;
          font: 500 .78rem/1 var(--mono); color: var(--muted-dk); white-space: nowrap; }
.status__dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--muted); flex: none; }
.status[data-open="yes"] .status__dot { background: var(--ground); box-shadow: 0 0 0 3px rgba(46,125,81,.22); }
.status[data-open="yes"] .status__text { color: var(--paper); }

.lang { display: flex; border: 1px solid var(--line-dk); border-radius: 3px; overflow: hidden; }
.lang__btn {
  appearance: none; border: 0; background: transparent; color: var(--muted-dk);
  font: 600 .8rem/1 var(--body); padding: .45rem .6rem; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.lang__btn + .lang__btn { border-left: 1px solid var(--line-dk); }
.lang__btn:hover { color: var(--paper); }
.lang__btn[aria-pressed="true"] { background: var(--paper); color: var(--ink); }

/* ── Hero ─────────────────────────────────────────────────────────────────── */

.hero { background: var(--ink); color: var(--paper); overflow: hidden;
        border-bottom: 3px solid var(--hot); }
.hero__in {
  width: min(var(--wrap), 100%); margin-inline: auto; padding: clamp(3rem,7vw,5.5rem) var(--pad) clamp(3.5rem,8vw,6rem);
  display: grid; gap: clamp(2.5rem, 6vw, 4.5rem); align-items: center;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
}
.hero__hours { margin: 1.75rem 0 0; font: 500 .88rem/1.5 var(--mono); color: var(--muted-dk); }
[data-lang="zh"] .hero__hours { font-family: var(--body); }

/* The load center. Breakers energize top-down on load; the eye follows the bus. */
.hero__panel { display: grid; place-items: center; gap: 1rem; }
.lc__hint {
  margin: 0; max-width: 22ch; text-align: center;
  font: 500 .78rem/1.5 var(--mono); color: var(--muted-dk);
}
[data-lang="zh"] .lc__hint { font-family: var(--body); }
.lc {
  width: min(300px, 100%); background: linear-gradient(180deg, #232A33, #1A1F26);
  border: 1px solid #39424E; border-radius: 5px; padding: .85rem;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.06);
}
.lc__plate {
  display: flex; justify-content: space-between; align-items: center;
  font: 500 .58rem/1 var(--mono); letter-spacing: .16em; color: var(--muted-dk);
  border-bottom: 1px solid #39424E; padding-bottom: .7rem; margin-bottom: .85rem;
}
.lc__amp { color: var(--copper-lt); }
.lc__main { display: flex; justify-content: center; margin-bottom: .9rem; }
.lc__bus { display: grid; grid-template-columns: 1fr auto 1fr; gap: .6rem; }
.lc__col { display: grid; gap: .5rem; }
.lc__spine { width: 3px; border-radius: 2px; background: linear-gradient(180deg, var(--copper), #6B421F); opacity: .8; }

/* A breaker: the handle sits near the centre bus and throws a short distance
   toward it, the way a real load centre does; the indicator window sits out at
   the far edge so it stays readable once the handle lands. */
.sw {
  display: block; width: 100%; height: 1.55rem; padding: 0;
  border-radius: 3px; position: relative; cursor: pointer;
  background: linear-gradient(90deg, #171D25, #0E1218);
  border: 1px solid #3B4450;
  -webkit-appearance: none; appearance: none;
  transition: border-color .2s ease;
}
.sw:hover { border-color: #5A6675; }
.sw::before {                       /* handle */
  content: ""; position: absolute; top: 50%; translate: 0 -50%;
  width: .82rem; height: .66rem; border-radius: 2px; background: #49535F;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
  transition: left .3s cubic-bezier(.2,.9,.25,1), right .3s cubic-bezier(.2,.9,.25,1),
              background .3s ease;
}
.sw::after {                        /* indicator window */
  content: ""; position: absolute; top: 50%; translate: 0 -50%;
  width: .3rem; height: .3rem; border-radius: 50%; background: #2C3340;
  transition: background .3s ease, box-shadow .3s ease;
}

/* Left bank: bus on the right, so the handle throws right and the window sits left. */
.lc__col:first-child .sw::after  { left: .5rem; }
.lc__col:last-child  .sw::after  { right: .5rem; }
.sw--main { width: 6rem; height: 1.8rem; margin-inline: auto; }
.sw--main::after { left: .5rem; }

@keyframes throw-right { from { right: 1.55rem; } to { right: .45rem; background: var(--copper); } }
@keyframes throw-left  { from { left:  1.55rem; } to { left:  .45rem; background: var(--copper); } }
@keyframes energize    { to { background: var(--live); box-shadow: 0 0 7px 1px rgba(242,193,78,.85); } }

/* Both states hang off aria-pressed at matching specificity, so neither can
   out-rank the other and strand a handle mid-throw. */
.lc__col:first-child .sw[aria-pressed="true"]::before,
.sw--main[aria-pressed="true"]::before { animation: throw-right .38s cubic-bezier(.2,.9,.25,1) var(--d, 0s) both; }
.lc__col:last-child .sw[aria-pressed="true"]::before { animation: throw-left .38s cubic-bezier(.2,.9,.25,1) var(--d, 0s) both; }
.sw[aria-pressed="true"]::after { animation: energize .38s ease var(--d, 0s) both; }

.lc__col:first-child .sw[aria-pressed="false"]::before,
.sw--main[aria-pressed="false"]::before { right: 1.55rem; background: #49535F; }
.lc__col:last-child .sw[aria-pressed="false"]::before { left: 1.55rem; background: #49535F; }
.sw[aria-pressed="false"]::after { background: #2C3340; box-shadow: none; }

/* ── Sections ─────────────────────────────────────────────────────────────── */

.sec { padding-block: var(--gap); }
.sec--dir { background: var(--paper-2); border-bottom: 1px solid var(--line); }
.sec--area { border-bottom: 1px solid var(--line); }

/* Circuit directory: the label schedule inside a panel door. Odd positions run
   down the left, even down the right — that is how a real load center is numbered. */
.dir {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr;
  column-gap: clamp(1.5rem, 4vw, 3.5rem);
  border-top: 1px solid var(--line);
}
.dir__row {
  display: grid; grid-template-columns: 1.75rem 1.15rem 1fr;
  align-items: center; gap: .9rem;
  padding: 1.15rem .25rem; border-bottom: 1px solid var(--line);
}
.dir__no { font: 500 .95rem/1 var(--mono); color: var(--copper-ink); }
.dir__t { font-weight: 500; line-height: 1.35; }

.brk {
  width: .95rem; height: 1.5rem; border-radius: 2px; flex: none; position: relative;
  background: var(--line); border: 1px solid var(--muted);
}
.brk::before {                      /* toggle, resting in the OFF position */
  content: ""; position: absolute; left: 50%; translate: -50% 0; bottom: .15rem;
  width: .5rem; height: .48rem; border-radius: 1px; background: var(--muted);
  transition: bottom .25s cubic-bezier(.2,.9,.25,1), background .25s ease;
}
.brk::after {                       /* indicator window */
  content: ""; position: absolute; left: 50%; translate: -50% 0; top: .2rem;
  width: .26rem; height: .26rem; border-radius: 50%; background: var(--muted);
  transition: background .25s ease, box-shadow .25s ease;
}
.dir__row:hover .brk, .dir__row:focus-within .brk { background: var(--ink); border-color: var(--ink); }
.dir__row:hover .brk::before, .dir__row:focus-within .brk::before {
  bottom: calc(100% - .63rem); background: var(--copper);
}
.dir__row:hover .brk::after, .dir__row:focus-within .brk::after {
  background: var(--live); box-shadow: 0 0 6px 1px rgba(242,193,78,.85);
}
.dir__row:hover .dir__no, .dir__row:focus-within .dir__no { color: var(--hot-text); }

.dir__more { margin: 2.5rem 0 0; color: var(--muted); font-size: .98rem; }

/* Service area: both names always visible — the neighborhood reads both. */
.area {
  list-style: none; margin: 2.5rem 0 0; padding: 0;
  display: grid; gap: 1px; background: var(--line);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border: 1px solid var(--line);
}
.area li {
  background: var(--paper); padding: 1.5rem 1.25rem;
  display: flex; flex-direction: column; gap: .3rem;
  border-top: 3px solid transparent; transition: border-color .18s ease, background .18s ease;
}
.area li:hover { border-top-color: var(--hot); background: var(--paper-2); }
.area b { font: 700 1.18rem/1.15 var(--disp); letter-spacing: -.005em; }
[data-lang="zh"] .area b { font-family: var(--body); font-size: 1.1rem; }
.area span { font-size: .92rem; color: var(--muted); }

/* ── Contact ──────────────────────────────────────────────────────────────── */

.sec--contact { background: var(--paper-2); }
.contact { display: grid; gap: clamp(2.5rem, 6vw, 4.5rem); grid-template-columns: minmax(0,1.1fr) minmax(0,.9fr); align-items: start; }

.tel {
  display: inline-block; margin: .5rem 0 1.75rem;
  font: 700 clamp(2rem, 1.2rem + 3.4vw, 3.4rem)/1 var(--disp);
  letter-spacing: -.01em; color: var(--hot-text); text-decoration: none;
  border-bottom: 3px solid transparent; transition: border-color .18s ease;
}
.tel:hover { border-bottom-color: var(--hot); }

.facts { margin: 0; border-top: 1px solid var(--line); }
.facts__row {
  display: grid; grid-template-columns: 7rem 1fr; gap: 1rem;
  padding: 1.15rem 0; border-bottom: 1px solid var(--line);
}
.facts dt { font: 500 .74rem/1.5 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
[data-lang="zh"] .facts dt { font-family: var(--body); letter-spacing: .08em; }
.facts dd { margin: 0; font-weight: 500; line-height: 1.5; }
.facts a { text-decoration-color: var(--line); text-underline-offset: 3px; }
.facts a:hover { text-decoration-color: var(--hot); }

/* ── Footer ───────────────────────────────────────────────────────────────── */

.foot { background: var(--ink); color: var(--muted-dk); padding-block: 2rem; }
.foot__in { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; justify-content: space-between; align-items: center; }
.foot p { margin: 0; font-size: .88rem; }
.foot__tag { font: 500 .74rem/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--copper-lt); }
[data-lang="zh"] .foot__tag { font-family: var(--body); letter-spacing: .1em; }

/* ── Sticky call bar (mobile) ─────────────────────────────────────────────── */

.callbar { display: none; }
.callbar svg { width: 1.15em; height: 1.15em; fill: currentColor; }

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .hero__in { grid-template-columns: 1fr; }
  .hero__panel { order: -1; justify-items: start; }
  .lc { width: min(250px, 70%); }
  .contact { grid-template-columns: 1fr; }
  .dir { grid-template-columns: 1fr; grid-auto-flow: row; grid-template-rows: none; }
}

@media (max-width: 720px) {
  .bar__call, .status { display: none; }
  body { padding-bottom: 4.25rem; }
  .callbar {
    display: flex; align-items: center; justify-content: center; gap: .6rem;
    position: fixed; inset: auto 0 0 0; z-index: 60;
    background: var(--hot); color: #fff; text-decoration: none;
    font: 600 1.05rem/1 var(--body); padding: 1.05rem 1rem;
    padding-bottom: calc(1.05rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 24px -8px rgba(0,0,0,.35);
  }
  .facts__row { grid-template-columns: 1fr; gap: .3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
