/* ==========================================================================
   BuildKit — the shared workbench shell for the interactive tool pages
   (/preview, /operations, /ai, /cost).

   Same anatomy on every page: the brief on the left, the thing being built on
   the right. Class names are .bk- prefixed so they can never collide with
   design-motion-20260919.js, which sets opacity:0 on a fixed list of shared
   class names and reveals them on a scroll trigger — these pages barely
   scroll, so borrowing any of those names would leave content invisible.
   ========================================================================== */

/* --- nav ------------------------------------------------------------------
   .campaign-nav lives in start-20260920.css, which only /start loads, so each
   tool page needs its own or the flex row collapses and the wordmark stacks. */
.bk-nav { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 88px; }
.bk-nav__links { display: flex; align-items: center; gap: 30px; }

/* --- progress rule across the very top ----------------------------------- */
.bk-progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 320;
  background: color-mix(in srgb, var(--border) 65%, transparent);
}
.bk-progress i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand-deep), var(--brand-lift), var(--signal));
  transition: width .55s var(--ease);
}

/* --- the stage ------------------------------------------------------------ */
.bk-stage {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  gap: clamp(28px, 4.5vw, 74px);
  align-items: center;
  min-height: calc(100svh - var(--nav-h));
  padding-block: clamp(30px, 5vh, 58px) clamp(38px, 6vh, 70px);
}

/* --- left: the brief ------------------------------------------------------ */
.bk-tag {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: .66rem; letter-spacing: .17em;
  color: var(--text-2);
}
.bk-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand-lift);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 17%, transparent);
  animation: bk-pulse 2.8s ease-in-out infinite;
}
@keyframes bk-pulse { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }

.bk-panel h1 {
  font-size: clamp(2.05rem, 3.4vw, 3.45rem);
  line-height: 1.07; letter-spacing: -.052em; margin-block: 20px 16px;
  max-width: 17ch;
}
.bk-hl {
  background: linear-gradient(106deg, var(--text) -25%, var(--brand-deep) 52%, var(--brand-lift));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.bk-lede { max-width: 46ch; color: var(--text-2); margin-bottom: 30px; }

/* --- the question card ---------------------------------------------------- */
.bk-form {
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface-solid); padding: clamp(18px, 2vw, 24px);
  box-shadow: var(--shadow-card);
}
.bk-meta { display: flex; align-items: baseline; gap: 13px; margin-bottom: 15px; }
.bk-counter {
  flex: 0 0 auto; font-family: var(--font-mono); font-size: .64rem;
  letter-spacing: .15em; color: var(--text-3);
}
.bk-question {
  font-family: var(--font-display); font-size: 1rem; font-weight: 600;
  letter-spacing: -.012em;
}

/* Fixed height so the card does not jump as controls swap between steps. */
.bk-control { min-height: 122px; }

.bk-input {
  width: 100%; padding: 14px 16px; font-size: 1.02rem;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--bg-2);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.bk-input::placeholder { color: var(--text-3); }
.bk-input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 13%, transparent);
}

.bk-options { display: flex; flex-wrap: wrap; gap: 10px; }
.bk-opt {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 16px; font-size: .9rem; text-align: left;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--bg-2);
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.bk-opt:hover { border-color: var(--brand); transform: translateY(-1px); }
.bk-opt[aria-pressed='true'] {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 11%, transparent);
  color: var(--brand-pale);
}
.bk-opt__tick { color: var(--brand-lift); font-size: .82rem; opacity: 0; transform: scale(.6); transition: all .2s var(--ease); }
.bk-opt[aria-pressed='true'] .bk-opt__tick { opacity: 1; transform: scale(1); }

.bk-swatch { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px 8px 8px; }
.bk-swatch i {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto;
  background: var(--sw, var(--brand));
  box-shadow: inset 0 0 0 1px #0000001f;
}
.bk-swatch[aria-pressed='true'] i { box-shadow: inset 0 0 0 1px #0000001f, 0 0 0 3px color-mix(in srgb, var(--sw) 30%, transparent); }

.bk-error { margin-top: 13px; font-size: .84rem; color: #b3261e; }
[data-theme='dark'] .bk-error { color: #ff9c92; }

.bk-actions-row { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.bk-back { font-size: .85rem; color: var(--text-2); padding: 10px 2px; transition: color .2s var(--ease); }
.bk-back:hover { color: var(--brand-pale); }
.bk-next { margin-left: auto; }

.bk-footnote {
  margin-top: 26px; font-family: var(--font-mono); font-size: .6rem;
  letter-spacing: .17em; color: var(--text-3);
}

/* --- right: the frame the deliverable builds inside ----------------------- */
/* The glow below reaches 7% past the preview on each side; clip it at the page
   edge so phones do not scroll sideways (was +5px at 390px wide). */
main { overflow-x: clip; }
.bk-view { position: relative; display: flex; flex-direction: column; gap: 16px; }
.bk-view::before {
  content: ''; position: absolute; left: -7%; right: -7%; top: -11%; height: 76%;
  z-index: 0; pointer-events: none;
  background: radial-gradient(54% 54% at 50% 34%, color-mix(in srgb, var(--brand) 24%, transparent), transparent 72%);
  filter: blur(46px);
}

.bk-browser {
  position: relative; z-index: 1; overflow: hidden;
  border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface-solid); box-shadow: var(--shadow-lg);
}
.bk-browser__bar {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-2) 90%, var(--surface-solid));
}
.bk-lights { display: flex; gap: 5px; flex: 0 0 auto; }
.bk-lights i { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.bk-url {
  flex: 1; min-width: 0; padding: 5px 13px; overflow: hidden;
  font-family: var(--font-mono); font-size: .68rem; color: var(--text-2);
  text-overflow: ellipsis; white-space: nowrap;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
.bk-badge {
  flex: 0 0 auto; font-family: var(--font-mono); font-size: .55rem;
  letter-spacing: .13em; color: var(--brand-pale);
}

.bk-browser__screen { position: relative; aspect-ratio: 16 / 10.4; background: #fff; }
.bk-browser__screen iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }

/* Sweep shown while the next version is being written. */
.bk-scan { position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: 0; }
.bk-scan::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 32%;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--brand) 30%, transparent), transparent);
}
.bk-browser.is-building .bk-scan { opacity: 1; }
.bk-browser.is-building .bk-scan::before { animation: bk-sweep .55s linear; }
@keyframes bk-sweep { from { transform: translateX(-45%) } to { transform: translateX(330%) } }

.bk-view__foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.bk-view__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.bk-action {
  padding: 10px 16px; font-size: .85rem;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface-solid);
  transition: border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease), opacity .2s;
}
.bk-action:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-pale); transform: translateY(-1px); }
.bk-action:disabled { opacity: .42; cursor: not-allowed; }
.bk-hint { font-size: .78rem; color: var(--text-3); max-width: 36ch; }

/* --- narrow --------------------------------------------------------------- */
@media (max-width: 1080px) {
  .bk-stage { gap: 34px; }
  .bk-panel h1 { max-width: none; }
}
@media (max-width: 900px) {
  .bk-nav { min-height: 76px; }
  .bk-nav__links { gap: 18px; }
  .bk-nav .text-link { font-size: .78rem; }
  .bk-stage {
    grid-template-columns: minmax(0, 1fr);
    align-items: start; min-height: 0;
    padding-block: 34px 52px; gap: 40px;
  }
  .bk-control { min-height: 0; }
  .bk-view { order: 2; }
  .bk-lede { max-width: none; }
  .bk-browser__screen { aspect-ratio: 16 / 11.5; }
  .bk-view__foot { justify-content: flex-start; }
}
@media (max-width: 560px) {
  .bk-badge { display: none; }
  .bk-opt { padding: 10px 14px; font-size: .85rem; }
  .bk-actions-row { flex-wrap: wrap; }
  .bk-next { margin-left: 0; width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .bk-dot { animation: none; }
  .bk-browser.is-building .bk-scan::before { animation: none; }
  .bk-progress i { transition: none; }
  .bk-opt:hover, .bk-action:hover:not(:disabled) { transform: none; }
}
