/* ============================================================
   family-history.css
   Page-level styles for family-history.html only.
   RTB widget styles live in root-to-branch.css.
   ============================================================ */

/* ── BASE PAGE ─────────────────────────────────────────────── */
* { box-sizing: border-box; }

body { margin: 0; padding: 0; font-family: 'Libre Baskerville', Georgia, serif; background: #FAF8F5; color: #2C2420; }
.page-wrapper { max-width: 1240px; margin: 0 auto; padding: 64px 24px 0; }
.section { padding: 40px 0; }
.section-label { font-family: 'Jost', sans-serif; font-size: 1.3rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: #9A8070; margin-bottom: 12px; }

.section-body { font-family: 'EB Garamond', serif; font-size: 1.05rem; line-height: 1.7; color: #5A4A44; }

/* ── Helper classes for family-history.html ───────────────── */
.fh-copy-section-tight-bottom { padding-bottom: 8px; }
.fh-body-spaced { margin-bottom: 20px; }
.fh-tree-shell { padding-top: 0; max-width: 1200px; overflow: visible; }
.fh-label-reset-top { margin-top: 0; }
.fh-chevron-rotated { transform: rotate(90deg); display: inline-block; }

/* ── COPY SECTIONS (Wendler Line, Ancestor Chart) ──────────── */
/* Override global max-width:620px so text isn't capped on desktop */
.fh-copy-section .section-body { max-width: none; }

.fh-copy-section,
.section:has(details),
.tree-section,
.page-wrapper > .section.fade-in:not(.fh-copy-section):not(:has(details)) {
  width: min(100%, 880px);
  margin-left: auto;
  margin-right: auto;
}

.section:has(details) .section-body {
  width: 100%;
}

.section:has(details) details {
  width: 100%;
}

/* Desktop: center label above body, constrain body width */
@media (min-width: 769px) {
  .fh-copy-section { text-align: center; }
  .fh-copy-section .section-body { max-width: 760px; margin: 0 auto; text-align: left; }

  .section:has(details) {
    text-align: center;
  }

  .section:has(details) .section-body {
    max-width: 820px;
    margin: 0 auto;
    text-align: left;
  }

  .page-wrapper > .section.fade-in:not(.fh-copy-section):not(:has(details)) {
    text-align: center;
  }

  .page-wrapper > .section.fade-in:not(.fh-copy-section):not(:has(details)) .section-body {
    max-width: 760px;
    margin: 0 auto;
    text-align: left;
  }
}

/* ── PIONEER HERO STRIP ────────────────────────────────────── */
.pioneer-strip {
  position: relative;
  width: min(100%, 820px);
  display: grid;
  grid-template-columns: 160px 156px 128px;
  justify-content: center;
  align-items: end;
  column-gap: clamp(20px, 5vw, 72px);
  padding: 0 8px;
  min-height: 188px;
  overflow: visible;
  margin: 36px auto 6px;
}
.campfire-wrap { position: relative; width: 160px; flex-shrink: 0; overflow: visible; order: 1; }
.smoke-blob { position: absolute; bottom: 108px; left: 50%; transform: translateX(-50%); animation: blobRise var(--sd) ease-out var(--dl) infinite; opacity: 0; }

@keyframes blobRise {
  0% {
    transform: translateX(calc(-50% + var(--sx,0px))) translateY(0) scale(0.3);
    opacity: 0;
  }
  12% {
    opacity: var(--so, 0.4);
  }
  75% {
    opacity: calc(var(--so, 0.4) * 0.4);
  }
  100% {
    transform: translateX(calc(-50% + var(--sx,0px) + var(--sw,10px))) translateY(-160px) scale(2.8);
    opacity: 0;
  }
}

.smoke-blob svg {
  display: block;
}
.stump-wrap { width: 156px; flex-shrink: 0; margin-bottom: 12px; overflow: visible; order: 2; }
.wagon-wrap { width: 128px; flex-shrink: 0; margin-bottom: 12px; order: 3; }
.wagon-wheel-svg { width: 128px; height: 128px; overflow: visible; }
.wheel-spin { transform-origin: 60px 60px; animation: wheelTurn 4s ease-in-out infinite alternate; }
@keyframes wheelTurn { 0% { transform: rotate(0deg); } 100% { transform: rotate(210deg); } }
@media (prefers-reduced-motion: reduce) { .smoke-blob { animation: none; opacity: 0.12; transform: translateX(-50%) translateY(-60px) scale(1.5); } .wheel-spin { animation: none; } }
@media (max-width: 600px) {
  .pioneer-strip {
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 12px 0 10px;
    min-height: 140px;
    margin-top: 28px;
  }
  .campfire-wrap { width: 130px; }
  .stump-wrap { width: 105px; }
  .wagon-wrap { width: 95px; }
  .wagon-wheel-svg { width: 95px; height: 95px; }
}

/* ── COLLAPSIBLE COPY ──────────────────────────────────────── */
.fh-details-toggle {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  font-family: 'Jost', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9A8070;
  user-select: none;
  padding: 0 0 16px;
}
.fh-details-toggle::-webkit-details-marker { display: none; }
.fh-details-caret { font-size: 0.7rem; transition: transform 0.2s; display: inline-block; }
details[open] .fh-details-caret { transform: rotate(90deg); }
details + details { margin-top: 4px; border-top: 1px solid #E4D8D2; padding-top: 20px; }

/* ── LEGEND WRAPPER ────────────────────────────────────────── */
.tree-section { width: 100%; padding: 16px 20px 8px; box-sizing: border-box; }
#rtb-legend + .section.fh-tree-shell {
  padding-top: 8px;
}

.page-wrapper > .section.fh-tree-shell:has(#tree-scroll) {
  padding-bottom: 8px;
}
.legend-box {
  border: 1px solid var(--line, #E4D8D2);
  border-radius: 8px;
  padding: 14px 22px 16px;
  background: var(--warm-white, #FEFCFA);
  box-shadow: 0 2px 10px rgba(0,0,0,0.09);
  margin: 0 auto 16px;
  position: relative;
  max-width: 820px;
}
.legend-icon-left  { position: absolute; top: 11px; left: 21px; width: 27px; height: 27px; opacity: 0.78; color: #8B7355; }
.legend-icon-right { position: absolute; top: 11px; right: 21px; width: 27px; height: 27px; opacity: 0.78; color: #8B7355; }

.legend-icon-stroke {
  stroke: currentColor;
}

.legend-icon-accent {
  fill: #C4806A;
  stroke: #C4806A;
  stroke-width: 1;
}
.legend-title { font-size: 1.1rem; font-style: italic; text-align: center; color: var(--charcoal, #2C2420); margin: 0 0 14px 0; letter-spacing: 0.04em; border-bottom: 1px solid var(--line, #E4D8D2); padding-bottom: 10px; font-family: 'Libre Baskerville', Georgia, serif; display: flex; align-items: center; justify-content: center; gap: 10px; }
.legend-title::before, .legend-title::after { content: '\2736'; font-size: 0.62rem; color: #C4806A; opacity: 0.75; }

/* ── Two-column middle section ─────────────────────────────── */
.legend-middle-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  margin-bottom: 14px;
  position: relative;
}
.legend-middle-section::after { display: none; }
.legend-left-column  { display: flex; flex-direction: column; gap: 10px; padding-right: 0; }
.legend-right-column { display: flex; flex-direction: column; gap: 16px; padding-left: 0; }

/* Structural/state rows */
.legend-row-item { display: flex; align-items: center; gap: 9px; font-size: 0.82rem; color: var(--dark-grey, #5A4A44); font-family: 'Jost', sans-serif; }
.card-sample { display: inline-flex; width: 14px; height: 22px; border: 1px solid var(--line, #E4D8D2); border-radius: 2px; background: var(--warm-white, #FEFCFA); position: relative; flex-shrink: 0; }
.card-sample.boerne  { background: #EEF3EE; }
.card-sample.linked  { background: #F3EFF8; }
.card-sample.focused { background: #FDF5E8; }
.card-sample.unknown { background: #C8C0BC; opacity: 0.55; }
.card-accent { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 1px; }
.accent-direct  { background: #C4806A; }
.accent-boerne  { background: #7A9E7E; }
.accent-linked  { background: #8B6FA8; }
.accent-focused { background: #C4A044; box-shadow: 0 0 3px rgba(196,160,68,0.5); }

/* Chevron indicators — icon left, label right */
.chevron-indicator { display: flex; flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
.chevron-circle { width: 26px; height: 26px; border: 1.5px solid #C4806A; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #C4806A; background: var(--warm-white, #FEFCFA); flex-shrink: 0; }
.chevron-circle.down { background: rgba(242,224,217,0.82); border-color: #C8A391; }
.chevron-circle.up   { background: rgba(214,194,178,0.88); border-color: #9E7C67; }
.chevron-circle.down::after { content: '\25BC'; font-size: 9px; }
.chevron-circle.up::after   { content: '\25B2'; font-size: 9px; }
.chevron-label { font-size: 0.78rem; color: var(--dark-grey, #5A4A44); font-style: italic; font-family: 'Jost', sans-serif; }

/* OPEN PAGE legend pill */
.legend-open-page-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 6px; }
.legend-open-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 14px;
  background: linear-gradient(135deg, #F5E6E0, #EAD0C5);
  border: 1.5px solid #C4806A;
  border-radius: 16px;
  font-family: 'Jost', sans-serif;
  font-size: 9px;
  font-weight: 700;
  color: #7A3F2D;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
}
.legend-open-helper { margin: 0; font-family: 'Jost', sans-serif; font-size: 0.68rem; color: #8A7060; font-style: italic; text-align: left; }

/* Section divider between upper and military sections */
.legend-section-divider { border-top: 1px solid var(--line, #E4D8D2); margin: 0 0 12px; }

/* ── Military grid (always 3 columns) ──────────────────────── */
.military-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 12px;
  margin-bottom: 14px;
  font-size: 0.75rem;
  color: var(--dark-grey, #5A4A44);
  font-family: 'Jost', sans-serif;
}
@media (min-width: 600px) {
  .military-grid {
    grid-template-columns: repeat(3, max-content);
    column-gap: 20px;
    justify-content: center;
  }
}
.military-grid .legend-item svg { flex-shrink: 0; }
.legend-item { display: flex; align-items: center; gap: 7px; }
.legend-item span { line-height: 1.2; }

/* ── Special badges row ─────────────────────────────────────── */
.special-badges-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line, #E4D8D2);
  font-size: 0.75rem;
  color: var(--dark-grey, #5A4A44);
  font-family: 'Jost', sans-serif;
  flex-wrap: wrap;
}
.special-badges-row .legend-item { white-space: nowrap; }

/* ── Narrow mobile adjustments ──────────────────────────────── */
@media (max-width: 420px) {
  .military-grid { gap: 6px 8px; font-size: 0.68rem; }
  .military-grid .legend-item svg { width: 14px !important; height: 14px !important; }
  .special-badges-row { gap: 12px; }
}

/* ── CHEVRON PILL DEMO ─────────────────────────────────────── */
.chevron-pill-demo { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; background: linear-gradient(135deg, #F5E6E0, #EAD0C5); border: 1px solid #C4806A; border-radius: 14px; font-family: 'Jost', sans-serif; font-size: 11px; font-weight: 600; color: #7A3F2D; text-transform: uppercase; letter-spacing: 0.5px; vertical-align: middle; margin: 0 2px; }
.chevron-icon { font-size: 9px; color: #A65D3D; }

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .legend-box { margin-left: 0; margin-right: 0; }
  .legend-middle-section {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .legend-right-column {
    gap: 10px;
  }
  .fh-copy-section,
  .section:has(details),
  .tree-section,
  .page-wrapper > .section.fade-in:not(.fh-copy-section):not(:has(details)) {
    width: 100%;
  }
}

.fh-dev-note-section {
  padding-top: 2px;
  padding-bottom: 4px;
}

.fh-dev-note {
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: center;
  color: #7A6A63;
  margin: 0;
}

.fh-dev-note p {
  margin: 0;
}
