/* ================================================================
   Carbon Calculator — visual skin
   Tokens sourced from design-system/colors_and_type.css
================================================================ */

/* ── Page wrapper ─────────────────────────────────────────── */
.calculator-wrapper {
  font-family: var(--font-sans);
}

.py-lg-6 {
  padding-top: 5rem;
  padding-bottom: 5rem;
}

/* ── Cards ────────────────────────────────────────────────── */
.hero-shell,
.calculator-card,
.results-card {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
}

.hero-shell {
  background: linear-gradient(135deg, rgba(255,255,255,0.97), var(--n-50));
}

.hero-shell h1,
.results-card h2,
.calculator-card h2 {
  font-family: var(--font-display);
  font-weight: var(--weight-extrabold);
  letter-spacing: var(--tracking-tight);
  color: var(--n-900);
}

/* ── Inner panels ─────────────────────────────────────────── */
.hero-note,
.results-placeholder,
.summary-tile,
.results-meta,
.disclaimer-box {
  border: 1px solid var(--border);
  background: var(--n-50);
}

.summary-tile.accent {
  background: rgba(201,12,15,0.05);
  border-color: rgba(201,12,15,0.15);
}

/* ── Typography helpers ───────────────────────────────────── */
.eyebrow,
.small-label,
.meta-label {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--palm-red);
}

.lead,
.text-secondary,
.form-text {
  color: var(--fg-2) !important;
  font-family: var(--font-sans);
}

/* ── Step pills ───────────────────────────────────────────── */
.step-pill {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  background: rgba(201,12,15,0.08);
  color: var(--palm-brown);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}

.step-pill.muted {
  background: var(--n-100);
  color: var(--fg-2);
}

/* ── Form controls ────────────────────────────────────────── */
.form-label {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--fg-1);
  margin-bottom: 6px;
}

.form-control,
.form-select,
.input-group-text {
  font-family: var(--font-sans);
  border-color: var(--border-strong);
  background-color: var(--bg-raised);
  color: var(--fg-1);
  min-height: 3.25rem;
  border-radius: var(--radius-sm) !important;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--palm-red);
  box-shadow: 0 0 0 3px rgba(201,12,15,0.14);
}

.form-control::placeholder { color: var(--fg-3); }

/* ── Primary button ───────────────────────────────────────── */
.btn-primary {
  --bs-btn-bg: var(--palm-red);
  --bs-btn-border-color: var(--palm-red);
  --bs-btn-hover-bg: var(--accent-hover);
  --bs-btn-hover-border-color: var(--accent-hover);
  --bs-btn-active-bg: var(--accent-press);
  --bs-btn-active-border-color: var(--accent-press);
  --bs-btn-disabled-bg: var(--palm-red);
  --bs-btn-disabled-border-color: var(--palm-red);
  font-family: var(--font-sans);
  font-weight: var(--weight-bold);
  border-radius: var(--radius-pill) !important;
  transition: background var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
}
.btn-primary:hover {
  box-shadow: var(--shadow-brand);
  transform: translateY(-1px);
}
.btn-primary:active { transform: scale(0.99); }

.report-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-sans);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-pill) !important;
  border-color: var(--palm-red) !important;
  color: var(--palm-red) !important;
  text-decoration: none;
  padding: 0.45rem 0.95rem;
}
.report-download-btn:hover,
.report-download-btn:focus-visible {
  background: rgba(201,12,15,0.08) !important;
  border-color: var(--accent-hover) !important;
  color: var(--accent-hover) !important;
}

.btn-primary:disabled,
.btn-primary.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Consent checkbox row ─────────────────────────────────── */
.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.consent-row input[type="checkbox"] {
  margin: 0;
  accent-color: var(--palm-red);
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
}
.consent-row label {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--fg-2);
  margin: 0;
  flex: 1;
}
.consent-row label a {
  color: var(--palm-red);
  text-decoration: underline;
}
.consent-row label a:hover { color: var(--accent-hover); }

/* Honeypot — hidden off-canvas, still submitted with the form */
.hpfield {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

#submitHelperText {
  font-size: var(--text-xs);
  color: var(--fg-3);
}

/* ── Results placeholder ──────────────────────────────────── */
.results-placeholder {
  min-height: 18rem;
  display: grid;
  place-items: center;
}

.results-placeholder h3 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  color: var(--n-900);
}

/* ── Results meta bar ─────────────────────────────────────── */
.results-meta .row > [class*="col-"] {
  min-width: 0; /* allow flex/grid children to shrink so text can wrap */
}

.meta-value {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--fg-1);
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

.meta-value-secondary {
  margin-top: 0.15rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--fg-2);
}

/* ── Valuation table ──────────────────────────────────────── */
.valuation-table thead th {
  padding-top: 1rem;
  padding-bottom: 1rem;
  border-bottom-width: 1px;
  border-color: var(--border);
  color: var(--n-900);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  letter-spacing: 0.02em;
}

.valuation-table tbody td,
.valuation-table tbody th {
  padding-top: 1rem;
  padding-bottom: 1rem;
  border-color: var(--border);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--fg-2);
}

.valuation-table tbody tr:first-child td,
.valuation-table tbody tr:first-child th {
  border-top: none;
}

.value-cell {
  font-weight: var(--weight-bold);
  white-space: nowrap;
  color: var(--fg-1);
}

.year-cell {
  font-weight: var(--weight-extrabold);
  font-family: var(--font-mono);
  color: var(--fg-1);
  letter-spacing: 0.02em;
}

/* ── Alert ────────────────────────────────────────────────── */
.alert-warning {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  background: var(--golden-50);
  border-color: var(--golden) !important;
  color: var(--n-800);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .display-5 { font-size: 2.5rem; }
  .py-lg-6 { padding-top: 3rem; padding-bottom: 3rem; }
}

/* ── Carbon equivalencies ─────────────────────────────────── */
.equiv-teaser {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}
.equiv-teaser span {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-pill);
  background: var(--bg-raised);
  border: 1px dashed var(--border-strong);
  color: var(--palm-red);
}
.equiv-teaser svg { width: 1.2rem; height: 1.2rem; stroke-width: 2; }

.equiv-panel {
  position: relative;
  overflow: hidden;
  color: var(--fg-on-dark);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(254,215,94,0.16), transparent 55%),
    linear-gradient(145deg, var(--palm-brown) 0%, var(--palm-red) 100%);
  box-shadow: var(--shadow-md);
}

.equiv-eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--golden);
}

.equiv-heading {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-extrabold);
  letter-spacing: var(--tracking-tight);
  color: var(--n-0);
}

.equiv-sub { color: var(--fg-on-dark-2); font-size: var(--text-sm); }

.equiv-how {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,0.35);
  color: var(--n-0);
  font-weight: var(--weight-semibold);
  padding: 0.4rem 0.9rem;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.equiv-how:hover,
.equiv-how:focus-visible,
.equiv-how[aria-expanded="true"] {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.6);
  color: var(--n-0);
}
.equiv-how svg { width: 1rem; height: 1rem; stroke-width: 2.2; }

.equiv-tile {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  transition: transform var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.equiv-tile:hover {
  transform: translateY(-3px);
  background: rgba(255,255,255,0.13);
}

.equiv-icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  background: var(--golden);
  color: var(--palm-brown);
}
.equiv-icon svg { width: 1.35rem; height: 1.35rem; stroke-width: 2.2; }

.equiv-value {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.3rem;
  font-family: var(--font-display);
  font-weight: var(--weight-extrabold);
  letter-spacing: var(--tracking-tight);
  line-height: 1.1;
  color: var(--n-0);
}
.equiv-approx { font-size: var(--text-lg); color: var(--golden); }
.equiv-number { font-size: clamp(1.6rem, 1.2rem + 1.2vw, var(--text-2xl)); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.equiv-scale  { font-size: var(--text-lg); }

.equiv-text {
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--fg-on-dark);
  flex: 1;
}

.equiv-source {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.14);
}
.equiv-source a {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  background: rgba(0,0,0,0.18);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--fg-on-dark);
  text-decoration: none;
}
.equiv-source a:hover,
.equiv-source a:focus-visible { background: rgba(0,0,0,0.3); color: var(--n-0); text-decoration: underline; }
.equiv-source svg { width: 0.8rem; height: 0.8rem; stroke-width: 2.4; }

.equiv-method {
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  color: var(--fg-2);
  font-size: var(--text-sm);
}
.equiv-method h4 { color: var(--fg-1); font-weight: var(--weight-bold); }
.equiv-method a { color: var(--link); }

.equiv-table th,
.equiv-table td {
  font-size: var(--text-xs);
  color: var(--fg-2);
  border-color: var(--border);
  vertical-align: top;
}
.equiv-table thead th { color: var(--fg-1); font-weight: var(--weight-bold); }
.equiv-table tbody th { color: var(--fg-1); white-space: nowrap; }
.equiv-table td:last-child { font-family: var(--font-mono); }

.equiv-sources li { margin-bottom: 0.4rem; }
.equiv-meta { font-size: var(--text-xs); color: var(--fg-3); }

.equiv-disclaimer {
  font-size: var(--text-xs);
  line-height: 1.55;
  color: var(--fg-on-dark-2);
}

/* Entrance: tiles rise in once the panel is on screen (JS adds .is-visible) */
.equiv-panel.js-reveal .equiv-tile {
  opacity: 0;
  transform: translateY(12px);
}
.equiv-panel.js-reveal.is-visible .equiv-tile {
  opacity: 1;
  transform: none;
  transition: opacity var(--dur-slow) var(--ease-out) var(--equiv-delay, 0ms),
              transform var(--dur-slow) var(--ease-out) var(--equiv-delay, 0ms),
              background var(--dur) var(--ease-out);
}
.equiv-panel.js-reveal.is-visible .equiv-tile:hover { transform: translateY(-3px); }

@media (prefers-reduced-motion: reduce) {
  .equiv-tile,
  .equiv-panel.js-reveal .equiv-tile { opacity: 1; transform: none; transition: none; }
}
.equiv-source { align-items: center; }
.equiv-source-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-on-dark-2);
  margin-right: 0.1rem;
}
.equiv-source a { white-space: nowrap; }
