/* Je foto's' days (timedaylist.js, timedays.js): the list of days beside the photos of the one shown, and that day's
   head and foot. Its photos, moments and cards are timeline.css's. */
/* ---- the days beside the photos of the one shown (timedaylist.js, timedays.js): a column of days at the left, the
   day's photos on a sheet beside it, the scrapbook's paper for both. Under 760 px (a phone, a narrow window) the days
   are a row a finger scrolls sideways above the photos (below) */
.tl-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 16px;
  /* (the screen's whole width, its sides in line with the head's: on a big screen its photos grow, timeline.css
     --tl-cell) */
  width: 100%;
  padding: 0 var(--tl-pad) calc(var(--safe-bottom) + 16px);
}
/* on a big screen the days as big as the head over them (timeline.css), their column grown with them */
@media (min-width: 1600px) and (min-height: 1000px) {
  .tl-body {
    grid-template-columns: minmax(calc(240px * var(--ui)), calc(300px * var(--ui))) minmax(0, 1fr);
  }
  .tl-days {
    zoom: var(--ui);
  }
}
.tl-days,
.tl-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 12px;
  background: #fffdf9;
  box-shadow:
    0 1px 2px rgb(30 20 10 / 0.14),
    0 10px 22px -14px rgb(30 20 10 / 0.35);
}
.tl-days-head {
  padding: 14px 18px 8px;
  color: var(--quiet);
  font-size: 12.5px;
  line-height: 1.35;
  text-wrap: pretty;
}
.tl-days-title {
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tl-days-title::after {
  content: ' · ';
}
.tl-days-rows {
  flex: 1;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 0 8px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.tl-day {
  position: relative;
  border-radius: 10px;
}
.tl-day-show {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
}
.tl-day-show:hover {
  background: rgb(36 34 31 / 0.04);
}
.tl-day.is-current .tl-day-show {
  background: rgb(36 34 31 / 0.075);
}
.tl-day-show:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.tl-day-title {
  font-size: 15px;
  font-weight: 650;
  line-height: 1.25;
}
.tl-day-short {
  display: none;
}
.tl-day-facts {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--quiet);
  font-size: 12.5px;
}
.tl-day-count {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* how many of its photos have no sure date: the guess's own yellow, as on the photos' notes */
.tl-day-unsure,
.tl-date-unsure {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: linear-gradient(172deg, #ffe58a, #f2c94c 70%);
  color: #3d2f00;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.55);
}
.tl-day-photos {
  display: flex;
  gap: 4px;
  margin-top: 5px;
  overflow: hidden;
  mask-image: linear-gradient(90deg, #000 80%, transparent);
}
.tl-day-photos img {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 2px;
  object-fit: cover;
}
/* while photos are selected, Hierheen at the day's right, its words making room for it */
.tl-day-here {
  position: absolute;
  top: 10px;
  right: 10px;
  min-height: 32px;
  padding: 0 14px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  font-size: 13.5px;
  animation: tl-bar-in 0.24s var(--ease);
}
.tl-day:has(> .tl-day-here:not([hidden])) :is(.tl-day-top, .tl-day-facts) {
  padding-right: 92px;
}
/* a photo dragged over a day: the day it would take, outlined as a place to put it */
.tl-day.is-target .tl-day-show {
  outline: 2px dashed var(--text);
  outline-offset: -2px;
  background: #fff;
}
/* a day that just took photos glows a moment */
.tl-day.is-took {
  animation: tl-took 0.9s var(--ease);
}
@keyframes tl-took {
  30% {
    box-shadow: 0 0 0 3px var(--accent);
  }
}

/* the day shown: its head stays at the top while its moments scroll under it; the other days aren't laid out */
.tl-track {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-top: 8px;
}
.tl-date:not(.is-open) {
  display: none;
}
.tl-date-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  gap: 4px;
  padding: 18px 20px 12px;
  border-radius: 12px 12px 0 0;
  background: color-mix(in oklab, #fffdf9 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 rgb(36 34 31 / 0.09);
}
.tl-date-top {
  margin: 0;
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
.tl-date-place::before {
  content: ' · ';
}
.tl-date-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  color: var(--quiet);
  font-size: 13px;
}
/* the day's label is a button: a tap brings its next photo without a sure date into view, lit (timecards.js) */
.tl-date-unsure {
  border: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.5;
  cursor: pointer;
  transition:
    filter 0.15s,
    transform 0.15s var(--ease);
}
.tl-date-unsure:hover {
  filter: brightness(0.96);
}
.tl-date-unsure:active {
  transform: scale(0.96);
}
.tl-date-unsure:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tl-date-body {
  padding-bottom: 6px;
}
/* its foot: how to sort photos by hand, and the way on to the next day */
.tl-date-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 6px 20px 0;
  padding: 12px 12px 12px 16px;
  border-radius: 10px;
  background: rgb(36 34 31 / 0.045);
}
.tl-date-foot .tl-hint {
  flex: 1 1 260px;
}
.tl-date-next {
  min-height: 40px;
  gap: 6px;
}
.tl-date-next svg {
  order: 1;
}

/* a phone, a narrow window: the days a row a finger scrolls sideways over the day's photos, each a small card of
   its own, the day shown ringed; the photos' sheet runs to the screen's edges */
@container timeline (width < 760px) {
  .tl-top {
    padding-bottom: 8px;
  }
  .tl-todo-sub,
  .tl-todo-go-word {
    display: none;
  }
  .tl-todo-go-short {
    display: inline;
  }
  .tl-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
    padding: 0;
  }
  .tl-days {
    border-radius: 0;
    background: none;
    box-shadow: none;
  }
  .tl-days-head {
    display: none;
  }
  .tl-days-rows {
    display: flex;
    gap: 8px;
    padding: 3px var(--tl-pad) 6px;
    overflow: auto hidden;
    scrollbar-width: none;
  }
  .tl-day {
    flex: none;
    width: 132px;
    background: #fffdf9;
    box-shadow:
      0 1px 2px rgb(30 20 10 / 0.12),
      0 6px 14px -10px rgb(30 20 10 / 0.35);
  }
  .tl-day.is-current .tl-day-show {
    background: none;
  }
  .tl-day.is-current {
    box-shadow: 0 0 0 2px var(--accent);
  }
  .tl-day-show {
    padding: 8px 10px;
  }
  .tl-day-title {
    display: none;
  }
  .tl-day-short {
    display: inline;
    font-size: 14px;
    font-weight: 650;
  }
  .tl-day-facts {
    font-size: 12px;
  }
  .tl-day-photos img {
    width: 22px;
    height: 22px;
  }
  .tl-day-here {
    position: static;
    width: calc(100% - 16px);
    margin: 0 8px 8px;
    justify-content: center;
  }
  .tl-day:has(> .tl-day-here:not([hidden])) :is(.tl-day-top, .tl-day-facts) {
    padding-right: 0;
  }
  .tl-pane {
    border-radius: 16px 16px 0 0;
  }
  .tl-date-head {
    padding: 14px 14px 10px 16px;
    border-radius: 16px 16px 0 0;
  }
  .tl-date-top {
    font-size: 19px;
  }
  .tl-date-foot {
    margin: 6px 12px 0;
  }
}

/* a short screen (a phone held sideways): a narrower list, the days without their photos */
@media (max-height: 500px) {
  .tl-body {
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
    gap: 10px;
    padding-bottom: calc(var(--safe-bottom) + 8px);
  }
  .tl-day-photos,
  .tl-days-head {
    display: none;
  }
  .tl-day-show {
    padding: 7px 10px;
  }
  .tl-date-head {
    padding: 10px 16px 8px;
  }
  .tl-date-top {
    font-size: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tl-day.is-took,
  .tl-day-here {
    animation: none;
  }
}
