/* Energies Advisory, concept B: one day on the grid.
   Black reading column on the left, the day in a window on the right.
   --accent, --sky-top and --sky-bot are rewritten by main.js as the day advances. */

:root {
  --bg: #000;
  --ink: #fff;
  --ink-2: rgba(255, 255, 255, 0.74);
  --ink-3: rgba(255, 255, 255, 0.52);
  --line: rgba(255, 255, 255, 0.16);
  --accent: #ffb86b;
  --sky-top: #0e1846;
  --sky-bot: #4b3c6e;
  --neg: #4a9ef5;
  --pos: #f08a2a;
  --sun: #ffd35c;

  --col: clamp(430px, 42vw, 640px);
  --nav-h: 64px;
  --bar-h: 52px;
  --tray-h: clamp(300px, 43vh, 420px);
  --pad-l: clamp(28px, 4vw, 64px);
  --pad-r: clamp(28px, 3.2vw, 52px);

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

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 1.1875rem/1.58 var(--sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; text-wrap: balance; }
p { margin: 0 0 1em; max-width: 36em; text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: #000; }

.skip { position: fixed; left: 12px; top: -60px; z-index: 50; background: var(--accent); color: #000; padding: 8px 14px; font: 600 0.9rem var(--sans); }
.skip:focus { top: 12px; }

/* ---------- Stage ---------- */
.stage { position: fixed; inset: 0; z-index: 0; background: linear-gradient(var(--sky-top), var(--sky-bot)); }
.stage canvas { display: block; width: 100%; height: 100%; }
/* The hero's black scrim stays over the scene at every hour, so the day never outshines the type. */
.stage::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to top right, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.42) 38%, rgba(0, 0, 0, 0) 64%),
    rgba(0, 0, 0, 0.3);
}
.fallback-array { display: none; position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 40vh; color: #05060c; }
.no-webgl .stage canvas { display: none; }
.no-webgl .fallback-array { display: block; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 20; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--pad-r) 0 var(--pad-l);
  transition: background-color 0.4s;
}
.scrolled .nav { background: #000; }
.brand { display: block; color: var(--ink); }
.logo { display: block; height: 28px; width: auto; }
.logo .mark-sun, .foot-brand .mark-sun { fill: var(--accent); transition: opacity 0.4s; }
.nav nav { display: flex; align-items: center; gap: clamp(16px, 2.2vw, 34px); font: 500 0.9375rem var(--sans); }
.nav nav a { text-decoration: none; color: var(--ink); }
.nav nav a:hover { color: var(--accent); }
.nav .nav-cta { padding: 9px 16px; background: var(--accent); color: #000; }
.nav .nav-cta:hover { color: #000; background: #fff; }

/* ---------- Buttons, links ---------- */
.btn {
  display: inline-block; border: 0; cursor: pointer;
  padding: 15px 24px; background: var(--accent); color: #000;
  font: 600 1rem var(--sans); text-decoration: none;
  transition: background-color 0.2s;
}
.btn:hover { background: #fff; }
.text-link { font: 500 1rem var(--sans); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 5px; }
.text-link:hover { color: var(--accent); }

/* ---------- Hero ---------- */
.hero { position: relative; z-index: 1; min-height: 100svh; display: flex; align-items: flex-end; }
.hero-copy { position: relative; padding: 0 var(--pad-r) calc(var(--bar-h) + 56px) var(--pad-l); max-width: min(980px, 72vw); }
.hero h1 {
  font-size: clamp(2.7rem, 5.3vw, 5.6rem); line-height: 0.97; letter-spacing: -0.005em;
  margin-bottom: 28px; max-width: 13.5em;
}
.lede { font-size: 1.3rem; line-height: 1.5; color: var(--ink); max-width: 31em; margin-bottom: 32px; }
.actions { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.hint {
  position: absolute; right: var(--pad-r); bottom: calc(var(--bar-h) + 22px); margin: 0;
  font: 500 0.875rem var(--sans); color: var(--ink-2); text-align: right;
}
@media (hover: none) { .hint { display: none; } }
.no-webgl .hint { display: none; }

/* ---------- Column ---------- */
.column { position: relative; z-index: 2; width: var(--col); background: var(--bg); }
.column::after { /* hairline edge of the window, tinted by the sky */
  content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: 1px;
  background: linear-gradient(var(--sky-top), var(--sky-bot)); opacity: 0.8;
}
.chapter { padding: 11vh var(--pad-r) 7vh var(--pad-l); }
.chapter h2 { font-size: clamp(2rem, 2.9vw, 3.1rem); line-height: 1.02; letter-spacing: -0.005em; margin-bottom: 28px; }
.chapter > p, .sticky > p { color: var(--ink-2); }
.chapter > p:first-of-type, .sticky > h2 + p { color: var(--ink); }

/* 07:00 chapter: content holds still while the morning passes */
.chapter-mpp { height: 200vh; padding-top: 0; padding-bottom: 0; }
.chapter-mpp .sticky { position: sticky; top: calc(var(--nav-h) + 2vh); padding-top: 3vh; }
.chapter-mpp h2 { font-size: clamp(1.8rem, 2.4vw, 2.6rem); margin-bottom: 20px; }
.chapter-mpp .sticky > p { font-size: 1.0625rem; line-height: 1.5; margin-bottom: 0.7em; }

.iv { margin: 18px 0 0; transition: transform 0.6s cubic-bezier(.2, .7, .2, 1); transform-origin: 50% 50%; }
.iv-chart { display: block; width: 100%; height: auto; overflow: visible; }
.iv-read { display: grid; grid-template-columns: repeat(5, auto); align-items: end; gap: 4px 18px; margin: 14px 0 10px; font-family: var(--sans); }
.iv-read div { min-width: 0; }
.iv-read dt { font-size: 0.75rem; line-height: 1.25; color: var(--ink-3); }
.iv-read dd { margin: 2px 0 0; font-size: 1.125rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.iv figcaption { font: 400 0.8125rem/1.45 var(--sans); color: var(--ink-3); max-width: 40em; }

/* SVG chart vocabulary, shared by both instruments */
.grid line { stroke: rgba(255, 255, 255, 0.1); stroke-width: 1; shape-rendering: crispEdges; }
.grid line.zero { stroke: rgba(255, 255, 255, 0.42); }
.tick, .axis-title, .panel-title, .direct, .now-label, .mpp-label { font-family: var(--sans); font-variant-numeric: tabular-nums; }
.tick { font-size: 11px; fill: var(--ink-3); }
.tick.end, .axis-title.end { text-anchor: end; }
.tick.mid, .direct.mid { text-anchor: middle; }
.direct.end { text-anchor: end; }
.axis-title, .panel-title { font-size: 11.5px; fill: var(--ink-2); font-weight: 500; }
.ghost path { fill: none; stroke: rgba(255, 255, 255, 0.16); stroke-width: 1; }
.ghost .tick { fill: rgba(255, 255, 255, 0.4); }
.live { fill: none; stroke: #fff; stroke-width: 2; stroke-linejoin: round; }
.mpp { fill: var(--accent); stroke: #000; stroke-width: 2; }
.op { fill: none; stroke: var(--accent); stroke-width: 1.25; }
.mpp-link { stroke: var(--accent); stroke-width: 1; opacity: 0.6; }
.mpp-label { font-size: 12px; font-weight: 600; fill: var(--ink); text-anchor: end; }
.iv-chart.dark .mpp, .iv-chart.dark .op, .iv-chart.dark .mpp-link { opacity: 0; }

/* Services */
.services { display: grid; gap: 0; margin-top: 8px; }
.services article { padding: 26px 0 28px; border-top: 1px solid var(--line); }
.services article:last-child { border-bottom: 1px solid var(--line); }
.services h3 { font-size: 1.45rem; letter-spacing: -0.01em; margin-bottom: 10px; }
.services p { color: var(--ink-2); font-size: 1.0625rem; margin-bottom: 14px; }
.services ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font: 500 0.9375rem/1.4 var(--sans); }
.services li { padding-left: 18px; position: relative; }
.services li::before { content: ''; position: absolute; left: 0; top: 0.6em; width: 8px; height: 2px; background: var(--accent); }

.figure-line { display: flex; align-items: baseline; gap: 14px; padding: 14px 0; margin: 26px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-family: var(--sans); max-width: none; }
.figure-line span { font-size: 0.9375rem; color: var(--ink-2); }
.figure-line strong { font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--accent); }

/* Brad */
.brad { display: grid; grid-template-columns: minmax(140px, 36%) 1fr; gap: 28px; align-items: start; }
.brad p { color: var(--ink-2); font-size: 1.0625rem; }
.brad p:first-child { color: var(--ink); }
.portrait {
  aspect-ratio: 4 / 5; border: 1px solid var(--line); display: grid; place-items: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 60%);
  font: 500 0.8125rem var(--sans); color: var(--ink-3); transition: transform 0.6s cubic-bezier(.2, .7, .2, 1);
}
.portrait { overflow: hidden; }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
blockquote { margin: 34px 0 30px; padding: 0; }
blockquote p { font: italic 400 clamp(1.5rem, 2vw, 1.9rem)/1.3 var(--serif); color: var(--ink); max-width: 22em; margin-bottom: 10px; }
blockquote footer { font: 500 0.875rem var(--sans); color: var(--accent); }
.facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.facts div { padding: 14px 18px 14px 0; border-bottom: 1px solid var(--line); }
.facts dt { font: 500 0.8125rem var(--sans); color: var(--ink-3); margin-bottom: 2px; }
.facts dd { margin: 0; font: 500 1rem/1.4 var(--sans); }

/* Notes */
.notes-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; }
.notes { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.notes a { display: block; padding: 22px 0 24px; border-bottom: 1px solid var(--line); text-decoration: none; }
.note-meta { display: block; font: 500 0.8125rem var(--sans); color: var(--ink-3); margin-bottom: 8px; }
.note-title { display: block; font: 600 1.4rem/1.15 var(--sans); letter-spacing: -0.012em; margin-bottom: 8px; transition: color 0.2s; }
.note-dek { display: block; font-size: 1.0625rem; color: var(--ink-2); max-width: 34em; }
.notes a:hover .note-title { color: var(--accent); }

/* Contact */
.contact-form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; margin: 30px 0 22px; }
.contact-form label { display: grid; gap: 6px; font: 500 0.875rem var(--sans); color: var(--ink-2); }
.contact-form label em { font-style: normal; color: var(--ink-3); }
.contact-form .full { grid-column: 1 / -1; }
.contact-form input, .contact-form textarea {
  width: 100%; background: #000; color: var(--ink); border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 0;
  padding: 12px 14px; font: 400 1.0625rem var(--sans);
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); }
.contact-form [aria-invalid='true'] { border-color: #ff7a6b; }
.contact-form button { justify-self: start; }
.form-error { grid-column: 1 / -1; color: #ff9a8e; font: 500 0.9375rem var(--sans); margin: 0; }
.form-success { font: 600 1.25rem var(--sans); color: var(--accent); }
.direct { font: 500 0.9375rem var(--sans); color: var(--ink-2); }
.chapter-contact { padding-bottom: 18vh; }

/* Footer */
.site-footer {
  position: relative; z-index: 2; background: #000; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 12px 40px;
  padding: 48px var(--pad-r) calc(var(--bar-h) + 36px) var(--pad-l); font: 400 0.9375rem var(--sans); color: var(--ink-2);
}
.site-footer p { margin: 0; }
.site-footer .logo { height: 34px; color: var(--ink); }
.site-footer a { color: var(--ink); }
.site-footer .fine { grid-column: 1 / -1; font-size: 0.8125rem; color: var(--ink-3); max-width: none; }

/* ---------- HUD: readouts bar and chart tray, pinned under the window ---------- */
.hud { position: fixed; z-index: 10; left: var(--col); right: 0; bottom: 0; font-family: var(--sans); pointer-events: none; }
.hud > * { pointer-events: auto; }
.bar {
  position: relative; z-index: 2; height: var(--bar-h); background: #000;
  display: flex; align-items: center; gap: clamp(14px, 1.8vw, 28px); padding: 0 var(--pad-r) 0 22px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.clock { margin: 0; display: flex; align-items: baseline; gap: 10px; }
.clock time { font-size: 1.375rem; font-weight: 600; color: var(--accent); letter-spacing: -0.01em; min-width: 3.1em; }
.clock span { font-size: 0.8125rem; color: var(--ink-2); min-width: 9.5em; }
.reads { display: flex; gap: clamp(12px, 1.6vw, 24px); margin: 0; }
.reads dt { font-size: 0.6875rem; color: var(--ink-3); line-height: 1.2; }
.reads dd { margin: 0; font-size: 0.8125rem; font-weight: 500; line-height: 1.35; min-width: 5.6em; }
.reads .wide dd { min-width: 9.8em; }
.ruler { width: 168px; height: 22px; margin-left: auto; flex: none; }
.ruler .base { stroke: rgba(255, 255, 255, 0.25); stroke-width: 1; }
.ruler .daylight { stroke: var(--sun); stroke-width: 3; opacity: 0.55; }
.ruler .ticks line { stroke: rgba(255, 255, 255, 0.35); }
.ruler .ticks text { font-size: 7px; fill: var(--ink-3); text-anchor: middle; }
.ruler .now { fill: var(--accent); stroke: #000; stroke-width: 1.5; }
.sim { margin: 0; font-size: 0.75rem; color: var(--ink-3); }

.tray {
  position: absolute; left: 0; right: 0; bottom: var(--bar-h); height: var(--tray-h);
  background: #000; border-top: 1px solid var(--line); padding: 14px var(--pad-r) 4px 22px;
  display: flex; flex-direction: column;
  transform: translateY(calc(100% + var(--bar-h))); transition: transform 0.7s cubic-bezier(.2, .7, .2, 1);
}
.tray-open .tray { transform: none; }
.tray-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.tray-title { margin: 0; font-size: 0.9375rem; font-weight: 600; }
.tray-title span { font-weight: 400; color: var(--ink-3); font-size: 0.8125rem; margin-left: 8px; }
.legend { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.75rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 14px; height: 8px; margin-right: 6px; vertical-align: 0; }
.k-line { border-top: 2px solid #fff; height: 0 !important; vertical-align: 3px !important; }
.k-faint { border-top: 1px solid rgba(255, 255, 255, 0.5); height: 0 !important; vertical-align: 3px !important; }
.k-solar { background: rgba(255, 211, 92, 0.3); }
.k-neg { background: rgba(74, 158, 245, 0.6); }
.k-pos { background: rgba(240, 138, 42, 0.55); }
.duck-host { position: relative; flex: 1; min-height: 0; }
.duck { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.duck .line { fill: none; stroke: #fff; stroke-width: 1.5; stroke-linejoin: round; }
.duck .line.faint { stroke: rgba(255, 255, 255, 0.45); stroke-width: 1; }
.duck .solar-fill { fill: rgba(255, 211, 92, 0.2); }
.duck .neg-fill { fill: rgba(74, 158, 245, 0.55); }
.duck .pos-fill { fill: rgba(240, 138, 42, 0.42); }
.duck .direct { font-size: 11px; fill: var(--ink); font-weight: 500; transition: opacity 0.4s; pointer-events: none; }
.duck .now line { stroke: var(--accent); stroke-width: 1; }
.duck .now-label { font-size: 11px; font-weight: 600; fill: var(--accent); }
.duck .now-dot { fill: var(--accent); stroke: #000; stroke-width: 2; }
.duck .hover { opacity: 0; pointer-events: none; }
.duck .hover line { stroke: rgba(255, 255, 255, 0.5); }
.duck-tip {
  position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none;
  display: grid; grid-template-columns: auto auto; gap: 2px 14px; padding: 10px 12px;
  background: #000; border: 1px solid rgba(255, 255, 255, 0.3); font-size: 0.75rem; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.duck-tip[hidden] { display: none; }
.duck-tip b { grid-column: 1 / -1; font-weight: 600; margin-bottom: 4px; }
.duck-tip span:nth-child(odd) { color: var(--ink-3); }
.duck-mobile { display: none; }
.window { display: none; }

/* ---------- Small screens: scene behind, black chapters, windows between ---------- */
@media (max-width: 899px) {
  :root { --col: 100vw; --bar-h: 44px; --pad-l: 22px; --pad-r: 22px; }
  .nav { height: 56px; }
  .nav nav a:not(.nav-cta) { display: none; }
  .nav .nav-cta { padding: 8px 12px; font-size: 0.875rem; }
  .logo { height: 24px; }
  .hero-copy { max-width: none; padding-bottom: calc(var(--bar-h) + 34px); }
  .stage::after {
    background:
      linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.5) 45%, rgba(0, 0, 0, 0) 75%),
      rgba(0, 0, 0, 0.3);
  }
  .hero h1 { font-size: clamp(2.3rem, 10.5vw, 3.4rem); }
  .lede { font-size: 1.125rem; }
  .column { width: 100%; background: transparent; }
  .column::after { display: none; }
  .chapter { background: #000; padding: 72px var(--pad-r) 64px; }
  .chapter-mpp { height: auto; padding: 72px var(--pad-r) 64px; }
  .chapter-mpp .sticky { position: static; padding: 0; }
  .window { display: block; height: 62svh; }
  .iv-read { grid-template-columns: repeat(3, auto); }
  .brad { grid-template-columns: 1fr; }
  .portrait { max-width: 220px; }
  .facts { grid-template-columns: 1fr; }
  .contact-form { grid-template-columns: 1fr; }
  .duck-mobile { display: block; margin-top: 28px; }
  .duck-mobile .duck-host { height: 300px; }
  .hud { left: 0; }
  .tray { display: none; }
  .bar { padding: 0 16px; gap: 16px; }
  .reads > div:not(:last-child), .ruler, .sim { display: none; }
  .clock span { min-width: 0; }
  .site-footer { grid-template-columns: 1fr; }
}

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