/* ==========================================================================
   GetVRF — custom layer on top of Tailwind
   Design tokens, bespoke components, motion, charts, print report.
   ========================================================================== */

:root {
  --ink: #0B1F33;
  --navy: #0A2540;
  --blue: #0369A1;
  --blue-deep: #075985;
  --green: #047857;
  --green-bright: #059669;
  --amber: #F59E0B;
  --amber-deep: #B45309;
  --line: #E2E8F0;
  --surface: #F8FAFC;
  /* Chart palette — CVD-validated (do not reorder): current / VRF / VRF+solar */
  --chart-current: #B45309;
  --chart-vrf: #0369A1;
  --chart-solar: #059669;
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
body { font-family: Inter, ui-sans-serif, system-ui, sans-serif; color: var(--ink); }
[id] { scroll-margin-top: 96px; }

::selection { background: #BAE6FD; color: var(--navy); }

/* Focus visibility (a11y) */
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--navy); color: #fff; padding: .6rem 1rem; border-radius: 0 0 .5rem 0;
}
.skip-link:focus { left: 0; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
/* display via :where() so Tailwind utilities (hidden, sm:inline-flex) can win */
:where(.btn) { display: inline-flex; }
.btn {
  align-items: center; justify-content: center; gap: .5rem;
  font-weight: 600; font-size: .95rem; line-height: 1;
  border-radius: .75rem; padding: .875rem 1.5rem;
  transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease;
  cursor: pointer; text-decoration: none; border: 1px solid transparent;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 8px 20px -8px rgba(4,120,87,.5); }
.btn-primary:hover { background: #065F46; box-shadow: 0 10px 26px -8px rgba(4,120,87,.55); transform: translateY(-1px); }
.btn-secondary { background: #fff; color: var(--navy); border-color: #CBD5E1; }
.btn-secondary:hover { border-color: var(--blue); color: var(--blue-deep); transform: translateY(-1px); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: #0D2F4F; transform: translateY(-1px); }
.btn-light { background: #fff; color: var(--navy); }
.btn-light:hover { background: #E0F2FE; transform: translateY(-1px); }
.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.btn-outline-light:hover { border-color: #fff; background: rgba(255,255,255,.08); }
.btn-sm { padding: .55rem 1rem; font-size: .85rem; border-radius: .6rem; }
.btn-lg { padding: 1.05rem 1.9rem; font-size: 1.05rem; }

/* --------------------------------------------------------------------------
   Type helpers
   -------------------------------------------------------------------------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--blue-deep);
}
.eyebrow::before { content: ""; width: 1.5rem; height: 2px; background: var(--green-bright); border-radius: 2px; }
.eyebrow--light { color: #7DD3FC; }

.h-display { font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif; letter-spacing: -0.02em; }

/* --------------------------------------------------------------------------
   Cards & chips
   -------------------------------------------------------------------------- */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 1.25rem;
  box-shadow: 0 1px 2px rgba(10,37,64,.05);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.card-hover:hover { transform: translateY(-4px); box-shadow: 0 2px 4px rgba(10,37,64,.06), 0 18px 40px -14px rgba(10,37,64,.25); border-color: #BFDBFE; }

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: #334155;
}
.chip--blue  { background: #E0F2FE; border-color: #BAE6FD; color: #075985; }
.chip--green { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.chip--amber { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.chip--navy  { background: var(--navy); border-color: var(--navy); color: #fff; }

/* Icon tile used in benefit grids */
.icon-tile {
  display: inline-flex; align-items: center; justify-content: center;
  width: 3rem; height: 3rem; border-radius: .9rem; flex: none;
  background: linear-gradient(135deg, #E0F2FE, #ECFDF5);
  color: var(--blue-deep); border: 1px solid #E2E8F0;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field-label { display: block; font-size: .85rem; font-weight: 600; color: var(--navy); margin-bottom: .4rem; }
.field-hint { font-size: .78rem; color: #64748B; margin-top: .35rem; }
.input, .select, .textarea {
  width: 100%; border: 1px solid #CBD5E1; border-radius: .7rem;
  padding: .7rem .9rem; font-size: .95rem; color: var(--ink); background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(3,105,161,.15);
}
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; padding-right: 2.4rem; }

/* Range sliders (calculator) */
.range { appearance: none; width: 100%; height: 6px; border-radius: 999px; background: #E2E8F0; outline-offset: 6px; }
.range::-webkit-slider-thumb {
  appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid var(--blue); cursor: pointer;
  box-shadow: 0 2px 6px rgba(10,37,64,.25); transition: transform .12s ease;
}
.range::-webkit-slider-thumb:hover { transform: scale(1.12); }
.range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 3px solid var(--blue); cursor: pointer;
}

/* Form success state */
.form-success { display: none; }
form.is-submitted { display: none; }
form.is-submitted + .form-success { display: block; }

/* --------------------------------------------------------------------------
   Sticky header
   -------------------------------------------------------------------------- */
.site-header { transition: box-shadow .25s ease, background-color .25s ease; }
.site-header.is-scrolled { box-shadow: 0 4px 24px -12px rgba(10,37,64,.25); }
.nav-link { position: relative; font-size: .92rem; font-weight: 500; color: #334155; padding: .4rem .15rem; }
.nav-link:hover { color: var(--navy); }
.nav-link.is-active { color: var(--blue-deep); font-weight: 600; }
.nav-link.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px;
  border-radius: 2px; background: var(--green-bright);
}

/* --------------------------------------------------------------------------
   Hero background — engineered grid + soft energy glows
   -------------------------------------------------------------------------- */
.hero-dark {
  background:
    radial-gradient(52rem 30rem at 84% -12%, rgba(245,158,11,.16), transparent 60%),
    radial-gradient(46rem 30rem at -8% 108%, rgba(5,150,105,.22), transparent 62%),
    linear-gradient(158deg, #071A2E 0%, #0A2540 46%, #0B3B57 100%);
  position: relative; overflow: hidden;
}
.hero-dark::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(148,197,255,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,197,255,.07) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(70rem 42rem at 50% 0%, #000 30%, transparent 78%);
}
.band-dark { background: linear-gradient(150deg, #071A2E, #0A2540 55%, #0E3A46); }

/* Animated energy-flow dashes inside SVG diagrams */
.flow-line { stroke-dasharray: 6 8; animation: flowDash 1.6s linear infinite; }
@keyframes flowDash { to { stroke-dashoffset: -28; } }
@media (prefers-reduced-motion: reduce) { .flow-line { animation: none; } }

/* --------------------------------------------------------------------------
   Scroll reveal
   -------------------------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0ms); will-change: opacity, transform; }
.reveal.revealed { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* --------------------------------------------------------------------------
   Accordion
   -------------------------------------------------------------------------- */
.acc-item { border: 1px solid var(--line); border-radius: 1rem; background: #fff; overflow: hidden; }
.acc-trigger {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  text-align: left; font-weight: 600; color: var(--navy); padding: 1.1rem 1.25rem; cursor: pointer;
}
.acc-trigger:hover { background: var(--surface); }
.acc-icon { flex: none; transition: transform .25s ease; color: var(--blue-deep); }
.acc-trigger[aria-expanded="true"] .acc-icon { transform: rotate(45deg); }
.acc-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s ease; }
.acc-panel > div { overflow: hidden; }
.acc-panel.open { grid-template-rows: 1fr; }
.acc-panel .acc-body { padding: 0 1.25rem 1.2rem; color: #475569; font-size: .95rem; line-height: 1.65; }

/* --------------------------------------------------------------------------
   Tabs (state incentives)
   -------------------------------------------------------------------------- */
.tab-btn {
  padding: .65rem 1.15rem; border-radius: .75rem; font-weight: 600; font-size: .92rem;
  color: #475569; border: 1px solid var(--line); background: #fff; cursor: pointer;
  transition: all .2s ease;
}
.tab-btn:hover { border-color: var(--blue); color: var(--blue-deep); }
.tab-btn[aria-selected="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.tab-panel[hidden] { display: none; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 1rem; background: #fff; }
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 560px; }
.data-table th {
  text-align: left; font-weight: 600; color: var(--navy); background: var(--surface);
  padding: .8rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table td { padding: .8rem 1rem; border-bottom: 1px solid #F1F5F9; color: #334155; vertical-align: top; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .row-highlight { background: #ECFDF5; }

/* --------------------------------------------------------------------------
   Article (guides) — supplements Tailwind typography plugin
   -------------------------------------------------------------------------- */
.article { max-width: 46rem; }
.article .prose h2 { font-family: "Space Grotesk", sans-serif; letter-spacing: -.015em; color: var(--navy); }
.article .prose h3 { color: var(--navy); }
.article .prose a { color: var(--blue-deep); text-decoration-color: #7DD3FC; text-underline-offset: 3px; }
.article .prose a:hover { color: var(--blue); }
.article .prose blockquote { border-left-color: var(--green-bright); color: #334155; }
.article .prose strong { color: var(--navy); }
.callout { border: 1px solid; border-radius: 1rem; padding: 1.1rem 1.25rem; font-size: .95rem; line-height: 1.6; margin: 1.75rem 0; }
.callout--info  { background: #F0F9FF; border-color: #BAE6FD; color: #0C4A6E; }
.callout--green { background: #ECFDF5; border-color: #A7F3D0; color: #064E3B; }
.callout--amber { background: #FFFBEB; border-color: #FDE68A; color: #78350F; }
.callout--red   { background: #FEF2F2; border-color: #FECACA; color: #7F1D1D; }

/* Sticky table of contents */
.toc a { display: block; padding: .35rem 0 .35rem .9rem; border-left: 2px solid var(--line); color: #64748B; font-size: .88rem; }
.toc a:hover { color: var(--navy); border-left-color: #94A3B8; }
.toc a.is-current { color: var(--blue-deep); border-left-color: var(--green-bright); font-weight: 600; }

/* --------------------------------------------------------------------------
   Charts — hand-rolled SVG/HTML. Palette is CVD-validated; text stays in ink.
   -------------------------------------------------------------------------- */
.bar-row { display: grid; grid-template-columns: 7.5rem 1fr auto; align-items: center; gap: .9rem; padding: .55rem 0; }
.bar-label { font-size: .85rem; color: #475569; font-weight: 500; }
.bar-track { height: 18px; border-radius: 5px; background: #F1F5F9; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 0 4px 4px 0; width: 0; transition: width .9s cubic-bezier(.2,.7,.2,1); }
.bar-fill--current { background: var(--chart-current); }
.bar-fill--vrf { background: var(--chart-vrf); }
.bar-fill--solar { background: var(--chart-solar); }
.bar-value { font-size: .9rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; min-width: 4.5rem; text-align: right; }

.donut-wrap { position: relative; width: 158px; height: 158px; }
.donut-wrap svg { transform: rotate(-90deg); }
.donut-track { fill: none; stroke: #E2E8F0; stroke-width: 14; }
.donut-arc { fill: none; stroke: var(--chart-solar); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2,.7,.2,1); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* Result stat tiles */
.stat-tile { background: #fff; border: 1px solid var(--line); border-radius: 1rem; padding: 1.1rem 1.25rem; }
.stat-tile .stat-label { font-size: .78rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: #64748B; }
.stat-tile .stat-value { font-family: "Space Grotesk", sans-serif; font-size: 1.7rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: .2rem; }
.stat-tile .stat-sub { font-size: .8rem; color: #64748B; margin-top: .15rem; }

/* --------------------------------------------------------------------------
   Modal (report gate)
   -------------------------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 80; display: none; }
.modal.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(7,26,46,.62); backdrop-filter: blur(3px); }
.modal-card {
  position: relative; z-index: 1; max-width: 30rem; margin: 8vh auto 0; background: #fff;
  border-radius: 1.25rem; padding: 2rem; box-shadow: 0 30px 80px -20px rgba(7,26,46,.5);
  max-height: 84vh; overflow-y: auto; width: calc(100% - 2rem);
  animation: modalIn .28s cubic-bezier(.2,.7,.2,1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* Mobile nav panel */
.mobile-nav { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s ease; }
.mobile-nav > div { overflow: hidden; }
.mobile-nav.open { grid-template-rows: 1fr; }

/* Timeline (how it works) */
.step-num {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 2.6rem; height: 2.6rem; border-radius: 50%; font-family: "Space Grotesk", sans-serif;
  font-weight: 700; background: var(--navy); color: #fff; font-size: 1.05rem;
}

/* Logo mark sizing */
.logo-mark { width: 2.15rem; height: 2.15rem; flex: none; }

/* --------------------------------------------------------------------------
   Print: turn the calculator results panel into the "PDF report"
   (Download PDF = print-to-PDF of this view; swap for jsPDF/server later)
   -------------------------------------------------------------------------- */
@media print {
  body * { visibility: hidden; }
  #results-panel, #results-panel * { visibility: visible; }
  #results-panel { position: absolute; inset: 0 auto auto 0; width: 100%; box-shadow: none !important; border: none !important; }
  .no-print { display: none !important; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
