/* ════════════════════════════════════════════════════════════
   Third Rock Wealth · tool-cta.css
   Styles for the per-tool CTA partial mounted by tool-cta.js into
   the [data-anim="cta"] slot on every calculator tool page.

   Two design choices that matter:

   1) The CTA is a properly DEFINED PANEL — solid border in the
      tool's accent colour, faint accent-tinted background, the
      rounded surface treatment the rest of the page uses. Sits
      INLINE inside the instrument flow, right after the chart,
      before the "how to read this tool" guide — peak engagement
      moment.

   2) Each tool's signature accent colour drives the panel —
      border, background tint, kicker text, button, focus ring,
      link underline — via color-mix(in oklab, var(--accent),
      transparent). Each tool's body[data-tool="<x>"] already sets
      --accent + --accent-bright, so the rules are palette-agnostic.

   The result-panel jump link (.tk-readout-jump) is a small mono
   button that sits inside each tool's result panel next to the
   final-number figures. Clicking it smooth-scrolls to the main
   CTA below.
   ════════════════════════════════════════════════════════════ */

/* ── Section wrapper ───────────────────────────────────────
   Inline inside the instrument's tk-wrap, so the section is a
   DIV (not a section element). scroll-margin-top keeps a gap
   below the sticky header when the in-readout jump link smooth-
   scrolls into the panel. */
.tool-cta-section {
  margin: clamp(20px, 2.4vw, 30px) 0 clamp(10px, 1.4vw, 18px);
  scroll-margin-top: clamp(80px, 9vh, 120px);
}
.tool-cta-inner {
  width: 100%;
  margin: 0;
}

/* ── Result-panel jump link ──
   A small mono button sitting inside each tool's result panel
   next to the figures. Tool-specific copy + a down arrow.
   Clicking smooth-scrolls to the in-page CTA below (tool-cta.js
   handles the scroll). The panel's flex/grid layout naturally
   pushes this to the right edge on desktop. */
.tk-readout-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: center;
  padding: 10px 16px;
  font-family: var(--mono, 'IBM Plex Mono', monospace);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--accent-bright);
  background: color-mix(in oklab, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in oklab, var(--accent) 55%, transparent);
  border-radius: var(--r-ctl);
  text-decoration: none;
  white-space: nowrap;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}
.tk-readout-jump span[aria-hidden="true"] {
  display: inline-block;
  transform: translateY(1px);
  transition: transform 260ms cubic-bezier(.2,.7,.2,1);
}
.tk-readout-jump:hover {
  background: color-mix(in oklab, var(--accent) 18%, transparent);
  border-color: var(--accent-bright);
  color: var(--accent-bright);
}
.tk-readout-jump:hover span[aria-hidden="true"] {
  transform: translateY(4px);
}
.tk-readout-jump:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
}

/* On overlap-analyzer the jump sits inside the picker foot bar,
   stretched to its own row. */
.tk-readout-jump--oa {
  margin: 12px 0 0;
  width: 100%;
  justify-content: center;
}

/* On versus the .vs-split is a 3-column grid (1fr auto 1fr) for
   the two sides + the "vs" mark. Span the full width and center. */
.tk-readout-jump--vs {
  grid-column: 1 / -1;
  margin: 4px auto clamp(14px, 2vw, 22px);
  align-self: center;
}

/* color-mix fallback for the jump link */
@supports not (color: color-mix(in oklab, red, blue)) {
  .tk-readout-jump {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.18);
  }
  .tk-readout-jump:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.32);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tk-readout-jump,
  .tk-readout-jump span[aria-hidden="true"] { transition: none !important; }
}

/* ── Idle + success: properly bordered, accent-tinted panel ── */
.tool-cta.tc {
  position: relative;
  padding: clamp(26px, 3.4vw, 40px) clamp(24px, 3.2vw, 36px);
  border: 1px solid color-mix(in oklab, var(--accent) 45%, var(--hairline-bold));
  background:
    linear-gradient(135deg,
      color-mix(in oklab, var(--accent) 7%, var(--surface-raised)) 0%,
      var(--surface-raised) 65%);
  border-radius: var(--r-panel);
  box-shadow:
    inset 0 1px 0 color-mix(in oklab, var(--accent-bright) 14%, transparent),
    0 8px 32px -16px color-mix(in oklab, var(--accent) 45%, transparent),
    0 1px 0 rgba(0, 0, 0, 0.2);
  transition: border-color 240ms ease, box-shadow 240ms ease;
}
.tool-cta.tc:hover {
  border-color: color-mix(in oklab, var(--accent-bright) 70%, var(--hairline-bold));
  box-shadow:
    inset 0 1px 0 color-mix(in oklab, var(--accent-bright) 20%, transparent),
    0 12px 40px -16px color-mix(in oklab, var(--accent) 55%, transparent),
    0 1px 0 rgba(0, 0, 0, 0.2);
}

/* Two-column grid on desktop, stack on mobile */
.tool-cta.tc[data-tc-state="idle"],
.tool-cta.tc[data-tc-state="success"] {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}
@media (min-width: 720px) {
  .tool-cta.tc[data-tc-state="idle"] {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: clamp(20px, 3vw, 40px);
    align-items: center;
  }
}

.tc .tc-action {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
@media (min-width: 720px) {
  .tc .tc-action { justify-content: flex-end; }
}

/* color-mix fallback for the panel surface */
@supports not (color: color-mix(in oklab, red, blue)) {
  .tool-cta.tc {
    border-color: var(--hairline-bold);
    background: var(--surface-raised);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
  }
}

/* ── Kicker / title / lede ─────────────────────────────── */
.tc .tc-kicker {
  font-family: var(--mono, 'IBM Plex Mono', monospace);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin: 0 0 10px;
}

.tc .tc-title {
  font-family: var(--serif, 'Fraunces', serif);
  font-weight: 500;
  font-size: clamp(22px, 2.5vw, 30px);
  line-height: 1.2;
  color: var(--text);
  margin: 0 0 10px;
  letter-spacing: -0.005em;
  max-width: 30ch;
}

.tc .tc-lede {
  font-family: var(--sans, 'Inter Tight', sans-serif);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-soft);
  margin: 0;
  max-width: 56ch;
}

/* ── Open button (idle state) ─────────────────────────── */
.tc .tc-open {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--accent);
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  color: var(--accent-bright);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  padding: 14px 26px;
  border-radius: var(--r-ctl);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}
.tc .tc-open::after {
  content: '  \2192';
  display: inline-block;
  transition: transform 220ms cubic-bezier(.2,.7,.2,1);
}
.tc .tc-open:hover {
  background: color-mix(in oklab, var(--accent) 22%, transparent);
  border-color: var(--accent-bright);
  color: var(--accent-bright);
}
.tc .tc-open:hover::after { transform: translateX(3px); }
.tc .tc-open:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
}

/* ── Expanded (form) state: keep containment ─────────── */
.tool-cta.tc[data-tc-state="expanded"] {
  display: block;
  padding: clamp(24px, 2.8vw, 32px) clamp(22px, 2.8vw, 30px);
}
.tool-cta.tc[data-tc-state="expanded"]:focus-within {
  border-color: var(--accent-bright);
}

.tc .tc-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tc .tc-form-head { margin-bottom: 6px; }
.tc .tc-form-head .tc-kicker { margin-bottom: 6px; }
.tc .tc-form-head .tc-title  { margin-bottom: 0; max-width: none; }

.tc .tc-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 620px) {
  .tc .tc-row { grid-template-columns: 1fr; }
}

.tc .tc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tc .tc-field-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.tc .tc-field input,
.tc .tc-field textarea {
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-ctl);
  padding: 10px 12px;
  outline: none;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.tc .tc-field textarea {
  resize: vertical;
  min-height: 56px;
  line-height: 1.5;
}
.tc .tc-field input::placeholder,
.tc .tc-field textarea::placeholder {
  color: var(--text-mute);
}
.tc .tc-field input:focus,
.tc .tc-field textarea:focus {
  border-color: var(--accent);
  background: var(--surface-high);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent);
}

/* ── Consent row ──────────────────────────────────────── */
.tc .tc-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-soft);
  cursor: pointer;
}
.tc .tc-consent input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}
.tc .tc-consent-link {
  color: var(--accent-bright);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--accent-bright) 55%, transparent);
}
.tc .tc-consent-link:hover { border-bottom-color: var(--accent-bright); }

/* ── Status / error / actions ─────────────────────────── */
.tc .tc-status {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-soft);
  margin: 0;
  min-height: 18px;
}
.tc .tc-status.is-error {
  color: var(--alert);
}

.tc .tc-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
}

.tc .tc-send {
  appearance: none;
  border: none;
  background: var(--accent);
  color: var(--surface);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  padding: 12px 24px;
  border-radius: var(--r-ctl);
  cursor: pointer;
  font-weight: 600;
  transition: background 180ms ease, transform 120ms ease, box-shadow 220ms ease;
}
.tc .tc-send:hover:not(:disabled) {
  background: var(--accent-bright);
  box-shadow: 0 6px 22px -10px color-mix(in oklab, var(--accent) 75%, transparent);
}
.tc .tc-send:active:not(:disabled) { transform: translateY(1px); }
.tc .tc-send:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
}
.tc .tc-send:disabled {
  opacity: 0.55;
  cursor: progress;
}

.tc .tc-cancel {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 12px 10px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(244, 235, 217, 0.18);
}
.tc .tc-cancel:hover {
  color: var(--text-soft);
  text-decoration-color: rgba(244, 235, 217, 0.42);
}

/* ── Reduced motion ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .tool-cta.tc,
  .tc .tc-open,
  .tc .tc-open::after,
  .tc .tc-send,
  .tc .tc-cancel,
  .tc .tc-field input,
  .tc .tc-field textarea {
    transition: none !important;
  }
}
