/* ===== History Overlay (robust; scoped by .history.hi-enhanced) ===== */
:root {
  --hi-card-bg: rgba(255,255,255,0.90); /* 70% opaque = 30% transparent */
  --hi-text: #000;
  --hi-border: rgba(0,0,0,.25);
  --hi-radius: 14px;
  --hi-gap: 16px;
}

body { background: #fff; }

/* Grid layout for rows (overrides legacy flex) */
.history.hi-enhanced .history-row {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0,1fr)) !important;
  gap: var(--hi-gap,16px) !important;
  align-items: start !important;
}
@media (max-width: 1024px) {
  .history.hi-enhanced .history-row { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
}
@media (max-width: 640px) {
  .history.hi-enhanced .history-row { grid-template-columns: 1fr !important; }
}

/* Collapsed card visuals */
.history.hi-enhanced .history-block {
  width: 90% !important;
  margin: 0 auto !important;
  background: transparent !important;
  border: 1px solid var(--hi-border, rgba(0,0,0,.25)) !important;
  border-radius: var(--hi-radius, 14px) !important;
  transform: rotateZ(-2deg);
  transition: transform .25s ease, box-shadow .25s ease;
  overflow: hidden;
  box-sizing: border-box;
}
.history.hi-enhanced .history-block:hover { transform: rotateZ(0deg) translateY(-2px); }

/* Year header = transparent, clickable */
.history.hi-enhanced .history-block__title {
  margin: 0 !important;
  padding: 12px 14px !important;
  background: transparent !important;
  color: var(--hi-text,#000) !important;
  font-weight: 800 !important;
  font-size: 18px !important;
  line-height: 1.2 !important;
  cursor: pointer !important;
  border-bottom: none !important;
}

/* Hide content in collapsed state */
.history.hi-enhanced .history-block > .history-block__content,
.history.hi-enhanced .history-block .history-block__paragraph,
.history.hi-enhanced .history-block .history-block__inner-block > .history-block__content,
.history.hi-enhanced .history-block .history-block__content * {
  display: none !important;
}

/* ===== Overlay ===== */
.hi-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.hi-overlay.is-open { display: flex; }

.hi-fly {
  position: absolute;
  background: var(--hi-card-bg);
  color: var(--hi-text);
  border: 1px solid var(--hi-border);
  border-radius: var(--hi-radius);
  box-shadow: 0 26px 60px rgba(0,0,0,.45);
  overflow: auto;
  transform-origin: center center;
  will-change: transform, width, height, top, left;
  max-width: min(1000px, 94vw);
}

/* Sticky transparent header inside overlay */
.hi-fly .history-block__title {
  position: sticky;
  top: 0;
  z-index: 2;
  background: transparent !important;
  color: var(--hi-text);
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0,0,0,.15);
  cursor: pointer;
}

/* Reveal all content in overlay */
.hi-fly .history-block__content,
.hi-fly .history-block__paragraph,
.hi-fly .history-block__inner-block > .history-block__content,
.hi-fly .history-block__content * {
  display: revert !important;
}

.hi-close {
  position: absolute;
  top: 10px; right: 12px;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(0,0,0,.35);
  color: #fff;
  font-size: 20px; font-weight: 700;
  cursor: pointer;
}
