:root {
  --bg: #efefef;
  --ink: #1f1f1f;
  --paper: #f6f6f6;
  --accent: #1f1f1f;
  --accent-soft: #d7d7d7;
  --line: #9c9c9c;
  --muted: #666666;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle, rgba(0, 0, 0, 0.14) 1px, transparent 1.1px),
    var(--bg);
  background-size: 14px 14px;
  font-family: "Space Grotesk", sans-serif;
}

.backdrop {
  display: none;
}

main {
  position: relative;
  z-index: 2;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1rem 2.5rem;
}

header {
  margin-bottom: 1.4rem;
  max-width: 900px;
}

.kicker {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 0.78rem;
}

h1 {
  margin: 0.1rem 0;
  font-family: "Spectral", serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

header p {
  margin-top: 0.45rem;
  max-width: 760px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  background: rgba(245, 245, 245, 0.9);
  border: 1px solid #b8b8b8;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.checkbox {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.92rem;
}

.controls label {
  font-weight: 500;
}

input[type="range"] {
  width: min(320px, 50vw);
}

button {
  background: #2a2a2a;
  color: #f3f3f3;
  border: 1px solid #2a2a2a;
  padding: 0.52rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.filters {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 1rem;
  margin-bottom: 0.8rem;
}

.filters-dropdown {
  background: rgba(245, 245, 245, 0.9);
  border: 1px solid #b8b8b8;
  border-radius: 10px;
  margin-bottom: 0.8rem;
  overflow: hidden;
}

.filters-dropdown summary {
  cursor: pointer;
  padding: 0.72rem 0.95rem;
  font-weight: 600;
  list-style: none;
}

.filters-dropdown summary::-webkit-details-marker {
  display: none;
}

.filters-dropdown[open] summary {
  border-bottom: 1px solid var(--line);
}

.filters {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.filters select {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.3rem 0.4rem;
  font-family: inherit;
}

.picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.picker-head button {
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 0.9rem;
  align-items: start;
}

.right-panel {
  position: sticky;
  top: 0.75rem;
  max-height: calc(100vh - 1.5rem);
  overflow-y: auto;
  background: rgba(245, 245, 245, 0.95);
  border: 1px solid #b8b8b8;
  border-radius: 10px;
  padding: 0.7rem;
}

.author-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.author-item {
  width: 100%;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 0.55rem;
  align-items: center;
  text-align: left;
  background: #f4f4f4;
  border: 1px solid #bdbdbd;
  border-radius: 8px;
  color: #232323;
  padding: 0.4rem 0.45rem;
}

.author-item.selected {
  border-color: #4b4b4b;
  box-shadow: inset 0 0 0 1px rgba(75, 75, 75, 0.2);
}

.author-item img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(35, 31, 28, 0.2);
}

.author-item-name {
  display: block;
  font-size: 0.83rem;
  font-weight: 700;
}

.author-item-meta {
  display: block;
  font-size: 0.67rem;
  line-height: 1.2;
  color: #614b37;
}

.timeline {
  border: 1px solid #b8b8b8;
  background: rgba(247, 247, 247, 0.95);
  border-radius: 10px;
  padding: 0.75rem 0.75rem 0.55rem;
}

.axis-shell {
  position: sticky;
  top: 0;
  z-index: 10;
  margin-bottom: 0.25rem;
}

.axis-window {
  overflow: hidden;
  border-bottom: 0;
  background: transparent;
  position: relative;
}

.axis-window::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 28px;
  top: 30px;
  border-top: 2px solid #7d7d7d;
}

.axis-window::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 24px;
  width: 12px;
  height: 12px;
  border-top: 2px solid #7d7d7d;
  border-right: 2px solid #7d7d7d;
  transform: rotate(45deg);
}

.axis {
  position: relative;
  height: 36px;
  will-change: transform;
}

.timeline-scroll {
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

.year-marker {
  position: absolute;
  top: 8px;
  transform: translateX(-50%);
  color: #6f6f6f;
  font-size: 0.72rem;
  white-space: nowrap;
}

.year-marker::before {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 15px;
  width: 1px;
  height: 14px;
  background: #9b9b9b;
}

.lane {
  position: relative;
  margin-top: 0.65rem;
  padding-top: 0.35rem;
}

.lane h2 {
  position: sticky;
  left: 0;
  margin: 0;
  width: fit-content;
  background: rgba(247, 247, 247, 0.9);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #595959;
  z-index: 3;
}

.lane-content {
  position: relative;
  min-height: 94px;
  border-top: 1px dashed rgba(110, 110, 110, 0.35);
  padding-top: 0.7rem;
}

#eventsContent {
  min-height: 460px;
}

.author-bar {
  position: absolute;
  height: 44px;
  border-radius: 6px;
  border: 2px solid rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.36rem 0.6rem;
  cursor: pointer;
  box-shadow: none;
  transition: none;
}

.author-bar:hover {
  filter: brightness(0.98);
}

.author-bar img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.22);
}

.author-bar strong {
  font-size: 0.82rem;
  font-weight: 600;
}

.author-bar span {
  font-size: 0.68rem;
  color: #2e2e2e;
}

.event {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transform: translateX(-50%);
  cursor: pointer;
  border: 0;
}

.event-link {
  display: block;
  text-decoration: none;
  padding: 0;
  margin: 0;
  color: inherit;
  background: transparent;
  line-height: 1;
}

.event-label {
  position: absolute;
  width: 124px;
  margin-left: 8px;
  font-size: 0.58rem;
  line-height: 1.2;
  color: #3b3b3b;
  pointer-events: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-stem {
  position: absolute;
  width: 1px;
  background: rgba(73, 57, 42, 0.25);
  pointer-events: none;
}

.event-link:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.event.play {
  background: #2f8d4f;
}

.event.global {
  background: #af3a2a;
}

.event.life {
  background: #2b5ba4;
}

#detailsModal {
  border: 1px solid var(--line);
  border-radius: 14px;
  max-width: min(640px, 92vw);
  padding: 0;
}

#eventModal {
  border: 1px solid var(--line);
  border-radius: 14px;
  max-width: min(680px, 94vw);
  padding: 0;
}

#detailsModal::backdrop {
  background: rgba(28, 17, 10, 0.5);
}

#eventModal::backdrop {
  background: rgba(28, 17, 10, 0.5);
}

#detailsModal article {
  padding: 1rem;
  background: var(--paper);
  position: relative;
}

#eventModal article {
  padding: 1rem;
  background: var(--paper);
  position: relative;
}

#detailsModal h3 {
  margin: 0.15rem 0;
  font-family: "Spectral", serif;
  font-size: 1.6rem;
}

#eventModal h3 {
  margin: 0.15rem 0;
  font-family: "Spectral", serif;
  font-size: 1.6rem;
}

.modal-head {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 0.85rem;
  align-items: start;
}

.modal-photo {
  width: 84px;
  height: 84px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(35, 31, 28, 0.2);
}

#detailsModal ul {
  margin: 0.6rem 0 0;
  padding-left: 1.1rem;
}

#detailsModal li {
  margin: 0.22rem 0;
}

#detailsModal a {
  color: #7b2e0f;
}

#eventModal a {
  color: #7b2e0f;
}

.hover-card {
  position: fixed;
  z-index: 40;
  max-width: min(340px, 90vw);
  pointer-events: none;
  background: #fff8ef;
  color: #2b221a;
  border: 1px solid rgba(35, 31, 28, 0.2);
  border-radius: 10px;
  padding: 0.48rem 0.58rem;
  font-size: 0.76rem;
  line-height: 1.35;
  box-shadow: 0 8px 22px rgba(15, 10, 5, 0.18);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.hover-card.show {
  opacity: 1;
  transform: translateY(0);
}

.hover-photo {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid rgba(35, 31, 28, 0.2);
  flex: 0 0 auto;
}

.hover-copy {
  min-width: 0;
}

.close {
  position: absolute;
  right: 0.65rem;
  top: 0.45rem;
  background: transparent;
  color: #5c4432;
  font-size: 1.45rem;
  line-height: 1;
  padding: 0;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .right-panel {
    position: static;
    max-height: none;
  }

  .author-bar {
    height: 56px;
    flex-direction: column;
    justify-content: center;
    gap: 0.18rem;
    text-align: center;
    padding: 0.35rem;
  }

  .author-bar img {
    width: 26px;
    height: 26px;
  }

  .author-bar strong {
    font-size: 0.72rem;
  }

  .author-bar span {
    font-size: 0.63rem;
  }

  #eventsContent {
    min-height: 560px;
  }

  .event-label {
    width: 98px;
    font-size: 0.58rem;
  }
}
