/**
 * Entry areas — the owner's 2026-08-23 redesign of the data-entry surfaces
 * in the Platform, Family, Faith and Philanthropy modules (Claude Design
 * artboards "Family Vision and Values" / "Platform Assessment Entry").
 *
 * The idea: the field reads as part of the page — no box, just a hairline
 * under the writing line — until it holds focus, when it becomes a bordered
 * teal field and its formatting toolbar unfolds above it. The assist
 * actions ("Interview me", "Take me through it") sit under the field as
 * quiet uppercase UI-type buttons; the autosave status keeps the row's
 * right edge.
 *
 * Scope: everything here is keyed on `.entry-area`, added by
 * shared/_entry_area alongside the legacy `interview-textarea-wrapper`
 * class (which tests and has-history transcripts key on). Modules still on
 * the old chrome (People) never get `.entry-area` and are untouched.
 */

/* ── The grid: toolbar / editor / (actions | status) ──────────────────────
   shared/_rich_text_field owns the editor + status markup; display:contents
   lifts its children into this grid so the status line can share a row with
   the actions, as the artboard draws it. */
.entry-area {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.entry-area .rich-text-field {
  display: contents;
}

/* ── Toolbar: present only while the field holds focus ────────────────────
   The space is RESERVED (visibility toggles, never height): collapsing the
   row on blur moved the assist links up between a click's mousedown and
   mouseup, so "Interview me" clicks landed on nothing — for anyone with
   reduced motion, and for the test browser. A constant-height row with an
   opacity fade cannot shift anything. visibility:hidden also keeps the
   folded buttons out of the tab order and off the pointer. */
.entry-area trix-toolbar {
  grid-row: 1;
  grid-column: 1 / -1;
  margin: 0;
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--motion-quick) var(--ease-smooth),
              visibility var(--motion-quick);
}

/* Reveal on EDITOR focus, not any focus in the wrapper: focus landing on
   the assist links below must not flash the toolbar. (The :focus-within
   arm covers Trix moving focus into its own toolbar dialogs.) */
.entry-area:has(trix-editor:focus) trix-toolbar,
.entry-area trix-toolbar:focus-within {
  visibility: visible;
  opacity: 1;
}

.entry-area trix-toolbar .trix-button-row {
  overflow: hidden;
  justify-content: flex-start;
  gap: 2px;
}

/* Ghost icon buttons in a single quiet row; hairline separators between
   groups (the artboard's bold/italic · lists · undo/redo rhythm). */
.entry-area trix-toolbar .trix-button-group {
  margin: 2px 0 10px;
  border: none;
  border-radius: 0;
  overflow: visible;
  align-items: center;
}

.entry-area trix-toolbar .trix-button-group:not(:first-child) {
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--border-light);
}

.entry-area trix-toolbar .trix-button {
  width: 34px;
  height: 30px;
  border: none;
  color: var(--text-muted);
  transition: color var(--motion-quick) var(--ease-smooth),
              background var(--motion-quick) var(--ease-smooth);
}

.entry-area trix-toolbar .trix-button:not(:first-child) {
  border-left: none;
}

.entry-area trix-toolbar .trix-button:hover {
  color: var(--text-dark);
  background: var(--bg-tertiary);
}

.entry-area trix-toolbar .trix-button.trix-active {
  background: var(--teal-light);
  color: var(--teal-ink);
}

/* Trix draws its glyphs as black-SVG background images; on a dark page they
   vanish. Inverting the glyph (not the button) keeps hover/active tints. */
[data-theme="dark"] .entry-area trix-toolbar .trix-button--icon::before {
  filter: invert(1);
}

/* ── The field: quiet at rest, a teal field in focus ─────────────────────── */
.entry-area trix-editor.trix-content,
.entry-area trix-editor.trix-content.trix-compact {
  grid-row: 2;
  grid-column: 1 / -1;
  min-height: 124px;
  background: transparent;
  border: 2px solid transparent;
  border-bottom-color: var(--border-light);
  border-radius: 0;
  box-shadow: none;
  padding: 14px 0;
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: var(--leading-prose);
  color: var(--text-dark);
  transition: padding var(--motion-quick) var(--ease-smooth),
              background var(--motion-quick) var(--ease-smooth),
              border-color var(--motion-quick) var(--ease-smooth),
              box-shadow var(--motion-quick) var(--ease-smooth);
}

.entry-area trix-editor.trix-content:focus {
  /* No outline suppression here: base.css hides the UA ring on mouse focus
     and draws the token ring on :focus-visible. */
  border-color: var(--teal-accent);
  background: var(--bg-primary);
  padding: 14px 16px;
  box-shadow: var(--focus-ring);
}

.entry-area trix-editor:empty:not(:focus)::before {
  color: var(--text-muted);
  opacity: 0.55;
}

/* ── Assist actions: uppercase UI type, muted until wanted ──────────────── */
.entry-area .entry-actions {
  grid-row: 3;
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 26px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.entry-action {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: var(--tap);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  font-size: var(--size-ui);
  line-height: 1;
  color: var(--text-muted);
  transition: color var(--motion-quick) var(--ease-smooth);
}

.entry-action:hover,
.entry-action:focus-visible {
  color: var(--teal-ink);
}

/* A field whose interview already holds messages keeps its quiet mark. */
.entry-area.has-history .entry-action-interview::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--teal-accent);
  flex: none;
}

/* ── Autosave status: the row's right edge ────────────────────────────────
   State colours stay with the shared .rich-text-field .field-status rules
   (components.css); this only moves the line into the actions row. */
.entry-area .field-status {
  grid-row: 3;
  grid-column: 2;
  align-self: center;
  justify-self: end;
  margin-top: 10px;
  font-size: var(--size-sm);
  color: var(--text-muted);
  text-align: right;
}

/* ── Shared entry typography: headings, descriptions, prompts ─────────────
   .entry-heading / .entry-desc pair a field's name with its help line
   (Family's per-field labels); .entry-prompt is a follow-up question set in
   the serif voice (Platform's "Do you have enough…", Faith's reflection
   prompt, Philanthropy's section prompt). */
.entry-heading {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  font-size: var(--size-h5);
  line-height: var(--leading-tight);
  color: var(--navy-primary);
  text-wrap: balance;
}

.entry-desc {
  margin: 8px 0 14px;
  font-size: var(--size-sm);
  line-height: var(--leading-prose);
  color: var(--text-secondary);
  max-width: 44em;
  text-wrap: pretty;
}

.entry-prompt {
  display: block;
  margin: 0 0 10px;
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  font-size: var(--size-h5);
  line-height: 1.4;
  color: var(--navy-primary);
  max-width: 40em;
  text-wrap: pretty;
}

/* Sibling entries in one pane separate on a hairline, the artboard's
   44px/36px cadence scaled to the pane. */
.entry-block + .entry-block {
  border-top: 1px solid var(--border-light);
  margin-top: 2rem;
  padding-top: 2rem;
}
