/* ==========================================================================
   Wayfinder Partners — Profit Engine Diagnostic (page styles)
   Extends css/site.css. Journey accent: Profit = --j-profit (blue).
   ========================================================================== */

.pd-page { --accent: var(--j-profit); }

/* hidden must win over any display value set below (same guard as .gate) */
.pd-app [hidden] { display: none !important; }

/* Long user-entered unit labels must wrap, never overflow their container */
.pd-step h2, .pd-results h2, .pd-stop h2, .pd-subtotal span,
.pd-stat .k, .pd-stat .s, .pd-lever .to, .pd-field label {
  overflow-wrap: break-word;
}

/* ---------- Compact dark hero ---------- */
.pd-hero {
  position: relative;
  background: var(--navy-2);
  color: #fff;
  overflow: hidden;
}
.pd-hero__bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center 70%;
  opacity: .26;
}
.pd-hero__bg::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8,15,30,.6) 0%, rgba(8,15,30,.35) 45%, #080F1E 100%);
}
.pd-hero .container {
  position: relative;
  max-width: var(--w-narrow);
  text-align: center;
  padding-top: calc(var(--header-h) + clamp(44px, 6vw, 72px));
  padding-bottom: clamp(40px, 5vw, 64px);
}
.pd-hero .eyebrow { justify-content: center; color: var(--dark-faint); }
.pd-hero .rule { margin-left: auto; margin-right: auto; }
.pd-hero .lede { margin-left: auto; margin-right: auto; }
.pd-hero__facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 36px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line-dark);
  font-size: 13.5px;
  color: var(--dark-faint);
}
.pd-hero__facts strong {
  display: block;
  font-family: var(--font-display);
  font-size: 16.5px; font-weight: 600;
  color: #fff;
}

/* Start CTA — minimalist circle, not a pill. Label over a thin-outlined
   circle with a down arrow; scrolls to the diagnostic. */
.pd-hero__start { margin-top: clamp(30px, 4vw, 44px); }
.pd-start {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.pd-start__label {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #fff;
  transition: color .2s;
}
.pd-start__circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.38);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .22s var(--ease-out), color .22s, transform .22s var(--ease-out);
}
.pd-start__circle svg { animation: pdStartBob 2.6s ease-in-out infinite; }
.pd-start:hover .pd-start__label,
.pd-start:focus-visible .pd-start__label { color: var(--cyan); }
.pd-start:hover .pd-start__circle,
.pd-start:focus-visible .pd-start__circle {
  border-color: var(--cyan);
  color: var(--cyan);
  transform: translateY(3px);
}
@keyframes pdStartBob {
  0%, 100% { transform: translateY(-2px); }
  50%      { transform: translateY(3px); }
}
@media (prefers-reduced-motion: reduce) {
  .pd-start__circle svg { animation: none; }
  .pd-start:hover .pd-start__circle { transform: none; }
}

/* ---------- App shell ---------- */
.pd-shell { background: var(--mist); scroll-margin-top: calc(var(--header-h) + 16px); }
.pd-shell .container { max-width: 860px; }
.pd-app {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: clamp(26px, 4vw, 44px);
}

/* Progress */
.pd-progress { margin-bottom: 28px; }
.pd-progress__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 10px;
}
.pd-progress__label {
  font-size: 12px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
}
.pd-progress__count { font-size: 13px; color: var(--ink-faint); font-weight: 600; white-space: nowrap; flex: none; }
@media (max-width: 420px) { .pd-progress__label { letter-spacing: .08em; } }
.pd-progress__track {
  height: 6px;
  border-radius: 3px;
  background: var(--mist);
  overflow: hidden;
}
.pd-progress__fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: var(--grad);
  transition: width .35s var(--ease-out);
}

/* Step */
.pd-step h2 {
  font-size: clamp(21px, 2.6vw, 26px);
  letter-spacing: -0.015em;
  margin-bottom: 10px;
}
.pd-step .pd-support {
  font-size: 15.5px;
  color: var(--ink-soft);
  max-width: 620px;
  margin-bottom: 26px;
}
.pd-step .pd-support strong { color: var(--ink); }

/* Option cards (step 1) */
.pd-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 620px) { .pd-options { grid-template-columns: 1fr; } }
.pd-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 18px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15.5px;
  text-align: left;
  width: 100%;
  transition: border-color .16s, background .16s, transform .18s var(--ease-out);
}
.pd-option:hover { border-color: var(--ink-faint); transform: translateY(-1px); }
.pd-option .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex: none;
  transition: border-color .16s, background .16s;
}
.pd-option[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, #fff);
}
.pd-option[aria-pressed="true"] .dot { border-color: var(--accent); background: var(--accent); }

/* Fields */
.pd-field { margin-bottom: 18px; max-width: 460px; }
.pd-field--wide { max-width: none; }
.pd-field label {
  display: block;
  font-size: 13.5px; font-weight: 700;
  margin-bottom: 8px;
}
.pd-field .hint { font-weight: 500; color: var(--ink-faint); }
.pd-input, .pd-select {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--mist);
  color: var(--ink);
  transition: border-color .16s, background .16s;
}
.pd-input:focus, .pd-select:focus { outline: none; border-color: var(--accent); background: #fff; }
.pd-input[aria-invalid="true"], .pd-select[aria-invalid="true"] { border-color: #C0392B; }
.pd-select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7A94' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 42px;
}

/* Currency affix */
.pd-money { position: relative; }
.pd-money .cur {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  font-weight: 600;
  pointer-events: none;
}
.pd-money .pd-input { padding-left: 34px; }

/* Inline messages */
.pd-error {
  display: flex; gap: 8px;
  font-size: 14px; font-weight: 600;
  color: #C0392B;
  margin-top: 8px;
}
.pd-warn {
  display: flex; gap: 10px;
  align-items: flex-start;
  font-size: 14.5px;
  color: #8A5A00;
  background: rgba(232,163,61,.12);
  border-left: 3px solid #E8A33D;
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  margin-top: 14px;
  max-width: 620px;
}

/* Instructional callout inside steps */
.pd-note {
  border-left: 3px solid var(--accent);
  background: var(--mist);
  border-radius: 0 10px 10px 0;
  padding: 16px 20px;
  font-size: 14.5px;
  color: var(--ink-soft);
  max-width: 620px;
  margin: 20px 0 4px;
}
.pd-note strong { color: var(--ink); }

/* Inline disclosure ("Not sure where … belongs?") */
.pd-reveal { margin: 0 0 20px; max-width: 620px; }
.pd-reveal summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--accent);
  padding: 10px 0;
}
.pd-reveal summary::-webkit-details-marker { display: none; }
.pd-reveal summary::after {
  content: '';
  width: 7px; height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .18s var(--ease-out);
}
.pd-reveal[open] summary::after { transform: rotate(225deg) translateY(-1px); }
.pd-reveal summary:hover { text-decoration: underline; }

/* Variable / fixed cost rows */
.pd-rows { display: grid; gap: 10px; max-width: 620px; }
.pd-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 148px 44px;
  gap: 10px;
  align-items: center;
}
/* Small screens: the label gets its own full-width line; the amount and
   remove button share the second line, so neither field truncates. */
@media (max-width: 560px) {
  .pd-row { grid-template-columns: minmax(0, 1fr) 44px; }
  .pd-row [data-role="label"] { grid-column: 1 / -1; }
}
/* 16px floor: below it, iOS Safari zooms the viewport on focus. */
.pd-row .pd-input { font-size: 16px; padding: 12px 14px; }
.pd-row .pd-money .pd-input { padding-left: 30px; }
.pd-row .pd-money .cur { left: 13px; font-size: 14px; }
.pd-row__remove {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  color: var(--ink-faint);
  border: 1.5px solid transparent;
  transition: color .16s, border-color .16s, background .16s;
}
.pd-row__remove:hover { color: #C0392B; border-color: var(--line); background: var(--mist); }
.pd-add {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display);
  font-weight: 600; font-size: 14.5px;
  color: var(--accent);
  margin-top: 14px;
  padding: 8px 2px;
  min-height: 44px;
}
.pd-add:hover { text-decoration: underline; }
.pd-subtotal {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: 620px;
  margin-top: 18px;
  padding: 15px 18px;
  background: var(--mist);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
}
.pd-subtotal strong { font-family: var(--font-display); font-size: 16.5px; }

/* Fixed-cost worksheet toggle */
.pd-worksheet-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display);
  font-weight: 600; font-size: 14.5px;
  color: var(--accent);
  margin: 4px 0 16px;
  padding: 6px 2px;
  min-height: 44px;
}
.pd-worksheet-toggle:hover { text-decoration: underline; }

/* Nav controls */
.pd-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.pd-controls .btn { padding: 15px 26px; }
/* On phones the long cost-entry steps push Continue far below the fold;
   keep the forward action visible while content scrolls under it. */
@media (max-width: 560px) {
  .pd-controls {
    position: sticky;
    bottom: 0;
    background: #fff;
    margin-left: -26px;
    margin-right: -26px;
    padding-left: 26px;
    padding-right: 26px;
    padding-bottom: 14px;
    box-shadow: 0 -8px 16px -12px rgba(10,25,49,.18);
    z-index: 2;
  }
}
.pd-back { color: var(--ink-soft); font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 6px;
  min-height: 44px; }
.pd-back:hover { color: var(--ink); }
.pd-restart {
  font-size: 13.5px;
  color: var(--ink-faint);
  padding: 8px 6px;
  min-height: 44px;
}
.pd-restart:hover { color: #C0392B; text-decoration: underline; }
.pd-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.pd-foot .pd-saved { font-size: 12.5px; color: var(--ink-faint); }

/* Contact gate step */
.pd-gate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; max-width: 620px; }
@media (max-width: 560px) { .pd-gate-grid { grid-template-columns: 1fr; } }
.pd-gate-grid .pd-field { max-width: none; }
.pd-gate-grid .pd-field--full { grid-column: 1 / -1; }
.pd-privacy { margin-top: 14px; font-size: 13px; color: var(--ink-faint); max-width: 620px; }

/* ---------- Results ---------- */
.pd-results .pd-state {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

/* Target-achieved verdict: teal words + check badge that pops with a slight
   overshoot, draws its check, then sends out one quiet ring (the same
   "destination pulse" language as the home hero). */
.pd-state .pd-ok {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--teal);
}
.pd-check {
  position: relative;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0,180,166,.16);
  color: var(--teal);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  animation: pdCheckPop .5s cubic-bezier(.34,1.4,.44,1) .15s both;
}
.pd-check::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1.5px solid var(--teal);
  opacity: 0;
  animation: pdCheckRing .9s cubic-bezier(.2,.6,.35,1) .85s;
}
.pd-check svg path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: pdCheckDraw .45s cubic-bezier(.45,.05,.35,1) .45s forwards;
}
@keyframes pdCheckPop {
  from { transform: scale(.4); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}
@keyframes pdCheckDraw { to { stroke-dashoffset: 0; } }
@keyframes pdCheckRing {
  0%   { transform: scale(1);   opacity: .55; }
  100% { transform: scale(2.2); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .pd-check { animation: none; }
  .pd-check::after { animation: none; opacity: 0; }
  .pd-check svg path { animation: none; stroke-dashoffset: 0; }
}
.pd-results h2 { font-size: clamp(23px, 3vw, 30px); margin-bottom: 14px; letter-spacing: -0.018em; }
.pd-results .pd-summary { color: var(--ink-soft); font-size: 16px; max-width: 640px; }
.pd-disclaimer {
  font-size: 13.5px;
  color: var(--ink-faint);
  max-width: 640px;
  margin-top: 14px;
}

.pd-results h3.pd-sec,
.pd-stop h3.pd-sec {
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-faint);
  margin: 40px 0 18px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

/* Stat grid — minmax(0,…) so an unbreakable currency string can never force
   the grid wider than the card and cause horizontal page scroll. */
.pd-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .pd-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pd-stat {
  background: var(--mist);
  border-radius: 12px;
  padding: 18px 18px 16px;
}
.pd-stat .k { font-size: 12.5px; font-weight: 600; color: var(--ink-faint); margin-bottom: 6px; line-height: 1.35; }
.pd-stat .v { font-family: var(--font-display); font-weight: 700; font-size: clamp(18px, 2.2vw, 22px); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.pd-stat .s { font-size: 12.5px; color: var(--ink-faint); margin-top: 4px; }
.pd-stat--bad .v { color: #C0392B; }
.pd-stat--good .v { color: var(--teal); }

/* Waterfall */
.pd-waterfall { display: grid; gap: 10px; max-width: 680px; }
.pd-wf-row { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: center; }
@media (max-width: 560px) {
  .pd-wf-row { grid-template-columns: 1fr; gap: 4px; }
}
.pd-wf-row .lbl { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); text-align: right; }
@media (max-width: 560px) { .pd-wf-row .lbl { text-align: left; } }
/* No overflow clipping: a value label that overhangs the track must spill
   into the card padding, not get cut mid-digit on narrow screens. */
.pd-wf-row .track { position: relative; height: 34px; background: var(--mist); border-radius: 8px; }
.pd-wf-row .zero {
  position: absolute; top: 0; bottom: 0;
  width: 2px; background: rgba(10,25,49,.22);
}
.pd-wf-row .bar {
  position: absolute; top: 5px; bottom: 5px;
  border-radius: 6px;
  min-width: 3px;
}
.pd-wf-row .val {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 13px; font-weight: 700;
  white-space: nowrap;
}
.pd-wf-row .bar--revenue { background: var(--blue); }
.pd-wf-row .bar--minus { background: #C6D2E0; }
.pd-wf-row .bar--cm { background: var(--teal); }
.pd-wf-row .bar--profit { background: var(--cyan); }
.pd-wf-row .bar--loss { background: #E8A33D; }

/* Lever cards */
.pd-levers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 680px; }
@media (max-width: 620px) { .pd-levers { grid-template-columns: 1fr; } }
.pd-lever {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  background: #fff;
  overflow: hidden;
}
.pd-lever::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  opacity: .5;
}
.pd-lever--top::before { opacity: 1; background: var(--grad); }
.pd-lever .rank {
  font-size: 11px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
}
.pd-lever--top .rank { color: var(--accent); }
.pd-lever h4 { font-size: 16px; margin-bottom: 10px; }
.pd-lever .delta { font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.pd-lever .delta.up { color: var(--teal); }
.pd-lever .delta.down { color: #C0392B; }
.pd-lever .to { font-size: 13.5px; color: var(--ink-faint); margin-top: 4px; }
.pd-lever .asm { font-size: 12.5px; color: var(--ink-faint); margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }

/* Results CTA */
.pd-next {
  margin-top: 40px;
  background: var(--navy-2);
  color: #fff;
  border-radius: var(--radius);
  padding: clamp(28px, 4vw, 40px);
}
.pd-next h3 { font-size: clamp(20px, 2.4vw, 25px); margin-bottom: 10px; }
.pd-next p { color: var(--dark-body); font-size: 15.5px; max-width: 560px; margin-bottom: 24px; }
.pd-next .actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- Negative-CM interstitial ---------- */
.pd-stop { max-width: 680px; }
.pd-stop__flag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700;
  letter-spacing: .13em; text-transform: uppercase;
  color: #C0392B;
  background: rgba(192,57,43,.09);
  border: 1px solid rgba(192,57,43,.25);
  border-radius: 99px;
  padding: 7px 14px;
  margin-bottom: 18px;
}
.pd-stop h2 { font-size: clamp(23px, 3vw, 30px); margin-bottom: 14px; letter-spacing: -0.018em; }
.pd-stop .pd-summary { color: var(--ink-soft); font-size: 16px; }
.pd-stop .pd-stats { margin-top: 26px; grid-template-columns: repeat(2, 1fr); }
.pd-stop .pd-levers { margin-top: 12px; }

@media (prefers-reduced-motion: reduce) {
  .pd-progress__fill { transition: none; }
  .pd-option { transition: none; }
}
