/* ============================================================
   QUERY · MEMO STYLE (Direction B)
   ────────────────────────────────────────────────────────────
   Restyles the strategic-query answer panel as a strategic memo:
     · Tabular section rows with color-coded right rules
     · Roman numerals for section markers
     · Heebo tracked uppercase section labels (NO `// mono`)
     · Memo head with title + meta block (date / horizon / sources)

   ALSO restyles the composer to match:
     · Cleaner tracked-caps kickers
     · Depth segmented control (קצר / מעמיק)
     · Four-mode button row (שאלי · מאמר · סוקרטי · תרחישים)
     · After-answer action row (switch depth · convert to article · PDF · Word)

   ALSO adds:
     · .article-memo block for the 560-word narrative mode
   ============================================================ */

/* ────────────────────────────────────────────────────────────
   COMPOSER · refresh
   ──────────────────────────────────────────────────────────── */

/* Replace `// mono` page-kicker styling on query tab with tracked-caps Heebo */
.query-tab-head {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--slate-1);
}
.query-tab-head h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  margin: 0;
  letter-spacing: -0.015em;
  color: var(--ivory);
}
.query-tab-head .eyebrow {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ivory-dim);
  margin-bottom: 8px;
}
.query-tab-head .lede {
  margin: 10px 0 0;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ivory-dim);
  max-width: 720px;
  text-wrap: pretty;
}

/* Composer field labels: replace `// mono` with tracked caps */
.field-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ivory-dim);
  margin-bottom: 8px;
  display: block;
}

/* ── Depth segmented control ── */
.depth-segmented {
  display: inline-flex;
  background: var(--bg-0);
  border: 1px solid var(--slate-1);
  border-radius: 3px;
  padding: 3px;
  gap: 2px;
}
.depth-segmented button {
  background: transparent;
  border: none;
  color: var(--ivory-dim);
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: 2px;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 120ms, color 120ms;
}
.depth-segmented button:hover { color: var(--ivory); }
.depth-segmented button.is-active {
  background: var(--teal);
  color: var(--bg-0);
  font-weight: 600;
}
.depth-segmented .depth-note {
  display: inline-block;
  font-size: 11px;
  color: var(--slate-3);
  padding: 8px 6px 8px 12px;
  align-self: center;
}

/* New action row layout: depth picker on the right, mode buttons on the left */
.query-action-row {
  margin-top: 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
@media (max-width: 720px) {
  .query-action-row { grid-template-columns: 1fr; }
}
.query-action-row .modes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Override the existing button styling for cleaner mode-row */
.query-submit-primary {
  background: var(--teal);
  color: var(--bg-0);
  border: none;
  border-radius: 3px;
  padding: 9px 18px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: filter 120ms;
}
.query-submit-primary:hover { filter: brightness(1.08); }

.query-submit-secondary {
  background: transparent;
  color: var(--ivory);
  border: 1px solid var(--slate-2);
  padding: 8px 16px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 140ms, color 140ms, background 140ms;
}
.query-submit-secondary:hover {
  border-color: var(--ivory-dim);
  color: var(--ivory);
  background: rgba(255,255,255,0.03);
}
.query-submit-secondary.is-article:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(198, 154, 69, 0.05);
}
.query-submit-secondary.is-socratic:hover {
  border-color: var(--rose);
  color: var(--rose);
  background: rgba(224, 115, 140, 0.05);
}
.query-submit-secondary.is-futures:hover {
  border-color: var(--purple);
  color: var(--purple);
  background: rgba(167, 139, 250, 0.05);
}

/* Stage text becomes a quieter inline indicator */
#q-stage {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--ivory-dim);
  letter-spacing: 0.02em;
}
#q-stage::before { content: ""; }

/* ────────────────────────────────────────────────────────────
   MEMO ANSWER BLOCK
   ──────────────────────────────────────────────────────────── */
.memo-block {
  background: var(--bg-1);
  border: 1px solid var(--slate-1);
  border-radius: 4px;
  padding: 0;
  overflow: hidden;
}

.memo-block .memo-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 24px;
  padding: 22px 28px 18px;
  border-bottom: 2px solid var(--ivory);
}
.memo-block .memo-doctype {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ivory-dim);
  margin-bottom: 6px;
}
.memo-block .memo-question {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ivory);
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}
.memo-block .memo-meta {
  text-align: left;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ivory-dim);
  line-height: 1.9;
  white-space: nowrap;
}
.memo-block .memo-meta .meta-key   { color: var(--slate-3); }
.memo-block .memo-meta .meta-val   { color: var(--ivory); margin-right: 6px; }
.memo-block .memo-meta .meta-depth { color: var(--teal); }

/* Section row */
.memo-block .memo-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 28px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--slate-1);
}
.memo-block .memo-row:last-of-type { border-bottom: none; }

.memo-block .row-marker {
  position: relative;
  padding-right: 16px;
  border-right: 2px solid var(--slate-2);
}
.memo-block .memo-row.kind-recommendation .row-marker { border-right-color: var(--gold); }
.memo-block .memo-row.kind-risk           .row-marker { border-right-color: var(--rose); }
.memo-block .memo-row.kind-frames         .row-marker { border-right-color: var(--purple); }
.memo-block .memo-row.kind-layers         .row-marker { border-right-color: var(--teal); }
.memo-block .memo-row.kind-indicators     .row-marker { border-right-color: var(--blue); }
.memo-block .memo-row.kind-primary        .row-marker { border-right-color: var(--ivory-dim); }

.memo-block .row-numeral {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 26px;
  color: var(--ivory-dim);
  line-height: 1;
}

.memo-block .row-content h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ivory);
  margin: 0 0 12px;
}
.memo-block .row-content p {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ivory);
  max-width: 680px;
  text-wrap: pretty;
}
.memo-block .row-content p:last-child { margin-bottom: 0; }

.memo-block .row-content .lead-p {
  font-size: 16.5px;
  line-height: 1.65;
}

/* Layered list inside the layers row */
.memo-block dl.layer-list {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 24px;
  margin: 0;
  padding: 0;
}
.memo-block dl.layer-list dt {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ivory-dim);
  padding-top: 3px;
}
.memo-block dl.layer-list dd {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ivory);
  text-wrap: pretty;
}

/* Indicators row uses bullets that look like dotted ticks */
.memo-block ul.memo-indicators {
  list-style: none;
  margin: 0;
  padding: 0;
}
.memo-block ul.memo-indicators li {
  position: relative;
  padding-right: 22px;
  margin-bottom: 8px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ivory);
  text-wrap: pretty;
}
.memo-block ul.memo-indicators li::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0.7em;
  width: 12px;
  height: 1px;
  background: var(--blue);
}

/* Recommendation row gets a soft gold gutter inside */
.memo-block .memo-row.kind-recommendation .row-content {
  padding: 16px 20px;
  background: rgba(198, 154, 69, 0.06);
  border-right: 2px solid var(--gold);
  border-radius: 2px;
  margin-right: -4px;
}
.memo-block .memo-row.kind-recommendation .row-content p {
  font-size: 16px;
  font-weight: 500;
}

/* Frames chip row */
.memo-frame-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 12px;
}
.memo-frame-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--purple);
  border-radius: 2px;
  font-size: 12.5px;
  color: var(--ivory);
  background: rgba(167, 139, 250, 0.04);
}
.memo-frame-chip .glyph { color: var(--purple); font-size: 14px; line-height: 1; }
.memo-frame-chip .he    { color: var(--ivory-dim); margin-right: 4px; font-size: 11.5px; }

/* Inline citation pill — Memo flavor (more subtle) */
.memo-block .cite-chip,
.memo-block a.cite-chip {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 500;
  padding: 1px 7px;
  margin: 0 2px;
  border-radius: 999px;
  background: rgba(94, 234, 212, 0.08);
  color: var(--teal);
  border: none;
  text-decoration: none;
  vertical-align: baseline;
  transition: background 120ms;
}
.memo-block .cite-chip:hover { background: rgba(94, 234, 212, 0.16); }

/* Sources table at the bottom of the memo */
.memo-block .memo-sources {
  padding: 18px 28px 22px;
  border-top: 2px solid var(--ivory);
}
.memo-block .memo-sources-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ivory-dim);
  margin-bottom: 14px;
}
.memo-block .memo-source-row {
  display: grid;
  grid-template-columns: 40px 1fr 200px;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px solid var(--slate-1);
  font-size: 13.5px;
  align-items: baseline;
}
.memo-block .memo-source-row:last-child { border-bottom: none; }
.memo-block .memo-source-row .src-num {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--teal);
}
.memo-block .memo-source-row .src-title { color: var(--ivory); }
.memo-block .memo-source-row .src-summary {
  display: block;
  font-size: 12px;
  color: var(--ivory-dim);
  margin-top: 2px;
  line-height: 1.55;
  text-wrap: pretty;
}
.memo-block .memo-source-row .src-layers {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ivory-dim);
  text-align: left;
}

/* ────────────────────────────────────────────────────────────
   AFTER-ANSWER ACTION ROW
   ──────────────────────────────────────────────────────────── */
.memo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 16px 28px;
  border-top: 1px solid var(--slate-1);
  background: rgba(255,255,255,0.015);
}
.memo-actions .group {
  display: flex; gap: 8px; align-items: center;
}
.memo-actions .group-sep {
  width: 1px;
  height: 22px;
  background: var(--slate-1);
  margin: 0 6px;
}
.memo-actions .group-label {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--slate-3);
  margin-left: 4px;
}
.memo-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  color: var(--ivory);
  border: 1px solid var(--slate-2);
  padding: 7px 13px;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 140ms, color 140ms, background 140ms;
}
.memo-action-btn .ic {
  font-size: 13px;
  line-height: 1;
  opacity: 0.85;
}
.memo-action-btn:hover {
  border-color: var(--ivory-dim);
  background: rgba(255,255,255,0.03);
}
.memo-action-btn.is-primary {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(198, 154, 69, 0.05);
}
.memo-action-btn.is-primary:hover {
  background: rgba(198, 154, 69, 0.12);
}
.memo-action-btn:disabled {
  opacity: 0.4; cursor: wait;
}

/* ────────────────────────────────────────────────────────────
   ARTICLE MEMO — 560-word narrative
   ──────────────────────────────────────────────────────────── */
.article-memo {
  background: var(--bg-1);
  border: 1px solid var(--slate-1);
  border-radius: 4px;
  overflow: hidden;
}
.article-memo .article-head {
  padding: 24px 32px 18px;
  border-bottom: 2px solid var(--ivory);
}
.article-memo .article-doctype {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.article-memo .article-doctype::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to left, transparent, var(--slate-1));
}

.article-memo .article-headline {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--ivory);
  margin: 0 0 14px;
  text-wrap: balance;
}
.article-memo .article-standfirst {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ivory-dim);
  margin: 0 0 6px;
  text-wrap: pretty;
  max-width: 720px;
}

.article-memo .article-body {
  padding: 26px 32px 18px;
  font-family: var(--font-display);
  font-size: 16.5px;
  line-height: 1.85;
  color: var(--ivory);
  max-width: 760px;
}
.article-memo .article-body p {
  margin: 0 0 18px;
  text-wrap: pretty;
}
.article-memo .article-body .lede {
  font-size: 17.5px;
  line-height: 1.75;
  color: var(--ivory);
}
.article-memo .article-body sup.cite {
  font-family: var(--font-display);
  font-size: 0.7em;
  color: var(--gold);
  font-weight: 500;
  cursor: pointer;
  margin: 0 1px;
}
.article-memo .article-byline {
  margin: 18px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--slate-1);
  font-family: var(--font-display);
  font-size: 13.5px;
  color: var(--ivory-dim);
}

.article-memo .article-sources {
  padding: 20px 32px 24px;
  border-top: 2px solid var(--ivory);
}
.article-memo .article-sources-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ivory-dim);
  margin-bottom: 12px;
}
.article-memo .article-source {
  font-size: 13px;
  line-height: 1.65;
  color: var(--ivory-dim);
  padding: 6px 0;
  border-bottom: 1px dashed var(--slate-1);
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
}
.article-memo .article-source:last-child { border-bottom: none; }
.article-memo .article-source .num {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 12.5px;
}
.article-memo .article-source .title { color: var(--ivory); }

.article-memo .memo-actions {
  background: rgba(198, 154, 69, 0.04);
}

/* Word count badge at top-right of article body */
.article-memo .article-wordcount {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 2px;
  background: rgba(94, 234, 212, 0.08);
  color: var(--teal);
  margin-bottom: 14px;
}

/* ────────────────────────────────────────────────────────────
   SCROLL-DOWN COMPOSER LABEL CLEANUP
   Remove the `// ` mono-prefix decorations the old composer used.
   We hide the inline mono notes that are now redundant.
   ──────────────────────────────────────────────────────────── */
.query-composer .legacy-mono-note { display: none; }

/* History sidebar — mode chips for new modes */
.history-mode-article  { color: var(--gold); }

/* Tab-level kicker (page header) — keep but tone down (was `// query · …`) */
.query-tab-head .eyebrow.is-meta {
  font-family: var(--font-display);
  font-size: 10.5px;
}
