/* Stage1Energy — base styles. Spec v2.0.
   Rules enforced here: zero box-shadows, 8px radii via --radius-md,
   three type faces with fixed jobs, lime once per viewport (by convention). */

/* ---------- Reset ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: light;
  overscroll-behavior-y: none;
  scrollbar-gutter: auto;
  scrollbar-width: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-dark);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Scrollbar — floating lime pill; hidden until scroll / edge hover ---------- */

html::-webkit-scrollbar {
  width: 0;
  height: 0;
}

html.scrollbar-visible::-webkit-scrollbar,
html.scrollbar-persist::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

html.scrollbar-visible,
html.scrollbar-persist {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

html::-webkit-scrollbar-track,
html::-webkit-scrollbar-track:vertical,
html::-webkit-scrollbar-track:horizontal {
  background: transparent;
}

html::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: var(--radius-pill);
  border: var(--scrollbar-thumb-inset) solid transparent;
  background-clip: padding-box;
  min-height: 40px;
}

html::-webkit-scrollbar-thumb:hover,
html::-webkit-scrollbar-thumb:active {
  background-color: var(--scrollbar-thumb-hover);
}

html::-webkit-scrollbar-corner {
  background: transparent;
}

/* Nested scroll areas — same pill, reveal on hover or while scrolling */
.table--wide,
.nav-menu-dropdown {
  scrollbar-width: none;
}

.table--wide::-webkit-scrollbar,
.nav-menu-dropdown::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.table--wide:hover::-webkit-scrollbar,
.table--wide:focus-within::-webkit-scrollbar,
.table--wide.is-scrolling::-webkit-scrollbar,
.nav-menu-dropdown:hover::-webkit-scrollbar,
.nav-menu-dropdown.is-scrolling::-webkit-scrollbar,
html.nav-menu-open .nav-menu-dropdown::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

.table--wide:hover,
.table--wide:focus-within,
.table--wide.is-scrolling,
.nav-menu-dropdown:hover,
.nav-menu-dropdown.is-scrolling,
html.nav-menu-open .nav-menu-dropdown {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.table--wide::-webkit-scrollbar-track,
.nav-menu-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.table--wide::-webkit-scrollbar-thumb,
.nav-menu-dropdown::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: var(--radius-pill);
  border: var(--scrollbar-thumb-inset) solid transparent;
  background-clip: padding-box;
  min-height: 32px;
}

.table--wide::-webkit-scrollbar-thumb:hover,
.nav-menu-dropdown::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

@media (prefers-reduced-motion: no-preference) {
  html::-webkit-scrollbar-thumb,
  .table--wide::-webkit-scrollbar-thumb,
  .nav-menu-dropdown::-webkit-scrollbar-thumb {
    transition: background-color 180ms ease;
  }
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

button {
  font: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.sr-only:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  clip: auto;
  z-index: 100;
  background: var(--lime);
  color: var(--ink);
  padding: 8px 16px;
  font-family: var(--mono);
  font-size: 13px;
}

/* ---------- Type scale (§3.2 — fixed) ---------- */

.mono-xs {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 400;
}

.mono-sm {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  font-weight: 400;
}

.body-sm {
  font-size: 16px;
  line-height: 1.6;
}

.body-lg {
  font-size: 20px;
  line-height: 1.55;
}

.d1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(40px, 7vw, 88px);
  line-height: 1.02;
  max-width: 18ch;
}

.d2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(30px, 4.4vw, 52px);
  line-height: 1.1;
  max-width: 18ch;
}

.d3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.2;
  max-width: 24ch;
}

p,
li {
  max-width: 65ch;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--moss);
}

.sec--dark .eyebrow {
  color: var(--text-mute);
}

.muted {
  color: var(--text-mute);
}

/* ---------- Layout ---------- */

.wrap {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--text {
  max-width: calc(var(--max-text) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sec {
  padding-block: var(--section-pad);
}

.sec--compact {
  padding-block: var(--section-pad-compact);
}

.sec--band {
  padding-block: var(--section-pad-band);
}

.sec--flush-top {
  padding-top: 0;
}

.wrap--prose {
  max-width: calc(72ch + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sec--paper {
  background: var(--paper);
  color: var(--text-dark);
}

.sec--dark {
  background: var(--ink);
  color: var(--paper);
}

.sec--dark,
.site-footer,
.landing-hero,
.cookie-banner {
  --text-mute: var(--text-mute-on-dark);
}

.sec--dark ::selection {
  background: var(--paper);
  color: var(--ink);
}

.hairline {
  border: 0;
  border-top: 1px solid var(--line);
}

.sec--dark .hairline,
.hairline--dark {
  border-top-color: var(--ink-line);
}

/* ---------- Buttons (§4.2) ---------- */

.btn {
  display: inline-block;
  font-family: var(--body);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  padding: 16px 28px;
  border-radius: var(--radius-md);
  text-decoration: none;
  text-align: center;
  transition: transform 150ms ease, background-color 150ms ease;
}

.btn--primary {
  background: var(--lime);
  color: var(--ink);
}

.btn--primary:hover {
  transform: translateY(-1px);
  background: var(--lime-hover);
}

.btn--cta-free {
  white-space: nowrap;
}

.btn--secondary {
  background: transparent;
  border: 1px solid var(--line);
  color: inherit;
}

.sec--dark .btn--secondary,
.btn--secondary.btn--on-dark {
  border-color: var(--ink-line);
}

.btn--secondary:hover {
  transform: translateY(-1px);
}

.btn__free {
  display: inline-block;
  margin-left: 0.4em;
  padding: 3px 9px;
  background: var(--ink);
  color: var(--lime);
  font-family: var(--mono);
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 4px;
  vertical-align: 0.05em;
}

.btn--secondary .btn__free {
  background: var(--lime);
  color: var(--ink);
}

/* Mandatory microcopy directly beneath every primary button (§6) */
.btn-micro {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-top: 12px;
}

/* Tertiary: text link */
.link {
  color: var(--moss);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.sec--dark .link,
.link--on-dark {
  color: var(--lime);
}

/* Quiet variant for dark sections whose lime budget is already spent on a CTA */
.sec--dark .link--quiet,
.link--quiet {
  color: var(--paper);
}

.cta-block {
  margin-top: 40px;
}

/* Header / nav: see assets/css/top-bar.css */

/* ---------- Cards & panels (§3.4) ---------- */

.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 28px;
}

.sec--dark .card,
.card--dark {
  background: var(--ink-2);
  border-color: var(--ink-line);
}

/* The one exception: NPV card carries a 1px lime border (§3.4) */
.card--npv {
  border-color: var(--lime);
}

/* ---------- KPI blocks ---------- */

.kpi {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
}

.sec--dark .kpi {
  background: var(--ink-2);
  border-color: var(--ink-line);
}

.kpi__label {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.kpi__value {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.05;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

.kpi__unit {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-mute);
  margin-top: 4px;
}

/* ---------- Verdict pill ---------- */

.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 10px 18px;
  border-radius: var(--radius-md);
}

.pill--verdict {
  background: var(--lime);
  color: var(--ink);
}

.pill--ghost {
  border: 1px solid var(--ink-line);
  color: var(--paper);
}

/* ---------- Tables ---------- */

.table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
}

.table th {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--text-mute);
  text-align: left;
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--line);
}

.table td {
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.sec--dark .table th,
.sec--dark .table td {
  border-bottom-color: var(--ink-line);
}

.table--wide {
  display: block;
  overflow-x: auto;
}

/* ---------- Flags ---------- */

.flag-status {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  display: inline-block;
}

.flag-status--low {
  background: var(--moss);
  color: var(--paper);
}

.flag-status--medium {
  background: var(--amber);
  color: var(--ink);
}

.flag-status--high {
  background: var(--clay);
  color: var(--paper);
}

.flag-status--info {
  border: 1px solid var(--line);
  color: var(--text-mute);
}

/* ---------- Forms ---------- */

.field {
  margin-bottom: 24px;
}

.field label {
  display: block;
  font-family: var(--body);
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 8px;
}

.field .hint {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-top: 6px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.4;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper-2);
  color: var(--text-dark);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid var(--moss);
  outline-offset: 0;
  border-color: var(--moss);
}

.form-status {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 16px;
  min-height: 20px;
}

.form-status--error {
  color: var(--clay);
}

.form-status--ok {
  color: var(--moss);
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--ink);
  color: var(--paper);
  padding-block: 72px 40px;
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--ink-line);
}

@media (max-width: 767px) {
  .site-footer__grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

.site-footer__brand {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.site-footer p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-mute);
}

.site-footer a {
  color: var(--paper);
}

.site-footer nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.site-footer nav a {
  font-size: 15px;
  text-decoration: none;
}

.site-footer nav a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.site-footer__nav-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 4px;
}

.disclaimer {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: var(--text-mute);
  max-width: 90ch;
  padding-top: 32px;
}

/* ---------- Cookie banner ---------- */

.cookie-banner {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-width: 480px;
  z-index: 70;
  background: var(--ink-2);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius-md);
  color: var(--paper);
  padding: 20px;
  display: none;
}

.cookie-banner.is-visible {
  display: block;
}

.cookie-banner p {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.cookie-banner a {
  color: var(--paper);
}

.cookie-banner__actions {
  display: flex;
  gap: 12px;
}

.cookie-banner .btn {
  padding: 10px 20px;
}

/* Accept is deliberately not lime — the lime budget belongs to the page */
.cookie-banner .btn--accept {
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  padding: 10px 20px;
}

.cookie-banner .btn--plain {
  border: 1px solid var(--ink-line);
  border-radius: var(--radius-md);
  color: var(--paper);
  font-size: 15px;
  font-weight: 500;
  padding: 10px 20px;
}

/* ---------- Sticky CTA bar ---------- */

.sticky-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--ink);
  border-top: 1px solid var(--ink-line);
  color: var(--paper);
  transform: translateY(100%);
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.sticky-bar.is-visible {
  transform: translateY(0);
}

.sticky-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 12px;
}

.sticky-bar__price {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sticky-bar .btn {
  padding: 12px 22px;
  flex-shrink: 0;
}

@media (max-width: 599px) {
  .sticky-bar__price {
    font-size: 12px;
  }
}

@media (max-width: 479px) {
  .sticky-bar .btn--cta-free {
    font-size: 14px;
    padding: 12px 16px;
  }

  .sticky-bar__price {
    font-size: 11px;
    letter-spacing: 0.1em;
  }
}

/* ---------- Reveal animation (§5.1) ---------- */

html.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
}

html.js [data-reveal].is-in {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--reveal-delay, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  html.js [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- Charts ---------- */

.chart-note {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.06em;
  color: var(--text-mute);
  margin-top: 16px;
}

.chart svg {
  width: 100%;
  height: auto;
}

/* Path draw (§5.3): initial hidden state set by JS via dash props */
@media (prefers-reduced-motion: reduce) {
  .chart [data-draw] {
    stroke-dashoffset: 0 !important;
    stroke-dasharray: none !important;
  }

  .chart [data-grow] {
    transform: none !important;
  }
}

/* ---------- Utility grids ---------- */

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gutter);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gutter);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gutter);
}

@media (max-width: 899px) {
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 599px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ---------- Prose pages (legal, methodology) ---------- */

.prose h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.2;
  margin: 48px 0 16px;
  max-width: 24ch;
}

.prose h3 {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 32px 0 12px;
  color: var(--moss);
}

.prose p,
.prose li {
  margin-bottom: 14px;
}

.prose ul,
.prose ol {
  padding-left: 24px;
  margin-bottom: 16px;
}

.prose .mono-sm {
  color: var(--text-mute);
}
