/* simple & beginner-friendly */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;            /* only #wrap scrolls horizontally; #info scrolls internally */
  background: #0f0f10;
  color: #fff;
  font-family: Arial, sans-serif;
}

/* title */
#mainTitle {
  position: fixed;
  top: 12px;
  left: 16px;
  z-index: 5;
  margin: 0;
  padding: 6px 12px;
  font-weight: 800;
  letter-spacing: 2px;
  font-size: 28px;
  color: #fff;
  background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .8);
  pointer-events: none;
}

/* background image layer */
#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}
#bg::after {
  content: "";
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .55);
  opacity: 0; transition: .2s;
}
#bg.show::after { opacity: 1; }

/* timeline viewport */
#wrap {
  position: relative;
  z-index: 1;
  height: 100vh;
  width: 100vw;
  overflow-x: auto;
  overflow-y: hidden;
  cursor: grab;
  will-change: scroll-position;
}
#wrap.drag { cursor: grabbing; }

#canvas { position: relative; height: 100%; }

/* timeline line (left/width set by JS) */
#line {
  position: absolute;
  top: 50%;
  height: 4px;
  background: #fff;
  transform: translateY(-2px);
  box-shadow: 0 0 6px rgba(0, 0, 0, .9);
}

/* dots */
.dot {
  position: absolute;
  top: calc(50% - 10px);
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #fff;
  box-shadow: 0 0 0 7px rgba(0, 0, 0, 1);
  cursor: pointer;
}
.dot:hover::after {
  content: attr(data-name);
  position: absolute;
  top: -30px; left: 50%;
  transform: translateX(-50%);
  background: #1b1e26;
  color: #dcdff9;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #2b2f3a;
  font-size: 12px;
  white-space: nowrap;
}

/* === Backdrop + Sheet === */
#sheetBackdrop{
  position: fixed;
  inset: 0;
  z-index: 7;
  background: rgba(0,0,0,.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
#sheetBackdrop.show{
  opacity: 1;
  pointer-events: auto;
}

#info{
  position: fixed;
  z-index: 8;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 100%); /* start offscreen */
  width: min(1100px, 92vw);
  min-height: 10vh;
  max-height: 92vh;
  height: auto;
  box-sizing: border-box;
  overflow-y: auto;
  background: #151922;
  border: 1px solid #2b2f3a;
  border-radius: 16px 16px 0 0;
  padding: 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,.55);
  transition:
    transform .35s cubic-bezier(.22,.8,.25,1),
    opacity   .20s ease,
    height    .28s cubic-bezier(.22,.8,.25,1);
  opacity: 0;
  display: block;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}
#info.show{ transform: translate(-50%, 0); opacity: 1; }

#info.peek{
  height: 38vh;
  max-height: 38vh;
}
#info.full{
  height: 92vh;
  max-height: 92vh;
}

#sheetHandle{
  position: sticky;
  top: 0;
  display: block;
  height: 16px;
  margin: -8px 0 8px;
  pointer-events: none;
  background: transparent;
}
#sheetHandle::before{
  content: "";
  display: block;
  width: 48px; height: 5px;
  margin: 8px auto 0;
  background: #3a4152;
  border-radius: 999px;
  opacity: .9;
}

#title {
  margin: 0 36px 10px 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .2px;
}

#closeBtn {
  position: absolute;
  right: 8px; top: 8px;
  width: 28px; height: 28px;
  border: 1px solid #404656;
  background: #262b36;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
}
#closeBtn:hover { background: #313748; }

.row {
  display: grid;
  grid-template-columns: 1.2fr 1.8fr 1fr 1fr;
  gap: 10px;
}
.card {
  background: #0f131b;
  border: 1px solid #2b2f3a;
  border-radius: 10px;
  padding: 10px 12px;
}
.card h3 {
  margin: 0 0 6px;
  font-size: 12px;
  color: #9fb5ff;
  text-transform: uppercase;
}
.card p {
  margin: 0;
  color: #e8ebff;
  line-height: 1.5;
}

.divider{
  border: 0;
  border-top: 1px solid #2b2f3a;
  margin: 14px -2px 12px;
}

/* research */
.research h3{
  margin: 0 0 6px;
  font-size: 12px;
  color: #9fb5ff;
  text-transform: uppercase;
}
.research .muted{
  margin: 0 0 8px;
  color: #b8c4ff;
  opacity: .75;
  font-size: 13px;
}
.research .links{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.research .links a{
  display: inline-block;
  padding: 8px 10px;
  border: 1px solid #2b2f3a;
  background: #0f131b;
  color: #e8ebff;
  border-radius: 8px;
  font-size: 13px;
  text-decoration: none;
}
.research .links a:hover{ background:#151b25; }

/* summary paragraph */
.summary h3{
  margin: 0 0 8px;
  font-size: 12px;
  color: #9fb5ff;
  text-transform: uppercase;
}
#summaryText{
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  color: #e8ebff;
  max-width: 70ch;
  opacity: .95;
}

/* scroll hint */
.scrollHint{
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: #9fb5ff;
  padding: 10px 0 2px;
  background: linear-gradient(180deg, rgba(21,25,34,0) 0%, rgba(21,25,34,.85) 40%, rgba(21,25,34,1) 100%);
}
.scrollHint.hide{ display:none; }
.scrollHint .chev{
  font-size: 16px;
  animation: bounceDown 1.2s ease-in-out infinite;
  line-height: 1;
}
@keyframes bounceDown{
  0%, 100% { transform: translateY(0); opacity: .9; }
  50%      { transform: translateY(6px); opacity: .6; }
}

/* Optional: nicer scrollbar (WebKit) */
#info::-webkit-scrollbar{ width: 10px; }
#info::-webkit-scrollbar-track{ background: #0f131b; }
#info::-webkit-scrollbar-thumb{ background: #2b2f3a; border-radius: 10px; }
#info::-webkit-scrollbar-thumb:hover{ background: #3a4152; }

/* hint text */
#hint {
  position: fixed;
  left: 8px; bottom: 6px;
  z-index: 2;
  font-size: 12px;
  color: #9fb5ff;
  opacity: .85;
}

/* ticks */
.tick {
  position: absolute;
  width: 3px; height: 100px;
  top: calc(50% - 100px);
  background: #fff;
  transform: translateX(-1px);
  opacity: .9;
  z-index: 1;
  pointer-events: none;
}
.tick.down { top: 50%; height: 100px; }

.tickLabel {
  position: absolute;
  top: calc(50% - 150px);
  transform: translateX(-50%);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .9);
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
  padding: 4px 10px;
}
.tickLabel.down { top: calc(50% + 120px); }

/* small perf bump for transforms */
.tick, .tickLabel, .dot { will-change: transform; }

/* --- Search --- */
#searchWrap{
  position: fixed;
  top: 150px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;                 /* below sheet(8) and backdrop(7) */
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  transition: opacity .2s ease, filter .2s ease;
}
body.sheet-open #searchWrap{
  opacity: .12;
  filter: blur(1px);
  pointer-events: none;       /* no clicks while sheet is open */
}
#searchInput{
  width: min(560px, 70vw);
  padding: 10px 14px;
  font-size: 16px;
  color: #e8ebff;
  background: #141821;
  border: 1px solid #2b2f3a;
  border-radius: 10px;
  outline: none;
  box-shadow: 0 6px 16px rgba(0,0,0,.35);
}
#searchInput::placeholder{ color:#9fb5ff; opacity:.8; }

#searchList{
  list-style: none;
  margin: 0; padding: 6px 0;
  width: min(560px, 70vw);
  max-height: 280px;
  overflow-y: auto;
  background: #0f131b;
  border: 1px solid #2b2f3a;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0,0,0,.45);
  display: none;
}
#searchList.show{ display:block; }

#searchList li{
  padding: 8px 12px;
  cursor: pointer;
  color:#e8ebff;
  font-size: 14px;
  display: flex; gap: 8px; align-items: baseline;
}
#searchList li:hover{ background:#151b25; }
#searchList .when{ color:#9fb5ff; font-size:12px; }
#searchList .title{ flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* responsive */
@media (max-width:700px){
  #searchInput, #searchList{ width: 90vw; }
  .row{ grid-template-columns: 1fr; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce){
  #info, #sheetBackdrop{ transition: none; }
  .scrollHint .chev{ animation: none; }
}
