/* Brief page — builds on ../lab/_shared/lab.css tokens (colours, fonts, radii). */

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 60;
  background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: var(--radius-sm);
  font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
.brief-wrap { max-width: 720px; padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
.brief-header .lead { color: var(--muted); }

.brief { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

/* ---------- draft note ---------- */
.draft-note {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: space-between;
  font-size: 14px; color: var(--muted);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--surface);
}
.draft-note[hidden] { display: none; }
.link-btn {
  background: none; border: 0; padding: 6px 2px; cursor: pointer; color: var(--text);
  font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
}
.link-btn:hover { text-decoration-color: var(--text); }

/* ---------- progress ---------- */
.progress-row { display: flex; align-items: center; gap: 14px; }
.progress-row[hidden] { display: none; }
.progress-label { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar { flex: 1; height: 4px; border-radius: 4px; background: var(--line-strong); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--text); border-radius: 4px; transition: width .3s ease; }

/* ---------- card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(18px, 4vw, 32px);
}
.card[hidden] { display: none; }

.step h2, .result h2 {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em;
  font-size: clamp(20px, 3.2vw, 28px); line-height: 1.15; margin: 0 0 8px;
}
.step h2:focus, .result h2:focus { outline: none; }
.step h2:focus-visible, .result h2:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; border-radius: 4px; }
.sub { color: var(--muted); margin: 0 0 20px; font-size: 15px; }
.step .sub:empty { display: none; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong);
  font-size: 15px; font-weight: 500; line-height: 1.25; text-align: left;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: rgba(255, 255, 255, 0.36); }
.chip[aria-pressed='true'] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip .tick {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 1.5px solid currentColor; opacity: .55; display: grid; place-items: center;
}
.chip[aria-pressed='true'] .tick { opacity: 1; background: var(--accent-ink); border-color: var(--accent-ink); }
.chip[aria-pressed='true'] .tick::after {
  content: ''; width: 7px; height: 4px; border-left: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent);
  transform: translateY(-1px) rotate(-45deg);
}
.chip.other { border-style: dashed; }
.chip.other[aria-pressed='true'] { border-style: solid; }
.chip:focus-visible, .brief .btn:focus-visible, .link-btn:focus-visible, .channel:focus-visible {
  outline: 2px solid var(--text); outline-offset: 3px;
}

/* ---------- fields ---------- */
.field-block { display: grid; gap: 6px; margin-top: 16px; }
.field-block[hidden] { display: none; }
.field-block label { font-size: 14px; font-weight: 600; }
.field-block .hint { margin: 0; }
.tf {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--text);
  font: inherit; font-size: 16px; /* 16px stops iOS zoom on focus */ line-height: 1.45;
}
textarea.tf { resize: vertical; min-height: 120px; }
.tf::placeholder { color: var(--muted); opacity: 1; }
.tf:focus { outline: 2px solid var(--text); outline-offset: 1px; border-color: transparent; }
.tf[aria-invalid='true'] { border-color: var(--warn); }

.error { color: var(--warn); font-size: 14px; margin: 14px 0 0; min-height: 0; }
.error:empty { display: none; }

/* ---------- step nav ---------- */
.nav { display: flex; gap: 10px; justify-content: space-between; margin-top: 24px; }
.nav .btn { min-height: 48px; padding: 0 22px; font-size: 15px; }
.nav #nextBtn { margin-left: auto; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn[hidden] { display: none; }

/* ---------- result ---------- */
.brief-text {
  width: 100%; min-height: 240px; resize: none; margin-top: 4px; overflow: hidden;
  padding: 16px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--bg); color: var(--text);
  font-family: var(--font-ui); font-size: 16px; line-height: 1.55;
}
.brief-text:focus { outline: 2px solid var(--text); outline-offset: 1px; border-color: transparent; }
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 12px; }
.copy-row .btn { min-height: 48px; padding: 0 26px; font-size: 15px; }
.copy-row .hint { color: var(--ok); }

.send-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 28px 0 10px; }
.channels { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.channel {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-2);
  text-decoration: none; font-weight: 600; font-size: 15px; color: var(--text);
  transition: border-color .15s, background .15s;
}
.channel:hover { border-color: rgba(255, 255, 255, 0.36); }
.channel svg { width: 20px; height: 20px; flex: none; }
.channel .note { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted); }
.send-hint { margin: 12px 0 0; }

.result-nav { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.result-nav .btn { min-height: 46px; }

.toast { text-align: center; width: max-content; }

@media (max-width: 640px) {
  .card { border-radius: 14px; }
  .chip { font-size: 15px; padding: 10px 14px; }
  .nav .btn { flex: 1 1 0; }
  .nav #backBtn[hidden] + #nextBtn { flex: 1 1 100%; }
  .copy-row .btn { flex: 1 1 100%; }
  .channels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .channels li:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

@media (max-width: 440px) {
  .channels { grid-template-columns: minmax(0, 1fr); }
  .brief-text { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .bar > i, .chip, .channel, .toast { transition: none; }
}
