/* ============================================================
   Schild Family History — /history/*
   Extends style.css (load that first for tokens, header, footer,
   hero, and base type). This file is the history-specific
   component layer: entrance cards, vertical timeline, person and
   place profiles, archive cards, the document viewer, the source
   drawer, and the research-confidence badge. Mobile-first
   throughout: base rules are the phone layout, media queries only
   add space and columns as the viewport grows.
   ============================================================ */

/* ---------- Compact page hero for /history and its subpages ---------- */
.h-hero {
  background:
    radial-gradient(640px 360px at 50% -10%, rgba(169, 129, 47, 0.14), transparent 62%),
    var(--charcoal);
  border-bottom: 1px solid var(--charcoal-line);
  padding: 2.75rem 1.5rem 3rem;
}

.h-hero-inner { max-width: var(--max-width); margin: 0 auto; }

.h-hero .eyebrow {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass-on-dark);
  margin: 0 0 0.75rem;
}

.h-hero h1 {
  color: var(--cream);
  font-size: clamp(1.9rem, 6vw, 3rem);
  line-height: 1.1;
  margin: 0 0 1rem;
  max-width: 18ch;
}

.h-hero p {
  color: var(--cream-soft);
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.6;
  max-width: 52ch;
  margin: 0;
}

.h-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--cream-faint);
  margin: 0 0 1.25rem;
}
.h-breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; color: var(--cream-soft); text-decoration: none; }
.h-breadcrumb a:hover { color: var(--cream); }
.h-breadcrumb span[aria-hidden] { color: var(--cream-faint); }
.h-breadcrumb .current { color: var(--brass-on-dark); }

/* ---------- Generic buttons ---------- */
.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.75rem 1.6rem;
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
  border: 1px solid transparent;
}
.btn-primary { background: var(--burgundy); color: var(--cream); }
.btn-primary:hover { background: var(--burgundy-bright); color: var(--cream); transform: translateY(-1px); }
.btn-ghost { background: transparent; border-color: var(--paper-line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--burgundy); color: var(--burgundy); }
.btn-ghost.on-dark { border-color: var(--charcoal-line); color: var(--cream-soft); }
.btn-ghost.on-dark:hover { border-color: var(--brass-on-dark); color: var(--cream); }

/* ---------- History landing: discovery cards ---------- */
.h-discovery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  margin-top: 2rem;
}

.h-discovery-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 44px;
  padding: 1.25rem 1.35rem;
  background: var(--paper-raised);
  border: 1px solid var(--paper-line);
  border-radius: 4px;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.h-discovery-card:hover { border-color: var(--brass); }
.h-discovery-card:active { transform: scale(0.99); }

.h-discovery-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  color: var(--burgundy);
}
.h-discovery-icon svg { width: 22px; height: 22px; }

.h-discovery-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.h-discovery-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--ink);
  margin: 0 0 0.15rem;
}
.h-discovery-desc { font-size: 0.88rem; color: var(--ink-faint); margin: 0; max-width: 40ch; }
.h-discovery-arrow { flex-shrink: 0; color: var(--ink-faint); font-size: 1.2rem; }

@media (min-width: 700px) {
  .h-discovery { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .h-discovery { grid-template-columns: repeat(5, 1fr); gap: 1rem; }
  .h-discovery-card { flex-direction: column; align-items: flex-start; text-align: left; padding: 1.5rem 1.25rem; gap: 0.85rem; }
  .h-discovery-arrow { display: none; }
}

/* ---------- Section preview header (used above each preview block) ---------- */
.h-preview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.h-preview-head h2 { margin: 0; }
.h-preview-head .h-see-all { display: inline-flex; align-items: center; min-height: 44px; font-size: 0.9rem; font-weight: 600; white-space: nowrap; text-decoration: none; }

/* ---------- Featured story ---------- */
.h-featured {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border: 1px solid var(--paper-line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper-raised);
}

.h-featured-visual {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--charcoal);
}
.h-featured-visual svg { width: 100%; height: 100%; display: block; }

.h-featured-body { padding: 1.5rem 1.35rem 1.75rem; }
.h-featured-eyebrow {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--burgundy);
  margin: 0 0 0.5rem;
}
.h-featured-body h3 { font-size: clamp(1.3rem, 3vw, 1.6rem); margin: 0 0 0.5rem; }
.h-featured-meta { font-size: 0.85rem; color: var(--ink-faint); margin: 0 0 0.85rem; }
.h-featured-body p.h-teaser { font-size: 1rem; margin: 0 0 1.25rem; max-width: 60ch; }

@media (min-width: 760px) {
  .h-featured { grid-template-columns: 1fr 1fr; }
  .h-featured-visual { aspect-ratio: auto; height: 100%; }
  .h-featured-body { padding: 2rem 2.25rem; display: flex; flex-direction: column; justify-content: center; }
}

/* ---------- Story cards (grid) ---------- */
.h-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 1.75rem;
}
@media (min-width: 700px) { .h-card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .h-card-grid { grid-template-columns: repeat(3, 1fr); } }

.h-story-card {
  display: block;
  text-decoration: none;
  border: 1px solid var(--paper-line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper-raised);
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.h-story-card:hover { border-color: var(--brass); }
@media (hover: hover) { .h-story-card:hover { transform: translateY(-2px); } }

.h-story-card-visual { display: block; aspect-ratio: 16 / 9; background: var(--charcoal); overflow: hidden; }
.h-story-card-visual svg { width: 100%; height: 100%; display: block; }
.h-story-card-visual img { width: 100%; height: 100%; display: block; object-fit: cover; }
.h-story-card-body { display: flex; flex-direction: column; padding: 1.15rem 1.25rem 1.35rem; }
.h-story-card-eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--burgundy);
  margin: 0 0 0.4rem;
}
.h-story-card-title { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--ink); margin: 0 0 0.3rem; }
.h-story-card-meta { font-size: 0.82rem; color: var(--ink-faint); margin: 0 0 0.6rem; }
.h-story-card-teaser { font-size: 0.92rem; color: var(--ink-soft); margin: 0; }

/* ---------- Vertical timeline (one model, mobile through desktop) ---------- */
.h-vtimeline {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  border-left: 2px solid var(--paper-line);
  max-width: 720px;
}

.h-vtimeline-item {
  position: relative;
  padding: 0 0 2.25rem 1.75rem;
}
.h-vtimeline-item:last-child { padding-bottom: 0; }

.h-vtimeline-item::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 0.3rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--brass);
}

.h-vtimeline-date {
  display: inline-block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--burgundy);
  margin: 0 0 0.4rem;
}

.h-vtimeline-card {
  background: var(--paper-raised);
  border: 1px solid var(--paper-line);
  border-radius: 4px;
  padding: 1.1rem 1.25rem;
}

.h-vtimeline-title { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; margin: 0 0 0.5rem; color: var(--ink); }
.h-vtimeline-desc { font-size: 1rem; line-height: 1.6; color: var(--ink-soft); margin: 0 0 0.85rem; max-width: 56ch; }

.h-vtimeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin: 0 0 0.85rem;
}
.h-vtimeline-meta span { display: inline-flex; align-items: center; gap: 0.35rem; }

.h-vtimeline-actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: center; }
.h-vtimeline-actions a.h-link,
.h-vtimeline-actions button.h-link {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--burgundy);
  background: none;
  border: none;
  padding: 0.4rem 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
}
.h-vtimeline-actions a.h-link:hover,
.h-vtimeline-actions button.h-link:hover { color: var(--burgundy-bright); text-decoration: underline; }

@media (min-width: 760px) {
  .h-vtimeline { max-width: 820px; padding-left: 0.25rem; }
}

/* ---------- Person / place cards (compact, list contexts) ---------- */
.h-entity-list {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
@media (min-width: 700px) { .h-entity-list { grid-template-columns: repeat(2, 1fr); } }

.h-entity-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.15rem;
  background: var(--paper-raised);
  border: 1px solid var(--paper-line);
  border-radius: 4px;
  text-decoration: none;
  min-height: 44px;
  transition: border-color 0.2s ease;
}
.h-entity-card:hover { border-color: var(--brass); }

.h-entity-portrait {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 600;
  color: var(--burgundy);
}

.h-entity-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.h-entity-name { font-family: var(--serif); font-weight: 600; font-size: 1.02rem; color: var(--ink); margin: 0 0 0.15rem; }
.h-entity-sub { font-size: 0.82rem; color: var(--ink-faint); margin: 0 0 0.2rem; }
.h-entity-context { font-size: 0.88rem; color: var(--ink-soft); margin: 0; }

/* Small horizontally-scrollable related-entity strip (used on profiles) */
.h-related-strip {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.25rem 0 0.5rem;
  margin-top: 1.25rem;
  scroll-snap-type: x proximity;
}
.h-related-strip .h-entity-card,
.h-related-strip .h-story-card {
  flex: 0 0 auto;
  width: 250px;
  scroll-snap-align: start;
}

/* ---------- Profile layout (person / place) ---------- */
.h-profile-head {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: flex-start;
}

.h-profile-portrait {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--paper-raised);
  border: 1px solid var(--paper-line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.75rem;
  color: var(--burgundy);
  flex-shrink: 0;
}

.h-profile-name { margin: 0 0 0.35rem; }
.h-profile-role { font-size: 1rem; color: var(--ink-faint); margin: 0 0 0.5rem; }

.h-fact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  margin: 1.75rem 0;
  padding: 1.35rem;
  background: var(--paper-raised);
  border: 1px solid var(--paper-line);
  border-radius: 4px;
  max-width: 560px;
}
.h-fact-grid dt { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--burgundy); }
.h-fact-grid dd { margin: 0.2rem 0 0; font-size: 0.98rem; color: var(--ink); }

@media (min-width: 560px) {
  .h-profile-head { flex-direction: row; align-items: center; }
  .h-fact-grid { grid-template-columns: 1fr 1fr; }
}

.h-bio { max-width: 68ch; }
.h-bio p { max-width: none; }

/* ---------- Research confidence badge ---------- */
.h-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.65rem 0.3rem 0.5rem;
  border-radius: 999px;
  border: 1px solid;
}
.h-status svg { width: 13px; height: 13px; flex-shrink: 0; }
.h-status.confirmed { color: #3f6b3f; border-color: rgba(63, 107, 63, 0.35); background: rgba(63, 107, 63, 0.07); }
.h-status.probable { color: #8a6a1f; border-color: rgba(138, 106, 31, 0.35); background: rgba(138, 106, 31, 0.08); }
.h-status.researching { color: var(--burgundy); border-color: rgba(111, 31, 40, 0.3); background: rgba(111, 31, 40, 0.06); }

/* ---------- Mystery / question card ---------- */
.h-mystery {
  border: 1px solid var(--paper-line);
  border-left: 3px solid var(--brass);
  border-radius: 0 4px 4px 0;
  padding: 1.25rem 1.4rem;
  background: var(--paper-raised);
  max-width: 620px;
}
.h-mystery h3 { margin: 0 0 0.6rem; font-size: 1.1rem; }
.h-mystery p { margin: 0.75rem 0 0; font-size: 0.96rem; }
.h-mystery .h-status { margin-top: 0.5rem; }

/* ---------- Wider Schild story flag: a visible, non buried label for
   content not yet proven to be part of the direct family line. Reuses
   the same card shape as .h-mystery with a burgundy edge instead of
   brass, so it reads as a distinct signal at a glance. ---------- */
.h-lineage-flag {
  display: inline-flex;
  flex-direction: column;
  gap: 0.3rem;
  border: 1px solid var(--paper-line);
  border-left: 3px solid var(--burgundy);
  border-radius: 0 4px 4px 0;
  padding: 0.85rem 1.1rem;
  background: var(--paper-raised);
  max-width: 620px;
  margin: 1.25rem 0;
}
.h-lineage-flag-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--burgundy);
}
.h-lineage-flag p { margin: 0; font-size: 0.9rem; }
.section-dark .h-lineage-flag { background: var(--charcoal-soft); border-color: var(--charcoal-line); }
.section-dark .h-lineage-flag p { color: var(--cream-soft); }

/* ---------- Places list / map ---------- */
.h-place-map {
  background: var(--paper-raised);
  border: 1px solid var(--paper-line);
  border-radius: 4px;
  padding: 0.6rem;
  max-width: 620px;
  margin: 1.5rem 0;
}
.h-place-map svg,
.h-place-map img { width: 100%; height: auto; display: block; border-radius: 2px; }
.h-place-map-caption { text-align: center; font-size: 0.8rem; color: var(--ink-faint); margin-top: 0.6rem; }
.h-place-map-credit { text-align: center; font-size: 0.72rem; color: var(--ink-faint); margin-top: 0.15rem; }
.h-place-map-credit a { color: inherit; }

/* ---------- Video embed: reuses .h-place-map's frame ---------- */
.h-video-embed-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 2px;
  overflow: hidden;
  background: #000;
}
.h-video-embed-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- Archive cards ---------- */
.h-archive-card {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  padding: 1.25rem;
  background: var(--paper-raised);
  border: 1px solid var(--paper-line);
  border-radius: 4px;
}
.h-archive-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 3px;
  background: var(--charcoal);
  color: var(--brass-on-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}
.h-archive-thumb svg { width: 28px; height: 28px; }
.h-archive-type { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--burgundy); margin: 0 0 0.3rem; }
.h-archive-title { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; margin: 0 0 0.3rem; color: var(--ink); }
.h-archive-meta { font-size: 0.85rem; color: var(--ink-faint); margin: 0 0 0.75rem; }
.h-archive-card .btn-ghost { padding: 0.55rem 1.1rem; font-size: 0.85rem; }

/* ---------- Source trigger + drawer ---------- */
.h-source-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0 0.2rem;
  background: none;
  border: none;
  color: var(--burgundy);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.h-source-trigger:hover { color: var(--burgundy-bright); text-decoration: underline; }

.h-drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 11, 0.55);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.h-drawer-scrim.open { opacity: 1; pointer-events: auto; }

.h-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 301;
  background: var(--paper);
  border-top: 1px solid var(--paper-line);
  border-radius: 12px 12px 0 0;
  max-height: 82vh;
  overflow-y: auto;
  padding: 1.25rem 1.35rem calc(1.5rem + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.3s ease;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
}
.h-drawer.open { transform: translateY(0); }

.h-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.h-drawer-head h3 { margin: 0; font-size: 1.15rem; }
.h-drawer-close {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper-raised);
  border: 1px solid var(--paper-line);
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink);
  font-size: 1.1rem;
  flex-shrink: 0;
}
.h-drawer-close:hover { border-color: var(--burgundy); color: var(--burgundy); }

.h-source-item { padding: 0.9rem 0; border-bottom: 1px solid var(--paper-line); }
.h-source-item:last-child { border-bottom: none; }
.h-source-item-title { font-weight: 600; color: var(--ink); margin: 0 0 0.3rem; font-size: 0.96rem; }
.h-source-item-note { font-size: 0.85rem; color: var(--ink-faint); margin: 0 0 0.5rem; }

@media (min-width: 640px) {
  .h-drawer {
    left: auto;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 400px;
    max-height: 70vh;
    border-radius: 8px;
    transform: translateY(24px) scale(0.98);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }
  .h-drawer.open { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---------- Document viewer (modal) ---------- */
.h-viewer {
  position: fixed;
  inset: 0;
  z-index: 310;
  background: var(--charcoal);
  display: none;
  flex-direction: column;
}
.h-viewer.open { display: flex; }

.h-viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--charcoal-line);
  flex-shrink: 0;
}
.h-viewer-bar h3 { color: var(--cream); font-size: 1rem; margin: 0; }
.h-viewer-close {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--charcoal-line);
  border-radius: 50%;
  color: var(--cream);
  cursor: pointer;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.h-viewer-close:hover { border-color: var(--brass-on-dark); color: var(--brass-on-dark); }

.h-viewer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.5rem 1.25rem 2.5rem;
}
.h-viewer-inner { max-width: 640px; margin: 0 auto; }

.h-viewer-noimage {
  aspect-ratio: 4 / 3;
  max-height: 40vh;
  background: var(--charcoal-soft);
  border: 1px dashed var(--charcoal-line);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--cream-faint);
  text-align: center;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.h-viewer-noimage svg { width: 40px; height: 40px; opacity: 0.6; }
.h-viewer-noimage p { color: var(--cream-faint); font-size: 0.85rem; margin: 0; max-width: 32ch; }

.h-viewer-image { margin-bottom: 0.6rem; }
.h-viewer-image img { width: 100%; height: auto; max-height: 48vh; object-fit: contain; display: block; border-radius: 6px; background: var(--charcoal-soft); }
.h-viewer-image-credit { color: var(--cream-faint); font-size: 0.72rem; margin: 0.5rem 0 1.5rem; }

.h-viewer-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.h-viewer-tab {
  min-height: 40px;
  padding: 0.5rem 1rem;
  background: var(--charcoal-soft);
  border: 1px solid var(--charcoal-line);
  border-radius: 999px;
  color: var(--cream-soft);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.h-viewer-tab[aria-selected="true"] { background: var(--burgundy); border-color: var(--burgundy); color: var(--cream); }

.h-viewer-panel { display: none; }
.h-viewer-panel.active { display: block; }
.h-viewer-panel p, .h-viewer-panel dd { color: var(--cream-soft); }
.h-viewer-panel h4 { color: var(--cream); font-size: 0.95rem; margin: 1.25rem 0 0.5rem; }
.h-viewer-panel h4:first-child { margin-top: 0; }

body.h-lock { overflow: hidden; }

@media (min-width: 760px) {
  .h-viewer-body { padding: 2.5rem 1.5rem; }
}

/* ---------- Homepage entrance card ---------- */
.history-entry {
  display: block;
  text-decoration: none;
  border: 1px solid var(--paper-line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper-raised);
  margin-top: 2rem;
  transition: border-color 0.2s ease;
}
.history-entry:hover { border-color: var(--brass); }
@media (hover: hover) { .history-entry:hover .history-entry-visual svg { transform: scale(1.03); } }

.history-entry-visual {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--charcoal);
  overflow: hidden;
}
.history-entry-visual svg { width: 100%; height: 100%; display: block; transition: transform 0.4s ease; }

.history-entry-body { padding: 1.35rem 1.4rem 1.5rem; }
.history-entry-body h3 { font-size: 1.3rem; margin: 0 0 0.5rem; }
.history-entry-body p { margin: 0 0 1.1rem; font-size: 0.98rem; max-width: 52ch; }
.history-entry .btn-primary { pointer-events: none; }

@media (min-width: 700px) {
  .history-entry { display: flex; align-items: stretch; }
  .history-entry-visual { aspect-ratio: auto; width: 42%; flex-shrink: 0; }
  .history-entry-body { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; padding: 1.75rem 2rem; }
}

/* ============================================================
   Reusable components for archival/military-flavored stories
   (first used by the August Schild Jr. / 376th BG story, built
   to be reused by any future story with a similar "exhibit,
   not a war game" visual language).
   ============================================================ */

/* ---------- Dark section wrapper, for cinematic light/dark rhythm ---------- */
.section-dark {
  background: var(--charcoal);
  color: var(--cream-soft);
}
.section-dark h2, .section-dark h3 { color: var(--cream); }
.section-dark p { color: var(--cream-soft); }
.section-dark .h-story-section-inner { max-width: var(--max-width); margin: 0 auto; padding: 2.75rem 1.5rem; }
@media (min-width: 760px) { .section-dark .h-story-section-inner { padding: 3.5rem 2rem; } }

/* ---------- Unit badge (small pill, e.g. "513th BS", "The Liberandos") ---------- */
.h-unit-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--brass);
  color: var(--brass-on-dark);
  background: rgba(169, 129, 47, 0.1);
}
.h-unit-badge + .h-unit-badge { margin-left: 0.4rem; }
.h-unit-badge-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 0; }

/* ---------- Stat row (e.g. 451 missions · 4 squadrons · B-24 Liberator) ---------- */
.h-stat-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem 1rem;
  margin: 1.75rem 0 0;
  max-width: 640px;
}
.h-stat-num {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  color: var(--brass-on-dark);
  line-height: 1.1;
}
.h-stat-label { display: block; font-size: 0.82rem; color: var(--cream-faint); margin-top: 0.3rem; }
@media (min-width: 600px) { .h-stat-row { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Military personnel card ---------- */
.h-mil-card {
  background: var(--charcoal-soft);
  border: 1px solid var(--charcoal-line);
  border-left: 3px solid var(--brass);
  border-radius: 4px;
  padding: 1.5rem 1.5rem 1.6rem;
  max-width: 560px;
  margin: 1.75rem 0 0;
}
.h-mil-card-rank {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-on-dark);
  margin: 0 0 0.4rem;
}
.h-mil-card-name {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 3.5vw, 1.6rem);
  color: var(--cream);
  margin: 0 0 1.1rem;
  line-height: 1.25;
}
.h-mil-facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin: 0;
}
.h-mil-facts dt { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brass-on-dark); }
.h-mil-facts dd { margin: 0.15rem 0 0; font-size: 0.95rem; color: var(--cream-soft); }
@media (min-width: 540px) { .h-mil-facts { grid-template-columns: 1fr 1fr; } }

/* ---------- Crew position diagram (native <details>, no JS needed) ---------- */
.h-crew-diagram {
  border: 1px solid var(--charcoal-line);
  border-radius: 4px;
  background: var(--charcoal-soft);
  padding: 0;
  margin: 1.75rem 0 0;
  max-width: 640px;
}
.h-crew-diagram > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 44px;
  padding: 0.9rem 1.1rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--cream);
}
.h-crew-diagram > summary::-webkit-details-marker { display: none; }
.h-crew-diagram > summary::after { content: "+"; font-size: 1.3rem; color: var(--brass-on-dark); flex-shrink: 0; }
.h-crew-diagram[open] > summary::after { content: "\2212"; }
.h-crew-diagram-body { padding: 0.25rem 1.1rem 1.35rem; }
.h-crew-diagram-body svg { width: 100%; height: auto; display: block; }
.h-crew-diagram-caption { font-size: 0.82rem; color: var(--cream-faint); margin: 0.85rem 0 0; max-width: 60ch; }

/* ---------- Route / theater map: reuses .h-place-map's dark frame ---------- */
.h-route-legend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  max-width: 560px;
}
.h-route-legend li { display: flex; align-items: center; gap: 0.6rem; }
.h-route-legend .h-route-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--burgundy); flex-shrink: 0; }
.h-route-legend a { display: inline-flex; align-items: center; min-height: 44px; }
