/* Energies Advisory, concept C: "The grid, from generator to your meter".
   Black drafting board, bone-white model, copper conductors.
   Blue is reserved for power flowing the other way (exports, negative prices).
   Generation, transmission and distribution each have a hue, shown while their section
   is read. Keep them in sync with HUE in js/scene.js. */

:root {
  --black: #000;
  --paper: #f2f1ed;
  --graphite: #8e8b84;
  --dim: #5a5853;
  --rule: rgba(242, 241, 237, 0.16);
  --rule-strong: rgba(242, 241, 237, 0.32);
  --copper: #ee8a3a;
  --blue: #7fb2e5;
  --gen: #e07b4f;
  --trans: #d6b04a;
  --dist: #8fb592;

  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter Tight", "Helvetica Neue", Arial, sans-serif;

  --nav-h: 64px;
  --nem-h: 34px;
  --gutter: clamp(1.25rem, 4vw, 4rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--black);
  color: var(--paper);
  font: 400 1.125rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; text-wrap: balance; }
p { margin: 0 0 1em; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--paper); color: #000; padding: 6px 10px; font-family: var(--sans); }
.skip:focus { left: 8px; }

/* ---------- fixed layers ---------- */
#grid { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; opacity: 0; transition: opacity 0.9s ease-out; }
#grid.ready { opacity: 1; }
#callouts { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
#leaders { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#leaders .ld { fill: none; stroke: rgba(242, 241, 237, 0.55); stroke-width: 1; vector-effect: non-scaling-stroke; }
#leaders .dot { fill: var(--black); stroke: var(--paper); stroke-width: 1; }
#leaders .dot.hot { stroke: var(--copper); }
#leaders .dot.cold { stroke: var(--blue); }
#leaders .dot.gen { stroke: var(--gen); }
#leaders .dot.trans { stroke: var(--trans); }
#leaders .dot.dist { stroke: var(--dist); }
.callout {
  position: absolute; left: 0; top: 0;
  font: 500 0.8125rem/1.25 var(--sans);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--paper);
  will-change: transform, opacity;
}
.callout small { display: block; font-weight: 400; color: var(--graphite); }
.callout.left { text-align: right; }
.callout b { font-weight: 600; color: var(--copper); }
.callout b.cold { color: var(--blue); }

.fallback { display: none; }
.no-webgl .fallback { display: block; position: fixed; left: 50%; top: 22vh; width: min(1100px, 92vw); transform: translateX(-50%); z-index: 0; }
.no-webgl #grid, .no-webgl #callouts { display: none; }
.no-webgl .panel { background: #000; }

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--gutter);
  background: linear-gradient(#000 30%, rgba(0, 0, 0, 0));
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--paper); }
.logo { display: block; height: 28px; width: auto; }
.logo .mark-sun { fill: var(--copper); }
.nav-links { display: flex; align-items: center; gap: 1.75rem; font: 500 0.9375rem/1 var(--sans); letter-spacing: 0.02em; }
.nav-links a { text-decoration: none; color: var(--graphite); transition: color 0.15s; }
.nav-links a:hover { color: var(--paper); }
.nav-links .nav-cta { color: var(--paper); padding: 0.55rem 0.8rem; border: 1px solid var(--copper); }
.nav-links .nav-cta:hover { background: var(--copper); color: #000; }

/* ---------- route rail ---------- */
.rail {
  position: fixed; z-index: 9;
  left: calc(var(--gutter) * 0.5 - 2px); top: 50%;
  transform: translateY(-50%);
  --icon: 21px; --gap: 2.4rem; --pad: 0.4rem;
  display: flex; flex-direction: column; gap: var(--gap);
  padding: var(--pad) 0;
}
/* The wire breaks at each icon, so the model shows through the icons rather than a black box. */
.rail-wire {
  position: absolute; left: 10px; top: 0; bottom: 0; width: 1px; background: var(--rule-strong);
  mask: repeating-linear-gradient(transparent 0 var(--icon), #000 0 calc(var(--icon) + var(--gap))) 0 var(--pad);
}
.rail-fill { position: absolute; left: 0; top: 0; width: 1px; height: 100%; background: var(--copper); transform-origin: top; transform: scaleY(var(--fill, 0)); }
.rail a { position: relative; display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--dim); }
.rail svg { width: var(--icon); height: var(--icon); flex: none; fill: none; stroke: currentColor; stroke-width: 1.3; }
.rail svg text { fill: currentColor; stroke: none; font: 600 6.5px var(--sans); }
.rail span { font: 500 0.8125rem/1 var(--sans); letter-spacing: 0.02em; opacity: 0; transform: translateX(-4px); transition: opacity 0.2s, transform 0.2s; }
.rail a.done { color: var(--copper); }
.rail a[data-stage="1"] { --hue: var(--gen); }
.rail a[data-stage="2"] { --hue: var(--dist); }
.rail a.now { color: var(--hue, var(--paper)); }
.rail a.now span, .rail a:hover span, .rail a:focus-visible span { opacity: 1; transform: none; }

/* ---------- sections ---------- */
main { position: relative; z-index: 3; }

.hero {
  min-height: 100svh;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 2rem;
  padding: calc(var(--nav-h) + 2rem) var(--gutter) calc(var(--nem-h) + 3rem);
  padding-left: calc(var(--gutter) + 2.5rem);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0) 55%);
}
.hero h1 {
  font-size: clamp(2.8rem, 5.4vw, 5.6rem);
  line-height: 1.02;
  letter-spacing: -0.005em;
  max-width: 13ch;
  margin-bottom: 1.5rem;
}
.lede { font-size: 1.25rem; line-height: 1.5; max-width: 36rem; color: rgba(242, 241, 237, 0.86); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem; margin-top: 2rem; }

.btn {
  display: inline-block; cursor: pointer;
  padding: 0.85rem 1.2rem 0.9rem;
  font: 600 1rem/1 var(--sans); letter-spacing: 0.02em;
  color: #000; background: var(--copper); border: 0; text-decoration: none;
  transition: background 0.15s;
}
.btn:hover { background: var(--paper); }
.btn-quiet { font: 500 1rem/1 var(--sans); letter-spacing: 0.02em; color: var(--paper); text-decoration: none; border-bottom: 1px solid var(--rule-strong); padding-bottom: 4px; }
.btn-quiet:hover { border-color: var(--copper); }

/* Drawing title block, bottom right of the hero. */
.titleblock {
  border-collapse: collapse;
  font: 400 0.8125rem/1.3 var(--sans);
  font-variant-numeric: tabular-nums;
  min-width: 19rem;
  background: rgba(0, 0, 0, 0.7);
}
.titleblock caption { text-align: left; font-weight: 600; color: var(--paper); padding: 0 0 0.4rem; }
.titleblock th, .titleblock td { border: 1px solid var(--rule-strong); padding: 0.4rem 0.6rem; text-align: left; vertical-align: top; }
.titleblock th { font-weight: 500; color: var(--graphite); width: 5.5rem; }

.stage {
  min-height: 160vh;
  display: flex; align-items: center;
  padding: 20vh var(--gutter);
  padding-left: calc(var(--gutter) + 6.5rem);
}

.panel {
  width: min(31rem, 100%);
  padding: 1.8rem 2rem 2rem;
  background: rgba(0, 0, 0, 0.93);
  border-top: 1px solid var(--rule-strong);
  transform: perspective(1400px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-origin: 50% 50%;
}
.panel-wide { width: min(46rem, 100%); }
.panel h2 { font-size: clamp(2rem, 2.9vw, 2.75rem); line-height: 1.06; letter-spacing: -0.005em; margin-bottom: 1.1rem; }
.panel > p, .panel .brad p { color: rgba(242, 241, 237, 0.86); }

.stage-ref {
  display: flex; align-items: center; gap: 0.55rem;
  font: 500 0.875rem/1 var(--sans) !important; letter-spacing: 0.02em;
  color: var(--copper) !important;
  margin-bottom: 1.3rem !important;
}
.stage-ref svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.stage-ref svg text { fill: currentColor; stroke: none; font: 600 6.5px var(--sans); }

.ticks { list-style: none; margin: 1.4rem 0 0; padding: 0; font: 400 1rem/1.4 var(--sans); letter-spacing: 0.01em; }
.ticks li { position: relative; padding: 0.6rem 0 0.6rem 1.4rem; border-top: 1px solid var(--rule); }
.ticks li::before { content: ""; position: absolute; left: 0; top: 1.05rem; width: 0.7rem; height: 1px; background: var(--copper); }

/* Duck curve chart */
.duck { margin: 1.6rem 0 0; }
.duck svg { display: block; width: 100%; height: auto; overflow: visible; }
.duck figcaption, .bill figcaption, .punch caption {
  font: 400 0.8125rem/1.4 var(--sans); color: var(--graphite); margin-top: 0.6rem; letter-spacing: 0.01em;
}
.duck .axis { stroke: var(--rule-strong); stroke-width: 1; }
.duck .zero { stroke: var(--rule-strong); stroke-dasharray: 2 3; }
.duck .price { fill: none; stroke: var(--copper); stroke-width: 1.6; }
.duck .neg { fill: rgba(127, 178, 229, 0.28); }
.duck text { font: 400 11px var(--sans); fill: var(--graphite); font-variant-numeric: tabular-nums; }
.duck text.hot { fill: var(--copper); font-weight: 500; }
.duck text.cold { fill: var(--blue); font-weight: 500; }

/* Bill split */
.bill { margin: 1.6rem 0 0; }
.bill-bar { display: flex; height: 14px; gap: 2px; }
.bill-bar span { flex: 0 0 var(--w); }
.b-energy { background: var(--gen); }
/* Network pays for both transmission and distribution; the blend claims no split. */
.b-network { background: linear-gradient(to right, var(--trans), var(--dist)); }
.b-env { background: var(--graphite); }
.b-retail { background: var(--dim); }
.bill-key { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; margin: 0.7rem 0 0; font: 400 0.8125rem/1.25 var(--sans); }
.bill-key div { border-left: 1px solid var(--rule-strong); padding-left: 0.4rem; min-width: 0; }
.bill-key dt { color: var(--graphite); }
.bill-key dd { margin: 0; font-weight: 600; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.bill-key div:nth-child(1) { border-color: var(--gen); }
.bill-key div:nth-child(2) { border-color: var(--dist); }

/* Punch list table */
.punch { width: 100%; border-collapse: collapse; margin-top: 1.4rem; font: 400 0.9375rem/1.3 var(--sans); font-variant-numeric: tabular-nums; caption-side: bottom; }
.punch caption { text-align: left; }
.punch th { font-weight: 500; color: var(--graphite); text-align: right; padding: 0 0 0.45rem 0.8rem; border-bottom: 1px solid var(--rule-strong); white-space: nowrap; }
.punch th:first-child, .punch td:first-child { text-align: left; padding-left: 0; }
.punch td { text-align: right; padding: 0.6rem 0 0.6rem 0.8rem; border-bottom: 1px solid var(--rule); vertical-align: top; white-space: nowrap; }
.punch td:first-child { white-space: normal; }
.punch td:last-child { color: var(--copper); font-weight: 600; }

/* Brad */
.brad { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 2rem; align-items: start; }
.portrait { margin: 0; }
.portrait-slot {
  aspect-ratio: 4 / 5; display: grid; place-items: center;
  border: 1px solid var(--rule-strong);
  font: 400 0.8125rem var(--sans); color: var(--dim);
  background:
    linear-gradient(var(--rule), var(--rule)) 50% 0 / 1px 100% no-repeat,
    linear-gradient(var(--rule), var(--rule)) 0 50% / 100% 1px no-repeat;
}
.portrait-img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 30%; border: 1px solid var(--rule-strong); }
.portrait figcaption { font: 400 0.8125rem/1.3 var(--sans); color: var(--graphite); margin-top: 0.5rem; }
blockquote { margin: 1.4rem 0 0; padding: 0 0 0 1rem; border-left: 1px solid var(--copper); font-style: italic; font-size: 1.3rem; line-height: 1.4; }

/* Where Energies is going: the three pillars */
.pillars { list-style: none; margin: 1.6rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.4rem; }
.pillars li { border-top: 1px solid var(--rule-strong); padding-top: 0.8rem; }
.pillars h3 { font-size: 1.2rem; font-weight: 400; line-height: 1.2; margin: 0.5rem 0; }
.pillars p { margin: 0; font-size: 0.9375rem; line-height: 1.45; color: rgba(242, 241, 237, 0.78); }
.pillars .text-link { display: inline-block; margin-top: 0.6rem; }
.pillar-status { font: 500 0.8125rem/1 var(--sans); letter-spacing: 0.02em; color: var(--graphite); }
.pillar-status.now { color: var(--copper); }
.pillars li:first-child { border-top-color: var(--copper); }

/* Blog */
.blog-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.text-link { font: 500 0.9375rem/1 var(--sans); letter-spacing: 0.02em; text-decoration: none; border-bottom: 1px solid var(--rule-strong); padding-bottom: 3px; }
.text-link:hover { border-color: var(--copper); }
.posts { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.posts a {
  display: grid; grid-template-columns: 7rem minmax(0, 1fr) auto; gap: 1.2rem; align-items: baseline;
  padding: 1.1rem 0; border-top: 1px solid var(--rule); text-decoration: none;
}
.posts li:last-child a { border-bottom: 1px solid var(--rule); }
.post-cat { font: 500 0.875rem/1.2 var(--sans); color: var(--copper); letter-spacing: 0.02em; }
.post-title { font-size: 1.35rem; line-height: 1.25; transition: color 0.15s; }
.posts a:hover .post-title { color: var(--copper); }
.post-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; font: 400 0.8125rem/1.2 var(--sans); color: var(--graphite); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Contact */
.stage-contact { min-height: 130vh; }
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 2.4rem; }
.contact h2 { font-size: clamp(1.9rem, 2.6vw, 2.5rem); }
.contact-mail a { font: 500 1.05rem var(--sans); color: var(--copper); text-decoration: none; border-bottom: 1px solid currentColor; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.2rem; align-content: start; }
.form .full { grid-column: 1 / -1; }
.form label span { display: block; font: 500 0.8125rem/1 var(--sans); color: var(--graphite); letter-spacing: 0.02em; margin-bottom: 0.35rem; }
.form input, .form textarea {
  width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--rule-strong);
  color: var(--paper); font: 400 1.05rem/1.4 var(--sans); padding: 0.3rem 0; border-radius: 0; resize: vertical;
}
.form input:focus, .form textarea:focus { outline: none; border-bottom-color: var(--copper); }
.form input[aria-invalid="true"], .form textarea[aria-invalid="true"] { border-bottom-color: var(--copper); }
.form-error { margin: 0; font: 500 0.875rem var(--sans); color: var(--copper); }
.form .btn { justify-self: start; }
.form-done { grid-column: 2; font: 500 1.05rem var(--sans); border-left: 1px solid var(--copper); padding-left: 0.8rem; align-self: start; }

.foot {
  position: relative; z-index: 3;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem 2.5rem;
  padding: 2.2rem var(--gutter) calc(var(--nem-h) + 2rem);
  background: #000; border-top: 1px solid var(--rule);
  font: 400 0.875rem/1.4 var(--sans); color: var(--graphite);
}
.foot p { margin: 0; }
.foot .logo { height: 34px; }
.foot-small { text-align: right; max-width: 26rem; }

/* ---------- NEM strip ---------- */
.nem {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  height: var(--nem-h);
  display: flex; align-items: center; gap: 1.6rem;
  padding: 0 var(--gutter);
  background: #000; border-top: 1px solid var(--rule);
  font: 400 0.8125rem/1 var(--sans); letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--graphite);
}
.nem-label { color: var(--paper); font-weight: 500; white-space: nowrap; }
.nem-label em { font-style: normal; font-weight: 400; color: var(--dim); margin-left: 0.3rem; }
.nem-regions { display: flex; gap: 1.4rem; list-style: none; margin: 0; padding: 0; }
.nem-regions li { display: flex; gap: 0.3rem; white-space: nowrap; }
.nem-regions b { font-weight: 600; color: var(--paper); min-width: 3.4em; text-align: right; }
.nem-regions b.neg { color: var(--blue); }
.nem-regions b.high { color: var(--copper); }
.nem-time { margin-left: auto; white-space: nowrap; }
.nem-hz { white-space: nowrap; color: var(--paper); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .nem-time { display: none; }
  .titleblock { display: none; }
  .hero { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  :root { --nav-h: 56px; }
  .rail, .nem, #callouts { display: none; }
  .nav-links a:not(.nav-cta) { display: none; }
  .nav-links .nav-cta { font-size: 0.875rem; padding: 0.45rem 0.6rem; }
  .logo { height: 24px; }

  .hero { min-height: 100svh; padding: 0 var(--gutter) 2.5rem; background: linear-gradient(to top, #000 42%, rgba(0, 0, 0, 0) 70%); }
  .hero h1 { font-size: clamp(2.4rem, 10.5vw, 3.4rem); }
  .lede { font-size: 1.1rem; }

  /* The scene sits in the top of the screen; each panel rises over it. */
  .stage { min-height: 0; display: block; padding: 62svh 0 0; }
  .panel, .panel-wide { width: 100%; padding: 1.6rem var(--gutter) 2.4rem; background: #000; transform: none; }
  .stage-contact { min-height: 0; }
  .brad { grid-template-columns: 1fr; }
  .portrait { max-width: 12rem; }
  .contact { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .form-done { grid-column: 1; }
  .pillars { grid-template-columns: 1fr; }
  .posts a { grid-template-columns: 1fr; gap: 0.35rem; }
  .post-meta { flex-direction: row; align-items: baseline; gap: 1rem; }
  .punch th:nth-child(2), .punch td:nth-child(2) { display: none; }
  .foot { grid-template-columns: 1fr; padding-bottom: 2rem; }
  .foot-small { text-align: left; }
}
