/* 42-record-sheet.css — v42.44
   One skeleton, two reflow points. Below 560px this is the phone layout from
   the wireframes; above it the facts and the image sit side by side and the
   prose caps its measure. The sheet itself caps at 620px and centres, so a
   wide monitor never stretches a line of notes across the screen, and buttons
   never grow to fill — they keep their width and wrap. */

.record-sheet {
  display: grid;
  gap: 13px;
  max-width: 620px;
  margin-inline: auto;
}

/* 1 — identity */
.rs-identity { display: flex; gap: 12px; align-items: center; }
.rs-thumb {
  width: 56px; height: 56px; flex: 0 0 auto; padding: 0;
  border-radius: 12px; overflow: hidden;
  border: 1px solid rgba(120, 92, 43, .34); background: rgba(120, 92, 43, .10);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #6e5b40;
}
.rs-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
button.rs-thumb { cursor: pointer; }
.rs-identity-body { display: grid; gap: 7px; min-width: 0; }
.rs-name {
  margin: 0; font-size: var(--t2); font-weight: var(--fw-head); line-height: 1.2;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
/* The name lives in the sheet header; this copy is for structure and screen
   readers only, so a record never shows its title twice. */
.rs-name-quiet {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.rs-secret {
  padding: 3px 9px; border-radius: 999px;
  background: #3f3018; color: #f1e4c4;
  font-size: .72rem; font-weight: var(--fw-emph); letter-spacing: 0;
}
.rs-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rs-chip {
  padding: 3px 10px; border-radius: 999px; font-size: var(--t0);
  border: 1px solid rgba(120, 92, 43, .34); background: rgba(120, 92, 43, .10); color: #4a3a22;
}
/* The one fact that matters most at the table: attitude, status, rarity. */
.rs-chip-lead {
  padding: 5px 13px; font-size: var(--t1); font-weight: var(--fw-emph);
  background: var(--brass); border-color: transparent; color: #1b1105;
}

/* 2 — facts */
.rs-facts {
  margin: 0; border: 1px solid rgba(120, 92, 43, .28); border-radius: 12px;
  padding: 2px 12px; background: rgba(255, 252, 240, .45);
}
.rs-fact {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid rgba(120, 92, 43, .16);
}
.rs-fact:last-child { border-bottom: 0; }
.rs-fact dt { font-size: var(--t0); color: var(--muted); }
.rs-fact dd { margin: 0; font-size: var(--t1); font-weight: var(--fw-emph); text-align: right; }
/* v42.59: the label never shrinks ("Locatio / n"); the value takes what is
   left and wraps inside it, so a long ship name can't squeeze the label. */
.rs-fact { align-items: baseline; }
.rs-fact dt { flex: 0 0 auto; white-space: nowrap; }
.rs-fact dd { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
/* A linked value is the same text as any other value — family, size and
   weight inherited from dd. Colour and the dotted underline say it's a link.
   (.ship-location-jump set the display weight, 800 against the values' 600.) */
.rs-fact dd :is(.rs-fact-link, .loc-jump, .ship-location-jump) {
  font: inherit; color: var(--lagoon-deep, #14615c); text-align: inherit;
  background: none; border: 0; padding: 0; cursor: pointer;
  /* The shared touch rule keeps this 44px tall (legacy, !important) — right
     for a finger, so it stays; the negative margin stops it heightening the row. */
  display: inline-flex; align-items: center; margin: -9px 0;
  text-decoration: underline dotted; text-underline-offset: 2px;
}
.rs-fact dd .rs-fact-note { font-weight: 400; color: var(--muted); font-size: var(--t0); }

/* 3 — media */
.rs-media {
  display: block; width: 100%; padding: 0; border-radius: 12px; overflow: hidden;
  border: 1px solid rgba(120, 92, 43, .3); background: rgba(120, 92, 43, .10);
}
button.rs-media { cursor: pointer; }
/* v42.54: crop from the TOP, not the centre. A tall portrait cropped to the
   middle takes the chin and loses the face, which is what every NPC and
   character sheet was doing. */
.rs-media img { display: block; width: 100%; max-height: 300px; object-fit: cover; object-position: top center; }
.rs-thumb img { object-position: top center; }

/* 4 — sections */
.rs-section {
  border: 1px solid rgba(120, 92, 43, .28); border-radius: 12px;
  padding: 10px 12px; background: rgba(255, 252, 240, .45);
}
.rs-section-title {
  margin: 0 0 2px; font-size: var(--t0); font-weight: var(--fw-head); color: #5a4728;
}
.rs-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-height: 40px; padding: 8px 0; text-align: left;
  border: 0; border-top: 1px solid rgba(120, 92, 43, .16);
  background: transparent; color: var(--ink); font: inherit; font-size: var(--t1);
}
button.rs-row { cursor: pointer; }
.rs-row-end { display: inline-flex; align-items: center; gap: 8px; }
.rs-row-meta { font-size: var(--t0); color: var(--muted); }
.rs-chevron { color: var(--muted); }
.rs-body { font-size: var(--t1); line-height: 1.5; white-space: pre-wrap; max-width: 68ch; }

/* 6 — actions, then the quiet line */
.rs-actions { display: grid; gap: 8px; }
.rs-action-row { display: flex; gap: 8px; flex-wrap: wrap; }
.rs-action { min-height: 44px; flex: 0 0 auto; }     /* never stretch to fill */
.rs-edited, .rs-note { margin: 0; font-size: var(--t0); color: var(--muted); }

/* The only reflow: facts beside the image once there is room for both. The
   class is emitted by Components.recordSheet when a sheet has both; before
   v42.54 it was styled here but never rendered, so desktop stayed a tall
   single column with a very large picture. */
@media (min-width: 560px) {
  .record-sheet { gap: 14px; }
  .rs-split { display: flex; gap: 14px; align-items: flex-start; }
  .rs-split .rs-facts { flex: 1 1 0; min-width: 0; margin: 0; }
  .rs-split .rs-media { flex: 0 0 240px; }
  .rs-split .rs-media img { max-height: 230px; }
}
@media (max-width: 559px) {
  .rs-split { display: grid; gap: 13px; }
}

/* v42.45 — the same rules applied to sheets that still use their own card
   markup, until each one moves onto Components.recordSheet. */
.sheet-rule-quiet-name {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.sheet-rule-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet-rule-actions .rs-action { flex: 0 0 auto; min-height: 44px; }
/* One media treatment: the framed portrait becomes the same plain, rounded
   image every other type uses. */
#modal .npc-detail-image-frame {
  border: 1px solid rgba(120, 92, 43, .3) !important;
  border-radius: 12px !important;
  padding: 0 !important;
  background: rgba(120, 92, 43, .10) !important;
  box-shadow: none !important;
}
#modal .npc-detail-image-frame img { border-radius: 12px; }

/* v42.55 — the face pile: who is in this, not a list of them. */
.rs-facepile {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 48px; padding: 6px 0; border: 0; background: transparent;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.rs-faces { display: flex; align-items: center; padding-left: 8px; }
.rs-face {
  width: 32px; height: 32px; flex: 0 0 auto; margin-left: -8px;
  border-radius: 999px; overflow: hidden;
  border: 2px solid var(--parchment, #f4ecd8);
  background: rgba(120, 92, 43, .18);
  display: inline-flex; align-items: center; justify-content: center;
}
.rs-face img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.rs-face-blank { font-size: var(--t0); font-weight: var(--fw-emph); color: #6b5631; }
.rs-face-more { background: #3f3018; color: #f1e4c4; font-size: var(--t0); font-weight: var(--fw-emph); }
.rs-facepile-count { margin-left: auto; font-size: var(--t0); color: var(--muted); font-variant-numeric: tabular-nums; }

/* v42.59: place sections ("Location views") use the shared section heading
   and count badge instead of 04-screens' display weight (800 on both). */
.loc-collapsible > summary { font-weight: var(--fw-body); }
.loc-collapsible > summary > span:first-of-type {
  font-size: var(--t0); font-weight: var(--fw-head); color: #5a4728;
}
.loc-collapsible .loc-section-count {
  font-size: var(--t0); font-weight: var(--fw-body); font-variant-numeric: tabular-nums;
  color: #514128; background: #e8dfc5; border: 0;
}

/* v42.59 — the sheet hierarchy of NPC.html / Desktop-NPC.html.
   A compact header with the title on the left; the sheet sits directly on the
   dialog rather than in a second bordered card; Edit and Share are outlined,
   Delete is the destructive outline. Scoped to record sheets (codex-reader). */
#modal.codex-reader .modal-head h2 { text-align: left; }
#modal.codex-reader .modal-head:has(> .modal-back-spacer) { grid-template-columns: 0 minmax(0, 1fr) 44px; }
#modal.codex-reader .record-sheet.card { border: 0; padding: 0; background: transparent; box-shadow: none; }
#modal.codex-reader .rs-actions .rs-action-row > .button.secondary {
  background: transparent; color: var(--ink); border: 1px solid rgba(120, 92, 43, .45); box-shadow: none;
}
#modal.codex-reader .rs-actions .rs-action.danger {
  background: transparent; color: #8f2416; border: 1px solid rgba(143, 36, 22, .45); box-shadow: none;
}
/* v42.59 — Connections with nothing in it yet (Connections-empty.html). */
.codex-connections-empty {
  border: 1px dashed rgba(120, 92, 43, .38); border-radius: 12px; padding: 12px; background: rgba(255, 252, 240, .35);
}
.codex-connections-empty-head { display: grid; gap: 2px; }
.codex-connections-empty-head b { font-size: var(--t1); font-weight: var(--fw-emph); }
.codex-connections-empty-head small { font-size: var(--t0); color: var(--ink-soft); }
.codex-connections-empty .codex-connections-body:empty { display: none; }
.codex-connections-empty .codex-connections-body { margin-top: 8px; }
