/* ============================================================================
   Ask A2A — page shell, on the house identity.
   tokens.css owns every value; components.css owns the controls. This file is
   only the layout and the page-specific pieces, per DESIGN-LAW.md ("the page
   layout/shell stays per-project"). Grayscale, hairlines, zero radius,
   no shadows. Serif carries the reading; Inter carries the structure.
   ============================================================================ */

/* components.css locks the body for the companion app's fixed shell;
   this page is a scrolling document, so the lock is lifted. */
body {
  overflow: auto;
  height: auto;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}

/* ---------- sidebar ---------- */

.sidebar {
  background: var(--g0);
  border-right: 1px solid var(--g3);
  padding: var(--sp-32) var(--sp-24);
  display: flex;
  flex-direction: column;
  gap: var(--sp-32);
  /* the rail holds still while the answer column scrolls;
     the corpus stays pinned at the visible bottom */
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
}

.brand-mark {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.01em;
  color: var(--g0);
  background: var(--soft);
  padding: var(--sp-8) var(--sp-8);
  line-height: 1;
}

.brand .eyebrow {
  margin: 0 0 2px;
}

.brand h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.1;
  letter-spacing: -.01em;
  margin: 0;
  color: var(--g7);
}

.eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0;
}

/* the corpus inventory sinks to the foot of the rail; sample questions stay high */
.side-section.compact {
  margin-top: auto;
}

.side-section h2 {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--g6);
  margin: 0 0 var(--sp-12);
}

.prompt-chip {
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.4;
  color: var(--g7);
  background: var(--g0);
  border: 1px solid var(--g3);
  padding: var(--sp-8) var(--sp-12);
  margin-bottom: var(--sp-8);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}

.prompt-chip:hover {
  border-color: var(--soft);
}

.prompt-chip:disabled {
  color: var(--g4);
  cursor: default;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid var(--g2);
  padding: var(--sp-8) 0;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--g6);
}

.stat-row strong {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 13px;
  color: var(--g7);
  font-variant-numeric: tabular-nums;
}

/* ---------- main column ---------- */

.main {
  padding: var(--sp-48) var(--sp-48) var(--sp-64);
  min-width: 0;
}

.hero {
  margin-bottom: var(--sp-16);
}

.hero-lede {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: var(--sp-8) 0 0;
  max-width: 640px;
}

.hero h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -.015em;
  margin: 0;
  color: var(--g7);
  max-width: 640px;
}

.card-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--sp-12);
}

.status-pill {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}

/* ---------- question composer ---------- */

.question-card {
  background: var(--g0);
  border: 1px solid var(--g3);
  padding: var(--sp-24);
  margin-bottom: var(--sp-24);
}

.composer {
  display: flex;
  gap: var(--sp-12);
  align-items: stretch;
}

.composer .input {
  resize: vertical;
  min-height: 72px;
  font-size: 15px;
  line-height: 1.5;
}

.composer .btn {
  align-self: flex-end;
}

/* ---------- workspace ---------- */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--sp-24);
  align-items: start;
}

.answer-card {
  background: var(--g0);
  border: 1px solid var(--g3);
  padding: var(--sp-32);
}

.card-head .eyebrow {
  margin-bottom: var(--sp-8);
}

.card-head h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -.01em;
  margin: 0 0 var(--sp-16);
  color: var(--g7);
  max-width: 640px;
}

/* the reading column — serif, capped at the house measure */
.answer {
  max-width: 640px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  color: var(--g7);
}

.answer h2,
.answer h3 {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--g6);
  margin: var(--sp-24) 0 var(--sp-8);
}

.answer p {
  margin: 0 0 var(--sp-12);
}

.answer ul,
.answer ol {
  margin: 0 0 var(--sp-16);
  padding-left: var(--sp-24);
}

.answer li {
  margin: 0 0 var(--sp-8);
}

.answer li p {
  margin: 0 0 var(--sp-4);
}

.answer strong {
  font-weight: 600;
  color: var(--g7);
}

.answer em {
  font-style: italic;
}

.answer.empty {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-2);
}

/* ---------- the working indicator ---------- */

.thinking {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  color: var(--g5);
  padding: var(--sp-16) 0;
}

.thinking span {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-2);
}

.wave {
  overflow: hidden;
}

.wave-path {
  animation: wave-travel 1.4s linear infinite;
}

@keyframes wave-travel {
  to { transform: translateX(-24px); }
}

@media (prefers-reduced-motion: reduce) {
  .wave-path { animation: none; }
}

/* ---------- try next ---------- */

.next-panel {
  max-width: 640px;
  margin-top: var(--sp-24);
  padding-top: var(--sp-16);
  border-top: 1px solid var(--g2);
}

.next-panel .eyebrow {
  margin-bottom: var(--sp-12);
}

.next-list {
  display: grid;
  gap: var(--sp-8);
}

.next-question {
  width: 100%;
  text-align: left;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--g7);
  background: var(--g0);
  border: 1px solid var(--g3);
  padding: var(--sp-12);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}

.next-question:hover {
  border-color: var(--soft);
}

.next-question:disabled {
  color: var(--g4);
  cursor: wait;
}

/* ---------- source & graph trails ---------- */

.context-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-24);
}

.context-card {
  background: var(--g0);
  border: 1px solid var(--g3);
  padding: var(--sp-16);
}

.context-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--g2);
  padding-bottom: var(--sp-8);
  margin-bottom: var(--sp-12);
}

.context-head h3 {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--g6);
  margin: 0;
}

.context-head span {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.source-card {
  display: flex;
  gap: var(--sp-12);
  border-top: 1px solid var(--g2);
  padding: var(--sp-12) 0;
}

.source-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.source-index {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  padding-top: 2px;
}

.source-card strong {
  display: block;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--g7);
  margin-bottom: var(--sp-4);
}

.source-card p {
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.5;
  color: var(--g6);
  margin: 0 0 var(--sp-4);
}

.source-card small {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.graph-item {
  border-top: 1px solid var(--g2);
  padding: var(--sp-8) 0;
}

.graph-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.graph-item strong {
  display: block;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--g7);
}

.graph-item p {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-2);
  margin: 2px 0 0;
}

.muted {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-2);
  margin: 0;
}

/* ---------- narrow screens ---------- */

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--g3);
    position: static;
    height: auto;
  }
  .main {
    padding: var(--sp-24);
  }
  .hero {
    flex-direction: column;
  }
}
