/* ============================================================================
   watts.css — WattCost site-local layer
   AAA+++ STUDIO PREMIUM, §5 row "watts": company voice = SWITCHBOARD SCHEDULE,
   signature set piece = the annual-cost METER BAND.

   Loads AFTER styles.css and data.css, so every value here is an override or an
   addition in the site's own drawing hand. Nothing in _shared/ is touched.

   THE DRAWING HAND (must not be confusable with a sibling's):
   rectilinear only. Square terminals, butt-cap rules, 1px hairlines that meet
   at right angles, digit cells divided like the windows on a kWh meter, a
   DIN-rail tick ruler under the register. Explicitly FORBIDDEN here: round
   caps and arcs (those are RunCost's fuel-gauge hand), dashed contour rings
   (LuxPlan), plate/circle charts (ThaliFacts, DietPlanIndia). An electrician's
   load schedule is drawn with a ruler and a square, and so is this.

   CLS 0.00 is a hard constraint and the odometer is the only thing on the page
   that JavaScript rewrites, so every part of it is dimensioned in advance:
   a fixed six-cell register (leading zeros are printed, not hidden, exactly as
   a real meter prints them), fixed-width mono scale labels reserved in `ch`,
   and a marker that moves by `left` on an absolutely positioned element. No
   text node the script can rewrite is allowed to affect layout.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   1. Entrance choreography (§3.7) — kicker -> h1 -> meter band, 60ms stagger.
   The kicker and the meter band carry .reveal / .reveal-3 in the markup; the
   h1 is emitted by the shared shell() and cannot take a class, so its 60ms
   step is applied here by selector. Same keyframes, same gate: reduced-motion
   readers get the finished page and nothing animates below the fold.
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .hero h1 { animation: aaa-rise var(--t-slow) var(--ease-out) both; animation-delay: 60ms; }
}

/* The eyebrow now carries two things — the schedule kicker and the circuit
   chip — so it becomes a row rather than an inline-block. */
.hero .eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.hero .eyebrow .kicker { color: var(--accent-deep); }
.hero .eyebrow .chip { text-transform: none; letter-spacing: .03em; }

/* ---------------------------------------------------------------------------
   2. The answer, demoted to a schedule entry.
   One display numeral per page is the rule, and on WattCost that numeral is
   the meter register. The shared .answer.aaa .big is Fraunces at --fs-stat;
   here the same span becomes the written entry BESIDE the meter reading — mono,
   tabular, ruled underneath, the way a figure is entered on a load schedule
   after someone has read it off the dial. Two registers, one number.
   --------------------------------------------------------------------------- */
.answer.aaa .big {
  display: inline-block;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 1.28rem;
  line-height: 1.3;
  letter-spacing: .01em;
  font-variation-settings: normal;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--accent-deep);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
  margin-right: .5em;
}

/* ---------------------------------------------------------------------------
   3. THE METER BAND
   --------------------------------------------------------------------------- */
.wc-band {
  margin: var(--s4) 0 0;
  padding: 0;
  max-width: 640px;
  border: 1px solid var(--line-2);
  border-radius: 0;                     /* switchboards do not have soft corners */
  background: var(--surface);
}
.wc-band > * { margin: 0; }

/* --- the schedule header row: register name left, circuit data right ------ */
.wc-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px var(--s3);
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
  background: var(--paper-2);
}
.wc-reg {
  font-family: var(--mono);
  font-size: var(--fs-mono);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums lining-nums;
}
.wc-meta { color: var(--muted); text-transform: uppercase; }

/* --- the register itself: the odometer inside its meter frame -------------
   The drum shading is two flat gradients, not a photograph: a real meter is a
   cylinder seen through a slot, so the digits sit darker top and bottom and
   catch the light across the middle. Costs nothing and no request.          */
.wc-frame {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 18px 14px 16px;
  border-bottom: 1px solid var(--line);
}
.wc-cur {
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--muted);
  align-self: flex-start;
  margin-top: 4px;
}
/* Never shrinks: a drum that squeezes is a text field, and a squeezed cell is a
   pixel of layout shift waiting for a longer figure. */
.wc-odo {
  display: flex;
  flex: 0 0 auto;
  width: max-content;                   /* the frame is exactly its drums wide */
  border: 1px solid var(--ink-2);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--ink) 9%, transparent) 0,
      transparent 34%,
      transparent 62%,
      color-mix(in srgb, var(--ink) 7%, transparent) 100%),
    var(--paper);
}
.wc-odo .d {
  display: block;
  width: 1.05ch;
  padding: 4px 6px 5px;
  text-align: center;
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  line-height: 1.06;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--ink);
  border-right: 1px solid var(--line-2);
}
.wc-odo .d:last-child { border-right: 0; }
/* Leading zeros are printed, not suppressed: a meter that hides its unused
   drums is a text field pretending to be a meter. They are just quiet. */
.wc-odo .d.z { color: var(--faint); }
.wc-odo .wc-dp {
  align-self: flex-end;
  padding: 0 3px 8px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--accent);
  border-right: 1px solid var(--line-2);
}
.wc-unit {
  margin-left: auto;
  align-self: flex-end;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
}
/* Two lines are reserved: the working line is the one string in the band whose
   length changes when the reader re-wires the register, and an unreserved line
   box is exactly how a live figure earns a layout shift. */
.wc-sub {
  padding: 10px 14px;
  min-height: calc(2 * 1.45em + 20px);
  line-height: 1.45;
  color: var(--muted);
  font-family: var(--mono);
  font-size: var(--fs-mono);
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums lining-nums;
  border-bottom: 1px solid var(--line);
}

/* --- the rail: a DIN-rail tick ruler with a square gate on your figure ----
   Ticks are a repeating gradient, so they are inherently butt-ended and pixel
   crisp at any width. The fill is the accumulation the product is about.    */
.wc-scale {
  display: grid;
  grid-template-columns: 10ch 1fr 10ch;
  align-items: center;
  gap: 10px;
  padding: 16px 14px 14px;
  border-bottom: 1px solid var(--line);
}
.wc-lo, .wc-hi { color: var(--muted); line-height: 1.25; }
.wc-lo b, .wc-hi b { display: block; color: var(--ink-2); font-weight: 600; font-size: .875rem; }
.wc-hi { text-align: right; }
.wc-lo em, .wc-hi em { font-style: normal; font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.wc-rail {
  position: relative;
  display: block;
  height: 26px;
  border-left: 1px solid var(--ink-2);
  border-right: 1px solid var(--ink-2);
  border-bottom: 1px solid var(--ink-2);
  background-image: repeating-linear-gradient(90deg, var(--line-2) 0 1px, transparent 1px 10%);
  background-position: bottom left;
  background-size: 100% 9px;
  background-repeat: no-repeat;
}
.wc-fill {
  position: absolute;
  left: 0; bottom: 0;
  height: 5px;
  background: var(--accent);
}
.wc-mark {
  position: absolute;
  bottom: 0;
  width: 2px;
  height: 100%;
  margin-left: -1px;
  background: var(--accent-deep);
}
.wc-mark::before {
  content: "";
  position: absolute;
  top: 0; left: -4px;
  width: 10px; height: 10px;
  background: var(--accent-deep);
}

/* --- the tariff terminal: an input wired beside the register -------------- */
.wc-tariff {
  display: grid;
  grid-template-columns: auto 8.5ch;
  align-items: center;
  gap: 10px var(--s3);
  padding: 12px 14px 14px;
}
.wc-tariff label {
  font-family: var(--mono);
  font-size: var(--fs-mono);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-2);
}
.wc-in {
  width: 100%;
  height: 40px;
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 1rem;
  font-variant-numeric: tabular-nums lining-nums;
  text-align: right;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink-2);
  border-radius: 0;
}
.wc-in:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.wc-note {
  grid-column: 1 / -1;
  color: var(--muted);
  text-transform: uppercase;
  line-height: 1.5;
}
.wc-note.live { color: var(--accent-deep); }
.wc-band figcaption { padding: 0 14px 14px; }
.wc-band figcaption .srcline { margin-top: 0; }

/* Wired-in selects on /calculator: same terminal grammar as the tariff box. */
.wc-terminals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s3);
  padding: 12px 14px 0;
}
.wc-terminals label {
  display: block;
  font-family: var(--mono);
  font-size: var(--fs-mono);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 5px;
}
.wc-terminals select, .wc-terminals input {
  width: 100%;
  height: 40px;
  padding: 0 8px;
  font-family: var(--sans);
  font-size: .95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink-2);
  border-radius: 0;
  font-variant-numeric: tabular-nums lining-nums;
}
.wc-fault { color: var(--accent-deep); }

@media (max-width: 560px) {
  .wc-scale { grid-template-columns: 1fr; }
  .wc-hi { text-align: left; }
  .wc-unit { margin-left: 0; }
  .wc-frame { flex-wrap: wrap; }
}

/* --------------------------------------------------------------------------
   4. Dark mode: the meter is a metal instrument on warm basalt, so the frame
   keeps its hairlines and loses the paper. Elevation stays a surface step —
   no decorative shadow anywhere in dark (§3.8).
   -------------------------------------------------------------------------- */
/* §3.8 dark accent: nothing to re-pick here. The light accent #5B4A9E is only
   2.54:1 on basalt #161512, but the shared layer already ships watts' dark
   variant (#A79BE8 = 7.39:1 on --paper, 6.88:1 on --surface), and --accent-deep
   mixes off that, so links, the keel rule, the fill bar and the meter's decimal
   point all clear AA in dark without a site-local override. Verified in-browser
   rather than assumed — do not add one back.                              */

:root[data-theme="dark"] .wc-band { background: var(--surface); box-shadow: none; }
:root[data-theme="dark"] .wc-head { background: var(--paper-2); }
:root[data-theme="dark"] .wc-odo {
  border-color: var(--line-2);
  background:
    linear-gradient(180deg,
      rgba(0, 0, 0, .34) 0,
      transparent 34%,
      transparent 62%,
      rgba(0, 0, 0, .28) 100%),
    var(--paper-deep);
}
:root[data-theme="dark"] .wc-odo .d { color: var(--ink); }
/* The unturned drums must stay quiet in dark too — the rule above is more
   specific than `.wc-odo .d.z`, so it has to be restated. */
:root[data-theme="dark"] .wc-odo .d.z { color: var(--faint); }
:root[data-theme="dark"] .wc-rail,
:root[data-theme="dark"] .wc-in,
:root[data-theme="dark"] .wc-terminals select,
:root[data-theme="dark"] .wc-terminals input { border-color: var(--line-2); background: var(--paper-deep); }
:root[data-theme="dark"] .wc-in,
:root[data-theme="dark"] .wc-terminals select,
:root[data-theme="dark"] .wc-terminals input { color: var(--ink); }

/* --------------------------------------------------------------------------
   5. The load-schedule row (the stat tiles, re-voiced).
   The shared .stats grid stays — verify.mjs re-derives every one of these
   figures from the formula — but on this site it is itemised like the rows of
   a schedule: mono keys, a hairline per row, no boxes.
   -------------------------------------------------------------------------- */
.wc-sched .stat { border-top: 1px solid var(--line); background: none; }
.wc-sched .stat .k { font-family: var(--mono); letter-spacing: .06em; color: var(--muted); }
.wc-sched .stat .v { font-variant-numeric: tabular-nums lining-nums; }
.wc-sched .stat .s { font-family: var(--mono); font-size: var(--fs-mono); letter-spacing: .04em; }

/* Print: the register is the whole point, so it survives the printer. */
@media print {
  .wc-tariff, .wc-terminals { display: none; }
  .wc-band { border-color: #999; }
}
