/* Solaraytics — rooftop solar calculators
   Structural model: APP SHELL / CONSOLE.
   Persistent left sidebar carries all navigation; there is no top nav bar.
   Content sits in a right-hand pane. Rounded, elevated, product-like.
   Deliberately shares no structure with the other two sites in this portfolio. */

:root {
  --bg:        #F6F7FB;
  --pane:      #FFFFFF;
  --rail:      #151A32;
  --rail-2:    #232A4A;
  --rail-ink:  #C3C9E4;
  --rail-hi:   #FFFFFF;

  --ink:       #171A2B;
  --ink-2:     #545A73;
  --ink-3:     #868CA3;
  --line:      #E1E4EF;
  --line-2:    #C4C9DC;

  --brand:     #2B3A8F;
  --brand-bg:  #ECEFFB;
  --sun:       #B87514;
  --sun-bg:    #FDF3E2;
  --ok:        #1F6B4A;
  --ok-bg:     #E8F4EE;
  --bad:       #A33228;
  --bad-bg:    #FBECEA;

  --sans: system-ui, "Segoe UI", Roboto, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;

  --rail-w: 15.5rem;
  --r: 10px;
  --shadow: 0 1px 2px rgba(21,26,50,.05), 0 4px 16px rgba(21,26,50,.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--sun); outline-offset: 2px; }

/* ============ SHELL ============ */

.shell { display: flex; min-height: 100vh; align-items: flex-start; }

.rail {
  width: var(--rail-w); flex: 0 0 var(--rail-w);
  background: var(--rail); color: var(--rail-ink);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 1.5rem 1.1rem 2rem; display: flex; flex-direction: column; gap: 1.5rem;
}

.brand {
  display: flex; align-items: center; gap: .55rem;
  font-size: 1.12rem; font-weight: 700; letter-spacing: -0.02em;
  color: var(--rail-hi); text-decoration: none;
}
.brand .dot {
  width: .62rem; height: .62rem; border-radius: 50%;
  background: #F0A93B; box-shadow: 0 0 0 4px rgba(240,169,59,.2);
}

.rail-group { display: flex; flex-direction: column; gap: .15rem; }
.rail-group h4 {
  font-family: var(--mono); font-size: .6rem; letter-spacing: .16em; text-transform: uppercase;
  color: #6C749B; margin: 0 0 .5rem .6rem; font-weight: 600;
}
.rail-group a {
  display: flex; align-items: center; gap: .6rem;
  padding: .46rem .6rem; border-radius: 7px;
  font-size: .875rem; color: var(--rail-ink); text-decoration: none; line-height: 1.4;
}
.rail-group a .ico { width: 18px; height: 18px; opacity: .68; }
.rail-group a:hover { background: var(--rail-2); color: var(--rail-hi); }
.rail-group a:hover .ico { opacity: 1; }
.rail-group a[aria-current="page"] { background: var(--brand); color: #fff; font-weight: 600; }
.rail-group a[aria-current="page"] .ico { opacity: 1; color: #FFD27A; }

.rail-foot {
  margin-top: auto; padding-top: 1.1rem; border-top: 1px solid var(--rail-2);
  font-size: .7rem; line-height: 1.55; color: #6C749B;
}
.rail-foot a { color: #8E96BE; text-decoration: none; }
.rail-foot a:hover { color: var(--rail-hi); }

.pane { flex: 1 1 auto; min-width: 0; padding: 0 0 4rem; }
.wrap { max-width: 54rem; margin: 0 auto; padding: 0 2rem; }

/* ============ TOPBAR (thin, inside the pane — not site navigation) ============ */

.topbar {
  background: var(--pane); border-bottom: 1px solid var(--line);
  padding: .7rem 0; position: sticky; top: 0; z-index: 5;
}
/* Pages that open with the gradient hero butt straight against the topbar;
   everything else gets breathing room. */
.topbar + main > .hero { margin-top: 0; }
.topbar + main > :not(.hero):first-child { margin-top: 2rem; }
.topbar .wrap { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.breadcrumb { font-size: .8rem; color: var(--ink-3); }
.breadcrumb a { color: var(--ink-2); text-decoration: none; }
.topbar .stamp { margin-left: auto; font-family: var(--mono); font-size: .68rem; color: var(--ink-3); }

/* ============ PAGE HEADS ============ */

/* Full-bleed gradient hero: breaks out of the pane padding on wide screens. */
.hero {
  background: linear-gradient(145deg, #1B2350 0%, #2B3A8F 48%, #3B4BA8 100%);
  color: #fff; border-radius: 0 0 var(--r) var(--r); margin-bottom: 2rem;
  padding: 2.5rem 0 0; overflow: hidden;
}
.hero .hero-inner {
  max-width: 54rem; margin: 0 auto; padding: 0 2rem;
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 2rem; align-items: center;
}
.hero-copy { padding-bottom: 2.5rem; }
.hero h1 {
  font-size: clamp(1.8rem, 3.9vw, 2.7rem); font-weight: 750; letter-spacing: -0.035em;
  line-height: 1.1; margin: 0 0 .8rem; text-wrap: balance; color: #fff;
}
.hero h1 em { font-style: normal; color: #FFD27A; }
.hero p { font-size: 1.05rem; color: rgba(255,255,255,.8); max-width: 34rem; margin: 0; }
.hero .kicker { color: #FFD27A; }
.hero-art { width: 100%; height: auto; display: block; }

.ico { width: 22px; height: 22px; flex: none; }

/* Headline stat tiles under the hero */
.stat-row {
  display: grid; gap: .85rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  margin: -3.25rem 0 2rem; position: relative; z-index: 2;
}
.stat-tile {
  background: var(--pane); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow);
}
.stat-tile .lbl { display: block; margin-bottom: .3rem; }
.stat-tile .big {
  font-size: 1.6rem; font-weight: 750; letter-spacing: -0.035em; line-height: 1.1;
  font-variant-numeric: tabular-nums; color: var(--brand); display: block;
}
.stat-tile p { margin: .35rem 0 0; font-size: .84rem; color: var(--ink-2); line-height: 1.5; }

.page-head { padding: .5rem 0 1.5rem; }
.page-head h1 {
  font-size: clamp(1.45rem, 3vw, 2rem); font-weight: 700; letter-spacing: -0.025em;
  line-height: 1.18; margin: .3rem 0 .55rem; text-wrap: balance;
}
.page-head .sub { color: var(--ink-2); max-width: 40rem; margin: 0; }

.eyebrow, .kicker, .lbl {
  font-family: var(--mono); font-size: .64rem; letter-spacing: .15em;
  text-transform: uppercase; color: var(--sun); margin: 0 0 .4rem;
}

.section { padding: 1.75rem 0; }
.section-title { font-size: 1.12rem; font-weight: 700; letter-spacing: -0.015em; margin: 0 0 1rem; }

/* ============ CARDS: elevated tiles ============ */

/* Rows stretch so cards in the same row share a height — ragged card bottoms
   are the single most template-looking thing a card grid can do. */
.grid { display: grid; gap: .85rem; align-items: stretch; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }

.card {
  background: var(--pane); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1.15rem 1.2rem; text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: .35rem; height: 100%;
  box-shadow: var(--shadow); transition: transform .12s ease, box-shadow .12s ease;
}
a.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(21,26,50,.06), 0 10px 26px rgba(21,26,50,.09); }
.card h3 { margin: 0; font-size: 1rem; font-weight: 650; letter-spacing: -0.015em; }
.card p { margin: 0; font-size: .875rem; color: var(--ink-2); line-height: 1.55; }
.card .meta { margin-top: auto; padding-top: .5rem; font-family: var(--mono); font-size: .68rem; color: var(--ink-3); }

.pill {
  display: inline-block; font-family: var(--mono); font-size: .63rem; letter-spacing: .08em;
  text-transform: uppercase; background: var(--sun-bg); color: var(--sun);
  padding: .2rem .5rem; border-radius: 999px;
}

/* ============ FORMS ============ */

.calc {
  background: var(--pane); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1.5rem; margin: 1.35rem 0; box-shadow: var(--shadow);
}
.calc h2 { margin: 0 0 1.1rem; font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; }

.fields { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr)); }
.field { display: flex; flex-direction: column; gap: .32rem; }
.field label { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: .74rem; color: var(--ink-3); }

input[type="number"], input[type="text"], input[type="email"], input[type="password"], select {
  font: inherit; font-size: .92rem; padding: .55rem .7rem; width: 100%;
  border: 1px solid var(--line-2); border-radius: 7px;
  background: var(--pane); color: var(--ink);
}
input[type="number"] { font-variant-numeric: tabular-nums; }
input:focus, select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-bg); }

.checks { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); margin-top: 1rem; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .88rem; }
.check input { width: auto; }

.actions { display: flex; gap: .6rem; align-items: center; margin-top: 1.25rem; flex-wrap: wrap; }
.btn {
  font: inherit; font-size: .9rem; font-weight: 650; padding: .6rem 1.3rem; border-radius: 7px;
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
  cursor: pointer; text-decoration: none; display: inline-block;
}
.btn:hover { background: #22307A; border-color: #22307A; color: #fff; }
.btn-ghost { background: var(--pane); color: var(--brand); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--brand-bg); color: var(--brand); border-color: var(--brand); }

/* ============ RESULT ============ */

.result {
  background: var(--pane); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1.6rem; margin: 1.35rem 0; box-shadow: var(--shadow);
  border-top: 3px solid var(--sun);
}
.result h2 { margin: 0 0 1rem; font-size: 1rem; font-weight: 700; }

.headline {
  font-size: clamp(2rem, 6vw, 3rem); font-weight: 750; letter-spacing: -0.035em;
  color: var(--brand); line-height: 1.03; font-variant-numeric: tabular-nums;
}
.headline-sub { font-size: .93rem; color: var(--ink-2); margin-top: .45rem; }

.stats {
  display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  margin: 1.35rem 0;
}
.stat {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: .7rem .85rem; display: flex; flex-direction: column; gap: .2rem;
}
.stat .k { font-family: var(--mono); font-size: .61rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.stat .v { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* ============ TABLES ============ */

.scroll { overflow-x: auto; margin: 1.15rem 0; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 28rem; }
th {
  text-align: left; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 650; padding: .55rem .8rem;
  background: var(--bg); white-space: nowrap;
}
td { padding: .55rem .8rem; border-top: 1px solid var(--line); vertical-align: top; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
th.num { text-align: right; }
tfoot td { font-weight: 700; border-top: 2px solid var(--line-2); }
tbody tr.highlight td { background: var(--sun-bg); }
tbody tr.win td { background: var(--ok-bg); }

/* ============ PROSE ============ */

.prose { max-width: 38rem; }
.prose h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; margin: 2rem 0 .6rem; }
.prose h3 { font-size: 1.02rem; font-weight: 650; margin: 1.5rem 0 .4rem; }
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { margin: 0 0 1rem; padding-left: 1.3rem; }
.prose li { margin-bottom: .38rem; }
.prose code { font-family: var(--mono); font-size: .86em; background: var(--brand-bg); padding: .1rem .35rem; border-radius: 4px; }

.chart {
  margin: 1.35rem 0; padding: 1.15rem 1.2rem 1rem;
  background: var(--pane); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); overflow-x: auto;
}
.chart svg { display: block; min-width: 30rem; }
.chart figcaption {
  margin-top: .8rem; padding-top: .7rem; border-top: 1px solid var(--line);
  font-size: .8rem; line-height: 1.55; color: var(--ink-3);
}

.formula-block, .formula {
  font-family: var(--mono); font-size: .81rem; line-height: 1.7;
  background: var(--rail); color: #D6DBF0; border-radius: 8px;
  padding: 1.05rem 1.2rem; margin: 1.2rem 0; overflow-x: auto; white-space: pre;
}

.note { background: var(--sun-bg); border-left: 3px solid var(--sun); border-radius: 0 8px 8px 0; padding: .9rem 1.1rem; margin: 1.2rem 0; font-size: .89rem; }
.note strong { color: #8A5709; }
.good { background: var(--ok-bg); border-left: 3px solid var(--ok); border-radius: 0 8px 8px 0; padding: .9rem 1.1rem; margin: 1.2rem 0; font-size: .89rem; }
.good strong { color: var(--ok); }
.error { background: var(--bad-bg); border-left: 3px solid var(--bad); border-radius: 0 8px 8px 0; padding: .9rem 1.1rem; margin: 1.2rem 0; font-size: .89rem; color: #7C251D; }

.faq details { background: var(--pane); border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; margin-bottom: .5rem; }
.faq summary { cursor: pointer; font-weight: 650; font-size: .93rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--brand); font-size: 1.1rem; }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: .6rem 0 0; font-size: .89rem; color: var(--ink-2); }

.meta-strip {
  display: flex; gap: 1.2rem; flex-wrap: wrap; font-family: var(--mono); font-size: .69rem;
  color: var(--ink-3); padding: .85rem 0; border-top: 1px solid var(--line); margin-top: 1.5rem;
}

/* Footer lives in the rail; this only carries the legal note. */
.site-footer { margin-top: 2.5rem; }
.footer-grid { display: none; }
.footer-note { font-size: .78rem; line-height: 1.6; color: var(--ink-3); max-width: 42rem; }
.footer-note strong { color: var(--ink-2); }

/* ============ RESPONSIVE: rail becomes a scrolling strip on top ============ */

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .rail {
    width: 100%; flex: none; height: auto; position: static;
    flex-direction: row; align-items: center; gap: 1rem;
    padding: .8rem 1rem; overflow-x: auto;
  }
  .rail-group { flex-direction: row; gap: .3rem; }
  .rail-group h4 { display: none; }
  .rail-group a { white-space: nowrap; font-size: .82rem; }
  .rail-foot { display: none; }
  .wrap { padding: 0 1.15rem; }
  .topbar { position: static; }
}

/* ---------- author byline ---------- */
.byline {
  display: flex; gap: 1.1rem; align-items: flex-start;
  background: var(--pane); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1.2rem 1.3rem; margin: 2.25rem 0 0; max-width: 38rem; box-shadow: var(--shadow);
}
.byline-mark {
  width: 2.6rem; height: 2.6rem; flex: none; border-radius: 50%;
  background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700;
}
.byline-body { min-width: 0; }
.byline-name { margin: 0 0 .3rem; font-size: .9rem; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); }
.byline-note { margin: 0; font-size: .86rem; line-height: 1.6; color: var(--ink-2); }
.byline-date {
  margin: .5rem 0 0; font-family: var(--mono); font-size: .68rem;
  letter-spacing: .07em; color: var(--ink-3);
}