/* studio dalits: the brief form. Loads after /styles.css and uses its tokens. */

[hidden] { display: none !important; }

.app main { padding-bottom: clamp(56px, 7vw, 104px); }

.brief-head {
  padding-block: clamp(20px, 3.5vw, 48px) clamp(24px, 3vw, 40px);
  border-top: 1px solid var(--rule-strong);
}
.brief-head .lead { max-width: 46ch; margin-top: 16px; }

.notice,
.broken {
  background: var(--white);
  padding: 24px clamp(20px, 3vw, 40px);
  max-width: 720px;
}
.broken p { margin-top: 12px; max-width: 56ch; }
.broken .actions { margin-top: 24px; }

.brief-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: var(--gutter);
  align-items: start;
}
.brief-main, .sent { grid-column: 1 / span 7; grid-row: 1; min-width: 0; scroll-margin-top: 16px; }
.brief-side { grid-column: 8 / span 5; grid-row: 1; position: sticky; top: 16px; min-width: 0; }

/* ---------- Step chips ---------- */

.steps ol {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 var(--gutter);
  padding: 0;
  list-style: none;
}
.step {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.step-num {
  display: flex;
  align-items: flex-end;
  height: 44px;
  padding: 0 8px 6px;
  background: var(--white);
  border: 1px solid var(--rule-strong);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  position: relative;
  isolation: isolate;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease) 0.06s;
}
/* A step chip fills from the bottom, like paint on a chip: sage when started,
   harbour for the current step. A chip drains faster than it fills. */
.step-num::before,
.step-num::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.14s ease-in;
}
.step-num::before { background: var(--sage-1); }
.step-num::after { background: var(--harbour); }
.step.is-started .step-num::before,
.step[aria-current="step"] .step-num::after { transform: scaleY(1); transition: transform 0.34s var(--ease); }
.step-title {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--ink-soft);
}
.step.is-started .step-num { border-color: var(--sage-2); }
.step[aria-current="step"] .step-num { border-color: var(--harbour); color: var(--on-harbour); }
.step[aria-current="step"] .step-title { color: var(--ink); }
.step:hover .step-num { border-color: var(--ink); }

/* ---------- Panel ---------- */

.panel { background: var(--white); padding: clamp(20px, 3vw, 40px); }
.panel-num { font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.panel-head .h3 { margin-top: 6px; }
.panel-head .h3:focus { outline: none; }
.panel-why { margin-top: 8px; color: var(--ink-soft); font-size: 17px; max-width: 56ch; }

.panel-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 16px;
  margin-top: 28px;
}
.q { grid-column: 1 / -1; min-width: 0; }

/* The new step wipes open in the direction of travel (the hero drawing's
   clip-path move). A question that an answer opens wipes down. Fill mode is
   "backwards" only, so no clip stays on and cuts a focus ring. */
.panel--fwd { animation: panel-in-fwd 0.42s var(--ease) backwards; }
.panel--back { animation: panel-in-back 0.42s var(--ease) backwards; }
.q--enter { animation: q-in 0.32s var(--ease) backwards; }
@keyframes panel-in-fwd {
  from { clip-path: inset(0 38% 0 0); opacity: 0.3; }
  to { clip-path: inset(0 0 0 0); opacity: 1; }
}
@keyframes panel-in-back {
  from { clip-path: inset(0 0 0 38%); opacity: 0.3; }
  to { clip-path: inset(0 0 0 0); opacity: 1; }
}
@keyframes q-in {
  from { clip-path: inset(0 0 100% 0); opacity: 0; transform: translateY(-6px); }
  to { clip-path: inset(0 0 0 0); opacity: 1; transform: none; }
}
.q--half { grid-column: auto; }
.q[hidden] { display: none; }

fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 10px; }
.q > label { display: block; margin-bottom: 8px; }
.q-label { font-size: 16px; font-weight: 600; line-height: 1.35; }
.tag { margin-left: 8px; font-size: 13px; font-weight: 500; color: var(--ink-soft); white-space: nowrap; }
.hint { margin: -2px 0 10px; font-size: 15px; line-height: 1.45; color: var(--ink-soft); max-width: 60ch; }

input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="date"], select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  background: var(--chalk);
  color: var(--ink);
  font: 400 17px/1.4 var(--sans);
}
textarea { min-height: 104px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:focus, select:focus, textarea:focus { border-color: var(--ink); background: var(--white); }
select:disabled { opacity: 0.6; }
[aria-invalid="true"] { border-color: var(--error) !important; }
.field-error { margin-top: 6px; color: var(--error); font-size: 15px; font-weight: 500; animation: note-in 0.22s var(--ease) backwards; }
@keyframes note-in { from { opacity: 0; transform: translateY(-4px); } }

/* Choice chips */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--rule-strong);
  background: var(--white);
  font-size: 16px;
  line-height: 1.3;
  cursor: pointer;
  position: relative;
  isolation: isolate;
  transition: border-color 0.2s var(--ease);
}
/* A chosen chip fills with sage from the bottom. */
.choice::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--sage-2);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.12s ease-in;
}
.choice:hover { border-color: var(--ink); }
.choice:has(input:checked) { border-color: var(--ink); font-weight: 500; }
.choice:has(input:checked)::before { transform: scaleY(1); transition: transform 0.28s var(--ease); }
.choice:has(input:focus-visible), .tier:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Tier tiles: one sage hue in three steps (The One Strip Rule). */
.choices--tiers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter); }
.tier {
  display: flex;
  flex-direction: column;
  padding-bottom: 14px;
  border: 1px solid var(--rule-strong);
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.2s var(--ease);
}
.tier:hover { border-color: var(--ink); }
.tier-swatch { display: block; height: 52px; }
.tier-swatch--single { background: var(--sage-1); }
.tier-swatch--business { background: var(--sage-2); }
.tier-swatch--custom { background: var(--sage-3); }
.tier-swatch--unsure { background: var(--mist); }
.tier-name { padding: 12px 14px 0; font-size: 18px; font-weight: 600; line-height: 1.25; }
.tier-note { padding: 2px 14px 0; font-size: 14px; font-weight: 500; line-height: 1.35; color: var(--ink-soft); }
.tier:has(input:checked) { border-color: var(--ink); outline: 1px solid var(--ink); outline-offset: -2px; }
/* The check mark draws itself when the tier is chosen. */
.tier-check { display: inline-block; width: 16px; height: 16px; margin-left: 7px; vertical-align: -1px; overflow: visible; }
.tier-check path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: square;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  transition: stroke-dashoffset 0.12s ease-in, opacity 0s linear 0.12s;
}
.tier:has(input:checked) .tier-check path {
  stroke-dashoffset: 0;
  opacity: 1;
  transition: stroke-dashoffset 0.38s var(--ease) 0.05s, opacity 0s linear 0.05s;
}

.count { margin-top: 10px; font-size: 15px; color: var(--ink-soft); }
.count:empty { display: none; }
.count--over { color: var(--ink); font-weight: 500; }
.clear { margin-top: 10px; }

/* Sliders */
.slider {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, 1.6fr) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding-block: 8px;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
  font-weight: 500;
}
.slider:last-child { border-bottom: 0; }
.slider-r { text-align: right; }
.slider input { width: 100%; accent-color: var(--harbour); }

/* Colours */
.colours { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.colours:empty { display: none; }
.colour { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.colour--new { animation: colour-in 0.3s var(--ease) backwards; }
@keyframes colour-in {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
.colour input[type="color"] { width: 48px; height: 48px; padding: 3px; border: 1px solid var(--rule-strong); background: var(--white); cursor: pointer; }
.colour select { width: auto; }

.btn-small {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: 600 15px/1 var(--sans);
  cursor: pointer;
}
.btn-small:hover { background: var(--wash); }
.btn-small:disabled { opacity: 0.45; cursor: default; }
.btn-small.is-done { background: var(--sage-1); }

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: 500 15px/1.4 var(--sans);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.link-btn:hover { color: var(--ink); text-decoration-thickness: 2px; }

/* Outline buttons that are <button> elements: no browser default fill.
   (styles.css styles them as links, which have no fill.) Hover stays as in styles.css. */
.btn--line, .btn--line-light { background: transparent; }

.nav-row { display: flex; justify-content: space-between; gap: 12px; margin-top: var(--gutter); }
.nav-row .btn { cursor: pointer; }
.nav-row .btn:disabled { opacity: 0.35; cursor: default; }
.form-error { margin-top: var(--gutter); padding: 12px 16px; border-left: 3px solid var(--error); background: var(--white); color: var(--error); font-weight: 500; animation: note-in 0.22s var(--ease) backwards; }
.turnstile { margin-top: 12px; }
.turnstile:empty { display: none; }

/* ---------- Side ---------- */

.side-field { background: var(--mist); padding: 20px; gap: 10px; }
.side-progress { font-size: 16px; font-weight: 600; }
/* Seven segments, one for each step, with the chip gap between them.
   A started step's segment fills from the left. */
.bar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; height: 6px; }
.bar i { position: relative; overflow: hidden; background: var(--white); }
.bar i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--harbour);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.14s ease-in;
}
.bar i.is-on::after { transform: scaleX(1); transition: transform 0.45s var(--ease); }

/* The save line: a 7px square (as in the home page start facts) shows the state.
   It pulses only while a save runs, and settles solid when the save is done. */
.save { display: flex; align-items: flex-start; gap: 9px; font-size: 15px; color: var(--ink-soft); }
.save-dot {
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: calc(0.8em - 3.5px);
  background: var(--sage-3);
  transition: background-color 0.25s var(--ease);
}
.save[data-state="saving"] .save-dot { background: var(--sage-2); animation: save-pulse 0.9s ease-in-out infinite alternate; }
.save[data-state="saved"] .save-dot,
.save[data-state="sent"] .save-dot { background: var(--harbour); }
.save[data-state="error"] .save-dot { background: var(--error); }
@keyframes save-pulse { to { opacity: 0.3; } }
.link-box { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.link-box label { font-size: 14px; font-weight: 600; }
.link-row { display: flex; gap: 8px; }
.link-row input { min-height: 40px; font-size: 14px; background: var(--white); }
.link-box .hint { margin: 0; font-size: 14px; }
#saveLater { align-self: flex-start; margin-top: 2px; }

/* The private link arrives once: it wipes down, and the link takes a short sage wash. */
.link-box--new { animation: link-in 0.4s var(--ease) backwards; }
.link-box--new input { animation: link-wash 1.6s ease-out 0.25s backwards; }
@keyframes link-in {
  from { clip-path: inset(0 0 100% 0); opacity: 0; }
  to { clip-path: inset(0 0 0 0); opacity: 1; }
}
@keyframes link-wash { from { background-color: var(--sage-1); } }

.summary { margin-top: var(--gutter); background: var(--white); }
.summary > summary { padding: 14px 20px; font-size: 16px; font-weight: 600; cursor: pointer; }
#summary { padding: 0 20px 20px; }
.sum-step + .sum-step { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule); }
.sum-step h3 { font-size: 15px; font-weight: 600; }
.sum-step dl { margin: 6px 0 0; }
.sum-step dt { margin-top: 8px; font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.sum-step dd { margin: 2px 0 0; font-size: 15px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.sum-empty { margin-top: 4px; font-size: 14px; color: var(--ink-soft); }

/* ---------- Sent ---------- */

.sent { display: flex; flex-direction: column; background: var(--harbour); color: var(--on-harbour); }
.sent:focus { outline: none; }
.sent-field { padding: clamp(28px, 4.4vw, 64px); }
.sent-lead { margin-top: 16px; max-width: 40ch; font-size: clamp(18px, 1.45vw, 21px); line-height: 1.5; color: var(--on-harbour-soft); }
.sent .actions { margin-top: 32px; }
.sent .btn { cursor: pointer; }
.sent .label { background: var(--white); }
.sent :focus-visible { outline-color: var(--on-harbour); }

/* The client's own colours, as a small paint chip card. */
.sent-colours { margin-top: 28px; }
.sent-colours-label { font-size: 14px; font-weight: 500; line-height: 1.35; color: var(--on-harbour-soft); }
.sent-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px;
  max-width: 560px;
  margin-top: 10px;
}
.sent-chip { display: flex; flex-direction: column; min-width: 0; background: var(--white); }
.sent-swatch { display: block; height: 64px; outline: 1px solid rgb(242 244 239 / 0.25); outline-offset: -1px; }
.sent-chip-name {
  padding: 6px 8px 7px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The sent moment. The chip fills up from its label band, like the close chip
   of the home page. Then the words settle, and the colour chips lay down. */
.sent.is-arriving { animation: fill-up 0.8s var(--ease) backwards; }
.sent.is-arriving .sent-field > * { animation: sent-rise 0.6s var(--ease) backwards; }
.sent.is-arriving .sent-field > :nth-child(1) { animation-delay: 0.22s; }
.sent.is-arriving .sent-field > :nth-child(2) { animation-delay: 0.3s; }
.sent.is-arriving .sent-field > :nth-child(3) { animation-delay: 0.38s; }
.sent.is-arriving .sent-field > :nth-child(4) { animation-delay: 0.46s; }
.sent.is-arriving .sent-chip { animation: fill-up 0.45s var(--ease) backwards; animation-delay: calc(0.5s + var(--i, 0) * 0.05s); }
@keyframes fill-up {
  from { clip-path: inset(100% 0 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
@keyframes sent-rise { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .brief-main, .sent, .brief-side { grid-column: 1 / -1; }
  .brief-side { grid-row: 2; position: static; }
}

@media (max-width: 760px) {
  .app main { font-size: 17px; }
  .step-title { display: none; }
  .step-num { height: 40px; }
  .panel-fields { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .q--half { grid-column: 1 / -1; }
  .colour { grid-template-columns: 48px minmax(0, 1fr); }
  .colour select { grid-column: 1 / span 2; width: 100%; }
  .colour .btn-small { grid-column: 1 / span 2; justify-self: start; }
  .sent-colours { margin-top: 24px; }
  .sent .actions .btn { flex: 1 1 100%; }
  .slider { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 4px; }
  .slider input { grid-column: 1 / -1; grid-row: 2; }
  .nav-row .btn { flex: 1; }
}

@media (max-width: 420px) {
  .choices--tiers { grid-template-columns: minmax(0, 1fr); }
  .tier { flex-direction: row; flex-wrap: wrap; align-items: baseline; padding-bottom: 12px; }
  .tier-swatch { width: 100%; height: 14px; }
  .tier-note { padding-left: 14px; width: 100%; }
}

/* Reduced motion: styles.css stops all transitions and animations, and
   brief.js plays no motion classes. Every state still shows at once. */
@media (prefers-reduced-motion: reduce) {
  .save[data-state="saving"] .save-dot { animation: none; }
}
