/* Feedback Clarity Builder - Lead With Clarity Lab
   Palette and type follow the CLRT lab brand guide. The coastal texture stays
   in the palette and whitespace, never announced. */

:root {
  /* Brand palette */
  --navy: #0e2a4a;
  --ink: #0b1f35;
  --cyan: #01a4d0;
  --cyan-tint: #5fcdeb;
  --slate: #5a6678;
  --mist: #e3f3fa;
  --paper: #edf2f6;
  --canvas: #fbfaf6;

  /* Working tokens */
  --text: #132235;
  --text-soft: #45566a;
  --line: #d6e0e8;
  --line-strong: #b7c6d1;
  --field-bg: #ffffff;
  --error: #a12822;

  --r: 16px;
  --r-sm: 10px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(11, 31, 53, 0.06);
  --shadow-md: 0 10px 30px -14px rgba(11, 31, 53, 0.28);

  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: Epilogue, var(--font-body);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  color: var(--text);
  background: var(--paper);
  font-family: var(--font-body);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 520px at 50% -8%, var(--mist), transparent 60%),
    var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

/* ---------- Shell ---------- */
.tool-shell {
  width: min(1140px, calc(100% - 40px));
  margin: 0 auto;
  padding: 40px 0 40px;
  display: grid;
  gap: 20px;
}

/* Shared surface */
.hero,
.privacy-panel,
.steps,
.card,
.output-card,
.cta {
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(760px 320px at 88% -30%, rgba(1, 164, 208, 0.28), transparent 62%),
    linear-gradient(160deg, var(--navy) 0%, var(--ink) 100%);
  border-color: var(--ink);
  color: #ffffff;
  padding: clamp(28px, 4vw, 44px);
}

.hero::after {
  /* waterline: a thin clarifying edge */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.9;
}

.brandbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brandbar img {
  height: 34px;
  width: auto;
  display: block;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--cyan-tint);
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.02;
  font-weight: 800;
}

.subtitle {
  margin: 0 0 22px;
  font-size: clamp(17px, 2.1vw, 21px);
  line-height: 1.4;
  color: #e8f1f6;
  max-width: 46ch;
}

.boundary {
  margin: 0;
  max-width: 74ch;
  font-size: 13.5px;
  line-height: 1.55;
  color: #cfe1ec;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--r-sm);
  padding: 14px 16px;
}

/* ---------- Section headings ---------- */
h2 {
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1.2;
  color: var(--navy);
}

.panel-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 6px;
}

/* ---------- Privacy panel ---------- */
.privacy-panel {
  padding: clamp(20px, 3vw, 28px);
  border-left: 4px solid var(--cyan);
}

.privacy-panel p {
  margin: 0 0 16px;
  line-height: 1.55;
  color: var(--text-soft);
  max-width: 78ch;
}

.ack {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--mist);
  font-weight: 600;
  cursor: pointer;
}

.ack input,
.inline-check input {
  width: 20px;
  height: 20px;
  min-height: 0;
  margin-top: 1px;
  flex: 0 0 auto;
  accent-color: var(--cyan);
  cursor: pointer;
}

/* ---------- Step tracker ---------- */
.steps {
  display: flex;
  gap: 8px;
  padding: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.steps::-webkit-scrollbar {
  display: none;
}

.steps button {
  flex: 1 1 0;
  min-width: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--slate);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.steps button:hover {
  background: var(--paper);
  color: var(--navy);
}

.steps button span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: #ffffff;
  color: var(--slate);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
}

.steps button.active {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
}

.steps button.active span {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--ink);
  box-shadow: 0 0 0 4px rgba(1, 164, 208, 0.22);
}

/* ---------- Builder layout (two-pane on desktop) ---------- */
.builder {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.builder__main {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.builder__aside {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 20px;
  min-width: 0;
}

/* ---------- Card / form ---------- */
.card {
  padding: clamp(20px, 3vw, 28px);
}

.section-grid {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.4;
}

fieldset {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 16px;
  margin: 0;
}

legend {
  padding: 0 6px;
  font-weight: 700;
  color: var(--navy);
}

.inline-check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  color: var(--text);
  background: var(--field-bg);
  font-weight: 400;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: #93a2b1;
}

textarea {
  min-height: 116px;
  resize: vertical;
  line-height: 1.5;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--slate);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(1, 164, 208, 0.22);
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
}

.field-error {
  color: var(--error);
  font-weight: 600;
  font-size: 13.5px;
  margin: 0;
}

.build-notice {
  border: 1px solid rgba(1, 164, 208, 0.35);
  border-left: 4px solid var(--cyan);
  background: var(--mist);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  line-height: 1.5;
  font-size: 14px;
  color: var(--text);
}

.turnstile {
  margin-top: 4px;
}

/* ---------- Buttons ---------- */
button,
.cta a {
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: #ffffff;
  color: var(--navy);
  padding: 12px 20px;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

button:not(.steps button, .primary, .seg button):not(:disabled):hover {
  border-color: var(--slate);
  background: var(--mist);
  color: var(--navy);
}

button:active {
  transform: translateY(1px);
}

button.primary,
.cta a {
  background: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
}

button.primary:not(:disabled):hover {
  background: var(--ink);
  border-color: var(--ink);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

button.primary:disabled {
  background: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.actions #nextButton,
.actions .primary {
  margin-left: auto;
}

.actions #resetButton {
  color: var(--slate);
}

/* ---------- Output / live preview ---------- */
.output-card {
  padding: clamp(20px, 3vw, 26px);
  display: grid;
  gap: 16px;
}

.output-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.status {
  margin: 6px 0 0;
  line-height: 1.5;
  color: var(--text-soft);
  font-size: 14px;
  flex-basis: 100%;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  min-height: 200px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 18px;
  line-height: 1.6;
  background: var(--canvas);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
}

#copyButton {
  justify-self: start;
}

/* ---------- CTA ---------- */
.cta {
  background:
    radial-gradient(520px 240px at 100% 0%, rgba(1, 164, 208, 0.22), transparent 60%),
    linear-gradient(160deg, var(--navy), var(--ink));
  border-color: var(--ink);
  color: #ffffff;
  padding: clamp(22px, 3vw, 28px);
}

.cta h2 {
  color: #ffffff;
}

.cta p {
  margin: 0 0 18px;
  line-height: 1.55;
  color: #d5e5ef;
}

.cta a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--ink);
  font-weight: 700;
}

.cta a:hover {
  background: var(--cyan-tint);
  border-color: var(--cyan-tint);
}

/* ---------- Footer ---------- */
.page-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 6px 8px;
  color: var(--slate);
  font-size: 13px;
}

.page-footer img {
  height: 22px;
  width: auto;
  opacity: 0.85;
}

.page-footer a {
  color: var(--slate);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.page-footer a:hover {
  color: var(--navy);
  border-bottom-color: var(--navy);
}

.page-footer .sep {
  opacity: 0.4;
}

/* ---------- Helper copy ---------- */
.step-helper {
  margin: -6px 0 2px;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-soft);
}

.field-help {
  font-weight: 400;
  font-size: 13px;
  line-height: 1.4;
  color: var(--slate);
  margin-top: -2px;
}

/* ---------- Segmented controls (delivery / tone) ---------- */
.seg-group {
  display: grid;
  gap: 10px;
}

.seg-label {
  font-weight: 600;
  color: var(--navy);
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seg button {
  flex: 0 0 auto;
  min-height: 0;
  padding: 9px 15px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-pill);
  background: #ffffff;
  color: var(--slate);
  font-weight: 600;
  font-size: 14px;
}

.seg button:not(.on):hover {
  border-color: var(--cyan);
  color: var(--navy);
  background: var(--mist);
}

.seg button.on {
  background: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
}

.seg button.on:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

/* ---------- Quick read + nudges (Describe) ---------- */
.read-note {
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
}

.read-note--safe {
  background: var(--mist);
  border: 1px solid rgba(1, 164, 208, 0.3);
  color: var(--text);
}

.read-note--nudge {
  background: #fff6ec;
  border: 1px solid #f0c489;
  color: #6b4415;
}

.read-note--stop {
  background: #fbecea;
  border: 1px solid #e2a19b;
  color: #7c241d;
}

.read-note--caution {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--navy);
  color: var(--text);
}

/* ---------- Live insights (why / avoid) ---------- */
.insights {
  display: grid;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.insight-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
  font-weight: 600;
  margin-bottom: 8px;
}

.insights ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.insights li {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}

#whyList li::marker {
  color: var(--cyan);
}

#avoidList li {
  color: var(--text-soft);
}

.growth-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-soft);
}

/* ---------- Scope notice (calm caution / firm crisis) ---------- */
.scope-notice {
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
}

.scope-notice strong {
  font-weight: 700;
}

.scope-notice--caution {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--navy);
  color: var(--text);
}

.scope-notice--crisis {
  background: #fbecea;
  border: 1px solid #e2a19b;
  color: #7c241d;
}

.copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- Concern note (matches the manager's stated worry) ---------- */
.concern-note {
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
}

.concern-note__label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--cyan);
}

.concern-note--coach {
  background: var(--mist);
  border: 1px solid rgba(1, 164, 208, 0.35);
  color: var(--text);
}

.concern-note--done {
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  color: var(--text-soft);
}

/* ---------- Utilities ---------- */
.hidden {
  display: none !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .builder {
    grid-template-columns: 1fr;
  }

  .builder__aside {
    position: static;
  }
}

@media (max-width: 640px) {
  .tool-shell {
    width: min(100% - 24px, 1140px);
    padding: 20px 0 32px;
    gap: 16px;
  }

  .steps {
    gap: 4px;
    padding: 10px 8px;
  }

  .steps button {
    min-width: 0;
    font-size: 11px;
    padding: 8px 2px;
    gap: 6px;
  }

  .steps button span {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .actions {
    gap: 10px;
  }

  .actions button {
    flex: 1 1 auto;
  }

  .actions #nextButton,
  .actions .primary {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }
}
