.history-panel__trigger {
  appearance: none;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, .08);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.history-panel__trigger > span:first-child {
  display: grid;
  gap: 8px;
}

.history-panel__trigger strong {
  color: #fff;
  font-size: 1.1rem;
}

.history-panel__trigger > span > span {
  color: var(--muted);
  line-height: 1.65;
}

.history-panel__trigger:hover,
.history-panel__trigger:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(200, 162, 59, .5);
  background: linear-gradient(180deg, rgba(200, 162, 59, .08), rgba(13, 13, 13, .98));
}

.history-panel__trigger:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 3px;
}

.history-panel__arrow {
  flex: 0 0 auto;
  color: var(--gold-soft);
  font-size: 1.5rem;
  transition: transform .2s ease;
}

.history-panel__trigger:hover .history-panel__arrow,
.history-panel__trigger:focus-visible .history-panel__arrow {
  transform: translateX(4px);
}

dialog.history-modal {
  width: min(1040px, calc(100vw - 32px));
  max-width: 1040px;
  height: min(92vh, 1040px);
  max-height: min(92vh, 1040px);
}

dialog.history-modal .history-modal__card {
  position: relative;
  background:
    radial-gradient(circle at 85% 0%, rgba(159, 23, 23, .16), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 28%),
    #090707;
}

dialog.history-modal .history-modal__body {
  display: flex;
  min-height: 0;
  overflow: hidden;
  padding: 20px clamp(16px, 3vw, 30px) 18px;
}

.history-modal__step[hidden] {
  display: none;
}

.history-modal__step {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.history-modal__intro {
  flex: 0 0 auto;
  margin-bottom: 14px;
}

.history-modal__intro h3 {
  margin: 0 0 4px;
  color: #fff;
  font-size: clamp(1.25rem, 2.3vw, 1.7rem);
}

.history-modal__intro h3 span {
  margin-right: 8px;
  color: var(--gold-soft);
  font-size: .72em;
}

.history-modal__intro p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.history-browser {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(210px, 28%) 1fr;
  border: 1px solid rgba(255, 255, 255, .09);
  background: rgba(255, 255, 255, .018);
}

.history-browser__index,
.history-browser__reader {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(200, 162, 59, .75) rgba(255, 255, 255, .04);
}

.history-browser__index {
  border-right: 1px solid rgba(255, 255, 255, .08);
  background: rgba(0, 0, 0, .18);
}

.history-browser__index-button {
  appearance: none;
  width: 100%;
  display: block;
  padding: 13px 14px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .065);
  background: transparent;
  color: #ccc;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}

.history-browser__index-button span,
.history-browser__index-button strong {
  display: block;
}

.history-browser__index-button span {
  margin-bottom: 4px;
  color: var(--gold-soft);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.history-browser__index-button strong {
  font-size: .9rem;
  line-height: 1.35;
}

.history-browser__index-button:hover,
.history-browser__index-button:focus-visible,
.history-browser__index-button.is-active {
  background: rgba(200, 162, 59, .105);
  color: #fff;
}

.history-browser__index-button:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: -3px;
}

.history-browser__reader {
  padding: clamp(18px, 3vw, 30px);
}

.history-entry[hidden] {
  display: none;
}

.history-entry__header {
  margin-bottom: 18px;
}

.history-entry__header .history-entry__era {
  margin: 0 0 5px;
  color: var(--gold-soft);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.history-entry__title {
  margin: 0;
  color: #fff;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  line-height: 1.14;
}

.history-entry__body {
  display: grid;
  gap: 18px;
}

.history-entry__image {
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  background: #050505;
  border: 1px solid rgba(255, 255, 255, .08);
}

.history-entry__copy {
  color: #d6d6d6;
  line-height: 1.78;
}

.history-entry__copy p {
  margin: 0 0 14px;
}

.history-entry__copy p:last-child {
  margin-bottom: 0;
}

.history-entry__credit {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  color: #aaa;
  font-size: .88rem;
}

.history-entry__credit a {
  color: var(--gold-soft);
}

.history-archive__empty {
  flex: 1 1 auto;
  padding: 28px;
  border: 1px dashed rgba(255, 255, 255, .14);
  color: var(--muted);
  text-align: center;
}

.history-modal__nav {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.history-modal__nav--split {
  justify-content: space-between;
}

.history-contribution-form {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.history-contribution-form__fields {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(200, 162, 59, .75) rgba(255, 255, 255, .04);
}

.history-contribution-form small {
  color: #9e9e9e;
  line-height: 1.5;
}

.history-contribution-form__consent {
  grid-template-columns: auto 1fr !important;
  align-items: start;
  gap: 12px !important;
  color: #d2d2d2;
  line-height: 1.55;
}

.history-contribution-form__consent input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--gold-soft);
}

.history-contribution-form__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

#historyContributionStatus.form-status {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, .1);
}

#historyContributionStatus.form-status--success {
  color: #c7f6ce;
  background: rgba(43, 135, 62, .16);
  border-color: rgba(76, 181, 95, .35);
}

#historyContributionStatus.form-status--error {
  color: #ffd0d0;
  background: rgba(159, 23, 23, .17);
  border-color: rgba(224, 75, 75, .35);
}

@media (max-width: 720px) {
  dialog.history-modal {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
  }

  dialog.history-modal .modal__header {
    padding: 13px 14px;
  }

  dialog.history-modal .modal__header h2 {
    font-size: 1.35rem;
  }

  dialog.history-modal .history-modal__body {
    padding: 12px 10px 10px;
  }

  .history-modal__intro {
    margin-bottom: 9px;
  }

  .history-modal__intro h3 {
    margin-bottom: 2px;
    font-size: 1.08rem;
  }

  .history-modal__intro p:last-child {
    font-size: .82rem;
    line-height: 1.35;
  }

  .history-browser {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .history-browser__index {
    display: flex;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    scrollbar-width: thin;
  }

  .history-browser__index-button {
    flex: 0 0 min(210px, 70vw);
    padding: 9px 11px;
    border-right: 1px solid rgba(255, 255, 255, .065);
    border-bottom: 0;
  }

  .history-browser__index-button span {
    margin-bottom: 2px;
    font-size: .62rem;
  }

  .history-browser__index-button strong {
    overflow: hidden;
    font-size: .82rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .history-browser__reader {
    padding: 15px;
  }

  .history-entry__header {
    margin-bottom: 12px;
  }

  .history-entry__title {
    font-size: 1.28rem;
  }

  .history-entry__body {
    gap: 13px;
  }

  .history-entry__copy {
    font-size: .93rem;
    line-height: 1.65;
  }

  .history-modal__nav,
  .history-modal__nav--split {
    gap: 8px;
    margin-top: 9px;
    padding-top: 9px;
  }

  .history-modal__nav .btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 10px 8px;
    font-size: .8rem;
    line-height: 1.2;
  }

  .history-contribution-form__fields {
    padding-right: 3px;
  }
}
