/* CentralNest survey cost calculator. Uses the design tokens in style.css. */

.cnc { --cnc-travel: #F07B20; --cnc-visit: #F59E3A; --cnc-write: #5DC8E8; --cnc-book: #94A3B8; position: relative; }
.cnc [hidden] { display: none !important; }

.cnc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: var(--space-6);
  align-items: start;
}

/* ── INPUTS ── */
.cnc-inputs {
  background: var(--bg-white);
  border: 1px solid var(--border-card);
  border-radius: var(--r-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-md);
}
@media (min-width: 961px) {
  .cnc-inputs { position: sticky; top: calc(var(--nav-height) + 24px); }
}

.cnc-q {
  font-family: var(--font-heading); font-weight: 700; font-size: var(--text-base);
  color: var(--text-primary); margin: var(--space-6) 0 var(--space-3);
}
.cnc-q:first-child { margin-top: 0; }

.cnc-seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  background: var(--bg-light); border: 1px solid var(--border-light); border-radius: var(--r-full);
}
.cnc-seg button {
  padding: 0.7rem 0.75rem; border-radius: var(--r-full); font-family: var(--font-heading);
  font-weight: 600; font-size: var(--text-sm); color: var(--text-secondary);
  transition: background var(--tr-fast), color var(--tr-fast), box-shadow var(--tr-fast);
}
.cnc-seg button:hover { color: var(--text-primary); }
.cnc-seg button[aria-pressed="true"] { background: var(--bg-hero); color: white; box-shadow: var(--shadow-sm); }

.cnc-sizes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: var(--space-6); }
.cnc-sizes button { white-space: nowrap; }
.cnc-sizes button {
  padding: 0.7rem 0.25rem; border: 1.5px solid var(--border-card); border-radius: var(--r-md);
  background: var(--bg-white); font-family: var(--font-heading); font-weight: 600; font-size: 0.8125rem;
  color: var(--text-primary); line-height: 1.25; transition: all var(--tr-fast);
}
.cnc-sizes button:hover { border-color: var(--orange-light); }
.cnc-sizes button[aria-pressed="true"] { border-color: var(--orange-primary); background: var(--orange-subtle); color: var(--orange-dark); }

.cnc-field { margin-bottom: var(--space-6); }
.cnc-field:last-child { margin-bottom: 0; }
.cnc-seg + .cnc-field { margin-top: var(--space-6); }
.cnc-label { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-2); }
.cnc-label label { font-weight: 600; font-size: var(--text-sm); color: var(--text-primary); }
.cnc-label output { font-family: var(--font-heading); font-weight: 800; color: var(--blue-deep); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cnc-hint { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 6px; line-height: 1.5; }

.cnc-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: var(--r-full); outline: none;
  background: linear-gradient(90deg, var(--orange-primary) 0, var(--orange-primary) var(--fill, 50%), #E2E8F0 var(--fill, 50%));
  cursor: pointer;
}
.cnc-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%;
  background: white; border: 3px solid var(--orange-primary); box-shadow: 0 2px 8px rgba(240,123,32,0.35);
  transition: transform var(--tr-fast);
}
.cnc-range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: white;
  border: 3px solid var(--orange-primary); box-shadow: 0 2px 8px rgba(240,123,32,0.35);
}
.cnc-range:hover::-webkit-slider-thumb, .cnc-range:focus-visible::-webkit-slider-thumb { transform: scale(1.12); }
.cnc-range:focus-visible { box-shadow: 0 0 0 4px var(--orange-glow); }

.cnc-adv { margin-top: var(--space-8); border-top: 1px solid var(--border-card); padding-top: var(--space-5); }
.cnc-adv summary {
  cursor: pointer; font-family: var(--font-heading); font-weight: 700; font-size: var(--text-sm);
  color: var(--blue-deep); list-style: none; display: flex; align-items: center; gap: var(--space-2);
}
.cnc-adv summary::-webkit-details-marker { display: none; }
.cnc-adv summary::before { content: '+'; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--blue-subtle); font-size: 14px; transition: transform var(--tr-fast); }
.cnc-adv[open] summary::before { content: '−'; }
.cnc-adv-row { display: grid; gap: var(--space-2); margin-top: var(--space-5); font-size: var(--text-xs); font-weight: 600; }
.cnc-adv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4) var(--space-5); margin-top: var(--space-5); }
.cnc-num label { display: block; font-size: var(--text-xs); font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.cnc-num-wrap { display: flex; align-items: center; border: 1.5px solid var(--border-card); border-radius: var(--r-md); background: var(--bg-alt); transition: border-color var(--tr-fast); }
.cnc-num-wrap:focus-within { border-color: var(--blue-primary); background: white; }
.cnc-num-wrap span { padding: 0 12px; color: var(--text-secondary); font-weight: 600; font-size: var(--text-sm); }
.cnc-num-wrap input { width: 100%; border: 0; background: transparent; padding: 0.6rem 0.75rem; font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); outline: none; }
.cnc-num .cnc-hint { margin-top: 4px; }
.cnc-reset { margin-top: var(--space-5); font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary); text-decoration: underline; text-underline-offset: 3px; }
.cnc-reset:hover { color: var(--text-primary); }

/* ── RESULTS STAGE ── */
.cnc-stage {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, #0A1628 0%, #0F2238 60%, #13294A 100%);
  border-radius: var(--r-xl); padding: var(--space-6);
  box-shadow: var(--shadow-xl);
  scroll-margin-top: calc(var(--nav-height) + 16px);
}
.cnc-stage::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px); background-size: 24px 24px;
}
.cnc-stage::after {
  content: ''; position: absolute; width: 380px; height: 380px; right: -140px; bottom: -160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(240,123,32,0.35) 0%, transparent 65%); filter: blur(40px); pointer-events: none;
}
.cnc-stage > * { position: relative; z-index: 1; }

/* The docket: a job sheet with a torn edge */
.cnc-docket {
  background: #FFFDF8; color: var(--text-primary);
  padding: var(--space-5) var(--space-6) calc(var(--space-5) + 12px);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  transform: rotate(-0.6deg);
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
  -webkit-mask: radial-gradient(circle 7px at 50% 100%, transparent 98%, #000) 50% 100% / 18px 100% repeat-x;
          mask: radial-gradient(circle 7px at 50% 100%, transparent 98%, #000) 50% 100% / 18px 100% repeat-x;
}
.cnc-docket-head {
  display: flex; justify-content: space-between; gap: var(--space-3);
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary);
  padding-bottom: var(--space-3); margin-bottom: var(--space-4); border-bottom: 2px dashed #E7E2D8;
}
.cnc-docket-head span:last-child { color: var(--orange-dark); }
.cnc-kicker { font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary); }
.cnc-big {
  font-family: var(--font-heading); font-weight: 800; font-size: clamp(3rem, 6vw, 4rem);
  line-height: 1; letter-spacing: -0.03em; color: var(--text-primary); font-variant-numeric: tabular-nums; margin: 6px 0 8px;
}
.cnc-big-sub { font-size: var(--text-sm); color: var(--text-secondary); }
.cnc-big-sub strong { color: var(--text-primary); }

.cnc-strip { display: flex; gap: 3px; height: 10px; margin: var(--space-5) 0 var(--space-3); }
.cnc-strip span { flex: 1 1 0; min-width: 4px; border-radius: 3px; transition: flex-grow 450ms cubic-bezier(.2,.8,.2,1); }
.s-travel { background: var(--cnc-travel); }
.s-visit  { background: var(--cnc-visit); }
.s-write  { background: var(--cnc-write); }
.s-book   { background: var(--cnc-book); }

.cnc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--text-xs); color: var(--text-secondary); }
.cnc-legend > span { display: inline-flex; align-items: center; white-space: nowrap; }
.cnc-legend b { color: var(--text-primary); margin-left: 4px; font-variant-numeric: tabular-nums; }
.cnc-legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }

/* CentralNest comparison */
.cnc-vs { color: var(--text-on-dark); padding: var(--space-6) var(--space-2) 0; }
.cnc-vs-title { margin-bottom: var(--space-4); }
.cnc-vs-title { font-family: var(--font-heading); font-weight: 800; font-size: var(--text-xl); color: white; }
.cnc-vs-title span { color: var(--blue-light); }

.cnc-bars { display: grid; gap: 8px; }
.cnc-bar { display: grid; grid-template-columns: 92px 1fr 72px; align-items: center; gap: var(--space-3); font-size: var(--text-sm); }
.cnc-bar > span { color: var(--text-on-dark); font-weight: 600; }
.cnc-bar > b { text-align: right; font-family: var(--font-heading); font-weight: 800; color: white; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cnc-track { height: 14px; background: rgba(255,255,255,0.07); border-radius: var(--r-full); overflow: hidden; }
.cnc-track i { display: block; height: 100%; border-radius: var(--r-full); min-width: 6px; transition: width 500ms cubic-bezier(.2,.8,.2,1); }
.b-now { background: linear-gradient(90deg, #8A93A3, #B8C0CC); }
.b-cn  { background: linear-gradient(90deg, var(--blue-primary), var(--blue-light)); box-shadow: 0 0 16px rgba(93,200,232,0.55); }
.cnc-vs-note { font-size: var(--text-xs); color: var(--text-on-dark-sub); margin: var(--space-3) 0 0; line-height: 1.55; }

.cnc-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin-top: var(--space-5); }
.cnc-tile { padding: var(--space-3) var(--space-4) !important; }
.cnc-tile { background: rgba(255,255,255,0.06); border: 1px solid var(--border-glass); border-radius: var(--r-md); padding: var(--space-4); }
.cnc-tile-k { font-size: var(--text-xs); font-weight: 600; color: var(--text-on-dark-sub); }
.cnc-tile-v { font-family: var(--font-heading); font-weight: 800; font-size: var(--text-3xl); line-height: 1.15; color: var(--orange-light); font-variant-numeric: tabular-nums; margin: 2px 0; }
.cnc-tile:last-child .cnc-tile-v { color: var(--blue-light); }
.cnc-negative .cnc-tile:first-child .cnc-tile-v { color: #CBD5E1; }

.cnc-cta { margin-top: var(--space-5); }
.cnc-cta .btn { width: 100%; justify-content: center; }
.cnc-links { display: flex; justify-content: center; gap: var(--space-5); margin: var(--space-4) 0 var(--space-1); }
.cnc-links a, .cnc-share { font-size: var(--text-xs); font-weight: 600; color: var(--text-on-dark-sub); text-decoration: underline; text-underline-offset: 3px; }
.cnc-links a:hover, .cnc-share:hover { color: white; }

/* Mobile live bar */
.cnc-mobilebar { display: none; }

@media (max-width: 960px) {
  .cnc-grid { grid-template-columns: 1fr; }
  .cnc-mobilebar {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 90;
    align-items: center; justify-content: space-between; gap: var(--space-3);
    background: var(--bg-hero); color: white; border-radius: var(--r-full);
    padding: 10px 10px 10px 20px; box-shadow: var(--shadow-xl); font-size: var(--text-sm);
    transform: translateY(150%); transition: transform var(--tr-base);
  }
  .cnc-mobilebar.on { transform: none; }
  .cnc-mobilebar b { font-family: var(--font-heading); color: var(--orange-light); font-size: var(--text-lg); margin-left: 4px; }
  .cnc-mobilebar a { background: var(--orange-primary); color: white; font-weight: 700; padding: 8px 14px; border-radius: var(--r-full); white-space: nowrap; }
}
@media (max-width: 560px) {
  .cnc-inputs { padding: var(--space-5); }
  .cnc-stage { padding: var(--space-4); border-radius: var(--r-lg); }
  .cnc-docket { padding: var(--space-5) var(--space-4) calc(var(--space-5) + 10px); transform: none; }
  .cnc-adv-row { display: grid; gap: var(--space-2); margin-top: var(--space-5); font-size: var(--text-xs); font-weight: 600; }
.cnc-adv-grid { grid-template-columns: 1fr; }
  .cnc-seg button { font-size: 0.8125rem; padding: 0.65rem 0.4rem; }
  .cnc-bar { grid-template-columns: 78px 1fr 64px; gap: var(--space-2); }
  .cnc-tile-v { font-size: var(--text-2xl); }
}

/* ── "HOW WE WORKED IT OUT" (collapsible) ──
   Used as static HTML on /survey-cost-calculator and rendered by calculator.js on /pricing */
.calc-method { max-width: 1000px; margin: 0 auto; border: 1px solid var(--border-card); border-radius: var(--r-xl); background: var(--bg-alt); }
.cnc .calc-method { max-width: none; margin-top: var(--space-6); background: var(--bg-white); }
.calc-method-summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-6) var(--space-8); cursor: pointer; list-style: none; }
.calc-method-summary::-webkit-details-marker { display: none; }
.calc-method-summary .section-label { margin-bottom: var(--space-2); }
.calc-method-summary h2, .calc-method-summary h3 { font-size: var(--text-2xl); margin: 0 0 4px; }
.cnc .calc-method-summary h3 { font-size: var(--text-xl); }
.calc-method-sub { display: block; font-size: var(--text-sm); color: var(--text-secondary); }
.calc-method-toggle { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; font-family: var(--font-heading); font-weight: 700; font-size: var(--text-sm); color: var(--blue-deep); }
.calc-method-toggle .t-hide, .calc-method[open] .calc-method-toggle .t-show { display: none; }
.calc-method[open] .calc-method-toggle .t-hide { display: inline; }
.calc-chev {
  width: 32px; height: 32px; min-width: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--bg-light); border: 1px solid var(--border-card); color: var(--blue-primary); font-size: 16px; font-weight: 700;
  transition: transform var(--tr-base), background var(--tr-base);
}
.calc-method[open] .calc-chev { transform: rotate(45deg); background: var(--blue-subtle); }
.calc-method-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: var(--space-8); align-items: start; padding: 0 var(--space-8) var(--space-8); }
.calc-method-grid > * { min-width: 0; }
.calc-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); background: var(--bg-white); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.calc-table th, .calc-table td { padding: 0.65rem 0.8rem; text-align: right; border-bottom: 1px solid var(--border-card); white-space: nowrap; }
.calc-table th:first-child, .calc-table td:first-child { text-align: left; white-space: normal; }
.calc-table thead th { background: var(--bg-hero); color: white; font-family: var(--font-heading); font-weight: 700; font-size: var(--text-xs); letter-spacing: 0.04em; }
.calc-table tbody tr:last-child td { border-bottom: 0; }
.calc-table td { font-variant-numeric: tabular-nums; }
.calc-table .cn-row td { background: var(--blue-subtle); }
.calc-table-note { font-size: var(--text-xs); color: var(--text-secondary); margin-top: var(--space-3); }
.calc-notes { display: grid; gap: var(--space-4); }
.calc-note { background: var(--bg-white); border: 1px solid var(--border-card); border-radius: var(--r-lg); padding: var(--space-5); }
.cnc .calc-note { background: var(--bg-alt); }
.calc-note h3, .calc-note h4 { font-size: var(--text-base); margin-bottom: var(--space-2); }
.calc-note p { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.65; margin: 0; }
.calc-note.left-out { background: var(--orange-subtle); border-color: rgba(240,123,32,0.25); }
@media (max-width: 900px) { .calc-method-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .calc-method-summary { padding: var(--space-5); }
  .calc-method-grid { padding: 0 var(--space-3) var(--space-5); }
  .calc-table { font-size: 12px; }
  .calc-table th, .calc-table td { padding: 0.55rem 0.35rem; }
  .calc-table th:first-child, .calc-table td:first-child { padding-left: 0.6rem; }
  .calc-table thead th { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .cnc-strip span, .cnc-track i, .cnc-mobilebar { transition: none; }
}
