/**
 * 100x Family Module - Styles
 * Family members, time together, generosity
 */

/* Container */
.family-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* Context from Roadmap (the context detail pane) */
.family-context {
  background: linear-gradient(135deg, var(--teal-light) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.family-context h3 {
  font-family: var(--font-display);
  color: var(--text-dark);
  margin: 0 0 var(--spacing-md);
  font-size: calc(1rem + var(--text-bump));
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.family-context h3 i {
  color: var(--teal-ink);
}

.family-context-item {
  padding: var(--spacing-sm) 0;
}

.family-context-item + .family-context-item {
  border-top: 1px solid var(--border-color);
  padding-top: var(--spacing-md);
  margin-top: var(--spacing-sm);
}

.family-context-label {
  font-size: calc(0.75rem + var(--text-bump));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.family-context-item p {
  margin: var(--spacing-xs) 0 0;
  color: var(--text-secondary);
  font-style: italic;
}

.family-section-description {
  color: var(--text-secondary);
  margin: 0 0 var(--spacing-md);
}

/* Guiding Questions (the rail masthead card's list) */
.family-questions-list {
  padding-left: var(--spacing-lg);
  margin: 0;
}

.family-questions-list li {
  color: var(--text-secondary);
  padding: var(--spacing-sm) 0;
  line-height: 1.6;
}

.family-questions-list li::marker {
  color: var(--teal-ink);
  font-weight: 600;
}

/* Form Groups */
.family-form-group {
  margin-bottom: var(--spacing-lg);
}

.family-form-group:last-child {
  margin-bottom: 0;
}

.family-form-group label {
  display: block;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: var(--spacing-xs);
}

.family-help-text {
  font-size: calc(0.875rem + var(--text-bump));
  color: var(--text-muted);
  margin-bottom: var(--spacing-sm);
}

/* Chat Container */
.family-chat-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 150px);
}

.family-chat-container .interview-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--spacing-md);
  flex-shrink: 0;
}

.family-chat-container .interview-title h2 {
  font-family: var(--font-display);
  margin: 0;
  color: var(--text-dark);
}

.family-chat-container .interview-title p {
  color: var(--text-secondary);
  margin: var(--spacing-xs) 0 0;
}

.family-chat-container .chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.family-chat-container .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-md);
}

.family-chat-container .chat-input-container {
  display: flex;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.family-chat-container .chat-input {
  flex: 1;
  padding: var(--spacing-sm) var(--spacing-md);
  font-family: var(--font-body);
  font-size: calc(1rem + var(--text-bump));
  color: var(--text-dark);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  resize: none;
  max-height: 100px;
}

.family-chat-container .chat-input:focus {
  border-color: var(--teal-accent);
}

.family-chat-container .send-btn {
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--teal-fill);
  color: var(--text-on-accent);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.family-chat-container .send-btn:hover {
  background: var(--navy-primary);
}

.family-chat-container .interview-actions {
  flex-shrink: 0;
  padding-top: var(--spacing-md);
}

/* ===== Module Chat (Rails parity) =====
   The original app hand-rolled a `.chat-container` inside `.family-chat-container`.
   The Rails surface wraps the shared streaming interview-chat component in
   `.family-chat-body`. The seeded opener renders as the first `.message.ai`
   bubble inside the chat (via messages/_opener), so it is identical to a
   streamed reply; this wrapper supplies the flow / scroll region the original
   `.chat-container` provided. */
.family-chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  overflow-y: auto;
}

/* Inline autosave status for rich-text fields (contract §5). */
.family-field-status {
  font-size: calc(0.8rem + var(--text-bump));
  color: var(--text-muted);
  margin-top: var(--spacing-xs);
  min-height: 1rem;
}

/* Synthesis blocked / unreadable response notice (contract §6). */
.family-synth-error {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  background: rgba(220, 53, 69, 0.08);
  border: 1px solid rgba(220, 53, 69, 0.3);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: calc(0.9rem + var(--text-bump));
}

.family-synth-error i {
  color: var(--danger);
}

/* Dark Theme */
[data-theme="dark"] .family-container,
[data-theme="dark"] .family-chat-container {
  color: var(--text-dark);
}

[data-theme="dark"] .family-context {
  background: linear-gradient(135deg, rgba(74, 155, 181, 0.1) 0%, var(--bg-secondary) 100%);
}

[data-theme="dark"] .family-chat-container .chat-container {
  background: var(--bg-secondary);
}

[data-theme="dark"] .family-chat-container .chat-input-container {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .family-chat-container .chat-input {
  background: var(--bg-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .family-chat-container {
    height: calc(100dvh - 120px);
  }
}

/* Print */
@media print {
  .family-chat-launch {
    display: none;
  }

  .family-context {
    background: #f5f5f5;
    border: 1px solid #ccc;
  }
}

/* ── Members board: the three circles in the People card grammar ─────────
   (owner, 2026-08-12). Section heads, grids, and add tails reuse the
   people-gallery classes (all module sheets load together); only the card
   itself is local — no photos and no flip, the card IS the edit trigger. */
.family-members-board {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.family-person-card {
  list-style: none;
  min-width: 0;
}

.family-person-card__open {
  width: 100%;
  aspect-ratio: 3 / 4;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.15rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-light);
  background: var(--teal-light);
  cursor: pointer;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition-fast);
}

.family-person-card__open:hover { box-shadow: var(--shadow-sm); }

.family-person-card__initials {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  font-family: var(--font-heading);
  font-size: calc(3rem + var(--text-bump));
  color: var(--teal-accent);
  opacity: 0.45;
}

.family-person-card__name {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: calc(1.05rem + var(--text-bump));
  color: var(--navy-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.family-person-card__meta {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: calc(0.7rem + var(--text-bump));
  color: var(--text-muted);
}

[data-theme="dark"] .family-person-card__open { background: rgba(72, 156, 184, 0.12); }

/* ── Per-member care grid (Member Guide pp. 86-87) ──────────────────────────
   One row per family member: biggest risk, biggest opportunity, how I will
   help, spiritual next step. Shared by the Understanding Them More Deeply
   section and the family_plan guide step. */

.family-care-grid { margin-bottom: 1.5rem; }

.family-care-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.family-care-title {
  font-family: var(--font-heading);
  font-size: calc(1rem + var(--text-bump));
  color: var(--navy-primary);
  margin: 0;
}

.family-care-group { margin-bottom: 1rem; }

.family-care-group-title {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: calc(0.7rem + var(--text-bump));
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.family-care-row {
  border: 1px solid var(--border-light, #dbe4ea);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.75rem;
  background: var(--surface, #fff);
}

.family-care-person {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.family-care-name {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--navy-primary);
}

.family-care-rel {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: calc(0.68rem + var(--text-bump));
  color: var(--text-muted);
}

.family-care-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 0.75rem;
}

@media (max-width: 640px) {
  .family-care-fields { grid-template-columns: 1fr; }
}

.family-care-field { display: block; margin: 0; }

.family-care-label {
  display: block;
  font-size: calc(0.8rem + var(--text-bump));
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.family-care-input {
  width: 100%;
  border: 1px solid var(--border-light, #cfdbe4);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  font-size: calc(0.9rem + var(--text-bump));
  font-family: var(--font-ui);
  color: var(--text-primary, #1a2b4a);
  background: var(--surface, #fff);
  resize: vertical;
}

.family-care-input:focus {
  border-color: var(--teal-accent);
  box-shadow: 0 0 0 2px rgba(74, 155, 181, 0.2);
}

.family-care-empty {
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.family-care-empty-link { color: var(--teal-accent); }

[data-theme="dark"] .family-care-row,
[data-theme="dark"] .family-care-input {
  background: rgba(72, 156, 184, 0.08);
  border-color: rgba(72, 156, 184, 0.3);
}

[data-theme="dark"] .family-care-title,
[data-theme="dark"] .family-care-name { color: var(--teal-light, #e8f4f8); }

/* == Add from People / the link chip ==================================== *
 * One record per person (docs/design/2026-08-17-one-record-per-person.md).
 * The picker is a disclosure under each circle; the chip on a card names
 * the other place that human appears. */

/* The picker is a footnote to the circle above it, not a section of its own:
   the roster section already carries 3rem beneath it, so this adds none. */
.family-link-picker {
  margin: 0.5rem 0 0;
  border-top: 1px solid var(--border-light);
  padding-top: 0.6rem;
}

/* A closed picker leaves the circle almost touching the next heading, which
   is the rhythm the board had before it existed. */
.family-roster-section .family-link-picker { margin-top: 0.75rem; }

.family-link-picker__summary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-ui);
  font-size: calc(13px * var(--text-scale, 1));
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal-ink);
  transition: color var(--transition-fast);
}

.family-link-picker__summary:hover { color: var(--text-dark); }
.family-link-picker__summary::-webkit-details-marker { display: none; }

.family-link-picker__count {
  min-width: 1.5em;
  padding: 0.1em 0.4em;
  background: var(--teal-light);
  color: var(--teal-ink);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.family-link-picker__body {
  margin-top: 0.7rem;
  padding: 1rem 1.1rem 0.9rem;
  background: var(--bg-primary);
  box-shadow: var(--shadow-sm);
}

.family-link-picker__lede {
  margin: 0 0 1rem;
  max-width: 58ch;
  color: var(--text-secondary);
  font-size: calc(14px * var(--text-scale, 1));
  line-height: 1.5;
}

.family-link-picker__group + .family-link-picker__group { margin-top: 1rem; }

.family-link-picker__group-title {
  margin: 0 0 0.35rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-light);
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* The whole row is the target, not a 13px box beside it. */
.family-link-picker__row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 40px;
  padding: 0.3rem 0.5rem;
  margin: 0 -0.5rem;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.family-link-picker__row:hover { background: var(--bg-secondary); }
.family-link-picker__row:has(:checked) { background: var(--teal-light); }

/* The default checkbox is the browser's blue, which belongs to no theme here
   and reads as a form control from another app. Square, like everything else
   (--radius-sm is 0), teal when ticked, with the app's own check glyph — the
   family is "Font Awesome 7 Sharp" at weight 300; there is no Bootstrap Icons
   font, so a bi- codepoint would render as nothing. */
.family-link-picker__row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  display: grid;
  place-content: center;
  border: 1.5px solid var(--border-medium);
  background: var(--bg-primary);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.family-link-picker__row:hover input[type="checkbox"] { border-color: var(--teal-accent); }

.family-link-picker__row input[type="checkbox"]::before {
  content: "\f00c";
  font-family: "Font Awesome 7 Sharp";
  font-weight: 900;
  font-style: normal;
  font-size: 10px;
  line-height: 1;
  color: var(--bg-primary);
  transform: scale(0);
  transition: transform var(--motion-quick) var(--ease-spring);
}

.family-link-picker__row input[type="checkbox"]:checked {
  background: var(--teal-accent);
  border-color: var(--teal-accent);
}

.family-link-picker__row input[type="checkbox"]:checked::before { transform: scale(1); }

.family-link-picker__name {
  font-family: var(--font-body);
  font-size: calc(15px * var(--text-scale, 1));
  font-weight: 500;
  color: var(--text-dark);
  line-height: 1.3;
}

.family-link-picker__meta {
  margin-left: auto;
  padding-left: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: calc(12px * var(--text-scale, 1));
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: right;
}

.family-link-picker__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border-light);
}

.family-person-card__link {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem 0.5rem;
  color: var(--text-muted);
  font-size: 12px;
}

/* The type-ahead duplicate offer, under the name field in both add-person
   dialogs. An offer, not a warning — so no alarm colour. */
.duplicate-offer {
  margin-top: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-left: 3px solid var(--teal-accent);
  background: var(--teal-light);
}

.duplicate-offer.is-linked { border-left-color: var(--status-success); }

.duplicate-offer__message {
  margin: 0 0 0.5rem;
  color: var(--text-dark);
  font-size: calc(14px * var(--text-scale, 1));
  line-height: 1.45;
}

.duplicate-offer.is-linked .duplicate-offer__actions { display: none; }

.duplicate-offer__actions { display: flex; gap: 0.4rem; }

.duplicate-offer__btn {
  min-height: 34px;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--teal-accent);
  background: transparent;
  color: var(--teal-ink);
  font-family: var(--font-body);
  font-size: calc(13px * var(--text-scale, 1));
  cursor: pointer;
}

.duplicate-offer__btn.is-primary {
  background: var(--teal-accent);
  color: var(--bg-primary);
}

/* "Choose existing" on the Name label's own line (owner, 2026-08-18): an
   alternative to typing the name, so it sits beside the name rather than in a
   block of its own. The panel drops between the label and the field. */
.person-dialog-field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.person-dialog-choose { flex: none; }

.person-dialog-choose__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-ui);
  font-size: calc(12px * var(--text-scale, 1));
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--teal-ink);
  transition: color var(--transition-fast);
}

.person-dialog-choose__link:hover { color: var(--text-dark); }
.person-dialog-choose__link::-webkit-details-marker { display: none; }

.person-dialog-choose__count {
  min-width: 1.4em;
  padding: 0.05em 0.35em;
  background: var(--teal-light);
  font-size: 11px;
  text-align: center;
}

/* Out of flow so the panel is full width under the label row rather than
   squeezed into the link's own column. */
.person-dialog-choose[open] { position: relative; }

.person-dialog-choose__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 5;
  width: min(22rem, 70vw);
  padding: 0.8rem 0.9rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
}

.person-dialog-choose__lede {
  margin: 0 0 0.7rem;
  color: var(--text-secondary);
  font-size: calc(13px * var(--text-scale, 1));
  line-height: 1.45;
}

/* The Add Person dialog's "Add from your family plan" list. Same rows as the
   pickers, but each is a button that fills the form rather than a checkbox. */
.person-dialog-from-family { margin: 0 0 1rem; }

.family-link-picker__row.is-pickable {
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
}

.family-link-picker__row.is-pickable:hover { background: var(--teal-light); }

.person-dialog-from-family.is-picked .family-link-picker__summary { color: var(--status-success); }

/* ===========================================
   Master-detail shell (the Library shell's grammar in family- names: one
   elevated viewport-fit card split into a master rail and a detail pane,
   each owning its own scroll. The rail sits a tonal step below the pane so
   the selected row's lift off its 3px teal edge reads. Rows are list
   grammar (one line, may ellipsize); the pane holds the selection whole.

   Below 900px it collapses list-first: the rail fills the screen and
   .is-detail-open (server-set for explicit ?entry= links, client-set on row
   taps) pushes the pane full-screen with a back affordance.)
   =========================================== */

.family-shell {
  display: grid;
  grid-template-columns: minmax(300px, 348px) minmax(0, 1fr);
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  /* The card fits the viewport under the sticky chrome (--chrome-height is
     published live by chrome_height_controller; the fallback covers the
     pre-JS first paint) so both panes scroll internally, app-like. */
  height: calc(100dvh - var(--chrome-height, 140px) - 3.25rem);
  min-height: 32rem;
  overflow: hidden;
  margin-block: 0.25rem 1.5rem;
}

/* Entrance: the hub's motion grammar, once per session. */
.family-shell[data-entrance="play"] > * {
  animation: motion-rise var(--motion-enter) var(--ease-out) backwards;
}

.family-shell[data-entrance="play"] > :nth-child(1) { animation-delay: 0ms; }
.family-shell[data-entrance="play"] > :nth-child(2) { animation-delay: 60ms; }

/* ── The master rail ─────────────────────────────────────────────────────── */

.family-master {
  overflow-y: auto;
  border-right: 1px solid var(--border-light);
  /* A quiet tonal step below the detail pane, so the selected row's lift
     to the card surface reads. */
  background: var(--surface-page);
}

.family-masthead {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1rem 1.05rem;
  border-bottom: 1px solid var(--border-light);
}

/* The AI chat launcher, quiet and full-width in the masthead. */
.family-chat-launch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: var(--tap);
  padding: 0.5rem 0.9rem;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: calc(13px * var(--text-scale));
  color: var(--teal-ink);
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  text-decoration: none;
  transition: background var(--motion-quick) var(--ease-out);
}

@media (hover: hover) {
  .family-chat-launch:hover {
    background: var(--teal-light);
  }
}

/* The guiding questions (contract §3) as a quiet masthead card — collapsed
   by default so eight long questions don't swamp the rail. */
.family-questions-rail {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
}

.family-questions-summary {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: var(--tap);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: calc(12px * var(--text-scale));
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: color var(--motion-quick) var(--ease-out);
}

.family-questions-summary::-webkit-details-marker { display: none; }

@media (hover: hover) {
  .family-questions-summary:hover { color: var(--teal-ink); }
}

.family-questions-rail .family-questions-list {
  padding: 0 1rem 0.9rem 2rem;
  font-size: calc(13px * var(--text-scale));
}

.family-questions-rail .family-questions-list li {
  padding: 0.3rem 0;
  line-height: 1.5;
}

/* ── Sections: quiet labels over row groups ──────────────────────────────── */

.family-index {
  padding-bottom: 1.25rem;
}

.family-rail-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.25rem 0.45rem;
}

.family-rail-section-head h2 {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: calc(12px * var(--text-scale));
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-secondary);
  margin: 0;
}

/* ── Rows ────────────────────────────────────────────────────────────────── */

.family-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.family-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 1.1rem 0.65rem 0.95rem;
  min-height: var(--tap);
  border-left: 3px solid transparent;
  text-decoration: none;
  transition: background var(--motion-quick) var(--ease-out),
              border-color var(--motion-quick) var(--ease-out);
}

@media (hover: hover) {
  a.family-row:hover:not([aria-current]) {
    background: color-mix(in srgb, var(--surface-card) 65%, transparent);
  }
}

/* The selected row lifts to the detail pane's surface off a teal edge. */
.family-row[aria-current] {
  background: var(--surface-card);
  border-left-color: var(--teal-accent);
}

.family-row-body {
  min-width: 0; /* let titles ellipsize instead of widening the rail */
}

.family-row-title {
  display: block;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: calc(14.5px * var(--text-scale));
  line-height: 1.35;
  color: var(--navy-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* One line, may ellipsize — list grammar; the pane never truncates. */
.family-row-meta {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--font-body);
  font-size: calc(12.5px * var(--text-scale));
  line-height: 1.5;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The quiet done mark on a written section. */
.family-row-done {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: calc(11.5px * var(--text-scale));
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal-ink);
  white-space: nowrap;
}

/* ── The detail pane ─────────────────────────────────────────────────────── */

.family-detail {
  overflow-y: auto;
  background: var(--surface-card);
}

turbo-frame#family_detail {
  display: block;
  min-height: 100%;
}

.family-pane {
  min-height: 100%;
}

.family-article {
  max-width: 960px;
  margin-inline: auto;
  padding: clamp(2rem, 5vh, 3rem) clamp(1.5rem, 4vw, 2.75rem) 4rem;
}

/* Member text in this pane's editors keeps the standard editor typography
   (var(--font-body)). Saved answers can arrive wrapped in Trix heading
   blocks (synthesized/imported statements), and the global heading rule
   (base.css h1..h6 → var(--font-heading)) was rendering them as ~21px serif
   inside the editor — actiontext.css only resets the heading's SIZE (1.2em),
   never its family. Scoped to the pane's editors only. */
.family-pane trix-editor.trix-content :is(h1, h2, h3, h4, h5, h6) {
  font-family: var(--font-body);
  font-size: inherit;
  line-height: inherit;
}

.family-detail-head {
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 1.9rem;
}

.family-detail-heading {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: calc(26px * var(--text-scale));
  line-height: 1.32;
  color: var(--navy-primary);
  margin: 0;
  text-wrap: balance;
}

.family-detail-heading i {
  color: var(--teal-ink);
  font-size: 0.8em;
  margin-right: 0.2em;
}

.family-eyebrow {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: calc(12px * var(--text-scale));
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 0.6rem;
}

.family-detail-head .family-section-description {
  margin: 0.6rem 0 0;
  color: var(--text-secondary);
  font-size: calc(0.9rem + var(--text-bump));
}

/* ── The back affordance: narrow screens only ────────────────────────────── */

.family-detail-back {
  display: none;
  align-items: center;
  gap: 0.1rem;
  min-height: var(--tap);
  padding: 0.9rem clamp(1.25rem, 5vw, 2rem) 0;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: calc(12.5px * var(--text-scale));
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal-ink);
  text-decoration: none;
}

.family-detail-back .fa-sharp {
  font-size: 1.35em;
}

/* ── Narrow: list-first, detail pushes full-screen ───────────────────────── */

@media (max-width: 899.98px) {
  .family-shell {
    display: block;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .family-master {
    border-right: 0;
    overflow: visible;
  }

  .family-detail {
    display: none;
    overflow: visible;
  }

  .family-shell.is-detail-open .family-master {
    display: none;
  }

  .family-shell.is-detail-open .family-detail {
    display: block;
  }

  .family-detail-back {
    display: inline-flex;
  }

  .family-article {
    padding-top: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .family-shell[data-entrance="play"] > * {
    animation: none;
  }
}
