.download-note > p.download-version {
  display: inline-block;
}

.update-history {
  z-index: 8;
  display: inline-block;
  position: relative;
  margin-left: 0.65rem;
  font-family: var(--sans);
}

.update-history > summary {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #e0c983;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  list-style: none;
  text-underline-offset: 0.22em;
}

.update-history > summary::-webkit-details-marker {
  display: none;
}

.update-history > summary::after {
  content: "＋";
  font-family: serif;
  font-size: 0.9rem;
}

.update-history[open] > summary::after {
  content: "－";
}

.update-history > summary:hover,
.update-history > summary:focus-visible {
  color: #fff2c7;
  text-decoration: underline;
}

.update-history > summary:focus-visible {
  outline: 2px solid #e0c983;
  outline-offset: 3px;
}

.update-history > .update-history-popover {
  width: min(650px, calc(100vw - 4rem));
  max-height: min(70vh, 720px);
  overflow: auto;
  position: absolute;
  top: calc(100% + 0.35rem);
  right: -1rem;
  display: block;
  padding: 1.25rem 1.35rem 1.35rem;
  color: #332b20;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0 1.85rem,
      rgb(94 72 39 / 8%) 1.85rem calc(1.85rem + 1px)
    ),
    #efe1c1;
  border: 1px solid #806a45;
  box-shadow: 10px 14px 28px rgb(22 16 9 / 36%);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.35rem);
  pointer-events: none;
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    visibility 140ms ease;
}

.update-history:hover > .update-history-popover,
.update-history:focus-within > .update-history-popover,
.update-history[open] > .update-history-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.update-history-popover h3 {
  margin: 0 0 0.9rem;
  color: #74422f;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
}

.update-history-entry {
  padding: 0.85rem 0;
  border-top: 1px dashed rgb(74 55 31 / 34%);
}

.update-history-version {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.7rem;
  margin: 0;
  font-size: 0.8rem;
}

.update-history-version time {
  color: #69583e;
  font-family: "Courier New", monospace;
}

.update-history-version strong {
  color: #873f2d;
  font-size: 0.88rem;
}

.update-history-version span {
  color: #554832;
  font-weight: 700;
}

.update-history-entry ul {
  display: grid;
  gap: 0.3rem;
  margin: 0.65rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.78rem;
  line-height: 1.65;
}

.update-history-entry li::marker {
  color: #9b5b3f;
}

.update-history-entry li.is-critical {
  color: #743426;
  font-weight: 700;
}

.update-history-release {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  margin: 0;
  padding-top: 0.85rem;
  border-top: 1px dashed rgb(74 55 31 / 34%);
  color: #554832;
  font-size: 0.8rem;
}

.update-history-release time {
  font-family: "Courier New", monospace;
}

.update-history-release strong {
  color: #873f2d;
}

@media (max-width: 760px) {
  .download-note > p.download-version {
    display: block;
  }

  .update-history {
    display: block;
    margin: 0.25rem 0 0;
  }

  .update-history > .update-history-popover {
    width: 100%;
    max-height: none;
    position: relative;
    top: auto;
    right: auto;
    display: none;
    margin-top: 0.35rem;
    padding: 1rem;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
  }

  .update-history[open] > .update-history-popover {
    display: block;
  }

  .update-history-entry ul {
    font-size: 0.84rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .update-history > .update-history-popover {
    transition: none;
  }
}

/* update-history desktop viewport fit */
@media (min-width: 761px) {
  .update-history > .update-history-popover {
    max-height: min(42vh, 500px);
  }
}
