/* The project home and its step rail (ACQ-IA-5). Role tokens only; the colours live in theme.css. */

.aq-home { display: grid; gap: 16px; }
.aq-home > .hx-card, .aq-home-cards > .hx-card { margin: 0; }
.aq-home-empty { padding: 40px; text-align: center; color: var(--muted); font-size: 14px; }
.aq-visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* —— The rail —— */
.aq-rail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.aq-rail-head .hx-section-label { margin: 0; }
.aq-rail { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); row-gap: 16px; }
.aq-rail-step { position: relative; min-width: 0; }
.aq-rail-step::before {
  content: ""; position: absolute; top: 16px; left: -50%; width: 100%; height: 2px;
  background: var(--line-strong); opacity: .5; z-index: 0;
}
.aq-rail-step:first-child::before { display: none; }
.aq-rail-step.is-done::before, .aq-rail-step.is-now::before { background: var(--ok); opacity: 1; }
.aq-rail-step > a {
  /* Above every connector, including the next step's, which would otherwise paint over this disc. */
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 0 4px 4px; border-radius: 8px; text-align: center; text-decoration: none; color: var(--ink);
}
.aq-rail-step > a:hover .aq-rail-disc { border-color: var(--accent); }
.aq-rail-step > a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.aq-rail-disc {
  width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; flex: none;
  font: 600 13px var(--mono); font-variant-numeric: tabular-nums;
  background: var(--surface); border: 1.5px solid var(--line-strong); color: var(--muted);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.aq-rail-disc .aq-icon { width: 16px; height: 16px; stroke-width: 2.4; }
.aq-rail-label { font-size: 12px; line-height: 1.2; font-weight: 600; hyphens: auto; overflow-wrap: break-word; }
.aq-rail-line { font-size: 11px; line-height: 1.2; color: var(--muted); hyphens: auto; overflow-wrap: break-word; }
.aq-rail-extra { color: var(--warn); }
.aq-rail-step.is-done .aq-rail-disc { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.aq-rail-step.is-imported .aq-rail-disc { background: transparent; border: 1.5px dashed var(--ok); color: var(--ok); }
.aq-rail-step.is-imported::before { background: var(--ok); opacity: .45; }
.aq-rail-imported { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.aq-rail-step.is-now .aq-rail-disc { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 4px var(--soft); }
.aq-rail-step.is-now .aq-rail-label { color: var(--accent); }
.aq-rail-step.is-block .aq-rail-disc { border-color: var(--danger); color: var(--danger); }
.aq-rail-step.is-block .aq-rail-line { color: var(--danger); }
.aq-rail-step.is-later .aq-rail-disc { border-style: dashed; }

/* Buttons on the home and the moved Build cards: the secondary carries the control edge (STYLE §6). */
:is(.aq-home, .aq-build-cards, .aq-cal) .hx-btn { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; }
:is(.aq-home, .aq-build-cards, .aq-cal) .hx-btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
:is(.aq-home, .aq-build-cards, .aq-cal) .hx-btn.secondary:hover:not(:disabled) { background: var(--surface-2); }
:is(.aq-home, .aq-build-cards, .aq-cal) .hx-btn.small { min-height: 28px; padding: 4px 10px; font-size: 12px; }

/* —— Next and blocking —— */
.aq-next-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 16px; align-items: center; border-left: 3px solid var(--accent); }
.aq-next-card.is-clear { border-left-color: var(--ok); }
.aq-next-body .hx-section-label { margin-bottom: 4px; }
.aq-next-what { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; }
.aq-next-why { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.aq-next-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.aq-next-go { text-decoration: none; display: inline-flex; align-items: center; }
.hx-btn.quiet { background: transparent; border-color: transparent; color: var(--ink); }
.hx-btn.quiet:hover:not(:disabled) { background: var(--surface-2); }
.aq-block-card { border-left: 3px solid var(--danger); }
.aq-block-card .hx-section-label { margin-bottom: 4px; }
.aq-block-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.aq-block-row p { margin: 0; font-size: 14px; flex: 1 1 320px; }
.aq-block-row .hx-btn, .aq-card-actions .hx-btn, .aq-step-actions .hx-btn, .aq-build-links .hx-btn { text-decoration: none; }

/* —— Override note (Mark done / Skip) —— */
.aq-override-form { grid-column: 1 / -1; display: grid; gap: 8px; max-width: 640px; margin-top: 4px; }
.aq-override-form label { font-size: 12px; font-weight: 600; }
.aq-override-form textarea { width: 100%; min-height: 56px; }
.aq-override-hint { margin: 0; font-size: 12px; color: var(--muted); }
.aq-override-error { margin: 0; font-size: 12px; color: var(--danger); }
.aq-override-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* —— Status cards —— */
.aq-home-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.aq-home-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.aq-card-title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.2; }
.aq-card-line { margin: 0; }
.aq-card-note { margin: 0; font-size: 13px; color: var(--muted); }
.aq-card-link { font-size: 13px; color: var(--accent); }
.aq-card-actions, .aq-step-actions, .aq-build-links { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.aq-card-actions { margin-top: auto; padding-top: 4px; }
.aq-latest { display: flex; flex-direction: column; flex: 1; }
.aq-ask-row { display: flex; gap: 8px; }
.aq-ask-row .hx-input { flex: 1; min-width: 0; height: 32px; }
.aq-ask-answer { border-top: 1px solid var(--line); padding-top: 8px; font-size: 14px; display: grid; gap: 4px; }
.aq-ask-answer p { margin: 0; white-space: pre-wrap; }

/* —— Step notes —— */
.aq-home-notes .aq-card-title { margin-bottom: 8px; }
.aq-note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.aq-note-list li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; font-size: 13px; }
.aq-note-step { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.aq-note-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* —— The path, step by step: the outline folded under the rail —— */
.aq-home-outline { display: grid; gap: 8px; }
.aq-outline-title { margin: 8px 0 0; font-size: 18px; font-weight: 600; }
.aq-path-group { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; scroll-margin-top: calc(var(--bar-h) + 16px); }
.aq-path-group > summary {
  display: grid; grid-template-columns: 28px minmax(0, auto) minmax(0, 1fr) auto; gap: 12px; align-items: center;
  min-height: 44px; padding: 8px 16px; cursor: pointer; list-style: none; border-radius: 10px;
}
.aq-path-group > summary::-webkit-details-marker { display: none; }
.aq-path-group > summary:hover { background: var(--surface-2); }
.aq-path-group > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.aq-path-num {
  width: 24px; height: 24px; border-radius: 999px; display: grid; place-items: center;
  font: 600 12px var(--mono); border: 1.5px solid var(--line-strong); color: var(--muted);
}
.aq-path-group.is-done .aq-path-num { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.aq-path-group.is-blocked .aq-path-num { border-color: var(--danger); color: var(--danger); }
.aq-path-group.is-later .aq-path-num { border-style: dashed; }
.aq-path-label { font-size: 14px; font-weight: 600; }
.aq-path-line { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aq-path-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.aq-path-body { padding: 0 16px 16px; display: grid; gap: 12px; }
.aq-path-table { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.aq-path-table .hx-kb-table { margin: 0; }
/* The outline rows' actions (Mark reviewed, Notes, Discuss) never touch. */
.aq-path-table td .hx-btn { margin: 0 8px 8px 0; }
.aq-step-head { display: grid; gap: 8px; }
.aq-step-head p { margin: 0; font-size: 14px; }
.aq-step-state { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.aq-step-block { color: var(--danger); }
.aq-step-unbuilt { color: var(--muted); }
.aq-plan-more { padding: 0; }
.aq-plan-more > summary { padding: 12px 16px; cursor: pointer; font-size: 14px; font-weight: 600; }
.aq-plan-more-body { padding: 0 16px 16px; }

/* —— Cards moved off Overview —— */
/* Expected budget step (ACQ-IA-8). Reading width; the empty lines sit inside the cards. */
.aq-budget { max-width: 760px; padding: 24px; }
@media (max-width: 768px) {
  .aq-budget { padding: 16px; }
}
.aq-budget h1 { margin: 0; font-size: 22px; font-weight: 600; line-height: 1.2; }
.aq-budget-lead, .aq-budget-note { margin: 8px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.aq-budget .hx-section-label { margin: 0; }
.aq-budget .aq-home-empty { margin: 0; padding: 40px 16px; }

.aq-build-cards { display: grid; gap: 12px; margin-bottom: 16px; }
.aq-gate-card { margin-bottom: 16px; }

@media (max-width: 1100px) {
  .aq-home-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .aq-ask-card { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .aq-rail { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  /* The connector starts again at the head of the second row. */
  .aq-rail-step:nth-child(6n + 1)::before { display: none; }
  .aq-next-card { grid-template-columns: minmax(0, 1fr); }
  .aq-next-actions { justify-content: flex-start; }
  .aq-home-cards { grid-template-columns: minmax(0, 1fr); }
  .aq-path-group > summary { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .aq-path-line { grid-column: 2 / -1; grid-row: 2; white-space: normal; }
}

@media (max-width: 640px) {
  .aq-rail-card { padding: 16px 12px; }
  .aq-rail-step > a { padding: 0 0 4px; }
  .aq-rail-label { font-size: 11px; }
  .aq-next-actions .hx-btn { flex: 1 1 auto; justify-content: center; }
  .aq-note-list li { grid-template-columns: 24px minmax(0, 1fr); }
  .aq-note-meta { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .aq-rail-disc { transition: none; }
}

/* —— The Calibrate step (ACQ-IA-12): the button card and the setup area —— */
.aq-cal { display: grid; gap: 16px; max-width: 1280px; }
.aq-cal .hx-btn { text-decoration: none; }
.aq-cal-card { border-left: 3px solid var(--accent); }
.aq-cal-card[data-ready="no"] { border-left-color: var(--warn); }
.aq-cal-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 16px; align-items: center; }
.aq-cal-what .hx-section-label { margin-bottom: 4px; }
.aq-cal-line { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; }
.aq-cal-actions { display: flex; gap: 8px; align-items: center; }
.aq-cal-setup { display: grid; gap: 12px; scroll-margin-top: calc(var(--bar-h) + 16px); }
.aq-cal-title { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.2; }
.aq-cal-intro, .aq-cal-coming { margin: 0; font-size: 14px; line-height: 1.45; max-width: 760px; }
.aq-cal-coming { color: var(--muted); }
.aq-cal-parts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.aq-cal-parts li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; padding: 12px 16px; background: var(--surface-2); border-radius: 10px; }
.aq-cal-parts h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; line-height: 1.2; }
.aq-cal-parts p { margin: 0; font-size: 13px; line-height: 1.45; }
.aq-cal-num {
  width: 24px; height: 24px; border-radius: 999px; display: grid; place-items: center;
  font: 600 12px var(--mono); border: 1.5px solid var(--line-strong); color: var(--ink);
}
.aq-cal-links { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 768px) {
  .aq-cal-head { grid-template-columns: minmax(0, 1fr); }
  .aq-cal-parts { grid-template-columns: minmax(0, 1fr); }
  .aq-cal-actions .hx-btn { flex: 1 1 auto; }
}
