/* ============================================================================
   History & Heritage Series — "Dispatches from the Mighty Eighth"
   Period typed-dispatch look, ported from the v10 print builder to the web.
   Depends on tokens in colors_and_type.css. Loads Special Elite (body) +
   Marcellus SC (Copperplate small-caps stand-in for the letterhead).
   "We refuse the second death." A Plume & Parchment publication.
   ========================================================================== */

/* ---- Series intro (navy, reuses .page-intro voice) --------------------- */
.hh-intro-lede {
  font-family: var(--echo-serif); font-size: 20px; line-height: 1.6;
  color: rgba(247, 241, 228, 0.9); margin: 16px 0 0; max-width: 680px;
}

/* ---- Archive grid of dispatch cards ------------------------------------ */
.dispatch-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.d-card {
  display: flex; flex-direction: column; background: var(--echo-surface);
  border: 1px solid var(--echo-border); border-radius: 8px; overflow: hidden;
  box-shadow: var(--echo-shadow); text-decoration: none; color: inherit;
  transition: box-shadow var(--echo-dur) var(--echo-ease), transform var(--echo-dur) var(--echo-ease);
}
.d-card:hover { box-shadow: var(--echo-shadow-lg); transform: translateY(-2px); }
.d-card .thumb { aspect-ratio: 16 / 9; background: #0c0b09; overflow: hidden; }
.d-card .thumb img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); }
/* photoless dispatches: emblem on navy instead of a broken image */
.d-card .thumb.empty { display: flex; align-items: center; justify-content: center; background: var(--echo-navy); }
.d-card .thumb.empty img { width: auto; height: 52%; object-fit: contain; filter: none; opacity: 0.9; }
.d-card .d-card-body { padding: 20px 24px 26px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.d-card .d-ref { font-family: var(--echo-stamp); font-size: 11px; letter-spacing: .04em; color: var(--echo-fg-3); margin: 0; }
/* Two-date block — makes the two distinct dates unmistakable */
.d-dates { display: flex; border: 1px solid var(--echo-border); border-radius: 6px; overflow: hidden; }
.d-date { flex: 1; padding: 8px 13px; min-width: 0; }
.d-date + .d-date { border-left: 1px solid var(--echo-border); }
.d-date-lbl { display: block; font-family: var(--echo-sans); font-weight: 700; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 4px; }
.d-date.dispatch .d-date-lbl { color: var(--echo-fg-3); }
.d-date.event .d-date-lbl { color: var(--echo-gold-deep); }
.d-date-val { display: block; font-family: var(--echo-stamp); font-size: 15px; color: var(--echo-ink); line-height: 1.2; }
.d-card h3 { font-family: var(--echo-serif); font-weight: 500; font-size: 21px; line-height: 1.25; color: var(--echo-ink); margin: 0; }
.d-card .d-event { font-family: var(--echo-sans); font-weight: 700; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--echo-gold-deep); margin: 0; }
.d-card .d-ex { font-family: var(--echo-sans); font-size: 14.5px; line-height: 1.55; color: var(--echo-fg-2); margin: 0; }
.d-card .d-more { font-family: var(--echo-sans); font-weight: 600; font-size: 14px; color: var(--echo-link); margin-top: auto; }

/* ============================================================================
   THE DISPATCH SHEET
   ========================================================================== */
.dispatch-ground {
  background: #e7ddc7;
  background-image:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 252, 244, 0.5), rgba(0, 0, 0, 0) 60%),
    radial-gradient(140% 120% at 50% 120%, rgba(60, 48, 28, 0.16), rgba(0, 0, 0, 0) 55%);
  padding: 44px 20px 72px;
}
.dispatch-back { max-width: 1080px; margin: 0 auto 22px; }
.dispatch-back a {
  font-family: var(--echo-sans); font-weight: 700; font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase; color: #5a4c30; text-decoration: none;
}
.dispatch-back a:hover { color: #171206; }

.sheet {
  position: relative; max-width: 1080px; margin: 0 auto;
  background: #ece3cf; color: #171206;
  border: 1.4px solid #4a3e28; padding: 48px 60px 40px;
  box-shadow: 0 18px 48px rgba(40, 30, 12, 0.32), inset 0 0 42px rgba(70, 55, 30, 0.16);
}
.sheet::before { content: ""; position: absolute; inset: 4px; border: 0.5px solid #6a5a3c; pointer-events: none; }

/* ---- Letterhead: seal column | centered text | spacer ------------------ */
/* seal column stretches to the full height of the centered text block */
.lh { display: flex; align-items: stretch; }
.lh .seal { flex: 0 0 116px; display: flex; align-items: center; }
.lh .seal img { height: 100%; width: auto; max-width: 100%; object-fit: contain; display: block; }
.lh .spacer { flex: 0 0 116px; }
.lh .txt { flex: 1; text-align: center; }
.lh .l1 { font-family: 'Marcellus SC', serif; font-size: 23px; letter-spacing: .01em; color: #120e07; line-height: 1.06; }
.lh .l2 { font-family: 'Marcellus SC', serif; font-size: 14.5px; letter-spacing: .01em; color: #161109; margin-top: 6px; }
.lh .l3 { font-family: 'Marcellus SC', serif; font-size: 12px; letter-spacing: .02em; color: #2c2418; margin-top: 3px; }
.lhrule { border: 0; border-top: 0.8px solid #2b2218; margin: 15px 0 0; }

/* ---- Boxed form fields: engraved label + typed value ------------------- */
.ftbl { width: 100%; border-collapse: collapse; margin-top: 18px; table-layout: fixed; }
.ftbl td { border: 0.8px solid #5a4c33; padding: 6px 10px 8px; vertical-align: top; }
.fl { font-family: 'Marcellus SC', serif; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #33291a; }
.fv { font-family: var(--echo-stamp); font-size: 18.5px; color: #171206; margin-top: 4px; line-height: 1.3; }

/* ---- Typed body -------------------------------------------------------- */
.d-body { font-family: var(--echo-stamp); font-size: 18.5px; line-height: 1.8; color: #171206; margin-top: 24px; text-align: left; }
.d-body p { margin: 0 0 14px; }
.d-body u { text-decoration: underline; text-underline-offset: 2px; }
.d-body em { font-style: italic; }

/* ---- Taped photos (tape centered on the frame corners) ----------------- */
.photo { position: relative; width: 66.667%; max-width: 66.667%; margin: 30px auto 38px; }
.photo .frame { position: relative; border: 7px solid #f4efe2; background: #0c0b09; box-shadow: 0 4px 12px rgba(20, 12, 0, 0.45); }
.photo .frame img { display: block; width: 100%; height: auto; filter: grayscale(1); }
.photo .cap { font-family: var(--echo-stamp); font-size: 14px; line-height: 1.45; color: #221d14; text-align: center; padding: 9px 6px 0; font-style: italic; }
.tape {
  position: absolute; width: 74px; height: 22px; z-index: 6;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.05)), rgba(210, 199, 164, 0.6);
  border-left: 0.5px solid rgba(120, 108, 76, 0.4); border-right: 0.5px solid rgba(120, 108, 76, 0.4);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.tape.tl { top: -11px; left: -37px; transform: rotate(-45deg); }
.tape.br { bottom: -11px; right: -37px; transform: rotate(-45deg); }
.photo.r1 { transform: rotate(-2deg); }
.photo.r2 { transform: rotate(2.5deg); }
.photo.r3 { transform: rotate(-2.5deg); }
.photo.r4 { transform: rotate(2deg); }

/* ---- Closing: mottos + signature --------------------------------------- */
.d-close { font-family: var(--echo-stamp); font-size: 18.5px; line-height: 1.8; color: #171206; }
.d-close .motto { font-style: italic; margin: 18px 0 0; }
.sig { font-family: var(--echo-stamp); font-size: 18.5px; color: #171206; line-height: 1.55; margin-top: 26px; padding-left: 48%; }
.sig .sl { letter-spacing: .18em; }
.sigblock { font-family: var(--echo-stamp); font-size: 15px; line-height: 1.55; color: #2a2316; margin-top: 22px; }
.d-copyright { font-family: var(--echo-stamp); font-size: 14px; color: #43381f; margin-top: 32px; }

/* ---- Footer (outside the border) --------------------------------------- */
.d-foot { max-width: 1080px; margin: 16px auto 0; }
.d-foot .fr { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.d-foot .fr span { font-family: 'Marcellus SC', serif; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #43381f; }

/* ---- "Filed under" index block below a dispatch (Subjects / People / Places) ---- */
.d-file { max-width: 1080px; margin: 24px auto 0; border: 1px solid #cdbf9c; border-radius: 8px; background: rgba(255, 255, 255, 0.32); padding: 20px 24px; }
.d-file-head { font-family: var(--echo-sans); font-weight: 700; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: #5a4c30; margin: 0 0 14px; }
.d-file-row { display: flex; gap: 16px; align-items: baseline; padding: 11px 0; border-top: 1px solid #ddd0b0; }
.d-file-row:first-of-type { border-top: 0; padding-top: 0; }
.d-file-lbl { flex: 0 0 78px; font-family: var(--echo-sans); font-weight: 700; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #7a6a48; padding-top: 6px; }
.d-file-vals { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
@media (max-width: 560px) { .d-file-row { flex-direction: column; gap: 8px; } .d-file-lbl { flex: none; } }
.tag-chip {
  font-family: var(--echo-sans); font-weight: 600; font-size: 12.5px; line-height: 1;
  color: #3a2f1c; background: rgba(252, 219, 28, 0.16); border: 1px solid rgba(74, 62, 40, 0.35);
  border-radius: 999px; padding: 7px 13px; text-decoration: none; cursor: pointer;
  transition: background var(--echo-dur) var(--echo-ease), border-color var(--echo-dur) var(--echo-ease);
}
.tag-chip:hover { background: rgba(252, 219, 28, 0.34); border-color: #4a3e28; color: #1f1810; }

/* ============================================================================
   ARCHIVE / "VIEW ALL" — filter, sort, paginate
   ========================================================================== */
/* Toolbar: date filters stacked on the left, sort + per-page out to the right */
.hh-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px 40px; align-items: flex-start; }
.hh-dates { display: flex; flex-direction: column; gap: 16px; }
.hh-opts { display: flex; flex-wrap: wrap; gap: 16px 22px; align-items: flex-start; }
.hh-field { display: flex; flex-direction: column; gap: 6px; }
.hh-field > label,
.hh-fieldset > legend { font-family: var(--echo-sans); font-weight: 700; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--echo-gold-deep); padding: 0; }
.hh-input, .hh-select {
  font-family: var(--echo-sans); font-size: 14px; color: var(--echo-ink);
  background: var(--echo-surface); border: 1px solid var(--echo-border); border-radius: 6px;
  padding: 9px 11px; min-height: 40px;
}
.hh-input:focus, .hh-select:focus { outline: 2px solid var(--echo-gold); outline-offset: 1px; }
.hh-range { display: flex; align-items: center; gap: 8px; }
.hh-range span { font-family: var(--echo-sans); font-size: 13px; color: var(--echo-fg-2); }
.hh-range .hh-input { min-width: 0; width: 100%; }

.hh-fieldset { border: 0; padding: 0; margin: 0; }
.hh-facet { margin-top: 20px; }

/* Person + location autocomplete filters */
.hh-acrow { display: flex; flex-wrap: wrap; gap: 16px 28px; margin-top: 18px; }
.hh-ac { min-width: 260px; }
@media (max-width: 760px) { .hh-acrow { flex-direction: column; gap: 16px; } .hh-ac { min-width: 0; width: 100%; } }

/* Reimagined tag filter: a dropdown to add tags, removable chips, AND/OR toggle */
.hh-tagpicker-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 10px; }
.hh-tagselect { min-width: 240px; }
/* Custom scrollable dropdown: opens the full list on tap, narrows as you type */
.hh-combo { position: relative; flex: 0 1 320px; min-width: 240px; }
.hh-combo .hh-input { width: 100%; }
.hh-options {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
  list-style: none; margin: 0; padding: 4px;
  max-height: 244px; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--echo-surface); border: 1px solid var(--echo-border);
  border-radius: 8px; box-shadow: var(--echo-shadow-lg);
}
.hh-options[hidden] { display: none; }
.hh-options li {
  font-family: var(--echo-sans); font-size: 14px; color: var(--echo-ink);
  padding: 10px 12px; border-radius: 5px; cursor: pointer; line-height: 1.3;
}
.hh-options li.active, .hh-options li:hover { background: rgba(252, 219, 28, 0.30); }
.hh-options .hh-noopt { color: var(--echo-fg-3); font-style: italic; cursor: default; }
.hh-options .hh-noopt:hover { background: transparent; }
.hh-match { display: inline-flex; align-items: center; gap: 8px; }
.hh-match[hidden] { display: none; }
.hh-match-lbl { font-family: var(--echo-sans); font-weight: 600; font-size: 13px; color: var(--echo-fg-2); }
.hh-seg { display: inline-flex; border: 1px solid var(--echo-border); border-radius: 999px; overflow: hidden; background: var(--echo-surface); }
.hh-seg button { font-family: var(--echo-sans); font-weight: 600; font-size: 13px; color: var(--echo-fg-2); background: transparent; border: 0; padding: 8px 16px; cursor: pointer; transition: background var(--echo-dur) var(--echo-ease), color var(--echo-dur) var(--echo-ease); }
.hh-seg button + button { border-left: 1px solid var(--echo-border); }
.hh-seg button.active { background: var(--echo-navy); color: #fff; }
.hh-match-hint { font-family: var(--echo-sans); font-size: 12.5px; color: var(--echo-fg-3); }
.hh-selected-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hh-selected-tags:empty { display: none; }
.tag-chip.removable { display: inline-flex; align-items: center; gap: 9px; background: var(--echo-gold); border-color: var(--echo-gold-deep); color: var(--echo-navy); }
.tag-chip.removable .x { font-weight: 700; font-size: 15px; line-height: 1; opacity: 0.65; }
.tag-chip.removable:hover { background: #e9c916; }
.tag-chip.removable:hover .x { opacity: 1; }

.hh-controls {
  background: var(--echo-surface); border: 1px solid var(--echo-border); border-radius: 10px;
  box-shadow: var(--echo-shadow); padding: 24px 26px; margin-bottom: 28px;
}
.hh-controls-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--echo-border); }
.hh-count { font-family: var(--echo-sans); font-size: 14px; color: var(--echo-fg-2); }
.hh-count strong { color: var(--echo-ink); font-weight: 700; }
.hh-clear { font-family: var(--echo-sans); font-weight: 600; font-size: 14px; color: var(--echo-link); background: none; border: 0; cursor: pointer; padding: 0; }
.hh-clear:hover { color: var(--echo-link-hover); }

.hh-empty { font-family: var(--echo-serif); font-size: 19px; color: var(--echo-fg-2); text-align: center; padding: 48px 0; }

/* Pagination */
.hh-pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 36px; }
.hh-pager button {
  font-family: var(--echo-sans); font-weight: 600; font-size: 14px; color: var(--echo-ink);
  background: var(--echo-surface); border: 1px solid var(--echo-border); border-radius: 6px;
  min-width: 40px; height: 40px; padding: 0 12px; cursor: pointer;
  transition: background var(--echo-dur) var(--echo-ease), border-color var(--echo-dur) var(--echo-ease);
}
.hh-pager button:hover:not(:disabled) { background: var(--echo-paper-2); border-color: var(--echo-fg-3); }
.hh-pager button.active { background: var(--echo-navy); border-color: var(--echo-navy); color: #fff; }
.hh-pager button:disabled { opacity: 0.4; cursor: default; }
.hh-pager .hh-gap { color: var(--echo-fg-3); padding: 0 4px; }

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 900px) {
  .sheet { padding: 36px 36px 32px; }
}
@media (max-width: 760px) {
  .dispatch-grid { grid-template-columns: 1fr; }
  .hh-toolbar { flex-direction: column; align-items: stretch; gap: 18px; }
  .hh-dates, .hh-opts { width: 100%; }
  .hh-opts { flex-direction: column; }
  .hh-field { width: 100%; }
  .hh-tagselect { min-width: 0; width: 100%; }
  .historian { grid-template-columns: 1fr; gap: 22px; justify-items: start; }
  .historian-portrait img { max-width: 180px; }
}
@media (max-width: 560px) {
  .dispatch-ground { padding: 28px 12px 56px; }
  .sheet { padding: 26px 20px 26px; }
  .lh .seal { flex-basis: 74px; } .lh .spacer { flex-basis: 74px; }
  .lh .l1 { font-size: 17px; } .lh .l2 { font-size: 11.5px; } .lh .l3 { font-size: 10px; }
  .ftbl td { padding: 5px 7px 6px; } .fv { font-size: 17px; } .fl { font-size: 9.5px; }
  .d-body, .d-close { font-size: 17px; }
  .sig { padding-left: 30%; font-size: 17px; }
  .d-foot .fr { gap: 4px 12px; }
}

/* ============================================================================
   ABOUT THE HISTORIAN (landing) — portrait cutout + LinkedIn
   ========================================================================== */
.historian { display: grid; grid-template-columns: 220px 1fr; gap: 40px; align-items: center; }
.historian-portrait { position: relative; width: 220px; }
.historian-portrait img { width: 100%; display: block; }
/* soft shadow "platform" so a background-removed cutout sits on the paper */
.historian-portrait::after {
  content: ""; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%);
  width: 76%; height: 20px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(16, 20, 49, 0.20), rgba(16, 20, 49, 0));
}
.historian-name { font-family: var(--echo-serif); font-weight: 600; font-size: 25px; line-height: 1.15; color: var(--echo-ink); margin: 0 0 3px; }
.historian-role { font-family: var(--echo-sans); font-weight: 700; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--echo-gold-deep); margin: 0 0 16px; }
.historian-bio { font-family: var(--echo-serif); font-size: 18px; line-height: 1.6; color: var(--echo-ink); margin: 0; }
.linkedin-icon { display: inline-block; margin-top: 18px; line-height: 0; transition: opacity var(--echo-dur) var(--echo-ease); }
.linkedin-icon img { width: 30px; height: 30px; display: block; }
.linkedin-icon:hover { opacity: 0.72; }

/* ==========================================================================
   Share buttons — shared component (dispatch top/bottom, landing, archive)
   ========================================================================== */
.hh-share { display: inline-flex; align-items: center; gap: 14px; font-family: var(--echo-sans); flex-wrap: wrap; }
.hh-share-lbl { font-family: var(--echo-display); font-weight: 700; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; }
.hh-share-btns { display: inline-flex; gap: 10px; }
/* Gold-filled buttons with navy icons on BOTH grounds (gold ↔ navy has strong
   contrast either way; white-on-gold did not). Only the label colour changes. */
.hh-sbtn { width: 46px; height: 46px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--echo-gold); background: var(--echo-gold); color: var(--echo-navy); cursor: pointer; text-decoration: none; padding: 0;
  -webkit-appearance: none; appearance: none; box-shadow: 0 2px 8px rgba(16, 20, 49, 0.18);
  transition: background var(--echo-dur) var(--echo-ease), border-color var(--echo-dur) var(--echo-ease), color var(--echo-dur) var(--echo-ease); }
.hh-sbtn svg { width: 21px; height: 21px; }
.hh-sbtn:hover { background: var(--echo-navy); border-color: var(--echo-navy); color: var(--echo-gold); }
.hh-share.on-dark .hh-share-lbl { color: var(--echo-gold); }
.hh-share.on-light .hh-share-lbl { color: #6a5a38; }
.hh-share-blurb { font-family: var(--echo-serif); font-style: italic; font-size: 16px; color: #5a4c30; margin-right: auto; }

/* thank-you-subscribe: prominent "share the series" block inside the navy bar */
.tys-share { margin-top: 34px; padding-top: 28px; border-top: 1px solid rgba(247, 241, 228, 0.18);
  display: flex; flex-direction: column; align-items: center; gap: 16px; }
.tys-share-head { font-family: var(--echo-serif); font-style: italic; font-size: 20px; color: rgba(247, 241, 228, 0.92); margin: 0; }
.tys-share .hh-share { justify-content: center; }

/* dispatch TOP bookend — aligned to the 1080 content column, cluster to the right */
.d-share-top { max-width: 1080px; margin: 0 auto 22px; display: flex; justify-content: flex-end; }
/* dispatch BOTTOM bookend — inside the Filed-under card, above the chips */
.d-share-infiled { display: flex; align-items: center; justify-content: space-between; gap: 14px 24px; flex-wrap: wrap; width: 100%; margin: 0 0 16px; padding: 0 0 16px; border-bottom: 1px solid #ddd0b0; }

/* "Link copied" toast (Instagram on desktop) */
#hh-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
  background: var(--echo-navy); color: #F7F1E4; font-family: var(--echo-sans); font-size: 14px;
  padding: 12px 20px; border-radius: 8px; box-shadow: var(--echo-shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .2s var(--echo-ease), transform .2s var(--echo-ease); z-index: 9999; max-width: 90vw; text-align: center; }
#hh-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 560px) { .d-share-top { justify-content: flex-start; } .hh-share-blurb { margin-right: 0; flex-basis: 100%; } }
