/* =========================================================
   FORGE — full-page application flow
   ========================================================= */
.ap { min-height: 100svh; display: flex; flex-direction: column; overflow-x: hidden; }

/* top bar */
.ap-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 28px; padding: 18px var(--gutter); background: rgba(241,238,232,.82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.ap-top .brand { margin-right: 0; }
.ap-secs { list-style: none; display: flex; gap: 6px; margin: 0 auto; padding: 0; }
.ap-secs li { position: relative; padding: 7px 12px; color: var(--muted); transition: color .4s, background .4s; }
.ap-secs li::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px currentColor; vertical-align: 1px; transition: background .4s; }
.ap-secs li.is-done { color: var(--ink); }
.ap-secs li.is-done::before { background: var(--ink); }
.ap-secs li.is-on { color: var(--ink); background: var(--lime); transform: skewX(-8deg); }
.ap-secs li.is-on::before { background: var(--ink); }
.ap-exit { color: var(--muted); white-space: nowrap; transition: color .3s; }
.ap-exit:hover { color: var(--ink); }
.ap-progress { position: sticky; top: 0; z-index: 19; height: 3px; background: var(--paper-3); }
.ap-progress i { position: absolute; inset: 0; background: var(--ink); transform-origin: left; transform: scaleX(0); transition: transform .7s var(--ease); }

/* layout */
.ap-main { flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; padding: clamp(28px, 4vw, 56px) var(--gutter); display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: start; }

/* ---------- live brief ---------- */
.brief { position: sticky; top: 96px; align-self: start; margin-top: max(0px, calc((min(620px, 100svh - 200px) - 540px) / 2)); background: var(--paper); box-shadow: 0 0 0 1.5px var(--ink), 12px 12px 0 var(--ink); transform: rotate(-1.2deg); transition: transform .8s var(--ease), box-shadow .8s var(--ease), background .8s; }
.brief__bar { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1.5px solid var(--ink); background: var(--paper-2); color: var(--muted); text-transform: none; font-size: 11px; }
.brief__dots { display: flex; gap: 5px; } .brief__dots i { width: 9px; height: 9px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--ink); }
.brief__dots i:first-child { background: var(--lime); }
.brief__file { flex: 1; }
.brief__bar b { color: var(--ink); font-weight: 700; }
.brief__meter { height: 4px; background: var(--paper-3); }
.brief__meter i { display: block; height: 100%; background: var(--lime-2); transform-origin: left; transform: scaleX(0); transition: transform .7s var(--ease); }
.brief__body { padding: 26px 24px 30px;
  background-image: linear-gradient(rgba(70,110,190,.10) 1px, transparent 1px), linear-gradient(90deg, rgba(70,110,190,.10) 1px, transparent 1px); background-size: 18px 18px; }
.brief__k { color: var(--muted); font-size: 10.5px; margin: 0 0 6px; }
.brief__title { margin: 0 0 22px; font-weight: 800; font-stretch: 110%; font-size: clamp(24px, 2.2vw, 30px); line-height: 1.08; letter-spacing: -.02em; min-height: 2.16em; transition: color .4s; word-break: break-word; }
.brief__title.is-empty { font-family: "Caveat", cursive; font-weight: 700; font-stretch: 100%; letter-spacing: 0; color: #26313F; opacity: .55; font-size: clamp(28px, 2.6vw, 36px); }
.brief__rows { margin: 0; }
.brief__row { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: baseline; padding: 11px 0; border-top: 1px dashed var(--line-2); }
.brief__row dt { color: var(--muted); font-size: 10.5px; }
.brief__row dd { margin: 0; font-weight: 600; font-size: 14.5px; line-height: 1.35; word-break: break-word; animation: inkIn .5s var(--ease-out); }
.brief__row.is-empty dd { height: 10px; align-self: center; animation: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='10' viewBox='0 0 120 10'%3E%3Cpath d='M2 5 q10 -5 20 0 t20 0 t20 0 t20 0 t20 0 t16 0' fill='none' stroke='%2326313F' stroke-opacity='.35' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") left center / auto 10px repeat-x; max-width: 70%; }
@keyframes inkIn { from { opacity: 0; transform: translateY(4px); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
.brief__row dd .chip { display: inline-block; margin: 0 4px 4px 0; padding: 2px 7px; font-family: var(--f-mono); font-size: 10.5px; font-weight: 500; text-transform: uppercase; background: var(--ink); color: var(--lime); }
.brief__stamp { position: absolute; right: 18px; bottom: -14px; padding: 6px 12px; background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); transform: rotate(-4deg); transition: background .5s, color .5s; }
.brief.is-built { background: var(--ink); color: var(--paper); transform: rotate(0); box-shadow: 0 0 0 1.5px var(--ink), 12px 12px 0 var(--lime); }
.brief.is-built .brief__body { background-image: none; }
.brief.is-built .brief__bar { background: #181817; color: rgba(241,238,232,.5); border-color: rgba(241,238,232,.12); }
.brief.is-built .brief__bar b { color: var(--lime); }
.brief.is-built .brief__title { color: var(--lime); }
.brief.is-built .brief__row { border-color: rgba(241,238,232,.14); }
.brief.is-built .brief__row dd .chip { background: var(--lime); color: var(--ink); }
.brief.is-built .brief__stamp { background: var(--lime); box-shadow: inset 0 0 0 1.5px var(--ink); }

/* ---------- question stage ---------- */
.stage { position: relative; min-height: min(620px, calc(100svh - 200px)); display: flex; flex-direction: column; }
#flow { flex: 1; display: flex; align-items: center; }
.q-host { position: relative; width: 100%; max-width: 760px; }
.q { width: 100%; }
.q--in { animation: qIn .7s var(--ease-out) both; }
.q--in-back { animation: qInBack .7s var(--ease-out) both; }
.q--out { position: absolute; inset: 0 0 auto 0; animation: qOut .45s var(--ease) both; pointer-events: none; }
.q--out-back { position: absolute; inset: 0 0 auto 0; animation: qOutBack .45s var(--ease) both; pointer-events: none; }
@keyframes qIn { from { opacity: 0; transform: translateY(60px); } to { opacity: 1; transform: none; } }
@keyframes qInBack { from { opacity: 0; transform: translateY(-60px); } to { opacity: 1; transform: none; } }
@keyframes qOut { to { opacity: 0; transform: translateY(-60px); } }
@keyframes qOutBack { to { opacity: 0; transform: translateY(60px); } }

.q__num { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; color: var(--muted); }
.q__num span { display: inline-grid; place-items: center; min-width: 34px; height: 24px; padding: 0 7px; background: var(--ink); color: var(--lime); font-weight: 700; transform: skewX(-10deg); }
.q__title { margin: 0; font-weight: 800; font-stretch: 112%; font-size: clamp(30px, 4vw, 52px); line-height: 1.04; letter-spacing: -.025em; }
.q__title em { font-family: var(--f-serif); font-weight: 400; font-style: italic; font-stretch: 100%; letter-spacing: -.01em; }
.q__sub { margin: 14px 0 0; color: var(--ink-2); font-size: clamp(16px, 1.3vw, 18px); max-width: 560px; }
.q__field { position: relative; margin-top: clamp(28px, 4vw, 44px); }
.q__input { width: 100%; border: 0; border-radius: 0; outline: 0; background: transparent; color: var(--ink); padding: 8px 0 14px;
  font: 600 clamp(22px, 2.6vw, 32px)/1.25 var(--f-sans); letter-spacing: -.01em; box-shadow: inset 0 -2px 0 var(--line-2); transition: box-shadow .35s; resize: none; }
.q__input::placeholder { color: #aba79f; font-weight: 500; }
.q__input:focus { box-shadow: inset 0 -3px 0 var(--ink); }
.q__input--area { font-size: clamp(19px, 1.9vw, 24px); line-height: 1.4; min-height: 3.2em; }
.q__count { position: absolute; right: 0; bottom: -24px; font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.q.is-invalid .q__input { box-shadow: inset 0 -3px 0 #D93A1E; }
.q__err { min-height: 18px; margin: 30px 0 0; font-family: var(--f-mono); font-size: 12px; color: #C2321A; }
.q__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 18px; margin-top: 10px; }
.q__hint { color: var(--muted); font-size: 11px; }
.q__hint kbd { font-family: var(--f-mono); padding: 3px 6px; background: var(--paper-2); box-shadow: inset 0 -2px 0 var(--line-2), inset 0 0 0 1px var(--line-2); }
.q__skip { font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; }
.q__skip:hover { color: var(--ink); }

/* options */
.opts { display: grid; gap: 10px; margin-top: clamp(26px, 3.6vw, 40px); max-width: 640px; }
.opts--grid { grid-template-columns: 1fr 1fr; max-width: 700px; }
.opt { position: relative; display: flex; align-items: center; gap: 16px; width: 100%; padding: 14px 18px 14px 14px; text-align: left; background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--line-2); transition: box-shadow .25s, background .25s, transform .3s var(--ease-out); }
.opt:hover { box-shadow: inset 0 0 0 1.5px var(--ink); transform: translateX(4px); }
.opt kbd { flex: none; display: grid; place-items: center; width: 30px; height: 30px; font-family: var(--f-mono); font-size: 12px; font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--ink); transition: background .25s, color .25s; }
.opt span { flex: 1; min-width: 0; }
.opt b { display: block; font-weight: 700; font-stretch: 106%; font-size: 17px; }
.opt small { display: block; color: var(--muted); font-size: 13.5px; margin-top: 1px; }
.opt i { font-style: normal; font-weight: 800; opacity: 0; transform: scale(.4); transition: .3s var(--ease-out); }
.opt.is-on { background: var(--lime); box-shadow: inset 0 0 0 1.5px var(--ink); }
.opt.is-on kbd { background: var(--ink); color: var(--lime); }
.opt.is-on i { opacity: 1; transform: none; }
.opt.flash { animation: flash .35s steps(2) 1; }
@keyframes flash { 50% { background: var(--paper); } }
.opt:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* review */
.review { margin-top: 26px; border-top: 1.5px solid var(--ink); max-width: 720px; }
.review__row { display: grid; grid-template-columns: 150px 1fr auto; gap: 16px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.review__row dt { font-family: var(--f-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.review__row dd { margin: 0; font-weight: 600; font-size: 15px; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.review__row dd.is-blank { color: var(--muted); font-weight: 400; }
.review__edit { font-family: var(--f-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.review__edit:hover { color: var(--ink); }
.consent { margin-top: 22px; }

/* bottom nav */
.ap-nav { display: flex; align-items: center; gap: 18px; padding-top: 22px; margin-top: 22px; border-top: 1px solid var(--line); }
.ap-nav__count { color: var(--muted); } .ap-nav__count b { color: var(--ink); }
.ap-nav__save { flex: 1; color: var(--muted); font-size: 10.5px; text-transform: none; letter-spacing: .02em; transition: color .3s; }
.ap-nav__save.is-saved { color: var(--ink); }
.ap-nav__arrows { display: flex; gap: 6px; }
.ap-nav__arrows button { width: 44px; height: 44px; background: var(--ink); color: var(--lime); font-weight: 800; font-size: 18px; transition: opacity .3s, transform .3s var(--ease-out); }
.ap-nav__arrows button:hover:not(:disabled) { transform: translateY(-2px); }
.ap-nav__arrows button:disabled { opacity: .2; cursor: default; }

/* submitting */
.btn.is-loading b { animation: spin .9s linear infinite; }

/* ---------- success ---------- */
.done { position: fixed; inset: 0; z-index: 50; background: var(--ink); color: var(--paper); overflow-y: auto; display: grid; place-items: center; padding: 60px var(--gutter);
  clip-path: circle(0% at var(--cx, 50%) var(--cy, 50%)); transition: clip-path 1.1s var(--ease); }
.done.is-open { clip-path: circle(150% at var(--cx, 50%) var(--cy, 50%)); }
.done::before { content: ""; position: fixed; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(241,238,232,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(241,238,232,.06) 1px, transparent 1px); background-size: 56px 56px; }
.done__inner { position: relative; width: 100%; max-width: 900px; }
.done__ok { color: rgba(241,238,232,.6); margin: 0 0 18px; } .done__ok b { color: var(--lime); font-weight: 500; }
.done__title { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: clamp(64px, 12vw, 170px); line-height: .9; text-transform: uppercase; }
.done__lede { font-size: clamp(18px, 1.7vw, 22px); margin: 28px 0 6px; color: rgba(241,238,232,.82); }
.done__ref { color: var(--lime); margin: 0; }
.done__next { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0; margin: 44px 0 44px; }
.done__next li { padding: 22px; border: 1px solid rgba(241,238,232,.18); display: flex; flex-direction: column; gap: 8px; }
.done__next .mono { color: var(--lime); }
.done__next b { font-weight: 800; font-stretch: 110%; font-size: 20px; letter-spacing: -.01em; }
.done__next em { font-style: normal; color: rgba(241,238,232,.62); font-size: 14.5px; }
.done .btn--lime { --hover: var(--paper); --hfg: var(--ink); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .ap-secs { display: none; }
  .ap-top { justify-content: space-between; }
  .ap-main { grid-template-columns: 1fr; align-items: start; }
  .brief { display: none; }
  .stage { min-height: calc(100svh - 150px); }
}
@media (max-width: 720px) {
  .ap-top { padding: 14px var(--gutter); }
  .ap-top .brand__rx { font-size: 12px; } .ap-top .brand__prog { font-size: 20px; }
  .ap-exit span { display: none; }
  .ap-main { padding: 24px var(--gutter) 18px; }
  .stage { min-height: calc(100svh - 110px); }
  #flow { align-items: flex-start; padding-top: 6vh; }
  .q__title { font-size: 28px; }
  .opts--grid { grid-template-columns: 1fr; }
  .opt { padding: 12px 14px 12px 12px; gap: 12px; }
  .opt b { font-size: 16px; }
  .q__hint, .ap-nav__save { display: none; }
  .ap-nav { justify-content: space-between; }
  .review__row { grid-template-columns: 1fr auto; gap: 2px 12px; }
  .review__row dt { grid-column: 1 / -1; }
  .done__next { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .q--in, .q--in-back, .q--out, .q--out-back { animation: none; }
  .q--out, .q--out-back { display: none; }
  .done { transition: none; }
}

/* form helpers (moved from styles.css) */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.consent { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; color: var(--ink-2); margin-top: 6px; position: relative; }
.consent span::before { content: ""; flex: none; display: inline-block; width: 20px; height: 20px; margin-right: 12px; vertical-align: -4px; box-shadow: inset 0 0 0 1.5px var(--ink); background: var(--paper-2); transition: .2s; }
.consent input:checked + span::before { background: var(--lime) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3L15 6.5' fill='none' stroke='%230D0D0C' stroke-width='2.4'/%3E%3C/svg%3E") center/16px no-repeat; }
.consent.is-invalid span::before { box-shadow: inset 0 0 0 1.5px #D93A1E; }
.consent input:focus-visible + span::before { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn.is-loading span { opacity: .5; }
.btn.is-loading b { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.consent input { position: absolute; opacity: 0; pointer-events: none; }

/* ---------- track choice (full vs quick) ---------- */
.tracks { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: clamp(26px, 3.6vw, 40px); max-width: 760px; }
.track { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 22px; text-align: left; background: var(--paper);
  box-shadow: inset 0 0 0 1.5px var(--line-2); transition: box-shadow .3s, background .3s, transform .4s var(--ease-out); }
.track:hover { box-shadow: inset 0 0 0 1.5px var(--ink); transform: translateY(-4px); }
.track[data-track="full"] { box-shadow: inset 0 0 0 1.5px var(--ink), 8px 8px 0 var(--lime); }
.track[data-track="full"]:hover { box-shadow: inset 0 0 0 1.5px var(--ink), 12px 12px 0 var(--lime); }
.track.is-on { background: var(--ink); color: var(--paper); }
.track__rec { position: absolute; top: -11px; right: 16px; padding: 4px 8px; background: var(--lime); color: var(--ink); font-size: 10px; font-weight: 700; transform: skewX(-8deg); }
.track__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.track kbd { display: grid; place-items: center; width: 30px; height: 30px; font-family: var(--f-mono); font-size: 12px; font-weight: 700; box-shadow: inset 0 0 0 1.5px currentColor; }
.track__meta { color: var(--muted); font-size: 11px; }
.track.is-on .track__meta { color: rgba(241,238,232,.6); }
.track__name { font-family: var(--f-display); font-weight: 400; font-size: clamp(28px, 2.8vw, 38px); line-height: 1; text-transform: uppercase; }
.track.is-on .track__name { color: var(--lime); }
.track__desc { color: var(--ink-2); font-size: 15px; line-height: 1.45; flex: 1; }
.track.is-on .track__desc { color: rgba(241,238,232,.78); }
.track__power { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.track__power .mono { font-size: 10px; color: var(--muted); }
.track__bars { display: flex; gap: 3px; }
.track__bars i { width: 16px; height: 8px; background: var(--paper-3); transform: skewX(-12deg); }
.track__bars i.on { background: var(--ink); }
.track[data-track="full"] .track__bars i.on { background: var(--lime-2); box-shadow: inset 0 0 0 1px var(--ink); }
.track.is-on .track__bars i { background: rgba(241,238,232,.18); }
.track.is-on .track__bars i.on { background: var(--lime); }
.track:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.q--track .q__hint { margin-top: 6px; }

/* review: upgrade a quick pitch to the full application */
.upgrade { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; max-width: 720px; margin-top: 18px; padding: 16px 18px; text-align: left;
  background: var(--lime); box-shadow: inset 0 0 0 1.5px var(--ink); font-size: 15px; transition: transform .4s var(--ease-out); }
.upgrade b { font-weight: 800; }
.upgrade i { font-style: normal; font-weight: 800; font-size: 22px; transition: transform .4s var(--ease-out); }
.upgrade:hover { transform: translateY(-2px); }
.upgrade:hover i { transform: translateX(6px); }
.ap-secs li[hidden] { display: none; }

@media (max-width: 720px) {
  .tracks { grid-template-columns: 1fr; gap: 16px; }
  .track { padding: 18px; gap: 10px; }
}
