/* Timeline page: one vertical line, built for a thumb. Loads after site.css. */

.hero-words { grid-template-columns: minmax(0, 1fr); padding-bottom: 24px; }

.lede {
  margin: 0;
  max-width: 38em;
  font-size: 20px;
  font-weight: 500;
  color: var(--chalk-dim);
}

/* one colour per lane, shared by chips, dots and cards */
.lane-britain   { --lc: var(--c0); }
.lane-europe    { --lc: var(--c6); }
.lane-asia      { --lc: var(--c4); }
.lane-americas  { --lc: var(--c5); }
.lane-africa    { --lc: var(--c1); }
.lane-ideas     { --lc: var(--c2); }
.lane-mine      { --lc: var(--jot); }
.lane-monarchs  { --lc: #ffd27a; }
.lane-treaties  { --lc: #9fd0ff; }
.lane-battles   { --lc: #ff8a8a; }
.lane-dynasties { --lc: #ff9f8a; }
.lane-people    { --lc: var(--c3); }
.lane-art       { --lc: #c9a6ff; }
.lane-eras      { --lc: #b8e986; }
.lane-religions { --lc: #ffb3c7; }
.lane-marketing { --lc: #ffc96b; }
.lane-writing   { --lc: #8fe3ff; }

.ghost {
  font: inherit;
  font-weight: 700;
  color: var(--chalk);
  background: transparent;
  border: 2px solid rgba(255, 248, 236, 0.35);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
}

/* ---- lanes and layers ---- */

.tl-layers { margin: 0 0 8px; }

.tl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tl-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--chalk-dim);
  background: transparent;
  border: 2px solid rgba(255, 248, 236, 0.22);
  border-radius: 999px;
  padding: 5px 10px 5px 8px;
  min-height: 36px;
  cursor: pointer;
  transition: background-color 150ms, color 150ms, transform 180ms var(--spring);
}

.tl-chip:active { transform: scale(0.95); }
.tl-chip-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--lc); }
.tl-chip-n { font-size: 12px; opacity: 0.7; }
.tl-chip.is-on { background: var(--lc); color: var(--ink); border-color: transparent; }
.tl-chip.is-on .tl-chip-dot { background: var(--ink); border-color: var(--ink); }
.tl-chip:not(.is-on) { text-decoration: line-through; text-decoration-color: rgba(255, 248, 236, 0.4); }

.tl-jump {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0 0;
}

.tl-jump input {
  font: inherit;
  font-size: 16px; /* under 16px and iOS zooms the page on focus */
  font-weight: 600;
  color: var(--chalk);
  background: rgba(255, 248, 236, 0.1);
  border: 2px solid rgba(255, 248, 236, 0.35);
  border-radius: 999px;
  padding: 9px 16px;
  width: 170px;
}

.tl-jump input::placeholder { color: var(--chalk-dim); }
.tl-jump input:focus { outline: none; border-color: var(--jot); }
.list-count { margin: 0 0 0 auto; font-weight: 600; color: var(--chalk-dim); }

/* ---- the century rail: sticks to the top while you scroll ---- */

.tl-rail {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 14px calc(-1 * clamp(20px, 5vw, 72px)) 0;
  padding: 10px clamp(20px, 5vw, 72px);
  background: var(--wall-deep);
  border-bottom: 2px solid rgba(255, 248, 236, 0.14);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tl-rail::-webkit-scrollbar { display: none; }

.tl-rail-btn {
  flex: 0 0 auto;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--chalk);
  background: rgba(255, 248, 236, 0.1);
  border: 0;
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  transition: background-color 150ms, color 150ms, transform 200ms var(--spring);
}

.tl-rail-btn.is-on { background: var(--jot); color: var(--ink); transform: rotate(-2deg) scale(1.06); }

/* ---- the line ---- */

.tl-list {
  --spine: 13px;
  position: relative;
  list-style: none;
  margin: 0;
  padding: 8px 0 24px 38px;
}

.tl-list::before {
  content: "";
  position: absolute;
  left: var(--spine);
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px;
  background: repeating-linear-gradient(to bottom, rgba(255, 248, 236, 0.4) 0 10px, transparent 10px 18px);
}

.tl-century {
  position: relative;
  margin: 28px 0 16px;
  scroll-margin-top: 64px;
}

.tl-century:first-child { margin-top: 12px; }

.tl-century h2 {
  display: inline-block;
  margin: 0;
  font-family: "Permanent Marker", cursive;
  font-weight: 400;
  font-size: 34px;
  line-height: 1;
  color: var(--jot);
  transform: rotate(-2deg);
}

.tl-century::before {
  /* a big knot on the spine */
  content: "";
  position: absolute;
  left: calc(var(--spine) - 38px - 7px);
  top: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--jot);
  box-shadow: 0 0 0 5px var(--wall-deep);
}

.tl-gap {
  margin: 4px 0 14px;
  font-size: 13px;
  font-weight: 700;
  font-style: italic;
  color: var(--chalk-dim);
}

.tl-item {
  position: relative;
  margin: 0 0 14px;
  scroll-margin-top: 80px;
}

/* only the first screenful slides in; animating hundreds of cards at once is slow on a phone */
.tl-item:nth-child(-n+12) { animation: tl-in 420ms var(--spring) both; }

@keyframes tl-in {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: none; }
}

.tl-item::before {
  /* the dot on the spine */
  content: "";
  position: absolute;
  left: calc(var(--spine) - 38px - 4px);
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--lc);
  box-shadow: 0 0 0 4px var(--wall-deep);
}

.tl-item::after {
  /* the string from the dot to the card */
  content: "";
  position: absolute;
  left: calc(var(--spine) - 38px + 10px);
  top: 23px;
  width: 16px;
  height: 2px;
  background: var(--lc);
  opacity: 0.7;
}

.tl-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  align-items: baseline;
  width: 100%;
  min-height: 56px;
  padding: 10px 14px 11px;
  border: 0;
  border-radius: 4px 12px 12px 4px;
  border-left: 8px solid rgba(28, 20, 64, 0.28);
  background: var(--lc);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.25);
  transform: rotate(-0.5deg);
  transition: transform 260ms var(--spring), box-shadow 260ms;
  -webkit-tap-highlight-color: transparent;
}

.tl-item.odd .tl-card { transform: rotate(0.5deg); }
.tl-card:active { transform: scale(0.98); }
.tl-item.is-open .tl-card { transform: none; box-shadow: 5px 7px 0 rgba(0, 0, 0, 0.3); border-radius: 4px 12px 0 0; }

.tl-year {
  grid-column: 1 / -1;
  font-family: "Permanent Marker", cursive;
  font-size: 19px;
  line-height: 1.1;
}

.tl-title { font-size: 17px; font-weight: 800; line-height: 1.25; }

.tl-lane {
  align-self: end;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(28, 20, 64, 0.12);
}

/* layers are borrowed from other pages: paper cards with a coloured edge */
.tl-item.is-layer .tl-card { background: var(--chalk); border-left-color: var(--lc); }
.tl-item.is-layer .tl-lane { background: var(--lc); }
.tl-item.is-custom .tl-card { outline: 2px dashed var(--ink); outline-offset: -6px; }

.tl-more {
  margin: 0;
  padding: 12px 14px 14px;
  border-radius: 0 0 12px 4px;
  border-left: 8px solid var(--lc);
  background: var(--chalk);
  color: var(--ink);
  box-shadow: 5px 7px 0 rgba(0, 0, 0, 0.3);
  animation: tl-more 300ms var(--spring) both;
  transform-origin: top;
}

@keyframes tl-more {
  from { opacity: 0; transform: scaleY(0.85); }
  to   { opacity: 1; transform: none; }
}

.tl-more p { margin: 0 0 8px; font-size: 16px; line-height: 1.5; }
.tl-more-sub { font-size: 13px !important; font-weight: 800; color: var(--ink-soft); }

.tl-more-link {
  display: inline-block;
  margin: 2px 0 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--chalk);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.tl-more h3 { margin: 10px 0 8px; font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.tl-near-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

.tl-near {
  width: 100%;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  color: var(--ink);
  background: color-mix(in srgb, var(--lc) 45%, white);
  border: 0;
  border-left: 5px solid var(--lc);
  border-radius: 4px 10px 10px 4px;
  padding: 9px 12px;
  min-height: 40px;
  cursor: pointer;
}

.tl-near strong { font-weight: 800; margin-right: 4px; }

.tl-remove {
  margin: 12px 0 0;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  background: var(--c1);
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
}

/* ---- add an event ---- */

.tl-add {
  margin: 28px 0 0;
  padding: 20px 20px 22px;
  border-radius: 14px;
  background: var(--jot);
  color: var(--ink);
  box-shadow: 6px 8px 0 rgba(0, 0, 0, 0.25);
  transform: rotate(-0.6deg);
  max-width: 44em;
}

.tl-add h2 { margin: 0 0 4px; font-family: "Permanent Marker", cursive; font-weight: 400; font-size: 26px; }
.tl-add p { margin: 0 0 12px; font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.tl-add form { display: grid; grid-template-columns: 1fr; gap: 10px; }
.tl-add input, .tl-add textarea {
  font: inherit; font-size: 16px; color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  border: 2px solid rgba(28, 20, 64, 0.15);
  border-radius: 10px; padding: 10px 12px;
  width: 100%;
}
.tl-add input:focus, .tl-add textarea:focus { outline: none; border-color: var(--ink); }
.tl-add textarea { resize: vertical; min-height: 64px; }
.tl-add .pin-btn { justify-self: end; }

@media (min-width: 761px) {
  .tl-list { max-width: 720px; }
  .tl-add form { grid-template-columns: 130px 1fr; }
  .tl-add textarea, .tl-add .pin-btn { grid-column: 1 / -1; }
}

/* the narrowest phones: the lane label drops under the title instead of squeezing it */
@media (max-width: 360px) {
  .tl-card { grid-template-columns: minmax(0, 1fr); }
  .tl-lane { justify-self: start; }
}
