/**
 * ROI Calculator — /roi-calculator/
 * Ported from the standalone build, scoped under .roi-page so it coexists with
 * Opal site globals. Brand-aligned: Opal blue accent, VC Garamond Condensed
 * headlines, Apercu body (both already loaded by the theme). Independent of the
 * /calculator/ and /alignment-tax-guide/ pages.
 */

.roi-page {
  color-scheme: light;
  --ink: #17211f;
  --ink-soft: #30413d;
  --muted: #65716d;
  --surface: #ffffff;
  --surface-soft: #f5f7f3;
  --surface-warm: #f4f7fd;
  --line: #dfe5dd;
  --accent: #2a70ea;
  --accent-strong: #1b4fb0;
  --accent-bright: #9dc0ff;
  --accent-soft: #e3ecfd;
  --shadow: 0 18px 46px rgba(28, 42, 37, 0.12);

  background:
    linear-gradient(180deg, rgba(227, 236, 253, 0.65), rgba(245, 247, 243, 0) 360px),
    var(--surface-soft);
  color: var(--ink);
  font-family: "Apercu", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.roi-page * {
  box-sizing: border-box;
}

.roi-page button,
.roi-page input {
  font: inherit;
}

.roi-page a {
  color: inherit;
}

.roi-page .app-shell {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

/* ---------- buttons ---------- */

.roi-page .button,
.roi-page .text-button,
.roi-page .cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.roi-page .button,
.roi-page .text-button {
  border: 1px solid var(--line);
  cursor: pointer;
  padding: 0 16px;
}

.roi-page .button {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.roi-page .text-button {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.roi-page .button:hover,
.roi-page .text-button:hover,
.roi-page .cta-button:hover {
  transform: translateY(-2px);
}

.roi-page .button:focus-visible,
.roi-page .text-button:focus-visible,
.roi-page .cta-button:focus-visible {
  outline: 3px solid rgba(42, 112, 234, 0.28);
  outline-offset: 3px;
}

.roi-page .button svg,
.roi-page .text-button svg,
.roi-page .cta-button svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.2;
}

/* ---------- hero ---------- */

.roi-page .roi-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: clamp(36px, 7vw, 110px);
  align-items: end;
  padding: clamp(48px, 7vw, 96px) 0 clamp(54px, 7vw, 92px);
}

.roi-page .eyebrow,
.roi-page .section-kicker {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.roi-page h1,
.roi-page h2 {
  margin-top: 0;
  margin-bottom: 0;
  text-transform: none;
}

.roi-page h1,
.roi-page .cta-panel h2 {
  font-family: "VC Garamond Condensed", Garamond, "Times New Roman", serif;
  font-synthesis-weight: none;
  font-weight: 300;
}

.roi-page h1 {
  max-width: 820px;
  color: var(--ink);
  font-size: clamp(3.2rem, 6.6vw, 6.5rem);
  letter-spacing: -0.025em;
  line-height: 0.86;
}

.roi-page h2 {
  font-size: 1.3rem;
  line-height: 1.15;
}

.roi-page .roi-hero-copy {
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.35vw, 1.12rem);
  line-height: 1.65;
}

.roi-page .roi-hero-copy p {
  margin-top: 0;
}

.roi-page .roi-hero-copy p:nth-last-of-type(1) {
  color: var(--ink);
  font-weight: 700;
}

.roi-page .topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

/* ---------- workspace ---------- */

.roi-page .workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(330px, 0.75fr);
  gap: 22px;
  align-items: start;
}

.roi-page .input-panel {
  display: grid;
  gap: 16px;
}

.roi-page .input-section {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  padding: clamp(22px, 3vw, 34px);
  box-shadow: 0 1px 0 rgba(23, 33, 31, 0.03);
}

.roi-page .org-section {
  background: var(--surface-warm);
}

.roi-page .section-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
}

.roi-page .section-heading h2 {
  font-family: "VC Garamond Condensed", Garamond, "Times New Roman", serif;
  font-size: clamp(1.8rem, 2.5vw, 2.35rem);
  font-synthesis-weight: none;
  font-weight: 300;
  line-height: 0.95;
}

.roi-page .number-tag {
  min-width: 38px;
  padding-top: 5px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.roi-page .section-intro {
  max-width: 700px;
  margin: -6px 0 22px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

/* ---------- fields ---------- */

.roi-page .field-grid {
  display: grid;
  gap: 18px;
}

.roi-page .field-grid.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.roi-page .field-grid.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.roi-page .field {
  display: grid;
  align-content: start;
  gap: 9px;
  margin: 0;
}

.roi-page .field-label {
  display: block;
  min-height: 2.6em;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.roi-page .field-label small {
  display: block;
  margin-top: 3px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
}

.roi-page .input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.roi-page .field input {
  width: 100%;
  height: 52px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 102px 0 14px;
  outline: none;
  font-size: 1rem;
  font-weight: 700;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.roi-page .field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(42, 112, 234, 0.14);
}

.roi-page .field input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.roi-page .field input[type="number"]::-webkit-inner-spin-button,
.roi-page .field input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.roi-page .input-unit,
.roi-page .currency-symbol {
  position: absolute;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  pointer-events: none;
}

.roi-page .input-unit {
  right: 13px;
}

.roi-page .currency-symbol {
  left: 14px;
  font-size: 0.92rem;
}

.roi-page .currency-input input {
  padding-left: 29px;
}

/* ---------- results ---------- */

.roi-page .results-panel {
  position: sticky;
  top: 20px;
  overflow: hidden;
  border: 1px solid #1d302b;
  border-radius: 14px;
  background:
    radial-gradient(circle at 100% 0, rgba(42, 112, 234, 0.28), transparent 15rem),
    var(--ink);
  color: #f7faf7;
  padding: clamp(24px, 3vw, 34px);
  box-shadow: var(--shadow);
}

.roi-page .results-heading {
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.roi-page .results-heading .section-kicker {
  color: var(--accent-bright);
}

.roi-page .results-heading h2 {
  color: #f7faf7;
  font-size: 1.12rem;
}

.roi-page .primary-metric {
  padding: 28px 0 25px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.roi-page .primary-metric span,
.roi-page .fte-metric span {
  display: block;
  color: rgba(247, 250, 247, 0.68);
  font-size: 0.78rem;
  font-weight: 700;
}

.roi-page .primary-metric strong {
  display: block;
  margin: 11px 0 9px;
  font-family: "VC Garamond Condensed", Garamond, serif;
  font-size: clamp(3.2rem, 4.8vw, 4.9rem);
  font-synthesis-weight: none;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 0.88;
}

.roi-page .primary-metric small,
.roi-page .fte-metric small,
.roi-page .results-note {
  color: rgba(247, 250, 247, 0.58);
  font-size: 0.72rem;
  line-height: 1.45;
}

.roi-page .fte-metric {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 23px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.roi-page .fte-metric strong {
  display: block;
  margin-top: 7px;
  font-size: 1.8rem;
  line-height: 1;
}

.roi-page .fte-metric small {
  text-align: right;
}

.roi-page .breakdown {
  padding-top: 23px;
}

.roi-page .breakdown > p {
  margin: 0 0 14px;
  color: rgba(247, 250, 247, 0.62);
  font-size: 0.72rem;
  font-weight: 700;
}

.roi-page .breakdown-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 57px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.78rem;
}

.roi-page .breakdown-row > span {
  color: rgba(247, 250, 247, 0.82);
  line-height: 1.35;
}

.roi-page .breakdown-row div {
  text-align: right;
}

.roi-page .breakdown-row strong,
.roi-page .breakdown-row small {
  display: block;
}

.roi-page .breakdown-row strong {
  font-size: 0.86rem;
}

.roi-page .breakdown-row small {
  margin-top: 3px;
  color: var(--accent-bright);
  font-size: 0.66rem;
}

.roi-page .results-note {
  margin: 17px 0 0;
}

/* ---------- methodology + CTA ---------- */

.roi-page .methodology-note {
  max-width: 830px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.6;
}

.roi-page .cta-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 42px;
  align-items: center;
  margin-top: clamp(70px, 9vw, 120px);
  border-radius: 16px;
  background: var(--accent-soft);
  padding: clamp(34px, 6vw, 72px);
}

.roi-page .cta-panel > div {
  max-width: 770px;
}

.roi-page .cta-panel h2 {
  margin-bottom: 17px;
  color: var(--ink);
  font-size: clamp(2.4rem, 4.8vw, 4.6rem);
  letter-spacing: -0.02em;
  line-height: 0.9;
}

.roi-page .cta-panel p:not(.section-kicker) {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.roi-page .cta-button {
  min-height: 52px;
  background: var(--accent);
  color: #fff;
  padding: 0 22px;
  white-space: nowrap;
}

.roi-page .cta-button:hover {
  background: var(--accent-strong);
  color: #fff;
}

/* ---------- toast ---------- */

.roi-page .toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.roi-page .toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- responsive ---------- */

@media (max-width: 1040px) {
  .roi-page .roi-hero {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .roi-page .roi-hero-copy {
    max-width: 720px;
  }

  .roi-page .workspace {
    grid-template-columns: 1fr;
  }

  .roi-page .results-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .roi-page .app-shell {
    width: min(100% - 28px, 680px);
    padding-top: 16px;
  }

  .roi-page .topbar-actions {
    gap: 7px;
  }

  .roi-page .button,
  .roi-page .text-button {
    min-height: 40px;
    padding: 0 12px;
    font-size: 0.76rem;
  }

  .roi-page .roi-hero {
    padding: 40px 0 46px;
  }

  .roi-page h1 {
    font-size: clamp(2.9rem, 15vw, 4.4rem);
  }

  .roi-page .field-grid.three-up,
  .roi-page .field-grid.two-up {
    grid-template-columns: 1fr;
  }

  .roi-page .field-label {
    min-height: auto;
  }

  .roi-page .cta-panel {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .roi-page .cta-button {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .roi-page .button svg,
  .roi-page .text-button svg {
    display: none;
  }

  .roi-page .fte-metric {
    align-items: flex-start;
    flex-direction: column;
  }

  .roi-page .fte-metric small {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .roi-page *,
  .roi-page *::before,
  .roi-page *::after {
    transition-duration: 0.01ms !important;
  }
}
