/* Kinfoly — the family tree chart maker (/family-tree-chart).
   Built on gedcom-viewer.css and gedcom-tools.css: the same tokens, drop zone and result
   card. What is here is the chart's own: the panel, the preview on its desk, and the
   print rules that put the chart alone on the sheet. */

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

/* Wider than the other tools' results: the preview wants the room. As specific as
   gedcom-tools.css's own widening, and after it, so this one wins */
.gv-dz-frame:has(.gt-result:not(.gv-hidden) .fc-work) { max-width: 1240px; }

.fc-work {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px;
  margin-top: 18px; align-items: start; text-align: left;
}
.fc-stage { min-width: 0; }

/* ---------- the preview ---------- */

.fc-stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; min-height: 30px; }
.fc-meta { display: flex; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--gv-text-3); }
.fc-meta > span + span::before { content: '·'; margin: 0 8px; color: var(--gv-text-4); }
.fc-meta-strong { color: var(--gv-text); font-weight: 600; }
.fc-pt { font-family: var(--gv-mono); font-size: 11.5px; }
.fc-pt::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 6px; vertical-align: 0; }
.fc-pt.ok::after { background: var(--gv-sage); }
.fc-pt.warn { color: #8A5A0B; }
.fc-pt.warn::after { background: #D3A13B; }
.fc-pt.bad { color: var(--gv-error); }
.fc-pt.bad::after { background: var(--gv-error); }

.fc-zoom {
  flex: none; font: 500 12px Inter, system-ui, sans-serif; color: var(--gv-text-2);
  background: #FFFFFF; border: 1px solid var(--gv-border-strong); border-radius: 8px;
  padding: 6px 10px; cursor: pointer;
}
.fc-zoom:hover { background: var(--gv-hover); }

/* The sheet lies on a desk: a quiet surface, so the paper reads as paper */
.fc-viewport {
  position: relative; display: flex; justify-content: center; align-items: flex-start;
  padding: 28px; border-radius: 14px; min-height: 360px;
  background-color: #ECEEE8;
  background-image: radial-gradient(#DCE1D6 1px, transparent 1.2px);
  background-size: 16px 16px;
  overflow: hidden;
}
.fc-sheet {
  flex: none; line-height: 0; background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(24, 24, 27, 0.08), 0 14px 36px -10px rgba(24, 24, 27, 0.28);
  transition: opacity 160ms ease;
}
.fc-sheet svg { display: block; width: 100%; height: auto; }
.fc-stage.zoomed .fc-viewport { overflow: auto; max-height: 78vh; justify-content: flex-start; }

.fc-busy {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(24, 24, 27, 0.86); color: #FFFFFF; font-size: 13px; font-weight: 500;
  padding: 9px 14px; border-radius: 999px; line-height: 1.2;
}
.fc-viewport:has(.fc-busy:not(.gv-hidden)) .fc-sheet { opacity: 0.45; }

.fc-note {
  margin-top: 12px; font-size: 13px; line-height: 1.5; border-radius: 10px; padding: 10px 14px;
}
.fc-note.warn { background: #FBF4E4; color: #7A5108; }
.fc-note.bad { background: var(--gv-error-bg); color: var(--gv-error); }
.fc-note-link {
  font: inherit; font-weight: 600; color: inherit; background: none; border: none; padding: 0;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}

.fc-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.fc-btn-print { display: inline-flex; align-items: center; gap: 8px; }
.fc-actions .gv-btn-ghost:disabled { opacity: 0.55; cursor: default; }
.fc-hint { font-size: 12px; color: var(--gv-text-3); margin-top: 10px; line-height: 1.55; max-width: 620px; text-wrap: pretty; }

/* ---------- the panel ---------- */

.fc-panel { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 16px; }
.fc-sec { background: #FFFFFF; border: 1px solid var(--gv-border); border-radius: 12px; padding: 14px; }
.fc-sec-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--gv-text-3); margin: 0 0 10px;
}
.fc-field-label { display: block; font-size: 12px; font-weight: 500; color: var(--gv-text-3); margin: 12px 0 6px; }
.fc-sec-title + .fc-field-label { margin-top: 0; }

.fc-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.fc-seg-btn {
  flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 500 13px Inter, system-ui, sans-serif; color: var(--gv-text-2);
  background: #FFFFFF; border: 1px solid var(--gv-border-strong); border-radius: 8px;
  padding: 7px 10px; cursor: pointer; transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.fc-seg-btn:hover:not(:disabled) { background: var(--gv-hover); }
.fc-seg-btn.on, .fc-seg-btn.on:hover { background: var(--gv-ink); border-color: var(--gv-ink); color: var(--gv-on-ink); }
.fc-seg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.fc-seg-btn.locked { color: var(--gv-text-3); border-style: dashed; }
.fc-lock { display: inline-flex; opacity: 0.75; }

.fc-seg-modes { display: grid; grid-template-columns: 1fr 1fr; }
.fc-seg-modes .fc-seg-btn { flex-direction: column; padding: 10px 6px 9px; gap: 3px; font-size: 12.5px; }
.fc-seg-ico svg { display: block; width: 26px; height: 26px; }
.fc-seg-papers .fc-seg-btn { flex: 1 1 21%; padding: 7px 4px; font-size: 12.5px; }
.fc-seg-small { margin-top: 8px; }
.fc-seg-small .fc-seg-btn { font-size: 12px; padding: 6px 6px; }

.fc-line { margin-top: 4px; }
.fc-line .rc-pick-input { font-size: 14px; }
/* The list hangs from the field. The calculator's stylesheet puts it 64px down, under
   a label this panel keeps outside the picker, which left a gap under the field */
.fc-pick-field { position: relative; }
.fc-pick .rc-pick-list { top: calc(100% + 4px); max-height: 320px; padding: 4px 0; }
.fc-pick .rc-pick-item.on { background: var(--gv-hover); }
.fc-pick .rc-pick-item.cur .n { font-weight: 600; }
.fc-pick .rc-pick-item.cur .n::before {
  content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gv-sage); margin: 0 7px 1px 0; vertical-align: middle;
}
.rc-pick-more { padding: 8px 12px 6px; font-size: 12px; color: var(--gv-text-3); border-top: 1px solid var(--gv-border); margin-top: 4px; }

.fc-step { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.fc-step-label { flex: 1; font-size: 13px; color: var(--gv-text-2); }
.fc-step-btn {
  width: 28px; height: 28px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  font: 500 16px Inter, system-ui, sans-serif; line-height: 1; color: var(--gv-text);
  background: #FFFFFF; border: 1px solid var(--gv-border-strong); border-radius: 8px; cursor: pointer;
}
.fc-step-btn:hover:not(:disabled) { background: var(--gv-hover); }
.fc-step-btn:disabled { opacity: 0.35; cursor: default; }
.fc-step-val { min-width: 56px; text-align: center; font: 500 12.5px var(--gv-mono); color: var(--gv-text); }

.fc-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--gv-text-2); margin-top: 9px; cursor: pointer; line-height: 1.4; }
.fc-check input { accent-color: var(--gv-sage); margin: 2px 0 0; flex: none; width: 15px; height: 15px; }
.fc-check:has(input:disabled) { opacity: 0.5; cursor: default; }
.fc-checks { margin-top: 6px; }

.fc-input {
  width: 100%; font: 400 14px Inter, system-ui, sans-serif; color: var(--gv-text);
  background: #FFFFFF; border: 1px solid var(--gv-border-strong); border-radius: 8px; padding: 8px 10px;
  outline: none; transition: border-color 120ms ease;
}
.fc-input:focus { border-color: var(--gv-sage); }
.fc-input::placeholder { color: var(--gv-text-4); }

.fc-looks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.fc-look {
  display: flex; flex-direction: column; align-items: stretch; gap: 5px; padding: 4px 4px 6px;
  background: #FFFFFF; border: 1px solid var(--gv-border-strong); border-radius: 10px; cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.fc-look:hover { border-color: #C9C9CF; }
.fc-look.on { border-color: var(--gv-sage); box-shadow: 0 0 0 1px var(--gv-sage); }
.fc-look-swatch { display: block; border-radius: 6px; border: 1px solid var(--gv-border); padding: 4px 3px; line-height: 0; }
.fc-look-swatch svg { width: 100%; height: auto; }
.fc-look-name { font-size: 12px; font-weight: 600; color: var(--gv-text); text-align: center; }

/* ---------- bigger than a printer takes ---------- */

.fc-bigger {
  display: flex; gap: 18px; align-items: center; margin-top: 22px; padding: 18px 20px;
  background: var(--gv-sage-soft); border: 1px solid #DCE6D3; border-radius: 14px; text-align: left;
}
.fc-bigger.flash { animation: fc-flash 1.2s ease; }
@keyframes fc-flash { 0%, 100% { box-shadow: 0 0 0 0 rgba(110, 139, 94, 0); } 30% { box-shadow: 0 0 0 4px rgba(110, 139, 94, 0.35); } }
.fc-bigger-art { flex: none; width: 120px; }
.fc-bigger-art svg { display: block; width: 100%; height: auto; }
.fc-bigger-title { font-size: 16px; font-weight: 600; color: var(--gv-text); }
.fc-bigger-body { font-size: 13.5px; color: var(--gv-text-2); line-height: 1.6; margin-top: 4px; max-width: 640px; text-wrap: pretty; }
.fc-bigger-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.fc-bigger-foot { font-size: 12px; color: var(--gv-text-3); margin-top: 8px; }

.fc-empty { margin-top: 18px; padding: 22px; border: 1px dashed var(--gv-border-strong); border-radius: 12px; text-align: center; }
.fc-empty-title { font-size: 15px; font-weight: 600; }
.fc-empty-body { font-size: 13.5px; color: var(--gv-text-2); margin-top: 6px; line-height: 1.6; }

/* ---------- the drop zone's picture: a .ged becomes a chart ---------- */

.gv-dz-art .sheet { fill: #FFFFFF; stroke: var(--gv-border-strong); stroke-width: 1.2; }
.gv-dz-art .tf { fill: #F7EAE7; }
.gv-dz-art .tm { fill: #E7EEF6; }
.gv-dz-art .tr { fill: #E7EEF6; stroke: #18181B; stroke-width: 1; }
.gv-dz-art .ttl { fill: #18181B; }
.gv-dz-art .tln { stroke: #B3B6BD; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.gv-dropzone.drag .gv-dz-art .sheet { stroke: var(--gv-sage); }

/* ---------- the engine: the canvas that only lays out ---------- */

.fc-engine, .fc-engine[hidden] { display: none !important; }

/* ---------- small screens ---------- */

@media (max-width: 980px) {
  .fc-work { grid-template-columns: 1fr; }
  .fc-panel { position: static; }
}
@media (max-width: 640px) {
  .fc-viewport { padding: 14px; min-height: 240px; }
  .fc-bigger { flex-direction: column; align-items: flex-start; }
  .fc-bigger-art { width: 96px; }
  .fc-stage-bar { flex-wrap: wrap; }
}

/* ---------- print: the chart alone, on a sheet its own size ---------- */

.fc-print-host { display: none; }
@media print {
  html.fc-printing, html.fc-printing body { margin: 0 !important; padding: 0 !important; background: #FFFFFF !important; height: auto !important; }
  html.fc-printing body > *:not(.fc-print-host) { display: none !important; }
  html.fc-printing .fc-print-host { display: block !important; }
  html.fc-printing .fc-print-host svg { display: block; break-inside: avoid; page-break-inside: avoid; }
  html.fc-printing, html.fc-printing * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}
