@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Syne:wght@600;700;800&display=swap');

:root {
  --bg: #e8f5f7;
  --bg-card: #f0fafb;
  --bg-blue: #d4edf5;
  --accent: #0d9488;
  --accent-dim: #0f766e;
  --blue: #0284c7;
  --blue-dim: #0369a1;
  --teal: #14b8a6;
  --yellow: #ca8a04;
  --yellow-dim: #a16207;
  --text: #1e3a42;
  --text-muted: #5a7d87;
  --border: #a8d4e0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: linear-gradient(135deg, #e8f5f7 0%, #d4edf5 25%, #e0f2f7 50%, #d4edf5 75%, #e8f5f7 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
}

.admin-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.admin-link:hover {
  color: var(--accent);
}

.admin-trigger {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 10000;
  opacity: 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 1.25rem;
}

.logo-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 6px rgba(20, 184, 166, 0.4));
}

.logo-text {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-tagline {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-left: 0.5rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border);
}

main {
  max-width: 840px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.learn-main {
  max-width: 720px;
}

.learn-article {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 2.5rem;
  box-shadow: 0 4px 20px rgba(20, 184, 166, 0.08);
}

.learn-article h1 {
  font-family: 'Syne', sans-serif;
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--accent);
}

.learn-article h1::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--teal), var(--accent));
  border-radius: 2px;
  margin-top: 0.75rem;
}

.learn-content {
  margin-bottom: 2rem;
  line-height: 1.7;
}

.learn-content h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.25rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--text);
}

.learn-content h3 {
  font-size: 1.1rem;
  margin: 1.25rem 0 0.5rem;
}

.learn-content p {
  margin-bottom: 1rem;
}

.learn-content ul,
.learn-content ol {
  margin: 0.5rem 0 1rem 1.5rem;
}

.learn-content li {
  margin-bottom: 0.35rem;
}

.learn-content code {
  background: var(--bg-blue);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.learn-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.article-boxes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.article-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.06);
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
}

.article-link {
  text-decoration: none;
  color: inherit;
  padding: 1.25rem 1.5rem;
  transition: background 0.2s, box-shadow 0.2s;
}

.article-link:hover {
  background: var(--bg-blue);
  box-shadow: 0 4px 16px rgba(20, 184, 166, 0.12);
}

.article-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.article-preview {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 0.75rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-read-more {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--teal);
}

@media (max-width: 640px) {
  .article-boxes {
    grid-template-columns: 1fr;
  }
}

/* Full article page */
.article-page-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.article-full {
  padding: 0;
}

.article-back {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  transition: color 0.2s;
}

.article-back:hover {
  color: var(--teal);
}

.article-full-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 1.5rem;
  line-height: 1.3;
}

.article-full-body {
  line-height: 1.7;
  margin-bottom: 2rem;
}

.article-full-body p {
  margin: 0 0 1.25rem;
}

.article-full-body p:first-child {
  margin-top: 0;
}

.hero h1 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.hero h1::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--teal), var(--accent));
  border-radius: 2px;
  margin-top: 0.5rem;
}

.solar-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input {
  padding: 1rem 1.25rem;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.3);
}

.form-group input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.postal-code-display {
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 500;
  min-height: 1.25em;
}

.cta-button {
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  background: linear-gradient(135deg, var(--teal) 0%, var(--blue) 100%);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 0.25rem;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.35);
}

.cta-button:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

.cta-button:active {
  transform: translateY(0);
}

.cta-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Results */
.results {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: linear-gradient(145deg, #ffffff 0%, #f0fafb 100%);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(20, 184, 166, 0.15);
  animation: fadeIn 0.4s ease;
}

.hidden {
  display: none !important;
}

.results.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.results h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
}

.results-system-image {
  margin-bottom: 1rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.results-system-image img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  object-position: center;
  display: block;
  background: var(--bg-card);
}

.email-signup-section {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}
.email-signup-section .email-signup-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}
.email-signup-section .email-signup-form input {
  min-width: 200px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border, #a8d4e0);
  border-radius: 10px;
  font-size: 0.95rem;
}
.cta-button-secondary {
  background: var(--bg-blue, #d4edf5);
  color: var(--text, #1e3a42);
  border: 1px solid var(--border, #a8d4e0);
}
.cta-button-secondary:hover {
  background: var(--border, #a8d4e0);
}
.email-signup-msg.error {
  color: #c53030;
}

.book-installation {
  margin-top: 1.25rem;
  padding: 1rem;
  background: rgba(20, 184, 166, 0.12);
  border: 1px solid rgba(20, 184, 166, 0.35);
  border-radius: 10px;
}

.book-installation h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.book-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.book-btn {
  margin-top: 0;
  text-decoration: none;
}

a.book-call-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.book-email-line {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}

.book-email-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.book-email-link:hover {
  text-decoration: underline;
}

.booking-success-banner {
  background: linear-gradient(135deg, var(--teal, #14b8a6) 0%, var(--accent, #0d9488) 100%);
  color: white;
  padding: 1rem 1.5rem;
  text-align: center;
  font-weight: 500;
}

.booking-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.booking-form .form-group {
  margin-bottom: 1rem;
}

.booking-info {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.booking-success {
  color: var(--accent);
  margin: 0.5rem 0;
}

.booking-cart {
  margin-top: 1rem;
  padding: 1.25rem;
  background: rgba(20, 184, 166, 0.08);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.booking-cart h4 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
}

.cart-summary {
  margin-bottom: 1.25rem;
}

.cart-summary p {
  margin: 0.4rem 0;
  font-size: 0.95rem;
}

.rebate-note {
  font-size: 0.85rem;
  color: var(--text-muted, #5a7d87);
  font-style: italic;
  margin: 0.25rem 0 0.75rem 0;
}

.payment-schedule {
  margin: 0.5rem 0 1rem 1.5rem;
  padding: 0;
  font-size: 0.95rem;
}

.payment-schedule li {
  margin: 0.25rem 0;
}

.paypal-checkout {
  margin-bottom: 1rem;
}

.cart-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.cart-paypal-form {
  display: inline-block;
}

.cta-button-paypal {
  background: #003087;
  color: white;
}

.cta-button-paypal:hover {
  background: #001c5e;
  color: white;
}

.cart-mailto-fallback {
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.cart-mailto-fallback .cta-button {
  margin-top: 0.5rem;
}

.cart-mailto-fallback a {
  color: var(--accent);
  font-weight: 600;
}

#cart-back {
  margin-top: 0.5rem;
}

.results .spec-sheet-link {
  display: inline-block;
  margin: 0 0 1rem 0;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .results-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.75rem;
  background: rgba(20, 184, 166, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(20, 184, 166, 0.25);
}

.result-item .label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.result-item .value {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--accent);
}

/* Area reference verification (temporary debug) */
.area-math-debug {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.04);
  border: 1px dashed var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
}

.area-math-debug h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.area-math-error {
  color: #b91c1c;
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
  padding: 0.5rem;
  background: rgba(185, 28, 28, 0.1);
  border-radius: 6px;
}

.area-math-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.area-math-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.area-math-item .label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.area-math-item .value {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text);
  word-break: break-word;
}

.rebate-value {
  color: var(--yellow) !important;
}

/* Sale treatment on results */
.result-value-with-sale {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.result-sale-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.result-sale-struck {
  position: relative;
  color: var(--text-muted);
}

.result-sale-struck::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  height: 2px;
  background: #dc2626;
  box-shadow: 0 0 4px rgba(220, 38, 38, 0.5);
}

/* Sale delayed: hide sale elements, no strikethrough yet */
.sale-delayed .result-sale-struck::after {
  width: 0 !important;
  animation: none;
}

.sale-delayed .result-sale-now,
.sale-delayed .result-sale-badge,
.sale-delayed .savings-chart-sale-header {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.sale-delayed .result-item-sale {
  background: rgba(20, 184, 166, 0.1);
  border-color: rgba(20, 184, 166, 0.25);
}

.sale-delayed .savings-chart-sale {
  border-color: rgba(20, 184, 166, 0.2);
  background: rgba(20, 184, 166, 0.08);
}

/* Sale revealed: animate in */
.sale-revealed .result-sale-struck::after {
  animation: saleStrikeThrough 0.6s ease-out forwards;
}

.sale-revealed .result-sale-now {
  animation: saleFadeIn 1.2s ease forwards;
}

.sale-revealed .result-sale-badge {
  animation: saleFadeIn 1.2s ease 0.15s forwards;
}

.sale-revealed .savings-chart-sale-header {
  animation: saleFadeIn 1.2s ease 0.3s forwards;
}

.sale-revealed .result-item-sale {
  transition: background 1s ease, border-color 1s ease;
}

.sale-revealed .savings-chart-sale {
  transition: border-color 1s ease, background 1s ease;
}

@keyframes saleFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes saleStrikeThrough {
  from { width: 0; opacity: 0.8; }
  to { width: 100%; opacity: 1; }
}

.result-sale-now {
  font-weight: 700;
  color: #dc2626;
}

.result-item-sale {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.3);
}

.result-sale-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}

.result-sale-label {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: #dc2626;
  letter-spacing: 0.08em;
}

.result-sale-countdown {
  font-size: 0.8rem;
  font-weight: 600;
  color: #b91c1c;
}

.savings-chart-sale {
  border-color: rgba(220, 38, 38, 0.4);
  background: rgba(220, 38, 38, 0.05);
}

.savings-chart-sale-header {
  margin-bottom: 0.75rem;
}

.sale-revealed .savings-chart-sale .chart-bar-value .result-sale-struck::after,
.sale-revealed .savings-chart-sale-header ~ .chart-bars .result-sale-struck::after {
  animation: saleStrikeThrough 1s ease-out 0.3s forwards;
}

.savings-chart-sale .savings-chart-sale-header .result-sale-badge {
  align-items: flex-start;
}

.savings-chart-sale .savings-chart-sale-header .result-sale-label {
  font-size: 2rem;
}

/* Savings chart */
.savings-chart {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(20, 184, 166, 0.08);
  border: 1px solid rgba(20, 184, 166, 0.2);
  border-radius: 10px;
}

.savings-chart h3 {
  font-family: 'Syne', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem;
}

.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chart-bar-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.chart-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.chart-bar-label span:first-child {
  color: var(--text-muted);
}

.chart-bar-value {
  font-weight: 600;
  color: var(--accent);
}

.chart-bar-track {
  height: 12px;
  background: rgba(20, 184, 166, 0.2);
  border-radius: 6px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease;
}

.chart-bar-payback {
  background: linear-gradient(90deg, var(--blue) 0%, var(--teal) 100%);
}

.chart-bar-savings {
  background: linear-gradient(90deg, var(--accent) 0%, var(--teal) 100%);
}

.chart-bar-axis-row {
  display: flex;
  justify-content: space-between;
}

.chart-bar-axis {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sale-banner {
  padding: 0.5rem 1.5rem;
  background: linear-gradient(135deg, var(--yellow) 0%, var(--yellow-dim) 100%);
  color: #1a1a1a;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.sale-banner.hidden {
  display: none;
}

.sale-countdown {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.kit-countdown {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--yellow-dim);
  margin-bottom: 0.25rem;
}

.price-was {
  text-decoration: line-through;
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 0.35rem;
}

.price-sale {
  color: var(--accent);
  font-weight: 700;
}

.results-kit {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.results-kit h3 {
  margin-bottom: 0.5rem;
}

.kits-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.5rem;
}

.results-kit-multi .kits-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.kit-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.75rem;
  padding: 0.85rem;
  background: var(--bg-card);
  border-radius: 10px;
  margin-top: 0;
  min-width: 0;
}

.results-kit-multi .kit-card {
  grid-template-columns: 140px 1fr;
  padding: 1.25rem;
}

.kit-card img {
  width: 100%;
  height: 80px;
  object-fit: contain;
  border-radius: 8px;
}

.results-kit-multi .kit-card img {
  height: 100px;
}

.kit-no-img {
  width: 100%;
  height: 80px;
  background: var(--bg-blue);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.results-kit-multi .kit-no-img {
  height: 100px;
}

.kit-info h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.kit-info .specs {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.kit-info .price {
  font-weight: 700;
  color: var(--accent);
}

.spec-sheet-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
}

.spec-sheet-link:hover {
  text-decoration: underline;
}

.equipment-img-placeholder {
  width: 100px;
  height: 80px;
  background: var(--bg-blue);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.error {
  color: #ef4444;
}
