/* ROI Calculator Page */
.is-roi-calc {
  --roi-accent: var(--accent-500);
}

/* Hero/Intro Section */
.roi-hero {
  position: relative;
  padding-top: calc(var(--header-height, 72px) + clamp(3rem, 8vw, 5rem));
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
  background: var(--surface);
  text-align: center;
}

.roi-hero::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--border) 20%, var(--border) 80%, transparent 100%);
}

.roi-hero__inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 4vw, 2.5rem);
}

.roi-hero .eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: var(--eyebrow-letter-spacing, 0.28em);
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent-700) 70%, var(--fg) 30%);
  margin-bottom: 1.25rem;
}

[data-theme="dark"] .roi-hero .eyebrow {
  color: color-mix(in srgb, var(--accent-300) 80%, var(--fg) 20%);
}

.roi-hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-wrap: balance;
  margin: 0 0 1.25rem;
  color: var(--fg);
}

.roi-hero__subtitle {
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.7;
  color: var(--fg-muted);
  max-width: 60ch;
  margin: 0 auto;
}

/* Calculator Section */
.roi-calc {
  background: var(--bg);
  padding: clamp(2.5rem, 6vw, 4rem) 0;
}

.roi-calc__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 4vw, 2.5rem);
}

/* Input Grid */
.roi-inputs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: auto;
  gap: clamp(1.25rem, 2.5vw, 2rem);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

@media (max-width: 1000px) {
  .roi-inputs {
    grid-template-columns: 1fr 1fr;
  }
  .roi-field--states {
    grid-row: span 1;
  }
  .roi-field--states select[multiple] {
    min-height: 80px;
    max-height: 120px;
  }
}
@media (max-width: 549px) {
  .roi-inputs { grid-template-columns: 1fr; }
  .roi-field--states select[multiple] {
    min-height: 100px;
    max-height: 140px;
  }
}

.roi-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Bottom row fields align to bottom of their cells */
.roi-field:nth-child(n+5):not(.roi-field--states) {
  justify-content: flex-end;
}

.roi-field--states {
  grid-row: span 2;
}

.roi-field--states select[multiple] {
  flex: 1;
  max-height: 180px;
}

.roi-field label {
  font-family: var(--ff-roboto);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--fg) 65%, var(--accent-700) 35%);
  transition: color 180ms ease;
}

.roi-field:focus-within label {
  color: var(--accent-600);
}

[data-theme="dark"] .roi-field label {
  color: color-mix(in srgb, var(--fg) 70%, var(--accent-300) 30%);
}

[data-theme="dark"] .roi-field:focus-within label {
  color: var(--accent-300);
}

.roi-field label .muted {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--fg-muted);
  font-size: 0.68rem;
  opacity: 0.8;
}

.roi-field select,
.roi-field input[type="number"] {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  font-family: var(--ff-open-sans);
  line-height: 1.5;
  color: var(--fg);
  background: color-mix(in srgb, var(--surface) 96%, var(--bg) 4%);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 14px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
  -webkit-appearance: none;
  appearance: none;
}

[data-theme="dark"] .roi-field select,
[data-theme="dark"] .roi-field input[type="number"] {
  background: color-mix(in srgb, var(--surface) 90%, rgba(17, 197, 198, 0.04) 10%);
  border-color: color-mix(in srgb, var(--border) 60%, rgba(255, 255, 255, 0.06) 40%);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.roi-field select:not([multiple]) {
  cursor: pointer;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='none' stroke='%235a6b73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M2 3.5l3 3 3-3'/%3E%3C/svg%3E") no-repeat right 1rem center,
    color-mix(in srgb, var(--surface) 96%, var(--bg) 4%);
  padding-right: 2.5rem;
}

[data-theme="dark"] .roi-field select:not([multiple]) {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='none' stroke='%23a8bec4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M2 3.5l3 3 3-3'/%3E%3C/svg%3E") no-repeat right 1rem center,
    color-mix(in srgb, var(--surface) 90%, rgba(17, 197, 198, 0.04) 10%);
}

.roi-field input:hover {
  border-color: color-mix(in srgb, var(--accent-400) 35%, var(--border) 65%);
  background: var(--surface);
}

.roi-field select:not([multiple]):hover {
  border-color: color-mix(in srgb, var(--accent-400) 35%, var(--border) 65%);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='none' stroke='%235a6b73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M2 3.5l3 3 3-3'/%3E%3C/svg%3E") no-repeat right 1rem center,
    var(--surface);
}

[data-theme="dark"] .roi-field select:not([multiple]):hover {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='none' stroke='%23a8bec4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M2 3.5l3 3 3-3'/%3E%3C/svg%3E") no-repeat right 1rem center,
    var(--surface);
}

.roi-field select[multiple]:hover {
  border-color: color-mix(in srgb, var(--accent-400) 35%, var(--border) 65%);
  background: var(--surface);
}

.roi-field input:focus {
  border-color: color-mix(in srgb, var(--accent-500) 55%, var(--border) 45%);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent-300) 25%, transparent),
    inset 0 1px 2px rgba(0, 0, 0, 0.02);
  background: var(--surface);
}

.roi-field select:not([multiple]):focus {
  border-color: color-mix(in srgb, var(--accent-500) 55%, var(--border) 45%);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent-300) 25%, transparent),
    inset 0 1px 2px rgba(0, 0, 0, 0.02);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='none' stroke='%235a6b73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M2 3.5l3 3 3-3'/%3E%3C/svg%3E") no-repeat right 1rem center,
    var(--surface);
}

[data-theme="dark"] .roi-field select:not([multiple]):focus {
  border-color: color-mix(in srgb, var(--accent-400) 60%, var(--border) 40%);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent-500) 22%, transparent),
    inset 0 1px 2px rgba(0, 0, 0, 0.1);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='none' stroke='%23a8bec4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M2 3.5l3 3 3-3'/%3E%3C/svg%3E") no-repeat right 1rem center,
    var(--surface);
}

.roi-field select[multiple]:focus {
  border-color: color-mix(in srgb, var(--accent-500) 55%, var(--border) 45%);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent-300) 25%, transparent),
    inset 0 1px 2px rgba(0, 0, 0, 0.02);
  background: var(--surface);
}

[data-theme="dark"] .roi-field input:focus {
  border-color: color-mix(in srgb, var(--accent-400) 60%, var(--border) 40%);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent-500) 22%, transparent),
    inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .roi-field select[multiple]:focus {
  border-color: color-mix(in srgb, var(--accent-400) 60%, var(--border) 40%);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent-500) 22%, transparent),
    inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.roi-field select[multiple] {
  min-height: 105px;
  padding: 0.5rem;
  background-image: none;
}

.roi-field select[multiple] option {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 3px;
  transition: background 120ms ease;
}

.roi-field select[multiple] option:checked {
  background: linear-gradient(0deg, var(--accent-soft-bg) 0%, var(--accent-soft-bg) 100%);
  color: var(--accent-soft-fg);
}

.roi-field input::placeholder {
  color: color-mix(in srgb, var(--fg-muted) 55%, transparent);
  font-weight: 400;
}

[data-theme="dark"] .roi-field input::placeholder {
  color: color-mix(in srgb, var(--fg-muted) 45%, transparent);
}

/* CTA Row */
.roi-cta-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.roi-cta-row .button {
  flex-shrink: 0;
}

#assumps {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  color: var(--fg-muted);
  line-height: 1.5;
  flex: 1;
  min-width: 200px;
}

/* Results Section */
.roi-results-section {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: clamp(1.5rem, 3vw, 2rem);
}

.roi-results-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.roi-results-header h2 {
  font-family: var(--ff-montserrat);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--fg);
}

.roi-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft-bg);
  color: var(--accent-soft-fg);
  font-family: var(--ff-roboto);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.roi-results {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 800px) {
  .roi-results { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .roi-results { grid-template-columns: 1fr; }
}

.roi-res {
  padding: clamp(1.25rem, 3vw, 1.75rem) clamp(1rem, 2vw, 1.5rem);
  border-right: 1px solid var(--border);
  text-align: center;
}

.roi-res:last-child { border-right: none; }

@media (max-width: 800px) {
  .roi-res { border-bottom: 1px solid var(--border); }
  .roi-res:nth-child(2n) { border-right: none; }
  .roi-res:nth-last-child(-n+2) { border-bottom: none; }
}
@media (max-width: 480px) {
  .roi-res { border-right: none; text-align: left; }
  .roi-res:last-child { border-bottom: none; }
}

.roi-res .k {
  font-family: var(--ff-roboto);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin-bottom: 0.5rem;
}

.roi-res .v {
  font-family: var(--ff-montserrat);
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
  color: var(--fg);
  line-height: 1.2;
  word-break: keep-all;
}

/* Drivers Accordion */
.roi-drivers {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.roi-drivers summary {
  cursor: pointer;
  list-style: none;
  padding: 1.1rem 1.5rem;
  font-family: var(--ff-montserrat);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: background 150ms ease;
  border-radius: 16px;
}

.roi-drivers summary:hover {
  background: color-mix(in srgb, var(--bg) 50%, var(--surface));
}

.roi-drivers summary::-webkit-details-marker { display: none; }

.roi-drivers summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 200ms ease;
  opacity: 0.5;
}

.roi-drivers[open] summary::before {
  transform: rotate(90deg);
}

.roi-drivers[open] summary {
  border-radius: 16px 16px 0 0;
  border-bottom: 1px solid var(--border);
}

.roi-driver-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 2.5rem;
  padding: 1.25rem 1.5rem;
}

@media (max-width: 600px) {
  .roi-driver-body { grid-template-columns: 1fr; }
}

.roi-drv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
}

.roi-drv-row:last-child { border-bottom: none; }

.roi-drv-row .k {
  font-family: var(--ff-roboto);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
}

.roi-drv-row .v {
  font-family: var(--ff-montserrat);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--fg);
  text-align: right;
}

/* Footnote */
.roi-footnote {
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--fg-muted);
  max-width: 80ch;
}

/* Bottom CTA */
.roi-bottom-cta {
  background: var(--surface);
  padding: clamp(3rem, 6vw, 5rem) 0;
  text-align: center;
  border-top: 1px solid var(--border);
}

.roi-bottom-cta__inner {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 4vw, 2.5rem);
}

.roi-bottom-cta h2 {
  font-family: var(--ff-montserrat);
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: var(--fg);
}

.roi-bottom-cta p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--fg-muted);
  margin: 0 0 1.75rem;
}

/* Hide tests */
.roi-tests { display: none; }
