:root {
  --history-rail-width: 108px;
}

.history-bar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--history-rail-width, 108px);
  padding: 96px 0 32px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.88));
  backdrop-filter: blur(12px);
  border-right: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 6px 0 22px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  z-index: 40;
}

.history-bar__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 24px;
}

.history-bar__item {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-bar__link {
  position: relative;
  display: inline-flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.16);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.history-bar__link:focus-visible,
.history-bar__link:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 36px rgba(15, 23, 42, 0.2);
}

.history-bar__link img {
  display: block;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 6px;
  border-radius: 50%;
  object-fit: contain;
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  box-shadow: inset 0 1px 3px rgba(148, 163, 184, 0.18);
  transition: transform 160ms ease;
}
.history-bar__link:hover img,
.history-bar__link:focus-visible img {
  transform: scale(0.97);
}

body.has-history .site-header,
body.has-history .site-main {
  margin-left: var(--history-rail-width, 108px);
}

body.has-history .nav-drawer {
  left: var(--history-rail-width, 108px);
  width: calc(100% - var(--history-rail-width, 108px));
}

body[data-theme="dark"] .history-bar {
  background: linear-gradient(180deg,
      color-mix(in srgb, var(--surface-card) 94%, var(--surface-page)) 0%,
      color-mix(in srgb, var(--surface-muted) 86%, var(--surface-page)) 100%);
  border-right: 1px solid var(--surface-border);
  box-shadow: 6px 0 22px color-mix(in srgb, var(--scrim-color) 65%, rgba(0, 0, 0, 0.15));
}

body[data-theme="dark"] .history-bar__link {
  background: #fff;
  border-color: var(--surface-border);
  box-shadow: 0 18px 32px color-mix(in srgb, var(--scrim-color) 55%, rgba(0, 0, 0, 0.25));
}

body[data-theme="dark"] .history-bar__link:hover,
body[data-theme="dark"] .history-bar__link:focus-visible {
  box-shadow: 0 22px 36px color-mix(in srgb, var(--theme-accent) 25%, rgba(0, 0, 0, 0.35));
}

body[data-theme="dark"] .history-bar__link img {
  background: #fff;
  box-shadow: inset 0 1px 3px color-mix(in srgb, var(--color-outline) 35%, transparent);
}

@media (max-width: 1024px) {
  .history-bar {
    display: none;
  }
  body.has-history .site-header,
  body.has-history .site-main,
  body.has-history .nav-drawer {
    margin-left: 0;
    left: 0;
    width: 100%;
  }
}
